battman2 2.0.0.0
battman2.h File Reference

This file contains API for BATT-MAN 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  battman2_t
 BATT-MAN 2 Click context object. More...
 
struct  battman2_cfg_t
 BATT-MAN 2 Click configuration object. More...
 
struct  battman2_chg_cnfg_t
 BATT-MAN 2 Click charger configuration object. More...
 
struct  battman2_stat_chg_t
 BATT-MAN 2 Click charger status object. More...
 
struct  battman2_sbb_cnfg_t
 BATT-MAN 2 Click Buck and boost configuration object. More...
 
struct  battman2_ldo_cnfg_t
 BATT-MAN 2 Click LDO configuration object. More...
 

Macros

#define BATTMAN2_INT_GLBL0   0x00
 BATT-MAN 2 description register.
 
#define BATTMAN2_INT_GLBL1   0x04
 
#define BATTMAN2_ERCFLAG   0x05
 
#define BATTMAN2_STAT_GLBL   0x06
 
#define BATTMAN2_INTM_GLBL1   0x08
 
#define BATTMAN2_INTM_GLBL0   0x09
 
#define BATTMAN2_CNFG_GLBL   0x10
 
#define BATTMAN2_CNFG_GPIO0   0x11
 
#define BATTMAN2_CNFG_GPIO1   0x12
 
#define BATTMAN2_CNFG_GPIO2   0x13
 
#define BATTMAN2_CID   0x14
 
#define BATTMAN2_CNFG_WDT   0x17
 
#define BATTMAN2_INT_CHG   0x01
 
#define BATTMAN2_STAT_CHG_A   0x02
 
#define BATTMAN2_STAT_CHG_B   0x03
 
#define BATTMAN2_INT_M_CHG   0x07
 
#define BATTMAN2_CNFG_CHG_A   0x20
 
#define BATTMAN2_CNFG_CHG_B   0x21
 
#define BATTMAN2_CNFG_CHG_C   0x22
 
#define BATTMAN2_CNFG_CHG_D   0x23
 
#define BATTMAN2_CNFG_CHG_E   0x24
 
#define BATTMAN2_CNFG_CHG_F   0x25
 
#define BATTMAN2_CNFG_CHG_G   0x26
 
#define BATTMAN2_CNFG_CHG_H   0x27
 
#define BATTMAN2_CNFG_CHG_I   0x28
 
#define BATTMAN2_CNFG_SBB0_A   0x29
 
#define BATTMAN2_CNFG_SBB0_B   0x2A
 
#define BATTMAN2_CNFG_SBB1_A   0x2B
 
#define BATTMAN2_CNFG_SBB1_B   0x2C
 
#define BATTMAN2_CNFG_SBB2_A   0x2D
 
#define BATTMAN2_CNFG_SBB2_B   0x2E
 
#define BATTMAN2_CNFG_SBB_TOP   0x2F
 
#define BATTMAN2_CNFG_LDO0_A   0x38
 
#define BATTMAN2_CNFG_LDO0_B   0x39
 
#define BATTMAN2_CNFG_LDO1_A   0x3A
 
#define BATTMAN2_CNFG_LDO1_B   0x3B
 
#define BATTMAN2_SEL_LED_RED   0x00
 BATT-MAN 2 description setting.
 
#define BATTMAN2_SEL_LED_YELLOW   0x01
 
#define BATTMAN2_SEL_LED_BLUE   0x02
 
#define BATTMAN2_PIN_STATE_OFF   0x00
 
#define BATTMAN2_PIN_STATE_ON   0x01
 
#define BATTMAN2_SEL_ALT_GPIO_STANDARD   0x00
 BATT-MAN 2 GPIO configuration.
 
#define BATTMAN2_SEL_ALT_GPIO_A_OUTPUT_SBB2   0x20
 
#define BATTMAN2_DBEN_GPI_NO_DEBOUNCE   0x00
 
#define BATTMAN2_DBEN_GPI_DEBOUNCE_30_ms   0x10
 
#define BATTMAN2_DO_GPIO_LOGIC_LOW   0x00
 
#define BATTMAN2_DO_GPIO_LOGIC_HIGH   0x08
 
#define BATTMAN2_DRV_OPEN_DRAIN   0x00
 
#define BATTMAN2_DRV_PUSH_PULL   0x04
 
#define BATTMAN2_DI_GPIO_LOGIC_LOW   0x00
 
#define BATTMAN2_DI_GPIO_LOGIC_HIGH   0x02
 
#define BATTMAN2_DIR_OUTPUT   0x00
 
#define BATTMAN2_DIR_INPUT   0x01
 
#define BATTMAN2_THM_HOT_411_mV   0x00
 BATT-MAN 2 JEITA Temperature Threshold setting.
 
#define BATTMAN2_THM_HOT_367_mV   0x01
 
