LTC4245 - Multiple Supply Hot Swap Controller with I2C Compatible Monitoring

Features

  • Allows Safe Insertion into Live CompactPCITM or PCI ExpressTM Backplane
  • 8-Bit ADC Monitors Current and Voltage
  • I2CTM/SMBus Interface
  • dI/dt Controlled Soft Start
  • Simultaneous or Sequenced Turn-On
  • ±20V Absolute Maximum Rating for ±12V Supplies
  • No External Gate Capacitor Required
  • Dual-Level Circuit Breaker and Current Limit
  • Bus Precharge Output
  • Power Good Input with Timeout
  • Optional Latchoff or Autoretry After Faults
  • Alerts Host After Faults
  • Integrated LOCAL_PCI_RST# Logic
  • 36-Pin SSOP and 38-Pin (5mm × 7mm) QFN Packages

Typical Application

LTC4245 Typical Application
LTC4245 Typical Application

Description

The LTC4245 Hot Swap controller allows a board to be safely inserted and removed from a live backplane in multiple supply systems such as CompactPCI and PCI Express. Using four external N-channel pass transistors, the board supply voltages can be ramped up at an adjustable rate and in any desired sequence. An I2C interface and onboard ADC allow monitoring of board current, voltage and fault status for each supply.

The device features adjustable dI/dt controlled soft start and foldback limited inrush current. A dual-level timed circuit breaker and fast current limit protect each supply against overcurrent faults. A power good input with timeout allows a downstream supply monitor to disconnect the board supplies. The device can be configured to function without a –12V supply or with an extra 3.3V supply instead of a 5V supply.

The controller has additional features to interrupt the host when a fault has occurred, notify when output power is good, detect insertion of a load card and power-up in either the on or off state.

Packaging

CAD Symbols and Footprints: The downloadable Zip file below contains the schematic symbol and PCB footprints.

For complete and up to date package information and drawings, please refer to our packaging page

Part Number Package Code Temp Package
Drawing
RoHS
LTC4245CG#PBF SSOP-36 G C 05-08-1640 (G36) Yes
LTC4245CG#TRPBF SSOP-36 G C 05-08-1640 (G36) Yes
LTC4245CUHF#PBF 5x7 QFN-38 UHF C 05-08-1701 Yes
LTC4245CUHF#TRPBF 5x7 QFN-38 UHF C 05-08-1701 Yes
LTC4245IG#PBF SSOP-36 G I 05-08-1640 (G36) Yes
LTC4245IG#TRPBF SSOP-36 G I 05-08-1640 (G36) Yes
LTC4245IUHF#PBF 5x7 QFN-38 UHF I 05-08-1701 Yes
LTC4245IUHF#TRPBF 5x7 QFN-38 UHF I 05-08-1701 Yes


LTC4245 Package Drawing
LTC4245 Package Drawing

Order Info

  • Part numbers ending in PBF are lead free. Solder plated terminal finish (SnPb) versions are non-standard and special terms and conditions and pricing applies if available. Please contact LTC marketing for information.
  • Part numbers containing TR or TRM are shipped in tape and reel or 500 unit mini tape and reel, respectively
  • Please refer to our general ordering information or the product datasheet for more details

Package Variations and Pricing

Part Number Package Temp Price
(1-99)
Price
(1k)*
RoHS
LTC4245CG#PBF SSOP-36 C $8.71 $5.95 Yes
LTC4245CG#TRPBF SSOP-36 C $6.05 Yes
LTC4245CUHF#PBF 5x7 QFN-38 C $8.71 $5.95 Yes
LTC4245CUHF#TRPBF 5x7 QFN-38 C $6.05 Yes
LTC4245IG#PBF SSOP-36 I $10.45 $7.14 Yes
LTC4245IG#TRPBF SSOP-36 I $7.24 Yes
LTC4245IUHF#PBF 5x7 QFN-38 I $10.45 $7.14 Yes
LTC4245IUHF#TRPBF 5x7 QFN-38 I $7.24 Yes
Buy NowRequest Samples
* The USA list pricing shown is for BUDGETARY USE ONLY, shown in United States dollars (FOB USA per unit for the stated volume), and is subject to change. International prices may differ due to local duties, taxes, fees and exchange rates. For volume-specific price or delivery quotes, please contact your local Linear Technology sales office or authorized distributor.

Demo Boards

Linear Technology offers many demo boards free of charge to qualified customers. Contact your local sales office or distributor to inquire about a demo board. Certain demo boards are also available for sale via credit card on this website. Demo boards are for evaluation purposes only. It remains the customer’s responsibility to verify proper and reliable operation in the actual end application.

