| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

DC2313A.ino
Go to the documentation of this file.
1 /*!
2 Linear Technology DC2313A Demonstration
3
4 LTC2937: Six Channel Sequencer and Voltage Supervisor with EEPROM
5
6 @verbatim
7 Setup:
8 Set the terminal baud rate to 115200 and select the newline terminator.
9
10 @endverbatim
11
12 http://www.linear.com/product/LTC2937
13
14 http://www.linear.com/demo/DC2313A
15
16
17 Copyright 2018(c) Analog Devices, Inc.
18
19 All rights reserved.
20
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions are met:
23 - Redistributions of source code must retain the above copyright
24 notice, this list of conditions and the following disclaimer.
25 - Redistributions in binary form must reproduce the above copyright
26 notice, this list of conditions and the following disclaimer in
27 the documentation and/or other materials provided with the
28 distribution.
29 - Neither the name of Analog Devices, Inc. nor the names of its
30 contributors may be used to endorse or promote products derived
31 from this software without specific prior written permission.
32 - The use of this software may or may not infringe the patent rights
33 of one or more patent holders. This license does not release you
34 from the requirement that you obtain separate licenses from these
35 patent holders to use this software.
36 - Use of the software either in source or binary form, must be run
37 on or directly connected to an Analog Devices Inc. component.
38
39 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
40 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
41 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
43 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
45 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 */
50
51 /*! @file
52 @ingroup LTC2937
53 */
54
55 #include <Arduino.h>
56 #include <stdint.h>
57 #include "Linduino.h"
58 #include "UserInterface.h"
59 //#include "LT_I2CBus.h"
60 #include "LT_SMBusNoPec.h"
61 //#include "LT_SMBusPec.h"
62 //#include "LT_PMBUS.h"
63 //#include "LT_I2C.h"
64 #include "LTC2937.h"
65
66 #define LTC2937_I2C_ADDRESS 0x36 //global 7-bit address
67 //#define LTC2937_I2C_ADDRESS 0x50 //HHZ 7-bit address
68
69
70 /****************************************************************************/
71 // Global variables
72 static uint8_t ltc2937_i2c_address;
73
74 //static LT_I2CBus *i2cbus = new LT_I2CBus();
75 //static LT_I2CBus *i2cbus = new LT_I2CBus();
76 //static LT_SMBusNoPec *smbus = new LT_SMBusNoPec(i2cbus);
77 static LT_SMBusNoPec *smbus = new LT_SMBusNoPec();
78
79
80 // function return values
81 enum return_values {SUCCEED=0, // the function succeeded without errors
82 NOT_DOWN, // the LTC2937 is not sequenced-down
83 WRITE_PROTECTED, // the LTC2937 is write-protected
84 FAIL // general failure to do the right thing
85 };
86
87 // delay times in milliseconds
88 #define LTC2937_RESTORE_DELAY 10
89 #define LTC2937_STORE_DELAY 120
90
91 /****************************************************************************/
92 //! Initialize Linduino
93 //! @return void
94 void setup()
95 {
96 uint16_t return_val;
97
98 ltc2937_i2c_address = LTC2937_I2C_ADDRESS;
99
100 Serial.begin(115200); //! Initialize the serial port to the PC
101 print_title();
102 print_prompt();
103
104 ltc2937_config0();
105 }
106
107 /****************************************************************************/
108 //! Main Linduino Loop
109 //! @return void
110 void loop()
111 {
112 uint8_t user_command;
113
114 if (Serial.available()) //! Checks for user input
115 {
116 user_command = read_int(); //! Reads the user command
117
118 switch (user_command)
119 {
120
121 case 1 :
122 Serial.print(F("1\n"));
123 Serial.print(F("\n****INITIALIZING THE LTC2937****\n"));
124 ltc2937_write_enable();
125 ltc2937_restore();
126 break;
127
128 case 2:
129 Serial.print(F("2\n"));
130 Serial.print(F("\n****SEQUENCE-UP THE LTC2937****\n"));
131 // ltc2937_write_enable();
132 ltc2937_sequence_up();
133 break;
134
135 case 3:
136 Serial.print(F("3\n"));
137 Serial.print(F("\n****SEQUENCE-DOWN THE LTC2937****\n"));
138 // ltc2937_write_enable();
139 ltc2937_sequence_down();
140 break;
141
142 case 4:
143 Serial.print(F("4\n"));
144 Serial.print(F("\n****READ LTC2937 STATUS****\n"));
145 ltc2937_read_all_status();
146 break;
147
148 case 5:
149 Serial.print(F("5\n"));
150 Serial.print(F("\n****SET LTC2937 BREAKPOINT AT STEP 1****\n"));
151 ltc2937_write_enable();
152 ltc2937_set_breakpoint(0x0001);
153 ltc2937_print_seq_pos_count();
154 break;
155
156 case 6:
157 Serial.print(F("6\n"));
158 Serial.print(F("\n****INCREMENT LTC2937 BREAKPOINT****\n"));
159 ltc2937_write_enable();
160 ltc2937_inc_breakpoint();
161 ltc2937_print_seq_pos_count();
162 break;
163
164 case 7:
165 Serial.print(F("7\n"));
166 Serial.print(F("\n****CLEAR LTC2937 BREAKPOINT****\n"));
167 ltc2937_write_enable();
168 ltc2937_clear_breakpoint();
169 break;
170
171 case 8:
172 Serial.print(F("8\n"));
173 Serial.print(F("\n****CONFIGURE SPECIAL LTC2937 SEQUENCING VALUES****\n"));
174 ltc2937_write_seq_regs();
175 break;
176
177 case 9:
178 Serial.print(F("9\n"));
179 Serial.print(F("\n****STORE LTC2937 CONFIGURATION TO EEPROM****\n"));
180 ltc2937_write_enable();
181 ltc2937_store();
182 break;
183
184 case 10:
185 Serial.print(F("10\n"));
186 Serial.print(F("\n****WRITE DEMO BOARD DEFAULTS TO LTC2937 RAM****\n"));
187 ltc2937_write_enable();
188 ltc2937_write_all_regs_dc_default();
189 break;
190
191 case 11:
192 Serial.print(F("11\n"));
193 Serial.print(F("\n****READ LTC2937 FAULTS****\n"));
194 ltc2937_pretty_print_monitor_status();
195 Serial.print(F("\n*******************************\n"));
196 ltc2937_pretty_print_monitor_status_history();
197 Serial.print(F("\n*******************************\n"));
198 ltc2937_pretty_print_status_information();
199 Serial.print(F("\n*******************************\n"));
200 break;
201 case 12:
202 Serial.print(F("12\n"));
203 Serial.print(F("\n****CLEAR LTC2937 FAULT BACKUP WORD****\n"));
204 // ltc2937_write_enable();
205 ltc2937_clear_fault_backup();
206 break;
207
208 case 13:
209 Serial.print(F("13\n"));
210 Serial.print(F("\n****CLEAR LTC2937 ALERT****\n"));
211 // ltc2937_write_enable();
212 ltc2937_clear_alertb();
213 break;
214
215 case 14:
216 Serial.print(F("14\n"));
217 Serial.print(F("\n****WRITE-ENABLE THE LTC2937****\n"));
218 ltc2937_write_enable();
219 break;
220
221 default:
222 Serial.print(F("15\n"));
223 Serial.println(F("Incorrect Option"));
224 break;
225 }
226 print_prompt();
227 }
228 }
229
230
231 /************************************************************************/
232 // Function Definitions
233
234 //! Prints the title block when program first starts.
235 //! @return void
236 void print_title()
237 {
238 Serial.print(F("\n***************************************************************\n"));
239 Serial.print(F("* DC2313A Control Program *\n"));
240 Serial.print(F("* *\n"));
241 Serial.print(F("* This program provides a simple interface to control the *\n"));
242 Serial.print(F("* the LTC2937 on the DC2313A Demo Board *\n"));
243 Serial.print(F("* *\n"));
244 Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
245 Serial.print(F("* *\n"));
246 Serial.print(F("*****************************************************************\n"));
247 }
248
249 //! Prints main menu.
250 //! @return void
251 void print_prompt()
252 {
253 Serial.print(F("\n"));
254 Serial.print(F(" 1 - Restore the LTC2937 to EEPROM values\n"));
255 Serial.print(F(" 2 - Sequence-up supplies\n"));
256 Serial.print(F(" 3 - Sequence-down supplies\n"));
257 Serial.print(F(" 4 - Read all status registers\n"));
258 Serial.print(F(" 5 - Set breakpoint at step 1\n"));
259 Serial.print(F(" 6 - Increment breakpoint\n"));
260 Serial.print(F(" 7 - Clear breakpoint\n"));
261 Serial.print(F(" 8 - Specify a new sequence order\n"));
262 Serial.print(F(" 9 - Write configuration to EEPROM\n"));
263 Serial.print(F(" 10 - Write demo board defaults to RAM\n"));
264 Serial.print(F(" 11 - Read fault information registers\n"));
265 Serial.print(F(" 12 - Clear faults (including backup)\n"));
266 Serial.print(F(" 13 - Clear alert\n"));
267 Serial.print(F(" 14 - Release software write-protect bit\n"));
268 Serial.print(F("\n Enter a command number: "));
269 }
270
271 //! make sure that the LTC2937 is configured for I2C bus control
272 //! @return int for success
273 int ltc2937_config0()
274 {
275 uint16_t return_val, on_off_bits;
276 // ltc2937_write_enable();
277 // ensure that the ON/OFF control is I2C, and ignores the ON pin
278 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL);
279 if (ltc2937_is_down() == SUCCEED)
280 {
281 on_off_bits = ((return_val & 0x00E3) + 0x0008); // mask the bits: b[15:8] and b[4:2]
282 return_val = return_val | on_off_bits; // set the ON/OFF control to I2C only
283 smbus->writeWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL, return_val);
284 }
285 else
286 {
287 return NOT_DOWN;
288 }
289 }
290
291 //! restore the LTC2937 settings from EEPROM values
292 //! @return int for success
293 int ltc2937_restore()
294 {
295 uint16_t return_val;
296
297 if (ltc2937_is_down() == SUCCEED)
298 {
299 // send the RESTORE command
300 smbus->sendByte(ltc2937_i2c_address, LTC2937_RESTORE);
301 // return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_RESTORE);
302 Serial.print (F("\nRESTORED LTC2937 CONFIGURATION FROM EEPROM.\n"));
303 delay(LTC2937_RESTORE_DELAY);
304 return SUCCEED;
305 }
306 else
307 {
308 Serial.print(F("\n IT IS A BAD IDEA TO RESTORE WHILE THE SUPPLIES ARE SEQUENCED-UP!\n"));
309 Serial.print(F(" --SEQUENCE-DOWN FIRST. \n"));
310 return NOT_DOWN;
311 }
312 }
313
314 //! store the LTC2937 settings into EEPROM
315 //! @return int for success
316 int ltc2937_store()
317 {
318 uint16_t return_val;
319
320 if (ltc2937_is_down() == SUCCEED)
321 {
322 smbus->sendByte(ltc2937_i2c_address, LTC2937_STORE);
323 // smbus->writeWord(ltc2937_i2c_address, LTC2937_STORE, 0xFFFF);
324 // return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_STORE);
325 Serial.print (F("STORED LTC2937 CONFIGURATION TO EEPROM.\n"));
326 delay(LTC2937_STORE_DELAY);
327 return SUCCEED;
328 }
329 else
330 {
331 Serial.print(F("\n IT IS A BAD IDEA TO STORE WHILE THE SUPPLIES ARE SEQUENCED-UP!\n"));
332 Serial.print(F(" --SEQUENCE-DOWN FIRST. \n"));
333 return NOT_DOWN;
334 }
335 }
336
337 //! sequence-up the LTC2937
338 //! @return int for success
339 int ltc2937_sequence_up()
340 {
341 uint16_t return_val;
342
343 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
344 {
345 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL);
346 return_val = (return_val & 0xFFEB); // mask the bits of interest
347 return_val = (return_val | 0x0018); // set the ON/OFF control to ON
348 smbus->writeWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL, return_val);
349 return SUCCEED;
350 }
351 else
352 {
353 Serial.print (F("FAIL: WRITE_PROTECTED.\n"));
354 return WRITE_PROTECTED;
355 }
356 }
357
358 //! sequence-down the LTC2937
359 //! @return int for success
360 int ltc2937_sequence_down()
361 {
362 uint16_t return_val;
363
364 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
365 {
366 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL);
367 return_val = (return_val & 0xFFEF); // mask the bits
368 smbus->writeWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL, return_val);
369 return SUCCEED;
370 }
371 else
372 {
373 Serial.print (F("FAIL: WRITE_PROTECTED.\n"));
374 return WRITE_PROTECTED;
375 }
376 }
377
378 //! indicate if the LTC2937 is in the sequenced-down state
379 //! @return int for part staus
380 int ltc2937_is_down()
381 {
382 uint16_t return_val,
383 on_off,
384 status;
385
386 // This function indicates when it is safe to issue a CLEAR command
387
388 // must meet the following conditions:
389 // ON_OFF_CONTROL[7] == 1'b0 (commanded down)
390 // STATUS_INFORMATION[11:10] == 2'b00 (local seq down complete)
391 // STATUS_INFORMATION[9:8] == 2'b00 (global seq down complete)
392 // STATUS_INFORMATION[2] == 1'b1 (supplies discharged)
393
394 // may also want:
395 // BREAK_POINT[10] == 1'b0 (not in BP mode)
396
397 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_STATUS_INFORMATION);
398 status = (return_val & 0x0F04); // mask the bits
399 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL);
400 on_off = (return_val & 0x0080); // mask the bits
401 if ((status == 0x0004) && (on_off == 0x0000))
402 {
403 return SUCCEED;
404 }
405 else
406 {
407 Serial.print(F("\n LTC2937 IS NOT DOWN \n"));
408 return NOT_DOWN;
409 }
410 }
411
412 //! read all status registers
413 //! @return int for success
414 int ltc2937_read_all_status()
415 {
416 uint16_t return_val;
417
418 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_WRITE_PROTECTION);
419 Serial.print(F("\n LTC2937_WRITE_PROTECTION: "));
420 Serial.println(return_val, HEX);
421
422 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SPECIAL_LOT);
423 Serial.print(F("\n LTC2937_SPECIAL_LOT: "));
424 Serial.println(return_val, HEX);
425
426 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL);
427 Serial.print(F("\n LTC2937_ON_OFF_CONTROL: "));
428 Serial.println(return_val, HEX);
429
430 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_STATUS_HISTORY);
431 Serial.print(F("\n LTC2937_MONITOR_STATUS_HISTORY: "));
432 Serial.println(return_val, HEX);
433
434 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_STATUS_INFORMATION);
435 Serial.print(F("\n LTC2937_STATUS_INFORMATION: "));
436 Serial.println(return_val, HEX);
437
438 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_BREAK_POINT);
439 Serial.print(F("\n LTC2937_BREAK_POINT: "));
440 Serial.println(return_val, HEX);
441
442 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_FAULT_RESPONSE);
443 Serial.print(F("\n LTC2937_FAULT_RESPONSE: "));
444 Serial.println(return_val, HEX);
445
446 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_POSITION_COUNT);
447 Serial.print(F("\n LTC2937_SEQ_POSITION_COUNT: "));
448 Serial.println(return_val, HEX);
449
450 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_BACKUP);
451 Serial.print(F("\n LTC2937_MONITOR_BACKUP: "));
452 Serial.println(return_val, HEX);
453
454 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_STATUS);
455 Serial.print(F("\n LTC2937_MONITOR_STATUS: "));
456 Serial.println(return_val, HEX);
457
458 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_DEVICE_ID);
459 Serial.print(F("\n LTC2937_DEVICE_ID: "));
460 Serial.println(return_val, HEX);
461 return SUCCEED;
462 }
463
464
465
466 //! read all registers
467 //! return int for success
468 int ltc2937_read_all_registers()
469 {
470 uint16_t return_val;
471
472 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_WRITE_PROTECTION);
473 Serial.print(F("\n LTC2937_WRITE_PROTECTION: "));
474 Serial.println(return_val, HEX);
475
476 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SPECIAL_LOT);
477 Serial.print(F("\n LTC2937_SPECIAL_LOT: "));
478 Serial.println(return_val, HEX);
479
480 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL);
481 Serial.print(F("\n LTC2937_ON_OFF_CONTROL: "));
482 Serial.println(return_val, HEX);
483
484 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_RANGE);
485 Serial.print(F("\n LTC2937_V_RANGE: "));
486 Serial.println(return_val, HEX);
487
488 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_1);
489 Serial.print(F("\n LTC2937_V_THRESHOLD_1: "));
490 Serial.println(return_val, HEX);
491
492 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_2);
493 Serial.print(F("\n LTC2937_V_THRESHOLD_2: "));
494 Serial.println(return_val, HEX);
495
496 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_3);
497 Serial.print(F("\n LTC2937_V_THRESHOLD_3: "));
498 Serial.println(return_val, HEX);
499
500 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_4);
501 Serial.print(F("\n LTC2937_V_THRESHOLD_4: "));
502 Serial.println(return_val, HEX);
503
504 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_5);
505 Serial.print(F("\n LTC2937_V_THRESHOLD_5: "));
506 Serial.println(return_val, HEX);
507
508 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_6);
509 Serial.print(F("\n LTC2937_V_THRESHOLD_6: "));
510 Serial.println(return_val, HEX);
511
512 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_1);
513 Serial.print(F("\n LTC2937_TON_TIMERS_1: "));
514 Serial.println(return_val, HEX);
515
516 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_2);
517 Serial.print(F("\n LTC2937_TON_TIMERS_2: "));
518 Serial.println(return_val, HEX);
519
520 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_3);
521 Serial.print(F("\n LTC2937_TON_TIMERS_3: "));
522 Serial.println(return_val, HEX);
523
524 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_4);
525 Serial.print(F("\n LTC2937_TON_TIMERS_4: "));
526 Serial.println(return_val, HEX);
527
528 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_5);
529 Serial.print(F("\n LTC2937_TON_TIMERS_5: "));
530 Serial.println(return_val, HEX);
531
532 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_6);
533 Serial.print(F("\n LTC2937_TON_TIMERS_6: "));
534 Serial.println(return_val, HEX);
535
536 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_1);
537 Serial.print(F("\n LTC2937_TOFF_TIMERS_1: "));
538 Serial.println(return_val, HEX);
539
540 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_2);
541 Serial.print(F("\n LTC2937_TOFF_TIMERS_2: "));
542 Serial.println(return_val, HEX);
543
544 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_3);
545 Serial.print(F("\n LTC2937_TOFF_TIMERS_3: "));
546 Serial.println(return_val, HEX);
547
548 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_4);
549 Serial.print(F("\n LTC2937_TOFF_TIMERS_4: "));
550 Serial.println(return_val, HEX);
551
552 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_5);
553 Serial.print(F("\n LTC2937_TOFF_TIMERS_5: "));
554 Serial.println(return_val, HEX);
555
556 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_6);
557 Serial.print(F("\n LTC2937_TOFF_TIMERS_6: "));
558 Serial.println(return_val, HEX);
559
560 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_1);
561 Serial.print(F("\n LTC2937_SEQ_UP_POSITION_1: "));
562 Serial.println(return_val, HEX);
563
564 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_2);
565 Serial.print(F("\n LTC2937_SEQ_UP_POSITION_2: "));
566 Serial.println(return_val, HEX);
567
568 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_3);
569 Serial.print(F("\n LTC2937_SEQ_UP_POSITION_3: "));
570 Serial.println(return_val, HEX);
571
572 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_4);
573 Serial.print(F("\n LTC2937_SEQ_UP_POSITION_4: "));
574 Serial.println(return_val, HEX);
575
576 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_5);
577 Serial.print(F("\n LTC2937_SEQ_UP_POSITION_5: "));
578 Serial.println(return_val, HEX);
579
580 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_6);
581 Serial.print(F("\n LTC2937_SEQ_UP_POSITION_6: "));
582 Serial.println(return_val, HEX);
583
584 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_1);
585 Serial.print(F("\n LTC2937_SEQ_DOWN_POSITION_1: "));
586 Serial.println(return_val, HEX);
587
588 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_2);
589 Serial.print(F("\n LTC2937_SEQ_DOWN_POSITION_2: "));
590 Serial.println(return_val, HEX);
591
592 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_3);
593 Serial.print(F("\n LTC2937_SEQ_DOWN_POSITION_3: "));
594 Serial.println(return_val, HEX);
595
596 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_4);
597 Serial.print(F("\n LTC2937_SEQ_DOWN_POSITION_4: "));
598 Serial.println(return_val, HEX);
599
600 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_5);
601 Serial.print(F("\n LTC2937_SEQ_DOWN_POSITION_5: "));
602 Serial.println(return_val, HEX);
603
604 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_6);
605 Serial.print(F("\n LTC2937_SEQ_DOWN_POSITION_6: "));
606 Serial.println(return_val, HEX);
607
608 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_RSTB_CONFIG);
609 Serial.print(F("\n LTC2937_RSTB_CONFIG: "));
610 Serial.println(return_val, HEX);
611
612 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_FAULT_RESPONSE);
613 Serial.print(F("\n LTC2937_FAULT_RESPONSE: "));
614 Serial.println(return_val, HEX);
615
616 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_STATUS_HISTORY);
617 Serial.print(F("\n LTC2937_MONITOR_STATUS_HISTORY: "));
618 Serial.println(return_val, HEX);
619
620 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_STATUS_INFORMATION);
621 Serial.print(F("\n LTC2937_STATUS_INFORMATION: "));
622 Serial.println(return_val, HEX);
623
624 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_BREAK_POINT);
625 Serial.print(F("\n LTC2937_BREAK_POINT: "));
626 Serial.println(return_val, HEX);
627
628 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_POSITION_COUNT);
629 Serial.print(F("\n LTC2937_SEQ_POSITION_COUNT: "));
630 Serial.println(return_val, HEX);
631
632 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_BACKUP);
633 Serial.print(F("\n LTC2937_MONITOR_BACKUP: "));
634 Serial.println(return_val, HEX);
635
636 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_STATUS);
637 Serial.print(F("\n LTC2937_MONITOR_STATUS: "));
638 Serial.println(return_val, HEX);
639
640 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_DEVICE_ID);
641 Serial.print(F("\n LTC2937_DEVICE_ID: "));
642 Serial.println(return_val, HEX);
643 return SUCCEED;
644 }
645
646 //! write all registers to demo board defaults
647 //! @return int for failure mode
648 int ltc2937_write_all_regs_dc_default()
649 {
650 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
651 {
652 if (ltc2937_is_down() == SUCCEED)
653 {
654 smbus->writeWord(ltc2937_i2c_address, LTC2937_WRITE_PROTECTION, 0x3AA);
655 smbus->writeWord(ltc2937_i2c_address, LTC2937_SPECIAL_LOT, 0x2313);
656 smbus->writeWord(ltc2937_i2c_address, LTC2937_ON_OFF_CONTROL, 0x0005);
657 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_RANGE, 0x0554);
658 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_1, 0x8970);
659 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_2, 0xE6C1);
660 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_3, 0xaF91);
661 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_4, 0x997E);
662 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_5, 0x7662);
663 smbus->writeWord(ltc2937_i2c_address, LTC2937_V_THRESHOLD_6, 0x5745);
664 smbus->writeWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_1, 0xF000);
665 smbus->writeWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_2, 0xF000);
666 smbus->writeWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_3, 0xF000);
667 smbus->writeWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_4, 0xF000);
668 smbus->writeWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_5, 0xF000);
669 smbus->writeWord(ltc2937_i2c_address, LTC2937_TON_TIMERS_6, 0xF000);
670 smbus->writeWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_1, 0x8000);
671 smbus->writeWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_2, 0x8000);
672 smbus->writeWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_3, 0x8000);
673 smbus->writeWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_4, 0x8000);
674 smbus->writeWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_5, 0x8000);
675 smbus->writeWord(ltc2937_i2c_address, LTC2937_TOFF_TIMERS_6, 0x8000);
676 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_1, 0x0001);
677 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_2, 0x0002);
678 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_3, 0x0003);
679 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_4, 0x0004);
680 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_5, 0x0005);
681 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_UP_POSITION_6, 0x0006);
682 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_1, 0x0006);
683 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_2, 0x0005);
684 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_3, 0x0004);
685 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_4, 0x0003);
686 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_5, 0x0002);
687 smbus->writeWord(ltc2937_i2c_address, LTC2937_SEQ_DOWN_POSITION_6, 0x0001);
688 smbus->writeWord(ltc2937_i2c_address, LTC2937_RSTB_CONFIG, 0xBFFF);
689 smbus->writeWord(ltc2937_i2c_address, LTC2937_FAULT_RESPONSE, 0x022F);
690 smbus->writeWord(ltc2937_i2c_address, LTC2937_BREAK_POINT, 0x0000);
691 smbus->writeWord(ltc2937_i2c_address, LTC2937_DEVICE_ID, 0x2937);
692
693 return SUCCEED;
694 }
695 else
696 {
697 return NOT_DOWN;
698 }
699 }
700 else
701 {
702 Serial.print (F("FAIL: WRITE_PROTECTED.\n"));
703 return WRITE_PROTECTED;
704 }
705 }
706
707
708 //! write sequencing registers to a user-specified pattern
709 //! @return int for failure mode
710 int ltc2937_write_seq_regs()
711 {
712 int i;
713 uint16_t return_val;
714 uint16_t user_command;
715 uint8_t dummy_reg_address;
716
717
718 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
719 {
720 if (ltc2937_is_down() == SUCCEED)
721 {
722
723 Serial.print(F("\nCHANGING SEQUENCE-UP ORDER\n"));
724 dummy_reg_address = LTC2937_SEQ_UP_POSITION_1;
725 for (i = 1; i <= 6; i++)
726 {
727 Serial.print(F("\nENTER SEQUENCE-UP POSITION FOR CHANNEL "));
728 Serial.println(i, DEC);
729
730 user_command = read_int();
731 if (user_command > 1023)
732 {
733 user_command = 1023;
734 }
735 return_val = 0x0000 + user_command;
736 smbus->writeWord(ltc2937_i2c_address, dummy_reg_address, return_val);
737 dummy_reg_address++;
738 }
739
740 Serial.print(F("\nCHANGING SEQUENCE-DOWN ORDER\n"));
741 dummy_reg_address = LTC2937_SEQ_DOWN_POSITION_1;
742 for (i = 1; i <= 6; i++)
743 {
744 Serial.print(F("\nENTER SEQUENCE-DOWN POSITION FOR CHANNEL "));
745 Serial.println(i, DEC);
746
747 user_command = read_int();
748 if (user_command > 1023)
749 {
750 user_command = 1023;
751 }
752 return_val = 0x0000 + user_command;
753 smbus->writeWord(ltc2937_i2c_address, dummy_reg_address, return_val);
754 dummy_reg_address++;
755 }
756 return SUCCEED;
757 }
758 else
759 {
760 return NOT_DOWN;
761 }
762 }
763 else
764 {
765 Serial.print (F("FAIL: WRITE_PROTECTED.\n"));
766 return WRITE_PROTECTED;
767 }
768 }
769
770
771 //! Indicate if the part is write protected
772 //! return 0 if the part is write enabled (hardware and software), 1 if it is protected
773 int ltc2937_is_write_protected()
774 {
775 uint16_t return_val;
776 uint16_t wp_bits;
777
778 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_WRITE_PROTECTION);
779 wp_bits = (return_val & 0x0003);
780
781 if (wp_bits == 0x0000)
782 {
783 // neither hardware nor software lock bits set
784 return SUCCEED;
785 }
786 else
787 {
788 Serial.print(F("\n LTC2937 IS WRITE-PROTECTED. WRITING WILL FAIL\n"));
789 return WRITE_PROTECTED;
790 }
791
792 }
793
794 //! remove software write-protection
795 //! report if the part is hardware write-protected
796 //! @return int for failure mode
797 int ltc2937_write_enable()
798 {
799 uint16_t return_val, write_val;
800 uint16_t hardware_wp_bit;
801 uint16_t software_wp_bit;
802
803 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_WRITE_PROTECTION);
804 hardware_wp_bit = (return_val & 0x0002);
805 software_wp_bit = (return_val & 0x0001);
806 if (hardware_wp_bit == 0x0000)
807 {
808 // hardware is not write-protected, write the software unlock bit
809 Serial.print(F("\n UNLOCKING LTC2937 SOFTWARE WRITE-PROTECT BIT."));
810 // Serial.println(return_val, HEX);
811 write_val = (return_val & 0xFFFE);
812 smbus->writeWord(ltc2937_i2c_address, LTC2937_WRITE_PROTECTION, write_val);
813 }
814 else
815 {
816 Serial.print(F("\n LTC2937 IS HARDWARE WRITE-PROTECTED. WRITING WILL FAIL\n"));
817 return WRITE_PROTECTED;
818 }
819 }
820
821 //! set the breakpoint to the given value
822 //! @return int for failure mode
823 int ltc2937_set_breakpoint(uint16_t set_val)
824 {
825 uint16_t return_val;
826 // uint16_t bp_en_val;
827 // read the existing breakpoint
828 // return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_BREAK_POINT);
829 // bp_en_val = (return_val & 0x0400); // mask the bits of interest: b[10]
830 // return_val = (return_val & 0x03FF); // mask the bits of interest: b[9:0]
831 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
832 {
833 if ((set_val >=0) && (set_val < 1024))
834 {
835 return_val = 0x0400 + set_val; // set the enable bit and break_point value
836 smbus->writeWord(ltc2937_i2c_address, LTC2937_BREAK_POINT, return_val);
837 }
838 else
839 {
840 Serial.print(F("\n ERROR! BREAKPOINT VALUE OUT OF RANGE.\n"));
841 }
842 return SUCCEED;
843 }
844 else
845 {
846 Serial.print (F("FAIL: WRITE_PROTECTED.\n"));
847 return WRITE_PROTECTED;
848 }
849 }
850
851 //! increment the breakpoint by 1
852 //! @return int for failure mode
853 int ltc2937_inc_breakpoint()
854 {
855 uint16_t return_val;
856 uint16_t bp_en_val;
857 uint16_t bp_ct_val;
858
859 // read the existing breakpoint
860 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
861 {
862 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_BREAK_POINT);
863 bp_en_val = (return_val & 0x0400); // mask the bits of interest: b[10]
864 bp_ct_val = (return_val & 0x03FF); // mask the bits of interest: b[9:0]
865 if (bp_ct_val < 1023)
866 {
867 return_val = (++bp_ct_val);
868 return_val = (return_val | 0x0400); // ensure that the enable bit is set
869 smbus->writeWord(ltc2937_i2c_address, LTC2937_BREAK_POINT, return_val);
870 Serial.print(F("\n INCREMENTING BREAK_POINT TO VALUE : \n"));
871 Serial.println(bp_ct_val);
872 return SUCCEED;
873 }
874 else
875 {
876 Serial.print(F("\n ERROR! BREAKPOINT VALUE OUT OF RANGE.\n"));
877 return FAIL;
878 }
879 }
880 else
881 {
882 Serial.print (F("FAIL: WRITE_PROTECTED.\n"));
883 return WRITE_PROTECTED;
884 }
885 }
886
887
888 //! pretty-print the sequence_position_count register contents
889 //! @return int for success
890 int ltc2937_print_seq_pos_count()
891 {
892 uint16_t return_val;
893 uint16_t sp_bp_test;
894 uint16_t sp_count;
895
896 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_SEQ_POSITION_COUNT);
897 sp_bp_test = (return_val & 0x0400);
898 sp_count = (return_val & 0x3FF);
899
900 Serial.println(return_val, HEX);
901 Serial.print(F("\n SEQUENCE POSITION COUNT = "));
902 Serial.println(sp_count, DEC);
903
904 if (sp_bp_test == 0x0400)
905 {
906 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_BREAK_POINT);
907 if ((return_val & 0x0400) == 0x0400)
908 {
909 Serial.print(F("\n WAITING AT BREAKPOINT.\n"));
910 }
911 }
912 else
913 {
914 Serial.print(F("\n NOT AT BREAKPOINT."));
915 }
916 return SUCCEED;
917 }
918
919
920 //! clear breakpoint register
921 //! @return int indicating failure mode
922 int ltc2937_clear_breakpoint()
923 {
924 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
925 {
926 smbus->writeWord(ltc2937_i2c_address, LTC2937_BREAK_POINT, 0x0000);
927 return SUCCEED;
928 }
929 else
930 {
931 return WRITE_PROTECTED;
932 }
933 }
934
935 //! issue a clear command
936 //! @return int indicating failure mode
937 int ltc2937_clear()
938 {
939 uint16_t return_val;
940 uint8_t user_command;
941
942 if (ltc2937_is_down() == NOT_DOWN)
943 {
944 Serial.print(F("\n IT IS A BAD IDEA TO CLEAR WHILE THE SUPPLIES ARE SEQUENCED-UP!\n"));
945 Serial.print(F(" DO YOU WISH TO CLEAR? (y/n)"));
946 user_command = read_char(); //! Reads the user command
947 if ((user_command == 'y') || (user_command == 'Y'))
948 {
949 smbus->readWord(ltc2937_i2c_address, LTC2937_CLEAR);
950 Serial.print(F("\n ****CLEARING**** \n"));
951 return SUCCEED;
952 }
953 else
954 {
955 Serial.print(F("\n ****NOT CLEARING**** \n"));
956 return NOT_DOWN;
957 }
958 }
959 else
960 {
961 smbus->readWord(ltc2937_i2c_address, LTC2937_CLEAR);
962 Serial.print(F("\n ****CLEARING**** \n"));
963 return SUCCEED;
964 }
965 }
966
967 //! handle the backup word fault log (affects NVM and RAM)
968 //! @return int indicating failure mode
969 int ltc2937_clear_fault_backup()
970 {
971 uint8_t user_command;
972
973 // RECIPE:
974 // check for sequenced-down and writable
975 // warn the user and ask for permission to overwrite config registers
976 // write-enable
977 // restore to retrieve the backup word
978 // pretty-print fault information
979 // clear to clear all faults
980 // store to clear the NVM backup word
981 // restore (again) to clear the RAM backup word flag
982
983 if ( ltc2937_is_write_protected() != WRITE_PROTECTED)
984 {
985 if (ltc2937_is_down() == SUCCEED)
986 {
987 Serial.print(F("\n THIS OPERATION WILL AFFECT BOTH RAM AND EEPROM!\n"));
988 Serial.print(F(" DO YOU WISH TO CLEAR RAM CONFIGURATION SETTINGS? (y/n)"));
989 user_command = read_char(); //! Reads the user command
990 if ((user_command == 'y') || (user_command == 'Y'))
991 {
992 if (ltc2937_restore() == SUCCEED)
993 {
994 ltc2937_pretty_print_monitor_backup();
995 ltc2937_clear();
996 ltc2937_store();
997 delay(100);
998 ltc2937_restore();
999 Serial.print (F("\nTHE BACKUP WORD IS NOW CLEAR.\n"));
1000 }
1001 else
1002 {
1003 // fail due to unsuccessful restore
1004 return FAIL;
1005 }
1006 }
1007 }
1008 else
1009 {
1010 return NOT_DOWN;
1011 }
1012 }
1013 else
1014 {
1015 Serial.print (F("FAIL: CANNOT MANIPULATE FAULT BACKUP WHILE WRITE-PROTECTED.\n"));
1016 return WRITE_PROTECTED;
1017 }
1018
1019
1020 }
1021
1022
1023 //! clear ALERTB pin
1024 //! @return int for success
1025 int ltc2937_clear_alertb()
1026 {
1027 smbus->readWord(ltc2937_i2c_address, LTC2937_CLEAR_ALERTB);
1028 return SUCCEED;
1029 }
1030
1031 //! pretty-print MONITOR_BACKUP
1032 //! @return int for success
1033 int ltc2937_pretty_print_monitor_backup()
1034 {
1035 uint16_t return_val,
1036 masked_val;
1037
1038 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_BACKUP);
1039
1040 Serial.print(F("\n LTC2937 MONITOR_BACKUP CONTENTS: "));
1041 Serial.println(return_val, HEX);
1042
1043 masked_val = (return_val & 0xE000);
1044 switch (masked_val)
1045 {
1046 case 0xE000 :
1047 Serial.print(F("\n**RESERVED SEQUENCE STATE (THIS IS BAD)"));
1048 break;
1049 case 0xC000 :
1050 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 6"));
1051 break;
1052 case 0xA000 :
1053 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 5"));
1054 break;
1055 case 0x8000 :
1056 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 4"));
1057 break;
1058 case 0x6000 :
1059 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 3"));
1060 break;
1061 case 0x4000 :
1062 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 2"));
1063 break;
1064 case 0x2000 :
1065 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 1"));
1066 break;
1067 case 0x0000 :
1068 Serial.print(F("\n NO SEQUENCE FAULTS"));
1069 break;
1070 default :
1071 Serial.print(F("\n**UNDEFINED SEQUENCE FAULT STATE (THIS IS BAD)"));
1072 break;
1073 }
1074 masked_val = (return_val & 0x1000);
1075 if (masked_val != 0x0000)
1076 {
1077 Serial.print(F("\n**RESET FAULT DETECTED"));
1078 }
1079 else
1080 {
1081 Serial.print(F("\n NO RESET FAULT"));
1082 }
1083 masked_val = (return_val & 0x0800);
1084 if (masked_val != 0x0000)
1085 {
1086 Serial.print(F("\n**V6 OV RESET FAULT DETECTED"));
1087 }
1088 else
1089 {
1090 Serial.print(F("\n NO V6 OV FAULT"));
1091 }
1092 masked_val = (return_val & 0x0400);
1093 if (masked_val != 0x0000)
1094 {
1095 Serial.print(F("\n**V6 UV RESET FAULT DETECTED"));
1096 }
1097 else
1098 {
1099 Serial.print(F("\n NO V6 UV FAULT"));
1100 }
1101 masked_val = (return_val & 0x0200);
1102 if (masked_val != 0x0000)
1103 {
1104 Serial.print(F("\n**V5 OV RESET FAULT DETECTED"));
1105 }
1106 else
1107 {
1108 Serial.print(F("\n NO V5 OV FAULT"));
1109 }
1110 masked_val = (return_val & 0x0100);
1111 if (masked_val != 0x0000)
1112 {
1113 Serial.print(F("\n**V5 UV RESET FAULT DETECTED"));
1114 }
1115 else
1116 {
1117 Serial.print(F("\n NO V5 UV FAULT"));
1118 }
1119 masked_val = (return_val & 0x0080);
1120 if (masked_val != 0x0000)
1121 {
1122 Serial.print(F("\n**V4 OV RESET FAULT DETECTED"));
1123 }
1124 else
1125 {
1126 Serial.print(F("\n NO V4 OV FAULT"));
1127 }
1128 masked_val = (return_val & 0x0040);
1129 if (masked_val != 0x0000)
1130 {
1131 Serial.print(F("\n**V4 UV RESET FAULT DETECTED"));
1132 }
1133 else
1134 {
1135 Serial.print(F("\n NO V4 UV FAULT"));
1136 }
1137 masked_val = (return_val & 0x0020);
1138 if (masked_val != 0x0000)
1139 {
1140 Serial.print(F("\n**V3 OV RESET FAULT DETECTED"));
1141 }
1142 else
1143 {
1144 Serial.print(F("\n NO V3 OV FAULT"));
1145 }
1146 masked_val = (return_val & 0x0010);
1147 if (masked_val != 0x0000)
1148 {
1149 Serial.print(F("\n**V3 UV RESET FAULT DETECTED"));
1150 }
1151 else
1152 {
1153 Serial.print(F("\n NO V3 UV FAULT"));
1154 }
1155 masked_val = (return_val & 0x0008);
1156 if (masked_val != 0x0000)
1157 {
1158 Serial.print(F("\n**V2 OV RESET FAULT DETECTED"));
1159 }
1160 else
1161 {
1162 Serial.print(F("\n NO V2 OV FAULT"));
1163 }
1164 masked_val = (return_val & 0x0004);
1165 if (masked_val != 0x0000)
1166 {
1167 Serial.print(F("\n**V2 UV RESET FAULT DETECTED"));
1168 }
1169 else
1170 {
1171 Serial.print(F("\n NO V2 UV FAULT"));
1172 }
1173 masked_val = (return_val & 0x0002);
1174 if (masked_val != 0x0000)
1175 {
1176 Serial.print(F("\n**V1 OV RESET FAULT DETECTED"));
1177 }
1178 else
1179 {
1180 Serial.print(F("\n NO V1 OV FAULT"));
1181 }
1182 masked_val = (return_val & 0x0001);
1183 if (masked_val != 0x0000)
1184 {
1185 Serial.print(F("\n**V1 UV RESET FAULT DETECTED"));
1186 }
1187 else
1188 {
1189 Serial.print(F("\n NO V1 UV FAULT"));
1190 }
1191 return SUCCEED;
1192 }
1193
1194 //! pretty-print MONITOR_STATUS_HISTORY
1195 //! @return int for success
1196 int ltc2937_pretty_print_monitor_status_history()
1197 {
1198 uint16_t return_val,
1199 masked_val;
1200
1201 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_STATUS_HISTORY);
1202
1203 Serial.print(F("\n LTC2937 MONITOR_STATUS_HISTORY CONTENTS: "));
1204 Serial.println(return_val, HEX);
1205
1206 masked_val = (return_val & 0xE000);
1207 switch (masked_val)
1208 {
1209 case 0xE000 :
1210 Serial.print(F("\n RESERVED SEQUENCE STATE (THIS IS BAD)"));
1211 break;
1212 case 0xC000 :
1213 Serial.print(F("\n SEQUENCE FAULT ON CHANNEL 6"));
1214 break;
1215 case 0xA000 :
1216 Serial.print(F("\n SEQUENCE FAULT ON CHANNEL 5"));
1217 break;
1218 case 0x8000 :
1219 Serial.print(F("\n SEQUENCE FAULT ON CHANNEL 4"));
1220 break;
1221 case 0x6000 :
1222 Serial.print(F("\n SEQUENCE FAULT ON CHANNEL 3"));
1223 break;
1224 case 0x4000 :
1225 Serial.print(F("\n SEQUENCE FAULT ON CHANNEL 2"));
1226 break;
1227 case 0x2000 :
1228 Serial.print(F("\n SEQUENCE FAULT ON CHANNEL 1"));
1229 break;
1230 case 0x0000 :
1231 Serial.print(F("\n NO SEQUENCE FAULTS"));
1232 break;
1233 default :
1234 Serial.print(F("\n UNDEFINED SEQUENCE FAULT STATE (THIS IS BAD)"));
1235 break;
1236 }
1237 masked_val = (return_val & 0x1000);
1238 if (masked_val != 0x0000)
1239 {
1240 Serial.print(F("\n RESET FAULT DETECTED"));
1241 }
1242 else
1243 {
1244 Serial.print(F("\n NO RESET FAULT"));
1245 }
1246 masked_val = (return_val & 0x0800);
1247 if (masked_val != 0x0000)
1248 {
1249 Serial.print(F("\n V6 OV RESET FAULT DETECTED"));
1250 }
1251 else
1252 {
1253 Serial.print(F("\n NO V6 OV FAULT"));
1254 }
1255 masked_val = (return_val & 0x0400);
1256 if (masked_val != 0x0000)
1257 {
1258 Serial.print(F("\n V6 UV RESET FAULT DETECTED"));
1259 }
1260 else
1261 {
1262 Serial.print(F("\n NO V6 UV FAULT"));
1263 }
1264 masked_val = (return_val & 0x0200);
1265 if (masked_val != 0x0000)
1266 {
1267 Serial.print(F("\n V5 OV RESET FAULT DETECTED"));
1268 }
1269 else
1270 {
1271 Serial.print(F("\n NO V5 OV FAULT"));
1272 }
1273 masked_val = (return_val & 0x0100);
1274 if (masked_val != 0x0000)
1275 {
1276 Serial.print(F("\n V5 UV RESET FAULT DETECTED"));
1277 }
1278 else
1279 {
1280 Serial.print(F("\n NO V5 UV FAULT"));
1281 }
1282 masked_val = (return_val & 0x0080);
1283 if (masked_val != 0x0000)
1284 {
1285 Serial.print(F("\n V4 OV RESET FAULT DETECTED"));
1286 }
1287 else
1288 {
1289 Serial.print(F("\n NO V4 OV FAULT"));
1290 }
1291 masked_val = (return_val & 0x0040);
1292 if (masked_val != 0x0000)
1293 {
1294 Serial.print(F("\n V4 UV RESET FAULT DETECTED"));
1295 }
1296 else
1297 {
1298 Serial.print(F("\n NO V4 UV FAULT"));
1299 }
1300 masked_val = (return_val & 0x0020);
1301 if (masked_val != 0x0000)
1302 {
1303 Serial.print(F("\n V3 OV RESET FAULT DETECTED"));
1304 }
1305 else
1306 {
1307 Serial.print(F("\n NO V3 OV FAULT"));
1308 }
1309 masked_val = (return_val & 0x0010);
1310 if (masked_val != 0x0000)
1311 {
1312 Serial.print(F("\n V3 UV RESET FAULT DETECTED"));
1313 }
1314 else
1315 {
1316 Serial.print(F("\n NO V3 UV FAULT"));
1317 }
1318 masked_val = (return_val & 0x0008);
1319 if (masked_val != 0x0000)
1320 {
1321 Serial.print(F("\n V2 OV RESET FAULT DETECTED"));
1322 }
1323 else
1324 {
1325 Serial.print(F("\n NO V2 OV FAULT"));
1326 }
1327 masked_val = (return_val & 0x0004);
1328 if (masked_val != 0x0000)
1329 {
1330 Serial.print(F("\n V2 UV RESET FAULT DETECTED"));
1331 }
1332 else
1333 {
1334 Serial.print(F("\n NO V2 UV FAULT"));
1335 }
1336 masked_val = (return_val & 0x0002);
1337 if (masked_val != 0x0000)
1338 {
1339 Serial.print(F("\n V1 OV RESET FAULT DETECTED"));
1340 }
1341 else
1342 {
1343 Serial.print(F("\n NO V1 OV FAULT"));
1344 }
1345 masked_val = (return_val & 0x0001);
1346 if (masked_val != 0x0000)
1347 {
1348 Serial.print(F("\n V1 UV RESET FAULT DETECTED"));
1349 }
1350 else
1351 {
1352 Serial.print(F("\n NO V1 UV FAULT"));
1353 }
1354 return SUCCEED;
1355 }
1356
1357 //! pretty-print MONITOR_STATUS
1358 //! @return int for success
1359 int ltc2937_pretty_print_monitor_status()
1360 {
1361 uint16_t return_val,
1362 masked_val;
1363
1364 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_MONITOR_STATUS);
1365
1366 Serial.print(F("\n LTC2937 MONITOR_STATUS CONTENTS: "));
1367 Serial.println(return_val, HEX);
1368
1369 masked_val = (return_val & 0x2000);
1370 if (masked_val != 0x0000)
1371 {
1372 Serial.print(F("\n MARGIN IS ACTIVE"));
1373 }
1374 else
1375 {
1376 Serial.print(F("\n MARGIN IS NOT ACTIVE"));
1377 }
1378 masked_val = (return_val & 0x1000);
1379 if (masked_val != 0x0000)
1380 {
1381 Serial.print(F("\n RSTB PIN IS LOW"));
1382 }
1383 else
1384 {
1385 Serial.print(F("\n RSTB PIN IS HIGH"));
1386 }
1387 masked_val = (return_val & 0x0800);
1388 if (masked_val != 0x0000)
1389 {
1390 Serial.print(F("\n**V6 OV COMPARATOR ASSERTED"));
1391 }
1392 else
1393 {
1394 Serial.print(F("\n V6 OV COMPARATOR NOT ASSERTED"));
1395 }
1396 masked_val = (return_val & 0x0400);
1397 if (masked_val != 0x0000)
1398 {
1399 Serial.print(F("\n**V6 UV COMPARATOR ASSERTED"));
1400 }
1401 else
1402 {
1403 Serial.print(F("\n V6 UV COMPARATOR NOT ASSERTED"));
1404 }
1405 masked_val = (return_val & 0x0200);
1406 if (masked_val != 0x0000)
1407 {
1408 Serial.print(F("\n**V5 OV COMPARATOR ASSERTED"));
1409 }
1410 else
1411 {
1412 Serial.print(F("\n V5 OV COMPARATOR NOT ASSERTED"));
1413 }
1414 masked_val = (return_val & 0x0100);
1415 if (masked_val != 0x0000)
1416 {
1417 Serial.print(F("\n**V5 UV COMPARATOR ASSERTED"));
1418 }
1419 else
1420 {
1421 Serial.print(F("\n V5 UV COMPARATOR NOT ASSERTED"));
1422 }
1423 masked_val = (return_val & 0x0080);
1424 if (masked_val != 0x0000)
1425 {
1426 Serial.print(F("\n**V4 OV COMPARATOR ASSERTED"));
1427 }
1428 else
1429 {
1430 Serial.print(F("\n V4 OV COMPARATOR NOT ASSERTED"));
1431 }
1432 masked_val = (return_val & 0x0040);
1433 if (masked_val != 0x0000)
1434 {
1435 Serial.print(F("\n**V4 UV COMPARATOR ASSERTED"));
1436 }
1437 else
1438 {
1439 Serial.print(F("\n V4 UV COMPARATOR NOT ASSERTED"));
1440 }
1441 masked_val = (return_val & 0x0020);
1442 if (masked_val != 0x0000)
1443 {
1444 Serial.print(F("\n**V3 OV COMPARATOR ASSERTED"));
1445 }
1446 else
1447 {
1448 Serial.print(F("\n V3 OV COMPARATOR NOT ASSERTED"));
1449 }
1450 masked_val = (return_val & 0x0010);
1451 if (masked_val != 0x0000)
1452 {
1453 Serial.print(F("\n**V3 UV COMPARATOR ASSERTED"));
1454 }
1455 else
1456 {
1457 Serial.print(F("\n V3 UV COMPARATOR NOT ASSERTED"));
1458 }
1459 masked_val = (return_val & 0x0008);
1460 if (masked_val != 0x0000)
1461 {
1462 Serial.print(F("\n**V2 OV COMPARATOR ASSERTED"));
1463 }
1464 else
1465 {
1466 Serial.print(F("\n V2 OV COMPARATOR NOT ASSERTED"));
1467 }
1468 masked_val = (return_val & 0x0004);
1469 if (masked_val != 0x0000)
1470 {
1471 Serial.print(F("\n**V2 UV COMPARATOR ASSERTED"));
1472 }
1473 else
1474 {
1475 Serial.print(F("\n V2 UV COMPARATOR NOT ASSERTED"));
1476 }
1477 masked_val = (return_val & 0x0002);
1478 if (masked_val != 0x0000)
1479 {
1480 Serial.print(F("\n**V1 OV COMPARATOR ASSERTED"));
1481 }
1482 else
1483 {
1484 Serial.print(F("\n V1 OV COMPARATOR NOT ASSERTED"));
1485 }
1486 masked_val = (return_val & 0x0001);
1487 if (masked_val != 0x0000)
1488 {
1489 Serial.print(F("\n**V1 UV COMPARATOR ASSERTED"));
1490 }
1491 else
1492 {
1493 Serial.print(F("\n V1 UV COMPARATOR NOT ASSERTED"));
1494 }
1495 return SUCCEED;
1496 }
1497
1498
1499 //! pretty-print STATUS_INFORMATION
1500 //! @return int for success
1501 int ltc2937_pretty_print_status_information()
1502 {
1503 uint16_t return_val,
1504 masked_val;
1505
1506 return_val = smbus->readWord(ltc2937_i2c_address, LTC2937_STATUS_INFORMATION);
1507
1508 Serial.print(F("\n LTC2937 STATUS_INFORMATION CONTENTS: "));
1509 Serial.println(return_val, HEX);
1510
1511 masked_val = (return_val & 0xE000);
1512 switch (masked_val)
1513 {
1514 case 0xE000 :
1515 Serial.print(F("\n***RESERVED SEQUENCE STATE (THIS IS BAD)"));
1516 break;
1517 case 0xC000 :
1518 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 6"));
1519 break;
1520 case 0xA000 :
1521 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 5"));
1522 break;
1523 case 0x8000 :
1524 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 4"));
1525 break;
1526 case 0x6000 :
1527 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 3"));
1528 break;
1529 case 0x4000 :
1530 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 2"));
1531 break;
1532 case 0x2000 :
1533 Serial.print(F("\n**SEQUENCE FAULT ON CHANNEL 1"));
1534 break;
1535 case 0x0000 :
1536 Serial.print(F("\n NO SEQUENCE FAULTS"));
1537 break;
1538 default :
1539 Serial.print(F("\n**UNDEFINED SEQUENCE FAULT STATE (THIS IS BAD)"));
1540 break;
1541 }
1542 masked_val = (return_val & 0x1000);
1543 if (masked_val != 0x0000)
1544 {
1545 Serial.print(F("\n**MONITOR BACKUP IS STORED IN EEPROM"));
1546 }
1547 else
1548 {
1549 Serial.print(F("\n NO MONITOR BACKUP IN EEPROM"));
1550 }
1551
1552 masked_val = (return_val & 0x0C00);
1553 switch (masked_val)
1554 {
1555 case 0x0C00 :
1556 Serial.print(F("\n PART SEQUENCE-UP COMPLETE"));
1557 break;
1558 case 0x0800 :
1559 Serial.print(F("\n PART SEQUENCE-DOWN IN PROGRESS"));
1560 break;
1561 case 0x0400 :
1562 Serial.print(F("\n PART SEQUENCE-UP IN PROGRESS"));
1563 break;
1564 case 0x0000 :
1565 Serial.print(F("\n PART SEQUENCE-DOWN COMPLETE"));
1566 break;
1567 default :
1568 Serial.print(F("\n**UNDEFINED PART SEQUENCING STATE (THIS IS BAD)"));
1569 break;
1570 }
1571
1572 masked_val = (return_val & 0x0300);
1573 switch (masked_val)
1574 {
1575 case 0x0300 :
1576 Serial.print(F("\n GROUP SEQUENCE-UP COMPLETE"));
1577 break;
1578 case 0x0200 :
1579 Serial.print(F("\n GROUP SEQUENCE-DOWN IN PROGRESS"));
1580 break;
1581 case 0x0100 :
1582 Serial.print(F("\n GROUP SEQUENCE-UP IN PROGRESS"));
1583 break;
1584 case 0x0000 :
1585 Serial.print(F("\n GROUP SEQUENCE-DOWN COMPLETE"));
1586 break;
1587 default :
1588 Serial.print(F("\n**UNDEFINED GROUP SEQUENCING STATE (THIS IS BAD)"));
1589 break;
1590 }
1591
1592 masked_val = (return_val & 0x0080);
1593 if (masked_val != 0x0000)
1594 {
1595 Serial.print(F("\n**SEQUENCE-UP FAULT DETECTED"));
1596 }
1597 else
1598 {
1599 Serial.print(F("\n NO SEQUENCE-UP FAULT"));
1600 }
1601 masked_val = (return_val & 0x0040);
1602 if (masked_val != 0x0000)
1603 {
1604 Serial.print(F("\n**SEQUENCE-DOWN FAULT DETECTED"));
1605 }
1606 else
1607 {
1608 Serial.print(F("\n NO SEQUENCE-DOWN FAULT"));
1609 }
1610 masked_val = (return_val & 0x0200);
1611 if (masked_val != 0x0000)
1612 {
1613 Serial.print(F("\n**OV FAULT DETECTED"));
1614 }
1615 else
1616 {
1617 Serial.print(F("\n NO OV FAULT"));
1618 }
1619 masked_val = (return_val & 0x0010);
1620 if (masked_val != 0x0000)
1621 {
1622 Serial.print(F("\n**UV FAULT DETECTED"));
1623 }
1624 else
1625 {
1626 Serial.print(F("\n NO UV FAULT"));
1627 }
1628 masked_val = (return_val & 0x0008);
1629 if (masked_val != 0x0000)
1630 {
1631 Serial.print(F("\n**RESET FAULT DETECTED"));
1632 }
1633 else
1634 {
1635 Serial.print(F("\n NO RESET FAULT"));
1636 }
1637 masked_val = (return_val & 0x0004);
1638 if (masked_val != 0x0000)
1639 {
1640 Serial.print(F("\n ALL SEQUENCED SUPPLIES ARE BELOW THEIR DISCHARGE THRESHOLDS"));
1641 }
1642 else
1643 {
1644 Serial.print(F("\n**NOT ALL SEQUENCED SUPPLIES ARE DOWN"));
1645 }
1646 masked_val = (return_val & 0x0002);
1647 if (masked_val != 0x0000)
1648 {
1649 Serial.print(F("\n**CONTROL FAULT DETECTED"));
1650 }
1651 else
1652 {
1653 Serial.print(F("\n NO CONTROL FAULT"));
1654 }
1655 masked_val = (return_val & 0x0001);
1656 if (masked_val != 0x0000)
1657 {
1658 Serial.print(F("\n**OTHER FAULT DETECTED"));
1659 }
1660 else
1661 {
1662 Serial.print(F("\n NO OTHER FAULT"));
1663 }
1664 return SUCCEED;
1665 }
LTC2937_BREAK_POINT
#define LTC2937_BREAK_POINT
Definition: LTC2937.h:148
LTC2937_TOFF_TIMERS_1
#define LTC2937_TOFF_TIMERS_1
Definition: LTC2937.h:122
LTC2937_TON_TIMERS_2
#define LTC2937_TON_TIMERS_2
Definition: LTC2937.h:117
ltc2937_clear_breakpoint
static int ltc2937_clear_breakpoint()
clear breakpoint register
Definition: DC2313A.ino:922
LTC2937_SEQ_UP_POSITION_1
#define LTC2937_SEQ_UP_POSITION_1
Definition: LTC2937.h:128
ltc2937_write_enable
static int ltc2937_write_enable()
remove software write-protection report if the part is hardware write-protected
Definition: DC2313A.ino:797
LTC2937_SEQ_UP_POSITION_5
#define LTC2937_SEQ_UP_POSITION_5
Definition: LTC2937.h:132
LTC2937_SEQ_UP_POSITION_6
#define LTC2937_SEQ_UP_POSITION_6
Definition: LTC2937.h:133
LTC2937_TOFF_TIMERS_6
#define LTC2937_TOFF_TIMERS_6
Definition: LTC2937.h:127
ltc2937_set_breakpoint
static int ltc2937_set_breakpoint(uint16_t set_val)
set the breakpoint to the given value
Definition: DC2313A.ino:823
FAIL
Definition: DC2313A.ino:84
NOT_DOWN
Definition: DC2313A.ino:82
LT_SMBusBase::sendByte
void sendByte(uint8_t address, uint8_t command)
SMBus send byte command.
Definition: LT_SMBusBase.cpp:508
LTC2937_SEQ_UP_POSITION_2
#define LTC2937_SEQ_UP_POSITION_2
Definition: LTC2937.h:129
user_command
unsigned char user_command
Definition: Serial_EEPROM_Test.ino:75
LTC2937_SPECIAL_LOT
#define LTC2937_SPECIAL_LOT
Definition: LTC2937.h:107
LTC2937_V_THRESHOLD_1
#define LTC2937_V_THRESHOLD_1
Definition: LTC2937.h:110
LT_SMBusBase::writeWord
void writeWord(uint8_t address, uint8_t command, uint16_t data)
SMBus write word command.
Definition: LT_SMBusBase.cpp:265
ltc2937_write_all_regs_dc_default
static int ltc2937_write_all_regs_dc_default()
write all registers to demo board defaults
Definition: DC2313A.ino:648
LTC2937_V_THRESHOLD_6
#define LTC2937_V_THRESHOLD_6
Definition: LTC2937.h:115
ltc2937_sequence_down
static int ltc2937_sequence_down()
sequence-down the LTC2937
Definition: DC2313A.ino:360
LTC2937_SEQ_POSITION_COUNT
#define LTC2937_SEQ_POSITION_COUNT
Definition: LTC2937.h:149
LTC2937_RESTORE
#define LTC2937_RESTORE
Definition: LTC2937.h:151
status
String status(void)
Returns a descriptive string based on status of pins.
Definition: DC2364A.ino:217
smbus
static LT_SMBusNoPec * smbus
Definition: DC2313A.ino:77
WRITE_PROTECTED
Definition: DC2313A.ino:83
Linduino.h
Header File for Linduino Libraries and Demo Code.
LTC2937_TON_TIMERS_5
#define LTC2937_TON_TIMERS_5
Definition: LTC2937.h:120
ltc2937_write_seq_regs
static int ltc2937_write_seq_regs()
write sequencing registers to a user-specified pattern
Definition: DC2313A.ino:710
LTC2937_CLEAR_ALERTB
#define LTC2937_CLEAR_ALERTB
Definition: LTC2937.h:146
LTC2937_RSTB_CONFIG
#define LTC2937_RSTB_CONFIG
Definition: LTC2937.h:140
LT_SMBusNoPec
Definition: LT_SMBusNoPec.h:60
LTC2937_RESTORE_DELAY
#define LTC2937_RESTORE_DELAY
Definition: DC2313A.ino:88
LTC2937_SEQ_DOWN_POSITION_6
#define LTC2937_SEQ_DOWN_POSITION_6
Definition: LTC2937.h:139
LTC2937_V_THRESHOLD_3
#define LTC2937_V_THRESHOLD_3
Definition: LTC2937.h:112
SUCCEED
Definition: DC2313A.ino:81
LTC2937_STATUS_INFORMATION
#define LTC2937_STATUS_INFORMATION
Definition: LTC2937.h:147
LTC2937_TOFF_TIMERS_4
#define LTC2937_TOFF_TIMERS_4
Definition: LTC2937.h:125
LTC2937_MONITOR_STATUS
#define LTC2937_MONITOR_STATUS
Definition: LTC2937.h:154
LTC2937_SEQ_DOWN_POSITION_5
#define LTC2937_SEQ_DOWN_POSITION_5
Definition: LTC2937.h:138
LTC2937_TON_TIMERS_4
#define LTC2937_TON_TIMERS_4
Definition: LTC2937.h:119
LTC2937_TON_TIMERS_1
#define LTC2937_TON_TIMERS_1
Definition: LTC2937.h:116
LTC2937_FAULT_RESPONSE
#define LTC2937_FAULT_RESPONSE
Definition: LTC2937.h:141
LTC2937_SEQ_DOWN_POSITION_2
#define LTC2937_SEQ_DOWN_POSITION_2
Definition: LTC2937.h:135
LTC2937_SEQ_DOWN_POSITION_1
#define LTC2937_SEQ_DOWN_POSITION_1
Definition: LTC2937.h:134
LTC2937.h
Header for LTC2937: Six Channel Sequencer and Voltage Supervisor with EEPROM.
print_title
static void print_title()
Prints the title block when program first starts.
Definition: DC2313A.ino:236
LTC2937_ON_OFF_CONTROL
#define LTC2937_ON_OFF_CONTROL
Definition: LTC2937.h:108
ltc2937_read_all_registers
static int ltc2937_read_all_registers()
read all registers return int for success
Definition: DC2313A.ino:468
ltc2937_read_all_status
static int ltc2937_read_all_status()
read all status registers
Definition: DC2313A.ino:414
LTC2937_STORE_DELAY
#define LTC2937_STORE_DELAY
Definition: DC2313A.ino:89
LTC2937_DEVICE_ID
#define LTC2937_DEVICE_ID
Definition: LTC2937.h:155
LTC2937_V_THRESHOLD_4
#define LTC2937_V_THRESHOLD_4
Definition: LTC2937.h:113
LTC2937_TOFF_TIMERS_3
#define LTC2937_TOFF_TIMERS_3
Definition: LTC2937.h:124
print_prompt
static void print_prompt()
Prints main menu.
Definition: DC2313A.ino:251
ltc2937_pretty_print_monitor_status_history
static int ltc2937_pretty_print_monitor_status_history()
pretty-print MONITOR_STATUS_HISTORY
Definition: DC2313A.ino:1196
LTC2937_WRITE_PROTECTION
#define LTC2937_WRITE_PROTECTION
Definition: LTC2937.h:106
LTC2937_SEQ_DOWN_POSITION_4
#define LTC2937_SEQ_DOWN_POSITION_4
Definition: LTC2937.h:137
LTC2937_MONITOR_STATUS_HISTORY
#define LTC2937_MONITOR_STATUS_HISTORY
Definition: LTC2937.h:144
ltc2937_store
static int ltc2937_store()
store the LTC2937 settings into EEPROM
Definition: DC2313A.ino:316
ltc2937_config0
static int ltc2937_config0()
make sure that the LTC2937 is configured for I2C bus control
Definition: DC2313A.ino:273
ltc2937_pretty_print_monitor_status
static int ltc2937_pretty_print_monitor_status()
pretty-print MONITOR_STATUS
Definition: DC2313A.ino:1359
LTC2937_V_THRESHOLD_2
#define LTC2937_V_THRESHOLD_2
Definition: LTC2937.h:111
ltc2937_clear_fault_backup
static int ltc2937_clear_fault_backup()
handle the backup word fault log (affects NVM and RAM)
Definition: DC2313A.ino:969
LTC2937_TON_TIMERS_3
#define LTC2937_TON_TIMERS_3
Definition: LTC2937.h:118
ltc2937_i2c_address
static uint8_t ltc2937_i2c_address
Definition: DC2313A.ino:72
LTC2937_SEQ_UP_POSITION_3
#define LTC2937_SEQ_UP_POSITION_3
Definition: LTC2937.h:130
LTC2937_V_THRESHOLD_5
#define LTC2937_V_THRESHOLD_5
Definition: LTC2937.h:114
LTC2937_CLEAR
#define LTC2937_CLEAR
Definition: LTC2937.h:152
ltc2937_restore
static int ltc2937_restore()
restore the LTC2937 settings from EEPROM values
Definition: DC2313A.ino:293
LTC2937_I2C_ADDRESS
#define LTC2937_I2C_ADDRESS
Definition: DC2313A.ino:66
LT_SMBusNoPec.h
LTC SMBus Support: Implementation for a shared SMBus layer.
LTC2937_SEQ_UP_POSITION_4
#define LTC2937_SEQ_UP_POSITION_4
Definition: LTC2937.h:131
LTC2937_V_RANGE
#define LTC2937_V_RANGE
Definition: LTC2937.h:109
UserInterface.h
ltc2937_sequence_up
static int ltc2937_sequence_up()
sequence-up the LTC2937
Definition: DC2313A.ino:339
LTC2937_TON_TIMERS_6
#define LTC2937_TON_TIMERS_6
Definition: LTC2937.h:121
ltc2937_inc_breakpoint
static int ltc2937_inc_breakpoint()
increment the breakpoint by 1
Definition: DC2313A.ino:853
read_int
int32_t read_int()
Definition: UserInterface.cpp:93
loop
static void loop()
Main Linduino Loop.
Definition: DC2313A.ino:110
ltc2937_is_write_protected
static int ltc2937_is_write_protected()
Indicate if the part is write protected return 0 if the part is write enabled (hardware and software)...
Definition: DC2313A.ino:773
LTC2937_STORE
#define LTC2937_STORE
Definition: LTC2937.h:150
return_values
return_values
Definition: DC2313A.ino:81
LTC2937_SEQ_DOWN_POSITION_3
#define LTC2937_SEQ_DOWN_POSITION_3
Definition: LTC2937.h:136
ltc2937_is_down
static int ltc2937_is_down()
indicate if the LTC2937 is in the sequenced-down state
Definition: DC2313A.ino:380
ltc2937_print_seq_pos_count
static int ltc2937_print_seq_pos_count()
pretty-print the sequence_position_count register contents
Definition: DC2313A.ino:890
ltc2937_clear_alertb
static int ltc2937_clear_alertb()
clear ALERTB pin
Definition: DC2313A.ino:1025
ltc2937_clear
static int ltc2937_clear()
issue a clear command
Definition: DC2313A.ino:937
LTC2937_MONITOR_BACKUP
#define LTC2937_MONITOR_BACKUP
Definition: LTC2937.h:153
i
static int i
Definition: DC2430A.ino:184
LTC2937_TOFF_TIMERS_5
#define LTC2937_TOFF_TIMERS_5
Definition: LTC2937.h:126
read_char
int8_t read_char()
Definition: UserInterface.cpp:116
setup
static void setup()
Initialize Linduino.
Definition: DC2313A.ino:94
ltc2937_pretty_print_status_information
static int ltc2937_pretty_print_status_information()
pretty-print STATUS_INFORMATION
Definition: DC2313A.ino:1501
ltc2937_pretty_print_monitor_backup
static int ltc2937_pretty_print_monitor_backup()
pretty-print MONITOR_BACKUP
Definition: DC2313A.ino:1033
LTC2937_TOFF_TIMERS_2
#define LTC2937_TOFF_TIMERS_2
Definition: LTC2937.h:123
LT_SMBusBase::readWord
uint16_t readWord(uint8_t address, uint8_t command)
SMBus read word command.
Definition: LT_SMBusBase.cpp:301