Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
DC1697A.ino
Go to the documentation of this file.
1 /*!
2 DC1697A
3 LTC2945: Wide Range Power Monitor
4 
5 @verbatim
6 
7 Setting the Alerts:
8  1. Select the Alert option from the main menu.
9  2. Select the desired alerts to be changed. Then enter the minimum and maximum
10  values.
11  3. Select the Enable and Disable Alert Option and Enable the desired alerts.
12  4. Lastly, go back to the main menu and start reading values in Continuous Mode
13  or Snapshot Mode.
14  Note: Alerts only respond when conversion is done. Therefore, in continuous
15  mode the alerts will constantly be updated.
16 
17 Reading and Clearing an Alert:
18  1. Select the Alert option from the main menu.
19  2. Select the Read and Clear Alerts option. This reads all faults that occured
20  and clears the alerts.
21 
22 NOTES
23  Setup:
24  Set the terminal baud rate to 115200 and select the newline terminator.
25  Requires a power supply.
26  Refer to demo manual DC1697A.
27 
28 USER INPUT DATA FORMAT:
29  decimal : 1024
30  hex : 0x400
31  octal : 02000 (leading 0 "zero")
32  binary : B10000000000
33  float : 1024.0
34 
35 @endverbatim
36 
37 
38 Copyright 2018(c) Analog Devices, Inc.
39 
40 All rights reserved.
41 
42 Redistribution and use in source and binary forms, with or without
43 modification, are permitted provided that the following conditions are met:
44  - Redistributions of source code must retain the above copyright
45  notice, this list of conditions and the following disclaimer.
46  - Redistributions in binary form must reproduce the above copyright
47  notice, this list of conditions and the following disclaimer in
48  the documentation and/or other materials provided with the
49  distribution.
50  - Neither the name of Analog Devices, Inc. nor the names of its
51  contributors may be used to endorse or promote products derived
52  from this software without specific prior written permission.
53  - The use of this software may or may not infringe the patent rights
54  of one or more patent holders. This license does not release you
55  from the requirement that you obtain separate licenses from these
56  patent holders to use this software.
57  - Use of the software either in source or binary form, must be run
58  on or directly connected to an Analog Devices Inc. component.
59 
60 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
61 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
62 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
63 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
64 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
65 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
66 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
67 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
68 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
69 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70  */
71 
72 /*! @file
73  @ingroup LTC2945
74 */
75 
76 #include <Arduino.h>
77 #include <stdint.h>
78 #include "Linduino.h"
79 #include "LT_I2C.h"
80 #include "LT_SPI.h"
81 #include "UserInterface.h"
82 #include "QuikEval_EEPROM.h"
83 #include "LTC2945.h"
84 #include <Wire.h>
85 #include <SPI.h>
86 
87 // Function Declaration
88 void print_title(); // Print the title block
89 void print_prompt(); // Print the Prompt
90 void store_alert_settings(); // Store the alert settings to the EEPROM
91 int8_t restore_alert_settings(); // Read the alert settings from EEPROM
92 
93 int8_t menu_1_continuous_mode(int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE, float scale);
94 int8_t menu_2_snapshot_mode(int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE);
95 int8_t menu_2_snapshot_mode_menu_1_current(int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE);
98 int8_t menu_3_alert(int8_t ADIN_or_SENSE);
99 int8_t menu_3_alert_menu_1_set_power_alerts(int8_t ADIN_or_SENSE);
105 int8_t menu_4_shutdown();
106 void menu_5_settings(int8_t *VDD_or_SENSE_monitoring, int8_t *ADIN_or_SENSE, float *scale);
107 int8_t menu_6_clear_min_max();
108 
109 #define CONTINUOUS_MODE_DISPLAY_DELAY 1000 //!< The delay between readings
110 
111 // LSB Weights
112 const float LTC2945_ADIN_lsb = 5.001221E-04; //!< Typical ADIN lsb weight in volts
113 const float LTC2945_DELTA_SENSE_lsb = 2.5006105E-05; //!< Typical Delta lsb weight in volts
114 const float LTC2945_VIN_lsb = 2.5006105E-02; //!< Typical VIN lsb weight in volts
115 const float LTC2945_Power_lsb = 6.25305E-07; //!< Typical POWER lsb weight in V^2
116 const float LTC2945_ADIN_DELTA_SENSE_lsb = 1.25061E-08; //!< Typical sense lsb weight in V^2 *ADIN_lsb * DELTA_SENSE_lsb
117 
118 const float resistor = .02; //!< resistor value on demo board
119 
120 // Error string
121 const char ack_error[] = "Error: No Acknowledge. Check I2C Address."; //!< Error message
122 
123 // Global variables
124 static int8_t demo_board_connected; //!< Set to 1 if the board is connected
125 static uint8_t alert_code = 0; //!< Value stored or read from ALERT register. Shared between loop() and restore_alert_settings()
126 
127 //! Initialize Linduino
128 void setup()
129 {
130  char demo_name[] = "DC1697"; // Demo Board Name stored in QuikEval EEPROM
131 
132  quikeval_I2C_init(); //! Configure the EEPROM I2C port for 100kHz
133  quikeval_I2C_connect(); //! Connects to main I2C port
134  Serial.begin(115200); //! Initialize the serial port to the PC
135  print_title();
138  {
139  Serial.println(F("Demo board not detected, will attempt to proceed"));
140  demo_board_connected = true;
141  }
143  {
145  print_prompt();
146  }
147 }
148 
149 //! Repeats Linduino loop
150 void loop()
151 {
152  int8_t ack = 0; // I2C acknowledge indicator
153  static uint8_t user_command; // The user input command
154 
155  static int8_t VDD_or_SENSE_monitoring = 1; // Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
156  static int8_t ADIN_or_SENSE = 1; // Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
157 
158  static float scale; // Stores division ration for resistive divider on ADIN pin. Configured inside "Settings" menu.
159 
160  if (demo_board_connected) //! Do nothing if the demo board is not connected
161  {
162  if (Serial.available()) //! Do nothing if serial is not available
163  {
164  user_command = read_int(); //! Read user input command
165  if (user_command != 'm')
166  Serial.println(user_command);
167  Serial.println();
168  ack = 0;
169  switch (user_command) //! Prints the appropriate submenu
170  {
171  case 1:
172  ack |= menu_1_continuous_mode(VDD_or_SENSE_monitoring, ADIN_or_SENSE, scale); // Continuous Mode
173  break;
174 
175  case 2:
176  ack |= menu_2_snapshot_mode(VDD_or_SENSE_monitoring, ADIN_or_SENSE);
177  break;
178 
179  case 3:
180  ack |= menu_3_alert(ADIN_or_SENSE); // Alert
181  break;
182 
183  case 4:
184  ack |= menu_4_shutdown(); // Shutdown Down Mode
185  break;
186 
187  case 5:
188  menu_5_settings(&VDD_or_SENSE_monitoring, &ADIN_or_SENSE, &scale); // Settings
189  break;
190 
191  case 6:
192  ack |= menu_6_clear_min_max(); // Clear Min/Max
193  break;
194 
195  default:
196  Serial.println("Incorrect Option");
197  break;
198  }
199  if (ack != 0)
200  Serial.println(ack_error);
201  Serial.print(F("*************************"));
202  print_prompt();
203  }
204  }
205 }
206 
207 // Function Definitions
208 //! Print the title block
210 {
211  Serial.println(F("\n*****************************************************************"));
212  Serial.print(F("* DC1697 Demonstration Program *\n"));
213  Serial.print(F("* *\n"));
214  Serial.print(F("* This program communicates with the LTC2945 12-Bit Wide Range *\n"));
215  Serial.print(F("* I2C Power Monitor found on the DC1697 demo board. *\n"));
216  Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
217  Serial.print(F("* *\n"));
218  Serial.print(F("*****************************************************************\n"));
219 }
220 
221 //! Print the Prompt
223 {
224  Serial.print(F("\n1-Continuous Mode\n"));
225  Serial.print(F("2-Snapshot Mode\n"));
226  Serial.print(F("3-Alert\n"));
227  Serial.print(F("4-Shutdown Mode\n"));
228  Serial.print(F("5-Settings\n"));
229  Serial.print(F("6-Clear Min/Max\n\n"));
230  Serial.print(F("Enter a command: "));
231 }
232 
233 //! Continuous Mode.
234 int8_t menu_1_continuous_mode(int8_t VDD_or_SENSE_monitoring, //!< Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
235  int8_t ADIN_or_SENSE, //!< Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
236  float scale) //!< Stores division ratio for resistive divider on ADIN pin. Configured inside "Settings" menu.
237 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
238 {
239  int8_t LTC2945_mode;
240  int8_t ack = 0;
241  LTC2945_mode = LTC2945_CONTINUOUS_MODE;
242  if (VDD_or_SENSE_monitoring == 1)
243  LTC2945_mode = LTC2945_mode | LTC2945_SENSE_MONITOR; //! Enables SENSE+ voltage monitor
244  if (ADIN_or_SENSE == 1)
245  LTC2945_mode = LTC2945_mode | LTC2945_SENSE_MULTIPLIER; //! Selects VIN as a multiplier for power
246  Serial.println();
247  ack |= LTC2945_write(LTC2945_I2C_ADDRESS, LTC2945_CONTROL_REG, LTC2945_mode); //! Sets the LTC2945 to continuous mode
248  do
249  {
250  if (ADIN_or_SENSE == 1)
251  {
252  Serial.print(F("*************************\n\n"));
253 
254  int32_t power_code, max_power_code, min_power_code;
258 
259  float power, max_power, min_power; // Store power results
260  power = LTC2945_code_to_power(power_code, resistor, LTC2945_Power_lsb);
261  max_power = LTC2945_code_to_power(max_power_code, resistor, LTC2945_Power_lsb);
262  min_power = LTC2945_code_to_power(min_power_code, resistor, LTC2945_Power_lsb);
263 
264  Serial.print(F("****Power: "));
265  Serial.print(power, 4);
266  Serial.print(F(" W\n"));
267 
268  Serial.print(F("Max Power: "));
269  Serial.print(max_power, 4);
270  Serial.print(F(" W\n"));
271 
272  Serial.print(F("Min Power: "));
273  Serial.print(min_power, 4);
274  Serial.print(F(" W\n"));
275  }
276  else
277  {
278  Serial.print(F("*************************"));
279  Serial.println();
280  Serial.println();
281 
282  int32_t power_code, max_power_code, min_power_code;
286 
287  float power, max_power, min_power;
289  max_power = LTC2945_code_to_ADIN_power(max_power_code, resistor, LTC2945_ADIN_DELTA_SENSE_lsb) * scale;
290  min_power = LTC2945_code_to_ADIN_power(min_power_code, resistor, LTC2945_ADIN_DELTA_SENSE_lsb) * scale;
291 
292  Serial.print(F("\n***ADIN Power: "));
293  Serial.print(power, 4);
294  Serial.print(F(" W\n"));
295 
296  Serial.print(F("Max ADIN Power: "));
297  Serial.print(max_power, 4);
298  Serial.print(F(" W\n"));
299 
300  Serial.print(F("Min ADIN Power: "));
301  Serial.print(min_power, 4);
302  Serial.print(F(" W\n"));
303  }
304 
305  uint16_t current_code, max_current_code, min_current_code;
309 
310  float current, max_current, min_current;
311  current = LTC2945_code_to_current(current_code, resistor, LTC2945_DELTA_SENSE_lsb);
312  max_current = LTC2945_code_to_current(max_current_code, resistor, LTC2945_DELTA_SENSE_lsb);
313  min_current = LTC2945_code_to_current(min_current_code, resistor, LTC2945_DELTA_SENSE_lsb);
314 
315  Serial.print(F("\n****Current: "));
316  Serial.print(current, 4);
317  Serial.print(F(" A\n"));
318 
319  Serial.print(F("Max Current: "));
320  Serial.print(max_current, 4);
321  Serial.print(F(" A\n"));
322 
323  Serial.print(F("Min Current: "));
324  Serial.print(min_current, 4);
325  Serial.print(F(" A\n"));
326 
327  uint16_t VIN_code, max_VIN_code, min_VIN_code;
331 
332  float VIN, max_VIN, min_VIN;
334  max_VIN = LTC2945_VIN_code_to_voltage(max_VIN_code, LTC2945_VIN_lsb);
335  min_VIN = LTC2945_VIN_code_to_voltage(min_VIN_code, LTC2945_VIN_lsb);
336 
337  Serial.print(F("\n****VIN: "));
338  Serial.print(VIN, 4);
339  Serial.print(F(" V\n"));
340 
341  Serial.print(F("Max VIN: "));
342  Serial.print(max_VIN, 4);
343  Serial.print(F(" V\n"));
344 
345  Serial.print(F("Min VIN: "));
346  Serial.print(min_VIN, 4);
347  Serial.print(F(" V\n"));
348 
349  uint16_t ADIN_code, max_ADIN_code, min_ADIN_code;
353 
354  float ADIN, max_ADIN, min_ADIN;
356  max_ADIN = LTC2945_ADIN_code_to_voltage(max_ADIN_code, LTC2945_ADIN_lsb);
357  min_ADIN = LTC2945_ADIN_code_to_voltage(min_ADIN_code, LTC2945_ADIN_lsb);
358 
359  Serial.print(F("\n****ADIN: "));
360  Serial.print(ADIN, 4);
361  Serial.print(F(" V\n"));
362 
363  Serial.print(F("Max ADIN: "));
364  Serial.print(max_ADIN, 4);
365  Serial.print(F(" V\n"));
366 
367  Serial.print(F("Min ADIN: "));
368  Serial.print(min_ADIN, 4);
369  Serial.print(F(" V\n"));
370  Serial.print(F("m-Main Menu\n\n"));
371  Serial.flush();
373  }
374  while (Serial.available() == false);
375  read_int(); // clears the Serial.available
376  return(ack);
377 }
378 
379 // DJE: Should user_command be passed as a pointer to allow 'm' option to break properly?
380 //! Snapshot Mode Menu
381 int8_t menu_2_snapshot_mode(int8_t VDD_or_SENSE_monitoring, //!< Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
382  int8_t ADIN_or_SENSE) //!< Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
383 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
384 {
385  int8_t ack = 0;
386  //! Print submenu
387  Serial.print(F("*************************\n\n"));
388  Serial.print(F("Snapshot Mode\n"));
389  Serial.print(F("1-Current\n"));
390  Serial.print(F("2-VIN\n"));
391 
392  Serial.print(F("3-ADIN\n"));
393  Serial.print(F("m-Main Menu\n"));
394  uint8_t user_command;
395  do
396  {
397  Serial.print(F("\n\nEnter a Command: "));
398  user_command = read_int();
399  if (user_command == 'm')
400  Serial.println("m");
401  else
402  {
403  Serial.println(user_command);
404  }
405  if (user_command != 'm')
406  {
407  Serial.print(F("*************************\n\n"));
408  Serial.print(F("Snapshot Mode\n"));
409  Serial.print(F("1-Current\n"));
410  Serial.print(F("2-VIN\n"));
411  Serial.print(F("3-ADIN\n"));
412  Serial.print(F("m-Main Menu\n"));
413  }
414  Serial.println();
415  switch (user_command)
416  {
417  case 1: // Current - Snapshot Mode
418  ack |= menu_2_snapshot_mode_menu_1_current(VDD_or_SENSE_monitoring, ADIN_or_SENSE);
419  break;
420 
421  case 2: // VIN - Snapshot Mode
423  break;
424 
425  case 3: // ADIN - Snapshot Mode
427  break;
428 
429  default:
430  if (user_command != 'm')
431  Serial.println("Incorrect Option");
432  break;
433  }
434  }
435  while (!((user_command == 'm') || (ack)));
436  return(ack);
437 }
438 
439 //! Current - Snapshot mode
440 int8_t menu_2_snapshot_mode_menu_1_current(int8_t VDD_or_SENSE_monitoring, //!< Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
441  int8_t ADIN_or_SENSE) //!< Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
442 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
443 {
444  int8_t ack = 0;
445  int8_t LTC2945_mode;
446  LTC2945_mode = LTC2945_DELTA_SENSE_SNAPSHOT;
447  if (ADIN_or_SENSE == 1) LTC2945_mode = LTC2945_mode | LTC2945_SENSE_MONITOR;
448  if (VDD_or_SENSE_monitoring == 1) LTC2945_mode = LTC2945_mode | LTC2945_SENSE_MULTIPLIER;
450 
451  uint8_t busy;
452  do
453  {
455  }
456  while (0x8 & busy);
457 
458  uint16_t current_code;
460 
461  float current;
462  current = LTC2945_code_to_current(current_code, resistor, LTC2945_DELTA_SENSE_lsb);
463  Serial.print(F("Current: "));
464  Serial.print(current, 4);
465  Serial.print(F(" A"));
466  return(ack);
467 }
468 
469 //! VIN - Snapshot Mode
471 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
472 {
473  int8_t ack = 0;
475 
476  uint8_t busy;
477  do
478  {
480  }
481  while (0x8 & busy);
482 
483  uint16_t VIN_code;
485 
486  float VIN;
488  Serial.print(F("VIN: "));
489  Serial.print(VIN, 4);
490  Serial.print(F(" V"));
491  return(ack);
492 }
493 
494 //! ADIN - Snapshot Mode
496 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
497 {
498  int8_t ack = 0;
499 
501 
502  uint8_t busy;
503  do
504  {
506  }
507  while (0x8 & busy);
508 
509  uint16_t ADIN_code;
511 
512  float ADIN;
514  Serial.print(F("ADIN: "));
515  Serial.print(ADIN, 4);
516  Serial.print(F(" V"));
517  return(ack);
518 }
519 
520 //! Alert Menu
521 int8_t menu_3_alert(int8_t ADIN_or_SENSE) //!< Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
522 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
523 {
524  int8_t ack = 0;
525  int8_t user_command;
526  do
527  {
528  Serial.print(F("*************************\n\n"));
529  Serial.print(F("1-Set Power Alerts\n"));
530  Serial.print(F("2-Set Current Alerts\n"));
531  Serial.print(F("3-Set VIN Alerts\n"));
532  Serial.print(F("4-Set ADIN Alerts\n"));
533  Serial.print(F("5-Enable and Disable Alerts\n"));
534  Serial.print(F("6-Read and Clear Alerts\n"));
535  Serial.print(F("7-Store Alert Settings to EEPROM\n"));
536  Serial.print(F("m-Main Menu\n\n"));
537  Serial.print(F("Enter a command: "));
538 
539  user_command = read_int();
540  if (user_command == 'm')
541  Serial.println("m");
542  else
543  Serial.println(user_command);
544  Serial.println();
545  switch (user_command)
546  {
547  case 1:
548  ack |= menu_3_alert_menu_1_set_power_alerts(ADIN_or_SENSE); // Set Power Alerts
549  break;
550 
551  case 2:
552  ack |= menu_3_alert_menu_2_set_current_alerts(); // Set Current Alerts
553  break;
554 
555  case 3:
556  ack |= menu_3_alert_menu_3_set_vin_alerts(); // Set VIN Alerts
557  break;
558 
559  case 4:
560  ack |= menu_3_alert_menu_4_set_adin_alerts(); // Set ADIN Alerts
561  break;
562 
563  case 5:
564  ack |= menu_3_alert_menu_5_enable_disable_alerts(); // Enable/Disable Alerts
565  break;
566 
567  case 6:
568  ack |= menu_3_alert_menu_6_read_clear_alerts(); // Read Alerts
569  break;
570 
571  case 7:
572  // Read current min/max alarm and store to EEPROM
574  break;
575  default:
576  if (user_command != 'm')
577  Serial.println("Incorrect Option");
578  break;
579  }
580  }
581  while (!((user_command == 'm') || (ack)));
582  return(ack);
583 }
584 
585 //! Set Power Alerts
586 int8_t menu_3_alert_menu_1_set_power_alerts(int8_t ADIN_or_SENSE) //!< Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
587 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
588 {
589  int8_t ack = 0;
590  Serial.print(F("Enter Max Power Threshold:"));
591 
592  float max_power_threshold;
593  max_power_threshold = read_float();
594  Serial.println(max_power_threshold, 4);
595 
596  int32_t max_power_threshold_code;
597  if (ADIN_or_SENSE == 1)
598  max_power_threshold_code = (max_power_threshold / LTC2945_Power_lsb) * resistor;
599  else
600  max_power_threshold_code = (max_power_threshold / LTC2945_ADIN_DELTA_SENSE_lsb) * resistor;
601 
603 
604  Serial.print(F("Enter Min Power Threshold:"));
605 
606  float min_power_threshold;
607  min_power_threshold = read_float();
608  Serial.println(min_power_threshold, 4);
609 
610  int32_t min_power_threshold_code;
611  if (ADIN_or_SENSE == 1)
612  min_power_threshold_code = (min_power_threshold / LTC2945_Power_lsb) * resistor;
613  else
614  min_power_threshold_code = min_power_threshold / LTC2945_ADIN_DELTA_SENSE_lsb * resistor;
616  return(ack);
617 }
618 
619 //! Set Current Alerts
621 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
622 {
623  int8_t ack = 0;
624  Serial.print(F("Enter Max Current Threshold:"));
625 
626  float max_current_threshold;
627  max_current_threshold = read_float();
628  Serial.println(max_current_threshold, 4);
629 
630  int32_t max_current_threshold_code;
631  max_current_threshold_code = (max_current_threshold / LTC2945_DELTA_SENSE_lsb) * resistor;
632 
633  ack |= LTC2945_write_16_bits(LTC2945_I2C_ADDRESS, LTC2945_MAX_DELTA_SENSE_THRESHOLD_MSB_REG, (max_current_threshold_code << 4));
634 
635  Serial.print(F("Enter Min Current Threshold:"));
636 
637  float min_current_threshold;
638  min_current_threshold = read_float();
639  Serial.println(min_current_threshold, 4);
640 
641  int32_t min_current_threshold_code;
642  min_current_threshold_code = (min_current_threshold / LTC2945_DELTA_SENSE_lsb) * resistor;
643  ack |= LTC2945_write_16_bits(LTC2945_I2C_ADDRESS, LTC2945_MIN_DELTA_SENSE_THRESHOLD_MSB_REG, (min_current_threshold_code << 4));
644  return(ack);
645 }
646 
647 //! Set VIN Alerts
649 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
650 {
651  int8_t ack = 0;
652  Serial.print(F("Enter Max VIN Threshold:"));
653 
654  float max_VIN_threshold;
655  max_VIN_threshold = read_float();
656  Serial.println(max_VIN_threshold, 4);
657 
658  int32_t max_VIN_threshold_code;
659  max_VIN_threshold_code = max_VIN_threshold / LTC2945_VIN_lsb;
660  ack |= LTC2945_write_16_bits(LTC2945_I2C_ADDRESS, LTC2945_MAX_VIN_THRESHOLD_MSB_REG, (max_VIN_threshold_code << 4));
661 
662  Serial.print(F("Enter Min VIN Threshold:"));
663 
664  float min_VIN_threshold;
665  min_VIN_threshold = read_float();
666  Serial.println(min_VIN_threshold, 4);
667 
668  int32_t min_VIN_threshold_code;
669  min_VIN_threshold_code = min_VIN_threshold / LTC2945_VIN_lsb;
670  ack |= LTC2945_write_16_bits(LTC2945_I2C_ADDRESS, LTC2945_MIN_VIN_THRESHOLD_MSB_REG, (min_VIN_threshold_code << 4));
671  return(ack);
672 }
673 
674 //! Set ADIN Alerts
676 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
677 {
678  int8_t ack = 0;
679  Serial.print(F("Enter Max ADIN Threshold:"));
680 
681  float max_ADIN_threshold;
682  max_ADIN_threshold = read_float();
683  Serial.println(max_ADIN_threshold, 4);
684 
685  int32_t max_ADIN_threshold_code;
686  max_ADIN_threshold_code = max_ADIN_threshold / LTC2945_ADIN_lsb;
687  ack |= LTC2945_write_16_bits(LTC2945_I2C_ADDRESS, LTC2945_MAX_ADIN_THRESHOLD_MSB_REG, (max_ADIN_threshold_code << 4));
688 
689  Serial.print(F("Enter Min ADIN Threshold:"));
690 
691  float min_ADIN_threshold;
692  min_ADIN_threshold = read_float();
693  Serial.println(min_ADIN_threshold, 4);
694 
695  int32_t min_ADIN_threshold_code;
696  min_ADIN_threshold_code = min_ADIN_threshold / LTC2945_ADIN_lsb;
697  ack |= LTC2945_write_16_bits(LTC2945_I2C_ADDRESS, LTC2945_MIN_ADIN_THRESHOLD_MSB_REG, (min_ADIN_threshold_code << 4));
698  return(ack);
699 }
700 
701 //! Enable/Disable Alerts
703 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
704 {
705  int8_t ack = 0;
706  uint8_t user_command;
707  do
708  {
709  Serial.print(F("*************************\n\n"));
710  Serial.print(F("1-Enable/Disable Power Alerts\n"));
711  Serial.print(F("2-Enable/Disable Current Alerts\n"));
712  Serial.print(F("3-Enable/Disable VIN Alerts\n"));
713  Serial.print(F("4-Enable/Disable ADIN Alerts\n"));
714  Serial.print(F("m-Alert Menu\n\n"));
715  Serial.print(F("Enter a command:"));
716  user_command = read_int();
717  if (user_command == 'm')
718  Serial.println('m');
719  else
720  Serial.println(user_command);
721  if (!(user_command == 0))
722  {
723  Serial.print(F("1-Enable, 2-Disable\n"));
724  }
725  switch (user_command)
726  {
727  case 1:
728  // ENABLE/Disable Power Alerts
729  Serial.print(F(" Max Power:"));
730  user_command = read_int();
731  if ((user_command > 2) || (user_command < 0))
732  user_command = 2;
733  Serial.println(user_command);
734  if (user_command == 1)
736  else
738 
739  Serial.print(F(" Min Power:"));
740  user_command = read_int();
741  if ((user_command > 2) || (user_command < 0))
742  user_command = 2;
743  Serial.println(user_command);
744  if (user_command == 1)
746  else
748  break;
749  case 2:
750  // ENABLE/Disable Current Alerts
751  Serial.print(F(" Max Current:"));
752  user_command = read_int();
753  if ((user_command > 2) || (user_command < 0))
754  user_command = 2;
755  Serial.println(user_command);
756  if (user_command == 1)
758  else
760 
761  Serial.print(F(" Min Current:"));
762  user_command = read_int();
763  if ((user_command > 2) || (user_command < 0))
764  user_command = 2;
765  Serial.println(user_command);
766  if (user_command == 1)
768  else
770  break;
771  case 3:
772  // ENABLE/Disable VIN Alerts
773  Serial.print(F(" Max VIN:"));
774  user_command = read_int();
775  if ((user_command > 2) || (user_command < 0))
776  user_command = 2;
777  Serial.println(user_command);
778  if (user_command == 1)
780  else
782 
783  Serial.print(F(" Min VIN:"));
784  user_command = read_int();
785  if ((user_command > 2) || (user_command < 0))
786  user_command = 2;
787  Serial.println(user_command);
788  if (user_command == 1)
790  else
792  break;
793  case 4:
794  // ENABLE/Disable ADIN Alerts
795  Serial.print(F(" Max ADIN:"));
796  user_command = read_int();
797  if ((user_command > 2) || (user_command < 0))
798  user_command = 2;
799  Serial.println(user_command);
800  if (user_command == 1)
802  else
804 
805  Serial.print(F(" Min ADIN:"));
806  user_command = read_int();
807  if ((user_command > 2) || (user_command < 0))
808  user_command = 2;
809  Serial.println(user_command);
810  if (user_command == 1)
812  else
814  break;
815  default:
816  if (user_command != 'm')
817  Serial.println("Incorrect Option");
818  break;
819  }
820  }
821  while (user_command != 'm');
823  return(ack);
824 }
825 
826 //! Read Alerts and Clear Alerts
828 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
829 {
830  int8_t ack = 0;
832  if (alert_code & 0x80) Serial.print(F("Power Overvalue Fault Occurred\n\n"));
833  if (alert_code & 0x40) Serial.print(F("Power Undervalue Fault Occurred\n"));
834  if (alert_code & 0x20) Serial.print(F("Current Overvalue Fault Occurred\n"));
835  if (alert_code & 0x10) Serial.print(F("Current Undervalue Fault Occurred\n"));
836  if (alert_code & 0x08) Serial.print(F("VIN Overvalue Fault Occurred\n"));
837  if (alert_code & 0x04) Serial.print(F("VIN Undervalue Fault Occurred\n"));
838  if (alert_code & 0x02) Serial.print(F("ADIN Overvalue Fault Occurred\n"));
839  if (alert_code & 0x01) Serial.print(F("ADIN Undervalue Fault Occurred\n"));
840  if (!alert_code) Serial.print(F("No Alarms Were Present\n"));
841  return(ack);
842 }
843 
844 //! Shutdown Down Mode
846 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
847 {
848  int8_t ack = 0;
849 
851  Serial.print(F("LTC2945 Has Been Shutdown\n"));
852  return(ack);
853 }
854 
855 //! change Settings
856 void menu_5_settings(int8_t *VDD_or_SENSE_monitoring, //!< Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
857  int8_t *ADIN_or_SENSE, //!< Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
858  float *scale) //!< Stores division ratio for resistive divider on ADIN pin.
859 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
860 {
861  Serial.print(F("VIN Monitor"));
862  Serial.print(F("\n0-VDD or 1-Sense+ Monitoring (Default=1)\n\n"));
863  *VDD_or_SENSE_monitoring = read_int();
864  if ((*VDD_or_SENSE_monitoring < 0) || (*VDD_or_SENSE_monitoring > 1))
865  *VDD_or_SENSE_monitoring = 1;
866  Serial.println(*VDD_or_SENSE_monitoring);
867  Serial.print(F("Multiplier Select\n"));
868  Serial.print(F("0-ADIN or 1-SENS+/VDD (Default=1)"));
869  *ADIN_or_SENSE = read_int();
870  if ((*ADIN_or_SENSE < 0) || (*ADIN_or_SENSE > 1))
871  *ADIN_or_SENSE = 1;
872  if (*ADIN_or_SENSE == 0)
873  {
874  Serial.print(F("\nresistor divider needs to be set such that New FS is 2.048v to ADIN\n"));
875  Serial.print(F("Enter in new full scale input voltage:"));
876  float user_float;
877  user_float = read_float();
878  *scale = user_float / 2.048;
879  Serial.println(user_float);
880  Serial.print(F("Scale:"));
881  Serial.println(*scale);
882  }
883 }
884 
885 //! Clear Min/Max
887 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
888 {
889  int8_t ack = 0;
890 
899  Serial.println();
900  return(ack);
901 }
902 
903 //! Used to manipulate EEPROM data.
904 union eeprom_data_union
905 {
906  struct data_struct_type //! EEPROM data structure
907  {
908  int16_t cal_key; //!< The key that keeps track of the calibration
909  uint8_t alert; //!< Used to store the alert settings
910  int32_t max_power_threshold; //!< Used to store max power alert settings
911  int32_t min_power_threshold; //!< Used to store min power alert settings
912  uint16_t max_delta_sense_thresh; //!< Used to store max delta sense alert settings
913  uint16_t min_delta_sense_thresh; //!< Used to store min delta sense alert settings
914  uint16_t max_Vin_thresh; //!< Used to store max Vin alert settings
915  uint16_t min_Vin_thresh; //!< Used to store min Vin alert settings
916  uint16_t max_adin_thresh; //!< Used to store adin max alert settings
917  uint16_t min_adin_thresh; //!< Used to store adin min alert settings
918  } data_struct; //!< Name of structure
919 
920  char byte_array[sizeof(data_struct_type)]; //!< Array used to store the structure
921 };
922 
923 //! Read the alert settings from EEPROM
925 //! @return Return 1 if successful, 0 if not
926 {
927  int16_t cal_key;
928 
929  // Read the cal key from the EEPROM
931 
932  if (cal_key == EEPROM_CAL_KEY)
933  {
934  // Calibration has been stored, read thresholds
935 
937 
939  alert_code = eeprom.data_struct.alert; // Global variable used to communicate with loop()
940 
950 
951  Serial.println("Alert Settings Restored");
952  return(1);
953  }
954  else
955  {
956  Serial.println("Alert Settings not found");
957  return(0);
958  }
959 }
960 
961 //! Store the alert settings to the EEPROM
963 {
965 
967 
977 
979 
980  Serial.println("Alert Settings Stored to EEPROM");
981 }
982 
#define LTC2945_ENABLE_MAX_POWER_ALERT
Definition: LTC2945.h:346
uint8_t eeprom_read_byte_array(uint8_t i2c_address, char *data, uint16_t address, uint8_t num_bytes)
Read a data byte at address from the EEPROM with i2c_address.
int32_t min_power_threshold
Used to store min power alert settings.
Definition: DC1697A.ino:911
EEPROM data structure.
Definition: DC2692A.ino:162
static int8_t menu_6_clear_min_max()
Clear Min/Max.
Definition: DC1697A.ino:886
#define LTC2945_MIN_ADIN_MSB_RESET
Definition: LTC2945.h:344
uint16_t min_Vin_thresh
Used to store min Vin alert settings.
Definition: DC1697A.ino:915
static void store_alert_settings()
Store the alert settings to the EEPROM.
Definition: DC1697A.ino:962
uint8_t eeprom_read_int16(uint8_t i2c_address, int16_t *read_data, uint16_t address)
Read the two byte integer data from the EEPROM starting at address.
#define LTC2945_DELTA_SENSE_SNAPSHOT
Definition: LTC2945.h:288
#define VIN
uint8_t alert
Used to store the alert settings.
Definition: DC1697A.ino:909
uint16_t min_adin_thresh
Used to store adin min alert settings.
Definition: DC1697A.ino:917
unsigned char user_command
#define EEPROM_I2C_ADDRESS
static int8_t menu_2_snapshot_mode(int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE)
Snapshot Mode Menu.
Definition: DC1697A.ino:381
#define LTC2945_DISABLE_MAX_ADIN_ALERT
Definition: LTC2945.h:363
static void print_prompt()
Print the Prompt.
Definition: DC1697A.ino:222
#define LTC2945_MIN_DELTA_SENSE_THRESHOLD_MSB_REG
Definition: LTC2945.h:251
int8_t LTC2945_write_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t code)
Write a 16-bit code to the LTC2945.
Definition: LTC2945.cpp:88
float LTC2945_code_to_ADIN_power(int32_t adc_code, float resistor, float LTC2945_ADIN_DELTA_SENSE_lsb)
Calculate the LTC2945 power with the ADIN.
Definition: LTC2945.cpp:200
#define LTC2945_MAX_ADIN_MSB_REG
Definition: LTC2945.h:267
#define LTC2945_ENABLE_MIN_DELTA_SENSE_ALERT
Definition: LTC2945.h:352
#define LTC2945_DISABLE_MIN_VIN_ALERT
Definition: LTC2945.h:359
int16_t cal_key
The key that keeps track of the calibration.
Definition: DC2692A.ino:164
#define LTC2945_DISABLE_MIN_POWER_ALERT
Definition: LTC2945.h:349
#define LTC2945_VIN_SNAPSHOT
Definition: LTC2945.h:289
#define CONTINUOUS_MODE_DISPLAY_DELAY
The delay between readings.
Definition: DC1697A.ino:109
#define LTC2945_CONTROL_REG
Definition: LTC2945.h:221
float LTC2945_code_to_current(uint16_t adc_code, float resistor, float LTC2945_DELTA_SENSE_lsb)
Calculate the LTC2945 current with a sense resistor.
Definition: LTC2945.cpp:180
Header File for Linduino Libraries and Demo Code.
#define LTC2945_I2C_ADDRESS
Definition: LTC2945.h:153
int8_t LTC2945_read_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 16-bit adc_code from LTC2945.
Definition: LTC2945.cpp:137
const float LTC2945_ADIN_lsb
Typical ADIN lsb weight in volts.
Definition: DC1697A.ino:112
static int8_t menu_3_alert_menu_4_set_adin_alerts()
Set ADIN Alerts.
Definition: DC1697A.ino:675
#define LTC2945_VIN_MSB_REG
Definition: LTC2945.h:254
static int8_t menu_2_snapshot_mode_menu_1_current(int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE)
Current - Snapshot mode.
Definition: DC1697A.ino:440
uint8_t eeprom_write_byte_array(uint8_t i2c_address, char data[], uint16_t address, uint8_t num_bytes)
Write the data byte array to the EEPROM with i2c_address starting at EEPROM address.
#define LTC2945_MIN_VIN_MSB_REG
Definition: LTC2945.h:258
#define LTC2945_FAULT_CoR_REG
Definition: LTC2945.h:225
#define LTC2945_MAX_POWER_THRESHOLD_MSB2_REG
Definition: LTC2945.h:236
int8_t LTC2945_read(uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
Reads an 8-bit adc_code from LTC2945.
Definition: LTC2945.cpp:112
uint16_t max_delta_sense_thresh
Used to store max delta sense alert settings.
Definition: DC1697A.ino:912
#define LTC2945_MAX_POWER_MSB2_REG
Definition: LTC2945.h:230
#define LTC2945_SENSE_MULTIPLIER
Definition: LTC2945.h:334
#define LTC2945_MAX_VIN_MSB_RESET
Definition: LTC2945.h:341
static void setup()
Initialize Linduino.
Definition: DC1697A.ino:128
#define LTC2945_ENABLE_MIN_ADIN_ALERT
Definition: LTC2945.h:362
#define LTC2945_POWER_MSB2_REG
Definition: LTC2945.h:227
#define LTC2945_CONTINUOUS_MODE
Definition: LTC2945.h:330
#define LTC2945_ADIN_MSB_REG
Definition: LTC2945.h:265
#define LTC2945_MIN_ADIN_THRESHOLD_MSB_REG
Definition: LTC2945.h:273
static int8_t demo_board_connected
Set to 1 if the board is connected.
Definition: DC1697A.ino:124
static void loop()
Repeats Linduino loop.
Definition: DC1697A.ino:150
int8_t LTC2945_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
Write an 8-bit code to the LTC2945.
Definition: LTC2945.cpp:76
#define LTC2945_MIN_VIN_MSB_RESET
Definition: LTC2945.h:342
static int8_t menu_3_alert(int8_t ADIN_or_SENSE)
Alert Menu.
Definition: DC1697A.ino:521
float LTC2945_code_to_power(int32_t adc_code, float resistor, float LTC2945_Power_lsb)
Calculate the LTC2945 power.
Definition: LTC2945.cpp:190
#define LTC2945_MIN_DELTA_SENSE_MSB_RESET
Definition: LTC2945.h:340
uint16_t max_Vin_thresh
Used to store max Vin alert settings.
Definition: DC1697A.ino:914
static int8_t menu_3_alert_menu_2_set_current_alerts()
Set Current Alerts.
Definition: DC1697A.ino:620
static int8_t menu_3_alert_menu_1_set_power_alerts(int8_t ADIN_or_SENSE)
Set Power Alerts.
Definition: DC1697A.ino:586
#define LTC2945_MIN_POWER_THRESHOLD_MSB2_REG
Definition: LTC2945.h:239
#define LTC2945_MAX_ADIN_MSB_RESET
Definition: LTC2945.h:343
QuikEval EEPROM Library.
#define LTC2945_DELTA_SENSE_MSB_REG
Definition: LTC2945.h:243
const float LTC2945_Power_lsb
Typical POWER lsb weight in V^2.
Definition: DC1697A.ino:115
static void print_title()
Print the title block.
Definition: DC1697A.ino:209
#define LTC2945_ENABLE_MAX_DELTA_SENSE_ALERT
Definition: LTC2945.h:351
#define LTC2945_MIN_ADIN_MSB_REG
Definition: LTC2945.h:269
Used to manipulate EEPROM data.
Definition: DC2692A.ino:160
#define LTC2945_ENABLE_MAX_ADIN_ALERT
Definition: LTC2945.h:361
float LTC2945_ADIN_code_to_voltage(uint16_t adc_code, float LTC2945_ADIN_lsb)
Calculate the LTC2945 ADIN voltage.
Definition: LTC2945.cpp:171
#define EEPROM_CAL_STATUS_ADDRESS
#define LTC2945_ENABLE_MAX_VIN_ALERT
Definition: LTC2945.h:356
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
static int8_t menu_3_alert_menu_6_read_clear_alerts()
Read Alerts and Clear Alerts.
Definition: DC1697A.ino:827
static int8_t menu_3_alert_menu_3_set_vin_alerts()
Set VIN Alerts.
Definition: DC1697A.ino:648
#define LTC2945_SHUTDOWN_MODE
Definition: LTC2945.h:331
float LTC2945_VIN_code_to_voltage(uint16_t adc_code, float LTC2945_VIN_lsb)
Calculate the LTC2945 VIN voltage.
Definition: LTC2945.cpp:162
#define LTC2945_MIN_POWER_MSB2_RESET
Definition: LTC2945.h:338
#define LTC2945_DISABLE_MIN_ADIN_ALERT
Definition: LTC2945.h:364
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
int32_t max_power_threshold
Used to store max power alert settings.
Definition: DC1697A.ino:910
const float resistor
resistor value on demo board
Definition: DC1697A.ino:118
#define LTC2945_DISABLE_MAX_VIN_ALERT
Definition: LTC2945.h:358
static int8_t menu_1_continuous_mode(int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE, float scale)
Continuous Mode.
Definition: DC1697A.ino:234
uint16_t max_adin_thresh
Used to store adin max alert settings.
Definition: DC1697A.ino:916
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
#define LTC2945_MAX_DELTA_SENSE_MSB_REG
Definition: LTC2945.h:245
const float LTC2945_ADIN_DELTA_SENSE_lsb
Typical sense lsb weight in V^2 *ADIN_lsb * DELTA_SENSE_lsb.
Definition: DC1697A.ino:116
static void menu_5_settings(int8_t *VDD_or_SENSE_monitoring, int8_t *ADIN_or_SENSE, float *scale)
change Settings
Definition: DC1697A.ino:856
#define LTC2945_MAX_VIN_MSB_REG
Definition: LTC2945.h:256
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
const float LTC2945_VIN_lsb
Typical VIN lsb weight in volts.
Definition: DC1697A.ino:114
eeprom_data_union eeprom
Definition: DC2692A.ino:177
int32_t read_int()
static int8_t restore_alert_settings()
Read the alert settings from EEPROM.
Definition: DC1697A.ino:924
#define LTC2945_MAX_DELTA_SENSE_THRESHOLD_MSB_REG
Definition: LTC2945.h:249
float read_float()
#define LTC2945_ADIN_SNAPSHOT
Definition: LTC2945.h:290
char byte_array[sizeof(data_struct_type)]
Array used to store the structure.
Definition: DC2692A.ino:174
static int8_t menu_4_shutdown()
Shutdown Down Mode.
Definition: DC1697A.ino:845
uint16_t min_delta_sense_thresh
Used to store min delta sense alert settings.
Definition: DC1697A.ino:913
#define LTC2945_DISABLE_MAX_POWER_ALERT
Definition: LTC2945.h:348
#define LTC2945_DISABLE_MAX_DELTA_SENSE_ALERT
Definition: LTC2945.h:353
int8_t LTC2945_read_12_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 12-bit adc_code from LTC2945.
Definition: LTC2945.cpp:123
static int8_t menu_2_snapshot_mode_menu_2_vin()
VIN - Snapshot Mode.
Definition: DC1697A.ino:470
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
Definition: LT_I2C.cpp:394
#define LTC2945_MAX_POWER_MSB2_RESET
Definition: LTC2945.h:337
const float LTC2945_DELTA_SENSE_lsb
Typical Delta lsb weight in volts.
Definition: DC1697A.ino:113
int8_t LTC2945_read_24_bits(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code)
Reads a 24-bit adc_code from LTC2945.
Definition: LTC2945.cpp:148
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
Definition: LT_I2C.cpp:401
#define LTC2945_MAX_DELTA_SENSE_MSB_RESET
Definition: LTC2945.h:339
#define LTC2945_ALERT_REG
Definition: LTC2945.h:222
static uint16_t current
the current measurement from the LTC3335&#39;s counter test mode.
Definition: DC2343A.ino:114
struct eeprom_data_union::data_struct_type data_struct
Name of structure.
#define LTC2945_MIN_VIN_THRESHOLD_MSB_REG
Definition: LTC2945.h:262
LTC2945: 12-Bit Wide Range Power Monitor.
static uint8_t alert_code
Value stored or read from ALERT register.
Definition: DC1697A.ino:125
const char ack_error[]
Error message.
Definition: DC1697A.ino:121
#define LTC2945_MAX_ADIN_THRESHOLD_MSB_REG
Definition: LTC2945.h:271
#define EEPROM_CAL_KEY
#define LTC2945_ENABLE_MIN_VIN_ALERT
Definition: LTC2945.h:357
static int8_t menu_3_alert_menu_5_enable_disable_alerts()
Enable/Disable Alerts.
Definition: DC1697A.ino:702
int8_t LTC2945_write_24_bits(uint8_t i2c_address, uint8_t adc_command, int32_t code)
Write a 24-bit code to the LTC2945.
Definition: LTC2945.cpp:98
#define LTC2945_MAX_VIN_THRESHOLD_MSB_REG
Definition: LTC2945.h:260
#define LTC2945_ENABLE_MIN_POWER_ALERT
Definition: LTC2945.h:347
#define LTC2945_MIN_DELTA_SENSE_MSB_REG
Definition: LTC2945.h:247
#define LTC2945_DISABLE_MIN_DELTA_SENSE_ALERT
Definition: LTC2945.h:354
static int8_t menu_2_snapshot_mode_menu_3_ADIN()
ADIN - Snapshot Mode.
Definition: DC1697A.ino:495
#define LTC2945_MIN_POWER_MSB2_REG
Definition: LTC2945.h:233
#define LTC2945_SENSE_MONITOR
Definition: LTC2945.h:335