SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
axp1xx::AdcTraitsBase< AXP192Core > Class Reference

AXP192 ADC traits specialization. More...

#include <AXP192AdcTraits.hpp>

Static Public Member Functions

static uint32_t getChannelMask (PmicAdcBase::Channel ch)
 Map PmicAdcBase::Channel to AXP192 ADC enable mask.
 
static bool hasSpecialEnablement (PmicAdcBase::Channel ch)
 AXP192 does not require special channel enablement.
 
static bool enableSpecialChannel (AXP192Core &core, PmicAdcBase::Channel ch)
 No special enablement needed for AXP192.
 
static bool disableSpecialChannel (AXP192Core &core, PmicAdcBase::Channel ch)
 No special disablement needed for AXP192.
 
static bool readChannel (AXP192Core &core, PmicAdcBase::Channel ch, float &out)
 Read a single ADC channel value for AXP192.
 

Static Public Attributes

static constexpr uint8_t ADC_EN1_ADDR = axp192_regs::adc::ADC_EN1
 
static constexpr uint8_t ADC_EN2_ADDR = axp192_regs::adc::ADC_EN2
 

Detailed Description

AXP192 ADC traits specialization.

Implements the AdcTraitsBase interface for AXP192, providing:

  • Register addresses for ADC control
  • Channel mask definitions
  • ADC reading logic for all supported channels
Note
AXP192 supports 9 logical ADC channels (VBUS, BAT, APS, TS, TEMP, ACIN, etc.) with 12-bit H8L4 and 13-bit H8L5 register formats.

Definition at line 57 of file AXP192AdcTraits.hpp.

Member Function Documentation

◆ disableSpecialChannel()

static bool axp1xx::AdcTraitsBase< AXP192Core >::disableSpecialChannel ( AXP192Core core,
PmicAdcBase::Channel  ch 
)
inlinestatic

No special disablement needed for AXP192.

Definition at line 93 of file AXP192AdcTraits.hpp.

◆ enableSpecialChannel()

static bool axp1xx::AdcTraitsBase< AXP192Core >::enableSpecialChannel ( AXP192Core core,
PmicAdcBase::Channel  ch 
)
inlinestatic

No special enablement needed for AXP192.

Definition at line 83 of file AXP192AdcTraits.hpp.

◆ getChannelMask()

uint32_t axp1xx::AdcTraitsBase< AXP192Core >::getChannelMask ( PmicAdcBase::Channel  ch)
inlinestatic

Map PmicAdcBase::Channel to AXP192 ADC enable mask.

Returns a bitmask to enable the corresponding ADC channel. Lower 8 bits go to ADC_EN1, upper 8 bits to ADC_EN2.

Definition at line 42 of file AXP192AdcTraits_impl.hpp.

References PmicAdcBase::ACIN_CURRENT, PmicAdcBase::ACIN_VOLTAGE, PmicAdcBase::BAT_CURRENT, PmicAdcBase::BAT_VOLTAGE, PmicAdcBase::DIE_TEMPERATURE, PmicAdcBase::VBUS_CURRENT, PmicAdcBase::VBUS_VOLTAGE, and PmicAdcBase::VSYS_VOLTAGE.

◆ hasSpecialEnablement()

static bool axp1xx::AdcTraitsBase< AXP192Core >::hasSpecialEnablement ( PmicAdcBase::Channel  ch)
inlinestatic

AXP192 does not require special channel enablement.

Definition at line 74 of file AXP192AdcTraits.hpp.

◆ readChannel()

bool axp1xx::AdcTraitsBase< AXP192Core >::readChannel ( AXP192Core core,
PmicAdcBase::Channel  ch,
float &  out 
)
inlinestatic

Read a single ADC channel value for AXP192.

Implements channel-specific register reads, device state checks, and ADC value conversion using the AXP192's conversion factors.

Parameters
coreReference to AXP192Core
chChannel to read
outReference to output float
Returns
true on success

Definition at line 79 of file AXP192AdcTraits_impl.hpp.

References axp192_regs::ac::ACIN_CUR_H8, axp192_regs::ac::ACIN_CUR_L4, PmicAdcBase::ACIN_CURRENT, axp192_regs::factory::ACIN_CURRENT_STEP, axp192_regs::ac::ACIN_VOL_H8, axp192_regs::ac::ACIN_VOL_L4, PmicAdcBase::ACIN_VOLTAGE, axp192_regs::factory::ACIN_VOLTAGE_STEP, axp192_regs::adc::APS_AVERVOL_H8, axp192_regs::adc::APS_AVERVOL_L4, axp192_regs::factory::APS_VOLTAGE_STEP, axp192_regs::adc::BAT_AVERCHGCUR_H8, axp192_regs::adc::BAT_AVERCHGCUR_L5, axp192_regs::adc::BAT_AVERDISCHGCUR_H8, axp192_regs::adc::BAT_AVERDISCHGCUR_L5, axp192_regs::adc::BAT_AVERVOL_H8, axp192_regs::adc::BAT_AVERVOL_L4, axp192_regs::factory::BAT_CHARGE_CUR_STEP, PmicAdcBase::BAT_CURRENT, axp192_regs::factory::BAT_DISCHARGE_CUR_STEP, PmicAdcBase::BAT_PERCENTAGE, PmicAdcBase::BAT_TEMPERATURE, PmicAdcBase::BAT_VOLTAGE, axp192_regs::factory::BAT_VOLTAGE_STEP, PmicAdcBase::DIE_TEMPERATURE, axp192_regs::adc::INTERNAL_TEMP_H8, axp192_regs::adc::INTERNAL_TEMP_L4, axp192_regs::factory::INTERNAL_TEMP_OFFSET, axp192_regs::factory::INTERNAL_TEMP_STEP, axp192_regs::bmu::MODE_CHGSTATUS, SensorCommWrapper::readReg(), axp192_regs::bmu::STATUS, axp192_regs::adc::VBUS_CUR_H8, axp192_regs::adc::VBUS_CUR_L4, PmicAdcBase::VBUS_CURRENT, axp192_regs::factory::VBUS_CURRENT_STEP, axp192_regs::adc::VBUS_VOL_H8, axp192_regs::adc::VBUS_VOL_L4, PmicAdcBase::VBUS_VOLTAGE, axp192_regs::factory::VBUS_VOLTAGE_STEP, and PmicAdcBase::VSYS_VOLTAGE.

Member Data Documentation

◆ ADC_EN1_ADDR

constexpr uint8_t axp1xx::AdcTraitsBase< AXP192Core >::ADC_EN1_ADDR = axp192_regs::adc::ADC_EN1
staticconstexpr

Definition at line 60 of file AXP192AdcTraits.hpp.

◆ ADC_EN2_ADDR

constexpr uint8_t axp1xx::AdcTraitsBase< AXP192Core >::ADC_EN2_ADDR = axp192_regs::adc::ADC_EN2
staticconstexpr

Definition at line 61 of file AXP192AdcTraits.hpp.


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