|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
#include <GaugeBQ27220.hpp>
Public Types | |
| enum | Access { FULL_ACCESS = 1 , UNBLOCK_ACCESS , SEALED_ACCESS } |
Public Member Functions | |
| GaugeBQ27220 () | |
| ~GaugeBQ27220 ()=default | |
| bool | begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback) |
| bool | refresh () override |
| Refresh the battery data by reading from the registers. | |
| uint16_t | getAtRate () const |
| Get the AtRate value. | |
| uint16_t | getAtRateTimeToEmpty () const |
| Get the AtRateTimeToEmpty value. | |
| float | getTemperature () override |
| Get the temperature value. | |
| uint16_t | getVoltage () override |
| Get the battery voltage value. | |
| BatteryStatus | getBatteryStatus () const |
| Get the battery status. | |
| float | getCurrent () override |
| Get the instantaneous current value. | |
| bool | isCharging () override |
| Check if battery is charging. | |
| bool | isDischarging () override |
| Check if battery is discharging. | |
| uint16_t | getRemainingCapacity () const |
| Get the remaining battery capacity. | |
| uint16_t | getFullChargeCapacity () const |
| Get the full charge capacity of the battery. | |
| uint16_t | getTimeToEmpty () override |
| Get the estimated time until the battery is empty. | |
| uint16_t | getTimeToFull () override |
| Get the estimated time until the battery is fully charged. | |
| int16_t | getStandbyCurrent () const |
| Get the standby current value. | |
| uint16_t | getStandbyTimeToEmpty () const |
| Get the estimated time until the battery is empty at standby discharge rate. | |
| int16_t | getMaxLoadCurrent () const |
| Get the maximum load current value. | |
| uint16_t | getMaxLoadTimeToEmpty () const |
| Get the estimated time until the battery is empty at maximum load current discharge rate. | |
| uint16_t | getRawCoulombCount () const |
| Get the raw coulomb count value. | |
| int16_t | getAveragePower () const |
| Get the average power value. | |
| float | getInternalTemperature () const |
| Get the internal temperature value. | |
| uint16_t | getCycleCount () const |
| Get the cycle count value. | |
| uint16_t | getStateOfCharge () override |
| Get the state of charge value. | |
| uint16_t | getStateOfHealth () const |
| Get the state of health value. | |
| uint16_t | getRequestChargingVoltage () const |
| Get the requested charging voltage value. | |
| uint16_t | getRequestChargingCurrent () const |
| Get the requested charging current value. | |
| uint16_t | getBTPDischargeSet () const |
| Get the BTP discharge set value. | |
| uint16_t | getBTPChargeSet () const |
| Get the BTP charge set value. | |
| FuelGaugeOperationStatus | getOperationStatus () const |
| Get the operation status. | |
| uint16_t | getDesignCapacity () const |
| Get the design capacity value. | |
| bool | setNewCapacity (uint16_t newDesignCapacity, uint16_t newFullChargeCapacity) |
| Set the new design capacity and full charge capacity of the battery. | |
| OperationConfig | getOperationConfig () |
| Retrieve the operation configuration of the device. | |
| uint16_t | getChipID () override |
| Retrieve the unique identifier of the chip. | |
| int | getHardwareVersion () |
| Get the hardware version of the device. | |
| int | getFirmwareVersion () |
| Get the firmware version of the device. | |
| void | reset () override |
| Reset the device. | |
| void | setAccessKey (uint32_t key) |
| Set the access key for the device. | |
Public Member Functions inherited from GaugeBase | |
| virtual | ~GaugeBase ()=default |
| GaugeBase (const GaugeBase &)=delete | |
| GaugeBase & | operator= (const GaugeBase &)=delete |
Public Member Functions inherited from I2CDeviceWithHal | |
| bool | begin (SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr) |
| Initialize the sensor using custom callback interface. | |
Public Member Functions inherited from DeviceBeginCommon | |
| virtual | ~DeviceBeginCommon () |
| uint8_t | getAddress () const |
| uint8_t | getInterface () const |
Public Member Functions inherited from SensorCommWrapper | |
| SensorCommWrapper ()=default | |
| int | readReg (uint8_t reg) const |
| int | readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const |
| int | readBuff (uint8_t *buf, size_t len) const |
| int | writeReg (uint8_t reg, uint8_t val) |
| int | writeRegBuff (uint8_t reg, uint8_t *buf, size_t len) |
| int | writeBuff (uint8_t *buf, size_t len) |
| int | writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len) |
| bool | setRegBit (uint8_t reg, uint8_t bit) |
| bool | clrRegBit (uint8_t reg, uint8_t bit) |
| bool | getRegBit (uint8_t reg, uint8_t bit) |
| int | updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted) |
| void | setAddress (uint8_t address) |
| void | setAck (bool enable) |
Public Member Functions inherited from SensorCommInterface | |
| virtual | ~SensorCommInterface ()=default |
Protected Attributes | |
| uint32_t | accessKey |
| BatteryData | data |
| const uint8_t | START_REGISTER = 0x02 |
| const uint8_t | REGISTER_COUNT = 54 |
Protected Attributes inherited from DeviceBeginCommon | |
| std::unique_ptr< SensorCommBase > | comm |
| std::unique_ptr< SensorHal > | hal |
| std::unique_ptr< SensorCommStatic > | staticComm |
| uint8_t | _addr = 0 |
| uint8_t | _iface = COMM_CUSTOM |
Static Protected Attributes | |
| static constexpr uint16_t | BQ27220_SUB_CMD_CTRL_STATUS = (0x0000) |
| static constexpr uint16_t | BQ27220_SUB_CMD_DEVICE_NUMBER = (0x0001) |
| static constexpr uint16_t | BQ27220_SUB_CMD_FW_VERSION = (0x0002) |
| static constexpr uint16_t | BQ27220_SUB_CMD_HW_VERSION = (0x0003) |
| static constexpr uint16_t | BQ27220_SUB_CMD_BOARD_OFFSET = (0x0009) |
| static constexpr uint16_t | BQ27220_SUB_CMD_CC_OFFSET = (0x000A) |
| static constexpr uint16_t | BQ27220_SUB_CMD_CC_OFFSET_SAVE = (0x000B) |
| static constexpr uint16_t | BQ27220_SUB_CMD_OCV_CMD = (0x000C) |
| static constexpr uint16_t | BQ27220_SUB_CMD_BAT_INSERT = (0x000D) |
| static constexpr uint16_t | BQ27220_SUB_CMD_BAT_REMOVE = (0x000E) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_SNOOZE = (0x0013) |
| static constexpr uint16_t | BQ27220_SUB_CMD_CLEAR_SNOOZE = (0x0014) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_PROFILE_1 = (0x0015) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_PROFILE_2 = (0x0016) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_PROFILE_3 = (0x0017) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_PROFILE_4 = (0x0018) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_PROFILE_5 = (0x0019) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SET_PROFILE_6 = (0x001A) |
| static constexpr uint16_t | BQ27220_SUB_CMD_CAL_TOGGLE = (0x002D) |
| static constexpr uint16_t | BQ27220_SUB_CMD_SEALED = (0x0030) |
| static constexpr uint16_t | BQ27220_SUB_CMD_RESET = (0x0041) |
| static constexpr uint16_t | BQ27220_SUB_CMD_EXIT_CAL = (0x0080) |
| static constexpr uint16_t | BQ27220_SUB_CMD_ENTER_CAL = (0x0081) |
| static constexpr uint16_t | BQ27220_SUB_CMD_ENTER_CFG_UPDATE = (0x0090) |
| static constexpr uint16_t | BQ27220_SUB_CMD_EXIT_CFG_UPDATE_REINIT = (0x0091) |
| static constexpr uint16_t | BQ27220_SUB_CMD_EXIT_CFG_UPDATE = (0x0092) |
| static constexpr uint16_t | BQ27220_SUB_CMD_RETURN_TO_ROM = (0x0F00) |
| static constexpr uint8_t | BQ27220_REG_STA_AT_RATE = (0x02) |
| static constexpr uint8_t | BQ27220_REG_STA_AT_RATE_TIME_TO_EMPTY = (0x04) |
| static constexpr uint8_t | BQ27220_REG_STA_NTC_TEMP = (0x06) |
| static constexpr uint8_t | BQ27220_REG_STA_BAT_VOLTAGE = (0x08) |
| static constexpr uint8_t | BQ27220_REG_STA_BAT_STATUS = (0x0A) |
| static constexpr uint8_t | BQ27220_REG_STA_CURRENT = (0x0C) |
| static constexpr uint8_t | BQ27220_REG_STA_REMAINING_CAPACITY = (0x10) |
| static constexpr uint8_t | BQ27220_REG_STA_FULL_CHARGE_CAPACITY = (0x12) |
| static constexpr uint8_t | BQ27220_REG_STA_TIME_TO_EMPTY = (0x16) |
| static constexpr uint8_t | BQ27220_REG_STA_TIME_TO_FULL = (0x18) |
| static constexpr uint8_t | BQ27220_REG_STA_STANDBY_CURRENT = (0x1A) |
| static constexpr uint8_t | BQ27220_REG_STA_STANDBY_TIME_TO_EMPTY = (0x1C) |
| static constexpr uint8_t | BQ27220_REG_STA_MAX_LOAD_CURRENT = (0x1E) |
| static constexpr uint8_t | BQ27220_REG_STA_MAX_LOAD_TO_EMPTY = (0x20) |
| static constexpr uint8_t | BQ27220_REG_STA_COULOMB_COUNT = (0x22) |
| static constexpr uint8_t | BQ27220_REG_STA_AVG_POWER = (0x24) |
| static constexpr uint8_t | BQ27220_REG_STA_INTER_TEMP = (0x28) |
| static constexpr uint8_t | BQ27220_REG_STA_CYCLE_COUNT = (0x2A) |
| static constexpr uint8_t | BQ27220_REG_STA_STATE_OF_CHARGE = (0x2C) |
| static constexpr uint8_t | BQ27220_REG_STA_STATE_OF_HEALTH = (0x2E) |
| static constexpr uint8_t | BQ27220_REG_STA_CHARGING_VOLTAGE = (0x30) |
| static constexpr uint8_t | BQ27220_REG_STA_CHARGING_CURRENT = (0x32) |
| static constexpr uint8_t | BQ27220_REG_STA_BTP_DISC_SET = (0x34) |
| static constexpr uint8_t | BQ27220_REG_STA_BTP_CHARGE_SET = (0x36) |
| static constexpr uint8_t | BQ27220_REG_STA_OPERATION_STATUS = (0x3A) |
| static constexpr uint8_t | BQ27220_REG_STA_DESIGN_CAPACITY = (0x3C) |
| static constexpr uint8_t | BQ27220_REG_STA_DESIGN_CAPACITY_MSB = (0x3E) |
| static constexpr uint8_t | BQ27220_REG_STA_DESIGN_CAPACITY_LSB = (0x3F) |
| static constexpr uint8_t | BQ27220_REG_MAC_BUFFER_START = (0x40) |
| static constexpr uint8_t | BQ27220_REG_MAC_BUFFER_END = (0x5F) |
| static constexpr uint8_t | BQ27220_REG_MAC_DATA_SUM = (0x60) |
| static constexpr uint8_t | BQ27220_REG_MAC_DATA_LEN = (0x61) |
| static constexpr uint8_t | BQ27220_REG_ANALOG_COUNT = (0x79) |
| static constexpr uint8_t | BQ27220_REG_RAW_CURRENT = (0x7A) |
| static constexpr uint8_t | BQ27220_REG_RAW_VOLTAGE = (0x7C) |
| static constexpr uint8_t | BQ27220_REG_ROM_START = (0x3E) |
| static constexpr uint16_t | BQ27220_CHIP_ID = (0x0220) |
| static constexpr uint16_t | BQ27220_ROM_FULL_CHARGE_CAPACITY = (0x929D) |
| static constexpr uint16_t | BQ27220_ROM_DESIGN_CAPACITY = (0x929F) |
| static constexpr uint16_t | BQ27220_ROM_OPERATION_CONFIG_A = (0x9206) |
| static constexpr uint16_t | BQ27220_ROM_OPERATION_CONFIG_B = (0x9208) |
Additional Inherited Members | |
Protected Member Functions inherited from GaugeBase | |
| GaugeBase ()=default | |
Protected Member Functions inherited from I2CDeviceWithHal | |
| bool | ensureValid () const override |
| Ensure the communication interface is valid. | |
Protected Member Functions inherited from DeviceBeginCommon | |
| DeviceBeginCommon ()=default | |
| virtual SensorCommBase * | getComm () const override |
| virtual void | beforeBegin () |
| virtual void | afterCommReady () |
| virtual void | afterInitSuccess (uint8_t param) |
| virtual void | onBeginFail () |
| bool | fail () |
| void | clearCommState () |
| template<typename CreateComm > | |
| bool | beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm) |
Definition at line 591 of file gauge/ti/GaugeBQ27220.hpp.
| enum GaugeBQ27220::Access |
| Enumerator | |
|---|---|
| FULL_ACCESS | |
| UNBLOCK_ACCESS | |
| SEALED_ACCESS | |
Definition at line 635 of file gauge/ti/GaugeBQ27220.hpp.
|
inline |
Definition at line 641 of file gauge/ti/GaugeBQ27220.hpp.
|
default |
References I2CDeviceWithHal::begin().
|
inline |
Definition at line 666 of file gauge/ti/GaugeBQ27220.hpp.
References I2CDeviceWithHal::begin(), and hal_callback().
Referenced by setup().
|
inline |
Get the AtRate value.
The AtRate represents the current rate at which the battery is being discharged or charged. The value is in milliamperes (mA).
Definition at line 707 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the AtRateTimeToEmpty value.
The AtRateTimeToEmpty indicates the estimated time remaining until the battery is empty at the current discharge rate. The unit is minutes.
Definition at line 715 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the average power value.
The average power during battery charging and discharging. Values are negative during discharging and positive during charging. A value of 0 means the battery is not discharging. The value is reported in milliwatts (mW).
Definition at line 833 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the battery status.
The Read Word function returns the contents of the Fuel Gauge Status Register, describing the current battery status.
Definition at line 739 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the BTP charge set value.
This read/write word command updates the BTP setup threshold that triggers the BTP interrupt in the charge direction and sets the OperationStatus()[BTPINT] bit.
Definition at line 899 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the BTP discharge set value.
This read/write word command updates the BTP setup threshold that triggers the BTP interrupt in the discharge direction and sets the OperationStatus()[BTPINT] bit.
Definition at line 891 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Retrieve the unique identifier of the chip.
Implements GaugeBase.
Definition at line 984 of file gauge/ti/GaugeBQ27220.hpp.
References arraySize(), and BQ27220_SUB_CMD_DEVICE_NUMBER.
|
inlineoverridevirtual |
Get the instantaneous current value.
The instantaneous current in the sense resistor. It is updated once per second. A negative value indicates a discharge current. The unit is milliamperes (mA).
Implements GaugeBase.
Definition at line 747 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the cycle count value.
The number of cycles the active battery has experienced, ranging from 0 to 65535. A cycle occurs when the accumulated discharge ≥ the cycle threshold.
Definition at line 849 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the design capacity value.
This read - only function returns the value stored in the design capacity in milliampere - hours (mAh). This value is used as the theoretical or nominal capacity of a new battery pack and is used to calculate the state of health.
Definition at line 916 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the firmware version of the device.
This function tries to obtain the firmware version by sending a specific sub - command to request the firmware version. If the sub - command sending fails or the subsequent reading of the MAC data fails, it returns -1. Otherwise, it combines the four bytes read from the MAC data into a 32 - bit unsigned integer and returns it as the firmware version.
Definition at line 1025 of file gauge/ti/GaugeBQ27220.hpp.
References arraySize(), and BQ27220_SUB_CMD_FW_VERSION.
|
inline |
Get the full charge capacity of the battery.
This function returns the full charge capacity of the battery in milliampere - hours (mAh).
Definition at line 773 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the hardware version of the device.
This function attempts to retrieve the hardware version by writing a specific value to the hardware version sub - command register and then reading the MAC data. If any step fails during the process, it returns -1 to indicate an error. Otherwise, it combines the two bytes read from the MAC data into a 16 - bit unsigned integer and returns it as the hardware version.
Definition at line 1005 of file gauge/ti/GaugeBQ27220.hpp.
References arraySize(), BQ27220_SUB_CMD_HW_VERSION, and SensorCommWrapper::writeReg().
|
inline |
Get the internal temperature value.
This read - only function returns the internal temperature sensor value measured by the fuel gauge in Celsius. The raw data is stored in tenths of Kelvin and is converted to Celsius in this function.
Definition at line 841 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the maximum load current value.
This function returns the signed integer value in milliamperes (mA) at the maximum load.
Definition at line 810 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the estimated time until the battery is empty at maximum load current discharge rate.
This function returns the predicted remaining battery life in minutes at the maximum load current discharge rate.
Definition at line 817 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Retrieve the operation configuration of the device.
This function is responsible for obtaining the current operation configuration of the device. The operation configuration typically includes various settings and parameters that govern the device's behavior, such as operating modes, thresholds, and enable/disable flags.
OperationConfig object that contains the current operation configuration of the device. Definition at line 964 of file gauge/ti/GaugeBQ27220.hpp.
References sensorlib::_highByte(), sensorlib::_lowByte(), BQ27220_REG_ROM_START, BQ27220_ROM_OPERATION_CONFIG_A, DeviceBeginCommon::hal, SensorCommWrapper::readRegBuff(), and SensorCommWrapper::writeReg().
Referenced by setup().
|
inline |
Get the operation status.
The Read Word function returns the contents of the internal status register. See datasheet page 27.
Definition at line 907 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the raw coulomb count value.
The amount of coulombs transferred from a battery during charge/discharge.
Definition at line 824 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the remaining battery capacity.
This function returns the remaining capacity of the battery in milliampere - hours (mAh).
Definition at line 766 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the requested charging current value.
This read - only function returns an unsigned integer value for the desired battery charging current. A value of 65,535 indicates that the battery is requesting the maximum current from the battery charger.
Definition at line 883 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the requested charging voltage value.
This read - only function returns the unsigned integer value of the desired battery charging voltage. A value of 65,535 indicates that the battery is requesting the maximum voltage from the battery charger.
Definition at line 874 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the standby current value.
The standby current measured by the sense resistor. The unit is milliamperes (mA).
Definition at line 796 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the estimated time until the battery is empty at standby discharge rate.
This function returns the predicted remaining battery life in minutes at the standby discharge rate.
Definition at line 803 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Get the state of charge value.
This read - only function returns an unsigned integer value representing the predicted remaining battery capacity as a percentage of the full charge capacity, in the range 0 to 100%.
Implements GaugeBase.
Definition at line 857 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inline |
Get the state of health value.
This read - only function returns an unsigned integer value representing the percentage of the full charge capacity to the design capacity, ranging from 0 to 100%.
Definition at line 865 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Get the temperature value.
This function returns the temperature measured by the fuel gauge in Celsius. The raw data is stored in tenths of Kelvin and is converted to Celsius in this function.
Implements GaugeBase.
Definition at line 723 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Get the estimated time until the battery is empty.
This function returns the estimated time remaining until the battery is empty under normal operating conditions. The unit is minutes.
Implements GaugeBase.
Definition at line 781 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Get the estimated time until the battery is fully charged.
This function returns the estimated time remaining until the battery is fully charged. The unit is minutes.
Implements GaugeBase.
Definition at line 789 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Get the battery voltage value.
This value represents the measured battery pack voltage in millivolts (mV), ranging from 0 to 6000mV.
Implements GaugeBase.
Definition at line 731 of file gauge/ti/GaugeBQ27220.hpp.
References data.
Referenced by loop().
|
inlineoverridevirtual |
Check if battery is charging.
Implements GaugeBase.
Definition at line 753 of file gauge/ti/GaugeBQ27220.hpp.
References data.
|
inlineoverridevirtual |
Check if battery is discharging.
Implements GaugeBase.
Definition at line 759 of file gauge/ti/GaugeBQ27220.hpp.
References data.
|
inlineoverridevirtual |
Refresh the battery data by reading from the registers.
This function attempts to read battery data from the specified registers of the fuel gauge. If any of the read operations fail, the function returns false; otherwise, it returns true.
Implements GaugeBase.
Definition at line 679 of file gauge/ti/GaugeBQ27220.hpp.
References data, i, SensorCommWrapper::readRegBuff(), REGISTER_COUNT, and START_REGISTER.
Referenced by loop().
|
inlineoverridevirtual |
Reset the device.
This function sends a reset sub - command to the device to perform a reset operation.
Implements GaugeBase.
Definition at line 1041 of file gauge/ti/GaugeBQ27220.hpp.
References BQ27220_SUB_CMD_RESET.
|
inline |
Set the access key for the device.
If this function is not called, the default access key is 0xFFFFFFFF. This function allows the user to set a custom access key.
| key | The 32 - bit unsigned integer representing the access key to be set. |
Definition at line 1052 of file gauge/ti/GaugeBQ27220.hpp.
References accessKey.
|
inline |
Set the new design capacity and full charge capacity of the battery.
This function is responsible for updating the design capacity and full charge capacity of the battery. It first checks the device's access settings, enters the configuration update mode, writes the new capacity values and checksums, and finally exits the configuration update mode. If the device was previously in a sealed state, it will be restored to the sealed mode after the operation is completed. For new devices, use the default key for access. If it is an encrypted device, use setAccessKey(uint32_t key) to set the key.
| newDesignCapacity | The new design capacity to be set, of type uint16_t. |
| newFullChargeCapacity | The new full charge capacity to be set, of type uint16_t. |
Definition at line 932 of file gauge/ti/GaugeBQ27220.hpp.
References sensorlib::_highByte(), sensorlib::_lowByte(), BQ27220_ROM_DESIGN_CAPACITY, BQ27220_ROM_FULL_CHARGE_CAPACITY, DeviceBeginCommon::hal, and SENSORLIB_LOG_E.
Referenced by setup().
|
protected |
Definition at line 1309 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by setAccessKey().
|
staticconstexprprotected |
Definition at line 1381 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1376 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1373 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1372 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1375 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1374 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1377 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1378 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1379 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by getOperationConfig().
|
staticconstexprprotected |
Definition at line 1344 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1345 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1359 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1348 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1347 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1367 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1366 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1365 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1364 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1358 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1349 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1361 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1369 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1371 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1370 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1351 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1360 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1356 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1357 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1346 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1368 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1350 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1354 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1355 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1362 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1363 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1352 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1353 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1384 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by setNewCapacity().
|
staticconstexprprotected |
Definition at line 1383 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by setNewCapacity().
|
staticconstexprprotected |
Definition at line 1385 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by getOperationConfig().
|
staticconstexprprotected |
Definition at line 1386 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1323 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1324 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1319 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1333 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1320 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1321 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1326 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1315 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1316 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by getChipID().
|
staticconstexprprotected |
Definition at line 1337 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1338 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1336 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1340 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1339 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1317 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by getFirmwareVersion().
|
staticconstexprprotected |
Definition at line 1318 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by getHardwareVersion().
|
staticconstexprprotected |
Definition at line 1322 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1335 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by reset().
|
staticconstexprprotected |
Definition at line 1341 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1334 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1327 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1328 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1329 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1330 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1331 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1332 of file gauge/ti/GaugeBQ27220.hpp.
|
staticconstexprprotected |
Definition at line 1325 of file gauge/ti/GaugeBQ27220.hpp.
|
protected |
Definition at line 1310 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by getAtRate(), getAtRateTimeToEmpty(), getAveragePower(), getBatteryStatus(), getBTPChargeSet(), getBTPDischargeSet(), getCurrent(), getCycleCount(), getDesignCapacity(), getFullChargeCapacity(), getInternalTemperature(), getMaxLoadCurrent(), getMaxLoadTimeToEmpty(), getOperationStatus(), getRawCoulombCount(), getRemainingCapacity(), getRequestChargingCurrent(), getRequestChargingVoltage(), getStandbyCurrent(), getStandbyTimeToEmpty(), getStateOfCharge(), getStateOfHealth(), getTemperature(), getTimeToEmpty(), getTimeToFull(), getVoltage(), isCharging(), isDischarging(), and refresh().
|
protected |
Definition at line 1312 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by refresh().
|
protected |
Definition at line 1311 of file gauge/ti/GaugeBQ27220.hpp.
Referenced by refresh().