| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions
LTC2945.h File Reference
Power Monitors and Coulomb Counters » LTC2945: 12-Bit Wide Range Power Monitor

LTC2945: 12-Bit Wide Range Power Monitor. More...

## Detailed Description

LTC2945: 12-Bit Wide Range Power Monitor.

    The LTC2945 is a rail-to-rail system monitor that measures current, voltage, and
    power. It features an operating range of 2.7V to 80V and includes a shunt
    regulator for supplies above 80V to allow flexibility in the selection of input
    supply. The current measurement range of 0V to 80V is independent of the input
    supply. An onboard 0.75% accurate 12-bit ADC measures load current, input
    voltage and an auxiliary external voltage. A 24-bit power value is generated by
    digitally multiplying the measured 12-bit load current and input voltage data.
    Minimum and maximum values are stored and an overrange alert with programmable
    thresholds minimizes the need for software polling. Data is reported via a
    standard I2C interface. Shutdown mode reduces power consumption to 20uA.
    standard I2C interface. Shutdown mode reduces power consumption to 20uA.

    I2C DATA FORMAT (MSB FIRST):

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

    START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  X  X 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  X  X  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:

    Read power, current, and voltage.

        adc_command = LTC2945_SENSE_MONITOR | LTC2945_CONTINUOUS_MODE; // Builds commands to set LTC2945 to continuous mode
        ack |= LTC2945_write(LTC2945_I2C_ADDRESS, LTC2945_CONTROL_REG, adc_command);   // Sets the LTC2945 to continuous mode

        resistor = .02; // Resistor Value On Demo Board

        ack |= LTC2945_read_24_bits(LTC2945_I2C_ADDRESS, LTC2945_POWER_MSB2_REG, &power_code);  // Reads the ADC registers that contains V^2
        power = LTC2945_code_to_power(power_code, resistor, LTC2945_Power_lsb); // Calculates power from power code, resistor value and power lsb

        ack |= LTC2945_read_12_bits(LTC2945_I2C_ADDRESS, LTC2945_DELTA_SENSE_MSB_REG, &current_code); // Reads the voltage code across sense resistor
        current = LTC2945_code_to_current(current_code, resistor, LTC2945_DELTA_SENSE_lsb); // Calculates current from current code, resistor value and current lsb

        ack |= LTC2945_read_12_bits(LTC2945_I2C_ADDRESS, LTC2945_VIN_MSB_REG, &VIN_code);   // Reads VIN voltage code
        VIN = LTC2945_VIN_code_to_voltage(VIN_code, LTC2945_VIN_lsb);  // Calculates VIN voltage from VIN code and lsb

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

http://www.linear.com/product/ltc2945#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.

Header for LTC2945: 12-bit Wide Range Power Monitor

Definition in file LTC2945.h.

Go to the source code of this file.

## Functions
int8_t | LTC2945_write (uint8_t i2c_address, uint8_t adc_command, uint8_t code)
| Write an 8-bit code to the LTC2945. More...
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. More...
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. More...
int8_t | LTC2945_read (uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
| Reads an 8-bit adc_code from LTC2945. More...
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. More...
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. More...
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. More...
float | LTC2945_VIN_code_to_voltage (uint16_t adc_code, float LTC2945_VIN_lsb)
| Calculate the LTC2945 VIN voltage. More...
float | LTC2945_ADIN_code_to_voltage (uint16_t adc_code, float LTC2945_ADIN_lsb)
| Calculate the LTC2945 ADIN voltage. More...
float | LTC2945_code_to_current (uint16_t adc_code, float resistor, float LTC2945_DELTA_SENSE_lsb)
| Calculate the LTC2945 current with a sense resistor. More...
float | LTC2945_code_to_power (int32_t adc_code, float resistor, float LTC2945_Power_lsb)
| Calculate the LTC2945 power. More...
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. More...

## Macros
LTC2945 I2C Address Assignments
Use table to select address
LTC2945 I2C Address Assignment | Value | AD1 | AD2
--- | --- | --- | ---
LTC2945_I2C_ADDRESS | 0x67 | High | Low
LTC2945_I2C_ADDRESS | 0x68 | Float | High
LTC2945_I2C_ADDRESS | 0x69 | High | High
LTC2945_I2C_ADDRESS | 0x6A | Float | Float
LTC2945_I2C_ADDRESS | 0x6B | Float | Low
LTC2945_I2C_ADDRESS | 0x6C | Low | High
LTC2945_I2C_ADDRESS | 0x6D | High | Float
LTC2945_I2C_ADDRESS | 0x6E | Low | Float
LTC2945_I2C_ADDRESS | 0x6F | Low | Low
LTC2945_I2C_MASS_WRITE | 0xCC | X | X
LTC2945_I2C_ALERT_RESPONSE | 0x19 | X | X
#define | LTC2945_I2C_ADDRESS 0x6F
#define | LTC2945_I2C_MASS_WRITE 0xCC
#define | LTC2945_I2C_ALERT_RESPONSE 0x19
Registers
Name | Value
--- | ---
LTC2945_CONTROL_REG | 0x00
LTC2945_ALERT_REG | 0x01
LTC2945_STATUS_REG | 0x02
LTC2945_FAULT_REG | 0x03
LTC2945_FAULT_CoR_REG | 0x04
LTC2945_POWER_MSB2_REG | 0x05
LTC2945_POWER_MSB1_REG | 0x06
LTC2945_POWER_LSB_REG | 0x07
LTC2945_MAX_POWER_MSB2_REG | 0x08
LTC2945_MAX_POWER_MSB1_REG | 0x09
LTC2945_MAX_POWER_LSB_REG | 0x0A
LTC2945_MIN_POWER_MSB2_REG | 0x0B
LTC2945_MIN_POWER_MSB1_REG | 0x0C
LTC2945_MIN_POWER_LSB_REG | 0x0D
LTC2945_MAX_POWER_THRESHOLD_MSB2_REG | 0x0E
LTC2945_MAX_POWER_THRESHOLD_MSB1_REG | 0x0F
LTC2945_MAX_POWER_THRESHOLD_LSB_REG | 0x10
LTC2945_MIN_POWER_THRESHOLD_MSB2_REG | 0x11
LTC2945_MIN_POWER_THRESHOLD_MSB1_REG | 0x12
LTC2945_MIN_POWER_THRESHOLD_LSB_REG | 0x13
LTC2945_DELTA_SENSE_MSB_REG | 0x14
LTC2945_DELTA_SENSE_LSB_REG | 0x15
LTC2945_MAX_DELTA_SENSE_MSB_REG | 0x16
LTC2945_MAX_DELTA_SENSE_LSB_REG | 0x17
LTC2945_MIN_DELTA_SENSE_MSB_REG | 0x18
LTC2945_MIN_DELTA_SENSE_LSB_REG | 0x19
LTC2945_MAX_DELTA_SENSE_THRESHOLD_MSB_REG | 0x1A
LTC2945_MAX_DELTA_SENSE_THRESHOLD_LSB_REG | 0x1B
LTC2945_MIN_DELTA_SENSE_THRESHOLD_MSB_REG | 0x1C
LTC2945_MIN_DELTA_SENSE_THRESHOLD_LSB_REG | 0x1D
LTC2945_VIN_MSB_REG | 0x1E
LTC2945_VIN_LSB_REG | 0x1F
LTC2945_MAX_VIN_MSB_REG | 0x20
LTC2945_MAX_VIN_LSB_REG | 0x21
LTC2945_MIN_VIN_MSB_REG | 0x22
LTC2945_MIN_VIN_LSB_REG | 0x23
LTC2945_MAX_VIN_THRESHOLD_MSB_REG | 0x24
LTC2945_MAX_VIN_THRESHOLD_LSB_REG | 0x25
LTC2945_MIN_VIN_THRESHOLD_MSB_REG | 0x26
LTC2945_MIN_VIN_THRESHOLD_LSB_REG | 0x27
LTC2945_ADIN_MSB_REG | 0x28
LTC2945_ADIN_LSB_REG_REG | 0x29
LTC2945_MAX_ADIN_MSB_REG | 0x2A
LTC2945_MAX_ADIN_LSB_REG | 0x2B
LTC2945_MIN_ADIN_MSB_REG | 0x2C
LTC2945_MIN_ADIN_LSB_REG | 0x2D
LTC2945_MAX_ADIN_THRESHOLD_MSB_REG | 0x2E
LTC2945_MAX_ADIN_THRESHOLD_LSB_REG | 0x2F
LTC2945_MIN_ADIN_THRESHOLD_MSB_REG | 0x30
LTC2945_MIN_ADIN_THRESHOLD_LSB_REG | 0x31
#define | LTC2945_CONTROL_REG 0x00
#define | LTC2945_ALERT_REG 0x01
#define | LTC2945_STATUS_REG 0x02
#define | LTC2945_FAULT_REG 0x03
#define | LTC2945_FAULT_CoR_REG 0x04
#define | LTC2945_POWER_MSB2_REG 0x05
#define | LTC2945_POWER_MSB1_REG 0x06
#define | LTC2945_POWER_LSB_REG 0x07
#define | LTC2945_MAX_POWER_MSB2_REG 0x08
#define | LTC2945_MAX_POWER_MSB1_REG 0x09
#define | LTC2945_MAX_POWER_LSB_REG 0x0A
#define | LTC2945_MIN_POWER_MSB2_REG 0x0B
#define | LTC2945_MIN_POWER_MSB1_REG 0x0C
#define | LTC2945_MIN_POWER_LSB_REG 0x0D
#define | LTC2945_MAX_POWER_THRESHOLD_MSB2_REG 0x0E
#define | LTC2945_MAX_POWER_THRESHOLD_MSB1_REG 0x0F
#define | LTC2945_MAX_POWER_THRESHOLD_LSB_REG 0x10
#define | LTC2945_MIN_POWER_THRESHOLD_MSB2_REG 0x11
#define | LTC2945_MIN_POWER_THRESHOLD_MSB1_REG 0x12
#define | LTC2945_MIN_POWER_THRESHOLD_LSB_REG 0x13
#define | LTC2945_DELTA_SENSE_MSB_REG 0x14
#define | LTC2945_DELTA_SENSE_LSB_REG 0x15
#define | LTC2945_MAX_DELTA_SENSE_MSB_REG 0x16
#define | LTC2945_MAX_DELTA_SENSE_LSB_REG 0x17
#define | LTC2945_MIN_DELTA_SENSE_MSB_REG 0x18
#define | LTC2945_MIN_DELTA_SENSE_LSB_REG 0x19
#define | LTC2945_MAX_DELTA_SENSE_THRESHOLD_MSB_REG 0x1A
#define | LTC2945_MAX_DELTA_SENSE_THRESHOLD_LSB_REG 0x1B
#define | LTC2945_MIN_DELTA_SENSE_THRESHOLD_MSB_REG 0x1C
#define | LTC2945_MIN_DELTA_SENSE_THRESHOLD_LSB_REG 0x1D
#define | LTC2945_VIN_MSB_REG 0x1E
#define | LTC2945_VIN_LSB_REG 0x1F
#define | LTC2945_MAX_VIN_MSB_REG 0x20
#define | LTC2945_MAX_VIN_LSB_REG 0x21
#define | LTC2945_MIN_VIN_MSB_REG 0x22
#define | LTC2945_MIN_VIN_LSB_REG 0x23
#define | LTC2945_MAX_VIN_THRESHOLD_MSB_REG 0x24
#define | LTC2945_MAX_VIN_THRESHOLD_LSB_REG 0x25
#define | LTC2945_MIN_VIN_THRESHOLD_MSB_REG 0x26
#define | LTC2945_MIN_VIN_THRESHOLD_LSB_REG 0x27
#define | LTC2945_ADIN_MSB_REG 0x28
#define | LTC2945_ADIN_LSB_REG_REG 0x29
#define | LTC2945_MAX_ADIN_MSB_REG 0x2A
#define | LTC2945_MAX_ADIN_LSB_REG 0x2B
#define | LTC2945_MIN_ADIN_MSB_REG 0x2C
#define | LTC2945_MIN_ADIN_LSB_REG 0x2D
#define | LTC2945_MAX_ADIN_THRESHOLD_MSB_REG 0x2E
#define | LTC2945_MAX_ADIN_THRESHOLD_LSB_REG 0x2F
#define | LTC2945_MIN_ADIN_THRESHOLD_MSB_REG 0x30
#define | LTC2945_MIN_ADIN_THRESHOLD_LSB_REG 0x31
Selection Command
Snapshot Selection Command | Value
--- | ---
LTC2945_DELTA_SENSE_SNAPSHOT | 0x80
LTC2945_VIN_SNAPSHOT | 0xA0
LTC2945_ADIN_SNAPSHOT | 0xC0
#define | LTC2945_DELTA_SENSE_SNAPSHOT 0x80
#define | LTC2945_VIN_SNAPSHOT 0xA0
#define | LTC2945_ADIN_SNAPSHOT 0xC0
Command Codes
Command Codes | Value
--- | ---
LTC2945_CONTINUOUS_MODE | 0x00
LTC2945_SHUTDOWN_MODE | 0x02
LTC2945_TEST_MODE | 0x10
LTC2945_RESET_ALL_FAULTS | 0x00
LTC2945_SENSE_MULTIPLIER | 0x01
LTC2945_SENSE_MONITOR | 0x04
LTC2945_MAX_POWER_MSB2_RESET | 0x00
LTC2945_MIN_POWER_MSB2_RESET | 0xFF
LTC2945_MAX_DELTA_SENSE_MSB_RESET | 0x00
LTC2945_MIN_DELTA_SENSE_MSB_RESET | 0xFF
LTC2945_MAX_VIN_MSB_RESET | 0x00
LTC2945_MIN_VIN_MSB_RESET | 0xFF
LTC2945_MAX_ADIN_MSB_RESET | 0x00
LTC2945_MIN_ADIN_MSB_RESET | 0xFF
LTC2945_ENABLE_MAX_POWER_ALERT | 0x80
LTC2945_ENABLE_MIN_POWER_ALERT | 0x40
LTC2945_DISABLE_MAX_POWER_ALERT | 0x7F
LTC2945_DISABLE_MIN_POWER_ALERT | 0xBF
LTC2945_ENABLE_MAX_DELTA_SENSE_ALERT | 0x20
LTC2945_ENABLE_MIN_DELTA_SENSE_ALERT | 0x10
LTC2945_DISABLE_MAX_DELTA_SENSE_ALERT | 0xDF
LTC2945_DISABLE_MIN_DELTA_SENSE_ALERT | 0xEF
LTC2945_ENABLE_MAX_VIN_ALERT | 0x08
LTC2945_ENABLE_MIN_VIN_ALERT | 0x04
LTC2945_DISABLE_MAX_VIN_ALERT | 0xF7
LTC2945_DISABLE_MIN_VIN_ALERT | 0xFB
LTC2945_ENABLE_MAX_ADIN_ALERT | 0x02
LTC2945_ENABLE_MIN_ADIN_ALERT | 0x01
LTC2945_DISABLE_MAX_ADIN_ALERT | 0xFD
LTC2945_DISABLE_MIN_ADIN_ALERT | 0xFE
#define | LTC2945_CONTINUOUS_MODE 0x00
#define | LTC2945_SHUTDOWN_MODE 0x02
#define | LTC2945_TEST_MODE 0x10
#define | LTC2945_RESET_ALL_FAULTS 0x00
#define | LTC2945_SENSE_MULTIPLIER 0x01
#define | LTC2945_SENSE_MONITOR 0x04
#define | LTC2945_MAX_POWER_MSB2_RESET 0x00
#define | LTC2945_MIN_POWER_MSB2_RESET 0xFF
#define | LTC2945_MAX_DELTA_SENSE_MSB_RESET 0x00
#define | LTC2945_MIN_DELTA_SENSE_MSB_RESET 0xFF
#define | LTC2945_MAX_VIN_MSB_RESET 0x00
#define | LTC2945_MIN_VIN_MSB_RESET 0xFF
#define | LTC2945_MAX_ADIN_MSB_RESET 0x00
#define | LTC2945_MIN_ADIN_MSB_RESET 0xFF
#define | LTC2945_ENABLE_MAX_POWER_ALERT 0x80
#define | LTC2945_ENABLE_MIN_POWER_ALERT 0x40
#define | LTC2945_DISABLE_MAX_POWER_ALERT 0x7F
#define | LTC2945_DISABLE_MIN_POWER_ALERT 0xBF
#define | LTC2945_ENABLE_MAX_DELTA_SENSE_ALERT 0x20
#define | LTC2945_ENABLE_MIN_DELTA_SENSE_ALERT 0x10
#define | LTC2945_DISABLE_MAX_DELTA_SENSE_ALERT 0xDF
#define | LTC2945_DISABLE_MIN_DELTA_SENSE_ALERT 0xEF
#define | LTC2945_ENABLE_MAX_VIN_ALERT 0x08
#define | LTC2945_ENABLE_MIN_VIN_ALERT 0x04
#define | LTC2945_DISABLE_MAX_VIN_ALERT 0xF7
#define | LTC2945_DISABLE_MIN_VIN_ALERT 0xFB
#define | LTC2945_ENABLE_MAX_ADIN_ALERT 0x02
#define | LTC2945_ENABLE_MIN_ADIN_ALERT 0x01
#define | LTC2945_DISABLE_MAX_ADIN_ALERT 0xFD
#define | LTC2945_DISABLE_MIN_ADIN_ALERT 0xFE

## Function Documentation

## ◆ LTC2945_ADIN_code_to_voltage()

float LTC2945_ADIN_code_to_voltage | ( | uint16_t | adc_code,
|  | float | LTC2945_ADIN_lsb
| ) |  |

Calculate the LTC2945 ADIN voltage.

Returns
  Returns the ADIN Voltage in Volts

Parameters

  adc_code | The ADC value
  LTC2945_ADIN_lsb | ADIN lsb weight

Definition at line 171 of file LTC2945.cpp.

## ◆ LTC2945_code_to_ADIN_power()

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.

Returns
  The LTC2945 power with the ADIN

Parameters

  adc_code | The ADC value
  resistor | The resistor value
  LTC2945_ADIN_DELTA_SENSE_lsb | Power lsb weight

Definition at line 200 of file LTC2945.cpp.

## ◆ LTC2945_code_to_current()

float LTC2945_code_to_current | ( | uint16_t | adc_code,
|  | float | resistor,
|  | float | LTC2945_DELTA_SENSE_lsb
| ) |  |

Calculate the LTC2945 current with a sense resistor.

Returns
  The LTC2945 current

Parameters

  adc_code | The ADC value
  resistor | The resistor value
  LTC2945_DELTA_SENSE_lsb | Delta sense lsb weight

Definition at line 180 of file LTC2945.cpp.

## ◆ LTC2945_code_to_power()

float LTC2945_code_to_power | ( | int32_t | adc_code,
|  | float | resistor,
|  | float | LTC2945_Power_lsb
| ) |  |

Calculate the LTC2945 power.

Returns
  The LTC2945 power

Parameters

  adc_code | The ADC value
  resistor | The resistor value
  LTC2945_Power_lsb | Power lsb weight

Definition at line 190 of file LTC2945.cpp.

## ◆ LTC2945_read()

int8_t LTC2945_read | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint8_t * | adc_code
| ) |  |

