23#define REG_CALIBRATION 0x05
25#define REG_BUSVOLTAGE 0x02
28#define REG_SHUNTVOLTAGE 0x01
81 return ((raw >> 3) * 0.004);
106 float loadVoltage = busVoltage + shuntVoltage;
109 float percentage = (loadVoltage - 6.0F) / 2.4f * 100.0F;
110 if (percentage > 100.0F)
112 if (percentage < 0.0F)
Definition of the BatteryController class.
Definition of the I2CController class.
void setCalibration32V2A()
Set the calibration for 32V and 2A.
~BatteryController() override
Destroy the BatteryController object.
BatteryController(II2CController *i2cController=nullptr)
Construct a new BatteryController object.
float getBusVoltage_V()
Get the bus voltage in volts.
float getShuntVoltage_V()
Get the shunt voltage in volts.
float getBatteryPercentage() override
Get the battery percentage.
II2CController * m_i2cController
Class that controls I2C devices.
Interface for controlling I2C devices.