battman3 2.0.0.0
|
API for configuring and manipulating BATT-MAN 3 Click driver. More...
Topics | |
BATT-MAN 3 Registers List | |
List of registers of BATT-MAN 3 Click driver. | |
BATT-MAN 3 Registers Settings | |
Settings for registers of BATT-MAN 3 Click driver. | |
BATT-MAN 3 MikroBUS Map | |
MikroBUS pin mapping of BATT-MAN 3 Click driver. | |
Functions | |
void | battman3_cfg_setup (battman3_cfg_t *cfg) |
BATT-MAN 3 configuration object setup function. | |
err_t | battman3_init (battman3_t *ctx, battman3_cfg_t *cfg) |
BATT-MAN 3 initialization function. | |
err_t | battman3_default_cfg (battman3_t *ctx) |
BATT-MAN 3 default configuration function. | |
err_t | battman3_generic_write (battman3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
BATT-MAN 3 I2C writing function. | |
err_t | battman3_reg_write (battman3_t *ctx, uint8_t reg, uint8_t tx_data) |
Register writing function. | |
err_t | battman3_generic_read (battman3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
BATT-MAN 3 I2C reading function. | |
err_t | battman3_reg_read (battman3_t *ctx, uint8_t reg, uint8_t *rx_data) |
Register reading function. | |
uint8_t | battman3_get_battery_ok (battman3_t *ctx) |
Get battery OK. | |
uint8_t | battman3_get_power_good (battman3_t *ctx) |
Get power good. | |
uint8_t | battman3_get_interrupt (battman3_t *ctx) |
Get interrupt. | |
err_t | battman3_set_charge_state (battman3_t *ctx, uint8_t enable) |
Enable/Disable charging. | |
err_t | battman3_set_charge_termination_voltage (battman3_t *ctx, float voltage) |
Set charge termination voltage. | |
err_t | battman3_set_charge_voltage_threshold (battman3_t *ctx, battman3_vtrk_dead_t vtrk_dead, float vweak) |
Set charge termination voltage. | |
err_t | battman3_set_charge_vbus_current_limit (battman3_t *ctx, uint16_t current) |
Set charge current limit. | |
err_t | battman3_set_ldo_state (battman3_t *ctx, battman3_ldo_t ldo, uint8_t enable) |
Enable/Disable LDO. | |
err_t | battman3_set_ldo_vout (battman3_t *ctx, battman3_ldo_t ldo, battman3_ldo_vout_t vout) |
Set voltage output on LDO. | |
err_t | battman3_get_battery_voltage (battman3_t *ctx, float *vout) |
Read battery voltage level. | |
API for configuring and manipulating BATT-MAN 3 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void battman3_cfg_setup | ( | battman3_cfg_t * | cfg | ) |
BATT-MAN 3 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See battman3_cfg_t object definition for detailed explanation. |
err_t battman3_default_cfg | ( | battman3_t * | ctx | ) |
BATT-MAN 3 default configuration function.
This function executes a default configuration of BATT-MAN 3 click board.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t battman3_generic_read | ( | battman3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
BATT-MAN 3 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See battman3_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 battman3_generic_write | ( | battman3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
BATT-MAN 3 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See battman3_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 battman3_get_battery_ok | ( | battman3_t * | ctx | ) |
Get battery OK.
This function reads a state of the bok pin.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
err_t battman3_get_battery_voltage | ( | battman3_t * | ctx, |
float * | vout ) |
Read battery voltage level.
This function reads and calculates battery voltage.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[out] | vout | : Battery voltage. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t battman3_get_interrupt | ( | battman3_t * | ctx | ) |
Get interrupt.
This function reads a state of the int_pin pin.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
uint8_t battman3_get_power_good | ( | battman3_t * | ctx | ) |
Get power good.
This function reads a state of the pgd pin.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
err_t battman3_init | ( | battman3_t * | ctx, |
battman3_cfg_t * | cfg ) |
BATT-MAN 3 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See battman3_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t battman3_reg_read | ( | battman3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_data ) |
Register reading function.
This function reads a data from the selected register.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | rx_data | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_reg_write | ( | battman3_t * | ctx, |
uint8_t | reg, | ||
uint8_t | tx_data ) |
Register writing function.
This function writes a data to the selected register.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | tx_data | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_set_charge_state | ( | battman3_t * | ctx, |
uint8_t | enable ) |
Enable/Disable charging.
This function sets or clears 1st bit of the CHARGER_FUNCTION_SETTING1 register.
[in,out] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | enable | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_set_charge_termination_voltage | ( | battman3_t * | ctx, |
float | voltage ) |
Set charge termination voltage.
This function sets charge termination voltage.
[in,out] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | voltage | : Termination voltage in range from 3.7V to 4.5V. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_set_charge_vbus_current_limit | ( | battman3_t * | ctx, |
uint16_t | current ) |
Set charge current limit.
This function sets charge current limit on vbus pin.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | current | : Current limit in range from 100mA to 1500mA. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_set_charge_voltage_threshold | ( | battman3_t * | ctx, |
battman3_vtrk_dead_t | vtrk_dead, | ||
float | vweak ) |
Set charge termination voltage.
This function sets charge termination voltage.
[in,out] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | vtrk_dead | : Trickle to fast charge dead battery voltage. |
[in] | vweak | : Weak voltage in range from 2.7V to 3.4V. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_set_ldo_state | ( | battman3_t * | ctx, |
battman3_ldo_t | ldo, | ||
uint8_t | enable ) |
Enable/Disable LDO.
This function enable or disable LDO.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | ldo | : Select whitch LDO to change state. |
[in] | enable | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t battman3_set_ldo_vout | ( | battman3_t * | ctx, |
battman3_ldo_t | ldo, | ||
battman3_ldo_vout_t | vout ) |
Set voltage output on LDO.
This function sets voltage output on LDO.
[in] | ctx | : Click context object. See battman3_t object definition for detailed explanation. |
[in] | ldo | : Select whitch LDO. |
[in] | vout | : LDO voltage output. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.