Part Number Description Price Documentation
DC985A-A/B LTC4245 Demoboard: Quad Hot Swap Controller with ADC and I2C (Requires DC590) $25.00
Buy Now

Companion Boards

Part Number Description Price Documentation
DC2026C Linduino One Isolated USB Demo Board: An Arduino- and QuikEval-Compatible Code Development Platform $75.00
DC590B Isolated USB Serial Controller for Linear Technology QuikEval-Compatible Demo Boards $50.00
Buy Now
Click here to view our complete list of demo boards

Applications

  • Live Board Insertion
  • CompactPCI, CompactPCI Express, CompactTCA, PCI Express Systems

Product Notifications

Please login to your MyLinear account for notifications of datasheet updates, new document releases and LTspice model announcements for your favorite products. If you do not have a MyLinear account you may Sign Up Now.

Forgot your password? Click here.
Need help? Email mylinear@linear.com with questions and comments.

Design Tools

Linduino

Linduino is an Arduino compatible platform for developing and distributing firmware libraries and code for SPI and I²C-compatible integrated circuits. The Linduino One board interfaces to more than 300 QuikEval demonstration cards, supporting a variety of product types including analog-to-digital converters (ADCs)digital-to-analog converters (DACs)power monitors, and more. Firmware libraries for individual devices are written in C and designed to be portable to a wide variety of processors and microcontrollers. Each library has a demonstration program that can be uploaded to the Linduino One platform to allow the circuit and software to be quickly and easily verified.

Click here for more information on Linduino

Code

Linduino is Linear Technology's Arduino compatible system for developing and distributing firmware libraries and example code for Linear Technology’s integrated circuits. The code below can be downloaded or copied and pasted into your project. Please visit the Linduino Home Page for demo board, manual and setup information.

This part is Code Supported: There is example code available for this part. The code below may rely on other drivers available in the full library.

Download LTC4245 - DC985A.ino

/*!
Linear Technology DC985A Demonstration Board.
LTC4245: Hot Swap Controller with I2C Compatible Monitoring

@verbatim

NOTES
  Setup:
   Set the terminal baud rate to 115200 and select the newline terminator. Provide
   the board with an external power supply of 12 V.   Ensure all jumpers on the
   demo board are installed in their default positions from the factory. Refer to
   Demo Manual DC985A.

   This program has options to measure voltage at ADIN pin (input voltage), SOURCE
   VOLTAGE (output voltage), and SENSE CURRENT (current through sense resisitor).
   There are also options to read and manipulate CONTROL register, ALERT register,
   and FAULT register.

   Mass write option can be achieved using Device Address = 0xBE. Refer to datasheet
   LTC4245.

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

@endverbatim

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

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

REVISION HISTORY
$Revision: 3489 $
$Date: 2015-05-26 11:02:02 -0700 (Tue, 26 May 2015) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

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

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, 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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

/*! @file
    @ingroup LTC4245
*/

// Headerfiles
#include <Arduino.h>
#include <stdint.h>
#include "Linduino.h"
#include "LT_I2C.h"
#include "LT_SPI.h"
#include "UserInterface.h"
#include "QuikEval_EEPROM.h"
#include <Wire.h>
#include <SPI.h>
#include "LTC4245.h"

// Function Declarations
void print_title();
void print_prompt();
int8_t main_menu_1_continuous_mode();
int8_t main_menu_2_read_and_clear_faults();
int8_t main_menu_3_send_ARA();
int8_t main_menu_4_manage_alerts();
int8_t main_menu_5_settings();
int8_t main_menu_6_read_all_registers();

//! Initialize Linduino
void setup()
{
  char demo_name[] = "DC985";             // Demo Board Name stored in QuikEval EEPROM
  quikeval_I2C_init();                    // Enable the I2C port
  quikeval_I2C_connect();
  Serial.begin(115200);                   // Initialize the serial port to the PC
  print_title();
  discover_DC985A(demo_name);
  print_prompt();
}

//! Repeats Linduino loop
void loop()
{
  if (1)
  {
    int8_t ack = 0;                            // I2C acknowledge indicator
    static uint8_t user_command;               // The user input command
    if (Serial.available())                     //! Do nothing if serial is not available
    {
      user_command = read_int();                //! Read user input command
      if (user_command != 'm')
        Serial.println(user_command);
      Serial.println();
      ack = 0;

      switch (user_command)                     //! Prints the appropriate submenu
      {
        case 1:
          ack |= main_menu_1_continuous_mode();       // continous mode
          break;
        case 2:
          ack |= main_menu_2_read_and_clear_faults(); // read and clear faults
          break;
        case 3:
          ack |= main_menu_3_send_ARA();// read address of alert
          break;
        case 4:
          ack |= main_menu_4_manage_alerts();         // manage alerts
          break;
        case 5:
          ack |= main_menu_5_settings();              // settings
          break;
        case 6:
          ack |= main_menu_6_read_all_registers();
          break;
        default:
          Serial.println("Incorrect Option");
          break;
      }

      print_prompt();
    }
  }
}

