no-OS
ltc4162l.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file ltc4162l.h
3  * @brief Header file of the LTC4162L Driver
4  * @authors Marc Paolo Sosa (marcpaolo.sosa@analog.com)
5  ********************************************************************************
6  * Copyright 2024(c) Analog Devices, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of Analog Devices, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *******************************************************************************/
33 
34 #ifndef __LTC4162L_H__
35 #define __LTC4162L_H__
36 
37 #include <stdint.h>
38 #include <string.h>
39 #include "no_os_util.h"
40 #include "no_os_i2c.h"
41 
42 #define LTC4162L_EN_LIMIT_ALERTS_REG 0x0D
43 #define LTC4162L_EN_CHARGER_STATE_ALERTS_REG 0x0E
44 #define LTC4162L_EN_CHARGE_STATUS_ALERTS_REG 0x0F
45 #define LTC4162L_CONFIG_BITS_REG 0x14
46 #define LTC4162L_IIN_LIMIT_TARGET 0x15
47 #define LTC4162L_ARM_SHIP_MODE 0x19
48 #define LTC4162L_CHARGE_CURRENT_SETTING 0X1A
49 #define LTC4162L_VCHARGE_SETTING 0X1B
50 #define LTC4162L_C_OVER_X_THRESHOLD 0x1C
51 #define LTC4162L_MAX_CV_TIME 0X1D
52 #define LTC4162L_MAX_CHARGE_TIME 0X1E
53 #define LTC4162L_CHARGER_CONFIG 0x29
54 #define LTC4162L_CHARGER_STATE 0x34
55 #define LTC4162L_CHARGE_STATUS 0x35
56 #define LTC4162L_LIMIT_ALERTS_REG 0x36
57 #define LTC4162L_CHARGER_STATE_ALERTS_REG 0x37
58 #define LTC4162L_CHARGE_STATUS_ALERTS_REG 0x38
59 #define LTC4162L_SYSTEM_STATUS_REG 0x39
60 #define LTC4162L_VBAT 0x3A
61 #define LTC4162L_VIN 0x3B
62 #define LTC4162L_VOUT 0x3C
63 #define LTC4162L_IBAT 0x3D
64 #define LTC4162L_IIN 0x3E
65 #define LTC4162L_DIE_TEMPERATURE 0x3F
66 #define LTC4162L_THERMISTOR_VOLTAGE 0x40
67 #define LTC4162L_BSR 0x41
68 #define LTC4162L_JEITA_REGION 0x42
69 #define LTC4162L_CHEM_CELLS_REG 0x43
70 #define LTC4162L_ICHARGE_DAC 0x44
71 #define LTC4162L_VCHARGE_DAC 0x45
72 #define LTC4162L_IIN_LIMIT_DAC 0x46
73 #define LTC4162L_VBAT_FILT 0x47
74 #define LTC4162L_INPUT_UNDERVOLTAGE_DAC 0x4B
75 
76 #define LTC4162L_CELL_COUNT_MASK NO_OS_GENMASK(3, 0)
77 #define LTC4162L_CHEM_TYPE_MASK NO_OS_GENMASK(11, 8)
78 #define LTC4162L_CHEM_MASK NO_OS_GENMASK(11, 8)
79 #define LTC4162L_ONLINE_STATUS_BIT NO_OS_BIT(2)
80 #define LTC4162L_EN_C_OVER_X_TERM_BIT NO_OS_BIT(2)
81 #define LTC4162L_IIN_LIMIT_DAC_MASK NO_OS_GENMASK(6, 0)
82 #define LTC4162L_CHARGER_CONFIG_BIT NO_OS_BIT(2)
83 #define LTC4162L_ICHARGE_DAC_MASK NO_OS_GENMASK(4, 0)
84 #define LTC4162L_VIN_GT_VBAT_BIT NO_OS_BIT(2)
85 #define LTC4162L_VCHARGE_SETTING_MASK NO_OS_GENMASK(4, 0)
86 #define LTC4162L_RUN_BSR_BIT NO_OS_BIT(4)
87 #define LTC4162L_FORCE_TELEMETRY_BIT NO_OS_BIT(2)
88 
89 #define LTC4162L_ARM_SHIP_MODE_MAGIC 21325
90 #define LTC4162L_MULTIPLIER 14660
91 #define LTC4015_MULTIPLIER 146487
92 #define LTC4162L_VCHARGE_RANGE 38125
93 #define LTC4015_VCHARGE_RANGE 34125
94 
95 #define LTC4162L_BASE_VOLTAGE 3812500
96 #define LTC4162L_SCALE_FACTOR 12500
97 #define LTC4162L_RANGE 31
98 
99 #define LTC4162F_BASE_VOLTAGE 3412500
100 #define LTC4162F_SCALE_FACTOR 12500
101 #define LTC4162F_RANGE 31
102 
103 #define LTC4162S_BASE_VOLTAGE 6000000
104 #define LTC4162S_SCALE_FACTOR 28571
105 #define LTC4162S_RANGE 31
106 
107 #define LTC4015_BASE_VOLTAGE_TYPE1 3812500
108 #define LTC4015_SCALE_FACTOR_TYPE1 12500
109 #define LTC4015_RANGE_TYPE1 31
110 #define LTC4015_BASE_VOLTAGE_TYPE2 3412500
111 #define LTC4015_SCALE_FACTOR_TYPE2 12500
112 #define LTC4015_RANGE_TYPE2 31
113 #define LTC4015_BASE_VOLTAGE_TYPE3 6000000
114 #define LTC4015_SCALE_FACTOR_TYPE3 28571
115 #define LTC4015_RANGE_TYPE3 35
116 
125 };
126 
134 };
135 
144  uint32_t rsnsb;
145  uint32_t rsnsi;
146 };
147 
155  uint32_t rsnsb;
156  uint32_t rsnsi;
158 };
159 
164  uint32_t base_voltage;
165  uint32_t scale_factor;
166  uint32_t range;
167  uint16_t (*get_vcharge_setting)(uint16_t reg, uint16_t cell_count,
168  uint16_t chem_type);
169  uint16_t (*get_vbat)(uint16_t reg, uint16_t cell_count, uint16_t chem_type);
170  uint16_t (*get_avg_vbat)(uint16_t reg, uint16_t cell_count, uint16_t chem_type);
171  uint16_t (*get_die_temp)(uint16_t reg, uint16_t cell_count, uint16_t chem_type);
172  uint16_t (*read_ibat)(struct ltc4162l_desc *dev, uint16_t signed_regval);
173  uint16_t (*read_input_current)(struct ltc4162l_desc *dev,
174  uint16_t signed_regval);
175 };
176 
177 /* Write register value*/
178 int ltc4162l_reg_write(struct ltc4162l_desc *dev, uint8_t addr, uint16_t val);
179 
180 /* Read register value*/
181 int ltc4162l_reg_read(struct ltc4162l_desc *dev, uint8_t addr, uint16_t *val);
182 
183 /* Update register value*/
184 int ltc4162l_reg_update(struct ltc4162l_desc *dev, uint8_t addr, uint16_t mask,
185  uint16_t val);
186 
187 /* Initialize the LTC4162L device */
188 int ltc4162l_init(struct ltc4162l_desc **dev,
190 
191 /* Free the resources allocated by ltc4162l_init() */
192 int ltc4162l_remove(struct ltc4162l_desc *dev);
193 
194 /* Get the number of cells */
195 int ltc4162l_get_cell_count(struct ltc4162l_desc *dev, uint16_t *val);
196 
197 /* Get the chemistry type */
198 int ltc4162l_get_chem_type(struct ltc4162l_desc *dev, uint16_t *val);
199 
200 /* Get the charger state */
201 int ltc4162l_get_charger_state(struct ltc4162l_desc *dev, uint16_t *val);
202 
203 /* Get the charge status */
204 int ltc4162l_get_charge_status(struct ltc4162l_desc *dev, uint16_t *val);
205 
206 /* Get the online status */
207 int ltc4162l_get_online_status(struct ltc4162l_desc *dev, uint16_t *val);
208 
209 /* Get the battery voltage */
210 int ltc4162l_read_vbat(struct ltc4162l_desc *dev, uint16_t *val);
211 
212 /* Get the average battery voltage */
213 int ltc4162l_read_avg_vbat(struct ltc4162l_desc *dev, uint16_t *val);
214 
215 /* Get the battery current */
216 int ltc4162l_read_ibat(struct ltc4162l_desc *dev, uint16_t *val);
217 
218 /* Get the input voltage */
219 int ltc4162l_read_input_voltage(struct ltc4162l_desc *dev, uint16_t *val);
220 
221 /* Get the input current */
222 int ltc4162l_read_input_current(struct ltc4162l_desc *dev, uint16_t *val);
223 
224 /* Get icharge setting*/
225 int ltc4162l_get_icharge_setting(struct ltc4162l_desc *dev, uint16_t *val);
226 
227 /* Set icharge setting*/
228 int ltc4162l_set_icharge_setting(struct ltc4162l_desc *dev, uint16_t val);
229 
230 /* Get icharge*/
231 int ltc4162l_get_icharge(struct ltc4162l_desc *dev, uint16_t *val);
232 
233 /* Get vcharge setting*/
234 int ltc4162l_get_vcharge_setting(struct ltc4162l_desc *dev, uint16_t *val);
235 
236 /* Set vcharge setting*/
237 int ltc4162l_set_vcharge_setting(struct ltc4162l_desc *dev, uint16_t val);
238 
239 /* Get iin vcharge*/
240 int ltc4162l_get_vcharge(struct ltc4162l_desc *dev, uint16_t *val);
241 
242 /* Get iin limit*/
243 int ltc4162l_get_iin_limit(struct ltc4162l_desc *dev, uint16_t *val);
244 
245 /* Set iin limit*/
246 int ltc4162l_set_iin_limit(struct ltc4162l_desc *dev, uint16_t val);
247 
248 /* Get die temperature*/
249 int ltc4162l_get_die_temperature(struct ltc4162l_desc *dev, uint16_t *val);
250 
251 /* Get term current*/
252 int ltc4162l_get_term_current(struct ltc4162l_desc *dev, uint16_t *val);
253 
254 /* Set term current*/
255 int ltc4162l_set_term_current(struct ltc4162l_desc *dev, uint16_t val);
256 
257 /* Get telemetry*/
258 int ltc4162l_get_telemetry(struct ltc4162l_desc *dev, uint16_t *val);
259 
260 /* Set telemetry*/
261 int ltc4162l_set_telemetry(struct ltc4162l_desc *dev, uint16_t val);
262 
263 #endif //__LTC4162L_H__
LTC4162L_IIN_LIMIT_DAC_MASK
#define LTC4162L_IIN_LIMIT_DAC_MASK
Definition: ltc4162l.h:81
no_os_alloc.h
LTC4015_SCALE_FACTOR_TYPE3
#define LTC4015_SCALE_FACTOR_TYPE3
Definition: ltc4162l.h:114
ltc4162l_set_icharge_setting
int ltc4162l_set_icharge_setting(struct ltc4162l_desc *dev, uint16_t val)
Set icharge setting.
Definition: ltc4162l.c:558
ltc4162l_get_term_current
int ltc4162l_get_term_current(struct ltc4162l_desc *dev, uint16_t *val)
Get the term current.
Definition: ltc4162l.c:760
LTC4162L_BASE_VOLTAGE
#define LTC4162L_BASE_VOLTAGE
Definition: ltc4162l.h:95
LTC4162L_CHEM_TYPE_MASK
#define LTC4162L_CHEM_TYPE_MASK
Definition: ltc4162l.h:77
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
LTC4162S_SCALE_FACTOR
#define LTC4162S_SCALE_FACTOR
Definition: ltc4162l.h:104
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
LTC4162L_EN_C_OVER_X_TERM_BIT
#define LTC4162L_EN_C_OVER_X_TERM_BIT
Definition: ltc4162l.h:80
ltc4162l.h
ltc4162l_chip_info::read_input_current
uint16_t(* read_input_current)(struct ltc4162l_desc *dev, uint16_t signed_regval)
Definition: ltc4162l.h:173
ltc4162l_reg_read
int ltc4162l_reg_read(struct ltc4162l_desc *dev, uint8_t addr, uint16_t *val)
Read from a register of the LTC4162L.
Definition: ltc4162l.c:206
ltc4162l_get_icharge_setting
int ltc4162l_get_icharge_setting(struct ltc4162l_desc *dev, uint16_t *val)
Get icharge setting.
Definition: ltc4162l.c:533
ltc4162l_get_icharge
int ltc4162l_get_icharge(struct ltc4162l_desc *dev, uint16_t *val)
Get icharge value.
Definition: ltc4162l.c:581
ltc4162l_init
int ltc4162l_init(struct ltc4162l_desc **dev, struct ltc4162l_init_param *init_param)
Initialize the LTC4162L device.
Definition: ltc4162l.c:254
ltc4162l_set_iin_limit
int ltc4162l_set_iin_limit(struct ltc4162l_desc *dev, uint16_t val)
Set the iin limit.
Definition: ltc4162l.c:721
ltc4162l_chip_info::range
uint32_t range
Definition: ltc4162l.h:166
ltc4162l_read_avg_vbat
int ltc4162l_read_avg_vbat(struct ltc4162l_desc *dev, uint16_t *val)
Get the average battery voltage.
Definition: ltc4162l.c:436
ltc4162l_get_iin_limit
int ltc4162l_get_iin_limit(struct ltc4162l_desc *dev, uint16_t *val)
Get the iin limit.
Definition: ltc4162l.c:696
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
LTC4162L_VIN
#define LTC4162L_VIN
Definition: ltc4162l.h:61
ltc4162l_init
int ltc4162l_init(struct ltc4162l_desc **device, struct ltc4162l_init_param *init_param)
Initialize the LTC4162L device.
Definition: ltc4162l.c:254
ltc4162l_get_charge_status
int ltc4162l_get_charge_status(struct ltc4162l_desc *dev, uint16_t *val)
Get the charge status.
Definition: ltc4162l.c:368
LTC4162L_RANGE
#define LTC4162L_RANGE
Definition: ltc4162l.h:97
ID_LTC4162F
@ ID_LTC4162F
Definition: ltc4162l.h:122
ltc4162l_set_telemetry
int ltc4162l_set_telemetry(struct ltc4162l_desc *dev, uint16_t val)
Set the telemetry.
Definition: ltc4162l.c:841
LTC4162L_CMD_GET_VBAT
@ LTC4162L_CMD_GET_VBAT
Definition: ltc4162l.h:131
ltc4162l_chip_info::read_ibat
uint16_t(* read_ibat)(struct ltc4162l_desc *dev, uint16_t signed_regval)
Definition: ltc4162l.h:172
no_os_delay.h
Header file of Delay functions.
ltc4162l_get_vcharge_setting
int ltc4162l_get_vcharge_setting(struct ltc4162l_desc *dev, uint16_t *val)
Get the vcharge setting.
Definition: ltc4162l.c:606
LTC4162L_SCALE_FACTOR
#define LTC4162L_SCALE_FACTOR
Definition: ltc4162l.h:96
ltc4162l_reg_update
int ltc4162l_reg_update(struct ltc4162l_desc *dev, uint8_t addr, uint16_t mask, uint16_t val)
Update a register of the LTC4162L.
Definition: ltc4162l.c:232
ltc4162l_get_die_temperature
int ltc4162l_get_die_temperature(struct ltc4162l_desc *dev, uint16_t *val)
ltc4162l_read_input_current
int ltc4162l_read_input_current(struct ltc4162l_desc *dev, uint16_t *val)
Get the input current.
Definition: ltc4162l.c:510
ltc4162l_chip_info::get_avg_vbat
uint16_t(* get_avg_vbat)(uint16_t reg, uint16_t cell_count, uint16_t chem_type)
Definition: ltc4162l.h:170
device
Definition: ad9361_util.h:69
ltc4162l_get_vcharge
int ltc4162l_get_vcharge(struct ltc4162l_desc *dev, uint16_t *val)
ltc4162l_reg_write
int ltc4162l_reg_write(struct ltc4162l_desc *dev, uint8_t addr, uint16_t val)
Write to a register of the LTC4162L.
Definition: ltc4162l.c:192
ltc4162l_chip_info::scale_factor
uint32_t scale_factor
Definition: ltc4162l.h:165
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
LTC4015_BASE_VOLTAGE_TYPE1
#define LTC4015_BASE_VOLTAGE_TYPE1
Definition: ltc4162l.h:107
ltc4162l_read_input_voltage
int ltc4162l_read_input_voltage(struct ltc4162l_desc *dev, uint16_t *val)
Get the input voltage.
Definition: ltc4162l.c:487
LTC4162L_CHARGE_STATUS
#define LTC4162L_CHARGE_STATUS
Definition: ltc4162l.h:55
ltc4162l_id
ltc4162l_id
LTC4162L device ID.
Definition: ltc4162l.h:120
ltc4162l_reg_read
int ltc4162l_reg_read(struct ltc4162l_desc *dev, uint8_t addr, uint16_t *val)
Read from a register of the LTC4162L.
Definition: ltc4162l.c:206
ltc4162l_get_telemetry
int ltc4162l_get_telemetry(struct ltc4162l_desc *dev, uint16_t *val)
Get the telemetry.
Definition: ltc4162l.c:818
ltc4162l_set_telemetry
int ltc4162l_set_telemetry(struct ltc4162l_desc *dev, uint16_t val)
Set the telemetry.
Definition: ltc4162l.c:841
LTC4015_BASE_VOLTAGE_TYPE2
#define LTC4015_BASE_VOLTAGE_TYPE2
Definition: ltc4162l.h:110
LTC4162L_ICHARGE_DAC_MASK
#define LTC4162L_ICHARGE_DAC_MASK
Definition: ltc4162l.h:83
ltc4162l_chip_info::get_vbat
uint16_t(* get_vbat)(uint16_t reg, uint16_t cell_count, uint16_t chem_type)
Definition: ltc4162l.h:169
ltc4162l_init_param::rsnsb
uint32_t rsnsb
Definition: ltc4162l.h:155
LTC4162L_VCHARGE_SETTING
#define LTC4162L_VCHARGE_SETTING
Definition: ltc4162l.h:49
ltc4162l_get_chem_type
int ltc4162l_get_chem_type(struct ltc4162l_desc *dev, uint16_t *val)
Get the chemistry type.
Definition: ltc4162l.c:328
LTC4162S_BASE_VOLTAGE
#define LTC4162S_BASE_VOLTAGE
Definition: ltc4162l.h:103
ltc4162l_desc::id
enum ltc4162l_id id
Definition: ltc4162l.h:143
ltc4162l_read_ibat
int ltc4162l_read_ibat(struct ltc4162l_desc *dev, uint16_t *val)
Get the battery current.
Definition: ltc4162l.c:464
ltc4162l_get_term_current
int ltc4162l_get_term_current(struct ltc4162l_desc *dev, uint16_t *val)
Get the term current.
Definition: ltc4162l.c:760
LTC4162L_CMD_GET_VCHARGE
@ LTC4162L_CMD_GET_VCHARGE
Definition: ltc4162l.h:132
LTC4162S_RANGE
#define LTC4162S_RANGE
Definition: ltc4162l.h:105
LTC4015_MULTIPLIER
#define LTC4015_MULTIPLIER
Definition: ltc4162l.h:91
LTC4015_VCHARGE_RANGE
#define LTC4015_VCHARGE_RANGE
Definition: ltc4162l.h:93
ltc4162l_chip_info::base_voltage
uint32_t base_voltage
Definition: ltc4162l.h:164
ltc4162l_get_icharge
int ltc4162l_get_icharge(struct ltc4162l_desc *dev, uint16_t *val)
Get icharge value.
Definition: ltc4162l.c:581
LTC4162L_RUN_BSR_BIT
#define LTC4162L_RUN_BSR_BIT
Definition: ltc4162l.h:86
ltc4162l_set_vcharge_setting
int ltc4162l_set_vcharge_setting(struct ltc4162l_desc *dev, uint16_t val)
Set the vcharge setting.
Definition: ltc4162l.c:636
ltc4162l_set_iin_limit
int ltc4162l_set_iin_limit(struct ltc4162l_desc *dev, uint16_t val)
Set the iin limit.
Definition: ltc4162l.c:721
LTC4162L_MULTIPLIER
#define LTC4162L_MULTIPLIER
Definition: ltc4162l.h:90
LTC4162L_VCHARGE_RANGE
#define LTC4162L_VCHARGE_RANGE
Definition: ltc4162l.h:92
ltc4162l_get_charge_status
int ltc4162l_get_charge_status(struct ltc4162l_desc *dev, uint16_t *val)
Get the charge status.
Definition: ltc4162l.c:368
ltc4162l_read_input_current
int ltc4162l_read_input_current(struct ltc4162l_desc *dev, uint16_t *val)
Get the input current.
Definition: ltc4162l.c:510
ltc4162l_set_term_current
int ltc4162l_set_term_current(struct ltc4162l_desc *dev, uint16_t val)
Set the term current.
Definition: ltc4162l.c:791
LTC4162L_CHARGE_CURRENT_SETTING
#define LTC4162L_CHARGE_CURRENT_SETTING
Definition: ltc4162l.h:48
ltc4162l_desc
LTC4162L descriptor.
Definition: ltc4162l.h:139
LTC4162L_CELL_COUNT_MASK
#define LTC4162L_CELL_COUNT_MASK
Definition: ltc4162l.h:76
LTC4162L_ICHARGE_DAC
#define LTC4162L_ICHARGE_DAC
Definition: ltc4162l.h:70
ltc4162l_get_iin_limit
int ltc4162l_get_iin_limit(struct ltc4162l_desc *dev, uint16_t *val)
Get the iin limit.
Definition: ltc4162l.c:696
LTC4162L_CHARGER_CONFIG_BIT
#define LTC4162L_CHARGER_CONFIG_BIT
Definition: ltc4162l.h:82
ltc4162l_read_avg_vbat
int ltc4162l_read_avg_vbat(struct ltc4162l_desc *dev, uint16_t *val)
Get the average battery voltage.
Definition: ltc4162l.c:436
LTC4162F_RANGE
#define LTC4162F_RANGE
Definition: ltc4162l.h:101
ltc4162l_desc::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: ltc4162l.h:141
LTC4162L_CHARGER_CONFIG
#define LTC4162L_CHARGER_CONFIG
Definition: ltc4162l.h:53
ltc4162l_read_input_voltage
int ltc4162l_read_input_voltage(struct ltc4162l_desc *dev, uint16_t *val)
Get the input voltage.
Definition: ltc4162l.c:487
ltc4162l_remove
int ltc4162l_remove(struct ltc4162l_desc *dev)
Free the resources allocated by ltc4162l_init()
Definition: ltc4162l.c:288
LTC4162L_VCHARGE_SETTING_MASK
#define LTC4162L_VCHARGE_SETTING_MASK
Definition: ltc4162l.h:85
LTC4015_SCALE_FACTOR_TYPE1
#define LTC4015_SCALE_FACTOR_TYPE1
Definition: ltc4162l.h:108
ltc4162l_chip_info::get_die_temp
uint16_t(* get_die_temp)(uint16_t reg, uint16_t cell_count, uint16_t chem_type)
Definition: ltc4162l.h:171
ltc4162l_init_param::rsnsi
uint32_t rsnsi
Definition: ltc4162l.h:156
LTC4015_SCALE_FACTOR_TYPE2
#define LTC4015_SCALE_FACTOR_TYPE2
Definition: ltc4162l.h:111
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
ID_LTC4015
@ ID_LTC4015
Definition: ltc4162l.h:124
LTC4015_RANGE_TYPE3
#define LTC4015_RANGE_TYPE3
Definition: ltc4162l.h:115
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
LTC4162L_VBAT
#define LTC4162L_VBAT
Definition: ltc4162l.h:60
no_os_i2c.h
Header file of I2C Interface.
LTC4162L_IIN_LIMIT_DAC
#define LTC4162L_IIN_LIMIT_DAC
Definition: ltc4162l.h:72
ltc4162l_init_param::i2c_init_param
struct no_os_i2c_init_param i2c_init_param
Definition: ltc4162l.h:153
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ltc4162l_read_ibat
int ltc4162l_read_ibat(struct ltc4162l_desc *dev, uint16_t *val)
Get the battery current.
Definition: ltc4162l.c:464
LTC4162L_CHEM_CELLS_REG
#define LTC4162L_CHEM_CELLS_REG
Definition: ltc4162l.h:69
ltc4162l_get_vcharge_setting
int ltc4162l_get_vcharge_setting(struct ltc4162l_desc *dev, uint16_t *val)
Get the vcharge setting.
Definition: ltc4162l.c:606
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
ltc4162l_get_icharge_setting
int ltc4162l_get_icharge_setting(struct ltc4162l_desc *dev, uint16_t *val)
Get icharge setting.
Definition: ltc4162l.c:533
ltc4162l_get_online_status
int ltc4162l_get_online_status(struct ltc4162l_desc *dev, uint16_t *val)
Get the online status.
Definition: ltc4162l.c:388
ltc4162l_get_cell_count
int ltc4162l_get_cell_count(struct ltc4162l_desc *dev, uint16_t *val)
Get the number of cells.
Definition: ltc4162l.c:307
ltc4162l_get_telemetry
int ltc4162l_get_telemetry(struct ltc4162l_desc *dev, uint16_t *val)
Get the telemetry.
Definition: ltc4162l.c:818
ltc4162l_get_charger_state
int ltc4162l_get_charger_state(struct ltc4162l_desc *dev, uint16_t *val)
Get the charger state.
Definition: ltc4162l.c:348
ltc4162l_set_term_current
int ltc4162l_set_term_current(struct ltc4162l_desc *dev, uint16_t val)
Set the term current.
Definition: ltc4162l.c:791
ltc4162l_read_vbat
int ltc4162l_read_vbat(struct ltc4162l_desc *dev, uint16_t *val)
Get the battery voltage.
Definition: ltc4162l.c:408
ID_LTC4162S
@ ID_LTC4162S
Definition: ltc4162l.h:123
LTC4015_BASE_VOLTAGE_TYPE3
#define LTC4015_BASE_VOLTAGE_TYPE3
Definition: ltc4162l.h:113
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
ltc4162l_get_online_status
int ltc4162l_get_online_status(struct ltc4162l_desc *dev, uint16_t *val)
Get the online status.
Definition: ltc4162l.c:388
ltc4162l_desc::rsnsb
uint32_t rsnsb
Definition: ltc4162l.h:144
ltc4162l_chip_info
LTC4162L chip info.
Definition: ltc4162l.h:163
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ltc4162l_get_die_temp
int ltc4162l_get_die_temp(struct ltc4162l_desc *dev, uint16_t *val)
Get the die temperature.
Definition: ltc4162l.c:740
ltc4162l_init_param::id
enum ltc4162l_id id
Definition: ltc4162l.h:157
ltc4162l_command
ltc4162l_command
LTC4162L commands.
Definition: ltc4162l.h:130
LTC4162L_FORCE_TELEMETRY_BIT
#define LTC4162L_FORCE_TELEMETRY_BIT
Definition: ltc4162l.h:87
ltc4162l_set_icharge_setting
int ltc4162l_set_icharge_setting(struct ltc4162l_desc *dev, uint16_t val)
Set icharge setting.
Definition: ltc4162l.c:558
LTC4162L_DIE_TEMPERATURE
#define LTC4162L_DIE_TEMPERATURE
Definition: ltc4162l.h:65
ltc4162l_chip_info::get_vcharge_setting
uint16_t(* get_vcharge_setting)(uint16_t reg, uint16_t cell_count, uint16_t chem_type)
Definition: ltc4162l.h:167
ltc4162l_reg_update
int ltc4162l_reg_update(struct ltc4162l_desc *dev, uint8_t addr, uint16_t mask, uint16_t val)
Update a register of the LTC4162L.
Definition: ltc4162l.c:232
LTC4162F_BASE_VOLTAGE
#define LTC4162F_BASE_VOLTAGE
Definition: ltc4162l.h:99
LTC4015_RANGE_TYPE1
#define LTC4015_RANGE_TYPE1
Definition: ltc4162l.h:109
ltc4162l_infos
const struct ltc4162l_chip_info ltc4162l_infos[]
LTC4162x chip information.
Definition: ltc4162l.c:142
LTC4162L_VBAT_FILT
#define LTC4162L_VBAT_FILT
Definition: ltc4162l.h:73
ltc4162l_get_chem_type
int ltc4162l_get_chem_type(struct ltc4162l_desc *dev, uint16_t *val)
Get the chemistry type.
Definition: ltc4162l.c:328
LTC4162L_ONLINE_STATUS_BIT
#define LTC4162L_ONLINE_STATUS_BIT
Definition: ltc4162l.h:79
no_os_util.h
Header file of utility functions.
LTC4162F_SCALE_FACTOR
#define LTC4162F_SCALE_FACTOR
Definition: ltc4162l.h:100
ltc4162l_init_param
LTC4162L init param.
Definition: ltc4162l.h:151
LTC4162L_CMD_GET_DIE_TEMP
@ LTC4162L_CMD_GET_DIE_TEMP
Definition: ltc4162l.h:133
LTC4162L_IIN
#define LTC4162L_IIN
Definition: ltc4162l.h:64
ltc4162l_desc::rsnsi
uint32_t rsnsi
Definition: ltc4162l.h:145
LTC4015_RANGE_TYPE2
#define LTC4015_RANGE_TYPE2
Definition: ltc4162l.h:112
ltc4162l_set_vcharge_setting
int ltc4162l_set_vcharge_setting(struct ltc4162l_desc *dev, uint16_t val)
Set the vcharge setting.
Definition: ltc4162l.c:636
ltc4162l_read_vbat
int ltc4162l_read_vbat(struct ltc4162l_desc *dev, uint16_t *val)
Get the battery voltage.
Definition: ltc4162l.c:408
ltc4162l_get_charger_state
int ltc4162l_get_charger_state(struct ltc4162l_desc *dev, uint16_t *val)
Get the charger state.
Definition: ltc4162l.c:348
ltc4162l_reg_write
int ltc4162l_reg_write(struct ltc4162l_desc *dev, uint8_t addr, uint16_t val)
Write to a register of the LTC4162L.
Definition: ltc4162l.c:192
ltc4162l_desc::info
struct ltc4162l_chip_info * info
Definition: ltc4162l.h:142
ltc4162l_get_cell_count
int ltc4162l_get_cell_count(struct ltc4162l_desc *dev, uint16_t *val)
Get the number of cells.
Definition: ltc4162l.c:307
errno.h
Error macro definition for ARM Compiler.
LTC4162L_IBAT
#define LTC4162L_IBAT
Definition: ltc4162l.h:63
LTC4162L_SYSTEM_STATUS_REG
#define LTC4162L_SYSTEM_STATUS_REG
Definition: ltc4162l.h:59
LTC4162L_CONFIG_BITS_REG
#define LTC4162L_CONFIG_BITS_REG
Definition: ltc4162l.h:45
ID_LTC4162L
@ ID_LTC4162L
Definition: ltc4162l.h:121
LTC4162L_C_OVER_X_THRESHOLD
#define LTC4162L_C_OVER_X_THRESHOLD
Definition: ltc4162l.h:50
ltc4162l_remove
int ltc4162l_remove(struct ltc4162l_desc *dev)
Free the resources allocated by ltc4162l_init()
Definition: ltc4162l.c:288