| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions | Macros | Variables
DC2024A.ino File Reference
Hot Swap » LTC4282: High Current Hot Swap Controller with I2C Compatible Monitoring and EEPROM

Linear Technology DC2024A Demonstration Board. More...

## Detailed Description

Linear Technology DC2024A Demonstration Board.

LTC4282: High Current Hotswap Controller with I2C Compatible Monitoring

    Setting the Alarm Thresholds:
        1. Select the Alarm option from the main menu.
        2. Then enter the minimum and maximum
           values.
        3. Once you are done, the new settings will be uploaded to the Device.
        4. Lastly, go back to the main menu and start reading values in Continuous Mode
           Note: Alerts only respond when conversion is done. Therefore, in continuous
           mode the alerts will constantly be updated.

    Reading and Clearing Alarm Faults:
        1. Select the View/Clear option from the main menu.
        2. Select the Clear Faults option. This will clear all faults.

    NOTES
     Setup:
     Set the terminal baud rate to 115200 and select the newline terminator.
     Requires a power supply.
     Refer to demo manual DC2024.

    USER INPUT DATA FORMAT:
     decimal : 1024
     hex     : 0x400
     octal   : 02000  (leading 0 "zero")
     binary  : B10000000000
     float   : 1024.0

http://www.linear.com/product/LTC4282

http://www.linear.com/product/LTC4282#demoboards

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
- Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file DC2024A.ino.

Go to the source code of this file.

## Functions
static void | print_title ()
| Print the title block. More...
static void | print_prompt ()
| Print the Prompt. More...
static int8_t | menu_1_continuous_mode (uint8_t CTRLREG_LSB, uint8_t ILIM_ADJUST, uint8_t CLK_DECIMATOR, float resistor)
| Continious Mode. More...
static int8_t | menu_2_alarm_thresholds (uint8_t CTRLREG_LSB)
| Continuous Mode Measurement. More...
static int8_t | menu_3_view_clear_faults ()
| Set Alarm Thresholds. More...
static int8_t | menu_3_view_faults_menu_1 ()
| View/Clear Faults. More...
static int8_t | menu_3_clear_faults_menu_2 ()
| View Faults. More...
static int8_t | menu_4_set_alert_registers ()
| Clear Faults. More...
static int8_t | menu_4_set_alert_msb_register_menu_1 ()
| Set Alert Registers. More...
static int8_t | menu_4_set_alert_lsb_register_menu_2 ()
| Set Alert MSB Register. More...
static int8_t | menu_5_settings (uint8_t *CTRLREG_MSB, uint8_t *CTRLREG_LSB, uint8_t *ILIM_ADJUST, uint8_t *CLK_DECIMATOR)
| Set Alert LSB Register. More...
static int8_t | menu_5_set_control_msb_register_menu_1 (uint8_t *CTRLREG_MSB)
| Settings. More...
static int8_t | menu_5_set_control_lsb_register_menu_2 (uint8_t *CTRLREG_LSB)
| Control MSB Register Menu. Configure OV/UV/OC Autoretry, FET ON, Mass Write Enable, ON/ENB, ON DELAY and ON FAULT MASK. More...
static uint8_t | menu_5_set_ilim_adjust_register_menu_3 (uint8_t *ILIM_ADJUST)
| Control LSB Register Menu. Configure Thresholds for POWER GOOD/OV/UV as well as for VIN MODE. More...
static uint8_t | menu_5_configure_GPIO_pins_menu_4 ()
static uint8_t | menu_5_write_register_values_to_EEPROM_menu_5 ()
| Configure State of GPIO Pins. Set GPIO1 as POWERGOOD/POWERBAD/GPO/GPI, OverFlow Alert, GPIO2 Stress Mode etc. More...
static uint8_t | menu_5_restore_register_values_from_EEPROM_menu_6 ()
| Write Values currently present in the Registers of the LTC4282 to the EEPROM. More...
static void | setup ()
| Initialize Linduino. More...
static void | loop ()

## Macros
#define | CONTINUOUS_MODE_DISPLAY_DELAY 2000
| Restore Values Currently Present in the EEPROM to the Registers of the LTC4282. More...

