| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

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

Library for LTC2945 12-Bit Wide Range Power Monitor. More...

## Detailed Description

Library for LTC2945 12-Bit Wide Range Power Monitor.

Definition in file LTC2945.cpp.

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...

## 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.