#define BATTMAN2_THM_HOT_327_mV   0x02
 
#define BATTMAN2_THM_HOT_291_mV   0x03
 
#define BATTMAN2_THM_WARM_511_mV   0x00
 
#define BATTMAN2_THM_WARM_459_mV   0x01
 
#define BATTMAN2_THM_WARM_411_mV   0x02
 
#define BATTMAN2_THM_WARM_367_mV   0x03
 
#define BATTMAN2_THM_COOL_923_mV   0x00
 
#define BATTMAN2_THM_COOL_867_mV   0x01
 
#define BATTMAN2_THM_COOL_807_mV   0x02
 
#define BATTMAN2_THM_COOL_747_mV   0x03
 
#define BATTMAN2_THM_COLD_1024_mV   0x00
 
#define BATTMAN2_THM_COLD_976_mV   0x01
 
#define BATTMAN2_THM_COLD_923_mV   0x02
 
#define BATTMAN2_THM_COLD_867_mV   0x03
 
#define BATTMAN2_BIT_MASK_CHARGER_DISABLE   0xFE
 BATT-MAN 2 charger enable setting.
 
#define BATTMAN2_BIT_MASK_CHARGER_ENABLE   0x01
 
#define BATTMAN2_SET_CHARGER_DISABLE   0x00
 
#define BATTMAN2_SET_CHARGER_ENABLE   0x01
 
#define BATTMAN2_I_PQ_10_PERCENTAGE   0x00
 BATT-MAN 2 prequalification charge current setting.
 
#define BATTMAN2_I_PQ_20_PERCENTAGE   0x01
 
#define BATTMAN2_I_TERM_5_PERCENTAGE   0x00
 BATT-MAN 2 Charger Termination Current setting.
 
#define BATTMAN2_I_TERM_7_5_PERCENTAGE   0x01
 
#define BATTMAN2_I_TERM_10_PERCENTAGE   0x02
 
#define BATTMAN2_I_TERM_15_PERCENTAGE   0x03
 
#define BATTMAN2_T_TOPOFF_0_MIN   0x00
 BATT-MAN 2 Top-Off Timer Value setting.
 
#define BATTMAN2_T_TOPOFF_5_MIN   0x01
 
#define BATTMAN2_T_TOPOFF_10_MIN   0x02
 
#define BATTMAN2_T_TOPOFF_15_MIN   0x03
 
#define BATTMAN2_T_TOPOFF_20_MIN   0x04
 
#define BATTMAN2_T_TOPOFF_25_MIN   0x05
 
#define BATTMAN2_T_TOPOFF_30_MIN   0x06
 
#define BATTMAN2_T_TOPOFF_35_MIN   0x07
 
#define BATTMAN2_TJ_REG_60_C   0x00
 BATT-MAN 2 die junction temperature regulation point setting.
 
#define BATTMAN2_TJ_REG_70_C   0x01
 
#define BATTMAN2_TJ_REG_80_C   0x02
 
#define BATTMAN2_TJ_REG_90_C   0x03
 
#define BATTMAN2_TJ_REG_100_C   0x04
 
#define BATTMAN2_T_FAST_CHG_TIMER_DISABLED   0x00
 BATT-MAN 2 fast-charge safety timer setting.
 
#define BATTMAN2_T_FAST_CHG_TIMER_3_HOURS   0x01
 
#define BATTMAN2_T_FAST_CHG_TIMER_5_HOURS   0x02
 
#define BATTMAN2_T_FAST_CHG_TIMER_7_HOURS   0x03
 
#define BATTMAN2_THM_EN_THERMISTOR_DISABLED   0x00
 BATT-MAN 2 Thermistor Enable setting.
 
#define BATTMAN2_THM_EN_THERMISTOR_ENABLED   0x01
 
#define BATTMAN2_USBS_CHGIN_IS_NOT_SUSPENDED   0x00
 BATT-MAN 2 CHGIN in USB suspend mode setting.
 
#define BATTMAN2_USBS_CHGIN_IS_SUSPENDED   0x01
 
#define BATTMAN2_IMON_DISCHG_SCALE_8_2_mA   0x00
 BATT-MAN 2 CHGIN in battery discharge current fullscale current setting.
 
#define BATTMAN2_IMON_DISCHG_SCALE_40_5_mA   0x01
 
#define BATTMAN2_IMON_DISCHG_SCALE_72_3_mA   0x02
 
#define BATTMAN2_IMON_DISCHG_SCALE_103_4_mA   0x03
 
#define BATTMAN2_IMON_DISCHG_SCALE_134_1_mA   0x04
 
#define BATTMAN2_IMON_DISCHG_SCALE_164_1_mA   0x05
 
#define BATTMAN2_IMON_DISCHG_SCALE_193_7_mA   0x06
 
#define BATTMAN2_IMON_DISCHG_SCALE_222_7_mA   0x07
 