## Variables
const float | resistor = 343.7E-6
| resistor value on demo board More...
const int | CLK_DIVIDER = 0x08
| CLK Frequency. More...
static float | voltage_fullscale
| Fullscale Voltage Setting Shared Across Functions For Polling Routines. More...
const char | ack_error [] = "Error: No Acknowledge. Check I2C Address."
| Error message. More...
static int8_t | demo_board_connected
| Set to 1 if the board is connected. More...

## Function Documentation

## ◆ loop()

static void loop | ( | void |  | ) |
| static

Definition at line 173 of file DC2024A.ino.

## ◆ menu_1_continuous_mode()

static int8_t menu_1_continuous_mode | ( | uint8_t | CTRLREG_LSB,
|  | uint8_t | ILIM_ADJUST,
|  | uint8_t | CLK_DECIMATOR,
|  | float | resistor
| ) |  |
| static

Continious Mode.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Parameters

  CTRLREG_LSB | Control LSB Register Code. Necessary to Check which Voltage Mode the Part is set to. Configured in Settings Menu.
  ILIM_ADJUST | ILIM_ADJUST Register Code. Necessary to Check Whether the Part is Configured as a Coulomb Meter or an Energy Meter. Also Checks Resolution Mode. Configured in Settings Menu.
  CLK_DECIMATOR | CLK_DECIMATOR Register Code. Sets the Clock Rate for the Energy/Coulomb Meter. Configured in the Settings Menu.

Definition at line 232 of file DC2024A.ino.

## ◆ menu_2_alarm_thresholds()

static int8_t menu_2_alarm_thresholds | ( | uint8_t | CTRLREG_LSB | ) |
| static

Continuous Mode Measurement.

Set Alarm Thresholds.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Parameters

  CTRLREG_LSB | Control LSB Value Passed On to Determine VIN MODE For Proper Voltage Conversion Of Thresholds. )

Definition at line 491 of file DC2024A.ino.

## ◆ menu_3_clear_faults_menu_2()

static int8_t menu_3_clear_faults_menu_2 | ( |  | ) |
| static

View Faults.

Clear Faults.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 781 of file DC2024A.ino.

## ◆ menu_3_view_clear_faults()

static int8_t menu_3_view_clear_faults | ( |  | ) |
| static

Set Alarm Thresholds.

View Faults And Clear Them.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 629 of file DC2024A.ino.

## ◆ menu_3_view_faults_menu_1()

static int8_t menu_3_view_faults_menu_1 | ( |  | ) |
| static

View/Clear Faults.

View Faults.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 676 of file DC2024A.ino.

## ◆ menu_4_set_alert_lsb_register_menu_2()

static int8_t menu_4_set_alert_lsb_register_menu_2 | ( |  | ) |
| static

Set Alert MSB Register.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 966 of file DC2024A.ino.

## ◆ menu_4_set_alert_msb_register_menu_1()

static int8_t menu_4_set_alert_msb_register_menu_1 | ( |  | ) |
| static

Set Alert Registers.

Set Alert MSB Register.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 849 of file DC2024A.ino.

## ◆ menu_4_set_alert_registers()

static int8_t menu_4_set_alert_registers | ( |  | ) |
| static

Clear Faults.

Set Alert Register Menu.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 797 of file DC2024A.ino.

## ◆ menu_5_configure_GPIO_pins_menu_4()

static uint8_t menu_5_configure_GPIO_pins_menu_4 | ( |  | ) |
| static

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 1550 of file DC2024A.ino.

## ◆ menu_5_restore_register_values_from_EEPROM_menu_6()

static uint8_t menu_5_restore_register_values_from_EEPROM_menu_6 | ( |  | ) |
| static

Write Values currently present in the Registers of the LTC4282 to the EEPROM.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 1855 of file DC2024A.ino.

## ◆ menu_5_set_control_lsb_register_menu_2()

static int8_t menu_5_set_control_lsb_register_menu_2 | ( | uint8_t * | CTRLREG_LSB | ) |
| static

Control MSB Register Menu. Configure OV/UV/OC Autoretry, FET ON, Mass Write Enable, ON/ENB, ON DELAY and ON FAULT MASK.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Parameters

  CTRLREG_LSB | Local Control LSB Register to Change Through Settings. This is shared across multiple functions such as Continious mode.

