| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2992.h
Go to the documentation of this file.
1 /*!
2 LTC2992: Dual Wide Range Power Monitor
3
4 @verbatim
5
6 The LTC®2992 is a rail-to-rail system monitor that measures
7 current, voltage, power, charge and energy. It features an
8 operating range of 2.7V to 100V and includes a shunt regulator
9 for supplies above 100V. The current measurement common mode
10 range of 0V to 100V is independent of the input supply.
11 A 12-bit ADC measures load current, input voltage and an
12 auxiliary external voltage. Load current and internally
13 calculated power are integrated over an external clock or
14 crystal or internal oscillator time base for charge and energy.
15 An accurate time base allows the LTC2992 to provide measurement
16 accuracy of better than ±0.6% for charge and ±1% for power and
17 energy. Minimum and maximum values are stored and an overrange
18 alert with programmable thresholds minimizes the need for software
19 polling. Data is reported via a standard I2C interface.
20 Shutdown mode reduces power consumption to 15uA.
21
22
23 I2C DATA FORMAT (MSB FIRST):
24
25 Data Out:
26 Byte #1 Byte #2 Byte #3
27
28 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK X X C5 C4 C3 C2 C1 C0 SACK D7 D6 D5 D4 D3 D2 D1 D0 SACK STOP
29
30 Data In:
31 Byte #1 Byte #2 Byte #3
32
33 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK X X C5 C4 C3 C2 C1 C0 SACK Repeat Start SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK
34
35 Byte #4 Byte #5
36 MSB LSB
37 D15 D14 D13 D12 D11 D10 D9 D8 MACK D7 D6 D5 D4 D3 D2 D1 D0 MNACK STOP
38
39 START : I2C Start
40 Repeat Start: I2c Repeat Start
41 STOP : I2C Stop
42 SAx : I2C Address
43 SACK : I2C Slave Generated Acknowledge (Active Low)
44 MACK : I2C Master Generated Acknowledge (Active Low)
45 MNACK : I2c Master Generated Not Acknowledge
46 W : I2C Write (0)
47 R : I2C Read (1)
48 Cx : Command Code
49 Dx : Data Bits
50 X : Don't care
51
52
53
54 Example Code:
55
56 Read power, current and voltage
57
58 CTRLA = LTC2992_CHANNEL_CONFIG_V_C_3|LTC2992_SENSE_PLUS|LTC2992_OFFSET_CAL_EVERY|LTC2992_ADIN_GND; //! Set Control A register to default value in continuous mode
59 ack |= LTC2992_write(LTC2992_I2C_ADDRESS, LTC2992_CTRLA_REG, CTRLA); //! Sets the LTC2992 to continuous mode
60
61 resistor = .02; // Resistor Value On Demo Board
62
63 ack |= LTC2992_read_24_bits(LTC2992_I2C_ADDRESS, LTC2992_POWER_MSB2_REG, &power_code); // Reads the ADC registers that contains V^2
64 power = LTC2992_code_to_power(power_code, resistor, LTC2992_Power_lsb); // Calculates power from power code, resistor value and power lsb
65
66 ack |= LTC2992_read_12_bits(LTC2992_I2C_ADDRESS, LTC2992_DELTA_SENSE_MSB_REG, &current_code); // Reads the voltage code across sense resistor
67 current = LTC2992_code_to_current(current_code, resistor, LTC2992_DELTA_SENSE_lsb); // Calculates current from current code, resistor value and current lsb
68
69 ack |= LTC2992_read_12_bits(LTC2992_I2C_ADDRESS, LTC2992_SENSE_MSB_REG, &SENSE_code); // Reads SENSE voltage code
70 SENSE = LTC2992_SENSE_code_to_voltage(SENSE_code, LTC2992_SENSE_lsb); // Calculates SENSE voltage from SENSE code and lsb
71
72 ack |= LTC2992_read_32_bits(LTC2992_I2C_ADDRESS, LTC2992_ENERGY_MSB3_REG, &energy_code); // Reads energy code
73 energy = LTC2992_code_to_energy(energy_code,resistor,LTC2992_Power_lsb, LTC2992_INTERNAL_TIME_lsb); //Calculates Energy in Joules from energy_code, resistor, power lsb and time lsb
74
75 ack |= LTC2992_read_32_bits(LTC2992_I2C_ADDRESS, LTC2992_CHARGE_MSB3_REG, &charge_code); // Reads charge code
76 charge = LTC2992_code_to_coulombs(charge_code,resistor,LTC2992_DELTA_SENSE_lsb, LTC2992_INTERNAL_TIME_lsb); //Calculates charge in coulombs from charge_code, resistor, current lsb and time lsb
77
78
79
80 @endverbatim
81
82 http://www.linear.com/product/LTC2992
83
84 http://www.linear.com/product/LTC2992#demoboards
85
86
87 Copyright 2018(c) Analog Devices, Inc.
88
89 All rights reserved.
90
91 Redistribution and use in source and binary forms, with or without
92 modification, are permitted provided that the following conditions are met:
93 - Redistributions of source code must retain the above copyright
94 notice, this list of conditions and the following disclaimer.
95 - Redistributions in binary form must reproduce the above copyright
96 notice, this list of conditions and the following disclaimer in
97 the documentation and/or other materials provided with the
98 distribution.
99 - Neither the name of Analog Devices, Inc. nor the names of its
100 contributors may be used to endorse or promote products derived
101 from this software without specific prior written permission.
102 - The use of this software may or may not infringe the patent rights
103 of one or more patent holders. This license does not release you
104 from the requirement that you obtain separate licenses from these
105 patent holders to use this software.
106 - Use of the software either in source or binary form, must be run
107 on or directly connected to an Analog Devices Inc. component.
108
109 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
110 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
111 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
112 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
113 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
114 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
115 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
116 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
117 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
118 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
119 */
120
121 /*! @file
122 @ingroup LTC2992
123 Header for LTC2992: Dual Wide Range Power Monitor
124 */
125
126 #ifndef LTC2992_H
127 #define LTC2992_H
128
129 #include <Wire.h>
130
131
132 //! Use table to select address
133 /*!
134 | LTC2992 I2C Address Assignment | Value | AD1 | AD2 |
135 | :-------------------------------- | :---: | :------: | :------: |
136 | LTC2992_I2C_ADDRESS | 0x67 | High | Low |
137 | LTC2992_I2C_ADDRESS | 0x68 | Float | High |
138 | LTC2992_I2C_ADDRESS | 0x69 | High | High |
139 | LTC2992_I2C_ADDRESS | 0x6A | Float | Float |
140 | LTC2992_I2C_ADDRESS | 0x6B | Float | Low |
141 | LTC2992_I2C_ADDRESS | 0x6C | Low | High |
142 | LTC2992_I2C_ADDRESS | 0x6D | High | Float |
143 | LTC2992_I2C_ADDRESS | 0x6E | Low | Float |
144 | LTC2992_I2C_ADDRESS | 0x6F | Low | Low |
145 | | | | |
146 | LTC2992_I2C_MASS_WRITE | 0x66 | X | X |
147 | LTC2992_I2C_ALERT_RESPONSE | 0x0C | X | X |
148 */
149 /*! @name LTC2992 I2C Address Assignments
150 @{ */
151 // Address Choices:
152 // To choose an address, comment out all options except the
153 // configuration on the demo board.
154
155 // Address assignment
156 // LTC2992 I2C Address // AD1 AD0
157 // #define LTC2992_I2C_ADDRESS 0x67 // High Low
158 // #define LTC2992_I2C_ADDRESS 0x68 // Float High
159 // #define LTC2992_I2C_ADDRESS 0x69 // High High
160 #define LTC2992_I2C_ADDRESS 0x6A // Float Float
161 // #define LTC2992_I2C_ADDRESS 0x6B // Float Low
162 // #define LTC2992_I2C_ADDRESS 0x6C // Low High
163 // #define LTC2992_I2C_ADDRESS 0x6D // High Float
164 // #define LTC2992_I2C_ADDRESS 0x6E // Low Float
165 //#define LTC2992_I2C_ADDRESS 0x6F // Low Low
166
167 #define LTC2992_I2C_MASS_WRITE 0x66
168 #define LTC2992_I2C_ALERT_RESPONSE 0x0C
169 //! @}
170
171
172 /*!
173 | Name | Value |
174 | :------------------------------------------------ | :---: |
175 | LTC2992_CTRLA_REG | 0x00 |
176 | LTC2992_CTRLB_REG | 0x01 |
177 | LTC2992_ALERT1_REG | 0x02 |
178 | LTC2992_FAULT1_REG | 0x03 |
179 | LTC2992_NADC_REG | 0x04 |
180 | LTC2992_POWER1_MSB2_REG | 0x05 |
181 | LTC2992_POWER1_MSB1_REG | 0x06 |
182 | LTC2992_POWER1_LSB_REG | 0x07 |
183 | LTC2992_MAX_POWER1_MSB2_REG | 0x08 |
184 | LTC2992_MAX_POWER1_MSB1_REG | 0x09 |
185 | LTC2992_MAX_POWER1_LSB_REG | 0x0A |
186 | LTC2992_MIN_POWER1_MSB2_REG | 0x0B |
187 | LTC2992_MIN_POWER1_MSB1_REG | 0x0C |
188 | LTC2992_MIN_POWER1_LSB_REG | 0x0D |
189 | LTC2992_MAX_POWER1_THRESHOLD_MSB2_REG | 0x0E |
190 | LTC2992_MAX_POWER1_THRESHOLD_MSB1_REG | 0x0F |
191 | LTC2992_MAX_POWER1_THRESHOLD_LSB_REG | 0x10 |
192 | LTC2992_MIN_POWER1_THRESHOLD_MSB2_REG | 0x11 |
193 | LTC2992_MIN_POWER1_THRESHOLD_MSB1_REG | 0x12 |
194 | LTC2992_MIN_POWER1_THRESHOLD_LSB_REG | 0x13 |
195 | LTC2992_DELTA_SENSE1_MSB_REG | 0x14 |
196 | LTC2992_DELTA_SENSE1_LSB_REG | 0x15 |
197 | LTC2992_MAX_DELTA1_SENSE_MSB_REG | 0x16 |
198 | LTC2992_MAX_DELTA1_SENSE_LSB_REG | 0x17 |
199 | LTC2992_MIN_DELTA1_SENSE_MSB_REG | 0x18 |
200 | LTC2992_MIN_DELTA1_SENSE_LSB_REG | 0x19 |
201 | LTC2992_MAX_DELTA1_SENSE_THRESHOLD_MSB_REG | 0x1A |
202 | LTC2992_MAX_DELTA1_SENSE_THRESHOLD_LSB_REG | 0x1B |
203 | LTC2992_MIN_DELTA1_SENSE_THRESHOLD_MSB_REG | 0x1C |
204 | LTC2992_MIN_DELTA1_SENSE_THRESHOLD_LSB_REG | 0x1D |
205 | LTC2992_SENSE1_MSB_REG | 0x1E |
206 | LTC2992_SENSE1_LSB_REG | 0x1F |
207 | LTC2992_MAX_SENSE1_MSB_REG | 0x20 |
208 | LTC2992_MAX_SENSE1_LSB_REG | 0x21 |
209 | LTC2992_MIN_SENSE1_MSB_REG | 0x22 |
210 | LTC2992_MIN_SENSE1_LSB_REG | 0x23 |
211 | LTC2992_MAX_SENSE1_THRESHOLD_MSB_REG | 0x24 |
212 | LTC2992_MAX_SENSE1_THRESHOLD_LSB_REG | 0x25 |
213 | LTC2992_MIN_SENSE1_THRESHOLD_MSB_REG | 0x26 |
214 | LTC2992_MIN_SENSE1_THRESHOLD_LSB_REG | 0x27 |
215 | LTC2992_GPIO1_MSB_REG | 0x28 |
216 | LTC2992_GPIO1_LSB_REG_REG | 0x29 |
217 | LTC2992_MAX_GPIO1_MSB_REG | 0x2A |
218 | LTC2992_MAX_GPIO1_LSB_REG | 0x2B |
219 | LTC2992_MIN_GPIO1_MSB_REG | 0x2C |
220 | LTC2992_MIN_GPIO1_LSB_REG | 0x2D |
221 | LTC2992_MAX_GPIO1_THRESHOLD_MSB_REG | 0x2E |
222 | LTC2992_MAX_GPIO1_THRESHOLD_LSB_REG | 0x2F |
223 | LTC2992_MIN_GPIO1_THRESHOLD_MSB_REG | 0x30 |
224 | LTC2992_MIN_GPIO1_THRESHOLD_LSB_REG | 0x31 |
225 | LTC2992_ADC_STATUS_REG | 0x32 |
226 | LTC2992_ALERT2_REG | 0x34 |
227 | LTC2992_FAULT2_REG | 0x35 |
228 | LTC2992_POWER2_MSB2_REG | 0x37 |
229 | LTC2992_POWER2_MSB1_REG | 0x38 |
230 | LTC2992_POWER2_LSB_REG | 0x39 |
231 | LTC2992_MAX_POWER2_MSB2_REG | 0x3A |
232 | LTC2992_MAX_POWER2_MSB1_REG | 0x3B |
233 | LTC2992_MAX_POWER2_LSB_REG | 0x3C |
234 | LTC2992_MIN_POWER2_MSB2_REG | 0x3D |
235 | LTC2992_MIN_POWER2_MSB1_REG | 0x3E |
236 | LTC2992_MIN_POWER2_LSB_REG | 0x3F |
237 | LTC2992_MAX_POWER2_THRESHOLD_MSB2_REG | 0x40 |
238 | LTC2992_MAX_POWER2_THRESHOLD_MSB1_REG | 0x41 |
239 | LTC2992_MAX_POWER2_THRESHOLD_LSB_REG | 0x42 |
240 | LTC2992_MIN_POWER2_THRESHOLD_MSB2_REG | 0x43 |
241 | LTC2992_MIN_POWER2_THRESHOLD_MSB1_REG | 0x44 |
242 | LTC2992_MIN_POWER2_THRESHOLD_LSB_REG | 0x45 |
243 | LTC2992_DELTA_SENSE2_MSB_REG | 0x46 |
244 | LTC2992_DELTA_SENSE2_LSB_REG | 0x47 |
245 | LTC2992_MAX_DELTA2_SENSE_MSB_REG | 0x48 |
246 | LTC2992_MAX_DELTA2_SENSE_LSB_REG | 0x49 |
247 | LTC2992_MIN_DELTA2_SENSE_MSB_REG | 0x4A |
248 | LTC2992_MIN_DELTA2_SENSE_LSB_REG | 0x4B |
249 | LTC2992_MAX_DELTA2_SENSE_THRESHOLD_MSB_REG | 0x4C |
250 | LTC2992_MAX_DELTA2_SENSE_THRESHOLD_LSB_REG | 0x4D |
251 | LTC2992_MIN_DELTA2_SENSE_THRESHOLD_MSB_REG | 0x4E |
252 | LTC2992_MIN_DELTA2_SENSE_THRESHOLD_LSB_REG | 0x4F |
253 | LTC2992_SENSE2_MSB_REG | 0x50 |
254 | LTC2992_SENSE2_LSB_REG | 0x51 |
255 | LTC2992_MAX_SENSE2_MSB_REG | 0x52 |
256 | LTC2992_MAX_SENSE2_LSB_REG | 0x53 |
257 | LTC2992_MIN_SENSE2_MSB_REG | 0x54 |
258 | LTC2992_MIN_SENSE2_LSB_REG | 0x55 |
259 | LTC2992_MAX_SENSE2_THRESHOLD_MSB_REG | 0x56 |
260 | LTC2992_MAX_SENSE2_THRESHOLD_LSB_REG | 0x57 |
261 | LTC2992_MIN_SENSE2_THRESHOLD_MSB_REG | 0x58 |
262 | LTC2992_MIN_SENSE2_THRESHOLD_LSB_REG | 0x59 |
263 | LTC2992_GPIO2_MSB_REG | 0x5A |
264 | LTC2992_GPIO2_LSB_REG_REG | 0x5B |
265 | LTC2992_MAX_GPIO2_MSB_REG | 0x5C |
266 | LTC2992_MAX_GPIO2_LSB_REG | 0x5D |
267 | LTC2992_MIN_GPIO2_MSB_REG | 0x5E |
268 | LTC2992_MIN_GPIO2_LSB_REG | 0x5F |
269 | LTC2992_MAX_GPIO2_THRESHOLD_MSB_REG | 0x60 |
270 | LTC2992_MAX_GPIO2_THRESHOLD_LSB_REG | 0x61 |
271 | LTC2992_MIN_GPIO2_THRESHOLD_MSB_REG | 0x62 |
272 | LTC2992_MIN_GPIO2_THRESHOLD_LSB_REG | 0x63 |
273 | LTC2992_GPIO3_MSB_REG | 0x64 |
274 | LTC2992_GPIO3_LSB_REG_REG | 0x65 |
275 | LTC2992_MAX_GPIO3_MSB_REG | 0x66 |
276 | LTC2992_MAX_GPIO3_LSB_REG | 0x67 |
277 | LTC2992_MIN_GPIO3_MSB_REG | 0x68 |
278 | LTC2992_MIN_GPIO3_LSB_REG | 0x69 |
279 | LTC2992_MAX_GPIO3_THRESHOLD_MSB_REG | 0x6A |
280 | LTC2992_MAX_GPIO3_THRESHOLD_LSB_REG | 0x6B |
281 | LTC2992_MIN_GPIO3_THRESHOLD_MSB_REG | 0x6C |
282 | LTC2992_MIN_GPIO3_THRESHOLD_LSB_REG | 0x6D |
283 | LTC2992_GPIO4_MSB_REG | 0x6E |
284 | LTC2992_GPIO4_LSB_REG_REG | 0x6F |
285 | LTC2992_MAX_GPIO4_MSB_REG | 0x70 |
286 | LTC2992_MAX_GPIO4_LSB_REG | 0x71 |
287 | LTC2992_MIN_GPIO4_MSB_REG | 0x72 |
288 | LTC2992_MIN_GPIO4_LSB_REG | 0x73 |
289 | LTC2992_MAX_GPIO4_THRESHOLD_MSB_REG | 0x74 |
290 | LTC2992_MAX_GPIO4_THRESHOLD_LSB_REG | 0x75 |
291 | LTC2992_MIN_GPIO4_THRESHOLD_MSB_REG | 0x76 |
292 | LTC2992_MIN_GPIO4_THRESHOLD_LSB_REG | 0x77 |
293 | LTC2992_ISUM_MSB_REG | 0x78 |
294 | LTC2992_ISUM_LSB_REG_REG | 0x79 |
295 | LTC2992_MAX_ISUM_MSB_REG | 0x7A |
296 | LTC2992_MAX_ISUM_LSB_REG | 0x7B |
297 | LTC2992_MIN_ISUM_MSB_REG | 0x7C |
298 | LTC2992_MIN_ISUM_LSB_REG | 0x7D |
299 | LTC2992_MAX_ISUM_THRESHOLD_MSB_REG | 0x7E |
300 | LTC2992_MAX_ISUM_THRESHOLD_LSB_REG | 0x7F |
301 | LTC2992_MIN_ISUM_THRESHOLD_MSB_REG | 0x80 |
302 | LTC2992_MIN_ISUM_THRESHOLD_LSB_REG | 0x81 |
303 | LTC2992_PSUM_MSB1_REG | 0x82 |
304 | LTC2992_PSUM_MSB_REG | 0x83 |
305 | LTC2992_PSUM_LSB_REG_REG | 0x84 |
306 | LTC2992_MAX_PSUM_MSB1_REG | 0x85 |
307 | LTC2992_MAX_PSUM_MSB_REG | 0x86 |
308 | LTC2992_MAX_PSUM_LSB_REG | 0x87 |
309 | LTC2992_MIN_PSUM_MSB1_REG | 0x88 |
310 | LTC2992_MIN_PSUM_MSB_REG | 0x89 |
311 | LTC2992_MIN_PSUM_LSB_REG | 0x8A |
312 | LTC2992_MAX_PSUM_THRESHOLD_MSB1_REG | 0x8B |
313 | LTC2992_MAX_PSUM_THRESHOLD_MSB_REG | 0x8C |
314 | LTC2992_MAX_PSUM_THRESHOLD_LSB_REG | 0x8D |
315 | LTC2992_MIN_PSUM_THRESHOLD_MSB1_REG | 0x8E |
316 | LTC2992_MIN_PSUM_THRESHOLD_MSB_REG | 0x8F |
317 | LTC2992_MIN_PSUM_THRESHOLD_LSB_REG | 0x90 |
318 | LTC2992_ALERT3_REG | 0x91 |
319 | LTC2992_FAULT3_REG | 0x92 |
320 | LTC2992_ALERT4_REG | 0x93 |
321 | LTC2992_FAULT4_REG | 0x94 |
322 | LTC2992_GPIO_STATUS_REG | 0x95 |
323 | LTC2992_GPIO_IO_CONT_REG | 0x96 |
324 | LTC2992_GPIO4_CFG_REG | 0x97 |
325 */
326
327
328
329
330 /*! @name Registers
331 @{ */
332 // Registers
333
334 #define LTC2992_CTRLA_REG 0x00
335 #define LTC2992_CTRLB_REG 0x01
336 #define LTC2992_ALERT1_REG 0x02
337 #define LTC2992_FAULT1_REG 0x03
338 #define LTC2992_NADC_REG 0x04
339 #define LTC2992_POWER1_MSB2_REG 0x05
340 #define LTC2992_POWER1_MSB1_REG 0x06
341 #define LTC2992_POWER1_LSB_REG 0x07
342 #define LTC2992_MAX_POWER1_MSB2_REG 0x08
343 #define LTC2992_MAX_POWER1_MSB1_REG 0x09
344 #define LTC2992_MAX_POWER1_LSB_REG 0x0A
345 #define LTC2992_MIN_POWER1_MSB2_REG 0x0B
346 #define LTC2992_MIN_POWER1_MSB1_REG 0x0C
347 #define LTC2992_MIN_POWER1_LSB_REG 0x0D
348 #define LTC2992_MAX_POWER1_THRESHOLD_MSB2_REG 0x0E
349 #define LTC2992_MAX_POWER1_THRESHOLD_MSB1_REG 0x0F
350 #define LTC2992_MAX_POWER1_THRESHOLD_LSB_REG 0x10
351 #define LTC2992_MIN_POWER1_THRESHOLD_MSB2_REG 0x11
352 #define LTC2992_MIN_POWER1_THRESHOLD_MSB1_REG 0x12
353 #define LTC2992_MIN_POWER1_THRESHOLD_LSB_REG 0x13
354 #define LTC2992_DELTA_SENSE1_MSB_REG 0x14
355 #define LTC2992_DELTA_SENSE1_LSB_REG 0x15
356 #define LTC2992_MAX_DELTA1_SENSE_MSB_REG 0x16
357 #define LTC2992_MAX_DELTA1_SENSE_LSB_REG 0x17
358 #define LTC2992_MIN_DELTA1_SENSE_MSB_REG 0x18
359 #define LTC2992_MIN_DELTA1_SENSE_LSB_REG 0x19
360 #define LTC2992_MAX_DELTA1_SENSE_THRESHOLD_MSB_REG 0x1A
361 #define LTC2992_MAX_DELTA1_SENSE_THRESHOLD_LSB_REG 0x1B
362 #define LTC2992_MIN_DELTA1_SENSE_THRESHOLD_MSB_REG 0x1C
363 #define LTC2992_MIN_DELTA1_SENSE_THRESHOLD_LSB_REG 0x1D
364 #define LTC2992_SENSE1_MSB_REG 0x1E
365 #define LTC2992_SENSE1_LSB_REG 0x1F
366 #define LTC2992_MAX_SENSE1_MSB_REG 0x20
367 #define LTC2992_MAX_SENSE1_LSB_REG 0x21
368 #define LTC2992_MIN_SENSE1_MSB_REG 0x22
369 #define LTC2992_MIN_SENSE1_LSB_REG 0x23
370 #define LTC2992_MAX_SENSE1_THRESHOLD_MSB_REG 0x24
371 #define LTC2992_MAX_SENSE1_THRESHOLD_LSB_REG 0x25
372 #define LTC2992_MIN_SENSE1_THRESHOLD_MSB_REG 0x26
373 #define LTC2992_MIN_SENSE1_THRESHOLD_LSB_REG 0x27
374 #define LTC2992_GPIO1_MSB_REG 0x28
375 #define LTC2992_GPIO1_LSB_REG_REG 0x29
376 #define LTC2992_MAX_GPIO1_MSB_REG 0x2A
377 #define LTC2992_MAX_GPIO1_LSB_REG 0x2B
378 #define LTC2992_MIN_GPIO1_MSB_REG 0x2C
379 #define LTC2992_MIN_GPIO1_LSB_REG 0x2D
380 #define LTC2992_MAX_GPIO1_THRESHOLD_MSB_REG 0x2E
381 #define LTC2992_MAX_GPIO1_THRESHOLD_LSB_REG 0x2F
382 #define LTC2992_MIN_GPIO1_THRESHOLD_MSB_REG 0x30
383 #define LTC2992_MIN_GPIO1_THRESHOLD_LSB_REG 0x31
384 #define LTC2992_ADC_STATUS_REG 0x32
385 #define LTC2992_ALERT2_REG 0x34
386 #define LTC2992_FAULT2_REG 0x35
387 #define LTC2992_POWER2_MSB2_REG 0x37
388 #define LTC2992_POWER2_MSB1_REG 0x38
389 #define LTC2992_POWER2_LSB_REG 0x39
390 #define LTC2992_MAX_POWER2_MSB2_REG 0x3A
391 #define LTC2992_MAX_POWER2_MSB1_REG 0x3B
392 #define LTC2992_MAX_POWER2_LSB_REG 0x3C
393 #define LTC2992_MIN_POWER2_MSB2_REG 0x3D
394 #define LTC2992_MIN_POWER2_MSB1_REG 0x3E
395 #define LTC2992_MIN_POWER2_LSB_REG 0x3F
396 #define LTC2992_MAX_POWER2_THRESHOLD_MSB2_REG 0x40
397 #define LTC2992_MAX_POWER2_THRESHOLD_MSB1_REG 0x41
398 #define LTC2992_MAX_POWER2_THRESHOLD_LSB_REG 0x42
399 #define LTC2992_MIN_POWER2_THRESHOLD_MSB2_REG 0x43
400 #define LTC2992_MIN_POWER2_THRESHOLD_MSB1_REG 0x44
401 #define LTC2992_MIN_POWER2_THRESHOLD_LSB_REG 0x45
402 #define LTC2992_DELTA_SENSE2_MSB_REG 0x46
403 #define LTC2992_DELTA_SENSE2_LSB_REG 0x47
404 #define LTC2992_MAX_DELTA2_SENSE_MSB_REG 0x48
405 #define LTC2992_MAX_DELTA2_SENSE_LSB_REG 0x49
406 #define LTC2992_MIN_DELTA2_SENSE_MSB_REG 0x4A
407 #define LTC2992_MIN_DELTA2_SENSE_LSB_REG 0x4B
408 #define LTC2992_MAX_DELTA2_SENSE_THRESHOLD_MSB_REG 0x4C
409 #define LTC2992_MAX_DELTA2_SENSE_THRESHOLD_LSB_REG 0x4D
410 #define LTC2992_MIN_DELTA2_SENSE_THRESHOLD_MSB_REG 0x4E
411 #define LTC2992_MIN_DELTA2_SENSE_THRESHOLD_LSB_REG 0x4F
412 #define LTC2992_SENSE2_MSB_REG 0x50
413 #define LTC2992_SENSE2_LSB_REG 0x51
414 #define LTC2992_MAX_SENSE2_MSB_REG 0x52
415 #define LTC2992_MAX_SENSE2_LSB_REG 0x53
416 #define LTC2992_MIN_SENSE2_MSB_REG 0x54
417 #define LTC2992_MIN_SENSE2_LSB_REG 0x55
418 #define LTC2992_MAX_SENSE2_THRESHOLD_MSB_REG 0x56
419 #define LTC2992_MAX_SENSE2_THRESHOLD_LSB_REG 0x57
420 #define LTC2992_MIN_SENSE2_THRESHOLD_MSB_REG 0x58
421 #define LTC2992_MIN_SENSE2_THRESHOLD_LSB_REG 0x59
422 #define LTC2992_GPIO2_MSB_REG 0x5A
423 #define LTC2992_GPIO2_LSB_REG_REG 0x5B
424 #define LTC2992_MAX_GPIO2_MSB_REG 0x5C
425 #define LTC2992_MAX_GPIO2_LSB_REG 0x5D
426 #define LTC2992_MIN_GPIO2_MSB_REG 0x5E
427 #define LTC2992_MIN_GPIO2_LSB_REG 0x5F
428 #define LTC2992_MAX_GPIO2_THRESHOLD_MSB_REG 0x60
429 #define LTC2992_MAX_GPIO2_THRESHOLD_LSB_REG 0x61
430 #define LTC2992_MIN_GPIO2_THRESHOLD_MSB_REG 0x62
431 #define LTC2992_MIN_GPIO2_THRESHOLD_LSB_REG 0x63
432 #define LTC2992_GPIO3_MSB_REG 0x64
433 #define LTC2992_GPIO3_LSB_REG_REG 0x65
434 #define LTC2992_MAX_GPIO3_MSB_REG 0x66
435 #define LTC2992_MAX_GPIO3_LSB_REG 0x67
436 #define LTC2992_MIN_GPIO3_MSB_REG 0x68
437 #define LTC2992_MIN_GPIO3_LSB_REG 0x69
438 #define LTC2992_MAX_GPIO3_THRESHOLD_MSB_REG 0x6A
439 #define LTC2992_MAX_GPIO3_THRESHOLD_LSB_REG 0x6B
440 #define LTC2992_MIN_GPIO3_THRESHOLD_MSB_REG 0x6C
441 #define LTC2992_MIN_GPIO3_THRESHOLD_LSB_REG 0x6D
442 #define LTC2992_GPIO4_MSB_REG 0x6E
443 #define LTC2992_GPIO4_LSB_REG_REG 0x6F
444 #define LTC2992_MAX_GPIO4_MSB_REG 0x70
445 #define LTC2992_MAX_GPIO4_LSB_REG 0x71
446 #define LTC2992_MIN_GPIO4_MSB_REG 0x72
447 #define LTC2992_MIN_GPIO4_LSB_REG 0x73
448 #define LTC2992_MAX_GPIO4_THRESHOLD_MSB_REG 0x74
449 #define LTC2992_MAX_GPIO4_THRESHOLD_LSB_REG 0x75
450 #define LTC2992_MIN_GPIO4_THRESHOLD_MSB_REG 0x76
451 #define LTC2992_MIN_GPIO4_THRESHOLD_LSB_REG 0x77
452 #define LTC2992_ISUM_MSB_REG 0x78
453 #define LTC2992_ISUM_LSB_REG_REG 0x79
454 #define LTC2992_MAX_ISUM_MSB_REG 0x7A
455 #define LTC2992_MAX_ISUM_LSB_REG 0x7B
456 #define LTC2992_MIN_ISUM_MSB_REG 0x7C
457 #define LTC2992_MIN_ISUM_LSB_REG 0x7D
458 #define LTC2992_MAX_ISUM_THRESHOLD_MSB_REG 0x7E
459 #define LTC2992_MAX_ISUM_THRESHOLD_LSB_REG 0x7F
460 #define LTC2992_MIN_ISUM_THRESHOLD_MSB_REG 0x80
461 #define LTC2992_MIN_ISUM_THRESHOLD_LSB_REG 0x81
462 #define LTC2992_PSUM_MSB1_REG 0x82
463 #define LTC2992_PSUM_MSB_REG 0x83
464 #define LTC2992_PSUM_LSB_REG_REG 0x84
465 #define LTC2992_MAX_PSUM_MSB1_REG 0x85
466 #define LTC2992_MAX_PSUM_MSB_REG 0x86
467 #define LTC2992_MAX_PSUM_LSB_REG 0x87
468 #define LTC2992_MIN_PSUM_MSB1_REG 0x88
469 #define LTC2992_MIN_PSUM_MSB_REG 0x89
470 #define LTC2992_MIN_PSUM_LSB_REG 0x8A
471 #define LTC2992_MAX_PSUM_THRESHOLD_MSB1_REG 0x8B
472 #define LTC2992_MAX_PSUM_THRESHOLD_MSB_REG 0x8C
473 #define LTC2992_MAX_PSUM_THRESHOLD_LSB_REG 0x8D
474 #define LTC2992_MIN_PSUM_THRESHOLD_MSB1_REG 0x8E
475 #define LTC2992_MIN_PSUM_THRESHOLD_MSB_REG 0x8F
476 #define LTC2992_MIN_PSUM_THRESHOLD_LSB_REG 0x90
477 #define LTC2992_ALERT3_REG 0x91
478 #define LTC2992_FAULT3_REG 0x92
479 #define LTC2992_ALERT4_REG 0x93
480 #define LTC2992_FAULT4_REG 0x94
481 #define LTC2992_GPIO_STATUS_REG 0x95
482 #define LTC2992_GPIO_IO_CONT_REG 0x96
483 #define LTC2992_GPIO4_CFG_REG 0x97
484
485
486 //! @}
487
488 /*! @name Command Codes
489 @{ */
490 // Command Codes
491
492 #define LTC2992_OFFSET_CAL_DEMAND 0x80
493 #define LTC2992_OFFSET_CAL_EVERY 0x00
494
495 #define LTC2992_MODE_SHUTDOWN 0x60
496 #define LTC2992_MODE_SINGLE_CYCLE 0x40
497 #define LTC2992_MODE_SNAPSHOT 0x20
498 #define LTC2992_MODE_CONTINUOUS 0x00
499
500 #define LTC2992_CONTINUOUS_GPIO_1_2_3_4 0x18
501 #define LTC2992_CONTINUOUS_GPIO_1_2 0x10
502 #define LTC2992_CONTINUOUS_SENSE_1_2 0x08
503 #define LTC2992_CONTINUOUS_SENSE_1_2_GPIO_1_2_3_4 0x00
504
505 #define LTC2992_SNAPSHOT_GPIO_1_2 0x07
506 #define LTC2992_SNAPSHOT_SENSE_1_2 0x06
507 #define LTC2992_SNAPSHOT_GPIO_4 0x05
508 #define LTC2992_SNAPSHOT_GPIO_3 0x04
509 #define LTC2992_SNAPSHOT_GPIO_2 0x03
510 #define LTC2992_SNAPSHOT_GPIO_1 0x02
511 #define LTC2992_SNAPSHOT_SENSE_2 0x01
512 #define LTC2992_SNAPSHOT_SENSE_1 0x00
513
514 #define LTC2992_ENABLE_ALERT_CLEAR 0x80
515 #define LTC2992_ENABLE_CLEARED_ON_READ 0x20
516 #define LTC2992_ENABLE_STUCK_BUS_RECOVER 0x10
517 #define LTC2992_ENABLE_RESET_PEAK_VALUES 0x08
518 #define LTC2992_ENABLE_RESET_ALL 0x01
519
520 #define LTC2992_DISABLE_ALERT_CLEAR 0x7F
521 #define LTC2992_DISABLE_CLEARED_ON_READ 0xDF
522 #define LTC2992_DISABLE_STUCK_BUS_RECOVER 0xEF
523 #define LTC2992 DISABLE_RESET_PEAK_VALUES 0xF7
524 #define LTC2992_DISABLE_RESET_ALL 0xFE
525
526 #define LTC2992_ENABLE_MAX_POWER1_ALERT 0x80
527 #define LTC2992_ENABLE_MIN_POWER1_ALERT 0x40
528 #define LTC2992_DISABLE_MAX_POWER1_ALERT 0x7F
529 #define LTC2992_DISABLE_MIN_POWER1_ALERT 0xBF
530
531 #define LTC2992_ENABLE_MAX_I_SENSE1_ALERT 0x20
532 #define LTC2992_ENABLE_MIN_I_SENSE1_ALERT 0x10
533 #define LTC2992_DISABLE_MAX_I_SENSE1_ALERT 0xDF
534 #define LTC2992_DISABLE_MIN_I_SENSE1_ALERT 0xEF
535
536 #define LTC2992_ENABLE_MAX_SENSE1_ALERT 0x08
537 #define LTC2992_ENABLE_MIN_SENSE1_ALERT 0x04
538 #define LTC2992_DISABLE_MAX_SENSE1_ALERT 0xF7
539 #define LTC2992_DISABLE_MIN_SENSE1_ALERT 0xFB
540
541 #define LTC2992_ENABLE_MAX_GPIO1_ALERT 0x02
542 #define LTC2992_ENABLE_MIN_GPIO1_ALERT 0x01
543 #define LTC2992_DISABLE_MAX_GPIO1_ALERT 0xFD
544 #define LTC2992_DISABLE_MIN_GPIO1_ALERT 0xFE
545
546
547 //NADC
548 #define LTC2992_ADC_RESOLUTION 0x80
549
550 //ALERT2
551 #define LTC2992_ENABLE_MAX_POWER2_ALERT 0x80
552 #define LTC2992_ENABLE_MIN_POWER2_ALERT 0x40
553 #define LTC2992_DISABLE_MAX_POWER2_ALERT 0x7F
554 #define LTC2992_DISABLE_MIN_POWER2_ALERT 0xBF
555
556 #define LTC2992_ENABLE_MAX_I_SENSE2_ALERT 0x20
557 #define LTC2992_ENABLE_MIN_I_SENSE2_ALERT 0x10
558 #define LTC2992_DISABLE_MAX_I_SENSE2_ALERT 0xDF
559 #define LTC2992_DISABLE_MIN_I_SENSE2_ALERT 0xEF
560
561 #define LTC2992_ENABLE_MAX_SENSE2_ALERT 0x08
562 #define LTC2992_ENABLE_MIN_SENSE2_ALERT 0x04
563 #define LTC2992_DISABLE_MAX_SENSE2_ALERT 0xF7
564 #define LTC2992_DISABLE_MIN_SENSE2_ALERT 0xFB
565
566 #define LTC2992_ENABLE_MAX_GPIO2_ALERT 0x02
567 #define LTC2992_ENABLE_MIN_GPIO2_ALERT 0x01
568 #define LTC2992_DISABLE_MAX_GPIO2_ALERT 0xFD
569 #define LTC2992_DISABLE_MIN_GPIO2_ALERT 0xFE
570
571 //ALERT3
572 #define LTC2992_ENABLE_MAX_GPIO3_ALERT 0x80
573 #define LTC2992_ENABLE_MIN_GPIO3_ALERT 0x40
574 #define LTC2992_DISABLE_MAX_GPIO3_ALERT 0x7F
575 #define LTC2992_DISABLE_MIN_GPIO3_ALERT 0xBF
576
577 #define LTC2992_ENABLE_MAX_GPIO4_ALERT 0x20
578 #define LTC2992_ENABLE_MIN_GPIO4_ALERT 0x10
579 #define LTC2992_DISABLE_MAX_GPIO4_ALERT 0xDF
580 #define LTC2992_DISABLE_MIN_GPIO4_ALERT 0xEF
581
582 #define LTC2992_ENABLE_MAX_I_SUM_ALERT 0x08
583 #define LTC2992_ENABLE_MIN_I_SUM_ALERT 0x04
584 #define LTC2992_DISABLE_MAX_I_SUM_ALERT 0xF7
585 #define LTC2992_DISABLE_MIN_I_SUM_ALERT 0xFB
586
587 #define LTC2992_ENABLE_MAX_P_SUM_ALERT 0x02
588 #define LTC2992_ENABLE_MIN_P_SUM_ALERT 0x01
589 #define LTC2992_DISABLE_MAX_P_SUM_ALERT 0xFD
590 #define LTC2992_DISABLE_MIN_P_SUM_ALERT 0xFE
591
592 //ALERT4
593 #define LTC2992_ENABLE_V_ADC_READY_ALERT 0x80
594 #define LTC2992_ENABLE_I_ADC_READY_ALERT 0x40
595 #define LTC2992_DISABLE_V_ADC_READY_ALERT 0x7F
596 #define LTC2992_DISABLE_I_ADC_READY_ALERT 0xBF
597
598 #define LTC2992_ENABLE_STUCK_BUS_TIMEOUT_ALERT 0x10
599 #define LTC2992_DISABLE_STUCK_BUS_TIMEOUT_ALERT 0xEF
600
601 #define LTC2992_ENABLE_GPIO1_INPUT_ALERT 0x08
602 #define LTC2992_ENABLE_GPIO2_INPUT_ALERT 0x04
603 #define LTC2992_DISABLE_GPIO1_INPUT_ALERT 0xF7
604 #define LTC2992_DISABLE_GPIO2_INPUT_ALERT 0xFB
605
606 #define LTC2992_ENABLE_GPIO3_INPUT_ALERT 0x02
607 #define LTC2992_DISABLE_GPIO3_INPUT_ALERT 0xFD
608
609
610 //GPIO IO Control Registers
611 #define LTC2992_GPIO1_OUT_HIGH_Z 0x7F
612 #define LTC2992_GPIO1_OUT_LOW 0x80
613 #define LTC2992_GPIO2_OUT_HIGH_Z 0xBF
614 #define LTC2992_GPIO2_OUT_LOW 0x40
615
616 #define LTC2992_GPIO3_CONFIG_LOW_DATARDY 0x30
617 #define LTC2992_GPIO3_CONFIG_128_LOW 0x20
618 #define LTC2992_GPIO3_CONFIG_16_LOW 0x10
619 #define LTC2992_GPIO3_CONFIG_IO 0x00
620
621 #define LTC2992_GPIO1_IN_HIGH_POL_ALERT 0x08
622 #define LTC2992_GPIO1_IN_LOW_POL_ALERT 0xFC
623 #define LTC2992_GPIO2_IN_HIGH_POL_ALERT 0x04
624 #define LTC2992_GPIO2_IN_LOW_POL_ALERT 0xFB
625 #define LTC2992_GPIO3_IN_HIGH_POL_ALERT 0x02
626 #define LTC2992_GPIO3_IN_LOW_POL_ALERT 0xFD
627 #define LTC2992_GPIO3_OUT_LOW 0x01
628 #define LTC2992_GPIO3_OUT_HIGH_Z 0xFE
629
630 //GPIO4 Control Reg
631 #define LTC2992_ALERT_GENERATED_TRUE 0x80
632 #define LTC2992_ALERT_GENERATED_CLEAR 0x7F
633 #define LTC2992_GPIO4_OUT_LOW 0x40
634 #define LTC2992_GPIO4_OUT_HI_Z 0xBF
635 //! @}
636
637 /*! @name Register Mask Command
638 @{ */
639 // Register Mask Command
640 #define LTC2992_CTRLA_OFFSET_MASK 0x7F
641 #define LTC2992_CTRLA_MEASUREMENT_MODE_MASK 0x9F
642 #define LTC2992_CTRLA_VOLTAGE_SEL_CONTINIOUS_MASK 0xE7
643 #define LTC2992_CTRLA_VOLTAGE_SEL_SNAPSHOT_MASK 0xF8
644 #define LTC2992_CTRLB_ACC_MASK 0xF3
645 #define LTC2992_CTRLB_RESET_MASK 0xFC
646 #define LTC2992_GPIOCFG_GPIO1_MASK 0x3F
647 #define LTC2992_GPIOCFG_GPIO2_MASK 0xCF
648 #define LTC2992_GPIOCFG_GPIO3_MASK 0xCF
649 #define LTC2992_GPIOCFG_GPIO2_OUT_MASK 0xFD
650 #define LTC2992_GPIO3_CTRL_GPIO3_MASK 0xBF
651 //! @}
652
653 //! Write an 8-bit code to the LTC2992.
654 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
655 int8_t LTC2992_write(uint8_t i2c_address, //!< Register address for the LTC2992
656 uint8_t adc_command, //!< The "command byte" for the LTC2992
657 uint8_t code //!< Value that will be written to the register.
658 );
659 //! Write a 16-bit code to the LTC2992.
660 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
661 int8_t LTC2992_write_16_bits(uint8_t i2c_address, //!< Register address for the LTC2992
662 uint8_t adc_command, //!< The "command byte" for the LTC2992
663 uint16_t code //!< Value that will be written to the register.
664 );
665
666 //! Write a 24-bit code to the LTC2992.
667 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
668 int8_t LTC2992_write_24_bits(uint8_t i2c_address, //!< Register address for the LTC2992
669 uint8_t adc_command, //!< The "command byte" for the LTC2992
670 uint32_t code //!< Value that will be written to the register.
671 );
672
673 //! Reads an 8-bit adc_code from LTC2992
674 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
675 int8_t LTC2992_read(uint8_t i2c_address, //!< Register address for the LTC2992
676 uint8_t adc_command, //!< The "command byte" for the LTC2992
677 uint8_t *adc_code //!< Value that will be read from the register.
678 );
679 //! Reads a 12-bit adc_code from LTC2992
680 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
681 int8_t LTC2992_read_12_bits(uint8_t i2c_address, //!< Register address for the LTC2992
682 uint8_t adc_command, //!< The "command byte" for the LTC2992
683 uint16_t *adc_code //!< Value that will be read from the register.
684 );
685 //! Reads a 16-bit adc_code from LTC2992
686 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
687 int8_t LTC2992_read_16_bits(uint8_t i2c_address, //!< Register address for the LTC2992
688 uint8_t adc_command, //!< The "command byte" for the LTC2992
689 uint16_t *adc_code //!< Value that will be read from the register.
690 );
691 //! Reads a 24-bit adc_code from LTC2992
692 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
693 int8_t LTC2992_read_24_bits(uint8_t i2c_address, //!< Register address for the LTC2992
694 uint8_t adc_command, //!< The "command byte" for the LTC2992
695 uint32_t *adc_code //!< Value that will be read from the register.
696 );
697
698 //! Calculate the LTC2992 SENSE voltage
699 //! @return Returns the SENSE Voltage in Volts
700 float LTC2992_SENSE_code_to_voltage(uint16_t adc_code, //!< The ADC value
701 float LTC2992_SENSE_lsb //!< SENSE lsb weight
702 );
703 //! Calculate the LTC2992 GPIO voltage
704 //! @return Returns the GPIO Voltage in Volts
705 float LTC2992_GPIO_code_to_voltage(uint16_t adc_code, //!< The ADC value
706 float LTC2992_ADIN_lsb //!< GPIO lsb weight
707 );
708 //! Calculate the LTC2992 current with a sense resistor
709 //! @return The LTC2992 current in Amps
710 float LTC2992_code_to_current(uint16_t adc_code, //!< The ADC value
711 float resistor, //!< The resistor value
712 float LTC2992_DELTA_SENSE_lsb //!< Delta sense lsb weight
713 );
714
715 //! Calculate the LTC2992 current sum with a sense resistor
716 //! @return The LTC2992 current in Amps
717 float LTC2992_code_to_current_sum(uint16_t adc_code, //!< The ADC value
718 float resistor, //!< The resistor value
719 float LTC2992_DELTA_SENSE_lsb //!< Delta sense lsb weight
720 );
721
722 //! Calculate the LTC2992 power
723 //! @return The LTC2992 power in Watts
724 float LTC2992_code_to_power(int32_t adc_code, //!< The ADC value
725 float resistor, //!< The resistor value
726 float LTC2992_Power_lsb); //!< Power lsb weight
727
728 float LTC2992_code_to_power_sum(int32_t adc_code, //!< The ADC value
729 float resistor, //!< The Resistor Value
730 float LTC2992_Power_lsb); //!< Power LSB Weight
731
732 #endif // LTC2945_H
733
LTC2992_code_to_power_sum
float LTC2992_code_to_power_sum(int32_t adc_code, float resistor, float LTC2992_Power_lsb)
Power LSB Weight.
Definition: LTC2992.cpp:273
i2c_address
uint8_t i2c_address
adc_command
static uint8_t adc_command
Definition: DC2071AA.ino:111
resistor
const float resistor
resistor value on demo board
Definition: DC1496BB.ino:116
LTC2992_write_16_bits
int8_t LTC2992_write_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t code)
Write a 16-bit code to the LTC2992.
Definition: LTC2992.cpp:150
LTC2992_read_16_bits
int8_t LTC2992_read_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 16-bit adc_code from LTC2992.
Definition: LTC2992.cpp:200
LTC2992_write
int8_t LTC2992_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
Write an 8-bit code to the LTC2992.
Definition: LTC2992.cpp:138
LTC2992_code_to_current_sum
float LTC2992_code_to_current_sum(uint16_t adc_code, float resistor, float LTC2992_DELTA_SENSE_lsb)
Calculate the LTC2992 current sum with a sense resistor.
Definition: LTC2992.cpp:253
LTC2992_read_12_bits
int8_t LTC2992_read_12_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 12-bit adc_code from LTC2992.
Definition: LTC2992.cpp:186
LTC2992_GPIO_code_to_voltage
float LTC2992_GPIO_code_to_voltage(uint16_t adc_code, float LTC2992_ADIN_lsb)
Calculate the LTC2992 GPIO voltage.
Definition: LTC2992.cpp:234
LTC2992_code_to_power
float LTC2992_code_to_power(int32_t adc_code, float resistor, float LTC2992_Power_lsb)
Calculate the LTC2992 power.
Definition: LTC2992.cpp:263
LTC2992_write_24_bits
int8_t LTC2992_write_24_bits(uint8_t i2c_address, uint8_t adc_command, uint32_t code)
Write a 24-bit code to the LTC2992.
Definition: LTC2992.cpp:160
LTC2992_read_24_bits
int8_t LTC2992_read_24_bits(uint8_t i2c_address, uint8_t adc_command, uint32_t *adc_code)
Reads a 24-bit adc_code from LTC2992.
Definition: LTC2992.cpp:211
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113
LTC2992_SENSE_code_to_voltage
float LTC2992_SENSE_code_to_voltage(uint16_t adc_code, float LTC2992_SENSE_lsb)
Calculate the LTC2992 SENSE voltage.
Definition: LTC2992.cpp:225
LTC2992_code_to_current
float LTC2992_code_to_current(uint16_t adc_code, float resistor, float LTC2992_DELTA_SENSE_lsb)
Calculate the LTC2992 current with a sense resistor.
Definition: LTC2992.cpp:243
LTC2992_read
int8_t LTC2992_read(uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
Reads an 8-bit adc_code from LTC2992.
Definition: LTC2992.cpp:175