Reads an 8-bit adc_code from LTC2945.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  adc_code | Value that will be read from the register.

Definition at line 112 of file LTC2945.cpp.

## ◆ LTC2945_read_12_bits()

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.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  adc_code | Value that will be read from the register.

Definition at line 123 of file LTC2945.cpp.

## ◆ LTC2945_read_16_bits()

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.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  adc_code | Value that will be read from the register.

Definition at line 137 of file LTC2945.cpp.

## ◆ LTC2945_read_24_bits()

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.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  adc_code | Value that will be read from the register.

Definition at line 148 of file LTC2945.cpp.

## ◆ LTC2945_VIN_code_to_voltage()

float LTC2945_VIN_code_to_voltage | ( | uint16_t | adc_code,
|  | float | LTC2945_VIN_lsb
| ) |  |

Calculate the LTC2945 VIN voltage.

Returns
  Returns the VIN Voltage in Volts

Parameters

  adc_code | The ADC value
  LTC2945_VIN_lsb | VIN lsb weight

Definition at line 162 of file LTC2945.cpp.

## ◆ LTC2945_write()

int8_t LTC2945_write | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint8_t | code
| ) |  |

Write an 8-bit code to the LTC2945.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  code | Value that will be written to the register.

Definition at line 76 of file LTC2945.cpp.

