battmon2 2.0.0.0
|
API for configuring and manipulating BATT-MON 2 Click driver. More...
Topics | |
BATT-MON 2 Registers List | |
List of registers of BATT-MON 2 Click driver. | |
BATT-MON 2 Registers Settings | |
Settings for registers of BATT-MON 2 Click driver. | |
BATT-MON 2 MikroBUS Map | |
MikroBUS pin mapping of BATT-MON 2 Click driver. | |
Functions | |
void | battmon2_cfg_setup (battmon2_cfg_t *cfg) |
BATT-MON 2 configuration object setup function. | |
err_t | battmon2_init (battmon2_t *ctx, battmon2_cfg_t *cfg) |
BATT-MON 2 initialization function. | |
err_t | battmon2_generic_write (battmon2_t *ctx, uint8_t reg, uint16_t *tx_buf, uint8_t tx_len) |
BATT-MON 2 I2C writing function. | |
err_t | battmon2_generic_read (battmon2_t *ctx, uint8_t reg, uint16_t *rx_buf, uint8_t rx_len) |
BATT-MON 2 I2C reading function. | |
err_t | battmon2_write_register (battmon2_t *ctx, uint8_t reg, uint16_t data_in) |
BATT-MON 2 write register function. | |
err_t | battmon2_read_register (battmon2_t *ctx, uint8_t reg, uint16_t *data_out) |
BATT-MON 2 read register function. | |
err_t | battmon2_check_communication (battmon2_t *ctx) |
BATT-MON 2 check communication function. | |
uint8_t | battmon2_get_alert_pin (battmon2_t *ctx) |
BATT-MON 2 get alert pin function. | |
err_t | battmon2_get_die_temperature (battmon2_t *ctx, float *temperature) |
BATT-MON 2 get die temperature function. | |
err_t | battmon2_get_battery_capacity (battmon2_t *ctx, float *capacity) |
BATT-MON 2 get battery capacity function. | |
err_t | battmon2_get_battery_percentage (battmon2_t *ctx, float *percentage) |
BATT-MON 2 get battery percentage function. | |
err_t | battmon2_get_battery_voltage (battmon2_t *ctx, float *voltage) |
BATT-MON 2 get battery voltage function. | |
err_t | battmon2_get_battery_current (battmon2_t *ctx, float *current) |
BATT-MON 2 get battery current function. | |
err_t | battmon2_get_battery_tte (battmon2_t *ctx, uint32_t *time_to_empty) |
BATT-MON 2 get battery tte function. | |
err_t | battmon2_get_battery_ttf (battmon2_t *ctx, uint32_t *time_to_full) |
BATT-MON 2 get battery ttf function. | |
API for configuring and manipulating BATT-MON 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void battmon2_cfg_setup | ( | battmon2_cfg_t * | cfg | ) |
BATT-MON 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See battmon2_cfg_t object definition for detailed explanation. |
err_t battmon2_check_communication | ( | battmon2_t * | ctx | ) |
BATT-MON 2 check communication function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_generic_read | ( | battmon2_t * | ctx, |
uint8_t | reg, | ||
uint16_t * | rx_buf, | ||
uint8_t | rx_len ) |
BATT-MON 2 I2C reading function.
This function reads a desired number of data words starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_generic_write | ( | battmon2_t * | ctx, |
uint8_t | reg, | ||
uint16_t * | tx_buf, | ||
uint8_t | tx_len ) |
BATT-MON 2 I2C writing function.
This function writes a desired number of data words starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t battmon2_get_alert_pin | ( | battmon2_t * | ctx | ) |
BATT-MON 2 get alert pin function.
This function returns the alert pin logic state.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
err_t battmon2_get_battery_capacity | ( | battmon2_t * | ctx, |
float * | capacity ) |
BATT-MON 2 get battery capacity function.
This function reads the battery remaining capacity in mAh.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | capacity | : Battery capacity in mAh. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_get_battery_current | ( | battmon2_t * | ctx, |
float * | current ) |
BATT-MON 2 get battery current function.
This function reads the battery current in mA.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | current | : Current in mA. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_get_battery_percentage | ( | battmon2_t * | ctx, |
float * | percentage ) |
BATT-MON 2 get battery percentage function.
This function reads the battery remaining SOC percentage.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | percentage | : SOC percentage. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_get_battery_tte | ( | battmon2_t * | ctx, |
uint32_t * | time_to_empty ) |
BATT-MON 2 get battery tte function.
This function reads the battery estimating time to empty.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | time_to_empty | : Time to empty in seconds. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_get_battery_ttf | ( | battmon2_t * | ctx, |
uint32_t * | time_to_full ) |
BATT-MON 2 get battery ttf function.
This function reads the battery estimating time to full.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | time_to_full | : Time to full in seconds. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_get_battery_voltage | ( | battmon2_t * | ctx, |
float * | voltage ) |
BATT-MON 2 get battery voltage function.
This function reads the battery voltage in mV.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | voltage | : Voltage in mV. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_get_die_temperature | ( | battmon2_t * | ctx, |
float * | temperature ) |
BATT-MON 2 get die temperature function.
This function reads the chip internal (die) temperature.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[out] | temperature | : Temperature in Celsius. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_init | ( | battmon2_t * | ctx, |
battmon2_cfg_t * | cfg ) |
BATT-MON 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See battmon2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_read_register | ( | battmon2_t * | ctx, |
uint8_t | reg, | ||
uint16_t * | data_out ) |
BATT-MON 2 read register function.
This function reads data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battmon2_write_register | ( | battmon2_t * | ctx, |
uint8_t | reg, | ||
uint16_t | data_in ) |
BATT-MON 2 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See battmon2_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.