//! Read the ID string from the EEPROM and determine if the correct board is connected.
//! Returns 1 if successful, 0 if not successful
uint8_t discover_DC985A(char *demo_name)
{
  Serial.print(F("\nChecking EEPROM contents..."));
  read_quikeval_id_string(&ui_buffer[0]);
  ui_buffer[48] = 0;
  Serial.println(ui_buffer);

  if (!strcmp(demo_board.name, demo_name))
  {
    Serial.print("Demo Board Name: ");
    Serial.println(demo_board.name);
    Serial.print("Product Name: ");
    Serial.println(demo_board.product_name);
    if (demo_board.option)
    {
      Serial.print("Demo Board Option: ");
      Serial.println(demo_board.option);
    }
    Serial.println(F("Demo board connected"));
    Serial.println(F("\n\n\t\t\t\tPress Enter to Continue..."));
    read_int();
    return 1;
  }
  else
  {
    Serial.print("Demo board ");
    Serial.print(demo_name);
    Serial.print(" not found, \nfound ");
    Serial.print(demo_board.name);
    Serial.println(" instead. \nConnect the correct demo board, then press the reset button.");
    return 0;
  }
}

//! Print the title block
void print_title()
{
  Serial.println(F("\n*****************************************************************"));
  Serial.print(F("* DC874A Demonstration Program                                  *\n"));
  Serial.print(F("*                                                               *\n"));
  Serial.print(F("* This program demonstrates how to send and receive data from   *\n"));
  Serial.print(F("* LTC4245 Hot Swap Controller with I2C Compatible Monitoring    *\n"));
  Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
  Serial.print(F("*                                                               *\n"));
  Serial.print(F("*****************************************************************\n"));
}

//! Print the main menu
void print_prompt()
{
  Serial.print(F("\n\nMain Menu\n"));
  Serial.print(F("  1. Read current and voltage on continous mode\n"));
  Serial.print(F("  2. Read and clear faults\n"));
  Serial.print(F("  3. Request for alert response address (ARA)\n"));
  Serial.print(F("  4. Manage alerts\n"));
  Serial.print(F("  5. Settings\n"));
  Serial.print(F("  6. Read all registers\n\n"));
  Serial.print(F("Enter a command: "));
}

