#ifndef _LC709203F_H__ #define _LC709203F_H__ #include #include #include "define.h" #ifdef __cplusplus extern "C" { #endif #define LC709203F_INTERVAL 3600000 #define LC709203F_ADDR 0x0B #define LC709203F_BEFORE_RSOC_REG 0x04 #define LC709203F_THERMISTOR_B_REG 0x06 #define LC709203F_INITIAL_RSOC_REG 0x07 #define LC709203F_CELL_TEMP_REG 0x08 #define LC709203F_CELL_VOLTAGE_REG 0x09 #define LC709203F_CURRENT_DIRECTION_REG 0x0A #define LC709203F_APA_REG 0x0B #define LC709203F_APT_REG 0x0C #define LC709203F_RSOC_REG 0x0D #define LC709203F_ITE_REG 0x0F #define LC709203F_VERSION_REG 0x11 #define LC709203F_PARAM_CHANGE_REG 0x12 #define LC709203F_ALARM_RSOC_REG 0x13 #define LC709203F_ALARM_CELLV_REG 0x14 #define LC709203F_POWER_MODE_REG 0x15 #define LC709203F_STATUS_BIT_REG 0x16 #define LC709203F_PARAM_NUM_REG 0x1A #define LC709203F_SLEEP_MODE 0x0002 #define LC709203F_OPERATIONAL_MODE 0x0001 #define LC709203F_I2C_MODE 0x0000 #define LC709203F_THERMISTOR_MODE 0x0001 #define LC709203F_AUTO_MODE 0x0000 #define LC709203F_CHARGE_MODE 0x0001 #define LC709203F_DISCHARGE_MODE 0xFFFF typedef struct{ uint16_t operational_mode; uint16_t apa; uint16_t bat_profile; uint16_t status_bit; uint16_t current_direction; }lc709203f_param_s; #ifdef BAT_ER2450 #define LC709203F_PARAM_DEFAULT_CONFIG \ { \ .operational_mode=LC709203F_OPERATIONAL_MODE, \ .apa=0x10, \ .bat_profile=0x0001, \ .status_bit=LC709203F_I2C_MODE, \ .current_direction=LC709203F_DISCHARGE_MODE, \ } #endif #ifdef BAT_ER18505 #define LC709203F_PARAM_DEFAULT_CONFIG \ { \ .operational_mode=LC709203F_OPERATIONAL_MODE, \ .apa=0x36, \ .bat_profile=0x0001, \ .status_bit=LC709203F_I2C_MODE, \ .current_direction=LC709203F_DISCHARGE_MODE, \ } #endif typedef struct{ uint16_t bat_percent; uint16_t bat_voltage; }lc709203f_data_s; void lc709203f_init(void); void lc709203f_read_value(void); void lc709203f_timers_init(void); extern lc709203f_data_s lc709203f_data; extern uint8_t bat_percent; #ifdef __cplusplus } #endif #endif // _LC709203F_H__ /** @} */