|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
#include <BQ25896Charger.hpp>
Public Member Functions | |
| BQ25896Charger (BQ25896Core &core) | |
| Construct charger interface. | |
| ~BQ25896Charger ()=default | |
| bool | enableCharging (bool enable) override |
| Enable or disable charging. | |
| bool | isCharging () override |
| Check if charging is in progress. | |
| bool | setPreChargeCurrent (uint16_t mA) override |
| Set pre-charge current. | |
| uint16_t | getPreChargeCurrent () override |
| Get pre-charge current. | |
| bool | setFastChargeCurrent (uint16_t mA) override |
| Set fast charge (constant-current) current. | |
| uint16_t | getFastChargeCurrent () override |
| Get fast charge current. | |
| bool | setTerminationCurrent (uint16_t mA) override |
| Set termination current. | |
| uint16_t | getTerminationCurrent () override |
| Get termination current. | |
| bool | setChargeVoltage (uint16_t mV) override |
| Set charge voltage (constant voltage phase) | |
| uint16_t | getChargeVoltage () override |
| Get charge voltage. | |
| Status | getStatus () override |
| Get charger status. | |
Public Member Functions inherited from PmicChargerBase | |
| virtual | ~PmicChargerBase ()=default |
| Virtual destructor. | |
Additional Inherited Members | |
Public Types inherited from PmicChargerBase | |
| enum class | ChargingStatus : uint8_t { NO_CHARGING = 0 , PRE_CHARGE = 1 , FAST_CHARGE = 2 , TERMINATION = 3 , UNKNOWN = 0xFF } |
| Charging status enumeration. More... | |
Definition at line 67 of file BQ25896Charger.hpp.
|
explicit |
Construct charger interface.
| core | Reference to BQ25896 core communication |
Definition at line 38 of file BQ25896Charger.cpp.
|
default |
|
overridevirtual |
Enable or disable charging.
Enables or disables the charging function. When disabled, the charger stops all charging operations immediately.
| enable | true to enable charging, false to disable |
Implements PmicChargerBase.
Definition at line 40 of file BQ25896Charger.cpp.
References SensorCommWrapper::updateBits().
|
overridevirtual |
Get charge voltage.
Reads the configured charge voltage from hardware.
Implements PmicChargerBase.
Definition at line 133 of file BQ25896Charger.cpp.
References SensorCommWrapper::readReg().
Referenced by setup().
|
overridevirtual |
Get fast charge current.
Reads the configured fast charge current from hardware.
Implements PmicChargerBase.
Definition at line 92 of file BQ25896Charger.cpp.
References SensorCommWrapper::readReg().
Referenced by setup().
|
overridevirtual |
Get pre-charge current.
Reads the configured pre-charge current from hardware.
Implements PmicChargerBase.
Definition at line 69 of file BQ25896Charger.cpp.
References SensorCommWrapper::readReg().
Referenced by setup().
|
overridevirtual |
Get charger status.
Returns a comprehensive status structure containing all relevant charger state information.
Implements PmicChargerBase.
Definition at line 144 of file BQ25896Charger.cpp.
References PmicChargerBase::Status::chargeDone, PmicChargerBase::Status::charging, PmicChargerBase::Status::chargingStatus, PmicChargerBase::FAST_CHARGE, PmicChargerBase::Status::fault, PmicChargerBase::Status::faultCode, BQ25896Core::getChargeStatus(), BQ25896Core::getFaultStatus(), BQ25896Core::isChargeDone(), BQ25896Core::isCharging(), BQ25896Core::isValid(), BQ25896Core::isVbusPresent(), PmicChargerBase::NO_CHARGING, PmicChargerBase::Status::online, PmicChargerBase::PRE_CHARGE, PmicChargerBase::TERMINATION, PmicChargerBase::UNKNOWN, and PmicChargerBase::Status::vbusPresent.
Referenced by loop().
|
overridevirtual |
Get termination current.
Reads the configured termination current from hardware.
Implements PmicChargerBase.
Definition at line 112 of file BQ25896Charger.cpp.
References SensorCommWrapper::readReg().
Referenced by setup().
|
overridevirtual |
Check if charging is in progress.
Returns the current charging state. This is a best-effort indication and may not always reflect the exact charger state.
Implements PmicChargerBase.
Definition at line 51 of file BQ25896Charger.cpp.
References BQ25896Core::isCharging().
Referenced by loop().
|
overridevirtual |
Set charge voltage (constant voltage phase)
Sets the target voltage during the constant voltage (CV) phase of charging. The charger maintains this voltage while the current gradually decreases.
| mV | Charge voltage in millivolts (3840-4608mV) Value will be quantized to nearest valid step (16mV).
|
Implements PmicChargerBase.
Definition at line 120 of file BQ25896Charger.cpp.
References SensorCommWrapper::updateBits().
Referenced by setup().
|
overridevirtual |
Set fast charge (constant-current) current.
Sets the maximum charging current during the fast charge phase. This is the main charging current applied when battery voltage is above the BATLOWV threshold.
| mA | Fast charge current in milliamps (0-3008mA) Value will be quantized to nearest valid step (64mA).
|
Implements PmicChargerBase.
Definition at line 77 of file BQ25896Charger.cpp.
References SensorCommWrapper::updateBits().
Referenced by setup().
|
overridevirtual |
Set pre-charge current.
Sets the current used during the pre-charge phase when battery voltage is below the BATLOWV threshold (default 3.0V).
| mA | Pre-charge current in milliamps (64-1024mA) Value will be quantized to nearest valid step (64mA).
|
Implements PmicChargerBase.
Definition at line 56 of file BQ25896Charger.cpp.
References SensorCommWrapper::updateBits().
Referenced by setup().
|
overridevirtual |
Set termination current.
Sets the current threshold used to detect charge termination. When charge current drops below this value, charging is considered complete.
| mA | Termination current in milliamps (64-1024mA) Value will be quantized to nearest valid step (64mA). |
Implements PmicChargerBase.
Definition at line 99 of file BQ25896Charger.cpp.
References SensorCommWrapper::updateBits().
Referenced by setup().