|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
@license MIT License More...
#include <GaugeDrv.hpp>Go to the source code of this file.
Macros | |
| #define | SENSOR_SDA 2 |
| #define | SENSOR_SCL 3 |
Functions | |
| void | setup () |
| void | loop () |
Variables | |
| GaugeBQ27220 | gauge |
@license MIT License
Copyright (c) 2025 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file bq27220_gauge.ino.
| #define SENSOR_SCL 3 |
Definition at line 37 of file bq27220_gauge.ino.
| #define SENSOR_SDA 2 |
Definition at line 33 of file bq27220_gauge.ino.
| void loop | ( | ) |
Definition at line 154 of file bq27220_gauge.ino.
References gauge, GaugeBQ27220::getAtRate(), GaugeBQ27220::getAtRateTimeToEmpty(), GaugeBQ27220::getAveragePower(), GaugeBQ27220::getBatteryStatus(), GaugeBQ27220::getBTPChargeSet(), GaugeBQ27220::getBTPDischargeSet(), GaugeBQ27220::getCurrent(), GaugeBQ27220::getCycleCount(), GaugeBQ27220::getDesignCapacity(), GaugeBQ27220::getFullChargeCapacity(), GaugeBQ27220::getInternalTemperature(), FuelGaugeOperationStatus::getIsBatteryVoltageBelowEdv2(), FuelGaugeOperationStatus::getIsBtpThresholdExceeded(), FuelGaugeOperationStatus::getIsCalibrationModeEnabled(), FuelGaugeOperationStatus::getIsCapacityAccumulationThrottled(), FuelGaugeOperationStatus::getIsConfigUpdateMode(), FuelGaugeOperationStatus::getIsDischargeCycleCompliant(), FuelGaugeOperationStatus::getIsInitializationComplete(), GaugeBQ27220::getMaxLoadCurrent(), GaugeBQ27220::getMaxLoadTimeToEmpty(), GaugeBQ27220::getOperationStatus(), GaugeBQ27220::getRawCoulombCount(), GaugeBQ27220::getRemainingCapacity(), GaugeBQ27220::getRequestChargingCurrent(), GaugeBQ27220::getRequestChargingVoltage(), FuelGaugeOperationStatus::getSecurityAccessLevel(), GaugeBQ27220::getStandbyCurrent(), GaugeBQ27220::getStandbyTimeToEmpty(), GaugeBQ27220::getStateOfCharge(), GaugeBQ27220::getStateOfHealth(), GaugeBQ27220::getTemperature(), GaugeBQ27220::getTimeToEmpty(), GaugeBQ27220::getTimeToFull(), GaugeBQ27220::getVoltage(), BatteryStatus::isBatteryInserted(), BatteryStatus::isBatteryPresent(), BatteryStatus::isChargeInhibited(), BatteryStatus::isChargingTerminationAlarm(), BatteryStatus::isDischargeTerminationAlarm(), BatteryStatus::isFullChargeDetected(), BatteryStatus::isFullDischargeDetected(), BatteryStatus::isGoodOcvMeasurement(), BatteryStatus::isInDischargeMode(), BatteryStatus::isInSleepMode(), BatteryStatus::isOcvMeasurementUpdateComplete(), BatteryStatus::isOcvReadFailedDueToCurrent(), BatteryStatus::isOverTemperatureDuringCharging(), BatteryStatus::isOverTemperatureDuringDischarge(), BatteryStatus::isSystemShutdownRequired(), and GaugeBQ27220::refresh().
| void setup | ( | ) |
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 42 of file bq27220_gauge.ino.
References GaugeBQ27220::begin(), OperationConfig::canEnterSleep(), gauge, OperationConfig::getConfigA(), OperationConfig::getConfigB(), GaugeBQ27220::getOperationConfig(), OperationConfig::getPfcCfg(), OperationConfig::getWkTh0(), OperationConfig::getWkTh1(), OperationConfig::isBatgEnEnabled(), OperationConfig::isBatgPolHigh(), OperationConfig::isBienableEnabled(), OperationConfig::isBlPupEnEnabled(), OperationConfig::isDefaultSealEnabled(), OperationConfig::isIntBatLEnabled(), OperationConfig::isIntBremEnabled(), OperationConfig::isIntFocvEnabled(), OperationConfig::isIntOcvEnabled(), OperationConfig::isIntOtEnabled(), OperationConfig::isIntPolHigh(), OperationConfig::isIntStateEnabled(), OperationConfig::isNonRemovableSet(), OperationConfig::isSlpwakechgEnabled(), OperationConfig::isTempsSet(), OperationConfig::isWakeEnEnabled(), OperationConfig::isWrtempEnabled(), SENSOR_SCL, SENSOR_SDA, and GaugeBQ27220::setNewCapacity().
| GaugeBQ27220 gauge |
Definition at line 40 of file bq27220_gauge.ino.