SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
PmicBQ25896 Class Reference

#include <PmicBQ25896.hpp>

Inheritance diagram for PmicBQ25896:
[legend]

Public Member Functions

 PmicBQ25896 ()
 Construct BQ25896 PMIC interface.
 
bool begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
 Initialize using custom I2C callback.
 
void end ()
 Deinitialize and release resources.
 
PmicCapability::Capability getCapabilities () const override
 Get supported PMIC capabilities.
 
BQ25896Chargercharger ()
 Get charger interface.
 
PmicChargerBasegetCharger () override
 Get charger interface (base class pointer)
 
PmicPowerBasegetPower () override
 Get power management interface.
 
PmicAdcBasegetAdc () override
 Get ADC interface.
 
PmicLedBasegetLed () override
 Get LED interface.
 
BQ25896Powerpower ()
 
BQ25896Ledled ()
 
BQ25896Adcadc ()
 
const PmicConfiggetConfig () const override
 Get device name.
 
const char * getChipName () const override
 Get PMIC device name.
 
BQ25896Corecore ()
 Get core interface (mutable)
 
const BQ25896Corecore () const
 Get core interface (const)
 
- Public Member Functions inherited from PmicBase
virtual ~PmicBase ()=default
 Virtual destructor.
 
virtual PmicGpioBasegetGpio ()
 Get GPIO interface.
 
virtual PmicChannelBasegetChannel ()
 Get power output channel interface.
 
virtual PmicIrqBasegetIrq ()
 Get interrupt interface.
 

Detailed Description

Definition at line 84 of file PmicBQ25896.hpp.

Constructor & Destructor Documentation

◆ PmicBQ25896()

PmicBQ25896::PmicBQ25896 ( )
inline

Construct BQ25896 PMIC interface.

Initializes the internal core and sub-modules. Sub-modules (charger, power, adc) are constructed with reference to the shared core.

Definition at line 94 of file PmicBQ25896.hpp.

Member Function Documentation

◆ adc()

BQ25896Adc & PmicBQ25896::adc ( )
inline

Definition at line 277 of file PmicBQ25896.hpp.

Referenced by loop(), and setup().

◆ begin()

bool PmicBQ25896::begin ( SensorCommCustom::CustomCallback  callback,
SensorCommCustomHal::CustomHalCallback  hal_cb,
uint8_t  addr 
)
inlinevirtual

Initialize using custom I2C callback.

For custom I2C implementations (bit-banging, SPI-I2C bridge, etc.)

Parameters
callbackCustom read/write callback function
hal_cbNo use this callback,can be nullptr
addrI2C address (default: BQ25896_SLAVE_ADDRESS = 0x6B)
Returns
true on success

Implements PmicBase.

Definition at line 153 of file PmicBQ25896.hpp.

References I2CDeviceWithHal::begin().

Referenced by setup().

◆ charger()

BQ25896Charger & PmicBQ25896::charger ( )
inline

Get charger interface.

Returns
Reference to BQ25896Charger

Use for:

  • enableCharging(bool)
  • setPreChargeCurrent(uint16_t mA) [quantized to 64mA step, 64-1024mA]
  • setFastChargeCurrent(uint16_t mA) [quantized to 64mA step, 0-3008mA]
  • setTerminationCurrent(uint16_t mA) [quantized to 64mA step, 64-1024mA]
  • setChargeVoltage(uint16_t mV) [quantized to 16mV step, 3840-4608mV]
  • getStatus()

Definition at line 193 of file PmicBQ25896.hpp.

Referenced by loop(), and setup().

◆ core() [1/2]

BQ25896Core & PmicBQ25896::core ( )
inline

Get core interface (mutable)

Returns
Reference to BQ25896Core

For direct register access, status reading, and advanced control. Use this for:

  • isVbusPresent() - check if USB power is connected
  • getBusStatus() - get detected input type (SDP/Adapter/OTG)
  • isVindpmActive() / isIindpmActive() - check dynamic power management
  • getNtcPercentage() - get NTC percentage (see ADC warning above)
  • getFaultStatus() - read detailed fault information

Definition at line 323 of file PmicBQ25896.hpp.

Referenced by loop().

◆ core() [2/2]

const BQ25896Core & PmicBQ25896::core ( ) const
inline

Get core interface (const)

Returns
Const reference to BQ25896Core

Definition at line 332 of file PmicBQ25896.hpp.

◆ end()

