117 float coulomb_charge;
119 coulomb_charge = coulomb_charge*3.6f;
120 return(coulomb_charge);
160 uint8_t register_data;
163 ack |=
LTC2942_read(i2c_address, register_address, ®ister_data);
164 register_data = register_data & (~bits_to_clear);
165 register_data = register_data | bits_to_set;
166 ack |=
LTC2942_write(i2c_address, register_address, register_data);
float LTC2942_code_to_voltage(uint16_t adc_code)
Calculate the LTC2942 SENSE+ voltage.
LTC2942: Battery Gas Gauge with Temperature, Voltage Measurement.
const float LTC2942_FULLSCALE_TEMPERATURE
static uint8_t adc_command
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 resistor
resistor value on demo board
int8_t LTC2942_read_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 16-bit adc_code from LTC2942.
Header File for Linduino Libraries and Demo Code.
const float LTC2942_CHARGE_lsb
int8_t LTC2942_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
Write an 8-bit code to the LTC2942.
int8_t LTC2942_register_set_clear_bits(uint8_t i2c_address, uint8_t register_address, uint8_t bits_to_set, uint8_t bits_to_clear)
int8_t LTC2942_write_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t code)
Write a 16-bit code to the LTC2942.
const float LTC2942_FULLSCALE_VOLTAGE
float LTC2942_code_to_coulombs(uint16_t adc_code, float resistor, uint16_t prescalar)
Calculate the LTC2942 charge in Coulombs.
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".
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.
float LTC2942_code_to_mAh(uint16_t adc_code, float resistor, uint16_t prescalar)
Calculate the LTC2942 charge in mAh.
float LTC2942_code_to_celcius_temperature(uint16_t adc_code)
Calculate the LTC2942 temperature.
int8_t LTC2942_read(uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
Reads an 8-bit adc_code from LTC2942.
float LTC2942_code_to_kelvin_temperature(uint16_t adc_code)
Calculate the LTC2942 temperature.