1 #ifndef STC3115_DRIVER_COMPONENT_H
2 #define STC3115_DRIVER_COMPONENT_H
5 #include "STC3115_constants.h"
6 #include "STC3115_types.h"
7 #include "STC3115_registers.h"
8 #include "STC3115I2CCore.h"
10 #define BATT_CAPACITY 610
12 #define VMODE MIXED_MODE
17 #define APP_EOC_CURRENT 75
18 #define APP_CUTOFF_VOLTAGE 3000
23 STC3115(uint8_t address = 0x70);
26 bool begin(
int batteryCapacity = BATT_CAPACITY,
int rSense = RSENSE);
33 int getRemainingTime();
38 void enableDebugging(Stream* stream = NULL);
39 void disableDebugging();
43 static int convert(
short value,
unsigned short factor);
STC3115 configuration structure.
Definition: STC3115_types.h:11
bool writeRAMData()
Write data from internal structure to STC3115 RAM.
Definition: STC3115.cpp:142
int updateRAMCRC8()
Update STC3115 RAM CRC8 value.
Definition: STC3115.cpp:105
bool begin(int batteryCapacity=BATT_CAPACITY, int rSense=RSENSE)
Initialize the STC3115 Gas Gauge chip.
Definition: STC3115.cpp:27
bool isBatteryDetected()
Check whether the battery is detected or not.
Definition: STC3115.cpp:636
STC3115 battery measurement data structure.
Definition: STC3115_types.h:27
int getSOC()
Get SOC of the battery.
Definition: STC3115.cpp:322
void run()
Gradually update battery status on the internal structure & RAM. This function should be called insid...
Definition: STC3115.cpp:504
int getRunningCounter()
Get the STC3115 conversion counter value.
Definition: STC3115.cpp:349
void initRAM()
Initialize STC3115 RAM data.
Definition: STC3115.cpp:77
static int convert(short value, unsigned short factor)
Convert measurement data with given factor.
Definition: STC3115.cpp:445
int getChipID()
Get the chip ID from STC3115.
Definition: STC3115.cpp:64
int getTemperature()
Get temperature of the battery. Temperature unit is celcius.
Definition: STC3115.cpp:295
void setParamAndRun()
Write configuration to STC3115 registers.
Definition: STC3115.cpp:206
void initConfig(int battCapacity, int rSense)
Initialize STC3115 config default values.
Definition: STC3115.cpp:150
bool restore()
Restore SOC value from RAM and run.
Definition: STC3115.cpp:279
bool readBatteryData()
Read battery measurement data in one go.
Definition: STC3115.cpp:369
int getCurrent()
Get battery current.
Definition: STC3115.cpp:313
STC3115(uint8_t address=0x70)
Initialize STC3115 I2C driver with given address.
Definition: STC3115.cpp:12
Definition: STC3115I2CCore.h:7
int getChargeValue()
Get the remaining capacity in mAh unit.
Definition: STC3115.cpp:331
STC3115 RAM data internal structure.
Definition: STC3115_types.h:45
bool readRAMData()
Read STC3115 RAM data and store it to an internal structure.
Definition: STC3115.cpp:95
int calculateCRC8RAM(uint8_t *data, size_t length)
Calculate the CRC8 of a buffer.
Definition: STC3115.cpp:119
bool startPowerSavingMode()
Start power saving mode.
Definition: STC3115.cpp:605
bool powerDown()
Power down the gauge.
Definition: STC3115.cpp:479
int getStatus()
Get STC3115 status.
Definition: STC3115.cpp:183
bool startup()
Write SOC data to STC3115 and run.
Definition: STC3115.cpp:247
int getVoltage()
Get battery voltage.
Definition: STC3115.cpp:304
bool stopPowerSavingMode()
Stop power saving mode.
Definition: STC3115.cpp:619
bool stop()
Store last reading data to RAM and then stop the gauge.
Definition: STC3115.cpp:490
int getOCV()
Get OCV of the battery.
Definition: STC3115.cpp:340
bool reset()
Reset gauge.
Definition: STC3115.cpp:458