Zephyr Project API  3.3.0
A Scalable Open Source RTOS
Fuel Gauge Interface

Fuel Gauge Interface. More...

Data Structures

struct  fuel_gauge_get_property
 
struct  fuel_gauge_set_property
 
struct  battery_driver_api
 

Macros

#define FUEL_GAUGE_AVG_CURRENT   0
 
#define FUEL_GAUGE_CURRENT   FUEL_GAUGE_AVG_CURRENT + 1
 
#define FUEL_GAUGE_CHARGE_CUTOFF   FUEL_GAUGE_CURRENT + 1
 
#define FUEL_GAUGE_CYCLE_COUNT   FUEL_GAUGE_CHARGE_CUTOFF + 1
 
#define FUEL_GAUGE_CONNECT_STATE   FUEL_GAUGE_CYCLE_COUNT + 1
 
#define FUEL_GAUGE_FLAGS   FUEL_GAUGE_CONNECT_STATE + 1
 
#define FUEL_GAUGE_FULL_CHARGE_CAPACITY   FUEL_GAUGE_FLAGS + 1
 
#define FUEL_GAUGE_PRESENT_STATE   FUEL_GAUGE_FULL_CHARGE_CAPACITY + 1
 
#define FUEL_GAUGE_REMAINING_CAPACITY   FUEL_GAUGE_PRESENT_STATE + 1
 
#define FUEL_GAUGE_RUNTIME_TO_EMPTY   FUEL_GAUGE_REMAINING_CAPACITY + 1
 
#define FUEL_GAUGE_RUNTIME_TO_FULL   FUEL_GAUGE_RUNTIME_TO_EMPTY + 1
 
#define FUEL_GAUGE_SBS_MFR_ACCESS   FUEL_GAUGE_RUNTIME_TO_FULL + 1
 
#define FUEL_GAUGE_STATE_OF_CHARGE   FUEL_GAUGE_SBS_MFR_ACCESS + 1
 
#define FUEL_GAUGE_TEMPERATURE   FUEL_GAUGE_STATE_OF_CHARGE + 1
 
#define FUEL_GAUGE_VOLTAGE   FUEL_GAUGE_TEMPERATURE + 1
 
#define FUEL_GAUGE_COMMON_COUNT   FUEL_GAUGE_VOLTAGE + 1
 
#define FUEL_GAUGE_CUSTOM_BEGIN   FUEL_GAUGE_COMMON_COUNT + 1
 
#define FUEL_GAUGE_PROP_MAX   UINT16_MAX
 

Typedefs

typedef int(* fuel_gauge_get_property_t) (const struct device *dev, struct fuel_gauge_get_property *props, size_t props_len)
 Fetch a battery fuel-gauge property. More...
 
typedef int(* fuel_gauge_set_property_t) (const struct device *dev, struct fuel_gauge_set_property *props, size_t props_len)
 Set a battery fuel-gauge property. More...
 

Detailed Description

Fuel Gauge Interface.

Macro Definition Documentation

◆ FUEL_GAUGE_AVG_CURRENT

#define FUEL_GAUGE_AVG_CURRENT   0

#include <include/zephyr/drivers/fuel_gauge.h>

Runtime Dynamic Battery Parameters Provide a 1 minute average of the current on the battery. Does not check for flags or whether those values are bad readings. See driver instance header for details on implementation and how the average is calculated. Units in uA negative=discharging

◆ FUEL_GAUGE_CHARGE_CUTOFF

#define FUEL_GAUGE_CHARGE_CUTOFF   FUEL_GAUGE_CURRENT + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Whether the battery underlying the fuel-gauge is cut off from charge

◆ FUEL_GAUGE_COMMON_COUNT

#define FUEL_GAUGE_COMMON_COUNT   FUEL_GAUGE_VOLTAGE + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Reserved to demark end of common fuel gauge properties

◆ FUEL_GAUGE_CONNECT_STATE

#define FUEL_GAUGE_CONNECT_STATE   FUEL_GAUGE_CYCLE_COUNT + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Connect state of battery

◆ FUEL_GAUGE_CURRENT

#define FUEL_GAUGE_CURRENT   FUEL_GAUGE_AVG_CURRENT + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Battery current (uA); negative=discharging

◆ FUEL_GAUGE_CUSTOM_BEGIN

