|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Interfaces for fuel gauges. More...
Topics | |
| Devicetree battery helpers | |
| Fuel Gauge Driver Backend API | |
| Fuel gauge backend emulator APIs | |
| Fuel gauge backend emulator APIs. | |
Files | |
| file | fuel_gauge.h |
| Main header file for fuel gauge driver API. | |
Data Structures | |
| union | fuel_gauge_prop_val |
| Property field to value/type union. More... | |
| struct | sbs_gauge_manufacturer_name |
| struct | sbs_gauge_device_name |
| struct | sbs_gauge_device_chemistry |
Macros | |
| #define | SBS_GAUGE_MANUFACTURER_NAME_MAX_SIZE 20 |
| Data structures for reading SBS buffer properties. | |
| #define | SBS_GAUGE_DEVICE_NAME_MAX_SIZE 20 |
| #define | SBS_GAUGE_DEVICE_CHEMISTRY_MAX_SIZE 4 |
Typedefs | |
| typedef uint16_t | fuel_gauge_prop_t |
Functions | |
| int | fuel_gauge_get_prop (const struct device *dev, fuel_gauge_prop_t prop, union fuel_gauge_prop_val *val) |
| Fetch a battery fuel-gauge property. | |
| int | fuel_gauge_get_props (const struct device *dev, const fuel_gauge_prop_t *props, union fuel_gauge_prop_val *vals, size_t len) |
| Fetch multiple battery fuel-gauge properties. | |
| int | fuel_gauge_set_prop (const struct device *dev, fuel_gauge_prop_t prop, union fuel_gauge_prop_val val) |
| Set a battery fuel-gauge property. | |
| int | fuel_gauge_set_props (const struct device *dev, const fuel_gauge_prop_t *props, const union fuel_gauge_prop_val *vals, size_t len) |
| Set a battery fuel-gauge property. | |
| int | fuel_gauge_get_buffer_prop (const struct device *dev, fuel_gauge_prop_t prop_type, void *dst, size_t dst_len) |
| Fetch a battery fuel-gauge buffer property. | |
| int | fuel_gauge_battery_cutoff (const struct device *dev) |
| Have fuel gauge cutoff its associated battery. | |
Interfaces for fuel gauges.
| #define SBS_GAUGE_DEVICE_CHEMISTRY_MAX_SIZE 4 |
#include <zephyr/drivers/fuel_gauge.h>
| #define SBS_GAUGE_DEVICE_NAME_MAX_SIZE 20 |
#include <zephyr/drivers/fuel_gauge.h>
| #define SBS_GAUGE_MANUFACTURER_NAME_MAX_SIZE 20 |
#include <zephyr/drivers/fuel_gauge.h>
Data structures for reading SBS buffer properties.
| typedef uint16_t fuel_gauge_prop_t |
#include <zephyr/drivers/fuel_gauge.h>
| enum fuel_gauge_prop_type |
#include <zephyr/drivers/fuel_gauge.h>
| Enumerator | |
|---|---|
| FUEL_GAUGE_AVG_CURRENT_UA | 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_AVG_CURRENT |
|
| FUEL_GAUGE_CURRENT_UA | Battery current (uA); negative=discharging. |
| FUEL_GAUGE_CURRENT |
|
| FUEL_GAUGE_CHARGE_CUTOFF | Whether the battery underlying the fuel-gauge is cut off from charge. |
| FUEL_GAUGE_CYCLE_COUNT | Cycle count in 1/100ths (number of charge/discharge cycles). |
| FUEL_GAUGE_CONNECT_STATE | Connect state of battery. |
| FUEL_GAUGE_FLAGS | General Error/Runtime Flags. |
| FUEL_GAUGE_FULL_CHARGE_CAPACITY_UAH | Full Charge Capacity in uAh (might change in some implementations to determine wear). |
| FUEL_GAUGE_FULL_CHARGE_CAPACITY |
|
| FUEL_GAUGE_PRESENT_STATE | Is the battery physically present. |
| FUEL_GAUGE_REMAINING_CAPACITY_UAH | Remaining capacity in uAh. |
| FUEL_GAUGE_REMAINING_CAPACITY |
|
| FUEL_GAUGE_RUNTIME_TO_EMPTY_MINS | Remaining battery life time in minutes. |
| FUEL_GAUGE_RUNTIME_TO_EMPTY |
|
| FUEL_GAUGE_RUNTIME_TO_FULL_MINS | Remaining time in minutes until battery reaches full charge. |
| FUEL_GAUGE_RUNTIME_TO_FULL |
|
| FUEL_GAUGE_SBS_MFR_ACCESS | Retrieve word from SBS1.1 ManufacturerAccess. |
| FUEL_GAUGE_ABSOLUTE_STATE_OF_CHARGE_PCT | Absolute state of charge (percent, 0-100) - expressed as % of design capacity. |
| FUEL_GAUGE_ABSOLUTE_STATE_OF_CHARGE |
|
| FUEL_GAUGE_RELATIVE_STATE_OF_CHARGE_PCT | Relative state of charge (percent, 0-100) - expressed as % of full charge capacity. |
| FUEL_GAUGE_RELATIVE_STATE_OF_CHARGE |
|
| FUEL_GAUGE_TEMPERATURE_DK | Temperature in 0.1 K. |
| FUEL_GAUGE_TEMPERATURE |
|
| FUEL_GAUGE_VOLTAGE_UV | Battery voltage (uV). |
| FUEL_GAUGE_VOLTAGE |
|
| FUEL_GAUGE_SBS_MODE | Battery Mode (flags). |
| FUEL_GAUGE_CHARGE_CURRENT_UA | Battery desired Max Charging Current (uA). |
| FUEL_GAUGE_CHARGE_CURRENT |
|
| FUEL_GAUGE_CHARGE_VOLTAGE_UV | Battery desired Max Charging Voltage (uV). |
| FUEL_GAUGE_CHARGE_VOLTAGE |
|
| FUEL_GAUGE_STATUS | Alarm, Status and Error codes (flags). |
| FUEL_GAUGE_DESIGN_CAPACITY | Design Capacity (mAh or 10mWh). |
| FUEL_GAUGE_DESIGN_VOLTAGE_MV | Design Voltage (mV). |
| FUEL_GAUGE_DESIGN_VOLTAGE |
|
| FUEL_GAUGE_SBS_ATRATE | AtRate (mA or 10 mW). |
| FUEL_GAUGE_SBS_ATRATE_TIME_TO_FULL_MINS | AtRateTimeToFull (minutes). |
| FUEL_GAUGE_SBS_ATRATE_TIME_TO_FULL |
|
| FUEL_GAUGE_SBS_ATRATE_TIME_TO_EMPTY_MINS | AtRateTimeToEmpty (minutes). |
| FUEL_GAUGE_SBS_ATRATE_TIME_TO_EMPTY |
|
| FUEL_GAUGE_SBS_ATRATE_OK | AtRateOK (boolean). |
| FUEL_GAUGE_SBS_REMAINING_CAPACITY_ALARM | Remaining Capacity Alarm (mAh or 10mWh). |
| FUEL_GAUGE_SBS_REMAINING_TIME_ALARM_MINS | Remaining Time Alarm (minutes). |
| FUEL_GAUGE_SBS_REMAINING_TIME_ALARM |
|
| FUEL_GAUGE_MANUFACTURER_NAME | Manufacturer of pack (1 byte length + 20 bytes data). |
| FUEL_GAUGE_DEVICE_NAME | Name of pack (1 byte length + 20 bytes data). |
| FUEL_GAUGE_DEVICE_CHEMISTRY | Chemistry (1 byte length + 4 bytes data). |
| FUEL_GAUGE_CURRENT_DIRECTION | Battery current direction (flags). |
| FUEL_GAUGE_STATE_OF_CHARGE_ALARM_PCT | Remaining state of charge alarm (percent, 0-100). |
| FUEL_GAUGE_STATE_OF_CHARGE_ALARM |
|
| FUEL_GAUGE_LOW_VOLTAGE_ALARM_UV | Low Cell Voltage Alarm (uV). |
| FUEL_GAUGE_LOW_VOLTAGE_ALARM |
|
| FUEL_GAUGE_HIGH_VOLTAGE_ALARM_UV | High Cell Voltage Alarm (uV). |
| FUEL_GAUGE_HIGH_VOLTAGE_ALARM |
|
| FUEL_GAUGE_LOW_CURRENT_ALARM_UA | Low Cell Current Alarm (uA). |
| FUEL_GAUGE_LOW_CURRENT_ALARM |
|
| FUEL_GAUGE_HIGH_CURRENT_ALARM_UA | High Cell Current Alarm (uA). |
| FUEL_GAUGE_HIGH_CURRENT_ALARM |
|
| FUEL_GAUGE_LOW_TEMPERATURE_ALARM_DK | Low Cell Temperature Alarm (dK). |
| FUEL_GAUGE_LOW_TEMPERATURE_ALARM |
|
| FUEL_GAUGE_HIGH_TEMPERATURE_ALARM_DK | High Cell Temperature Alarm (dK). |
| FUEL_GAUGE_HIGH_TEMPERATURE_ALARM |
|
| FUEL_GAUGE_LOW_GPIO_ALARM_UV | Low GPIO Voltage Alarm (uV). |
| FUEL_GAUGE_LOW_GPIO_ALARM |
|
| FUEL_GAUGE_HIGH_GPIO_ALARM_UV | High GPIO Voltage Alarm (uV). |
| FUEL_GAUGE_HIGH_GPIO_ALARM |
|
| FUEL_GAUGE_GPIO_VOLTAGE_UV | GPIO Voltage (uV). |
| FUEL_GAUGE_GPIO_VOLTAGE |
|
| FUEL_GAUGE_ADC_MODE | ADC Mode (flags). |
| FUEL_GAUGE_CC_CONFIG | Coulomb Counter Config (flags). |
| FUEL_GAUGE_STATE_OF_HEALTH | State of Health (SoH) (percent, 0-100). |
| FUEL_GAUGE_THERM_VOLTAGE_UV | Thermistor Voltage Sense reading (uV). |
| FUEL_GAUGE_COMMON_COUNT | Reserved to demark end of common fuel gauge properties. |
| FUEL_GAUGE_CUSTOM_BEGIN | Reserved to demark downstream custom properties - use this value as the actual value may change over future versions of this API. |
| FUEL_GAUGE_PROP_MAX | Reserved to demark end of valid enum properties. |
| int fuel_gauge_battery_cutoff | ( | const struct device * | dev | ) |
#include <zephyr/drivers/fuel_gauge.h>
Have fuel gauge cutoff its associated battery.
| dev | Pointer to the battery fuel-gauge device |
| int fuel_gauge_get_buffer_prop | ( | const struct device * | dev, |
| fuel_gauge_prop_t | prop_type, | ||
| void * | dst, | ||
| size_t | dst_len ) |
#include <zephyr/drivers/fuel_gauge.h>
Fetch a battery fuel-gauge buffer property.
| dev | Pointer to the battery fuel-gauge device |
| prop_type | Type of property to be fetched from device |
| dst | byte array or struct that will hold the buffer data that is read from the fuel gauge |
| dst_len | the length of the destination array in bytes |
| int fuel_gauge_get_prop | ( | const struct device * | dev, |
| fuel_gauge_prop_t | prop, | ||
| union fuel_gauge_prop_val * | val ) |
#include <zephyr/drivers/fuel_gauge.h>
Fetch a battery fuel-gauge property.
| dev | Pointer to the battery fuel-gauge device |
| prop | Type of property to be fetched from device |
| val | pointer to a union fuel_gauge_prop_val where the property is read into from the fuel gauge device. |
| int fuel_gauge_get_props | ( | const struct device * | dev, |
| const fuel_gauge_prop_t * | props, | ||
| union fuel_gauge_prop_val * | vals, | ||
| size_t | len ) |
#include <zephyr/drivers/fuel_gauge.h>
Fetch multiple battery fuel-gauge properties.
The default implementation is the same as calling fuel_gauge_get_prop() multiple times. A driver may implement the get_properties field of the fuel gauge driver APIs struct to override this implementation.
| dev | Pointer to the battery fuel-gauge device |
| props | Array of the type of property to be fetched from device, each index corresponds to the same index of the vals input array. |
| vals | Pointer to array of union fuel_gauge_prop_val where the property is read into from the fuel gauge device. The vals array is not permuted. |
| len | number of properties in props & vals array |
| int fuel_gauge_set_prop | ( | const struct device * | dev, |
| fuel_gauge_prop_t | prop, | ||
| union fuel_gauge_prop_val | val ) |
#include <zephyr/drivers/fuel_gauge.h>
Set a battery fuel-gauge property.
| dev | Pointer to the battery fuel-gauge device |
| prop | Type of property that's being set |
| val | Value to set associated prop property. |
| int fuel_gauge_set_props | ( | const struct device * | dev, |
| const fuel_gauge_prop_t * | props, | ||
| const union fuel_gauge_prop_val * | vals, | ||
| size_t | len ) |
#include <zephyr/drivers/fuel_gauge.h>
Set a battery fuel-gauge property.
| dev | Pointer to the battery fuel-gauge device |
| props | Array of the type of property to be set, each index corresponds to the same index of the vals input array. |
| vals | Pointer to array of union fuel_gauge_prop_val where the property is written the fuel gauge device. The vals array is not permuted. |
| len | number of properties in props array |