balancer4 2.0.0.0
balancer4.h File Reference

This file contains API for Balancer 4 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  balancer4_t
 Balancer 4 Click context object. More...
 
struct  balancer4_cfg_t
 Balancer 4 Click configuration object. More...
 

Macros

#define BALANCER4_REG_CONFIG0   0x00
 Balancer 4 Register Map.
 
#define BALANCER4_REG_CONFIG1   0x01
 
#define BALANCER4_REG_TIMER   0x02
 
#define BALANCER4_REG_STATUS   0x03
 
#define BALANCER4_REG_FAULT   0x04
 
#define BALANCER4_CONFIG0_VBAT_REG_8p3V   0x00
 Balancer 4 config 0 register setting.
 
#define BALANCER4_CONFIG0_VBAT_REG_8p4V   0x20
 
#define BALANCER4_CONFIG0_VBAT_REG_8p5V   0x40
 
#define BALANCER4_CONFIG0_VBAT_REG_8p6V   0x60
 
#define BALANCER4_CONFIG0_VBAT_REG_8p7V   0x80
 
#define BALANCER4_CONFIG0_VBAT_REG_8p8V   0xA0
 
#define BALANCER4_CONFIG0_VBAT_REG_8p9V   0xC0
 
#define BALANCER4_CONFIG0_VBAT_REG_8p2V   0xE0
 
#define BALANCER4_CONFIG0_CHARGING_DIS   0x00
 
#define BALANCER4_CONFIG0_CHARGING_EN   0x10
 
#define BALANCER4_CONFIG0_VBAT_PRE_6V   0x00
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p1V   0x02
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p2V   0x04
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p3V   0x06
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p4V   0x08
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p5V   0x0A
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p6V   0x0C
 
#define BALANCER4_CONFIG0_VBAT_PRE_6p7V   0x0E
 
#define BALANCER4_CONFIG0_CELL_OVP_HYS_80mV   0x00
 
#define BALANCER4_CONFIG0_CELL_OVP_HYS_0mV   0x01
 
#define BALANCER4_CONFIG1_NTC_TYPE_STANDARD   0x00
 Balancer 4 config 1 register setting.
 
#define BALANCER4_CONFIG1_NTC_TYPE_JEITA   0x80
 
#define BALANCER4_CONFIG1_VCELL_BAL_3p5V   0x00
 
#define BALANCER4_CONFIG1_VCELL_BAL_3p7V   0x40
 
#define BALANCER4_CONFIG1_BAL_THD_H2L_50mV   0x00
 
#define BALANCER4_CONFIG1_BAL_THD_H2L_70mV   0x20
 
#define BALANCER4_CONFIG1_BAL_THD_L2H_50mV   0x00
 
#define BALANCER4_CONFIG1_BAL_THD_L2H_70mV   0x10
 
#define BALANCER4_CONFIG1_ICC_250mA   0x00
 
#define BALANCER4_CONFIG1_ICC_300mA   0x01
 
#define BALANCER4_CONFIG1_ICC_350mA   0x02
 
#define BALANCER4_CONFIG1_ICC_400mA   0x03
 
#define BALANCER4_CONFIG1_ICC_450mA   0x04
 
#define BALANCER4_CONFIG1_ICC_500mA   0x05
 
#define BALANCER4_CONFIG1_ICC_550mA   0x06
 
#define BALANCER4_CONFIG1_ICC_600mA   0x07
 
#define BALANCER4_CONFIG1_ICC_650mA   0x08
 
#define BALANCER4_CONFIG1_ICC_700mA   0x09
 
#define BALANCER4_CONFIG1_ICC_750mA   0x0A
 
#define BALANCER4_CONFIG1_ICC_800mA   0x0B
 
#define BALANCER4_CONFIG1_ICC_850mA   0x0C
 
#define BALANCER4_CONFIG1_ICC_900mA   0x0D
 
#define BALANCER4_CONFIG1_ICC_950mA   0x0E
 
#define BALANCER4_CONFIG1_ICC_1000mA   0x0F
 
#define BALANCER4_TIMER_FSW_600KHZ   0x00
 Balancer 4 timer register setting.
 
#define BALANCER4_TIMER_FSW_1200KHZ   0x80
 
#define BALANCER4_TIMER_I2C_WD_TIMER_NORMAL   0x00
 
#define BALANCER4_TIMER_I2C_WD_TIMER_RESET   0x40
 
