Device driver interface for the LC709203F Battery Fuel Gauge. More...
Device driver interface for the LC709203F Battery Fuel Gauge.
Files | |
file | lc709203f.h |
Device driver interface for the LC709203F Battery Fuel Gauge. | |
Data Structures | |
struct | lc709203f_params_t |
Parameter struct for driver initialization. More... | |
struct | lc709203f_t |
Device descriptor for the fuel gauge. More... | |
Macros | |
#define | LC709203F_CRC_POLYNOMIAL 0x07 |
CRC Polynomial. | |
Typedefs | |
typedef void(* | lc709203f_cb_t) (void *arg) |
Typedef for the Callback function. | |
Enumerations | |
enum | { LC709203F_OK = 0 , LC709203F_NOI2C = -1 , LC709203F_CELL_TEMP_INVALID = -2 } |
Functions | |
int | lc709203f_init (lc709203f_t *dev, const lc709203f_params_t *params) |
initializes the sensor and i2c | |
int16_t | lc709203f_get_voltage (const lc709203f_t *dev) |
reads battery voltage from Sensor | |
int16_t | lc709203f_get_rsoc (const lc709203f_t *dev) |
reads battery state of charge from Sensor | |
int16_t | lc709203f_get_ite (const lc709203f_t *dev) |
reads battery indicator to empty from Sensor | |
int16_t | lc709203f_get_id (const lc709203f_t *dev) |
reads Sensor id | |
int16_t | lc709203f_get_cell_temp (const lc709203f_t *dev) |
reads cell temperature from sensor | |
lc709203f_temp_obtaining_mode_t | lc709203f_get_status_bit (const lc709203f_t *dev) |
reads status bit register (Temperature obtaining mode) | |
lc709203f_power_mode_t | lc709203f_get_power_mode (const lc709203f_t *dev) |
reads IC Power Mode register | |
int16_t | lc709203f_get_alarm_low_voltage (const lc709203f_t *dev) |
reads Alarm Low Cell Voltage Register | |
int16_t | lc709203f_get_alarm_low_rsoc (const lc709203f_t *dev) |
reads Alarm Low RSOC Register | |
int16_t | lc709203f_get_change_of_parameter (const lc709203f_t *dev) |
reads Change of the Parameter register, Battery Profile selection | |
int16_t | lc709203f_get_apt (const lc709203f_t *dev) |
reads APT (Adjustment Pack Thermistor) value to adjust temperature measurement delay timing. | |
int16_t | lc709203f_get_apa (const lc709203f_t *dev) |
reads APA (Adjustment Pack Application) in 1mOhm steps value to adjust temperature measurement delay timing. | |
lc709203f_current_direction_t | lc709203f_get_current_direction (const lc709203f_t *dev) |
reads Current Direction Register | |
int16_t | lc709203f_get_thermistor_b (const lc709203f_t *dev) |
reads Thermistor-B register (Thermistor B constant to be measured) | |
void | lc709203f_set_rsoc_before (const lc709203f_t *dev) |
Executes RSOC initialization with sampled maximum voltage. | |
void | lc709203f_set_thermistor_b (const lc709203f_t *dev, const unsigned int value) |
Sets B constant of the Thermistor. | |
void | lc709203f_set_rsoc_initial (const lc709203f_t *dev) |
Executes RSOC initialization. | |
int8_t | lc709203f_set_cell_temp (const lc709203f_t *dev, const unsigned int value) |
Sets cell temperature in I2C-mode. | |
void | lc709203f_set_current_direction (const lc709203f_t *dev, const lc709203f_current_direction_t direction) |
Sets current direction. | |
void | lc709203f_set_apa (const lc709203f_t *dev, const uint8_t value) |
Sets parasitic impedance (adjustment pack application) | |
void | lc709203f_set_apt (const lc709203f_t *dev, const unsigned int value) |
Sets value to adjust temperature measurement delay timing (adjusmtent pack thermistor) | |
void | lc709203f_set_change_of_parameter (const lc709203f_t *dev, const lc709203f_battery_profile_t value) |
Sets battery profile. | |
void | lc709203f_set_alarm_low_rsoc (const lc709203f_t *dev, const uint8_t value) |
Sets threshold for low rsoc alert. | |
void | lc709203f_set_alarm_low_cell_voltage (const lc709203f_t *dev, const unsigned int value) |
Sets threshold for low cell voltage alert. | |
void | lc709203f_set_power_mode (const lc709203f_t *dev, const lc709203f_power_mode_t value) |
Sets power mode. | |
void | lc709203f_set_status_bit (const lc709203f_t *dev, const lc709203f_temp_obtaining_mode_t value) |
Sets temperature obtaining method. | |
enum | lc709203f_current_direction_t { AUTO_MODE = 0x0 , CHARGE_MODE = 0x1 , DISCHARGE_MODE = 0xffff } |
Current direction modes. More... | |
enum | lc709203f_battery_profile_t { BAT_PROFILE_1 = 0 , BAT_PROFILE_2 = 1 } |
Battery Profile Options. More... | |
enum | lc709203f_power_mode_t { OPERATIONAL_MODE = 1 , SLEEP_MODE = 2 } |
Power mode choices. More... | |
enum | lc709203f_temp_obtaining_mode_t { I2C_MODE = 0 , THERMISTOR_MODE = 1 } |
Temperature obtaining mode options. More... | |
#define | LC709203F_REG_CELL_VOLTAGE 0x09 |
Register Addresses. | |
#define | LC709203F_REG_RSOC 0x0d |
Register RSOC (Relative State of Charge) | |
#define | LC709203F_REG_ITE 0x0f |
Register ITE (Indicator To Empty) | |
#define | LC709203F_REG_ID 0x11 |
Register IC Version. | |
#define | LC709203F_REG_CELL_TEMP 0x08 |
Register Cell Temperature. | |
#define | LC709203F_REG_STATUS 0x16 |
Register Status Bit. | |
#define | LC709203F_REG_POWER_MODE 0x15 |
Register IC Power Mode. | |
#define | LC709203F_REG_ALARM_VOLTAGE 0x14 |
Register Alarm Low Cell Voltage. | |
#define | LC709203F_REG_ALARM_RSOC 0x13 |
Register Alarm Low RSOC. | |
#define | LC709203F_REG_CHANGE_PARAMETER 0x12 |
Register Change of the parameter. | |
#define | LC709203F_REG_APT 0x0c |
Register APT (Adjustment Pack Thermistor) | |
#define | LC709203F_REG_APA 0x0b |
Register APA (Adjustment Pack Application) | |
#define | LC709203F_REG_CURRENT_DIRECTION 0x0a |
Register Current Direction. | |
#define | LC709203F_REG_THERMISTOR 0x06 |
Register Thermistor B. | |
#define | LC709203F_REG_BEFORE_RSOC 0x04 |
Register Before RSOC. | |
#define | LC709203F_REG_INITIAL_RSOC 0x07 |
Register Initial RSOC. | |
#define LC709203F_CRC_POLYNOMIAL 0x07 |
CRC Polynomial.
Definition at line 139 of file lc709203f.h.
#define LC709203F_REG_ALARM_RSOC 0x13 |
Register Alarm Low RSOC.
Definition at line 129 of file lc709203f.h.
#define LC709203F_REG_ALARM_VOLTAGE 0x14 |
Register Alarm Low Cell Voltage.
Definition at line 128 of file lc709203f.h.
#define LC709203F_REG_APA 0x0b |
Register APA (Adjustment Pack Application)
Definition at line 132 of file lc709203f.h.
#define LC709203F_REG_APT 0x0c |
Register APT (Adjustment Pack Thermistor)
Definition at line 131 of file lc709203f.h.
#define LC709203F_REG_BEFORE_RSOC 0x04 |
Register Before RSOC.
Definition at line 135 of file lc709203f.h.
#define LC709203F_REG_CELL_TEMP 0x08 |
Register Cell Temperature.
Definition at line 125 of file lc709203f.h.
#define LC709203F_REG_CELL_VOLTAGE 0x09 |
Register Addresses.
For more information on the registers and its functions see the datasheet Register Cell Voltage
Definition at line 121 of file lc709203f.h.
#define LC709203F_REG_CHANGE_PARAMETER 0x12 |
Register Change of the parameter.
Definition at line 130 of file lc709203f.h.
#define LC709203F_REG_CURRENT_DIRECTION 0x0a |
Register Current Direction.
Definition at line 133 of file lc709203f.h.
#define LC709203F_REG_ID 0x11 |
Register IC Version.
Definition at line 124 of file lc709203f.h.
#define LC709203F_REG_INITIAL_RSOC 0x07 |
Register Initial RSOC.
Definition at line 136 of file lc709203f.h.
#define LC709203F_REG_ITE 0x0f |
Register ITE (Indicator To Empty)
Definition at line 123 of file lc709203f.h.
#define LC709203F_REG_POWER_MODE 0x15 |
Register IC Power Mode.
Definition at line 127 of file lc709203f.h.
#define LC709203F_REG_RSOC 0x0d |
Register RSOC (Relative State of Charge)
Definition at line 122 of file lc709203f.h.
#define LC709203F_REG_STATUS 0x16 |
Register Status Bit.
Definition at line 126 of file lc709203f.h.
#define LC709203F_REG_THERMISTOR 0x06 |
Register Thermistor B.
Definition at line 134 of file lc709203f.h.
typedef void(* lc709203f_cb_t) (void *arg) |
Typedef for the Callback function.
A function of this type will be called when an Interrupt is triggered on low RSOC or Voltage
[in] | arg | Additional Arguments that will be passed to the function |
Definition at line 82 of file lc709203f.h.
anonymous enum |
Enumerator | |
---|---|
LC709203F_OK | all went as expected |
LC709203F_NOI2C | error using the I2C bus |
LC709203F_CELL_TEMP_INVALID | Cell temp invalid. |
Definition at line 95 of file lc709203f.h.
Battery Profile Options.
For more details please see the datasheet (http://www.onsemi.com/pub/Collateral/LC709203F-D.PDF)
Definition at line 49 of file lc709203f.h.
Current direction modes.
For more details please see the datasheet (http://www.onsemi.com/pub/Collateral/LC709203F-D.PDF)
Definition at line 37 of file lc709203f.h.
Power mode choices.
For more details please see the datasheet (http://www.onsemi.com/pub/Collateral/LC709203F-D.PDF)
Definition at line 60 of file lc709203f.h.
Temperature obtaining mode options.
For more details please see the datasheet (http://www.onsemi.com/pub/Collateral/LC709203F-D.PDF)
Definition at line 71 of file lc709203f.h.
int16_t lc709203f_get_alarm_low_rsoc | ( | const lc709203f_t * | dev | ) |
reads Alarm Low RSOC Register
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_alarm_low_voltage | ( | const lc709203f_t * | dev | ) |
reads Alarm Low Cell Voltage Register
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_apa | ( | const lc709203f_t * | dev | ) |
reads APA (Adjustment Pack Application) in 1mOhm steps value to adjust temperature measurement delay timing.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_apt | ( | const lc709203f_t * | dev | ) |
reads APT (Adjustment Pack Thermistor) value to adjust temperature measurement delay timing.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_cell_temp | ( | const lc709203f_t * | dev | ) |
reads cell temperature from sensor
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_change_of_parameter | ( | const lc709203f_t * | dev | ) |
reads Change of the Parameter register, Battery Profile selection
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
lc709203f_current_direction_t lc709203f_get_current_direction | ( | const lc709203f_t * | dev | ) |
reads Current Direction Register
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_id | ( | const lc709203f_t * | dev | ) |
reads Sensor id
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_ite | ( | const lc709203f_t * | dev | ) |
reads battery indicator to empty from Sensor
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
lc709203f_power_mode_t lc709203f_get_power_mode | ( | const lc709203f_t * | dev | ) |
reads IC Power Mode register
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_rsoc | ( | const lc709203f_t * | dev | ) |
reads battery state of charge from Sensor
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
lc709203f_temp_obtaining_mode_t lc709203f_get_status_bit | ( | const lc709203f_t * | dev | ) |
reads status bit register (Temperature obtaining mode)
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_thermistor_b | ( | const lc709203f_t * | dev | ) |
reads Thermistor-B register (Thermistor B constant to be measured)
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int16_t lc709203f_get_voltage | ( | const lc709203f_t * | dev | ) |
reads battery voltage from Sensor
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
int lc709203f_init | ( | lc709203f_t * | dev, |
const lc709203f_params_t * | params | ||
) |
initializes the sensor and i2c
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | *params | pointer to lc709203f_param_t struct containing the interrupt pin and callback |
void lc709203f_set_alarm_low_cell_voltage | ( | const lc709203f_t * | dev, |
const unsigned int | value | ||
) |
Sets threshold for low cell voltage alert.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | alert threshold in 1mV steps |
void lc709203f_set_alarm_low_rsoc | ( | const lc709203f_t * | dev, |
const uint8_t | value | ||
) |
Sets threshold for low rsoc alert.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | alert threshold (0-100%) |
void lc709203f_set_apa | ( | const lc709203f_t * | dev, |
const uint8_t | value | ||
) |
Sets parasitic impedance (adjustment pack application)
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | impedance in 1mOhm steps |
void lc709203f_set_apt | ( | const lc709203f_t * | dev, |
const unsigned int | value | ||
) |
Sets value to adjust temperature measurement delay timing (adjusmtent pack thermistor)
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | adjustment value |
int8_t lc709203f_set_cell_temp | ( | const lc709203f_t * | dev, |
const unsigned int | value | ||
) |
Sets cell temperature in I2C-mode.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | temp in 0.1K 0xAAC=0°C |
void lc709203f_set_change_of_parameter | ( | const lc709203f_t * | dev, |
const lc709203f_battery_profile_t | value | ||
) |
Sets battery profile.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | profile (enum) BAT_PROFILE_1 BAT_PROFILE_2 |
void lc709203f_set_current_direction | ( | const lc709203f_t * | dev, |
const lc709203f_current_direction_t | direction | ||
) |
Sets current direction.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | direction | current direction, AUTO_MODE, CHARGE_MODE, DISCHARGE_MODE |
void lc709203f_set_power_mode | ( | const lc709203f_t * | dev, |
const lc709203f_power_mode_t | value | ||
) |
Sets power mode.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | Power mode (enum) OPERATIONAL_MODE, SLEEP_MODE |
void lc709203f_set_rsoc_before | ( | const lc709203f_t * | dev | ) |
Executes RSOC initialization with sampled maximum voltage.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
void lc709203f_set_rsoc_initial | ( | const lc709203f_t * | dev | ) |
Executes RSOC initialization.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
void lc709203f_set_status_bit | ( | const lc709203f_t * | dev, |
const lc709203f_temp_obtaining_mode_t | value | ||
) |
Sets temperature obtaining method.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | method to be used (enum) I2C_MODE, THERMISTOR_MODE |
void lc709203f_set_thermistor_b | ( | const lc709203f_t * | dev, |
const unsigned int | value | ||
) |
Sets B constant of the Thermistor.
[in] | *dev | pointer to lc709203f_t struct containing the i2c device and the address |
[in] | value | Bconstant of thermistor |