//! Function to read Rsense current, ADIN voltage and ADIN2 voltage in continous mode
int8_t main_menu_1_continuous_mode()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t choice;
  int8_t ack = 0;
  float sense_voltage, vin_voltage, vout_voltage;
  uint8_t sense_code, vin_code, vout_code;
  // Set voltage divider ratio to 1, for no resistor divider circuit.
  float vin_full_scale_12V = 14.025;
  float vin_full_scale_5V = 5.61;
  float vin_full_scale_3_3V = 3.825;
  float vin_full_scale_NEG12V = -14.025;

  float sense_full_scale_12V = (63.75/1000);
  float sense_full_scale_5V = (31.875/1000);
  float sense_full_scale_3_3V = (31.875/1000);
  float sense_full_scale_NEG12V = (-63.75/1000);

  float vout_full_scale_12V = 14.025;
  float vout_full_scale_5V = 5.61;
  float vout_full_scale_3_3V = 3.825;
  float vout_full_scale_NEG12V = -14.025;

  float SENSE_RESISTOR_12V = 0.008;
  float SENSE_RESISTOR_5V = 0.0035;
  float SENSE_RESISTOR_3_3V = 0.0025;
  float SENSE_RESISTOR_NEG12V = 0.004;

  Serial.println(F("1. Read in continous mode"));
  Serial.print(F("2. Read in snapshot mode"));
  choice = read_int();

  if (choice == 1)
  {
    do
    {
      Serial.print(F("********** Press Enter to Exit ***********\n\n"));
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_12VIN_REG, &vin_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_12VSENSE_REG, &sense_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_12VOUT_REG, &vout_code);

      vin_voltage = LTC4245_code_to_voltage(vin_code, vin_full_scale_12V);
      sense_voltage = LTC4245_code_to_voltage(sense_code, sense_full_scale_12V);
      vout_voltage = LTC4245_code_to_voltage(vout_code, vout_full_scale_12V);

      Serial.print(F("VIN: "));
      Serial.println(vin_voltage);
      Serial.print(F("SENSE VOLTAGE CODE: "));
      Serial.println(sense_code);
      Serial.print(F("SENSE CURRENT CALCULATED: "));
      Serial.println((sense_voltage / SENSE_RESISTOR_12V), 4);
      Serial.print(F("VOUT: "));
      Serial.println(vout_voltage);
      Serial.print("\n");


      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_5VIN_REG, &vin_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_5VSENSE_REG, &sense_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_5VOUT_REG, &vout_code);

      vin_voltage = LTC4245_code_to_voltage(vin_code, vin_full_scale_5V);
      sense_voltage = LTC4245_code_to_voltage(sense_code, sense_full_scale_5V);
      vout_voltage = LTC4245_code_to_voltage(vout_code, vout_full_scale_5V);

      Serial.print(F("VIN: "));
      Serial.println(vin_voltage);
      Serial.print(F("SENSE VOLTAGE CODE: "));
      Serial.println(sense_code);
      Serial.print(F("SENSE CURRENT CALCULATED: "));
      Serial.println((sense_voltage / SENSE_RESISTOR_5V), 4);
      Serial.print(F("VOUT: "));
      Serial.println(vout_voltage);
      Serial.print("\n");


      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_3_3VIN_REG, &vin_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_3_3VSENSE_REG, &sense_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_3_3VOUT_REG, &vout_code);

      vin_voltage = LTC4245_code_to_voltage(vin_code, vin_full_scale_3_3V);
      sense_voltage = LTC4245_code_to_voltage(sense_code, sense_full_scale_3_3V);
      vout_voltage = LTC4245_code_to_voltage(vout_code, vout_full_scale_3_3V);

      Serial.print(F("VIN: "));
      Serial.println(vin_voltage);
      Serial.print(F("SENSE VOLTAGE CODE: "));
      Serial.println(sense_code);
      Serial.print(F("SENSE CURRENT CALCULATED: "));
      Serial.println((sense_voltage / SENSE_RESISTOR_3_3V), 4);
      Serial.print(F("VOUT: "));
      Serial.println(vout_voltage);
      Serial.print("\n");


      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_VEEIN_REG, &vin_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_VEESENSE_REG, &sense_code);
      ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_VEEOUT_REG, &vout_code);

      vin_voltage = LTC4245_code_to_voltage(vin_code, vin_full_scale_NEG12V);
      sense_voltage = LTC4245_code_to_voltage(sense_code, sense_full_scale_NEG12V);
      vout_voltage = LTC4245_code_to_voltage(vout_code, vout_full_scale_NEG12V);

      Serial.print(F("VIN: "));
      Serial.println(vin_voltage);
      Serial.print(F("SENSE VOLTAGE CODE: "));
      Serial.println(sense_code);
      Serial.print(F("SENSE CURRENT CALCULATED: "));
      Serial.println((sense_voltage / SENSE_RESISTOR_NEG12V), 4);
      Serial.print(F("VOUT: "));
      Serial.println(vout_voltage);
      Serial.print("\n");
      delay(2000);
    }
    while (Serial.available()==false && ack== 0);
    if (Serial.available())
      read_int(); // clears the Serial.available()
  }

  return (ack);
}