#define FUEL_GAUGE_CUSTOM_BEGIN   FUEL_GAUGE_COMMON_COUNT + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Reserved to demark downstream custom properties - use this value as the actual value may change over future versions of this API

◆ FUEL_GAUGE_CYCLE_COUNT

#define FUEL_GAUGE_CYCLE_COUNT   FUEL_GAUGE_CHARGE_CUTOFF + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Cycle count in 1/100ths (number of charge/discharge cycles)

◆ FUEL_GAUGE_FLAGS

#define FUEL_GAUGE_FLAGS   FUEL_GAUGE_CONNECT_STATE + 1

#include <include/zephyr/drivers/fuel_gauge.h>

General Error/Runtime Flags

◆ FUEL_GAUGE_FULL_CHARGE_CAPACITY

#define FUEL_GAUGE_FULL_CHARGE_CAPACITY   FUEL_GAUGE_FLAGS + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Full Charge Capacity in uAh (might change in some implementations to determine wear)

◆ FUEL_GAUGE_PRESENT_STATE

#define FUEL_GAUGE_PRESENT_STATE   FUEL_GAUGE_FULL_CHARGE_CAPACITY + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Is the battery physically present

◆ FUEL_GAUGE_PROP_MAX

#define FUEL_GAUGE_PROP_MAX   UINT16_MAX

#include <include/zephyr/drivers/fuel_gauge.h>

Reserved to demark end of valid enum properties

◆ FUEL_GAUGE_REMAINING_CAPACITY

#define FUEL_GAUGE_REMAINING_CAPACITY   FUEL_GAUGE_PRESENT_STATE + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Remaining capacity in uAh

◆ FUEL_GAUGE_RUNTIME_TO_EMPTY

#define FUEL_GAUGE_RUNTIME_TO_EMPTY   FUEL_GAUGE_REMAINING_CAPACITY + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Remaining battery life time in minutes

◆ FUEL_GAUGE_RUNTIME_TO_FULL

#define FUEL_GAUGE_RUNTIME_TO_FULL   FUEL_GAUGE_RUNTIME_TO_EMPTY + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Remaining time in minutes until battery reaches full charge

◆ FUEL_GAUGE_SBS_MFR_ACCESS

#define FUEL_GAUGE_SBS_MFR_ACCESS   FUEL_GAUGE_RUNTIME_TO_FULL + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Retrieve word from SBS1.1 ManufactuerAccess

◆ FUEL_GAUGE_STATE_OF_CHARGE

#define FUEL_GAUGE_STATE_OF_CHARGE   FUEL_GAUGE_SBS_MFR_ACCESS + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Absolute state of charge (percent, 0-100) - expressed as % of design capacity

◆ FUEL_GAUGE_TEMPERATURE

#define FUEL_GAUGE_TEMPERATURE   FUEL_GAUGE_STATE_OF_CHARGE + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Temperature in 0.1 K

◆ FUEL_GAUGE_VOLTAGE

#define FUEL_GAUGE_VOLTAGE   FUEL_GAUGE_TEMPERATURE + 1

#include <include/zephyr/drivers/fuel_gauge.h>

Battery voltage (uV)

Typedef Documentation

◆ fuel_gauge_get_property_t

typedef int(* fuel_gauge_get_property_t) (const struct device *dev, struct fuel_gauge_get_property *props, size_t props_len)

#include <include/zephyr/drivers/fuel_gauge.h>

Fetch a battery fuel-gauge property.

Parameters
devPointer to the battery fuel-gauge device
propspointer to array of fuel_gauge_get_property struct where the property struct field is set by the caller to determine what property is read from the fuel gauge device into the fuel_gauge_get_property struct's value field.
props_lennumber of properties in props array
Returns
return=0 if successful, return < 0 if getting all properties failed, return > 0 if some properties failed where return=number of failing properties.

◆ fuel_gauge_set_property_t

typedef int(* fuel_gauge_set_property_t) (const struct device *dev, struct fuel_gauge_set_property *props, size_t props_len)

#include <include/zephyr/drivers/fuel_gauge.h>

Set a battery fuel-gauge property.

Parameters
devPointer to the battery fuel-gauge device
propspointer to array of fuel_gauge_set_property struct where the property struct field is set by the caller to determine what property is written to the fuel gauge device from the fuel_gauge_get_property struct's value field.
props_lennumber of properties in props array
Returns
return=0 if successful, return < 0 if setting all properties failed, return > 0 if some properties failed where return=number of failing properties.