battmon 2.0.0.0
|
Functions | |
void | battmon_cfg_setup (battmon_cfg_t *cfg) |
Config Object Initialization function. | |
BATTMON_RETVAL | battmon_init (battmon_t *ctx, battmon_cfg_t *cfg) |
Initialization function. | |
void | battmon_default_cfg (battmon_t *ctx) |
Click Default Configuration function. | |
void | battmon_generic_write (battmon_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len) |
Generic write function. | |
void | battmon_generic_read (battmon_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len) |
Generic read function. | |
uint8_t | battmon_read_bytes (battmon_t *ctx, uint8_t reg_addr, uint8_t *data_out, uint8_t n_bytes) |
Bytes Read function. | |
uint8_t | battmon_read_word (battmon_t *ctx, uint8_t reg_addr, uint16_t *data_out) |
Word Read function. | |
uint8_t | battmon_write_byte (battmon_t *ctx, uint8_t reg_addr, uint8_t data_in) |
Byte Write function. | |
uint8_t | battmon_write_word (battmon_t *ctx, uint8_t reg_addr, uint16_t data_in) |
Word Write function. | |
float | battmon_get_data (battmon_t *ctx, uint8_t data_addr) |
Data Get function. | |
uint8_t | battmon_set_alarm (battmon_t *ctx, uint8_t alarm_addr, float alarm_value) |
Alarm Set function. | |
uint8_t | battmon_get_rio_pin (battmon_t *ctx) |
RIO Pin Get function. | |
uint8_t | battmon_get_alm_pin (battmon_t *ctx) |
ALM Pin Get function. | |
uint8_t | battmon_check_clear_alarm (battmon_t *ctx) |
Alarm Check And Clear function. | |
void | battmon_sw_reset (battmon_t *ctx) |
SW Reset function. | |
void | battmon_reset_conv_cnt (battmon_t *ctx) |
Conversion Counter Reset function. | |
void battmon_cfg_setup | ( | battmon_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
uint8_t battmon_check_clear_alarm | ( | battmon_t * | ctx | ) |
Alarm Check And Clear function.
ctx | Click object. |
@description This function allows user to check status of the low-SOC and low-voltage conditions.
void battmon_default_cfg | ( | battmon_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
Set: BATTMON_REG_MODE - BATTMON_MIXED_MODE | - BATTMON_ALM_EN | - BATTMON_OP_RUN_MODE Set: BATTMON_REG_CTRL - BATTMON_RST_CONV_CNT | - BATTMON_DRIVE_ALM_PIN_COND Set: BATTMON_REG_ALARM_SOC - 1 Set: BATTMON_REG_ALARM_VOLTAGE - 3000 *@description This function executes default configuration for BattMon click.
void battmon_generic_read | ( | battmon_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic read function.
ctx | Click object. |
reg | Register address. |
data_buf | Output data buf |
len | Number of the bytes to be read |
@description This function reads data from the desired register.
void battmon_generic_write | ( | battmon_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic write function.
ctx | Click object. |
reg | Register address. |
data_buf | Data buf to be written. |
len | Number of the bytes in data buf. |
@description This function writes data to the desired register.
uint8_t battmon_get_alm_pin | ( | battmon_t * | ctx | ) |
ALM Pin Get function.
ctx | Click object. |
@description This function allows user to check state of the ALM pin.
float battmon_get_data | ( | battmon_t * | ctx, |
uint8_t | data_addr ) |
Data Get function.
ctx | Click object. |
data_addr | Address of data to be read |
This function allows user to get the desired data calculated to the properly unit.
If data address is invalid, the function will return 0. Data unit to be calculated: SOC [%] Counter [sec] Current [mA] Voltage [mV] Temperature [Celsius degrees] *
uint8_t battmon_get_rio_pin | ( | battmon_t * | ctx | ) |
RIO Pin Get function.
ctx | Click object. |
@description This function allows user to check state of the RIO pin.
BATTMON_RETVAL battmon_init | ( | battmon_t * | ctx, |
battmon_cfg_t * | cfg ) |
Initialization function.
battmon | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
uint8_t battmon_read_bytes | ( | battmon_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t * | data_out, | ||
uint8_t | n_bytes ) |
Bytes Read function.
ctx | Click object. |
reg_addr | Address which from data reading be started |
dataOut | Memory where data be stored |
n_bytes | Number of bytes to be read |
@description This function reads the desired number of bytes starting from the selected register.
uint8_t battmon_read_word | ( | battmon_t * | ctx, |
uint8_t | reg_addr, | ||
uint16_t * | data_out ) |
Word Read function.
ctx | Click object. |
reg_addr | Address which from data be read |
data_out | Memory where data be stored |
@description This function reads 16bit data from the selected register.
void battmon_reset_conv_cnt | ( | battmon_t * | ctx | ) |
Conversion Counter Reset function.
ctx | Click object. |
@description This function allows user to reset the conversion counter.
uint8_t battmon_set_alarm | ( | battmon_t * | ctx, |
uint8_t | alarm_addr, | ||
float | alarm_value ) |
Alarm Set function.
ctx | Click object. |
alarm_addr | Address of alarm to be set |
alarm_value | Alarm value to be set |
@description This function allows user to set alarm registers to the desired value.
void battmon_sw_reset | ( | battmon_t * | ctx | ) |
SW Reset function.
ctx | Click object. |
@description This function performs a device SW reset and waits until reset operation was done.
uint8_t battmon_write_byte | ( | battmon_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t | data_in ) |
Byte Write function.
ctx | Click object. |
reg_addr | Address where data be written |
data_in | Data to be written |
@description This function writes one byte data to the selected register.
uint8_t battmon_write_word | ( | battmon_t * | ctx, |
uint8_t | reg_addr, | ||
uint16_t | data_in ) |
Word Write function.
ctx | Click object. |
reg_addr | Address where data be written |
data_in | Data to be written |
@description This function writes 16bit data to the selected register.