//! Function to read and clear fault register
int8_t main_menu_2_read_and_clear_faults()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;

  uint8_t faults;
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_FAULT1_REG, &faults);
  if (faults != 0)
  {
    Serial.println(F("Faults Detected :"));
    if (faults & LTC4245_NEG12V_OVERCURRENT_FAULT)
      Serial.println(F("  Overcurrent Fault Occurred on –12V Supply"));
    if (faults & LTC4245_3_3V_OVERCURRENT_FAULT)
      Serial.println(F("  Overcurrent Fault Occurred on 3.3V Supply"));
    if (faults & LTC4245_5V_OVERCURRENT_FAULT)
      Serial.println(F("  Overcurrent Fault Occurred on 5V Supply"));
    if (faults & LTC4245_12V_OVERCURRENT_FAULT)
      Serial.println(F("  Overcurrent Fault Occurred on 12V Supply"));
    if (faults & LTC4245_NEG12V_UNDERVOLTAGE_FAULT)
      Serial.println(F("  Undervoltage Fault Occurred on –12V Supply"));
    if (faults & LTC4245_3_3V_UNDERVOLTAGE_FAULT)
      Serial.println(F("  Undervoltage Fault Occurred on 3.3V Supply"));
    if (faults & LTC4245_5V_UNDERVOLTAGE_FAULT)
      Serial.println(F("  Undervoltage Fault Occurred on 5V Supply"));
    if (faults & LTC4245_12V_UNDERVOLTAGE_FAULT)
      Serial.println(F("  Undervoltage Fault Occurred on 12V Supply"));
  }
  faults = 0;
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_FAULT2_REG, &faults);
  if (faults != 0)
  {
    if (faults & LTC4245_GPIO1_STATE_CHANGE)
      Serial.println(F("  GPIO1 Pin Changed State"));
    if (faults & LTC4245_BD_SEL_STATE_CHANGE)
      Serial.println(F("  BD_SEL# Pin Changed State"));
    if (faults & LTC4245_FET_SHORT_FAULT)
      Serial.println(F("  FET Short Detected on at Least One Supply"));
    if (faults & LTC4245_PGI_FAULT)
      Serial.println(F("  PGI Fault Occurred"));
    if (faults & LTC4245_NEG12V_POWER_BAD_FAULT)
      Serial.println(F("   –12V Power Bad When VEEOUT Went High"));
    if (faults & LTC4245_3_3V_POWER_BAD_FAULT)
      Serial.println(F("  3.3V Power Bad When 3VOUT Went Low"));
    if (faults & LTC4245_5V_POWER_BAD_FAULT)
      Serial.println(F("  5V Power Bad When 5VOUT Went Low"));
    if (faults & LTC4245_12V_POWER_BAD_FAULT)
      Serial.println(F("  12V Power Bad When 12VOUT Went Low"));
  }
  ack |= LTC4245_write(LTC4245_I2C_ADDRESS, LTC4245_FAULT1_REG, 0x00);
  ack |= LTC4245_write(LTC4245_I2C_ADDRESS, LTC4245_FAULT2_REG, 0x00);
  Serial.print(F("\nALL FAULTS CLEARED \n\n"));

  return (ack);
}

//! Function to send alert response (0001100) and read back the address of device that pulled ALERT pin low.
int8_t main_menu_3_send_ARA()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t address;
  ack |= LTC4245_ARA(LTC4245_I2C_ALERT_RESPONSE, &address);// send ARA
  Serial.print(F("  ALERT RESPONSE ADDRESS : 0x"));
  Serial.println(address,HEX);
  if (address == 0xFF && ack == 1)
  {
    ack = 0;
    Serial.print(F("  NO RESPONSE\n\n"));
  }
  return(ack);
}