## ◆ LTC2945_write_16_bits()

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.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  code | Value that will be written to the register.

Definition at line 88 of file LTC2945.cpp.

## ◆ LTC2945_write_24_bits()

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.

Returns
  The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  i2c_address | Register address for the LTC2945
  adc_command | The "command byte" for the LTC2945
  code | Value that will be written to the register.

Definition at line 98 of file LTC2945.cpp.

## Macro Definition Documentation

## ◆ LTC2945_ADIN_LSB_REG_REG

#define LTC2945_ADIN_LSB_REG_REG 0x29

Definition at line 266 of file LTC2945.h.

## ◆ LTC2945_ADIN_MSB_REG

#define LTC2945_ADIN_MSB_REG 0x28

Definition at line 265 of file LTC2945.h.

## ◆ LTC2945_ADIN_SNAPSHOT

#define LTC2945_ADIN_SNAPSHOT 0xC0

Definition at line 290 of file LTC2945.h.

## ◆ LTC2945_ALERT_REG

#define LTC2945_ALERT_REG 0x01

Definition at line 222 of file LTC2945.h.

## ◆ LTC2945_CONTINUOUS_MODE

#define LTC2945_CONTINUOUS_MODE 0x00

Definition at line 330 of file LTC2945.h.

## ◆ LTC2945_CONTROL_REG

