Class that stores state and functions for interacting with the LC709203F I2C battery monitor.
More...
#include <Adafruit_LC709203F.h>
|
bool | readWord (uint8_t address, uint16_t *data) |
| Helper that reads 16 bits of CRC data from the chip. Note this function performs a CRC on data that includes the I2C write address, command, read address and 2 bytes of response. More...
|
|
bool | writeWord (uint8_t command, uint16_t data) |
| Helper that writes 16 bits of CRC data to the chip. Note this function performs a CRC on data that includes the I2C write address, command, and 2 bytes of response. More...
|
|
|
Adafruit_I2CDevice * | i2c_dev = NULL |
| Pointer to I2C bus interface.
|
|
Class that stores state and functions for interacting with the LC709203F I2C battery monitor.
◆ begin()
bool Adafruit_LC709203F::begin |
( |
TwoWire * |
wire = &Wire | ) |
|
Sets up the hardware and initializes I2C.
- Parameters
-
wire | The Wire object to be used for I2C connections. |
- Returns
- True if initialization was successful, otherwise false.
◆ initRSOC()
bool Adafruit_LC709203F::initRSOC |
( |
void |
| ) |
|
Initialize the RSOC algorithm.
- Returns
- True on I2C command success
◆ setPowerMode()
Set the power mode, LC709203F_POWER_OPERATE or LC709203F_POWER_SLEEP.
- Parameters
-
- Returns
- True on successful I2C write
◆ setPackSize()
Set the approximate pack size, helps RSOC calculation.
- Parameters
-
apa | The lc709203_adjustment_t enumerated approximate cell size |
- Returns
- True on successful I2C write
◆ setPackAPA()
bool Adafruit_LC709203F::setPackAPA |
( |
uint8_t |
apa_value | ) |
|
Set battery APA value, per LC709203F datasheet.
- Parameters
-
apa_value | 8-bit APA value to use for the attached battery |
- Returns
- True on successful I2C write
◆ getICversion()
uint16_t Adafruit_LC709203F::getICversion |
( |
void |
| ) |
|
Get IC LSI version.
- Returns
- 16-bit value read from LC709203F_CMD_ICVERSION register
◆ cellVoltage()
float Adafruit_LC709203F::cellVoltage |
( |
void |
| ) |
|
Get battery voltage.
- Returns
- Floating point value read in Volts
◆ cellPercent()
float Adafruit_LC709203F::cellPercent |
( |
void |
| ) |
|
Get battery state in percent (0-100%)
- Returns
- Floating point value from 0 to 100.0
◆ getThermistorB()
uint16_t Adafruit_LC709203F::getThermistorB |
( |
void |
| ) |
|
Get the thermistor B value (e.g. 3950)
- Returns
- The uint16_t B value
◆ setThermistorB()
bool Adafruit_LC709203F::setThermistorB |
( |
uint16_t |
b | ) |
|
Set the thermistor B value (e.g. 3950)
- Parameters
-
- Returns
- True on successful I2C write
◆ getBattProfile()
uint16_t Adafruit_LC709203F::getBattProfile |
( |
void |
| ) |
|
Get the battery profile parameter.
- Returns
- The uint16_t profile value (0 or 1)
◆ setBattProfile()
bool Adafruit_LC709203F::setBattProfile |
( |
uint16_t |
b | ) |
|
Set the battery profile parameter.
- Parameters
-
b | The value to set it to (0 or 1) |
- Returns
- True on successful I2C write
◆ setTemperatureMode()
Set the temperature mode (external or internal)
- Parameters
-
t | The desired mode: LC709203F_TEMPERATURE_I2C or LC709203F_TEMPERATURE_THERMISTOR |
- Returns
- True on successful I2C write
◆ getCellTemperature()
float Adafruit_LC709203F::getCellTemperature |
( |
void |
| ) |
|
Get battery thermistor temperature.
- Returns
- Floating point value from -20 to 60 *C
◆ setAlarmRSOC()
bool Adafruit_LC709203F::setAlarmRSOC |
( |
uint8_t |
percent | ) |
|
Set the alarm pin to respond to an RSOC percentage level.
- Parameters
-
percent | The threshold value, set to 0 to disable alarm |
- Returns
- True on successful I2C write
◆ setAlarmVoltage()
bool Adafruit_LC709203F::setAlarmVoltage |
( |
float |
voltage | ) |
|
Set the alarm pin to respond to a battery voltage level.
- Parameters
-
voltage | The threshold value, set to 0 to disable alarm |
- Returns
- True on successful I2C write
◆ readWord()
bool Adafruit_LC709203F::readWord |
( |
uint8_t |
command, |
|
|
uint16_t * |
data |
|
) |
| |
|
protected |
Helper that reads 16 bits of CRC data from the chip. Note this function performs a CRC on data that includes the I2C write address, command, read address and 2 bytes of response.
- Parameters
-
command | The I2C register/command |
data | Pointer to uint16_t value we will store response |
- Returns
- True on successful I2C read
◆ writeWord()
bool Adafruit_LC709203F::writeWord |
( |
uint8_t |
command, |
|
|
uint16_t |
data |
|
) |
| |
|
protected |
Helper that writes 16 bits of CRC data to the chip. Note this function performs a CRC on data that includes the I2C write address, command, and 2 bytes of response.
- Parameters
-
command | The I2C register/command |
data | Pointer to uint16_t value we will write to register |
- Returns
- True on successful I2C write
The documentation for this class was generated from the following files: