Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC4282.h
Go to the documentation of this file.
1 /*!
2 LTC4282: High Current Hot Swap Controller with I2C Compatible Monitoring and EEPROM
3 
4 @verbatim
5 
6 The LTC4282 Hot Swap controller allows a board to be safely inserted and removed from a live backplane.
7 Using one or more external N-channel pass transistors, board supply voltage and inrush current is ramped up at an adjustable rate.
8 An I2C interface and onboard ADC allows for monitoring of board current, voltage, power, energy and fault status.
9 
10 I2C DATA FORMAT (MSB FIRST):
11 
12 Data Out:
13 Byte #1 Byte #2 Byte #3
14 
15 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK C7 C6 C5 C4 C3 C2 C1 C0 SACK D7 D6 D5 D4 D3 D2 D1 D0 SACK STOP
16 
17 Data In:
18 Byte #1 Byte #2 Byte #3
19 
20 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK C7 C6 C5 C4 C3 C2 C1 C0 SACK Repeat Start SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK
21 
22 Byte #4 Byte #5
23 MSB LSB
24 D15 D14 D13 D12 D11 D10 D9 D8 MACK D7 D6 D5 D4 D3 D2 D1 D0 MNACK STOP
25 
26 START : I2C Start
27 Repeat Start: I2c Repeat Start
28 STOP : I2C Stop
29 SAx : I2C Address
30 SACK : I2C Slave Generated Acknowledge (Active Low)
31 MACK : I2C Master Generated Acknowledge (Active Low)
32 MNACK : I2c Master Generated Not Acknowledge
33 W : I2C Write (0)
34 R : I2C Read (1)
35 Cx : Command Code
36 Dx : Data Bits
37 X : Don't care
38 
39 
40 
41 Example Code:
42 
43 Read Voltage and Current
44 
45  static uint8_t CTRLREG_LSB = LTC4282_VIN_MODE_12_V;
46  static uint8_t ILIM_ADJUST = (LTC4282_ILIM_ADJUST_25_V_0|LTC4282_FOLDBACK_MODE_12_V_0|LTC4282_ADC_VSOURCE|LTC4282_ADC_GPIO2_MODE)& ~LTC4282_ADC_16_BIT;
47 
48  resistor = .1; // Resistor Value On Demo Board
49 
50  ack |= LTC4282_read_16_bits(LTC4282_I2C_ADDRESS, LTC4282_VSOURCE_MSB_REG, &voltage_code); //!< Read Voltage Code From VSOURCE Register
51  vsource = LTC4282_code_to_voltage(voltage_code, voltage_fullscale); //!< Convert Voltage Code to Current Source Voltage
52 
53  ack |= LTC4282_read_16_bits(LTC4282_I2C_ADDRESS, LTC4282_CURRENT_MSB_REG, t_code); // Reads the voltage code across sense resistor
54  current = LTC4282_code_to_current(current_code, resistor); // Calculates current from current code, resistor value.
55 
56  ack |= LTC4282_read_16_bits(LTC4282_I2C_ADDRESS, LTC4282_VOLTAGE_MSB_REG, &voltage_code); // Reads voltage voltage code
57  VIN = LTC4282_VIN_code_to_voltage(voltage_code); // Calculates VIN voltage from VIN code and lsb
58 
59 
60 @endverbatim
61 
62 http://www.linear.com/product/LTC4282
63 
64 http://www.linear.com/product/LTC4282#demoboards
65 
66 
67 Copyright 2018(c) Analog Devices, Inc.
68 
69 All rights reserved.
70 
71 Redistribution and use in source and binary forms, with or without
72 modification, are permitted provided that the following conditions are met:
73  - Redistributions of source code must retain the above copyright
74  notice, this list of conditions and the following disclaimer.
75  - Redistributions in binary form must reproduce the above copyright
76  notice, this list of conditions and the following disclaimer in
77  the documentation and/or other materials provided with the
78  distribution.
79  - Neither the name of Analog Devices, Inc. nor the names of its
80  contributors may be used to endorse or promote products derived
81  from this software without specific prior written permission.
82  - The use of this software may or may not infringe the patent rights
83  of one or more patent holders. This license does not release you
84  from the requirement that you obtain separate licenses from these
85  patent holders to use this software.
86  - Use of the software either in source or binary form, must be run
87  on or directly connected to an Analog Devices Inc. component.
88 
89 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
90 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
91 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
92 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
93 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
94 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
95 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
96 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
97 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
98 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99 */
100 
101 /*! @file
102  @ingroup LTC4282
103  Header for LTC4282: High Current Hot Swap Controller with I2C Compatible Monitoring and EEPROM
104 */
105 
106 #ifndef LTC4282_H
107 #define LTC4282_H
108 #include <stdint.h>
109 //! Use table to select address
110 /*!
111 | LTC4282 I2C Address Assignment | Value | AD2 | AD1 | AD0 |
112 | :-------------------------------- | :---: | :------: | :------: | :------: |
113 | LTC4282_I2C_ADDRESS | 0x40 | Low | NC | Low |
114 | LTC4282_I2C_ADDRESS | 0x41 | Low | High | NC |
115 | LTC4282_I2C_ADDRESS | 0x42 | Low | NC | NC |
116 | LTC4282_I2C_ADDRESS | 0x43 | Low | NC | High |
117 | LTC4282_I2C_ADDRESS | 0x44 | Low | Low | Low |
118 | LTC4282_I2C_ADDRESS | 0x45 | Low | High | High |
119 | LTC4282_I2C_ADDRESS | 0x46 | Low | Low | NC |
120 | LTC4282_I2C_ADDRESS | 0x47 | Low | Low | High |
121 | LTC4282_I2C_ADDRESS | 0x48 | NC | NC | Low |
122 | LTC4282_I2C_ADDRESS | 0x49 | NC | High | NC |
123 | LTC4282_I2C_ADDRESS | 0x4A | NC | NC | NC |
124 | LTC4282_I2C_ADDRESS | 0x4B | NC | NC | High |
125 | LTC4282_I2C_ADDRESS | 0x4C | NC | Low | Low |
126 | LTC4282_I2C_ADDRESS | 0x4D | NC | High | High |
127 | LTC4282_I2C_ADDRESS | 0x4E | NC | Low | NC |
128 | LTC4282_I2C_ADDRESS | 0x4F | NC | Low | High |
129 | LTC4282_I2C_ADDRESS | 0x50 | High | NC | Low |
130 | LTC4282_I2C_ADDRESS | 0x51 | High | High | NC |
131 | LTC4282_I2C_ADDRESS | 0x52 | High | NC | NC |
132 | LTC4282_I2C_ADDRESS | 0x53 | High | NC | High |
133 | LTC4282_I2C_ADDRESS | 0x54 | High | Low | Low |
134 | LTC4282_I2C_ADDRESS | 0x55 | High | High | High |
135 | LTC4282_I2C_ADDRESS | 0x56 | High | Low | NC |
136 | LTC4282_I2C_ADDRESS | 0x57 | High | Low | High |
137 | LTC4282_I2C_ADDRESS | 0x58 | Low | High | Low |
138 | LTC4282_I2C_ADDRESS | 0x59 | NC | High | Low |
139 | LTC4282_I2C_ADDRESS | 0x5A | High | High | Low |
140 | LTC4282_I2C_MASS_WRITE | 0x5F | X | X | X |
141 | LTC4282_I2C_ALERT_RESPONSE | 0x19 | X | X | X |
142 */
143 
144 
145 /*! @name LTC4282 I2C Address
146 @{ */
147 //#define LTC4282_I2C_ADDRESS 0x40 // Low | NC | Low |
148 //#define LTC4282_I2C_ADDRESS 0x41 // Low | High | NC |
149 //#define LTC4282_I2C_ADDRESS 0x42 // Low | NC | NC |
150 //#define LTC4282_I2C_ADDRESS 0x43 // Low | NC | High |
151 //#define LTC4282_I2C_ADDRESS 0x44 // Low | Low | Low |
152 //#define LTC4282_I2C_ADDRESS 0x45 // Low | High | High |
153 //#define LTC4282_I2C_ADDRESS 0x46 // Low | Low | NC |
154 //#define LTC4282_I2C_ADDRESS 0x47 // Low | Low | High |
155 //#define LTC4282_I2C_ADDRESS 0x48 // NC | NC | Low |
156 //#define LTC4282_I2C_ADDRESS 0x49 // NC | High | NC |
157 #define LTC4282_I2C_ADDRESS 0x4A // NC | NC | NC |
158 //#define LTC4282_I2C_ADDRESS 0x4B // NC | NC | High |
159 //#define LTC4282_I2C_ADDRESS 0x4C // NC | Low | Low |
160 //#define LTC4282_I2C_ADDRESS 0x4D // NC | High | High |
161 //#define LTC4282_I2C_ADDRESS 0x4E // NC | Low | NC |
162 //#define LTC4282_I2C_ADDRESS 0x4F // NC | Low | High |
163 //#define LTC4282_I2C_ADDRESS 0x50 // High | NC | Low |
164 //#define LTC4282_I2C_ADDRESS 0x51 // High | High | NC |
165 //#define LTC4282_I2C_ADDRESS 0x52 // High | NC | NC |
166 //#define LTC4282_I2C_ADDRESS 0x53 // High | NC | High |
167 //#define LTC4282_I2C_ADDRESS 0x54 // High | Low | Low |
168 //#define LTC4282_I2C_ADDRESS 0x55 // High | High | High |
169 //#define LTC4282_I2C_ADDRESS 0x56 // High | Low | NC |
170 //#define LTC4282_I2C_ADDRESS 0x57 // High | Low | High |
171 //#define LTC4282_I2C_ADDRESS 0x58 // Low | High | Low |
172 //#define LTC4282_I2C_ADDRESS 0x59 // NC | High | Low |
173 //#define LTC4282_I2C_ADDRESS 0x5A // High | High | Low |
174 #define LTC4282_I2C_MASS_WRITE 0x5F // X | X | X |
175 #define LTC4282_I2C_ALERT_RESPONSE 0x19 // X | X | X |
176 //! @}
177 
178 /*!
179 | Name | Value |
180 | :------------------------------------------------ | :---: |
181 | LTC4282_CONTROL_MSB_REG | 0x00 |
182 | LTC4282_CONTROL_LSB_REG | 0x01 |
183 | LTC4282_ALERT_MSB_REG | 0x02 |
184 | LTC4282_ALERT_LSB_REG | 0x03 |
185 | LTC4282_FAULT_LOG_REG | 0x04 |
186 | LTC4282_ADC_ALERT_LOG_REG | 0x05 |
187 | LTC4282_FET_BAD_FAULT_TIME_REG | 0x06 |
188 | LTC4282_GPIO_CONFIG_REG | 0x07 |
189 | LTC4282_VSOURCE_ALARM_MIN_REG | 0x08 |
190 | LTC4282_VSOURCE_ALARM_MAX_REG | 0x09 |
191 | LTC4282_VGPIO_ALARM_MIN_REG | 0x0A |
192 | LTC4282_VGPIO_ALARM_MAX_REG | 0x0B |
193 | LTC4282_VSENSE_ALARM_MIN_REG | 0x0C |
194 | LTC4282_VSENSE_ALARM_MAX_REG | 0x0D |
195 | LTC4282_POWER_ALARM_MIN_REG | 0x0E |
196 | LTC4282_POWER_ALARM_MAX_REG | 0x0F |
197 | LTC4282_CLK_DEC_REG | 0x10 |
198 | LTC4282_ILIM_ADJUST_REG | 0x11 |
199 | LTC4282_METER_MSB5_REG | 0x12 |
200 | LTC4282_METER_MSB4_REG | 0x13 |
201 | LTC4282_METER_MSB3_REG | 0x14 |
202 | LTC4282_METER_MSB2_REG | 0x15 |
203 | LTC4282_METER_MSB1_REG | 0x16 |
204 | LTC4282_METER_LSB_REG | 0x17 |
205 | LTC4282_TICK_COUNTER_MSB3_REG | 0x18 |
206 | LTC4282_TICK_COUNTER_MSB2_REG | 0x19 |
207 | LTC4282_TICK_COUNTER_MSB1_REG | 0x1A |
208 | LTC4282_TICK_COUNTER_LSB_REG | 0x1B |
209 | LTC4282_ALERT_CONTROL_REG | 0x1C |
210 | LTC4282_ADC_CONTROL_REG | 0x1D |
211 | LTC4282_STATUS_MSB_REG | 0x1E |
212 | LTC4282_STATUS_LSB_REG | 0x1F |
213 | LTC4282_EE_CONTROL_MSB_REG | 0x20 |
214 | LTC4282_EE_CONTROL_LSB_REG | 0x21 |
215 | LTC4282_EE_ALERT_MSB_REG | 0x22 |
216 | LTC4282_EE_ALERT_LSB_REG | 0x23 |
217 | LTC4282_EE_FAULT_REG | 0x24 |
218 | LTC4282_EE_ADC_ALERT_LOG_REG | 0x25 |
219 | LTC4282_EE_FET_BAD_FAULT_TIME_REG | 0x26 |
220 | LTC4282_EE_GPIO_CONFIG_REG | 0x27 |
221 | LTC4282_EE_VSOURCE_ALARM_MIN_REG | 0x28 |
222 | LTC4282_EE_VSOURCE_ALARM_MAX_REG | 0x29 |
223 | LTC4282_EE_VGPIO_ALARM_MIN_REG | 0x2A |
224 | LTC4282_EE_VGPIO_ALARM_MAX_REG | 0x2B |
225 | LTC4282_EE_VSENSE_ALARM_MIN_REG | 0x2C |
226 | LTC4282_EE_VSENSE_ALARM_MAX_REG | 0x2D |
227 | LTC4282_EE_POWER_ALARM_MIN_REG | 0x2E |
228 | LTC4282_EE_POWER_ALARM_MAX_REG | 0x2F |
229 | LTC4282_EE_CLK_DEC_REG | 0x30 |
230 | LTC4282_EE_ILIM_ADJUST_REG | 0x31 |
231 | LTC4282_VGPIO_MSB_REG | 0x34 |
232 | LTC4282_VGPIO_LSB_REG | 0x35 |
233 | LTC4282_VGPIO_MIN_MSB_REG | 0x36 |
234 | LTC4282_VGPIO_MIN_LSB_REG | 0x37 |
235 | LTC4282_VGPIO_MAX_MSB_REG | 0x38 |
236 | LTC4282_VGPIO_MAX_LSB_REG | 0x39 |
237 | LTC4282_VSOURCE_MSB_REG | 0x3A |
238 | LTC4282_VSOURCE_LSB_REG | 0x3B |
239 | LTC4282_VSOURCE_MIN_MSB_REG | 0x3C |
240 | LTC4282_VSOURCE_MIN_LSB_REG | 0x3D |
241 | LTC4282_VSOURCE_MAX_MSB_REG | 0x3E |
242 | LTC4282_VSOURCE_MAX_LSB_REG | 0x3F |
243 | LTC4282_VSENSE_MSB_REG | 0x40 |
244 | LTC4282_VSENSE_LSB_REG | 0x41 |
245 | LTC4282_VSENSE_MIN_MSB_REG | 0x42 |
246 | LTC4282_VSENSE_MIN_LSB_REG | 0x43 |
247 | LTC4282_VSENSE_MAX_MSB_REG | 0x44 |
248 | LTC4282_VSENSE_MAX_LSB_REG | 0x45 |
249 | LTC4282_POWER_MSB_REG | 0x46 |
250 | LTC4282_POWER_LSB_REG | 0x47 |
251 | LTC4282_POWER_MIN_MSB_REG | 0x48 |
252 | LTC4282_POWER_MIN_LSB_REG | 0x49 |
253 | LTC4282_POWER_MAX_MSB_REG | 0x4A |
254 | LTC4282_POWER_MAX_LSB_REG | 0x4B |
255 | | |
256 | LTC4282_EE_SPARE_MSB3_REG | 0x4C |
257 | LTC4282_EE_SPARE_MSB2_REG | 0x4D |
258 | LTC4282_EE_SPARE_MSB1_REG | 0x4E |
259 | LTC4282_EE_SPARE_LSB_REG | 0x4F |
260 */
261 /*! @name Registers
262 @{ */
263 // Registers
264 #define LTC4282_CONTROL_MSB_REG 0x00
265 #define LTC4282_CONTROL_LSB_REG 0x01
266 #define LTC4282_ALERT_MSB_REG 0x02
267 #define LTC4282_ALERT_LSB_REG 0x03
268 #define LTC4282_FAULT_LOG_REG 0x04
269 #define LTC4282_ADC_ALERT_LOG_REG 0x05
270 #define LTC4282_FET_BAD_FAULT_TIME_REG 0x06
271 #define LTC4282_GPIO_CONFIG_REG 0x07
272 #define LTC4282_VSOURCE_ALARM_MIN_REG 0x08
273 #define LTC4282_VSOURCE_ALARM_MAX_REG 0x09
274 #define LTC4282_VGPIO_ALARM_MIN_REG 0x0A
275 #define LTC4282_VGPIO_ALARM_MAX_REG 0x0B
276 #define LTC4282_VSENSE_ALARM_MIN_REG 0x0C
277 #define LTC4282_VSENSE_ALARM_MAX_REG 0x0D
278 #define LTC4282_POWER_ALARM_MIN_REG 0x0E
279 #define LTC4282_POWER_ALARM_MAX_REG 0x0F
280 #define LTC4282_CLK_DEC_REG 0x10
281 #define LTC4282_ILIM_ADJUST_REG 0x11
282 #define LTC4282_METER_MSB5_REG 0x12
283 #define LTC4282_METER_MSB4_REG 0x13
284 #define LTC4282_METER_MSB3_REG 0x14
285 #define LTC4282_METER_MSB2_REG 0x15
286 #define LTC4282_METER_MSB1_REG 0x16
287 #define LTC4282_METER_LSB_REG 0x17
288 #define LTC4282_TICK_COUNTER_MSB3_REG 0x18
289 #define LTC4282_TICK_COUNTER_MSB2_REG 0x19
290 #define LTC4282_TICK_COUNTER_MSB1_REG 0x1A
291 #define LTC4282_TICK_COUNTER_LSB_REG 0x1B
292 #define LTC4282_ALERT_CONTROL_REG 0x1C
293 #define LTC4282_ADC_CONTROL_REG 0x1D
294 #define LTC4282_STATUS_MSB_REG 0x1E
295 #define LTC4282_STATUS_LSB_REG 0x1F
296 #define LTC4282_EE_CONTROL_MSB_REG 0x20
297 #define LTC4282_EE_CONTROL_LSB_REG 0x21
298 #define LTC4282_EE_ALERT_MSB_REG 0x22
299 #define LTC4282_EE_ALERT_LSB_REG 0x23
300 #define LTC4282_EE_FAULT_REG 0x24
301 #define LTC4282_EE_ADC_ALERT_LOG_REG 0x25
302 #define LTC4282_EE_FET_BAD_FAULT_TIME_REG 0x26
303 #define LTC4282_EE_GPIO_CONFIG_REG 0x27
304 #define LTC4282_EE_VSOURCE_ALARM_MIN_REG 0x28
305 #define LTC4282_EE_VSOURCE_ALARM_MAX_REG 0x29
306 #define LTC4282_EE_VGPIO_ALARM_MIN_REG 0x2A
307 #define LTC4282_EE_VGPIO_ALARM_MAX_REG 0x2B
308 #define LTC4282_EE_VSENSE_ALARM_MIN_REG 0x2C
309 #define LTC4282_EE_VSENSE_ALARM_MAX_REG 0x2D
310 #define LTC4282_EE_POWER_ALARM_MIN_REG 0x2E
311 #define LTC4282_EE_POWER_ALARM_MAX_REG 0x2F
312 #define LTC4282_EE_CLK_DEC_REG 0x30
313 #define LTC4282_EE_ILIM_ADJUST_REG 0x31
314 #define LTC4282_VGPIO_MSB_REG 0x34
315 #define LTC4282_VGPIO_LSB_REG 0x35
316 #define LTC4282_VGPIO_MIN_MSB_REG 0x36
317 #define LTC4282_VGPIO_MIN_LSB_REG 0x37
318 #define LTC4282_VGPIO_MAX_MSB_REG 0x38
319 #define LTC4282_VGPIO_MAX_LSB_REG 0x39
320 #define LTC4282_VSOURCE_MSB_REG 0x3A
321 #define LTC4282_VSOURCE_LSB_REG 0x3B
322 #define LTC4282_VSOURCE_MIN_MSB_REG 0x3C
323 #define LTC4282_VSOURCE_MIN_LSB_REG 0x3D
324 #define LTC4282_VSOURCE_MAX_MSB_REG 0x3E
325 #define LTC4282_VSOURCE_MAX_LSB_REG 0x3F
326 #define LTC4282_VSENSE_MSB_REG 0x40
327 #define LTC4282_VSENSE_LSB_REG 0x41
328 #define LTC4282_VSENSE_MIN_MSB_REG 0x42
329 #define LTC4282_VSENSE_MIN_LSB_REG 0x43
330 #define LTC4282_VSENSE_MAX_MSB_REG 0x44
331 #define LTC4282_VSENSE_MAX_LSB_REG 0x45
332 #define LTC4282_POWER_MSB_REG 0x46
333 #define LTC4282_POWER_LSB_REG 0x47
334 #define LTC4282_POWER_MIN_MSB_REG 0x48
335 #define LTC4282_POWER_MIN_LSB_REG 0x49
336 #define LTC4282_POWER_MAX_MSB_REG 0x4A
337 #define LTC4282_POWER_MAX_LSB_REG 0x4B
338 
339 #define LTC4282_EE_SPARE_MSB3_REG 0x4C
340 #define LTC4282_EE_SPARE_MSB2_REG 0x4D
341 #define LTC4282_EE_SPARE_MSB1_REG 0x4E
342 #define LTC4282_EE_SPARE_LSB_REG 0x4F
343 //! @}
344 /*!
345 | Command Codes | Value |
346 | :-------------------------------------------- | :-------: |
347 | LTC4282_ON_FAULT_MASK | 0x80 |
348 | LTC4282_ENABLE_ON_DELAY | 0x40 |
349 | LTC4282_ON_ENB | 0x20 |
350 | LTC4282_ENABLE_MASS_WRITE | 0x10 |
351 | LTC4282_ENABLE_FET_ON | 0x08 |
352 | LTC4282_ENABLE_OC_AUTORETRY | 0x04 |
353 | LTC4282_ENABLE_UV_AUTORETRY | 0x02 |
354 | LTC4282_ENABLE_OV_AUTORETRY | 0x01 |
355 | | |
356 | LTC4282_DISABLE_ON_DELAY | 0xBF |
357 | LTC4282_DISABLE_ON_ENB | 0xDF |
358 | LTC4282_DISABLE_MASS_WRITE | 0xEF |
359 | LTC4282_DISABLE_FET_ON | 0xF7 |
360 | LTC4282_DISABLE_OC_AUTORETRY | 0xFB |
361 | LTC4282_DISABLE_UV_AUTORETRY | 0xFD |
362 | LTC4282_DISABLE_OV_AUTORETRY | 0xFE |
363 | | |
364 | LTC4282_FB_MODE_EXTERNAL | 0x00 |
365 | LTC4282_FB_MODE_5 | 0x40 |
366 | LTC4282_FB_MODE_10 | 0x80 |
367 | LTC4282_FB_MODE_15 | 0xC0 |
368 | LTC4282_UV_MODE_EXTERNAL | 0x00 |
369 | LTC4282_UV_MODE_5 | 0x10 |
370 | LTC4282_UV_MODE_10 | 0x20 |
371 | LTC4282_UV_MODE_15 | 0x30 |
372 | LTC4282_OV_MODE_EXTERNAL | 0x00 |
373 | LTC4282_OV_MODE_5 | 0x04 |
374 | LTC4282_OV_MODE_10 | 0x08 |
375 | LTC4282_OV_MODE_15 | 0x0C |
376 | LTC4282_VIN_MODE_3_V_3 | 0x00 |
377 | LTC4282_VIN_MODE_5_V | 0x01 |
378 | LTC4282_VIN_MODE_12_V | 0x02 |
379 | LTC4282_VIN_MODE_24_V | 0x03 |
380 | | |
381 | LTC4282_EEPROM_DONE_ALERT | 0x80 |
382 | LTC4282_FET_BAD_FAULT_ALERT | 0x40 |
383 | LTC4282_FET_SHORT_ALERT | 0x20 |
384 | LTC4282_ON_ALERT | 0x10 |
385 | LTC4282_PB_ALERT | 0x08 |
386 | LTC4282_OC_ALERT | 0x04 |
387 | LTC4282_UV_ALERT | 0x02 |
388 | LTC4282_OV_ALERT | 0x01 |
389 | | |
390 | LTC4282_POWER_ALARM_HIGH | 0x80 |
391 | LTC4282_POWER_ALARM_LOW | 0x40 |
392 | LTC4282_VSENSE_ALARM_HIGH | 0x20 |
393 | LTC4282_VSENSE_ALARM_LOW | 0x10 |
394 | LTC4282_VSOURCE_ALARM_HIGH | 0x08 |
395 | LTC4282_VSOURCE_ALARM_LOW | 0x04 |
396 | LTC4282_VGPIO_ALARM_HIGH | 0x02 |
397 | LTC4282_VGPIO_ALARM_LOW | 0x01 |
398 | | |
399 | LTC4282_ENABLE_GPIO3_PD | 0x80 |
400 | LTC4282_ENABLE_GPIO2_PD | 0x40 |
401 | LTC4282_GPIO1_CONFIG_POWER_GOOD | 0x00 |
402 | LTC4282_GPIO1_CONFIG_POWER_BAD | 0x10 |
403 | LTC4282_GPIO1_CONFIG_OUTPUT | 0x20 |
404 | LTC4282_GPIO1_CONFIG_INPUT | 0x30 |
405 | LTC4282_GPIO1_OUTPUT | 0x08 |
406 | LTC4282_ENABLE_ADC_CONV_ALERT | 0x04 |
407 | LTC4282_ENABLE_STRESS_TO_GPIO2 | 0x02 |
408 | LTC4282_ENABLE_METER_OF_ALERT | 0x01 |
409 | | |
410 | LTC4282_DISABLE_GPIO3_PD | 0x7F |
411 | LTC4282_DISABLE_GPIO2_PD | 0xBF |
412 | LTC4282_DISABLE_GPIO1_OUTPUT | 0xF7 |
413 | LTC4282_DISABLE_ADC_CONV_ALERT | 0xFB |
414 | LTC4282_DISABLE_STRESS_TO_GPIO2 | 0xFD |
415 | LTC4282_DISABLE_METER_OF_ALERT | 0xFE |
416 | | |
417 | LTC4282_ENABLE_COULOMB_METER | 0x80 |
418 | LTC4282_ENABLE_TICK_OUT | 0x40 |
419 | LTC4282_ENABLE_INT_CLK_OUT | 0x20 |
420 | | |
421 | LTC4282_DISABLE_COULOMB_METER | 0x7F |
422 | LTC4282_DISABLE_TICK_OUT | 0xBF |
423 | LTC4282_DISABLE_INT_CLK_OUT | 0xDF |
424 | | |
425 | LTC4282_ILIM_ADJUST_12_V_5 | 0x00 |
426 | LTC4282_ILIM_ADJUST_15_V_6 | 0x20 |
427 | LTC4282_ILIM_ADJUST_18_V_7 | 0x40 |
428 | LTC4282_ILIM_ADJUST_21_V_8 | 0x60 |
429 | LTC4282_ILIM_ADJUST_25_V_0 | 0x80 |
430 | LTC4282_ILIM_ADJUST_28_V_1 | 0xA0 |
431 | LTC4282_ILIM_ADJUST_31_V_2 | 0xC0 |
432 | LTC4282_ILIM_ADJUST_34_V_3 | 0xE0 |
433 | | |
434 | LTC4282_FOLDBACK_MODE_3_V_3 | 0x00 |
435 | LTC4282_FOLDBACK_MODE_5_V_0 | 0x08 |
436 | LTC4282_FOLDBACK_MODE_12_V_0 | 0x10 |
437 | LTC4282_FOLDBACK_MODE_24_V_0 | 0x18 |
438 | | |
439 | LTC4282_ENABLE_ADC_VSOURCE | 0x04 |
440 | LTC4282_ENABLE_ADC_GPIO_MODE | 0x02 |
441 | LTC4282_ENABLE_ADC_16_BIT | 0x01 |
442 | | |
443 | LTC4282_DISABLE_ADC_VSOURCE | 0xFB |
444 | LTC4282_DISABLE_ADC_GPIO_MODE | 0xFD |
445 | LTC4282_DISABLE_ADC_16_BIT | 0xFE |
446 | | |
447 | LTC4282_ENABLE_ALERT_GENERATED | 0x80 |
448 | LTC4282_ENABLE_ALERT_PD | 0x40 |
449 | LTC4282_DISABLE_ALERT_GENERATED | 0x7F |
450 | LTC4282_DISABLE_ALERT_PD | 0xBF |
451 | | |
452 | LTC4282_REBOOT | 0x80 |
453 | LTC4282_ENABLE_METER_RESET | 0x40 |
454 | LTC4282_ENABLE_METER_HALT | 0x20 |
455 | LTC4282_ENABLE_FAULT_LOG | 0x04 |
456 | LTC4282_GATEUP | 0x02 |
457 | LTC4282_ADC_HALT | 0x01 |
458 | | |
459 | LTC4282_DISABLE_METER_RESET | 0xBF |
460 | LTC4282_DISABLE_METER_HALT | 0xDF |
461 | LTC4282_DISABLE_FAULT_LOG | 0xFB |
462 | | |
463 |*/
464 /*! @name Command Codes
465 @{ */
466 // Command Codes
467 #define LTC4282_ON_FAULT_MASK 0x80
468 //#define LTC4282_ON_FAULT_MASK 0x80
469 #define LTC4282_ON_DELAY 0x40
470 #define LTC4282_ON_ENB 0x20
471 #define LTC4282_MASS_WRITE 0x10
472 #define LTC4282_FET_ON 0x08
473 #define LTC4282_OC_AUTORETRY 0x04
474 #define LTC4282_UV_AUTORETRY 0x02
475 #define LTC4282_OV_AUTORETRY 0x01
476 #define LTC4282_FB_MODE_EXTERNAL 0x00
477 #define LTC4282_FB_MODE_5 0x40
478 #define LTC4282_FB_MODE_10 0x80
479 #define LTC4282_FB_MODE_15 0xC0
480 #define LTC4282_UV_MODE_EXTERNAL 0x00
481 #define LTC4282_UV_MODE_5 0x10
482 #define LTC4282_UV_MODE_10 0x20
483 #define LTC4282_UV_MODE_15 0x30
484 #define LTC4282_OV_MODE_EXTERNAL 0x00
485 #define LTC4282_OV_MODE_5 0x04
486 #define LTC4282_OV_MODE_10 0x08
487 #define LTC4282_OV_MODE_15 0x0C
488 #define LTC4282_VIN_MODE_3_V_3 0x00
489 #define LTC4282_VIN_MODE_5_V 0x01
490 #define LTC4282_VIN_MODE_12_V 0x02
491 #define LTC4282_VIN_MODE_24_V 0x03
492 #define LTC4282_EEPROM_DONE_ALERT 0x80
493 #define LTC4282_FET_BAD_FAULT_ALERT 0x40
494 #define LTC4282_FET_SHORT_ALERT 0x20
495 #define LTC4282_ON_ALERT 0x10
496 #define LTC4282_PB_ALERT 0x08
497 #define LTC4282_OC_ALERT 0x04
498 #define LTC4282_UV_ALERT 0x02
499 #define LTC4282_OV_ALERT 0x01
500 #define LTC4282_POWER_ALARM_HIGH 0x80
501 #define LTC4282_POWER_ALARM_LOW 0x40
502 #define LTC4282_VSENSE_ALARM_HIGH 0x20
503 #define LTC4282_VSENSE_ALARM_LOW 0x10
504 #define LTC4282_VSOURCE_ALARM_HIGH 0x08
505 #define LTC4282_VSOURCE_ALARM_LOW 0x04
506 #define LTC4282_VGPIO_ALARM_HIGH 0x02
507 #define LTC4282_VGPIO_ALARM_LOW 0x01
508 #define LTC4282_GPIO3_PD 0x80
509 #define LTC4282_GPIO2_PD 0x40
510 #define LTC4282_GPIO1_CONFIG_POWER_GOOD 0x00
511 #define LTC4282_GPIO1_CONFIG_POWER_BAD 0x20
512 #define LTC4282_GPIO1_CONFIG_OUTPUT 0x10
513 #define LTC4282_GPIO1_CONFIG_INPUT 0x30
514 #define LTC4282_GPIO1_OUTPUT 0x08
515 #define LTC4282_ADC_CONV_ALERT 0x04
516 #define LTC4282_STRESS_TO_GPIO2 0x02
517 #define LTC4282_METER_OF_ALERT 0x01
518 #define LTC4282_COULOMB_METER 0x80
519 #define LTC4282_TICK_OUT 0x40
520 #define LTC4282_INT_CLK_OUT 0x20
521 #define LTC4282_ILIM_ADJUST_12_V_5 0x00
522 #define LTC4282_ILIM_ADJUST_15_V_6 0x20
523 #define LTC4282_ILIM_ADJUST_18_V_7 0x40
524 #define LTC4282_ILIM_ADJUST_21_V_8 0x60
525 #define LTC4282_ILIM_ADJUST_25_V_0 0x80
526 #define LTC4282_ILIM_ADJUST_28_V_1 0xA0
527 #define LTC4282_ILIM_ADJUST_31_V_2 0xC0
528 #define LTC4282_ILIM_ADJUST_34_V_3 0xE0
529 #define LTC4282_FOLDBACK_MODE_3_V_3 0x00
530 #define LTC4282_FOLDBACK_MODE_5_V_0 0x08
531 #define LTC4282_FOLDBACK_MODE_12_V_0 0x10
532 #define LTC4282_FOLDBACK_MODE_24_V_0 0x18
533 #define LTC4282_ADC_VSOURCE 0x04
534 #define LTC4282_ADC_GPIO2_MODE 0x02
535 #define LTC4282_ADC_16_BIT 0x01
536 #define LTC4282_ENABLE_ALERT_GENERATED 0x80
537 #define LTC4282_ENABLE_ALERT_PD 0x40
538 #define LTC4282_DISABLE_ALERT_GENERATED 0x7F
539 #define LTC4282_DISABLE_ALERT_PD 0xBF
540 #define LTC4282_REBOOT 0x80
541 #define LTC4282_ENABLE_METER_RESET 0x40
542 #define LTC4282_ENABLE_METER_HALT 0x20
543 #define LTC4282_ENABLE_FAULT_LOG 0x04
544 #define LTC4282_GATEUP 0x02
545 #define LTC4282_ADC_HALT 0x01
546 #define LTC4282_DISABLE_METER_RESET 0xBF
547 #define LTC4282_DISABLE_METER_HALT 0xDF
548 #define LTC4282_DISABLE_FAULT_LOG 0xFB
549 //! @}
550 
551 /*! @name Register MASKS
552 @{ */
553 //! LTC4282 Register MASKS
554 #define LTC4282_FB_MODE_MASK 0xC0
555 #define LTC4282_UV_MODE_MASK 0x30
556 #define LTC4282_OV_MODE_MASK 0x0C
557 #define LTC4282_VIN_MODE_MASK 0x03
558 #define LTC4282_ILIM_ADJUST_MASK 0xE0
559 #define LTC4282_FOLDBACK_MASK 0x18
560 #define LTC4282_GPIO1_CONFIG_MASK 0x30
561 //! @}
562 
563 /*! @name LTC4282 LSB's
564 @{ */
565 //! LTC4282 LSB's
566 const float LTC4282_ADC_FS = 40E-3;
567 const float LTC4282_VSOURCE_24V_FS = 33.28;
568 const float LTC4282_VSOURCE_12V_FS = 16.64;
569 const float LTC4282_VSOURCE_5V_FS = 8.32;
570 const float LTC4282_VSOURCE_3V3_FS = 5.547;
571 const float LTC4282_GPIO_FS = 1.28;
572 //! @}
573 
575 {
576  int64_t LT_int64; //!< 32-bit signed integer to be converted to four bytes
577  uint64_t LT_uint64; //!< 32-bit unsigned integer to be converted to four bytes
578  uint8_t LT_byte[8]; //!< 4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer
579 };
580 
581 //! Write an 8-bit code to the LTC4282
582 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
583 int8_t LTC4282_write(uint8_t i2c_address, //!< Register address for the LTC4282
584  uint8_t adc_command, //!< The "command byte" for the LTC4282
585  uint8_t code //!< Value that will be written to the register
586  );
587 
588 //! Write an 16-bit code to the LTC4282
589 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
590 int8_t LTC4282_write_16_bits(uint8_t i2c_address, //!< Register address for the LTC4282
591  uint8_t adc_command, //!< The "command byte" for the LTC4282
592  uint16_t code //!< Value that will be written to the register
593  );
594 
595 //! Write an 32-bit code to the LTC4282
596 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
597 int8_t LTC4282_write_32_bits(uint8_t i2c_address, //!< Register address for the LTC4282
598  uint8_t adc_command, //!< The "command byte" for the LTC4282
599  uint32_t code //!< Value that will be written to the register
600  );
601 
602 //! Write an 48-bit code to the LTC4282
603 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
604 int8_t LTC4282_write_48_bits(uint8_t i2c_address, //!< Register address for the LTC4282
605  uint8_t adc_command, //!< The "command byte" for the LTC4282
606  uint64_t code //!< Value that will be written to the register
607  );
608 
609 //! Read an 8-bit code from the LTC4282
610 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
611 int8_t LTC4282_read(uint8_t i2c_address, //!< Register address for the LTC4282
612  uint8_t adc_command, //!< The "command byte" for the LTC4282
613  uint8_t *adc_code //!< Value that will be read from the register
614  );
615 
616 //! Read a 16-bit code from the LTC4282
617 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
618 int8_t LTC4282_read_16_bits(uint8_t i2c_address, //!< Register address for the LTC4282
619  uint8_t adc_command, //!< The "command byte" for the LTC4282
620  uint16_t *adc_code //!< Value that will be read from the
621  );
622 
623 //! Read a 32-bit code from the LTC4282
624 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
625 int8_t LTC4282_read_32_bits(uint8_t i2c_address, //!< Register address for the LTC4282
626  uint8_t adc_command, //!< The "command byte" for the LTC4282
627  uint32_t *adc_code //!< Value that will be read from the
628  );
629 
630 //! Read a 48-bit code from the LTC4282
631 //! @return Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.
632 int8_t LTC4282_read_48_bits(uint8_t i2c_address, //!< Register address for the LTC4282
633  uint8_t adc_command, //!< The "command byte" for the LTC4282
634  uint64_t *adc_code //!< Value that will be read from the
635  );
636 
637 //! Convert ADC code to VGPIO
638 //! @return Returns floating point value of GPIO voltage
639 float LTC4282_code_to_VGPIO(uint16_t code //!< Code to be converted to voltage
640  );
641 
642 
643 //! Convert ADC code to voltage
644 //! @return Returns floating point value of voltage
645 float LTC4282_code_to_voltage(uint16_t code, //!< Code to be converted to voltage
646  float fullscaleVoltage //!< Fullscale VSOURCE Voltage
647  );
648 
649 //! Convert ADC code to current
650 //! @return Returns floating point value of current
651 float LTC4282_code_to_current(uint16_t code, //!< Code to be converted to current
652  float resistor //!< Sense Resistor Value
653  );
654 
655 //! Convert ADC code to power
656 //! @return Returns floating point value of power
657 float LTC4282_code_to_power(uint16_t code, //!< Code to be converted to power
658  float fullscaleVoltage, //!< Fullscale VSOURCE Voltage
659  float resistor //!< Sense Resistor Value
660  );
661 
662 //! Convert ADC code to energy
663 //! @return Returns floating point value of energy
664 float LTC4282_code_to_energy(uint64_t code, //!< Code to be converted to energy
665  float fullscaleVoltage, //!< Fullscale VSOURCE Voltage
666  float resistor, //!< Sense Resistor Value
667  float tConv //!< Conversion Time
668  );
669 
670 //! Convert ADC code to coulombs
671 //! @return Returns floating point value of coulombs
672 float LTC4282_code_to_coulombs(uint64_t code, //!< Code to be converted to Coulombs
673  float resistor, //!< Sense Resistor Value
674  float tConv //!< Conversion Time
675  );
676 
677 //! Convert ADC code to average power
678 //! @return Returns floating point value of average power
679 float LTC4282_code_to_avg_power(uint64_t code, //!< Code to be converted to average power
680  float energy, //!< Energy value
681  float tConv //!< Conversion Time
682  );
683 
684 //! Convert ADC code to average current
685 //! @return Returns floating point value of average current
686 float LTC4282_code_to_avg_current(uint64_t code, //!< Code to be converted to average power
687  float coulombs, //!< Energy value
688  float tConv //!< Conversion Time
689  );
690 
691 
692 //! Convert ADC code to GPIO alarm voltage
693 //! @return Returns floating point value of GPIO alarm voltage
694 float LTC4282_code_to_GPIO_alarm(uint8_t code //!< Code to be converted to voltage
695  );
696 
697 //! Convert ADC code to alarm voltage
698 //! @return Returns floating point value of alarm voltage
699 float LTC4282_code_to_volt_alarm(uint8_t code, //!< Code to be converted to voltage
700  float fullscaleVoltage //!< Fullscale VSOURCE voltage
701  );
702 
703 //! Convert ADC code to alarm current
704 //! @return Returns floating point value of alarm current
705 float LTC4282_code_to_current_alarm(uint8_t code, //!< Code to be converted to current
706  float resistor //!< Sense Resistor Value
707  );
708 
709 //! Convert ADC code to alarm power
710 //! @return Returns floating point value of alarm power
711 float LTC4282_code_to_power_alarm(uint8_t code, //!< Code to be converted to power
712  float fullscaleVoltage, //!< Fullscale VSOURCE voltage
713  float resistor //!< Sense Resistor Value
714  );
715 
716 //! Convert GPIO voltage to alarm code
717 //! @return Returns the ADC code of the floating point value parameter
718 uint8_t LTC4282_VGPIO_to_code_alarm(float vgpio //!< VGPIO voltage to be converted to alarm code
719  );
720 
721 //! Convert voltage to alarm code
722 //! @return Returns the ADC code of the floating point value parameter
723 uint8_t LTC4282_volt_to_code_alarm(float volt, //!< Voltage to be converted to alarm code
724  float fullscaleVoltage //!< Fullscale voltage value to convert voltage into alarm code
725  );
726 
727 //! Convert current to alarm code
728 //! @return Returns the ADC code of the floating point value parameter
729 uint8_t LTC4282_current_to_code_alarm(float current, //!< Current value to be converted to alarm code
730  float resistor //!< Sense Resistor Value
731  );
732 
733 //! Convert power to alarm code
734 //! @return Returns the ADC code of the floating point value
735 uint8_t LTC4282_power_to_code_alarm(float power, //!< Power value to be converted to alarm code
736  float resistor, //!< Sense Resistor Value
737  float fullscaleVoltage //!< Fullsvale voltage value to convert voltage into alarm code
738  );
739 
740 #endif
float LTC4282_code_to_voltage(uint16_t code, float fullscaleVoltage)
Convert ADC code to voltage.
Definition: LTC4282.cpp:177
uint8_t i2c_address
float LTC4282_code_to_GPIO_alarm(uint8_t code)
Convert ADC code to GPIO alarm voltage.
Definition: LTC4282.cpp:232
static uint8_t adc_command
Definition: DC2071AA.ino:111
int8_t LTC4282_write_48_bits(uint8_t i2c_address, uint8_t adc_command, uint64_t code)
Write an 48-bit code to the LTC4282.
Definition: LTC4282.cpp:105
const float resistor
resistor value on demo board
Definition: DC1496BB.ino:116
float LTC4282_code_to_current_alarm(uint8_t code, float resistor)
Convert ADC code to alarm current.
Definition: LTC4282.cpp:248
int8_t LTC4282_read_32_bits(uint8_t i2c_address, uint8_t adc_command, uint32_t *adc_code)
Read a 32-bit code from the LTC4282.
Definition: LTC4282.cpp:140
uint64_t LT_uint64
32-bit unsigned integer to be converted to four bytes
Definition: LTC4282.h:577
uint8_t LTC4282_power_to_code_alarm(float power, float resistor, float fullscaleVoltage)
Convert power to alarm code.
Definition: LTC4282.cpp:288
uint8_t LTC4282_VGPIO_to_code_alarm(float vgpio)
Convert GPIO voltage to alarm code.
Definition: LTC4282.cpp:264
const float LTC4282_ADC_FS
LTC4282 LSB&#39;s.
Definition: LTC4282.h:566
const float LTC4282_GPIO_FS
Definition: LTC4282.h:571
float LTC4282_code_to_avg_current(uint64_t code, float coulombs, float tConv)
Convert ADC code to average current.
Definition: LTC4282.cpp:224
const float LTC4282_VSOURCE_5V_FS
Definition: LTC4282.h:569
const float LTC4282_VSOURCE_3V3_FS
Definition: LTC4282.h:570
float LTC4282_code_to_power_alarm(uint8_t code, float fullscaleVoltage, float resistor)
Convert ADC code to alarm power.
Definition: LTC4282.cpp:256
const float LTC4282_VSOURCE_12V_FS
Definition: LTC4282.h:568
int8_t LTC4282_write_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t code)
Write an 16-bit code to the LTC4282.
Definition: LTC4282.cpp:81
float LTC4282_code_to_power(uint16_t code, float fullscaleVoltage, float resistor)
Convert ADC code to power.
Definition: LTC4282.cpp:193
int8_t LTC4282_read_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Read a 16-bit code from the LTC4282.
Definition: LTC4282.cpp:129
float LTC4282_code_to_coulombs(uint64_t code, float resistor, float tConv)
Convert ADC code to coulombs.
Definition: LTC4282.cpp:208
float LTC4282_code_to_VGPIO(uint16_t code)
Convert ADC code to VGPIO.
Definition: LTC4282.cpp:168
float LTC4282_code_to_energy(uint64_t code, float fullscaleVoltage, float resistor, float tConv)
Convert ADC code to energy.
Definition: LTC4282.cpp:200
uint8_t LT_byte[8]
4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer ...
Definition: LTC4282.h:578
int8_t LTC4282_read_48_bits(uint8_t i2c_address, uint8_t adc_command, uint64_t *adc_code)
Read a 48-bit code from the LTC4282.
Definition: LTC4282.cpp:154
int64_t LT_int64
32-bit signed integer to be converted to four bytes
Definition: LTC4282.h:576
float LTC4282_code_to_current(uint16_t code, float resistor)
Convert ADC code to current.
Definition: LTC4282.cpp:185
float LTC4282_code_to_avg_power(uint64_t code, float energy, float tConv)
Convert ADC code to average power.
Definition: LTC4282.cpp:216
const int16_t E
int8_t LTC4282_read(uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
Read an 8-bit code from the LTC4282.
Definition: LTC4282.cpp:120
static uint16_t current
the current measurement from the LTC3335&#39;s counter test mode.
Definition: DC2343A.ino:114
float LTC4282_code_to_volt_alarm(uint8_t code, float fullscaleVoltage)
Convert ADC code to alarm voltage.
Definition: LTC4282.cpp:240
uint8_t LTC4282_current_to_code_alarm(float current, float resistor)
Convert current to alarm code.
Definition: LTC4282.cpp:280
int8_t LTC4282_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
Write an 8-bit code to the LTC4282.
Definition: LTC4282.cpp:69
int8_t LTC4282_write_32_bits(uint8_t i2c_address, uint8_t adc_command, uint32_t code)
Write an 32-bit code to the LTC4282.
Definition: LTC4282.cpp:91
const float LTC4282_VSOURCE_24V_FS
Definition: LTC4282.h:567
uint8_t LTC4282_volt_to_code_alarm(float volt, float fullscaleVoltage)
Convert voltage to alarm code.
Definition: LTC4282.cpp:272
static uint32_t adc_code
Definition: DC2071AA.ino:113