#define LTC2945_CONTROL_REG 0x00

Definition at line 221 of file LTC2945.h.

## ◆ LTC2945_DELTA_SENSE_LSB_REG

#define LTC2945_DELTA_SENSE_LSB_REG 0x15

Definition at line 244 of file LTC2945.h.

## ◆ LTC2945_DELTA_SENSE_MSB_REG

#define LTC2945_DELTA_SENSE_MSB_REG 0x14

Definition at line 243 of file LTC2945.h.

## ◆ LTC2945_DELTA_SENSE_SNAPSHOT

#define LTC2945_DELTA_SENSE_SNAPSHOT 0x80

Definition at line 288 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MAX_ADIN_ALERT

#define LTC2945_DISABLE_MAX_ADIN_ALERT 0xFD

Definition at line 363 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MAX_DELTA_SENSE_ALERT

#define LTC2945_DISABLE_MAX_DELTA_SENSE_ALERT 0xDF

Definition at line 353 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MAX_POWER_ALERT

#define LTC2945_DISABLE_MAX_POWER_ALERT 0x7F

Definition at line 348 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MAX_VIN_ALERT

#define LTC2945_DISABLE_MAX_VIN_ALERT 0xF7

Definition at line 358 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MIN_ADIN_ALERT

#define LTC2945_DISABLE_MIN_ADIN_ALERT 0xFE