//! Function to update alert register bits
int8_t main_menu_4_manage_alerts()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t alert_settings = 0;
  int8_t user_command;
  do
  {
    Serial.println(F("GPIO1 STATE CHANGE ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_GPIO1_STATE_CHANGE_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_GPIO1_STATE_CHANGE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("BD_SEL# STATE CHANGE ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_BD_SEL_STATE_CHANGE_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_BD_SEL_STATE_CHANGE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("FET SHORT ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_FET_SHORT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_FET_SHORT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("PGI FAULT ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_PGI_FAULT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_PGI_FAULT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("ALERT# Pin Open-Drain Output State"));
    Serial.println(F("  1. Pulls Low"));
    Serial.println(F("  2. High Impedance"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_ALERT_PRESENT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_ALERT_PRESENT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("POWER BAD ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_POWER_BAD_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_POWER_BAD_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("OVERCURRENT ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_OVERCURRENT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_OVERCURRENT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("UNDERVOLTAGE ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4245_UNDERVOLTAGE_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4245_UNDERVOLTAGE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    ack |= LTC4245_write(LTC4245_I2C_ADDRESS, LTC4245_ALERT_REG, alert_settings);
    Serial.print(F("\n  ALERTS UPDATED\n\n"));
    Serial.println(F("  m. Main Menu"));
    Serial.println(F("  1. Repeat"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
  }
  while (!((user_command == 'm') || (ack)));
  return(ack);
}

//! Function to update control register bits
int8_t main_menu_5_settings()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t settings =0;
  int8_t user_command;
  do
  {
    Serial.println(F("ADC Free Running Operation to Allow On-Demand Measurement and Writes to ADC Registers"));
    Serial.println(F("  1. ADC Free Running"));
    Serial.println(F("  2. Halt ADC Free Running"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_ADC_FREE_RUN_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_ADC_FREE_RUN_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("Turn-On in a Set Sequence"));
    Serial.println(F("  1. Sequencing Enabled"));
    Serial.println(F("  2. Sequencing Disabled"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_SEQUENCING_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_SEQUENCING_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("MASS WRITE"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_MASS_WRITE_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_MASS_WRITE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("PGI Fault Autoretry"));
    Serial.println(F("  1. ON"));
    Serial.println(F("  2. OFF"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_PGI_FAULT_AUTO_RETRY_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_PGI_FAULT_AUTO_RETRY_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F(" PGI Pin"));
    Serial.println(F("  1. PGI Pin Enabled"));
    Serial.println(F("  2. PGI Pin Disabled"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_PGI_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_PGI_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("OVERCURRENT AUTO RETRY"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_OVERCURRENT_AUTO_RETRY_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_OVERCURRENT_AUTO_RETRY_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("UNDERVOLTAGE AUTO RETRY"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4245_UNDERVOLTAGE_AUTO_RETRY_ENABLE;
    else if (user_command ==2)
      settings &= LTC4245_UNDERVOLTAGE_AUTO_RETRY_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    ack |= LTC4245_write(LTC4245_I2C_ADDRESS, LTC4245_CONTROL_REG, settings);
    Serial.print(F("\nSETTINGS UPDATED\n\n"));
    Serial.println(F("  m. Main Menu"));
    Serial.println(F("  1. Repeat"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
  }
  while (!((user_command == 'm') || (ack)));
  return(ack);
}

//! Function to read all registers.
int8_t main_menu_6_read_all_registers()
//! @return Returns the state of the acknowledge bit after the I2C address read. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t register_val;
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_STATUS_REG, &register_val);
  Serial.print("  STATUS REGISTER   : 0b");
  Serial.println(register_val, BIN);
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_ALERT_REG, &register_val);
  Serial.print("  ALERT REGISTER    : 0b");
  Serial.println(register_val, BIN);
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_CONTROL_REG, &register_val);
  Serial.print("  CONTROL REGISTER  : 0b");
  Serial.println(register_val, BIN);
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_ON_REG, &register_val);
  Serial.print("  ON REGISTER       : 0b");
  Serial.println(register_val, BIN);
  Serial.println();
  return ack;
}

Download LTC4245 Linduino Header File

/*!
LTC4245: Hot Swap Controller with I2C Compatible Monitoring

@verbatim

The LTC4245 Hot Swap controller allows a board to be safely inserted and removed
from a live backplane. Using an external N-channel pass transistor, board supply
voltage and inrush current are ramped up at an adjustable rate. An I2C interface
and onboard ADC allow for monitoring of load current, voltage and fault status.

I2C DATA FORMAT (MSB FIRST):

Data Out:
Byte #1                                    Byte #2                       Byte #3

START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  C7  C6 C5 C4 C3 C2 C1 C0 SACK D7 D6 D5 D4 D3 D2 D1 D0 SACK  STOP

Data In:
Byte #1                                    Byte #2                                      Byte #3

START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  C7  C6  C5 C4 C3 C2 C1 C0 SACK  Repeat Start SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK

Byte #4                                   Byte #5
MSB                                       LSB
D15 D14  D13  D12  D11  D10  D9 D8 MACK   D7 D6 D5 D4 D3  D2  D1  D0  MNACK  STOP

START       : I2C Start
Repeat Start: I2C Repeat Start
STOP        : I2C Stop
SAx         : I2C Address
SACK        : I2C Slave Generated Acknowledge (Active Low)
MACK        : I2C Master Generated Acknowledge (Active Low)
MNACK       : I2C Master Generated Not Acknowledge
W           : I2C Write (0)
R           : I2C Read  (1)
Cx          : Command Code
Dx          : Data Bits
X           : Don't care


Example Code:

  float adin_lsb = (1.23/255);          // ADIN Voltage Data is 8-Bit Data with 4.82mV LSB and 1.23V Full Scale
    float adin_resisive_ratio = (155.4/12.4);   // Resistor divider circuit at ADIN pin.
  ack |= LTC4245_read(LTC4245_I2C_ADDRESS, LTC4245_ADIN_REG, &adin_code);       // Read ADIN Register
  adin_voltage = LTC4245_code_to_voltage(adin_code, adin_lsb, adin_resisive_ratio); // Calculate ADIN Voltage from ADIN Register data

@endverbatim

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

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

REVISION HISTORY
$Revision: 3488 $
$Date: 2015-05-26 11:01:05 -0700 (Tue, 26 May 2015) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

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

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, 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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

/*! @file
    @ingroup LTC4245
    Header for LTC4245: Hot Swap Controller with I2C Compatible Monitoring
*/

#ifndef LTC4245_H
#define LTC4245_H

//! @name LTC4261 Address Assignment
//! @{
#define LTC4245_I2C_ADDRESS                      0x20 //ADDR2 = L, ADDR1 = L, ADDR0 = L
#define LTC4245_I2C_ALERT_RESPONSE               0x0C
#define LTC4245_I2C_MASS_WRITE                   0x17
//!@}

//! @name LTC4245 Register addresses
//! @{
// Register Addresses
#define LTC4245_STATUS_REG                       0x00
#define LTC4245_ALERT_REG                        0x01
#define LTC4245_CONTROL_REG                      0x02
#define LTC4245_ON_REG                           0x03
#define LTC4245_FAULT1_REG                       0x04
#define LTC4245_FAULT2_REG                       0x05
#define LTC4245_GPIO_REG                         0x06
#define LTC4245_ADCADR_REG                       0x07
//!@}

//! @name LTC4245 ADC Data Register addresses
//! @{
// Register Addresses
#define LTC4245_12VIN_REG                        0x10
#define LTC4245_12VSENSE_REG                     0x11
#define LTC4245_12VOUT_REG                       0x12
#define LTC4245_5VIN_REG                         0x13
#define LTC4245_5VSENSE_REG                      0x14
#define LTC4245_5VOUT_REG                        0x15
#define LTC4245_3_3VIN_REG                       0x16
#define LTC4245_3_3VSENSE_REG                    0x17
#define LTC4245_3_3VOUT_REG                      0x18
#define LTC4245_VEEIN_REG                        0x19
#define LTC4245_VEESENSE_REG                     0x1A
#define LTC4245_VEEOUT_REG                       0x1B
#define LTC4245_GPIOADC1_REG                     0x1C
#define LTC4245_GPIOADC2_REG                     0x1D
#define LTC4245_GPIOADC3_REG                     0x1E
#define LTC4245_GPIOADC4_REG                     0x1F
//!@}

//! @name LTC4245 Status Register Bits
//! @{
// Alert Register Bit Positions
#define LTC4245_GPIO1_STATE_CHANGE_ENABLE        0x80
#define LTC4245_GPIO1_STATE_CHANGE_DISABLE       0x7F
#define LTC4245_BD_SEL_STATE_CHANGE_ENABLE       0x40
#define LTC4245_BD_SEL_STATE_CHANGE_DISABLE      0xBF
#define LTC4245_FET_SHORT_ENABLE                 0x20
#define LTC4245_FET_SHORT_DISABLE                0xDF
#define LTC4245_PGI_FAULT_ENABLE                 0x10
#define LTC4245_PGI_FAULT_DISABLE                0xEF
#define LTC4245_ALERT_PRESENT_ENABLE             0x08
#define LTC4245_ALERT_PRESENT_DISABLE            0xF7
#define LTC4245_POWER_BAD_ENABLE                 0x04
#define LTC4245_POWER_BAD_DISABLE                0xFB
#define LTC4245_OVERCURRENT_ENABLE               0x02
#define LTC4245_OVERCURRENT_DISABLE              0xFD
#define LTC4245_UNDERVOLTAGE_ENABLE              0x01
#define LTC4245_UNDERVOLTAGE_DISABLE             0xFE
//!@}

//! @name LTC4245 Control Register Bits
//! @{
// Control Register Bit Positions
#define LTC4245_ADC_FREE_RUN_DISABLE             0x80
#define LTC4245_ADC_FREE_RUN_ENABLE              0x7F

#define LTC4245_SEQUENCING_ENABLE                0x40
#define LTC4245_SEQUENCING_DISABLE               0xBF

#define LTC4245_MASS_WRITE_ENABLE                0x20
#define LTC4245_MASS_WRITE_DISABLE               0xDF

#define LTC4245_PGI_FAULT_AUTO_RETRY_ENABLE      0x10
#define LTC4245_PGI_FAULT_AUTO_RETRY_DISABLE     0xEF

#define LTC4245_PGI_DISABLE                      0x08
#define LTC4245_PGI_ENABLE                       0xF7

#define LTC4245_OVERCURRENT_AUTO_RETRY_ENABLE    0x02
#define LTC4245_OVERCURRENT_AUTO_RETRY_DISABLE   0xFD

#define LTC4245_UNDERVOLTAGE_AUTO_RETRY_ENABLE   0x01
#define LTC4245_UNDERVOLTAGE_AUTO_RETRY_DISABLE  0xFE
//!@}



//! @name LTC4245 Fault Register Bits
//! @{
// Fault Register Bit Positions
#define LTC4245_NEG12V_OVERCURRENT_FAULT     0x80
#define LTC4245_3_3V_OVERCURRENT_FAULT       0x40
#define LTC4245_5V_OVERCURRENT_FAULT       0x20
#define LTC4245_12V_OVERCURRENT_FAULT      0x10
#define LTC4245_NEG12V_UNDERVOLTAGE_FAULT    0x08
#define LTC4245_3_3V_UNDERVOLTAGE_FAULT      0x04
#define LTC4245_5V_UNDERVOLTAGE_FAULT      0x02
#define LTC4245_12V_UNDERVOLTAGE_FAULT       0x01

#define LTC4245_GPIO1_STATE_CHANGE               0x80
#define LTC4245_BD_SEL_STATE_CHANGE              0x40
#define LTC4245_FET_SHORT_FAULT                  0x20
#define LTC4245_PGI_FAULT                        0x10
#define LTC4245_NEG12V_POWER_BAD_FAULT           0x08
#define LTC4245_3_3V_POWER_BAD_FAULT             0x04
#define LTC4245_5V_POWER_BAD_FAULT               0x02
#define LTC4245_12V_POWER_BAD_FAULT              0x01
//!@}



//! Calculates voltage from register code data
//! @return The function returns valtage calculated from register data
float LTC4245_code_to_voltage(uint8_t register_code,    //! Data from registers
                              float full_scale_voltage  //! Full scale voltage
                             );

//! SMBus Alert ResponseProtocol: Sends an alert response command and releases /ALERT pin. LTC4245 responds with its address
//! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge
int8_t LTC4245_ARA(uint8_t alert_response_address,      //!< the Alert Response Address on the I2C bus
                   uint8_t *i2c_address           //!< the address of the alert source
                  );

//! Write an 8-bit code to the LTC4245
//! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4245_write(uint8_t i2c_address,  //! LTC4245 I2C ADDRESS
                     uint8_t command,      //! Register address to be written into
                     uint8_t code      //! Data to be written into the register
                    );


//! Reads an 8-bit adc_code from LTC4245
//! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4245_read(uint8_t i2c_address, //! LTC4245 I2C ADDRESS
                    uint8_t command,   //! Register address to read from
                    uint8_t *code    //! Contents of the requested register
                   );

#endif

Download LTC4245 Linduino.CPP

/*!
LTC4245: Hot Swap Controller with I2C Compatible Monitoring

@verbatim

The LTC4245 Hot Swap controller allows a board to be safely inserted and removed
from a live backplane. Using an external N-channel pass transistor, board supply
voltage and inrush current are ramped up at an adjustable rate. An I2C interface
and onboard ADC allow for monitoring of load current, voltage and fault status.

@endverbatim

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

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

REVISION HISTORY
$Revision: 3482 $
$Date: 2015-05-22 15:57:01 -0700 (Fri, 22 May 2015) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

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

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, 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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

//! @defgroup LTC4245 LTC4245: Hot Swap Controller with I2C Compatible Monitoring

/*! @file
    @ingroup LTC4245
    Library for LTC4245 Hot Swap Controller with I2C Compatible Monitoring
*/
#include <Arduino.h>
#include <stdint.h>
#include "Linduino.h"
#include "LT_I2C.h"
#include "LT_SPI.h"
#include "UserInterface.h"
#include "QuikEval_EEPROM.h"
#include <Wire.h>
#include <SPI.h>
#include "LTC4245.h"

// Calculates voltage from register code data
float LTC4245_code_to_voltage(uint8_t register_code, float full_scale_voltage)
{
  float voltage;
  voltage = (float)register_code * full_scale_voltage / 255;   //! 1) Calculate voltage from code and full scale voltage
  return voltage;
}


// SMBus Alert ResponseProtocol: Sends an alert response command and releases /ALERT pin. LTC4245 responds with its address
int8_t LTC4245_ARA(uint8_t alert_response_address, uint8_t *i2c_address)
{
  int8_t ack;
  ack = i2c_read_byte(alert_response_address, i2c_address);
  return ack;
}

// Write an 8-bit code to the LTC4245
int8_t LTC4245_write(uint8_t i2c_address, uint8_t command, uint8_t code)
{
  int8_t ack;
  ack = i2c_write_byte_data(i2c_address,command,code);
  return ack;
}

// Reads an 8-bit adc_code from LTC4245
int8_t LTC4245_read(uint8_t i2c_address, uint8_t command, uint8_t *code)
{
  int8_t ack;
  ack = i2c_read_byte_data(i2c_address,command,code);
  return ack;
}

Technical Support