lc709203f.h File Reference

Device driver interface for the LC709203F Battery Fuel Gauge. More...

Detailed Description

Device driver interface for the LC709203F Battery Fuel Gauge.

Steffen Robertz
Josua Arndt

Definition in file lc709203f.h.

#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for lc709203f.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lc709203f_params_t
 Parameter struct for driver initialization. More...
struct  lc709203f_t
 Device descriptor for the fuel gauge. More...


#define LC709203F_CRC_POLYNOMIAL   0x07
 CRC Polynomial.


typedef void(* lc709203f_cb_t) (void *arg)
 Typedef for the Callback function. More...


enum  { LC709203F_OK = 0, LC709203F_NOI2C = -1, LC709203F_CELL_TEMP_INVALID = -2 }


int lc709203f_init (lc709203f_t *dev, const lc709203f_params_t *params)
 initializes the sensor and i2c More...
int16_t lc709203f_get_voltage (const lc709203f_t *dev)
 reads battery voltage from Sensor More...
int16_t lc709203f_get_rsoc (const lc709203f_t *dev)
 reads battery state of charge from Sensor More...
int16_t lc709203f_get_ite (const lc709203f_t *dev)
 reads battery indicator to empty from Sensor More...
int16_t lc709203f_get_id (const lc709203f_t *dev)
 reads Sensor id More...
int16_t lc709203f_get_cell_temp (const lc709203f_t *dev)
 reads cell temperature from sensor More...
lc709203f_temp_obtaining_mode_t lc709203f_get_status_bit (const lc709203f_t *dev)
 reads status bit register (Temperature obtaining mode) More...
lc709203f_power_mode_t lc709203f_get_power_mode (const lc709203f_t *dev)
 reads IC Power Mode register More...
int16_t lc709203f_get_alarm_low_voltage (const lc709203f_t *dev)
 reads Alarm Low Cell Voltage Register More...
int16_t lc709203f_get_alarm_low_rsoc (const lc709203f_t *dev)
 reads Alarm Low RSOC Register More...
int16_t lc709203f_get_change_of_parameter (const lc709203f_t *dev)
 reads Change of the Parameter register, Battery Profile selection More...
int16_t lc709203f_get_apt (const lc709203f_t *dev)
 reads APT (Adjustment Pack Thermistor) value to adjust temperature measurement delay timing. More...
int16_t lc709203f_get_apa (const lc709203f_t *dev)
 reads APA (Adjustment Pack Application) in 1mOhm steps value to adjust temperature measurement delay timing. More...
lc709203f_current_direction_t lc709203f_get_current_direction (const lc709203f_t *dev)
 reads Current Direction Register More...
int16_t lc709203f_get_thermistor_b (const lc709203f_t *dev)
 reads Thermistor-B register (Thermistor B constant to be measured) More...
void lc709203f_set_rsoc_before (const lc709203f_t *dev)
 Executes RSOC initialization with sampled maximum voltage. More...
void lc709203f_set_thermistor_b (const lc709203f_t *dev, const unsigned int value)
 Sets B constant of the Thermistor. More...
void lc709203f_set_rsoc_initial (const lc709203f_t *dev)
 Executes RSOC initialization. More...
int8_t lc709203f_set_cell_temp (const lc709203f_t *dev, const unsigned int value)
 Sets cell temperature in I2C-mode. More...
void lc709203f_set_current_direction (const lc709203f_t *dev, const lc709203f_current_direction_t direction)
 Sets current direction. More...
void lc709203f_set_apa (const lc709203f_t *dev, const uint8_t value)
 Sets parasitic impedance (adjustment pack application) More...
void lc709203f_set_apt (const lc709203f_t *dev, const unsigned int value)
 Sets value to adjust temperature measurement delay timing (adjusmtent pack thermistor) More...
void lc709203f_set_change_of_parameter (const lc709203f_t *dev, const lc709203f_battery_profile_t value)
 Sets battery profile. More...
void lc709203f_set_alarm_low_rsoc (const lc709203f_t *dev, const uint8_t value)
 Sets threshold for low rsoc alert. More...
void lc709203f_set_alarm_low_cell_voltage (const lc709203f_t *dev, const unsigned int value)
 Sets threshold for low cell voltage alert. More...
void lc709203f_set_power_mode (const lc709203f_t *dev, const lc709203f_power_mode_t value)
 Sets power mode. More...
void lc709203f_set_status_bit (const lc709203f_t *dev, const lc709203f_temp_obtaining_mode_t value)
 Sets temperature obtaining method. More...
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. More...
#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.