Loading...
Searching...
No Matches
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.

Author
Steffen Robertz steff.nosp@m.en.r.nosp@m.obert.nosp@m.z@rw.nosp@m.th-aa.nosp@m.chen.nosp@m..de
Josua Arndt jarnd.nosp@m.t@ia.nosp@m.s.rwt.nosp@m.h-aa.nosp@m.chen..nosp@m.de

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...
 

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.
 
#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.
 
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...