| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions
LTC4151.cpp File Reference
Power Monitors and Coulomb Counters » LTC4151: High Voltage I2C Current and Voltage Monitor

Library for LTC4151: High Voltage I2C Current and Voltage Monitor. More...

## Detailed Description

Library for LTC4151: High Voltage I2C Current and Voltage Monitor.

Definition in file LTC4151.cpp.

Go to the source code of this file.

## Functions
int8_t | LTC4151_write (uint8_t i2c_address, uint8_t adc_command, uint8_t code)
| Write one byte to an LTC4151 register. More...
int8_t | LTC4151_read_12_bits (uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
| Reads a 12-bit value from LTC4151. More...
float | LTC4151_code_to_sense_current (uint16_t adc_code, float resistor, float LTC4151_sense_lsb)
| Calculates the LTC4151 sense current in Amps given "resistor" value in ohms and "LTC4151_sense_lsb" LSB weight in volts. More...
float | LTC4151_code_to_vin_voltage (uint16_t adc_code, float LTC4151_vin_lsb)
| Calculates the LTC4151 V_IN voltage given "LTC_vin_lsb" LSB weight in volts. More...
float | LTC4151_code_to_ADIN_voltage (uint16_t adc_code, float LTC4151_adin_lsb)
| Calculates the LTC4151 ADIN voltage in mV given "LTC4151_adin_lsb" LSB weight in mV. More...

## Function Documentation

## ◆ LTC4151_code_to_ADIN_voltage()

float LTC4151_code_to_ADIN_voltage | ( | uint16_t | adc_code,
|  | float | LTC4151_adin_lsb
| ) |  |

Calculates the LTC4151 ADIN voltage in mV given "LTC4151_adin_lsb" LSB weight in mV.

Returns
  the ADIN voltage in volts.

Parameters

  adc_code | Code read from the adc (from a function such as LTC4151_read_12_bits)
  LTC4151_adin_lsb | ADIN voltage LSB weight.

Definition at line 117 of file LTC4151.cpp.

## ◆ LTC4151_code_to_sense_current()

float LTC4151_code_to_sense_current | ( | uint16_t | adc_code,
|  | float | resistor,
|  | float | LTC4151_sense_lsb
| ) |  |

Calculates the LTC4151 sense current in Amps given "resistor" value in ohms and "LTC4151_sense_lsb" LSB weight in volts.

Returns
  Returns the current in Amperes.

Parameters

  adc_code | Code read from the adc (from a function such as LTC4151_read_12_bits)
  resistor | The sense resistor value
  LTC4151_sense_lsb | Current LSB weight.

Definition at line 100 of file LTC4151.cpp.

## ◆ LTC4151_code_to_vin_voltage()

float LTC4151_code_to_vin_voltage | ( | uint16_t | adc_code,
|  | float | LTC4151_vin_lsb
| ) |  |

Calculates the LTC4151 V_IN voltage given "LTC_vin_lsb" LSB weight in volts.

Returns
  the V_IN voltage in volts.

Parameters

  adc_code | Code read from the adc (from a function such as LTC4151_read_12_bits)
  LTC4151_vin_lsb | Voltage LSB weight.

Definition at line 109 of file LTC4151.cpp.

## ◆ LTC4151_read_12_bits()

int8_t LTC4151_read_12_bits | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint16_t * | adc_code
| ) |  |

Reads a 12-bit value from LTC4151.

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

Parameters

  i2c_address | I2C address of the LTC4151. Configured by tying the ADR0 and ADR1 pins high or low. See Table 1 of datasheet.
  adc_command | The "command byte" for the LTC4151.
  adc_code | Returns 12-bit value read from the adc

Definition at line 83 of file LTC4151.cpp.

## ◆ LTC4151_write()

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

Write one byte to an LTC4151 register.

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

Parameters

  i2c_address | I2C address of the LTC4151. Configured by tying the ADR0 and ADR1 pins high or low. See Table 1 of datasheet.
  adc_command | The "command byte" for the LTC4151.
  code | Value that will be written to the register.

Definition at line 73 of file LTC4151.cpp.