#define BATTMAN2_IMON_DISCHG_SCALE_251_2_mA   0x08
 
#define BATTMAN2_IMON_DISCHG_SCALE_279_3_mA   0x09
 
#define BATTMAN2_IMON_DISCHG_SCALE_300_mA   0x0A
 
#define BATTMAN2_MUX_SEL_MULTIPLEXER_DISABLED   0x00
 BATT-MAN 2 analog channel to connect setting.
 
#define BATTMAN2_MUX_SEL_CHGIN_VOLTAGE_MONITOR   0x01
 
#define BATTMAN2_MUX_SEL_CHGIN_CURRENT_MONITOR   0x02
 
#define BATTMAN2_MUX_SEL_BATT_VOLTAGE_MONITOR   0x03
 
#define BATTMAN2_MUX_SEL_BATT_CHARGE_CURRENT_MONITOR   0x04
 
#define BATTMAN2_MUX_SEL_BATT_DISCHARGE_CURRENT_NORMAL   0x05
 
#define BATTMAN2_MUX_SEL_BATT_DISCHARGE_CURRENT_NULLING   0x06
 
#define BATTMAN2_MUX_SEL_THM_VOLTAGE_MONITOR   0x07
 
#define BATTMAN2_MUX_SEL_TBIAS_VOLTAGE_MONITOR   0x08
 
#define BATTMAN2_MUX_SEL_AGND_VOLTAGE_MONITOR   0x09
 
#define BATTMAN2_MUX_SEL_SYS_VOLTAGE_MONITOR   0x0A
 
#define BATTMAN2_OP_MODE_BUCK_AND_BOOST   0x00
 BATT-MAN 2 Operation Mode of SBB0 setting.
 
#define BATTMAN2_OP_MODE_BUCK   0x01
 
#define BATTMAN2_CURRENT_LIMIT_1000_mA   0x00
 BATT-MAN 2 SIMO Buck-Boost Peak Current Limit setting.
 
#define BATTMAN2_CURRENT_LIMIT_750_mA   0x01
 
#define BATTMAN2_CURRENT_LIMIT_500_mA   0x02
 
#define BATTMAN2_CURRENT_LIMIT_333_mA   0x03
 
#define BATTMAN2_ACTIVE_DISCHARGE_DISABLE   0x00
 BATT-MAN 2 SIMO Buck-Boost Active Discharge Enable setting.
 
#define BATTMAN2_ACTIVE_DISCHARGE_ENABLE   0x01
 
#define BATTMAN2_ENABLE_CONTROL_FPS_SLOT_0   0x00
 BATT-MAN 2 SIMO Buck-Boost FPS setting.
 
#define BATTMAN2_ENABLE_CONTROL_FPS_SLOT_1   0x01
 
#define BATTMAN2_ENABLE_CONTROL_FPS_SLOT_2   0x02
 
#define BATTMAN2_ENABLE_CONTROL_FPS_SLOT_3   0x03
 
#define BATTMAN2_ENABLE_CONTROL_OFF_IRRESPECTIVE_FPS   0x04
 
#define BATTMAN2_ENABLE_CONTROL_ON_IRRESPECTIVE_FPS   0x06
 
#define BATTMAN2_ICHGIN_LIM_95_mA   0x00
 BATT-MAN 2 Buck-Boost interpreted modes setting.
 
#define BATTMAN2_ICHGIN_LIM_190_mA   0x01
 
#define BATTMAN2_ICHGIN_LIM_285_mA   0x02
 
#define BATTMAN2_ICHGIN_LIM_380_mA   0x03
 
#define BATTMAN2_ICHGIN_LIM_475_mA   0x04
 
#define BATTMAN2_DRV_SBB_FAST_TRANSITION_TIME   0x00
 BATT-MAN 2 SIMO Buck-Boost setting.
 
#define BATTMAN2_DRV_SBB_TRANSITION_TIME_1   0x01
 
#define BATTMAN2_DRV_SBB_TRANSITION_TIME_2   0x02
 
#define BATTMAN2_DRV_SBB_TRANSITION_TIME_3   0x03
 
#define BATTMAN2_SBB_CH_0   0x00
 BATT-MAN 2 SBB Channel selection.
 
#define BATTMAN2_SBB_CH_1   0x01
 
#define BATTMAN2_SBB_CH_2   0x02
 
#define BATTMAN2_SET_DEV_ADDR   0x48
 BATT-MAN 2 device address setting.
 
#define BATTMAN2_CHG_DTLS_OFF   0x00
 BATT-MAN 2 Charger Details description register.
 
#define BATTMAN2_CHG_DTLS_PREQUALIFICATION_MODE   0x01
 
#define BATTMAN2_CHG_DTLS_FAST_CHARGE_CONSTANT_CURRENT   0x02
 