Definition at line 364 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MIN_DELTA_SENSE_ALERT

#define LTC2945_DISABLE_MIN_DELTA_SENSE_ALERT 0xEF

Definition at line 354 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MIN_POWER_ALERT

#define LTC2945_DISABLE_MIN_POWER_ALERT 0xBF

Definition at line 349 of file LTC2945.h.

## ◆ LTC2945_DISABLE_MIN_VIN_ALERT

#define LTC2945_DISABLE_MIN_VIN_ALERT 0xFB

Definition at line 359 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MAX_ADIN_ALERT

#define LTC2945_ENABLE_MAX_ADIN_ALERT 0x02

Definition at line 361 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MAX_DELTA_SENSE_ALERT

#define LTC2945_ENABLE_MAX_DELTA_SENSE_ALERT 0x20

Definition at line 351 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MAX_POWER_ALERT

#define LTC2945_ENABLE_MAX_POWER_ALERT 0x80

Definition at line 346 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MAX_VIN_ALERT

#define LTC2945_ENABLE_MAX_VIN_ALERT 0x08

Definition at line 356 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MIN_ADIN_ALERT

#define LTC2945_ENABLE_MIN_ADIN_ALERT 0x01

Definition at line 362 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MIN_DELTA_SENSE_ALERT

#define LTC2945_ENABLE_MIN_DELTA_SENSE_ALERT 0x10

Definition at line 352 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MIN_POWER_ALERT

#define LTC2945_ENABLE_MIN_POWER_ALERT 0x40

Definition at line 347 of file LTC2945.h.

## ◆ LTC2945_ENABLE_MIN_VIN_ALERT

#define LTC2945_ENABLE_MIN_VIN_ALERT 0x04

Definition at line 357 of file LTC2945.h.

## ◆ LTC2945_FAULT_CoR_REG

#define LTC2945_FAULT_CoR_REG 0x04

Definition at line 225 of file LTC2945.h.

## ◆ LTC2945_FAULT_REG

#define LTC2945_FAULT_REG 0x03

Definition at line 224 of file LTC2945.h.

## ◆ LTC2945_I2C_ADDRESS

#define LTC2945_I2C_ADDRESS 0x6F

Definition at line 153 of file LTC2945.h.

## ◆ LTC2945_I2C_ALERT_RESPONSE

#define LTC2945_I2C_ALERT_RESPONSE 0x19

Definition at line 156 of file LTC2945.h.

## ◆ LTC2945_I2C_MASS_WRITE

#define LTC2945_I2C_MASS_WRITE 0xCC

Definition at line 155 of file LTC2945.h.

## ◆ LTC2945_MAX_ADIN_LSB_REG

#define LTC2945_MAX_ADIN_LSB_REG 0x2B

Definition at line 268 of file LTC2945.h.

## ◆ LTC2945_MAX_ADIN_MSB_REG

#define LTC2945_MAX_ADIN_MSB_REG 0x2A

Definition at line 267 of file LTC2945.h.

## ◆ LTC2945_MAX_ADIN_MSB_RESET

#define LTC2945_MAX_ADIN_MSB_RESET 0x00

Definition at line 343 of file LTC2945.h.

## ◆ LTC2945_MAX_ADIN_THRESHOLD_LSB_REG

#define LTC2945_MAX_ADIN_THRESHOLD_LSB_REG 0x2F

Definition at line 272 of file LTC2945.h.

## ◆ LTC2945_MAX_ADIN_THRESHOLD_MSB_REG

#define LTC2945_MAX_ADIN_THRESHOLD_MSB_REG 0x2E

Definition at line 271 of file LTC2945.h.

## ◆ LTC2945_MAX_DELTA_SENSE_LSB_REG

#define LTC2945_MAX_DELTA_SENSE_LSB_REG 0x17

Definition at line 246 of file LTC2945.h.

## ◆ LTC2945_MAX_DELTA_SENSE_MSB_REG

#define LTC2945_MAX_DELTA_SENSE_MSB_REG 0x16

Definition at line 245 of file LTC2945.h.

## ◆ LTC2945_MAX_DELTA_SENSE_MSB_RESET

#define LTC2945_MAX_DELTA_SENSE_MSB_RESET 0x00

Definition at line 339 of file LTC2945.h.

## ◆ LTC2945_MAX_DELTA_SENSE_THRESHOLD_LSB_REG

#define LTC2945_MAX_DELTA_SENSE_THRESHOLD_LSB_REG 0x1B

Definition at line 250 of file LTC2945.h.

## ◆ LTC2945_MAX_DELTA_SENSE_THRESHOLD_MSB_REG

#define LTC2945_MAX_DELTA_SENSE_THRESHOLD_MSB_REG 0x1A

Definition at line 249 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_LSB_REG

#define LTC2945_MAX_POWER_LSB_REG 0x0A

Definition at line 232 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_MSB1_REG

#define LTC2945_MAX_POWER_MSB1_REG 0x09

Definition at line 231 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_MSB2_REG

#define LTC2945_MAX_POWER_MSB2_REG 0x08

Definition at line 230 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_MSB2_RESET

#define LTC2945_MAX_POWER_MSB2_RESET 0x00

Definition at line 337 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_THRESHOLD_LSB_REG

#define LTC2945_MAX_POWER_THRESHOLD_LSB_REG 0x10

Definition at line 238 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_THRESHOLD_MSB1_REG

#define LTC2945_MAX_POWER_THRESHOLD_MSB1_REG 0x0F

Definition at line 237 of file LTC2945.h.

## ◆ LTC2945_MAX_POWER_THRESHOLD_MSB2_REG

#define LTC2945_MAX_POWER_THRESHOLD_MSB2_REG 0x0E

Definition at line 236 of file LTC2945.h.

## ◆ LTC2945_MAX_VIN_LSB_REG

#define LTC2945_MAX_VIN_LSB_REG 0x21

Definition at line 257 of file LTC2945.h.

## ◆ LTC2945_MAX_VIN_MSB_REG

#define LTC2945_MAX_VIN_MSB_REG 0x20

Definition at line 256 of file LTC2945.h.

## ◆ LTC2945_MAX_VIN_MSB_RESET

#define LTC2945_MAX_VIN_MSB_RESET 0x00

Definition at line 341 of file LTC2945.h.

## ◆ LTC2945_MAX_VIN_THRESHOLD_LSB_REG

#define LTC2945_MAX_VIN_THRESHOLD_LSB_REG 0x25

Definition at line 261 of file LTC2945.h.

## ◆ LTC2945_MAX_VIN_THRESHOLD_MSB_REG

#define LTC2945_MAX_VIN_THRESHOLD_MSB_REG 0x24

Definition at line 260 of file LTC2945.h.

## ◆ LTC2945_MIN_ADIN_LSB_REG

#define LTC2945_MIN_ADIN_LSB_REG 0x2D

Definition at line 270 of file LTC2945.h.

## ◆ LTC2945_MIN_ADIN_MSB_REG

#define LTC2945_MIN_ADIN_MSB_REG 0x2C

Definition at line 269 of file LTC2945.h.

## ◆ LTC2945_MIN_ADIN_MSB_RESET

#define LTC2945_MIN_ADIN_MSB_RESET 0xFF

Definition at line 344 of file LTC2945.h.

## ◆ LTC2945_MIN_ADIN_THRESHOLD_LSB_REG

#define LTC2945_MIN_ADIN_THRESHOLD_LSB_REG 0x31

Definition at line 274 of file LTC2945.h.

## ◆ LTC2945_MIN_ADIN_THRESHOLD_MSB_REG

#define LTC2945_MIN_ADIN_THRESHOLD_MSB_REG 0x30

Definition at line 273 of file LTC2945.h.

## ◆ LTC2945_MIN_DELTA_SENSE_LSB_REG

#define LTC2945_MIN_DELTA_SENSE_LSB_REG 0x19

Definition at line 248 of file LTC2945.h.

## ◆ LTC2945_MIN_DELTA_SENSE_MSB_REG

#define LTC2945_MIN_DELTA_SENSE_MSB_REG 0x18

Definition at line 247 of file LTC2945.h.

## ◆ LTC2945_MIN_DELTA_SENSE_MSB_RESET

#define LTC2945_MIN_DELTA_SENSE_MSB_RESET 0xFF

Definition at line 340 of file LTC2945.h.

## ◆ LTC2945_MIN_DELTA_SENSE_THRESHOLD_LSB_REG

#define LTC2945_MIN_DELTA_SENSE_THRESHOLD_LSB_REG 0x1D

Definition at line 252 of file LTC2945.h.

## ◆ LTC2945_MIN_DELTA_SENSE_THRESHOLD_MSB_REG

#define LTC2945_MIN_DELTA_SENSE_THRESHOLD_MSB_REG 0x1C

Definition at line 251 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_LSB_REG

#define LTC2945_MIN_POWER_LSB_REG 0x0D

Definition at line 235 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_MSB1_REG

#define LTC2945_MIN_POWER_MSB1_REG 0x0C

Definition at line 234 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_MSB2_REG

#define LTC2945_MIN_POWER_MSB2_REG 0x0B

Definition at line 233 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_MSB2_RESET

#define LTC2945_MIN_POWER_MSB2_RESET 0xFF

Definition at line 338 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_THRESHOLD_LSB_REG

#define LTC2945_MIN_POWER_THRESHOLD_LSB_REG 0x13

Definition at line 241 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_THRESHOLD_MSB1_REG

#define LTC2945_MIN_POWER_THRESHOLD_MSB1_REG 0x12

Definition at line 240 of file LTC2945.h.

## ◆ LTC2945_MIN_POWER_THRESHOLD_MSB2_REG

#define LTC2945_MIN_POWER_THRESHOLD_MSB2_REG 0x11

Definition at line 239 of file LTC2945.h.

## ◆ LTC2945_MIN_VIN_LSB_REG

#define LTC2945_MIN_VIN_LSB_REG 0x23

Definition at line 259 of file LTC2945.h.

## ◆ LTC2945_MIN_VIN_MSB_REG

#define LTC2945_MIN_VIN_MSB_REG 0x22

Definition at line 258 of file LTC2945.h.

## ◆ LTC2945_MIN_VIN_MSB_RESET

#define LTC2945_MIN_VIN_MSB_RESET 0xFF

Definition at line 342 of file LTC2945.h.

## ◆ LTC2945_MIN_VIN_THRESHOLD_LSB_REG

#define LTC2945_MIN_VIN_THRESHOLD_LSB_REG 0x27

Definition at line 263 of file LTC2945.h.

## ◆ LTC2945_MIN_VIN_THRESHOLD_MSB_REG

#define LTC2945_MIN_VIN_THRESHOLD_MSB_REG 0x26

Definition at line 262 of file LTC2945.h.

## ◆ LTC2945_POWER_LSB_REG

#define LTC2945_POWER_LSB_REG 0x07

Definition at line 229 of file LTC2945.h.

## ◆ LTC2945_POWER_MSB1_REG

#define LTC2945_POWER_MSB1_REG 0x06

Definition at line 228 of file LTC2945.h.

## ◆ LTC2945_POWER_MSB2_REG

#define LTC2945_POWER_MSB2_REG 0x05

Definition at line 227 of file LTC2945.h.

## ◆ LTC2945_RESET_ALL_FAULTS

#define LTC2945_RESET_ALL_FAULTS 0x00

Definition at line 333 of file LTC2945.h.

## ◆ LTC2945_SENSE_MONITOR

#define LTC2945_SENSE_MONITOR 0x04

Definition at line 335 of file LTC2945.h.

## ◆ LTC2945_SENSE_MULTIPLIER

#define LTC2945_SENSE_MULTIPLIER 0x01

Definition at line 334 of file LTC2945.h.

## ◆ LTC2945_SHUTDOWN_MODE

#define LTC2945_SHUTDOWN_MODE 0x02

Definition at line 331 of file LTC2945.h.

## ◆ LTC2945_STATUS_REG

#define LTC2945_STATUS_REG 0x02

Definition at line 223 of file LTC2945.h.

## ◆ LTC2945_TEST_MODE

#define LTC2945_TEST_MODE 0x10

Definition at line 332 of file LTC2945.h.

## ◆ LTC2945_VIN_LSB_REG

#define LTC2945_VIN_LSB_REG 0x1F

Definition at line 255 of file LTC2945.h.

## ◆ LTC2945_VIN_MSB_REG

#define LTC2945_VIN_MSB_REG 0x1E

Definition at line 254 of file LTC2945.h.

## ◆ LTC2945_VIN_SNAPSHOT

#define LTC2945_VIN_SNAPSHOT 0xA0

Definition at line 289 of file LTC2945.h.