void PmicBQ25896::end ( )
inlinevirtual

Deinitialize and release resources.

Calls end() on the core to perform cleanup.

Implements PmicBase.

Definition at line 165 of file PmicBQ25896.hpp.

References BQ25896Core::end().

◆ getAdc()

PmicAdcBase & PmicBQ25896::getAdc ( )
inlineoverridevirtual

Get ADC interface.

Returns
Reference to BQ25896Adc

Use for:

  • read(Channel::VBUS_VOLTAGE, float &) - millivolts
  • read(Channel::BAT_VOLTAGE, float &) - millivolts
  • read(Channel::VSYS_VOLTAGE, float &) - millivolts
  • read(Channel::BAT_CURRENT, float &) - milliamps
  • read(Channel::BAT_TEMPERATURE, float &) - NTC percentage (NOT temperature!)
  • read(Channel::DIE_TEMPERATURE, float &) - thermal status flag
  • setContinuousMode(bool)
Warning
BAT_TEMPERATURE returns percentage (21-80%), NOT temperature! See BQ25896Adc.hpp documentation for details.

Implements PmicBase.

Definition at line 239 of file PmicBQ25896.hpp.

◆ getCapabilities()

PmicCapability::Capability PmicBQ25896::getCapabilities ( ) const
inlineoverridevirtual

Get supported PMIC capabilities.

Returns
Bitmask of PmicCapability::Capability flags
Note
BQ25896 supports: CHARGER, POWER, ADC

Implements PmicBase.

Definition at line 176 of file PmicBQ25896.hpp.

References PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportCharger, and PmicCapability::PmicSupportPower.

◆ getCharger()

PmicChargerBase * PmicBQ25896::getCharger ( )
inlineoverridevirtual

Get charger interface (base class pointer)

Returns
Pointer to PmicChargerBase

Reimplemented from PmicBase.

Definition at line 202 of file PmicBQ25896.hpp.

◆ getChipName()

const char * PmicBQ25896::getChipName ( ) const
inlineoverridevirtual

Get PMIC device name.

Returns
C-string containing device name (e.g., "BQ25896", "SY6970")

Implements PmicBase.

Definition at line 306 of file PmicBQ25896.hpp.

◆ getConfig()

const PmicConfig & PmicBQ25896::getConfig ( ) const
inlineoverridevirtual

Get device name.

Returns
"BQ25896"

Implements PmicBase.

Definition at line 286 of file PmicBQ25896.hpp.

References PmicConfig::chipName, PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportCharger, and PmicCapability::PmicSupportPower.

◆ getLed()

PmicLedBase & PmicBQ25896::getLed ( )
inlineoverridevirtual

Get LED interface.

Controls the STAT pin for charging status indication.

// Disable STAT LED
// Enable STAT LED (hardware-controlled)
PmicAXP192 pmic
bool setMode(Mode mode) override
Set LED operating mode.
Definition AXP1xxLed.hpp:74
AXP1xxLed< axp192_regs > & led()
Access the LED module.
@ AUTO
PMIC controls LED automatically (e.g.
@ DISABLE
LED is disabled (if supported).
See also
PmicLedBase for available methods
BQ25896Led for chip-specific implementation

Implements PmicBase.

Definition at line 260 of file PmicBQ25896.hpp.

◆ getPower()

PmicPowerBase & PmicBQ25896::getPower ( )
inlineoverridevirtual

Get power management interface.

Returns
Reference to BQ25896Power

Use for:

  • setMinimumSystemVoltage(uint32_t mv) [quantized to 100mV step, 3000-3700mV]
  • setInputVoltageLimit(uint32_t mv) [quantized to 100mV step, 3900-15300mV]
  • setInputCurrentLimit(uint32_t mA) [quantized to 50mA step, 100-3250mA]
  • enableBoost(bool) [requires no VBUS connected]
  • setBoostVoltage(uint16_t mv) [quantized to 64mV step, 4550-5510mV]

Implements PmicBase.

Definition at line 218 of file PmicBQ25896.hpp.

◆ led()

BQ25896Led & PmicBQ25896::led ( )
inline

Definition at line 272 of file PmicBQ25896.hpp.

Referenced by setup().

◆ power()

BQ25896Power & PmicBQ25896::power ( )
inline

Definition at line 267 of file PmicBQ25896.hpp.

Referenced by loop(), and setup().


The documentation for this class was generated from the following file: