133 #define LTC2942_I2C_ADDRESS 0x64 134 #define LTC2942_I2C_ALERT_RESPONSE 0x0C 163 #define LTC2942_STATUS_REG 0x00 164 #define LTC2942_CONTROL_REG 0x01 165 #define LTC2942_ACCUM_CHARGE_MSB_REG 0x02 166 #define LTC2942_ACCUM_CHARGE_LSB_REG 0x03 167 #define LTC2942_CHARGE_THRESH_HIGH_MSB_REG 0x04 168 #define LTC2942_CHARGE_THRESH_HIGH_LSB_REG 0x05 169 #define LTC2942_CHARGE_THRESH_LOW_MSB_REG 0x06 170 #define LTC2942_CHARGE_THRESH_LOW_LSB_REG 0x07 171 #define LTC2942_VOLTAGE_MSB_REG 0x08 172 #define LTC2942_VOLTAGE_LSB_REG 0x09 173 #define LTC2942_VOLTAGE_THRESH_HIGH_REG 0x0A 174 #define LTC2942_VOLTAGE_THRESH_LOW_REG 0x0B 175 #define LTC2942_TEMPERATURE_MSB_REG 0x0C 176 #define LTC2942_TEMPERATURE_LSB_REG 0x0D 177 #define LTC2942_TEMPERATURE_THRESH_HIGH_REG 0x0E 178 #define LTC2942_TEMPERATURE_THRESH_LOW_REG 0x0F 205 #define LTC2942_AUTOMATIC_MODE 0xC0 206 #define LTC2942_MANUAL_VOLTAGE 0x80 207 #define LTC2942_MANUAL_TEMPERATURE 0x40 208 #define LTC2942_SLEEP_MODE 0x00 210 #define LTC2942_PRESCALAR_M_1 0x00 211 #define LTC2942_PRESCALAR_M_2 0x08 212 #define LTC2942_PRESCALAR_M_4 0x10 213 #define LTC2942_PRESCALAR_M_8 0x18 214 #define LTC2942_PRESCALAR_M_16 0x20 215 #define LTC2942_PRESCALAR_M_32 0x28 216 #define LTC2942_PRESCALAR_M_64 0x30 217 #define LTC2942_PRESCALAR_M_128 0x38 219 #define LTC2942_ALERT_MODE 0x04 220 #define LTC2942_CHARGE_COMPLETE_MODE 0x02 221 #define LTC2942_DISABLE_ALCC_PIN 0x00 223 #define LTC2942_SHUTDOWN_MODE 0x01 int8_t LTC2942_read(uint8_t i2c_address, uint8_t adc_command, uint8_t *adc_code)
Reads an 8-bit adc_code from LTC2942.
const float LTC2942_TEMPERATURE_lsb
const float LTC2942_FULLSCALE_TEMPERATURE
static uint8_t adc_command
int8_t LTC2942_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
Write an 8-bit code to the LTC2942.
const float resistor
resistor value on demo board
const float LTC2942_CHARGE_lsb
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_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.
float LTC2942_code_to_voltage(uint16_t adc_code)
Calculate the LTC2942 SENSE+ voltage.
float LTC2942_code_to_coulombs(uint16_t adc_code, float resistor, uint16_t prescalar)
Calculate the LTC2942 charge in Coulombs.
const float LTC2942_VOLTAGE_lsb
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.
float LTC2942_code_to_kelvin_temperature(uint16_t adc_code)
Calculate the LTC2942 temperature.