no-OS
ltc2992.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * @file ltc2992.h
3 * @brief Header file of the LTC2992 Driver
4 * @authors Cedric Justine Encarnacion (cedricjustine.encarnacion@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 __LTC2992_H__
35 #define __LTC2992_H__
36 
37 #include <stdint.h>
38 #include <string.h>
39 #include "no_os_util.h"
40 #include "no_os_i2c.h"
41 #include "no_os_gpio.h"
42 
43 #define LTC2992_REG_CTRLA 0x00
44 #define LTC2992_REG_CTRLB 0x01
45 #define LTC2992_REG_ALERT1 0x02
46 #define LTC2992_REG_FAULT1 0x03
47 #define LTC2992_REG_NADC 0x04
48 #define LTC2992_REG_POWER1 0x05
49 #define LTC2992_REG_POWER1_MAX 0x08
50 #define LTC2992_REG_POWER1_MIN 0x0B
51 #define LTC2992_REG_POWER1_MAX_THRESH 0x0E
52 #define LTC2992_REG_POWER1_MIN_THRESH 0x11
53 #define LTC2992_REG_DSENSE1 0x14
54 #define LTC2992_REG_DSENSE1_MAX 0x16
55 #define LTC2992_REG_DSENSE1_MIN 0x18
56 #define LTC2992_REG_DSENSE1_MAX_THRESH 0x1A
57 #define LTC2992_REG_DSENSE1_MIN_THRESH 0x1C
58 #define LTC2992_REG_SENSE1 0x1E
59 #define LTC2992_REG_SENSE1_MAX 0x20
60 #define LTC2992_REG_SENSE1_MIN 0x22
61 #define LTC2992_REG_SENSE1_MAX_THRESH 0x24
62 #define LTC2992_REG_SENSE1_MIN_THRESH 0x26
63 #define LTC2992_REG_G1 0x28
64 #define LTC2992_REG_G1_MAX 0x2A
65 #define LTC2992_REG_G1_MIN 0x2C
66 #define LTC2992_REG_G1_MAX_THRESH 0x2E
67 #define LTC2992_REG_G1_MIN_THRESH 0x30
68 #define LTC2992_REG_ALERT2 0x34
69 #define LTC2992_REG_FAULT2 0x35
70 #define LTC2992_REG_G2 0x5A
71 #define LTC2992_REG_G2_MAX 0x5C
72 #define LTC2992_REG_G2_MIN 0x5E
73 #define LTC2992_REG_G2_MAX_THRESH 0x60
74 #define LTC2992_REG_G2_MIN_THRESH 0x62
75 #define LTC2992_REG_G3 0x64
76 #define LTC2992_REG_G3_MAX 0x66
77 #define LTC2992_REG_G3_MIN 0x68
78 #define LTC2992_REG_G3_MAX_THRESH 0x6A
79 #define LTC2992_REG_G3_MIN_THRESH 0x6C
80 #define LTC2992_REG_G4 0x6E
81 #define LTC2992_REG_G4_MAX 0x70
82 #define LTC2992_REG_G4_MIN 0x72
83 #define LTC2992_REG_G4_MAX_THRESH 0x74
84 #define LTC2992_REG_G4_MIN_THRESH 0x76
85 #define LTC2992_REG_ISUM 0x78
86 #define LTC2992_REG_ISUM_MAX 0x7A
87 #define LTC2992_REG_ISUM_MIN 0x7C
88 #define LTC2992_REG_ISUM_MAX_THRESH 0x7E
89 #define LTC2992_REG_ISUM_MIN_THRESH 0x80
90 #define LTC2992_REG_PSUM 0x82
91 #define LTC2992_REG_PSUM_MAX 0x85
92 #define LTC2992_REG_PSUM_MIN 0x88
93 #define LTC2992_REG_PSUM_MAX_THRESH 0x8B
94 #define LTC2992_REG_PSUM_MIN_THRESH 0x8E
95 #define LTC2992_REG_ALERT3 0x91
96 #define LTC2992_REG_FAULT3 0x92
97 #define LTC2992_REG_GPIO_STATUS 0x95
98 #define LTC2992_REG_GPIO_IO_CTRL 0x96
99 #define LTC2992_REG_GPIO4_CTRL 0x97
100 #define LTC2992_REG_MFR_SPECIAL_ID 0xE7
101 
102 #define LTC2992_REG_POWER(x) (LTC2992_REG_POWER1 + ((x) * 0x32))
103 #define LTC2992_REG_POWER_MAX(x) (LTC2992_REG_POWER1_MAX + ((x) * 0x32))
104 #define LTC2992_REG_POWER_MIN(x) (LTC2992_REG_POWER1_MIN + ((x) * 0x32))
105 #define LTC2992_REG_POWER_MAX_THRESH(x) (LTC2992_REG_POWER1_MAX_THRESH + ((x) * 0x32))
106 #define LTC2992_REG_POWER_MIN_THRESH(x) (LTC2992_REG_POWER1_MIN_THRESH + ((x) * 0x32))
107 #define LTC2992_REG_DSENSE(x) (LTC2992_REG_DSENSE1 + ((x) * 0x32))
108 #define LTC2992_REG_DSENSE_MAX(x) (LTC2992_REG_DSENSE1_MAX + ((x) * 0x32))
109 #define LTC2992_REG_DSENSE_MIN(x) (LTC2992_REG_DSENSE1_MIN + ((x) * 0x32))
110 #define LTC2992_REG_DSENSE_MAX_THRESH(x) (LTC2992_REG_DSENSE1_MAX_THRESH + ((x) * 0x32))
111 #define LTC2992_REG_DSENSE_MIN_THRESH(x) (LTC2992_REG_DSENSE1_MIN_THRESH + ((x) * 0x32))
112 #define LTC2992_REG_SENSE(x) (LTC2992_REG_SENSE1 + ((x) * 0x32))
113 #define LTC2992_REG_SENSE_MAX(x) (LTC2992_REG_SENSE1_MAX + ((x) * 0x32))
114 #define LTC2992_REG_SENSE_MIN(x) (LTC2992_REG_SENSE1_MIN + ((x) * 0x32))
115 #define LTC2992_REG_SENSE_MAX_THRESH(x) (LTC2992_REG_SENSE1_MAX_THRESH + ((x) * 0x32))
116 #define LTC2992_REG_SENSE_MIN_THRESH(x) (LTC2992_REG_SENSE1_MIN_THRESH + ((x) * 0x32))
117 #define LTC2992_REG_POWER_FAULT(x) (LTC2992_REG_FAULT1 + ((x) * 0x32))
118 #define LTC2992_REG_SENSE_FAULT(x) (LTC2992_REG_FAULT1 + ((x) * 0x32))
119 #define LTC2992_REG_DSENSE_FAULT(x) (LTC2992_REG_FAULT1 + ((x) * 0x32))
120 
121 #define LTC2992_OFFSET_CAL_MSK NO_OS_BIT(7)
122 #define LTC2992_MEASURE_MODE_MSK NO_OS_GENMASK(6,5)
123 #define LTC2992_VSEL_CON_MSK NO_OS_GENMASK(4,3)
124 #define LTC2992_VSEL_SNAP_MSK NO_OS_GENMASK(2,0)
125 #define LTC2992_POWER_ALERT_MSK NO_OS_GENMASK(7,6)
126 #define LTC2992_DSENSE_ALERT_MSK NO_OS_GENMASK(5,4)
127 #define LTC2992_SENSE_ALERT_MSK NO_OS_GENMASK(3,2)
128 #define LTC2992_ISUM_ALERT_MSK NO_OS_GENMASK(3,2)
129 #define LTC2992_PSUM_ALERT_MSK NO_OS_GENMASK(1,0)
130 #define LTC2992_POWER_FAULT_MSK NO_OS_GENMASK(7,6)
131 #define LTC2992_DSENSE_FAULT_MSK NO_OS_GENMASK(5,4)
132 #define LTC2992_SENSE_FAULT_MSK NO_OS_GENMASK(3,2)
133 #define LTC2992_ISUM_FAULT_MSK NO_OS_GENMASK(3,2)
134 #define LTC2992_PSUM_FAULT_MSK NO_OS_GENMASK(1,0)
135 #define LTC2992_12B_SENSE_VAL_MSK NO_OS_GENMASK(15,4)
136 #define LTC2992_12B_POWER_VAL_MSK NO_OS_GENMASK(23,0)
137 #define LTC2992_8B_SENSE_VAL_MSK NO_OS_GENMASK(15,8)
138 #define LTC2992_8B_POWER_VAL_MSK NO_OS_GENMASK(23,8)
139 
140 #define LTC2992_G1_FAULT_ALERT_MSK 0x03
141 #define LTC2992_G2_FAULT_ALERT_MSK 0x03
142 #define LTC2992_G3_FAULT_ALERT_MSK 0xC0
143 #define LTC2992_G4_FAULT_ALERT_MSK 0x30
144 
145 #define LTC2992_ALERT_CLR_BIT NO_OS_BIT(7)
146 #define LTC2992_READ_CTRL_BIT NO_OS_BIT(5)
147 #define LTC2992_STUCK_BUS_TIMEOUT_BIT NO_OS_BIT(4)
148 #define LTC2992_PEAK_RST_BIT NO_OS_BIT(3)
149 #define LTC2992_RESET_BIT NO_OS_BIT(0)
150 #define LTC2992_G4_ALERT_PIN_BIT NO_OS_BIT(7)
151 #define LTC2992_G1_CTRL_BIT NO_OS_BIT(7)
152 #define LTC2992_G2_CTRL_BIT NO_OS_BIT(6)
153 #define LTC2992_G3_CTRL_BIT NO_OS_BIT(0)
154 #define LTC2992_G4_CTRL_BIT NO_OS_BIT(6)
155 
156 #define LTC2992_MFR_ID_VALUE 0x62
157 #define LTC2992_RESOLUTION_POS 7
158 
159 /******************************************************************************/
160 /*************************** Types Declarations *******************************/
161 /******************************************************************************/
162 
167 };
168 
174 };
175 
179 };
180 
184 };
185 
193 };
194 
198 };
199 
205 };
206 
212 };
213 
223 };
224 
228 };
229 
235 };
236 
242 };
243 
245  uint8_t data;
246  uint8_t max;
247  uint8_t min;
248  uint8_t max_thresh;
249  uint8_t min_thresh;
250  uint8_t fault;
251  uint8_t alert;
253  uint8_t ctrl;
254  uint8_t ctrl_mask;
255 };
256 
257 struct ltc2992_dev {
260  uint32_t shunt_resistor;
261  uint8_t resolution;
262 };
263 
272  uint32_t shunt_resistor;
276 };
277 
278 /******************************************************************************/
279 /************************ Functions Declarations ******************************/
280 /******************************************************************************/
281 
282 /* Generate device I2C address based on ADR pin states */
284  enum ltc2992_adr_state a0,
285  enum ltc2992_adr_state a1);
286 
287 /* Initialize communication peripheral for the device */
288 int ltc2992_init(struct ltc2992_dev **device,
290 
291 /* Free resources allocated to the device */
292 int ltc2992_remove(struct ltc2992_dev *dev);
293 
294 /* Read raw data from device register */
295 int ltc2992_read_reg(struct ltc2992_dev *dev, uint8_t addr,
296  uint32_t *data, uint8_t num_bytes);
297 
298 /* Write raw data to device register */
299 int ltc2992_write_reg(struct ltc2992_dev *dev, uint8_t addr,
300  uint32_t value, uint8_t num_bytes);
301 
302 /* Update register value in the device */
303 int ltc2992_update_reg(struct ltc2992_dev *dev, uint8_t addr,
304  uint8_t mask, uint8_t val);
305 
306 /* Read bus voltage in a sense channel */
307 int ltc2992_get_voltage(struct ltc2992_dev *dev,
308  enum ltc2992_sense sense,
309  uint32_t *voltage_data);
310 
311 /* Read shunt voltage in a sense channel */
312 int ltc2992_get_vshunt(struct ltc2992_dev *dev,
313  enum ltc2992_sense sense,
314  uint32_t *vshunt_data);
315 
316 /* Read bus current along a sense channel */
317 int ltc2992_get_current(struct ltc2992_dev *dev,
318  enum ltc2992_sense sense,
319  uint32_t *current_data);
320 
321 /* Read bus power output in a sense channel */
322 int ltc2992_get_power(struct ltc2992_dev *dev,
323  enum ltc2992_sense sense,
324  uint32_t *power_data);
325 
326 /* Read the shunt voltage sum or power sum of both sense channels */
327 int ltc2992_get_sum(struct ltc2992_dev *dev,
328  enum ltc2992_channel chan,
329  uint32_t *sum_data);
330 
331 /* Read sense data at a SENSE channel */
332 int ltc2992_get_sense_data(struct ltc2992_dev *dev,
333  enum ltc2992_sense sense,
334  enum ltc2992_channel chan,
335  uint32_t *data);
336 
337 /* Read maximum sense data at a SENSE channel */
338 int ltc2992_get_max_data(struct ltc2992_dev *dev,
339  enum ltc2992_sense sense,
340  enum ltc2992_channel chan,
341  uint32_t *data);
342 
343 /* Read minimum sense data at a SENSE channel */
344 int ltc2992_get_min_data(struct ltc2992_dev *dev,
345  enum ltc2992_sense sense,
346  enum ltc2992_channel chan,
347  uint32_t *data);
348 
349 /* Set upper thresh level for alert at a SENSE channel */
350 int ltc2992_set_max_thresh(struct ltc2992_dev *dev,
351  enum ltc2992_sense sense,
352  enum ltc2992_channel chan,
353  uint32_t thresh_value);
354 /* Set lower thresh level for alert at a SENSE channel */
355 int ltc2992_set_min_thresh(struct ltc2992_dev *dev,
356  enum ltc2992_sense sense,
357  enum ltc2992_channel chan,
358  uint32_t thresh_value);
359 
360 /* Enable alert */
361 int ltc2992_set_alert(struct ltc2992_dev *dev,
362  enum ltc2992_sense sense,
363  enum ltc2992_channel chan,
364  enum ltc2992_alert_value alert);
365 
366 /* Get fault status */
367 int ltc2992_get_fault(struct ltc2992_dev *dev,
368  enum ltc2992_sense sense,
369  enum ltc2992_channel chan,
370  enum ltc2992_fault_status *fault);
371 
372 /* Clear fault status */
373 int ltc2992_clear_fault(struct ltc2992_dev *dev,
374  enum ltc2992_sense sense,
375  enum ltc2992_channel chan);
376 
377 /* Get data from a GPIO data converter */
378 int ltc2992_get_gpio_data(struct ltc2992_dev *dev,
379  enum ltc2992_gpio gpio,
380  uint32_t *gpio_data);
381 
382 /* Get maximum data from a GPIO data converter */
383 int ltc2992_get_gpio_max_data(struct ltc2992_dev *dev,
384  enum ltc2992_gpio gpio,
385  uint32_t *gpio_data);
386 
387 /* Get minimum data from a GPIO data converter */
388 int ltc2992_get_gpio_min_data(struct ltc2992_dev *dev,
389  enum ltc2992_gpio gpio,
390  uint32_t *gpio_data);
391 
392 /* Set upper threshold level in a GPIO */
394  enum ltc2992_gpio gpio,
395  uint32_t thresh_value);
396 
397 /* Set lower threshold level in a GPIO */
399  enum ltc2992_gpio gpio,
400  uint32_t thresh_value);
401 
402 /* Enable alert when GPIO level reaches beyond threshold limit */
403 int ltc2992_set_gpio_alert(struct ltc2992_dev *dev,
404  enum ltc2992_gpio gpio,
405  enum ltc2992_alert_value alert_value);
406 
407 /* Get GPIO fault status */
408 int ltc2992_get_gpio_fault(struct ltc2992_dev *dev,
409  enum ltc2992_gpio gpio,
410  enum ltc2992_fault_status *fault);
411 
412 /* Clear GPIO fault status */
413 int ltc2992_clear_gpio_fault(struct ltc2992_dev *dev,
414  enum ltc2992_gpio gpio);
415 
416 /* Reset alert pin (GPI04) status */
417 int ltc2992_reset_alert_pin(struct ltc2992_dev *dev);
418 
419 /* Get GPIO state */
420 int ltc2992_get_gpio_state(struct ltc2992_dev *dev,
421  enum ltc2992_gpio gpio,
422  uint8_t *state);
423 
424 /* Set GPIO output */
425 int ltc2992_set_gpio_output(struct ltc2992_dev *dev,
426  enum ltc2992_gpio gpio,
427  enum ltc2992_gpio_output output);
428 #endif /* __LTC2992_H__ */
LTC2992_REG_G4_MIN
#define LTC2992_REG_G4_MIN
Definition: ltc2992.h:82
LTC2992_REG_DSENSE
#define LTC2992_REG_DSENSE(x)
Definition: ltc2992.h:107
LTC2992_MODE_SHUTDOWN
@ LTC2992_MODE_SHUTDOWN
Definition: ltc2992.h:204
LTC2992_VSEL_CON_MSK
#define LTC2992_VSEL_CON_MSK
Definition: ltc2992.h:123
LTC2992_VSEL_SNAP_MSK
#define LTC2992_VSEL_SNAP_MSK
Definition: ltc2992.h:124
ltc2992_set_gpio_min_thresh
int ltc2992_set_gpio_min_thresh(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t thresh_value)
Set lower threshold level in a GPIO.
Definition: ltc2992.c:1266
LTC2992_G3_CTRL_BIT
#define LTC2992_G3_CTRL_BIT
Definition: ltc2992.h:153
MILLI
#define MILLI
Definition: no_os_units.h:48
no_os_put_unaligned_be16
void no_os_put_unaligned_be16(uint16_t val, uint8_t *buf)
no_os_put_unaligned_be24
void no_os_put_unaligned_be24(uint32_t val, uint8_t *buf)
LTC2992_CALIBRATE_ON_DEMAND
@ LTC2992_CALIBRATE_ON_DEMAND
Definition: ltc2992.h:197
ltc2992_regmap::alert
uint8_t alert
Definition: ltc2992.h:251
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ltc2992_set_min_thresh
int ltc2992_set_min_thresh(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t thresh_value)
Set lower thresh level for alert at a SENSE channel.
Definition: ltc2992.c:892
LTC2992_REG_FAULT3
#define LTC2992_REG_FAULT3
Definition: ltc2992.h:96
ltc2992_init
int ltc2992_init(struct ltc2992_dev **device, struct ltc2992_init_param *init_param)
Initialize communication peripheral for the device.
Definition: ltc2992.c:179
LTC2992_REG_G3_MAX_THRESH
#define LTC2992_REG_G3_MAX_THRESH
Definition: ltc2992.h:78
ltc2992_fault_status
ltc2992_fault_status
Definition: ltc2992.h:237
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
LTC2992_MODE_SINGLE_CYCLE
@ LTC2992_MODE_SINGLE_CYCLE
Definition: ltc2992.h:203
LTC2992_12B_POWER_VAL_MSK
#define LTC2992_12B_POWER_VAL_MSK
Definition: ltc2992.h:136
dev_err
#define dev_err(dev, format,...)
Definition: ad9361_util.h:63
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
LTC2992_REG_ISUM_MIN_THRESH
#define LTC2992_REG_ISUM_MIN_THRESH
Definition: ltc2992.h:89
LTC2992_REG_FAULT2
#define LTC2992_REG_FAULT2
Definition: ltc2992.h:69
LTC2992_REG_NADC
#define LTC2992_REG_NADC
Definition: ltc2992.h:47
LTC2992_REG_ISUM_MAX
#define LTC2992_REG_ISUM_MAX
Definition: ltc2992.h:86
ltc2992_get_power
int ltc2992_get_power(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *power_data)
Read bus power output in a sense channel.
Definition: ltc2992.c:621
ltc2992_dev::alert_gpio_desc
struct no_os_gpio_desc * alert_gpio_desc
Definition: ltc2992.h:259
LTC2992_GPIO1
@ LTC2992_GPIO1
Definition: ltc2992.h:170
LTC2992_READ_CTRL_BIT
#define LTC2992_READ_CTRL_BIT
Definition: ltc2992.h:146
LTC2992_G1_CTRL_BIT
#define LTC2992_G1_CTRL_BIT
Definition: ltc2992.h:151
LTC2992_REG_GPIO4_CTRL
#define LTC2992_REG_GPIO4_CTRL
Definition: ltc2992.h:99
LTC2992_OFFSET_CAL_MSK
#define LTC2992_OFFSET_CAL_MSK
Definition: ltc2992.h:121
LTC2992_REG_ISUM_MAX_THRESH
#define LTC2992_REG_ISUM_MAX_THRESH
Definition: ltc2992.h:88
ltc2992_get_sum
int ltc2992_get_sum(struct ltc2992_dev *dev, enum ltc2992_channel chan, uint32_t *sum_data)
Read the shunt voltage sum or power sum of both sense channels.
Definition: ltc2992.c:638
LTC2992_FAULT_OVERVALUE
@ LTC2992_FAULT_OVERVALUE
Definition: ltc2992.h:240
ltc2992_get_gpio_fault
int ltc2992_get_gpio_fault(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_fault_status *fault)
Get GPIO fault status.
Definition: ltc2992.c:1315
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
LTC2992_REG_POWER_MIN
#define LTC2992_REG_POWER_MIN(x)
Definition: ltc2992.h:104
ltc2992_gpio
ltc2992_gpio
Definition: ltc2992.h:169
LTC2992_REG_G2_MAX
#define LTC2992_REG_G2_MAX
Definition: ltc2992.h:71
no_os_units.h
Header file of Units.
LTC2992_REG_MFR_SPECIAL_ID
#define LTC2992_REG_MFR_SPECIAL_ID
Definition: ltc2992.h:100
ltc2992_get_vshunt
int ltc2992_get_vshunt(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *vshunt_data)
Read shunt voltage in a sense channel.
Definition: ltc2992.c:579
ltc2992_get_max_data
int ltc2992_get_max_data(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
Read maximum sense data at a SENSE channel.
Definition: ltc2992.c:720
LTC2992_CONT_VSEL_GPIOS_ONLY
@ LTC2992_CONT_VSEL_GPIOS_ONLY
Definition: ltc2992.h:211
LTC2992_REG_G2
#define LTC2992_REG_G2
Definition: ltc2992.h:70
ltc2992_init_param::continuous_vsel
enum ltc2992_continuous_vsel continuous_vsel
Definition: ltc2992.h:270
LTC2992_REG_G1_MAX_THRESH
#define LTC2992_REG_G1_MAX_THRESH
Definition: ltc2992.h:66
LTC2992_REG_DSENSE_MAX
#define LTC2992_REG_DSENSE_MAX(x)
Definition: ltc2992.h:108
LTC2992_FAULT_ALL
@ LTC2992_FAULT_ALL
Definition: ltc2992.h:241
LTC2992_RESOLUTION_12_BIT
@ LTC2992_RESOLUTION_12_BIT
Definition: ltc2992.h:226
LTC2992_SNAP_VSEL_SENSE1
@ LTC2992_SNAP_VSEL_SENSE1
Definition: ltc2992.h:215
ltc2992_channel
ltc2992_channel
Definition: ltc2992.h:186
ltc2992_get_gpio_fault
int ltc2992_get_gpio_fault(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_fault_status *fault)
Get GPIO fault status.
Definition: ltc2992.c:1315
ltc2992_get_sense_data
int ltc2992_get_sense_data(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
Read sense data at a SENSE channel.
Definition: ltc2992.c:682
ltc2992_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: ltc2992.h:258
LTC2992_SNAP_VSEL_GPIO3
@ LTC2992_SNAP_VSEL_GPIO3
Definition: ltc2992.h:219
ltc2992_init_param::shunt_resistor
uint32_t shunt_resistor
Definition: ltc2992.h:272
LTC2992_REG_POWER
#define LTC2992_REG_POWER(x)
Definition: ltc2992.h:102
ltc2992_init_param::measure_mode
enum ltc2992_measure_mode measure_mode
Definition: ltc2992.h:269
device
Definition: ad9361_util.h:69
LTC2992_REG_G1_MIN_THRESH
#define LTC2992_REG_G1_MIN_THRESH
Definition: ltc2992.h:67
ltc2992_write_reg
int ltc2992_write_reg(struct ltc2992_dev *dev, uint8_t addr, uint32_t value, uint8_t num_bytes)
Write raw data to device register.
Definition: ltc2992.c:332
LTC2992_REG_G1_MIN
#define LTC2992_REG_G1_MIN
Definition: ltc2992.h:65
LTC2992_REG_SENSE
#define LTC2992_REG_SENSE(x)
Definition: ltc2992.h:112
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
LTC2992_12B_SENSE_VAL_MSK
#define LTC2992_12B_SENSE_VAL_MSK
Definition: ltc2992.h:135
LTC2992_ALERT_CLR_BIT
#define LTC2992_ALERT_CLR_BIT
Definition: ltc2992.h:145
LTC2992_POWER_FAULT_MSK
#define LTC2992_POWER_FAULT_MSK
Definition: ltc2992.h:130
ltc2992_set_gpio_max_thresh
int ltc2992_set_gpio_max_thresh(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t thresh_value)
Set upper threshold level in a GPIO.
Definition: ltc2992.c:1247
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:124
LTC2992_SNAP_VSEL_GPIO1_GPIO2
@ LTC2992_SNAP_VSEL_GPIO1_GPIO2
Definition: ltc2992.h:222
LTC2992_MFR_ID_VALUE
#define LTC2992_MFR_ID_VALUE
Definition: ltc2992.h:156
LTC2992_ALERT_DISABLE_ALL
@ LTC2992_ALERT_DISABLE_ALL
Definition: ltc2992.h:231
LTC2992_REG_G4_MAX
#define LTC2992_REG_G4_MAX
Definition: ltc2992.h:81
LTC2992_REG_G3_MIN_THRESH
#define LTC2992_REG_G3_MIN_THRESH
Definition: ltc2992.h:79
LTC2992_G4_CTRL_BIT
#define LTC2992_G4_CTRL_BIT
Definition: ltc2992.h:154
MICRO
#define MICRO
Definition: no_os_units.h:49
LTC2992_VOLTAGE
@ LTC2992_VOLTAGE
Definition: ltc2992.h:187
LTC2992_REG_POWER_MAX_THRESH
#define LTC2992_REG_POWER_MAX_THRESH(x)
Definition: ltc2992.h:105
LTC2992_CONT_VSEL_SENSE_ONLY
@ LTC2992_CONT_VSEL_SENSE_ONLY
Definition: ltc2992.h:209
ltc2992_regmap::ctrl_mask
uint8_t ctrl_mask
Definition: ltc2992.h:254
LTC2992_SNAP_VSEL_SENSE1_SENSE2
@ LTC2992_SNAP_VSEL_SENSE1_SENSE2
Definition: ltc2992.h:221
ltc2992_set_gpio_max_thresh
int ltc2992_set_gpio_max_thresh(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t thresh_value)
Set upper threshold level in a GPIO.
Definition: ltc2992.c:1247
ltc2992_init_param::snapshot_vsel
enum ltc2992_snapshot_vsel snapshot_vsel
Definition: ltc2992.h:271
LTC2992_REG_PSUM_MIN
#define LTC2992_REG_PSUM_MIN
Definition: ltc2992.h:92
LTC2992_MODE_CONTINUOUS
@ LTC2992_MODE_CONTINUOUS
Definition: ltc2992.h:201
LTC2992_REG_ALERT2
#define LTC2992_REG_ALERT2
Definition: ltc2992.h:68
ltc2992_remove
int ltc2992_remove(struct ltc2992_dev *dev)
Free resources allocated to the device.
Definition: ltc2992.c:272
ltc2992_dev::shunt_resistor
uint32_t shunt_resistor
Definition: ltc2992.h:260
ltc2992_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: ltc2992.h:265
ltc2992_get_gpio_data
int ltc2992_get_gpio_data(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
Get data from a GPIO data converter.
Definition: ltc2992.c:1193
LTC2992_REG_DSENSE_MIN_THRESH
#define LTC2992_REG_DSENSE_MIN_THRESH(x)
Definition: ltc2992.h:111
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
LTC2992_REG_PSUM_MAX
#define LTC2992_REG_PSUM_MAX
Definition: ltc2992.h:91
ltc2992_adr_state
ltc2992_adr_state
Definition: ltc2992.h:163
LTC2992_CONT_VSEL_ALL
@ LTC2992_CONT_VSEL_ALL
Definition: ltc2992.h:208
LTC2992_CURRENT
@ LTC2992_CURRENT
Definition: ltc2992.h:189
ltc2992_write_reg
int ltc2992_write_reg(struct ltc2992_dev *dev, uint8_t addr, uint32_t value, uint8_t num_bytes)
Write raw data to device register.
Definition: ltc2992.c:332
ltc2992_get_gpio_data
int ltc2992_get_gpio_data(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
Get data from a GPIO data converter.
Definition: ltc2992.c:1193
ltc2992_calibration
ltc2992_calibration
Definition: ltc2992.h:195
LTC2992_G2_FAULT_ALERT_MSK
#define LTC2992_G2_FAULT_ALERT_MSK
Definition: ltc2992.h:141
LTC2992_REG_DSENSE_FAULT
#define LTC2992_REG_DSENSE_FAULT(x)
Definition: ltc2992.h:119
LTC2992_ADR_HIGH
@ LTC2992_ADR_HIGH
Definition: ltc2992.h:164
LTC2992_PSUM_FAULT_MSK
#define LTC2992_PSUM_FAULT_MSK
Definition: ltc2992.h:134
ltc2992_init_param::fault_clear_on_read
bool fault_clear_on_read
Definition: ltc2992.h:274
LTC2992_REG_G2_MAX_THRESH
#define LTC2992_REG_G2_MAX_THRESH
Definition: ltc2992.h:73
LTC2992_MODE_SNAPSHOT
@ LTC2992_MODE_SNAPSHOT
Definition: ltc2992.h:202
LTC2992_SENSE_ALERT_MSK
#define LTC2992_SENSE_ALERT_MSK
Definition: ltc2992.h:127
LTC2992_REG_DSENSE_MAX_THRESH
#define LTC2992_REG_DSENSE_MAX_THRESH(x)
Definition: ltc2992.h:110
ltc2992_regmap
Definition: ltc2992.h:244
ltc2992_regmap::max_thresh
uint8_t max_thresh
Definition: ltc2992.h:248
ltc2992_set_gpio_output
int ltc2992_set_gpio_output(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_gpio_output output)
Set GPIO output.
Definition: ltc2992.c:1404
LTC2992_ISUM_FAULT_MSK
#define LTC2992_ISUM_FAULT_MSK
Definition: ltc2992.h:133
LTC2992_ALERT_ENABLE_OV
@ LTC2992_ALERT_ENABLE_OV
Definition: ltc2992.h:233
ltc2992_addr_gen
int ltc2992_addr_gen(struct ltc2992_init_param *init_param, enum ltc2992_adr_state a0, enum ltc2992_adr_state a1)
Generate device I2C address based on ADR pin states.
Definition: ltc2992.c:118
ltc2992_regmap::min_thresh
uint8_t min_thresh
Definition: ltc2992.h:249
LTC2992_REG_DSENSE_MIN
#define LTC2992_REG_DSENSE_MIN(x)
Definition: ltc2992.h:109
LTC2992_FAULT_NONE
@ LTC2992_FAULT_NONE
Definition: ltc2992.h:238
LTC2992_GPIO_OUTPUT_HI_Z
@ LTC2992_GPIO_OUTPUT_HI_Z
Definition: ltc2992.h:177
no_os_get_unaligned_be24
uint32_t no_os_get_unaligned_be24(uint8_t *buf)
ltc2992_get_current
int ltc2992_get_current(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *current_data)
Read bus current along a sense channel.
Definition: ltc2992.c:596
ltc2992_regmap::min
uint8_t min
Definition: ltc2992.h:247
LTC2992_SNAP_VSEL_GPIO4
@ LTC2992_SNAP_VSEL_GPIO4
Definition: ltc2992.h:220
LTC2992_REG_SENSE_FAULT
#define LTC2992_REG_SENSE_FAULT(x)
Definition: ltc2992.h:118
ltc2992_regmap::ctrl
uint8_t ctrl
Definition: ltc2992.h:253
no_os_mul_u32_u32
uint64_t no_os_mul_u32_u32(uint32_t a, uint32_t b)
LTC2992_STUCK_BUS_TIMEOUT_BIT
#define LTC2992_STUCK_BUS_TIMEOUT_BIT
Definition: ltc2992.h:147
LTC2992_GPIO2
@ LTC2992_GPIO2
Definition: ltc2992.h:171
ltc2992_update_reg
int ltc2992_update_reg(struct ltc2992_dev *dev, uint8_t addr, uint8_t mask, uint8_t val)
Update register value in the device.
Definition: ltc2992.c:365
LTC2992_REG_G2_MIN_THRESH
#define LTC2992_REG_G2_MIN_THRESH
Definition: ltc2992.h:74
LTC2992_VSHUNT
@ LTC2992_VSHUNT
Definition: ltc2992.h:188
LTC2992_GPIO_OUTPUT_PULL_LOW
@ LTC2992_GPIO_OUTPUT_PULL_LOW
Definition: ltc2992.h:178
ltc2992_get_current
int ltc2992_get_current(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *current_data)
Read bus current along a sense channel.
Definition: ltc2992.c:596
LTC2992_REG_G1_MAX
#define LTC2992_REG_G1_MAX
Definition: ltc2992.h:64
LTC2992_REG_ISUM
#define LTC2992_REG_ISUM
Definition: ltc2992.h:85
LTC2992_PEAK_RST_BIT
#define LTC2992_PEAK_RST_BIT
Definition: ltc2992.h:148
ltc2992_init_param::stuck_bus_timer_wakeup_en
bool stuck_bus_timer_wakeup_en
Definition: ltc2992.h:275
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
ltc2992_get_gpio_state
int ltc2992_get_gpio_state(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint8_t *state)
Get GPIO state.
Definition: ltc2992.c:1375
ltc2992_reset_alert_pin
int ltc2992_reset_alert_pin(struct ltc2992_dev *dev)
Reset alert pin (GPI04) status.
Definition: ltc2992.c:1355
LTC2992_REG_CTRLA
#define LTC2992_REG_CTRLA
Definition: ltc2992.h:43
LTC2992_ADR_LOW
@ LTC2992_ADR_LOW
Definition: ltc2992.h:165
no_os_clamp
#define no_os_clamp(val, min_val, max_val)
Definition: no_os_util.h:69
LTC2992_ISUM
@ LTC2992_ISUM
Definition: ltc2992.h:191
ltc2992_remove
int ltc2992_remove(struct ltc2992_dev *dev)
Free resources allocated to the device.
Definition: ltc2992.c:272
ltc2992_gpio_output
ltc2992_gpio_output
Definition: ltc2992.h:176
ltc2992_dev::resolution
uint8_t resolution
Definition: ltc2992.h:261
ltc2992_init_param::alert_clear
bool alert_clear
Definition: ltc2992.h:273
LTC2992_REG_POWER_MIN_THRESH
#define LTC2992_REG_POWER_MIN_THRESH(x)
Definition: ltc2992.h:106
LTC2992_REG_SENSE_MAX_THRESH
#define LTC2992_REG_SENSE_MAX_THRESH(x)
Definition: ltc2992.h:115
ltc2992_get_fault
int ltc2992_get_fault(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, enum ltc2992_fault_status *fault)
Get fault status.
Definition: ltc2992.c:1037
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
ltc2992_get_voltage
int ltc2992_get_voltage(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *voltage_data)
Read bus voltage in a sense channel.
Definition: ltc2992.c:562
ltc2992_get_gpio_state
int ltc2992_get_gpio_state(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint8_t *state)
Get GPIO state.
Definition: ltc2992.c:1375
ltc2992.h
ltc2992_sense
ltc2992_sense
Definition: ltc2992.h:181
ltc2992_alert_value
ltc2992_alert_value
Definition: ltc2992.h:230
LTC2992_REG_CTRLB
#define LTC2992_REG_CTRLB
Definition: ltc2992.h:44
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
LTC2992_G3_FAULT_ALERT_MSK
#define LTC2992_G3_FAULT_ALERT_MSK
Definition: ltc2992.h:142
ltc2992_init_param::resolution
enum ltc2992_resolution resolution
Definition: ltc2992.h:267
LTC2992_POWER_ALERT_MSK
#define LTC2992_POWER_ALERT_MSK
Definition: ltc2992.h:125
ltc2992_get_gpio_min_data
int ltc2992_get_gpio_min_data(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
Get minimum data from a GPIO data converter.
Definition: ltc2992.c:1229
LTC2992_REG_GPIO_STATUS
#define LTC2992_REG_GPIO_STATUS
Definition: ltc2992.h:97
ltc2992_resolution
ltc2992_resolution
Definition: ltc2992.h:225
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
LTC2992_DSENSE_ALERT_MSK
#define LTC2992_DSENSE_ALERT_MSK
Definition: ltc2992.h:126
ltc2992_read_reg
int ltc2992_read_reg(struct ltc2992_dev *dev, uint8_t addr, uint32_t *data, uint8_t num_bytes)
Read raw data from device register.
Definition: ltc2992.c:292
LTC2992_REG_SENSE_MIN_THRESH
#define LTC2992_REG_SENSE_MIN_THRESH(x)
Definition: ltc2992.h:116
no_os_clamp_t
#define no_os_clamp_t(type, val, min_val, max_val)
Definition: no_os_util.h:71
no_os_i2c.h
Header file of I2C Interface.
LTC2992_ALERT_ENABLE_UV
@ LTC2992_ALERT_ENABLE_UV
Definition: ltc2992.h:232
LTC2992_REG_G3
#define LTC2992_REG_G3
Definition: ltc2992.h:75
ltc2992_set_gpio_output
int ltc2992_set_gpio_output(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_gpio_output output)
Set GPIO output.
Definition: ltc2992.c:1404
ltc2992_snapshot_vsel
ltc2992_snapshot_vsel
Definition: ltc2992.h:214
LTC2992_CONT_VSEL_GPIO1_GPIO2
@ LTC2992_CONT_VSEL_GPIO1_GPIO2
Definition: ltc2992.h:210
LTC2992_REG_GPIO_IO_CTRL
#define LTC2992_REG_GPIO_IO_CTRL
Definition: ltc2992.h:98
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ltc2992_clear_gpio_fault
int ltc2992_clear_gpio_fault(struct ltc2992_dev *dev, enum ltc2992_gpio gpio)
Clear GPIO fault status.
Definition: ltc2992.c:1343
ltc2992_reset_alert_pin
int ltc2992_reset_alert_pin(struct ltc2992_dev *dev)
Reset alert pin (GPI04) status.
Definition: ltc2992.c:1355
ltc2992_set_alert
int ltc2992_set_alert(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, enum ltc2992_alert_value alert)
Enable alert.
Definition: ltc2992.c:951
ltc2992_get_gpio_min_data
int ltc2992_get_gpio_min_data(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
Get minimum data from a GPIO data converter.
Definition: ltc2992.c:1229
ltc2992_addr_gen
int ltc2992_addr_gen(struct ltc2992_init_param *init_param, enum ltc2992_adr_state a0, enum ltc2992_adr_state a1)
Generate device I2C address based on ADR pin states.
Definition: ltc2992.c:118
ltc2992_measure_mode
ltc2992_measure_mode
Definition: ltc2992.h:200
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
ltc2992_set_gpio_alert
int ltc2992_set_gpio_alert(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_alert_value alert_value)
Enable alert when GPIO level reaches beyond threshold limit.
Definition: ltc2992.c:1292
LTC2992_FAULT_UNDERVALUE
@ LTC2992_FAULT_UNDERVALUE
Definition: ltc2992.h:239
LTC2992_REG_G3_MIN
#define LTC2992_REG_G3_MIN
Definition: ltc2992.h:77
ltc2992_dev
Definition: ltc2992.h:257
ltc2992_regmap::fault_alert_mask
uint8_t fault_alert_mask
Definition: ltc2992.h:252
LTC2992_REG_POWER_FAULT
#define LTC2992_REG_POWER_FAULT(x)
Definition: ltc2992.h:117
LTC2992_REG_G2_MIN
#define LTC2992_REG_G2_MIN
Definition: ltc2992.h:72
LTC2992_PSUM
@ LTC2992_PSUM
Definition: ltc2992.h:192
ltc2992_regmap::fault
uint8_t fault
Definition: ltc2992.h:250
LTC2992_REG_G4_MAX_THRESH
#define LTC2992_REG_G4_MAX_THRESH
Definition: ltc2992.h:83
LTC2992_REG_ISUM_MIN
#define LTC2992_REG_ISUM_MIN
Definition: ltc2992.h:87
ltc2992_get_sum
int ltc2992_get_sum(struct ltc2992_dev *dev, enum ltc2992_channel chan, uint32_t *sum_data)
Read the shunt voltage sum or power sum of both sense channels.
Definition: ltc2992.c:638
ltc2992_get_fault
int ltc2992_get_fault(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, enum ltc2992_fault_status *fault)
Get fault status.
Definition: ltc2992.c:1037
LTC2992_REG_FAULT1
#define LTC2992_REG_FAULT1
Definition: ltc2992.h:46
LTC2992_REG_PSUM_MAX_THRESH
#define LTC2992_REG_PSUM_MAX_THRESH
Definition: ltc2992.h:93
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
ltc2992_update_reg
int ltc2992_update_reg(struct ltc2992_dev *dev, uint8_t addr, uint8_t mask, uint8_t val)
Update register value in the device.
Definition: ltc2992.c:365
ltc2992_clear_fault
int ltc2992_clear_fault(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan)
Clear fault status.
Definition: ltc2992.c:1112
LTC2992_SNAP_VSEL_GPIO2
@ LTC2992_SNAP_VSEL_GPIO2
Definition: ltc2992.h:218
ltc2992_get_max_data
int ltc2992_get_max_data(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
Read maximum sense data at a SENSE channel.
Definition: ltc2992.c:720
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
LTC2992_REG_PSUM
#define LTC2992_REG_PSUM
Definition: ltc2992.h:90
LTC2992_REG_G1
#define LTC2992_REG_G1
Definition: ltc2992.h:63
LTC2992_G4_ALERT_PIN_BIT
#define LTC2992_G4_ALERT_PIN_BIT
Definition: ltc2992.h:150
ltc2992_init_param
Definition: ltc2992.h:264
LTC2992_REG_SENSE_MAX
#define LTC2992_REG_SENSE_MAX(x)
Definition: ltc2992.h:113
ltc2992_set_gpio_min_thresh
int ltc2992_set_gpio_min_thresh(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t thresh_value)
Set lower threshold level in a GPIO.
Definition: ltc2992.c:1266
ltc2992_get_gpio_max_data
int ltc2992_get_gpio_max_data(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
Get maximum data from a GPIO data converter.
Definition: ltc2992.c:1211
LTC2992_ALERT_ENABLE_ALL
@ LTC2992_ALERT_ENABLE_ALL
Definition: ltc2992.h:234
LTC2992_REG_ALERT3
#define LTC2992_REG_ALERT3
Definition: ltc2992.h:95
LTC2992_SNAP_VSEL_SENSE2
@ LTC2992_SNAP_VSEL_SENSE2
Definition: ltc2992.h:216
ltc2992_set_min_thresh
int ltc2992_set_min_thresh(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t thresh_value)
Set lower thresh level for alert at a SENSE channel.
Definition: ltc2992.c:892
LTC2992_SENSE2
@ LTC2992_SENSE2
Definition: ltc2992.h:183
LTC2992_MEASURE_MODE_MSK
#define LTC2992_MEASURE_MODE_MSK
Definition: ltc2992.h:122
ltc2992_get_voltage
int ltc2992_get_voltage(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *voltage_data)
Read bus voltage in a sense channel.
Definition: ltc2992.c:562
LTC2992_POWER
@ LTC2992_POWER
Definition: ltc2992.h:190
ltc2992_init
int ltc2992_init(struct ltc2992_dev **device, struct ltc2992_init_param *init_param)
Initialize communication peripheral for the device.
Definition: ltc2992.c:179
ltc2992_set_max_thresh
int ltc2992_set_max_thresh(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t thresh_value)
Set upper thresh level for alert at a SENSE channel.
Definition: ltc2992.c:840
no_os_gpio.h
Header file of GPIO Interface.
LTC2992_RESET_BIT
#define LTC2992_RESET_BIT
Definition: ltc2992.h:149
ltc2992_regmap::data
uint8_t data
Definition: ltc2992.h:245
ltc2992_get_gpio_max_data
int ltc2992_get_gpio_max_data(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
Get maximum data from a GPIO data converter.
Definition: ltc2992.c:1211
LTC2992_REG_POWER_MAX
#define LTC2992_REG_POWER_MAX(x)
Definition: ltc2992.h:103
LTC2992_REG_G4_MIN_THRESH
#define LTC2992_REG_G4_MIN_THRESH
Definition: ltc2992.h:84
LTC2992_RESOLUTION_8_BIT
@ LTC2992_RESOLUTION_8_BIT
Definition: ltc2992.h:227
ltc2992_get_power
int ltc2992_get_power(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *power_data)
Read bus power output in a sense channel.
Definition: ltc2992.c:621
LTC2992_8B_POWER_VAL_MSK
#define LTC2992_8B_POWER_VAL_MSK
Definition: ltc2992.h:138
LTC2992_G4_FAULT_ALERT_MSK
#define LTC2992_G4_FAULT_ALERT_MSK
Definition: ltc2992.h:143
LTC2992_REG_PSUM_MIN_THRESH
#define LTC2992_REG_PSUM_MIN_THRESH
Definition: ltc2992.h:94
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
LTC2992_G1_FAULT_ALERT_MSK
#define LTC2992_G1_FAULT_ALERT_MSK
Definition: ltc2992.h:140
LTC2992_GPIO4
@ LTC2992_GPIO4
Definition: ltc2992.h:173
ltc2992_read_reg
int ltc2992_read_reg(struct ltc2992_dev *dev, uint8_t addr, uint32_t *data, uint8_t num_bytes)
Read raw data from device register.
Definition: ltc2992.c:292
no_os_util.h
Header file of utility functions.
LTC2992_DSENSE_FAULT_MSK
#define LTC2992_DSENSE_FAULT_MSK
Definition: ltc2992.h:131
LTC2992_G2_CTRL_BIT
#define LTC2992_G2_CTRL_BIT
Definition: ltc2992.h:152
LTC2992_CALIBRATE_ALWAYS
@ LTC2992_CALIBRATE_ALWAYS
Definition: ltc2992.h:196
LTC2992_GPIO3
@ LTC2992_GPIO3
Definition: ltc2992.h:172
ltc2992_clear_gpio_fault
int ltc2992_clear_gpio_fault(struct ltc2992_dev *dev, enum ltc2992_gpio gpio)
Clear GPIO fault status.
Definition: ltc2992.c:1343
LTC2992_RESOLUTION_POS
#define LTC2992_RESOLUTION_POS
Definition: ltc2992.h:157
LTC2992_REG_G4
#define LTC2992_REG_G4
Definition: ltc2992.h:80
LTC2992_ADR_NC
@ LTC2992_ADR_NC
Definition: ltc2992.h:166
ltc2992_set_alert
int ltc2992_set_alert(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, enum ltc2992_alert_value alert)
Enable alert.
Definition: ltc2992.c:951
LTC2992_SNAP_VSEL_GPIO1
@ LTC2992_SNAP_VSEL_GPIO1
Definition: ltc2992.h:217
ltc2992_set_gpio_alert
int ltc2992_set_gpio_alert(struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_alert_value alert_value)
Enable alert when GPIO level reaches beyond threshold limit.
Definition: ltc2992.c:1292
LTC2992_REG_G3_MAX
#define LTC2992_REG_G3_MAX
Definition: ltc2992.h:76
ltc2992_get_vshunt
int ltc2992_get_vshunt(struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *vshunt_data)
Read shunt voltage in a sense channel.
Definition: ltc2992.c:579
ltc2992_get_min_data
int ltc2992_get_min_data(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
Read minimum sense data at a SENSE channel.
Definition: ltc2992.c:780
LTC2992_SENSE1
@ LTC2992_SENSE1
Definition: ltc2992.h:182
LTC2992_ISUM_ALERT_MSK
#define LTC2992_ISUM_ALERT_MSK
Definition: ltc2992.h:128
ltc2992_init_param::alert_gpio_init
struct no_os_gpio_init_param alert_gpio_init
Definition: ltc2992.h:266
LTC2992_8B_SENSE_VAL_MSK
#define LTC2992_8B_SENSE_VAL_MSK
Definition: ltc2992.h:137
errno.h
Error macro definition for ARM Compiler.
ltc2992_set_max_thresh
int ltc2992_set_max_thresh(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t thresh_value)
Set upper thresh level for alert at a SENSE channel.
Definition: ltc2992.c:840
LTC2992_PSUM_ALERT_MSK
#define LTC2992_PSUM_ALERT_MSK
Definition: ltc2992.h:129
LTC2992_REG_ALERT1
#define LTC2992_REG_ALERT1
Definition: ltc2992.h:45
ltc2992_continuous_vsel
ltc2992_continuous_vsel
Definition: ltc2992.h:207
LTC2992_SENSE_FAULT_MSK
#define LTC2992_SENSE_FAULT_MSK
Definition: ltc2992.h:132
ltc2992_get_sense_data
int ltc2992_get_sense_data(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
Read sense data at a SENSE channel.
Definition: ltc2992.c:682
ltc2992_clear_fault
int ltc2992_clear_fault(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan)
Clear fault status.
Definition: ltc2992.c:1112
MILLIAMPER_PER_AMPER
#define MILLIAMPER_PER_AMPER
Definition: no_os_units.h:62
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
ltc2992_init_param::calibration
enum ltc2992_calibration calibration
Definition: ltc2992.h:268
LTC2992_REG_SENSE_MIN
#define LTC2992_REG_SENSE_MIN(x)
Definition: ltc2992.h:114
ltc2992_get_min_data
int ltc2992_get_min_data(struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
Read minimum sense data at a SENSE channel.
Definition: ltc2992.c:780
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)
ltc2992_regmap::max
uint8_t max
Definition: ltc2992.h:246
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75