| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions
LTC2946.cpp File Reference
Power Monitors and Coulomb Counters » LTC2946: 12-Bit Wide Range Power, Charge and Energy Monitor

Library for LTC2946 12-Bit Wide Range Power, Charge and Energy Monitor. More...

## Detailed Description

Library for LTC2946 12-Bit Wide Range Power, Charge and Energy Monitor.

Definition in file LTC2946.cpp.

Go to the source code of this file.

## Functions
int8_t | LTC2946_write (uint8_t i2c_address, uint8_t adc_command, uint8_t code)
| Write an 8-bit code to the LTC2946. More...
int8_t | LTC2946_write_16_bits (uint8_t i2c_address, uint8_t adc_command, uint16_t code)
| Write a 16-bit code to the LTC2946. More...
int8_t | LTC2946_write_24_bits (uint8_t i2c_address, uint8_t adc_command, uint32_t code)
| Write a 24-bit code to the LTC2946. More...
int8_t | LTC2946_write_32_bits (uint8_t i2c_address, uint8_t adc_command, uint32_t code)
| Write a 32-bit code to the LTC2946. More...
int8_t | LTC2946_read (uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
| Reads an 8-bit adc_code from LTC2946. More...
int8_t | LTC2946_read_12_bits (uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
| Reads a 12-bit adc_code from LTC2946. More...
int8_t | LTC2946_read_16_bits (uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
| Reads a 16-bit adc_code from LTC2946. More...
int8_t | LTC2946_read_24_bits (uint8_t i2c_address, uint8_t adc_command, uint32_t *adc_code)
| Reads a 24-bit adc_code from LTC2946. More...
int8_t | LTC2946_read_32_bits (uint8_t i2c_address, uint8_t adc_command, uint32_t *adc_code)
| Reads a 32-bit adc_code from LTC2946. More...
float | LTC2946_VIN_code_to_voltage (uint16_t adc_code, float LTC2946_VIN_lsb)
| Calculate the LTC2946 VIN voltage. More...
float | LTC2946_ADIN_code_to_voltage (uint16_t adc_code, float LTC2946_ADIN_lsb)
| Calculate the LTC2946 ADIN voltage. More...
float | LTC2946_code_to_current (uint16_t adc_code, float resistor, float LTC2946_DELTA_SENSE_lsb)
| Calculate the LTC2946 current with a sense resistor. More...
float | LTC2946_code_to_power (int32_t adc_code, float resistor, float LTC2946_Power_lsb)
| Calculate the LTC2946 power. More...
float | LTC2946_code_to_energy (int32_t adc_code, float resistor, float LTC2946_Power_lsb, float LTC2946_TIME_lsb)
| Calculate the LTC2946 energy. More...
float | LTC2946_code_to_coulombs (int32_t adc_code, float resistor, float LTC2946_DELTA_SENSE_lsb, float LTC2946_TIME_lsb)
| Calculate the LTC2946 coulombs. More...
float | LTC2946_code_to_time (float time_code, float LTC2946_TIME_lsb)
| Calculate the LTC2946 internal time base. More...

## Function Documentation

## ◆ LTC2946_ADIN_code_to_voltage()

float LTC2946_ADIN_code_to_voltage | ( | uint16_t | adc_code,
|  | float | LTC2946_ADIN_lsb
| ) |  |

Calculate the LTC2946 ADIN voltage.

Returns
  Returns the ADIN Voltage in Volts

Parameters

  adc_code | The ADC value
  LTC2946_ADIN_lsb | ADIN lsb weight

Definition at line 203 of file LTC2946.cpp.

## ◆ LTC2946_code_to_coulombs()

float LTC2946_code_to_coulombs | ( | int32_t | adc_code,
|  | float | resistor,
|  | float | LTC2946_DELTA_SENSE_lsb,
|  | float | LTC2946_Time_lsb
| ) |  |

Calculate the LTC2946 coulombs.

Returns
  The LTC2946 charge in coulombs

Parameters

  adc_code | The ADC value
  resistor | The resistor value
  LTC2946_DELTA_SENSE_lsb | Delta sense lsb weight
  LTC2946_TIME_lsb | Time lsb weight

Definition at line 243 of file LTC2946.cpp.

## ◆ LTC2946_code_to_current()

float LTC2946_code_to_current | ( | uint16_t | adc_code,
|  | float | resistor,
|  | float | LTC2946_DELTA_SENSE_lsb
| ) |  |

Calculate the LTC2946 current with a sense resistor.

Returns
  The LTC2946 current in Amps

Parameters

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

Definition at line 212 of file LTC2946.cpp.

## ◆ LTC2946_code_to_energy()

float LTC2946_code_to_energy | ( | int32_t | adc_code,
|  | float | resistor,
|  | float | LTC2946_Power_lsb,
|  | float | LTC2946_TIME_lsb
| ) |  |

Calculate the LTC2946 energy.

Returns
  The LTC2946 energy in Joules

Parameters

  adc_code | The ADC value
  resistor | The resistor value
  LTC2946_Power_lsb | Power lsb weight
  LTC2946_TIME_lsb | Time lsb weight

Definition at line 233 of file LTC2946.cpp.

## ◆ LTC2946_code_to_power()

float LTC2946_code_to_power | ( | int32_t | adc_code,
|  | float | resistor,
|  | float | LTC2946_Power_lsb
| ) |  |

Calculate the LTC2946 power.

Returns
  The LTC2946 power in Watts Power lsb weight

Parameters

  adc_code | The ADC value
  resistor | The resistor value

Definition at line 222 of file LTC2946.cpp.

## ◆ LTC2946_code_to_time()

float LTC2946_code_to_time | ( | float | time_code,
|  | float | LTC2946_Time_lsb
| ) |  |

Calculate the LTC2946 internal time base.

Returns
  The internal time base in seconds.

Parameters

  time_code | Time adc code
  LTC2946_TIME_lsb | Time lsb weight

Definition at line 253 of file LTC2946.cpp.

## ◆ LTC2946_read()

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

Reads an 8-bit adc_code from LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  adc_code | Value that will be read from the register.

Definition at line 130 of file LTC2946.cpp.

## ◆ LTC2946_read_12_bits()

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

Reads a 12-bit adc_code from LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  adc_code | Value that will be read from the register.

Definition at line 141 of file LTC2946.cpp.

## ◆ LTC2946_read_16_bits()

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

Reads a 16-bit adc_code from LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  adc_code | Value that will be read from the register.

Definition at line 155 of file LTC2946.cpp.

## ◆ LTC2946_read_24_bits()

int8_t LTC2946_read_24_bits | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint32_t * | adc_code
| ) |  |

Reads a 24-bit adc_code from LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  adc_code | Value that will be read from the register.

Definition at line 166 of file LTC2946.cpp.

## ◆ LTC2946_read_32_bits()

int8_t LTC2946_read_32_bits | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint32_t * | adc_code
| ) |  |

Reads a 32-bit adc_code from LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  adc_code | Value that will be read from the register.

Definition at line 180 of file LTC2946.cpp.

## ◆ LTC2946_VIN_code_to_voltage()

float LTC2946_VIN_code_to_voltage | ( | uint16_t | adc_code,
|  | float | LTC2946_VIN_lsb
| ) |  |

Calculate the LTC2946 VIN voltage.

Returns
  Returns the VIN Voltage in Volts

Parameters

  adc_code | The ADC value
  LTC2946_VIN_lsb | VIN lsb weight

Definition at line 194 of file LTC2946.cpp.

## ◆ LTC2946_write()

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

Write an 8-bit code to the LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  code | Value that will be written to the register.

Definition at line 81 of file LTC2946.cpp.

## ◆ LTC2946_write_16_bits()

int8_t LTC2946_write_16_bits | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint16_t | code
| ) |  |

Write a 16-bit code to the LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  code | Value that will be written to the register.

Definition at line 93 of file LTC2946.cpp.

## ◆ LTC2946_write_24_bits()

int8_t LTC2946_write_24_bits | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint32_t | code
| ) |  |

Write a 24-bit code to the LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  code | Value that will be written to the register.

Definition at line 103 of file LTC2946.cpp.

## ◆ LTC2946_write_32_bits()

int8_t LTC2946_write_32_bits | ( | uint8_t | i2c_address,
|  | uint8_t | adc_command,
|  | uint32_t | code
| ) |  |

Write a 32-bit code to the LTC2946.

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 LTC2946
  adc_command | The "command byte" for the LTC2946
  code | Value that will be written to the register.

Definition at line 116 of file LTC2946.cpp.