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

#include <PmicSY6970.hpp>

Inheritance diagram for PmicSY6970:
[legend]

Public Member Functions

 PmicSY6970 ()
 Construct SY6970 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.
 
SY6970Chargercharger ()
 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.
 
SY6970Powerpower ()
 
SY6970Ledled ()
 
SY6970Adcadc ()
 
const PmicConfiggetConfig () const override
 Get device name.
 
const char * getChipName () const override
 Get PMIC device name.
 
SY6970Corecore ()
 Get core interface (mutable)
 
const SY6970Corecore () 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 62 of file PmicSY6970.hpp.

Constructor & Destructor Documentation

◆ PmicSY6970()

PmicSY6970::PmicSY6970 ( )
inline

Construct SY6970 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 72 of file PmicSY6970.hpp.

Member Function Documentation

◆ adc()

SY6970Adc & PmicSY6970::adc ( )
inline

Definition at line 247 of file PmicSY6970.hpp.

Referenced by loop(), and setup().

◆ begin()

bool PmicSY6970::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: SY6970_SLAVE_ADDRESS)
Returns
true on success

Implements PmicBase.

Definition at line 127 of file PmicSY6970.hpp.

References I2CDeviceWithHal::begin().

Referenced by setup().

◆ charger()

SY6970Charger & PmicSY6970::charger ( )
inline

Get charger interface.

Returns
Reference to SY6970Charger

Use for:

  • enableCharging(bool)
  • setPreChargeCurrent(uint16_t mA) [quantized to 64mA step]
  • setFastChargeCurrent(uint16_t mA) [quantized to 64mA step]
  • setTerminationCurrent(uint16_t mA) [quantized to 64mA step]
  • setChargeVoltage(uint16_t mV) [quantized to 16mV step]
  • getStatus()

Definition at line 167 of file PmicSY6970.hpp.

Referenced by loop(), and setup().

◆ core() [1/2]

SY6970Core & PmicSY6970::core ( )
inline

Get core interface (mutable)

Returns
Reference to SY6970Core

For direct register access and status reading.

Definition at line 287 of file PmicSY6970.hpp.

◆ core() [2/2]

const SY6970Core & PmicSY6970::core ( ) const
inline

Get core interface (const)

Returns
Const reference to SY6970Core

Definition at line 296 of file PmicSY6970.hpp.

◆ end()

void PmicSY6970::end ( )
inlinevirtual

Deinitialize and release resources.

Calls end() on the core to perform cleanup.

Implements PmicBase.

Definition at line 139 of file PmicSY6970.hpp.

References SY6970Core::end().

◆ getAdc()

PmicAdcBase & PmicSY6970::getAdc ( )
inlineoverridevirtual

Get ADC interface.

Returns
Reference to SY6970Adc

Use for:

  • read(Channel::VBAT_VOLTAGE, float &)
  • read(Channel::VSYS_VOLTAGE, float &)
  • read(Channel::VBUS_VOLTAGE, float &)
  • read(Channel::BAT_CURRENT, float &)
  • read(Channel::BAT_TEMPERATURE, float &)
  • setContinuousMode(bool)

Implements PmicBase.

Definition at line 209 of file PmicSY6970.hpp.

◆ getCapabilities()

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

Get supported PMIC capabilities.

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

Implements PmicBase.

Definition at line 150 of file PmicSY6970.hpp.

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

◆ getCharger()

PmicChargerBase * PmicSY6970::getCharger ( )
inlineoverridevirtual

Get charger interface (base class pointer)

Returns
Pointer to PmicChargerBase

Reimplemented from PmicBase.

Definition at line 176 of file PmicSY6970.hpp.

◆ getChipName()

const char * PmicSY6970::getChipName ( ) const
inlineoverridevirtual

Get PMIC device name.

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

Implements PmicBase.

Definition at line 276 of file PmicSY6970.hpp.

◆ getConfig()

const PmicConfig & PmicSY6970::getConfig ( ) const
inlineoverridevirtual

Get device name.

Returns
"SY6970"

Implements PmicBase.

Definition at line 256 of file PmicSY6970.hpp.

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

◆ getLed()

PmicLedBase & PmicSY6970::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
SY6970Led for chip-specific implementation

Implements PmicBase.

Definition at line 230 of file PmicSY6970.hpp.

◆ getPower()

PmicPowerBase & PmicSY6970::getPower ( )
inlineoverridevirtual

Get power management interface.

Returns
Reference to SY6970Power

Use for:

  • setMinimumSystemVoltage(uint32_t mv) [quantized to 100mV step]
  • setInputVoltageLimit(uint32_t mv) [quantized to 100mV step]
  • setInputCurrentLimit(uint32_t mA) [quantized to 50mA step]
  • enableBoost(bool)
  • setBoostVoltage(uint16_t mv) [quantized to 64mV step]

Implements PmicBase.

Definition at line 192 of file PmicSY6970.hpp.

◆ led()

SY6970Led & PmicSY6970::led ( )
inline

Definition at line 242 of file PmicSY6970.hpp.

Referenced by setup().

◆ power()

SY6970Power & PmicSY6970::power ( )
inline

Definition at line 237 of file PmicSY6970.hpp.

Referenced by loop(), and setup().


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