Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
DC1704A.ino
Go to the documentation of this file.
1 /*!
2 Linear Technology DC874A Demonstration Board.
3 LTC4280: Hot Swap Controller with I2C Compatible Monitoring
4 
5 @verbatim
6 
7 NOTES
8  Setup:
9  Set the terminal baud rate to 115200 and select the newline terminator. Provide
10  the board with an external power supply of 12 V. Ensure all jumpers on the
11  demo board are installed in their default positions from the factory. Refer to
12  Demo Manual DC874A.
13 
14  This program has options to measure voltage at ADIN pin (input voltage), SOURCE
15  VOLTAGE (output voltage), and SENSE CURRENT (current through sense resisitor).
16  There are also options to read and manipulate CONTROL register, ALERT register,
17  and FAULT register.
18 
19  Mass write option can be achieved using Device Address = 0xBE. Refer to datasheet
20  LTC4280.
21 
22 USER INPUT DATA FORMAT:
23  decimal : 1024
24  hex : 0x400
25  octal : 02000 (leading 0 "zero")
26  binary : B10000000000
27  float : 1024.0
28 
29 @endverbatim
30 
31 http://www.linear.com/product/LTC4280
32 
33 http://www.linear.com/product/LTC4280#demoboards
34 
35 
36 Copyright 2018(c) Analog Devices, Inc.
37 
38 All rights reserved.
39 
40 Redistribution and use in source and binary forms, with or without
41 modification, are permitted provided that the following conditions are met:
42  - Redistributions of source code must retain the above copyright
43  notice, this list of conditions and the following disclaimer.
44  - Redistributions in binary form must reproduce the above copyright
45  notice, this list of conditions and the following disclaimer in
46  the documentation and/or other materials provided with the
47  distribution.
48  - Neither the name of Analog Devices, Inc. nor the names of its
49  contributors may be used to endorse or promote products derived
50  from this software without specific prior written permission.
51  - The use of this software may or may not infringe the patent rights
52  of one or more patent holders. This license does not release you
53  from the requirement that you obtain separate licenses from these
54  patent holders to use this software.
55  - Use of the software either in source or binary form, must be run
56  on or directly connected to an Analog Devices Inc. component.
57 
58 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
59 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
60 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
61 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
62 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
63 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
64 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
65 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
66 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
67 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68 */
69 
70 /*! @file
71  @ingroup LTC4280
72 */
73 
74 // Headerfiles
75 #include <Arduino.h>
76 #include <stdint.h>
77 #include "LT_I2C.h"
78 #include "LT_SPI.h"
79 #include "UserInterface.h"
80 #include "QuikEval_EEPROM.h"
81 #include <Wire.h>
82 #include <SPI.h>
83 #include "LTC4280.h"
84 
85 // Macros
86 #define SENSE_RESISTOR 0.004
87 
88 // Function Declarations
89 void print_title();
90 void print_prompt();
93 int8_t main_menu_3_send_ARA();
95 int8_t main_menu_5_settings();
97 
98 //! Initialize Linduino
99 void setup()
100 {
101  quikeval_I2C_init(); // Enable the I2C port
103  Serial.begin(115200); // Initialize the serial port to the PC
104  print_title();
105  print_prompt();
106 }
107 
108 //! Repeats Linduino loop
109 void loop()
110 {
111  if (1)
112  {
113  int8_t ack = 0; // I2C acknowledge indicator
114  static uint8_t user_command; // The user input command
115  if (Serial.available()) //! Do nothing if serial is not available
116  {
117  user_command = read_int(); //! Read user input command
118  if (user_command != 'm')
119  Serial.println(user_command);
120  Serial.println();
121  ack = 0;
122  switch (user_command) //! Prints the appropriate submenu
123  {
124  case 1:
125  ack |= main_menu_1_continuous_mode(); // continous mode
126  break;
127  case 2:
128  ack |= main_menu_2_read_and_clear_faults(); // read and clear faults
129  break;
130  case 3:
131  ack |= main_menu_3_send_ARA();// read address of alert
132  break;
133  case 4:
134  ack |= main_menu_4_manage_alerts(); // manage alerts
135  break;
136  case 5:
137  ack |= main_menu_5_settings(); // settings
138  break;
139  case 6:
141  break;
142  default:
143  Serial.println("Incorrect Option");
144  break;
145  }
146 
147  print_prompt();
148  }
149  }
150 }
151 
152 //! Print the title block
154 {
155  Serial.println(F("\n*****************************************************************"));
156  Serial.print(F("* DC874A Demonstration Program *\n"));
157  Serial.print(F("* *\n"));
158  Serial.print(F("* This program demonstrates how to send and receive data from *\n"));
159  Serial.print(F("* LTC4280 Hot Swap Controller with I2C Compatible Monitoring *\n"));
160  Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
161  Serial.print(F("* *\n"));
162  Serial.print(F("*****************************************************************\n"));
163 }
164 
165 //! Print the main menu
167 {
168  Serial.print(F("\n\nMain Menu\n"));
169  Serial.print(F(" 1. Read current and voltage on continous mode\n"));
170  Serial.print(F(" 2. Read and clear faults\n"));
171  Serial.print(F(" 3. Request for alert response address (ARA)\n"));
172  Serial.print(F(" 4. Manage alerts\n"));
173  Serial.print(F(" 5. Settings\n"));
174  Serial.print(F(" 6. Read all registers\n\n"));
175  Serial.print(F("Enter a command: "));
176 }
177 
178 //! Function to read Rsense current, ADIN voltage and ADIN2 voltage in continous mode
180 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
181 {
182  int8_t ack = 0;
183  float sense_voltage, source_voltage, adin_voltage;
184  uint8_t sense_code, source_code, adin_code;
185  float adin_lsb = (1.23/255), adin_resisive_ratio = (155.4/12.4);
186  float source_lsb = (15.44/255), source_resisive_ratio = 1; // Set voltage divider ratio to 1, for no resistor divider circuit.
187  float sense_lsb = (0.03845/255), sense_resisive_ratio = 1;
188 
189  do
190  {
191  uint8_t faults;
192  Serial.print(F("********** Press Enter to Exit ***********\n\n"));
194  if (faults != 0)
195  {
196  Serial.println(F("Faults Detected :"));
197  if (faults & LTC4280_FET_SHORT_FAULT )
198  Serial.println(F(" FET SHORT DETECTED"));
199  if (faults & LTC4280_EN_STATE_CHANGE)
200  Serial.println(F(" !EN STATE CHANGE DETECTED"));
201  if (faults & LTC4280_POWER_BAD_FAULT )
202  Serial.println(F(" BAD POWER DETECTED"));
203  if (faults & LTC4280_OVERCURRENT_FAULT )
204  Serial.println(F(" OVERCURRENT DETECTED"));
205  if (faults & LTC4280_UNDERVOLTAGE_FAULT )
206  Serial.println(F(" UNDERVOLTAGE DETECTED"));
207  if (faults & LTC4280_OVERVOLTAGE_FAULT )
208  Serial.println(F(" OVERVOLTAGE DETECTED"));
209  }
210  else
211  Serial.println(F(" NO FAULTS DETECTED"));
212 
213  ack |= LTC4280_read(LTC4280_I2C_ADDRESS, LTC4280_SENSE_REG, &sense_code);
214  ack |= LTC4280_read(LTC4280_I2C_ADDRESS, LTC4280_SOURCE_REG, &source_code);
216 
217  sense_voltage = LTC4280_code_to_voltage(sense_code, sense_lsb, sense_resisive_ratio);
218  source_voltage = LTC4280_code_to_voltage(source_code, source_lsb, source_resisive_ratio);
219  adin_voltage = LTC4280_code_to_voltage(adin_code, adin_lsb, adin_resisive_ratio);
220 
221  Serial.print(F("\nSENSE VOLTAGE CODE: "));
222  Serial.println(sense_code, HEX);
223  Serial.print(F("SENSE CURRENT CALCULATED: "));
224  Serial.println((sense_voltage / SENSE_RESISTOR), 4);
225  Serial.print(F("\nSOURCE VOLTAGE CODE: "));
226  Serial.println(source_code, HEX);
227  Serial.print(F("SOURCE VOLTAGE CALCULATED: "));
228  Serial.println(source_voltage, 4);
229  Serial.print(F("\nADIN CODE: "));
230  Serial.println(adin_code, HEX);
231  Serial.print(F("VOLTAGE CALCULATED AT ADIN: "));
232  Serial.println(adin_voltage, 4);
233  Serial.print("\n");
234  delay(2000);
235  }
236  while (Serial.available()==false && ack== 0);
237  if (Serial.available())
238  read_int(); // clears the Serial.available()
239  return (ack);
240 }
241 
242 //! Function to read and clear fault register
244 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
245 {
246  int8_t ack = 0;
247 
248  uint8_t faults;
250  if (faults != 0)
251  {
252  Serial.println(F("Faults Detected :"));
253  if (faults & LTC4280_FET_SHORT_FAULT)
254  Serial.println(F(" FET SHORT DETECTED"));
255  if (faults & LTC4280_EN_STATE_CHANGE)
256  Serial.println(F(" !EN STATE CHANGE DETECTED"));
257  if (faults & LTC4280_POWER_BAD_FAULT)
258  Serial.println(F(" BAD POWER DETECTED"));
259  if (faults & LTC4280_OVERCURRENT_FAULT)
260  Serial.println(F(" OVERCURRENT DETECTED"));
261  if (faults & LTC4280_UNDERVOLTAGE_FAULT)
262  Serial.println(F(" UNDERVOLTAGE DETECTED"));
263  if (faults & LTC4280_OVERVOLTAGE_FAULT)
264  Serial.println(F(" OVERVOLTAGE DETECTED"));
265  }
267  Serial.print(F("\nALL FAULTS CLEARED \n\n"));
268 
269  return (ack);
270 }
271 
272 //! Function to send alert response (0001100) and read back the address of device that pulled ALERT pin low.
274 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
275 {
276  int8_t ack = 0;
277  uint8_t address;
278  ack |= LTC4280_ARA(LTC4280_I2C_ALERT_RESPONSE, &address);// send ARA
279  Serial.print(F(" ALERT RESPONSE ADDRESS : 0x"));
280  Serial.println(address,HEX);
281  if (address == 0xFF && ack == 1)
282  {
283  ack = 0;
284  Serial.print(F(" NO RESPONSE\n\n"));
285  }
286  return(ack);
287 }
288 
289 //! Function to update alert register bits
291 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
292 {
293  int8_t ack = 0;
294  uint8_t alert_settings = 0;
295  int8_t user_command;
296  do
297  {
298  Serial.println(F("GPIO OUTPUT"));
299  Serial.println(F(" 1. Enable"));
300  Serial.println(F(" 2. Disable"));
301  Serial.print(F("Enter a command: "));
302  user_command = read_int();
303  if (user_command == 'm')
304  Serial.println("m");
305  else
306  Serial.println(user_command);
307  Serial.println();
308  if (user_command == 1)
309  alert_settings |= LTC4280_GPIO_OUTPUT_ENABLE;
310  else if (user_command ==2)
311  alert_settings &= LTC4280_GPIO_OUTPUT_DISABLE;
312  else if (user_command != 'm')
313  Serial.println("Incorrect Option\n");
314  else
315  return(ack);
316 
317  Serial.println(F("FET SHORT ALERT"));
318  Serial.println(F(" 1. Enable"));
319  Serial.println(F(" 2. Disable"));
320  Serial.print(F("Enter a command: "));
321  user_command = read_int();
322  if (user_command == 'm')
323  Serial.println("m");
324  else
325  Serial.println(user_command);
326  Serial.println();
327  if (user_command == 1)
328  alert_settings |= LTC4280_FET_SHORT_ENABLE;
329  else if (user_command ==2)
330  alert_settings &= LTC4280_FET_SHORT_DISABLE;
331  else if (user_command != 'm')
332  Serial.println("Incorrect Option\n");
333  else
334  return(ack);
335 
336  Serial.println(F("!EN STATE CHANGE ALERT"));
337  Serial.println(F(" 1. Enable"));
338  Serial.println(F(" 2. Disable"));
339  Serial.print(F("Enter a command: "));
340  user_command = read_int();
341  if (user_command == 'm')
342  Serial.println("m");
343  else
344  Serial.println(user_command);
345  Serial.println();
346  if (user_command == 1)
347  alert_settings |= LTC4280_EN_STATE_ENABLE;
348  else if (user_command ==2)
349  alert_settings &= LTC4280_EN_STATE_DISABLE;
350  else if (user_command != 'm')
351  Serial.println("Incorrect Option\n");
352  else
353  return(ack);
354 
355  Serial.println(F("POWER BAD ALERT"));
356  Serial.println(F(" 1. Enable"));
357  Serial.println(F(" 2. Disable"));
358  Serial.print(F("Enter a command: "));
359  user_command = read_int();
360  if (user_command == 'm')
361  Serial.println("m");
362  else
363  Serial.println(user_command);
364  Serial.println();
365  if (user_command == 1)
366  alert_settings |= LTC4280_POWER_BAD_ENABLE;
367  else if (user_command ==2)
368  alert_settings &= LTC4280_POWER_BAD_DISABLE;
369  else if (user_command != 'm')
370  Serial.println("Incorrect Option\n");
371  else
372  return(ack);
373 
374  Serial.println(F("OVERCURRENT ALERT"));
375  Serial.println(F(" 1. Enable"));
376  Serial.println(F(" 2. Disable"));
377  Serial.print(F("Enter a command: "));
378  user_command = read_int();
379  if (user_command == 'm')
380  Serial.println("m");
381  else
382  Serial.println(user_command);
383  Serial.println();
384  if (user_command == 1)
385  alert_settings |= LTC4280_OVERCURRENT_ENABLE;
386  else if (user_command ==2)
387  alert_settings &= LTC4280_OVERCURRENT_DISABLE;
388  else if (user_command != 'm')
389  Serial.println("Incorrect Option\n");
390  else
391  return(ack);
392 
393  Serial.println(F("UNDERVOLTAGE ALERT"));
394  Serial.println(F(" 1. Enable"));
395  Serial.println(F(" 2. Disable"));
396  Serial.print(F("Enter a command: "));
397  user_command = read_int();
398  if (user_command == 'm')
399  Serial.println("m");
400  else
401  Serial.println(user_command);
402  Serial.println();
403  if (user_command == 1)
404  alert_settings |= LTC4280_UNDERVOLTAGE_ENABLE;
405  else if (user_command ==2)
406  alert_settings &= LTC4280_UNDERVOLTAGE_DISABLE;
407  else if (user_command != 'm')
408  Serial.println("Incorrect Option\n");
409  else
410  return(ack);
411 
412  Serial.println(F("OVERVOLTAGE ALERT"));
413  Serial.println(F(" 1. Enable"));
414  Serial.println(F(" 2. Disable"));
415  Serial.print(F("Enter a command: "));
416  user_command = read_int();
417  if (user_command == 'm')
418  Serial.println("m");
419  else
420  Serial.println(user_command);
421  Serial.println();
422  if (user_command == 1)
423  alert_settings |= LTC4280_OVERVOLTAGE_ENABLE;
424  else if (user_command ==2)
425  alert_settings &= LTC4280_OVERVOLTAGE_DISABLE;
426  else if (user_command != 'm')
427  Serial.println("Incorrect Option\n");
428  else
429  return(ack);
430  ack |= LTC4280_write(LTC4280_I2C_ADDRESS, LTC4280_ALERT_REG, alert_settings);
431  Serial.print(F("\n ALERTS UPDATED\n\n"));
432  Serial.println(F(" m. Main Menu"));
433  Serial.println(F(" 1. Repeat"));
434  Serial.print(F("Enter a command: "));
435  user_command = read_int();
436  if (user_command == 'm')
437  Serial.println("m");
438  else
439  Serial.println(user_command);
440  Serial.println();
441  }
442  while (!((user_command == 'm') || (ack)));
443  return(ack);
444 }
445 
446 //! Function to update control register bits
448 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
449 {
450  int8_t ack = 0;
451  uint8_t settings =0;
452  int8_t user_command;
453  do
454  {
455  Serial.println(F("PGIO"));
456  Serial.println(F(" 1. !POWER GOOD"));
457  Serial.println(F(" 2. POWER GOOD"));
458  Serial.println(F(" 3. General Purpose Output"));
459  Serial.println(F(" 4. General Purpose Input"));
460  Serial.print(F("Enter a command: "));
461  user_command = read_int();
462  if (user_command == 'm')
463  {
464  Serial.println("m");
465  return(ack);
466  }
467  else
468  Serial.println(user_command);
469  Serial.println();
470  switch (user_command)
471  {
472  case 1:
473  settings |= LTC4280_PGIO_POWER_GOODX;
474  break;
475  case 2:
476  settings |= LTC4280_PGIO_POWER_GOOD;
477  break;
478  case 3:
480  break;
481  case 4:
483  break;
484  default:
485  if (user_command != 'm')
486  Serial.println("Incorrect Option\n");
487  break;
488  }
489 
490  Serial.println(F("TEST MODE ENABLE"));
491  Serial.println(F(" 1. Enable"));
492  Serial.println(F(" 2. Disable"));
493  Serial.print(F("Enter a command: "));
494  user_command = read_int();
495  if (user_command == 'm')
496  Serial.println("m");
497  else
498  Serial.println(user_command);
499  Serial.println();
500  if (user_command == 1)
501  settings |= LTC4280_TEST_MODE_ENABLE;
502  else if (user_command ==2)
503  settings &= LTC4280_TEST_MODE_DISABLE;
504  else if (user_command != 'm')
505  Serial.println("Incorrect Option\n");
506  else
507  return(ack);
508 
509  Serial.println(F("MASS WRITE ENABLE"));
510  Serial.println(F(" 1. Enable"));
511  Serial.println(F(" 2. Disable"));
512  Serial.print(F("Enter a command: "));
513  user_command = read_int();
514  if (user_command == 'm')
515  Serial.println("m");
516  else
517  Serial.println(user_command);
518  Serial.println();
519  if (user_command == 1)
520  settings |= LTC4280_MASS_WRITE_ENABLE;
521  else if (user_command ==2)
522  settings &= LTC4280_MASS_WRITE_DISABLE;
523  else if (user_command != 'm')
524  Serial.println("Incorrect Option\n");
525  else
526  return(ack);
527 
528  Serial.println(F("FET STATUS"));
529  Serial.println(F(" 1. ON"));
530  Serial.println(F(" 2. OFF"));
531  Serial.print(F("Enter a command: "));
532  user_command = read_int();
533  if (user_command == 'm')
534  Serial.println("m");
535  else
536  Serial.println(user_command);
537  Serial.println();
538  if (user_command == 1)
539  settings |= LTC4280_FET_ON;
540  else if (user_command ==2)
541  settings &= LTC4280_FET_OFF;
542  else if (user_command != 'm')
543  Serial.println("Incorrect Option\n");
544  else
545  return(ack);
546 
547  Serial.println(F("OVERCURRENT AUTO RETRY"));
548  Serial.println(F(" 1. Enable"));
549  Serial.println(F(" 2. Disable"));
550  Serial.print(F("Enter a command: "));
551  user_command = read_int();
552  if (user_command == 'm')
553  Serial.println("m");
554  else
555  Serial.println(user_command);
556  Serial.println();
557  if (user_command == 1)
559  else if (user_command ==2)
561  else if (user_command != 'm')
562  Serial.println("Incorrect Option\n");
563  else
564  return(ack);
565 
566  Serial.println(F("UNDERVOLTAGE AUTO RETRY"));
567  Serial.println(F(" 1. Enable"));
568  Serial.println(F(" 2. Disable"));
569  Serial.print(F("Enter a command: "));
570  user_command = read_int();
571  if (user_command == 'm')
572  Serial.println("m");
573  else
574  Serial.println(user_command);
575  Serial.println();
576  if (user_command == 1)
578  else if (user_command ==2)
580  else if (user_command != 'm')
581  Serial.println("Incorrect Option\n");
582  else
583  return(ack);
584 
585  Serial.println(F("OVERVOLTAGE AUTO RETRY"));
586  Serial.println(F(" 1. Enable"));
587  Serial.println(F(" 2. Disable"));
588  Serial.print(F("Enter a command: "));
589  user_command = read_int();
590  if (user_command == 'm')
591  Serial.println("m");
592  else
593  Serial.println(user_command);
594  Serial.println();
595  if (user_command == 1)
597  else if (user_command ==2)
599  else if (user_command != 'm')
600  Serial.println("Incorrect Option\n");
601  else
602  return(ack);
604  Serial.print(F("\nSETTINGS UPDATED\n\n"));
605  Serial.println(F(" m. Main Menu"));
606  Serial.println(F(" 1. Repeat"));
607  Serial.print(F("Enter a command: "));
608  user_command = read_int();
609  if (user_command == 'm')
610  Serial.println("m");
611  else
612  Serial.println(user_command);
613  Serial.println();
614  }
615  while (!((user_command == 'm') || (ack)));
616  return(ack);
617 }
618 
619 //! Function to read all registers.
621 //! @return Returns the state of the acknowledge bit after the I2C address read. 0=acknowledge, 1=no acknowledge.
622 {
623  int8_t ack = 0;
624  uint8_t faults;
626  Serial.print(" FAULT REGISTER : 0b");
627  Serial.println(faults, BIN);
629  Serial.print(" STATUS REGISTER : 0b");
630  Serial.println(faults, BIN);
632  Serial.print(" ALERT REGISTER : 0b");
633  Serial.println(faults, BIN);
635  Serial.print(" CONTROL REGISTER : 0b");
636  Serial.println(faults, BIN);
637  Serial.println();
638  return ack;
639 }
#define LTC4280_POWER_BAD_FAULT
Definition: LTC4280.h:121
#define LTC4280_TEST_MODE_DISABLE
Definition: LTC4280.h:155
static int8_t main_menu_4_manage_alerts()
Function to update alert register bits.
Definition: DC1704A.ino:290
#define LTC4280_SOURCE_REG
Definition: LTC4280.h:112
static void print_title()
Print the title block.
Definition: DC1704A.ino:153
unsigned char user_command
#define LTC4280_EN_STATE_DISABLE
Definition: LTC4280.h:135
#define LTC4280_UNDERVOLTAGE_ENABLE
Definition: LTC4280.h:140
float LTC4280_code_to_voltage(uint8_t register_code, float LSB, float resistor_divider_ratio)
Calculates voltage from register code data.
Definition: LTC4280.cpp:72
#define LTC4280_OVERCURRENT_DISABLE
Definition: LTC4280.h:139
#define LTC4280_OVERVOLTAGE_DISABLE
Definition: LTC4280.h:143
#define LTC4280_FET_SHORT_DISABLE
Definition: LTC4280.h:133
const float adin_lsb
Definition: DC998A.ino:99
#define LTC4280_EN_STATE_CHANGE
Definition: LTC4280.h:120
#define LTC4280_TEST_MODE_ENABLE
Definition: LTC4280.h:154
#define LTC4280_FET_OFF
Definition: LTC4280.h:161
#define LTC4280_FET_ON
Definition: LTC4280.h:160
#define LTC4280_GPIO_OUTPUT_ENABLE
Definition: LTC4280.h:130
#define LTC4280_STATUS_REG
Definition: LTC4280.h:109
#define LTC4280_PGIO_GENERAL_PURPOSE_OUTPUT
Definition: LTC4280.h:151
#define LTC4280_POWER_BAD_DISABLE
Definition: LTC4280.h:137
static uint8_t address
Definition: DC2091A.ino:83
#define LTC4280_EN_STATE_ENABLE
Definition: LTC4280.h:134
#define LTC4280_GPIO_OUTPUT_DISABLE
Definition: LTC4280.h:131
#define LTC4280_UNDERVOLTAGE_AUTO_RETRY_ENABLE
Definition: LTC4280.h:166
#define LTC4280_OVERVOLTAGE_FAULT
Definition: LTC4280.h:124
static int8_t main_menu_3_send_ARA()
Function to send alert response (0001100) and read back the address of device that pulled ALERT pin l...
Definition: DC1704A.ino:273
#define LTC4280_ALERT_REG
Definition: LTC4280.h:108
#define LTC4280_UNDERVOLTAGE_DISABLE
Definition: LTC4280.h:141
static void loop()
Repeats Linduino loop.
Definition: DC1704A.ino:109
#define LTC4280_CONTROL_REG
Definition: LTC4280.h:107
static void settings()
Configures the output.
Definition: DC726B_A.ino:202
#define LTC4280_OVERVOLTAGE_AUTO_RETRY_ENABLE
Definition: LTC4280.h:169
int8_t LTC4280_ARA(uint8_t alert_response_address, uint8_t *i2c_address)
SMBus Alert ResponseProtocol: Sends an alert response command and releases /ALERT pin...
Definition: LTC4280.cpp:81
#define LTC4280_OVERCURRENT_AUTO_RETRY_DISABLE
Definition: LTC4280.h:164
#define LTC4280_FET_SHORT_FAULT
Definition: LTC4280.h:119
QuikEval EEPROM Library.
int8_t LTC4280_write(uint8_t i2c_address, uint8_t command, uint8_t code)
Write an 8-bit code to the LTC4280.
Definition: LTC4280.cpp:89
static int8_t main_menu_1_continuous_mode()
Function to read Rsense current, ADIN voltage and ADIN2 voltage in continous mode.
Definition: DC1704A.ino:179
#define SENSE_RESISTOR
Definition: DC1704A.ino:86
#define LTC4280_I2C_ADDRESS
Definition: LTC4280.h:99
#define LTC4280_OVERVOLTAGE_ENABLE
Definition: LTC4280.h:142
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
#define LTC4280_FET_SHORT_ENABLE
Definition: LTC4280.h:132
#define LTC4280_OVERCURRENT_FAULT
Definition: LTC4280.h:122
#define LTC4280_ADIN_REG
Definition: LTC4280.h:113
#define LTC4280_POWER_BAD_ENABLE
Definition: LTC4280.h:136
static int8_t main_menu_5_settings()
Function to update control register bits.
Definition: DC1704A.ino:447
int32_t read_int()
#define LTC4280_SENSE_REG
Definition: LTC4280.h:111
static void print_prompt()
Print the main menu.
Definition: DC1704A.ino:166
#define LTC4280_OVERCURRENT_AUTO_RETRY_ENABLE
Definition: LTC4280.h:163
#define LTC4280_I2C_ALERT_RESPONSE
Definition: LTC4280.h:100
#define LTC4280_OVERVOLTAGE_AUTO_RETRY_DISABLE
Definition: LTC4280.h:170
#define LTC4280_MASS_WRITE_ENABLE
Definition: LTC4280.h:157
#define LTC4280_PGIO_POWER_GOOD
Definition: LTC4280.h:150
#define LTC4280_UNDERVOLTAGE_AUTO_RETRY_DISABLE
Definition: LTC4280.h:167
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
Definition: LT_I2C.cpp:394
LTC4280: Hot Swap Controller with I2C Compatible Monitoring.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
Definition: LT_I2C.cpp:401
#define LTC4280_MASS_WRITE_DISABLE
Definition: LTC4280.h:158
static void setup()
Initialize Linduino.
Definition: DC1704A.ino:99
#define LTC4280_FAULT_REG
Definition: LTC4280.h:110
#define LTC4280_UNDERVOLTAGE_FAULT
Definition: LTC4280.h:123
static int8_t main_menu_2_read_and_clear_faults()
Function to read and clear fault register.
Definition: DC1704A.ino:243
#define LTC4280_OVERCURRENT_ENABLE
Definition: LTC4280.h:138
int8_t LTC4280_read(uint8_t i2c_address, uint8_t command, uint8_t *code)
Reads an 8-bit adc_code from LTC4280.
Definition: LTC4280.cpp:97
#define LTC4280_PGIO_POWER_GOODX
Definition: LTC4280.h:149
static int8_t main_menu_6_read_all_registers()
Function to read all registers.
Definition: DC1704A.ino:620
#define LTC4280_PGIO_GENERAL_PURPOSE_INPUT
Definition: LTC4280.h:152