#define BALANCER4_TIMER_WD_TIMER_DIS   0x00
 
#define BALANCER4_TIMER_WD_TIMER_40S   0x10
 
#define BALANCER4_TIMER_WD_TIMER_80S   0x20
 
#define BALANCER4_TIMER_WD_TIMER_160S   0x30
 
#define BALANCER4_TIMER_REGISTER_KEEP   0x00
 
#define BALANCER4_TIMER_REGISTER_RESET   0x08
 
#define BALANCER4_TIMER_CHG_TIMER_DIS   0x00
 
#define BALANCER4_TIMER_CHG_TIMER_8H   0x02
 
#define BALANCER4_TIMER_CHG_TIMER_20H   0x04
 
#define BALANCER4_TIMER_CHG_TIMER_12H   0x06
 
#define BALANCER4_TIMER_EN_SUSP_BOOST_DIS   0x00
 
#define BALANCER4_TIMER_EN_SUSP_BOOST_EN   0x01
 
#define BALANCER4_STATUS_NOT_CHARGING   0x00
 Balancer 4 status register setting.
 
#define BALANCER4_STATUS_PRE_CHARGE   0x10
 
#define BALANCER4_STATUS_CONSTANT_CHARGE   0x20
 
#define BALANCER4_STATUS_CHARGING_COMPLETE   0x30
 
#define BALANCER4_STATUS_CHG_STAT_MASK   0x30
 
#define BALANCER4_STATUS_NOT_IN_PPM   0x00
 
#define BALANCER4_STATUS_IN_VIN_PPM   0x08
 
#define BALANCER4_STATUS_PPM_STAT_MASK   0x08
 
#define BALANCER4_STATUS_BATTERY_PRESENT   0x00
 
#define BALANCER4_STATUS_BATTERY_MISSING   0x04
 
#define BALANCER4_STATUS_BATFLOAT_STAT_MASK   0x04
 
#define BALANCER4_STATUS_THERM_NORMAL   0x00
 
#define BALANCER4_STATUS_THERM_REGULATION   0x02
 
#define BALANCER4_STATUS_THERM_STAT_MASK   0x02
 
#define BALANCER4_STATUS_NOT_IN_VSYS_MIN   0x00
 
#define BALANCER4_STATUS_IN_VSYS_MIN_REG   0x01
 
#define BALANCER4_STATUS_VSYS_STAT_MASK   0x01
 
#define BALANCER4_FAULT_WD   0x80
 Balancer 4 fault register setting.
 
#define BALANCER4_FAULT_INPUT   0x40
 
#define BALANCER4_FAULT_THERMAL_SD   0x20
 
#define BALANCER4_FAULT_TIMER   0x10
 
#define BALANCER4_FAULT_BAT   0x08
 
#define BALANCER4_FAULT_NTC_COLD   0x01
 
#define BALANCER4_FAULT_NTC_COOL   0x02
 
#define BALANCER4_FAULT_NTC_WARM   0x03
 
#define BALANCER4_FAULT_NTC_HOT   0x04
 
#define BALANCER4_FAULT_NTC_MASK   0x07
 
#define BALANCER4_SET_DEV_ADDR   0x4B
 Balancer 4 device address setting.
 
#define BALANCER4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  balancer4_return_value_t { BALANCER4_OK = 0 , BALANCER4_ERROR = -1 }
 Balancer 4 Click return value data. More...
 

Functions

void balancer4_cfg_setup (balancer4_cfg_t *cfg)
 Balancer 4 configuration object setup function.
 
err_t balancer4_init (balancer4_t *ctx, balancer4_cfg_t *cfg)
 Balancer 4 initialization function.
 
err_t balancer4_default_cfg (balancer4_t *ctx)
 Balancer 4 default configuration function.
 
err_t balancer4_write_register (balancer4_t *ctx, uint8_t reg, uint8_t data_in)
 Balancer 4 write register function.
 
err_t balancer4_write_and_verify_register (balancer4_t *ctx, uint8_t reg, uint8_t data_in)
 Balancer 4 write and verify register function.
 
err_t balancer4_read_register (balancer4_t *ctx, uint8_t reg, uint8_t *data_out)
 Balancer 4 read register function.
 

Detailed Description

This file contains API for Balancer 4 Click Driver.

Enumeration Type Documentation

◆ balancer4_return_value_t

Balancer 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
BALANCER4_OK 
BALANCER4_ERROR