Definition at line 1262 of file DC2024A.ino.

## ◆ menu_5_set_control_msb_register_menu_1()

static int8_t menu_5_set_control_msb_register_menu_1 | ( | uint8_t * | CTRLREG_MSB | ) |
| static

Settings.

Control MSB Register Menu. Configure OV/UV/OC Autoretry, FET ON, Mass Write Enable, ON/ENB, ON DELAY and ON FAULT MASK.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Parameters

  CTRLREG_MSB | Local Control MSB Register to Change Through Settings. This is shared across multiple functions such as Continious mode.

Definition at line 1148 of file DC2024A.ino.

## ◆ menu_5_set_ilim_adjust_register_menu_3()

static uint8_t menu_5_set_ilim_adjust_register_menu_3 | ( | uint8_t * | ILIM_ADJUST | ) |
| static

Control LSB Register Menu. Configure Thresholds for POWER GOOD/OV/UV as well as for VIN MODE.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Parameters

  ILIM_ADJUST | Local ILIM ADJUST Register to Change Through Settings. This is shared across multiple functions such as Continious mode.

Definition at line 1399 of file DC2024A.ino.

## ◆ menu_5_settings()

static int8_t menu_5_settings | ( | uint8_t * | CTRLREG_MSB,
|  | uint8_t * | CTRLREG_LSB,
|  | uint8_t * | ILIM_ADJUST,
|  | uint8_t * | CLK_DECIMATOR
| ) |  |
| static

Set Alert LSB Register.

Settings Menu.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Parameters

  CTRLREG_MSB | Local Control MSB Register to Change Through Settings. This is shared across multiple functions such as Continious mode.
  CTRLREG_LSB | Local Control LSB Register to Change Through Settings. This is shared across multiple functions such as Continious mode.
  ILIM_ADJUST | Local ILIM ADJUST Register to Change Through Settings. This is shared across multiple functions such as Continious mode.
  CLK_DECIMATOR | Local ILIM ADJUST Register to Change Through Settings. This is shared across multiple functions such as Continious mode.

Definition at line 1080 of file DC2024A.ino.

## ◆ menu_5_write_register_values_to_EEPROM_menu_5()

static uint8_t menu_5_write_register_values_to_EEPROM_menu_5 | ( |  | ) |
| static

Configure State of GPIO Pins. Set GPIO1 as POWERGOOD/POWERBAD/GPO/GPI, OverFlow Alert, GPIO2 Stress Mode etc.

Returns
  Returns the state of the acknowledge bit after the I2C write/read. 0 = acknowledge, 1 = no acknowledge.

Definition at line 1711 of file DC2024A.ino.

## ◆ print_prompt()

static void print_prompt | ( |  | ) |
| static

Print the Prompt.

Definition at line 139 of file DC2024A.ino.

## ◆ print_title()

static void print_title | ( | void |  | ) |
| static

Print the title block.

Definition at line 125 of file DC2024A.ino.

## ◆ setup()

static void setup | ( | void |  | ) |
| static

Initialize Linduino.

Definition at line 152 of file DC2024A.ino.

## Macro Definition Documentation

## ◆ CONTINUOUS_MODE_DISPLAY_DELAY

#define CONTINUOUS_MODE_DISPLAY_DELAY 2000

Restore Values Currently Present in the EEPROM to the Registers of the LTC4282.

The delay between readings

Definition at line 109 of file DC2024A.ino.

## Variable Documentation

## ◆ ack_error

const char ack_error[] = "Error: No Acknowledge. Check I2C Address."

Error message.

Definition at line 118 of file DC2024A.ino.

## ◆ CLK_DIVIDER

const int CLK_DIVIDER = 0x08

CLK Frequency.

Definition at line 112 of file DC2024A.ino.

## ◆ demo_board_connected

int8_t demo_board_connected
| static

Set to 1 if the board is connected.

Definition at line 121 of file DC2024A.ino.

## ◆ resistor

const float resistor = 343.7E-6

resistor value on demo board

Definition at line 111 of file DC2024A.ino.

## ◆ voltage_fullscale

float voltage_fullscale
| static

Fullscale Voltage Setting Shared Across Functions For Polling Routines.

Definition at line 113 of file DC2024A.ino.