#define BATTMAN2_CHG_DTLS_JEITA_MODIFIED_FAST_CHRG_CC   0x03
 
#define BATTMAN2_CHG_DTLS_FAST_CHARGE_CONSTANT_VOLTAGE   0x04
 
#define BATTMAN2_CHG_DTLS_JEITA_MODIFIED_FAST_CHRG_CV   0x05
 
#define BATTMAN2_CHG_DTLS_TOP_OFF_MODE   0x06
 
#define BATTMAN2_CHG_DTLS_JEITA_MODIFIED_TOP_OFF_MODE   0x07
 
#define BATTMAN2_CHG_DTLS_DONE   0x08
 
#define BATTMAN2_CHG_DTLS_JEITA_MODIFIED_DONE   0x09
 
#define BATTMAN2_CHG_DTLS_PREQUALIFICATION_TIMER_FAULT   0x0A
 
#define BATTMAN2_CHG_DTLS_FAST_CHARGE_TIMER_FAULT   0x0B
 
#define BATTMAN2_CHG_DTLS_BATTERY_TEMPERATURE_FAULT   0x0C
 
#define BATTMAN2_CHG_NO_CHARGING   0x00
 BATT-MAN 2 Quick Charger Status register.
 
#define BATTMAN2_CHG_CHARGING   0x01
 
#define BATTMAN2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  battman2_return_value_t { BATTMAN2_OK = 0 , BATTMAN2_ERROR = -1 }
 BATT-MAN 2 Click return value data. More...
 

Functions

void battman2_cfg_setup (battman2_cfg_t *cfg)
 BATT-MAN 2 configuration object setup function.
 
err_t battman2_init (battman2_t *ctx, battman2_cfg_t *cfg)
 BATT-MAN 2 initialization function.
 
err_t battman2_default_cfg (battman2_t *ctx)
 BATT-MAN 2 default configuration function.
 
err_t battman2_generic_write (battman2_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 BATT-MAN 2 I2C writing function.
 
err_t battman2_generic_read (battman2_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 BATT-MAN 2 I2C reading function.
 
err_t battman2_hw_reset (battman2_t *ctx)
 BATT-MAN 2 hw reset function.
 
err_t battman2_check_int_glbl (battman2_t *ctx, uint8_t *int_glbl0, uint8_t *int_glbl1)
 BATT-MAN 2 check global interrupts function.
 
err_t battman2_check_faults_occurred (battman2_t *ctx, uint8_t *faults)
 BATT-MAN 2 check faults occurred function.
 
err_t battman2_check_stat (battman2_t *ctx, uint8_t *stat)
 BATT-MAN 2 check states function.
 
err_t battman2_set_gpio_output (battman2_t *ctx, uint8_t gpio_sel, uint8_t led_state)
 BATT-MAN 2 set gpio output state function.
 
err_t battman2_get_id (battman2_t *ctx, uint8_t *cid)
 BATT-MAN 2 get device ID function.
 
err_t battman2_set_charger_enable (battman2_t *ctx, uint8_t en_chg)
 BATT-MAN 2 set charger enable function.
 
err_t battman2_set_charger_cfg (battman2_t *ctx, battman2_chg_cnfg_t chg_cnfg)
 BATT-MAN 2 set charger configuration function.
 
err_t battman2_get_charger_cfg (battman2_t *ctx, battman2_chg_cnfg_t *chg_cnfg)
 BATT-MAN 2 get charger configuration function.
 
err_t battman2_get_chg_status (battman2_t *ctx, battman2_stat_chg_t *chg_stat)
 BATT-MAN 2 get charger status function.
 
err_t battman2_set_sbb_config (battman2_t *ctx, uint8_t sbb_sel, battman2_sbb_cnfg_t sbb_cfg)
 BATT-MAN 2 set SBB configuration function.
 
err_t battman2_get_sbb_config (battman2_t *ctx, uint8_t sbb_sel, battman2_sbb_cnfg_t *sbb_cfg)
 BATT-MAN 2 get SBB configuration function.
 
err_t battman2_set_ldo_config (battman2_t *ctx, battman2_ldo_cnfg_t ldo_cfg)
 BATT-MAN 2 set LDO configuration function.
 
err_t battman2_get_ldo_config (battman2_t *ctx, battman2_ldo_cnfg_t *ldo_cfg)
 BATT-MAN 2 get LDO configuration function.
 
uint8_t battman2_check_interrupt (battman2_t *ctx)
 BATT-MAN 2 check interrupt function.
 
void battman2_led_intro (battman2_t *ctx)
 BATT-MAN 2 LED intro function.
 

Detailed Description

This file contains API for BATT-MAN 2 Click Driver.

Enumeration Type Documentation

◆ battman2_return_value_t

BATT-MAN 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
BATTMAN2_OK 
BATTMAN2_ERROR