Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
52 #define CHARGER2_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
61 #define CHARGER2_RETVAL uint8_t
63 #define CHARGER2_OK 0x00
64 #define CHARGER2_INIT_ERROR 0xFF
78 #define CHARGER2_REG_MODE 0x00
79 #define CHARGER2_REG_CONTROL 0x01
80 #define CHARGER2_REG_CHARGE_LOW 0x02
81 #define CHARGER2_REG_CHARGE_HIGH 0x03
82 #define CHARGER2_REG_COUNTER_LOW 0x04
83 #define CHARGER2_REG_COUNTER_HIGH 0x05
84 #define CHARGER2_REG_CURRENT_LOW 0x06
85 #define CHARGER2_REG_CURRENT_HIGH 0x07
86 #define CHARGER2_REG_VOLTAGE_LOW 0x08
87 #define CHARGER2_REG_VOLTAGE_HIGH 0x09
88 #define CHARGER2_REG_TEMPERATURE_LOW 0x0A
89 #define CHARGER2_REG_TEMPERATURE_HIGH 0x0B
90 #define CHARGER2_REG_ID0 0x18
91 #define CHARGER2_REG_ID1 0x19
92 #define CHARGER2_REG_ID2 0x1A
93 #define CHARGER2_REG_ID3 0x1B
94 #define CHARGER2_REG_ID4 0x1C
95 #define CHARGER2_REG_ID5 0x1D
96 #define CHARGER2_REG_ID6 0x1E
97 #define CHARGER2_REG_ID7 0x1F
98 #define CHARGER2_REG_RAM0 0x20
99 #define CHARGER2_REG_RAM1 0x21
100 #define CHARGER2_REG_RAM2 0x22
101 #define CHARGER2_REG_RAM3 0x23
102 #define CHARGER2_REG_RAM4 0x24
103 #define CHARGER2_REG_RAM5 0x25
104 #define CHARGER2_REG_RAM6 0x26
105 #define CHARGER2_REG_RAM7 0x27
106 #define CHARGER2_REG_RAM8 0x28
107 #define CHARGER2_REG_RAM9 0x29
108 #define CHARGER2_REG_RAM10 0x2A
109 #define CHARGER2_REG_RAM11 0x2B
110 #define CHARGER2_REG_RAM12 0x2C
111 #define CHARGER2_REG_RAM13 0x2D
112 #define CHARGER2_REG_RAM14 0x2E
113 #define CHARGER2_REG_RAM15 0x2F
114 #define CHARGER2_REG_RAM16 0x30
115 #define CHARGER2_REG_RAM17 0x31
116 #define CHARGER2_REG_RAM18 0x32
117 #define CHARGER2_REG_RAM19 0x33
118 #define CHARGER2_REG_RAM20 0x34
119 #define CHARGER2_REG_RAM21 0x35
120 #define CHARGER2_REG_RAM22 0x36
121 #define CHARGER2_REG_RAM23 0x37
122 #define CHARGER2_REG_RAM24 0x38
123 #define CHARGER2_REG_RAM25 0x39
124 #define CHARGER2_REG_RAM26 0x3A
125 #define CHARGER2_REG_RAM27 0x3B
126 #define CHARGER2_REG_RAM28 0x3C
127 #define CHARGER2_REG_RAM29 0x3D
128 #define CHARGER2_REG_RAM30 0x3E
129 #define CHARGER2_REG_RAM31 0x3F
136 #define CHARGER2_AUTO_DETECT 0x00
137 #define CHARGER2_EXTERNAL_CLOCK 0x01
138 #define CHARGER2_14_BITS_RESOLUTION 0x00
139 #define CHARGER2_13_BITS_RESOLUTION 0x02
140 #define CHARGER2_12_BITS_RESOLUTION 0x04
141 #define CHARGER2_CALIBRATE_ADC 0x08
142 #define CHARGER2_STANDBY_MODE 0x00
143 #define CHARGER2_OPERATING_MODE 0x10
150 #define CHARGER2_IO0_OUTPUT_LOW 0x00
151 #define CHARGER2_IO0_OUTPUT_OPEN 0x01
152 #define CHARGER2_RESET_CHARGE_ACCUM_AND_COUNTER 0x02
153 #define CHARGER2_RELEASE_SOFT_RESET 0x00
154 #define CHARGER2_ASSERT_SOFT_RESET 0x10
161 #define CHARGER2_RESET_COUNTER_MODE 0x00
162 #define CHARGER2_SOFT_RESET_MODE 0x01
163 #define CHARGER2_CURRENT_CYCLE_CHECK 0x00
164 #define CHARGER2_VOLTAGE_TEMP_CYCLE_CHECK 0x01
165 #define CHARGER2_GAS_GAUGE_CHARGE_DATA 0x00
166 #define CHARGER2_CONV_NUMBER 0x01
167 #define CHARGER2_SHUNT_VOLTAGE 0x02
168 #define CHARGER2_BATTERY_VOLTAGE 0x03
169 #define CHARGER2_TEMPERATURE 0x04
170 #define CHARGER2_BATTERY_CURRENT 0x05
327 #endif // _CHARGER2_H_
uint8_t charger2_read_reg(charger2_t *ctx, uint8_t register_address, uint8_t *value_out, uint8_t n_bytes)
Read reg function.
uint8_t charger2_read_data(charger2_t *ctx, uint8_t data_mode, uint32_t *data_out)
Data Read function.
Click configuration structure definition.
Definition: charger2.h:200
pin_name_t scl
Definition: charger2.h:204
uint8_t i2c_address
Definition: charger2.h:210
void charger2_generic_read(charger2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void charger2_generic_write(charger2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
i2c_master_t i2c
Definition: charger2.h:187
uint8_t charger2_write_reg(charger2_t *ctx, uint8_t register_address, uint8_t transfer_data)
Write reg function.
uint8_t unit_mode
Definition: charger2.h:193
uint32_t i2c_speed
Definition: charger2.h:209
uint8_t charger2_check_conv_cycle(charger2_t *ctx, uint8_t conv_mode)
Conversion Cycle Check function.
pin_name_t sda
Definition: charger2.h:205
uint8_t slave_address
Definition: charger2.h:191
Click ctx object definition.
Definition: charger2.h:183
CHARGER2_RETVAL charger2_init(charger2_t *ctx, charger2_cfg_t *cfg)
Initialization function.
uint8_t charger2_reset(charger2_t *ctx, uint8_t reset_mode)
Reset function.
#define CHARGER2_RETVAL
Definition: charger2.h:61
void charger2_cfg_setup(charger2_cfg_t *cfg)
Config Object Initialization function.