175 *adc_code = 0x0FFFFFF & data.
LT_int32;
189 *adc_code = 0xFFFFFFFF & data.
LT_int32;
198 voltage = (float)adc_code*LTC2946_VIN_lsb;
207 adc_voltage = (float)adc_code*LTC2946_ADIN_lsb;
216 voltage = (float)adc_code*LTC2946_DELTA_SENSE_lsb;
226 power = (float)adc_code*LTC2946_Power_lsb/resistor;
236 float energy_lsb, energy;
238 energy = adc_code*energy_lsb;
246 float coulomb_lsb, coulombs;
248 coulombs = adc_code*coulomb_lsb;
256 seconds = LTC2946_TIME_lsb * time_code;
float LTC2946_code_to_energy(int32_t adc_code, float resistor, float LTC2946_Power_lsb, float LTC2946_TIME_lsb)
Calculate the LTC2946 energy.
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.
float LTC2946_code_to_power(int32_t adc_code, float resistor, float LTC2946_Power_lsb)
Calculate the LTC2946 power.
static uint8_t adc_command
int8_t i2c_read_block_data(uint8_t address, uint8_t command, uint8_t length, uint8_t *values)
Read a block of data, starting at register specified by "command" and ending at (command + length - 1...
uint8_t LT_byte[4]
4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer ...
int8_t i2c_read_byte_data(uint8_t address, uint8_t command, uint8_t *value)
Read a byte of data at register specified by "command", store in "value".
const float LTC2946_ADIN_lsb
Typical ADIN lsb weight in volts.
const float resistor
resistor value on demo board
int8_t LTC2946_read(uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
Reads an 8-bit adc_code from LTC2946.
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.
Header File for Linduino Libraries and Demo Code.
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.
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.
const float LTC2946_VIN_lsb
Typical VIN lsb weight in volts.
union LT_union_int32_4bytes data
float LTC2946_code_to_time(float time_code, float LTC2946_TIME_lsb)
Calculate the LTC2946 internal time base.
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.
float LTC2946_ADIN_code_to_voltage(uint16_t adc_code, float LTC2946_ADIN_lsb)
Calculate the LTC2946 ADIN voltage.
int8_t LTC2946_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
Write an 8-bit code to the LTC2946.
int8_t i2c_write_word_data(uint8_t address, uint8_t command, uint16_t value)
Write a 16-bit word of data to register specified by "command".
int8_t i2c_write_byte_data(uint8_t address, uint8_t command, uint8_t value)
Write a byte of data to register specified by "command".
static float LTC2946_TIME_lsb
Static variable which is based off of the default clk frequency of 250KHz.
int32_t LT_int32
32-bit signed integer to be converted to four bytes
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.
int8_t i2c_read_word_data(uint8_t address, uint8_t command, uint16_t *value)
Read a 16-bit word of data from register specified by "command".
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
int8_t i2c_write_block_data(uint8_t address, uint8_t command, uint8_t length, uint8_t *values)
Write a block of data, starting at register specified by "command" and ending at (command + length - ...
This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer) four uint...
LTC2946: 12-Bit Wide Range Power, Charge and Energy Monitor.
float LTC2946_VIN_code_to_voltage(uint16_t adc_code, float LTC2946_VIN_lsb)
Calculate the LTC2946 VIN voltage.
static uint16_t current
the current measurement from the LTC3335's counter test mode.
const float LTC2946_Power_lsb
Typical POWER lsb weight in V^2 VIN_lsb * DELTA_SENSE_lsb.
float LTC2946_code_to_current(uint16_t adc_code, float resistor, float LTC2946_DELTA_SENSE_lsb)
Calculate the LTC2946 current with a sense resistor.
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.
float LTC2946_code_to_coulombs(int32_t adc_code, float resistor, float LTC2946_DELTA_SENSE_lsb, float LTC2946_TIME_lsb)
Calculate the LTC2946 coulombs.
const float LTC2946_DELTA_SENSE_lsb
Typical Delta lsb weight in volts.