SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP2101Adc.hpp
Go to the documentation of this file.
1
31#pragma once
32#include "../../PmicAdcBase.hpp"
33#include "AXP2101Core.hpp"
34
52class AXP2101Adc : public PmicAdcBase
53{
54public:
55 // Hardware bitmask constants (for direct register control)
56 static constexpr uint8_t ADC_DIE_TEMP_HW = 0x10; // REG30H bit 4
57 static constexpr uint8_t ADC_SYSTEM_VOLTAGE_HW = 0x08; // REG30H bit 3
58 static constexpr uint8_t ADC_VBUS_VOLTAGE_HW = 0x04; // REG30H bit 2
59 static constexpr uint8_t ADC_TS_PIN_HW = 0x02; // REG30H bit 1
60 static constexpr uint8_t ADC_BAT_VOLTAGE_HW = 0x01; // REG30H bit 0
61
62 explicit AXP2101Adc(AXP2101Core &core);
63 ~AXP2101Adc() = default;
64
73
74 bool enableChannels(uint32_t mask) override;
75
81 bool disableChannels(uint32_t mask) override;
82
97 bool read(Channel ch, float &out) override;
98
113 float getTsTemperature(float SteinhartA = 1.126e-3f,
114 float SteinhartB = 2.38e-4f,
115 float SteinhartC = 8.5e-8f);
116
117private:
118 AXP2101Core &_core;
119};
@license MIT License
ADC control for the AXP2101 PMIC.
static constexpr uint8_t ADC_SYSTEM_VOLTAGE_HW
static constexpr uint8_t ADC_BAT_VOLTAGE_HW
bool disableChannels(uint32_t mask) override
Disable one or more ADC channels (REG 0x30).
float getTsTemperature(float SteinhartA=1.126e-3f, float SteinhartB=2.38e-4f, float SteinhartC=8.5e-8f)
Read TS pin temperature using Steinhart-Hart equation.
bool enableChannels(uint32_t mask) override
Enable one or more ADC channels.
static constexpr uint8_t ADC_TS_PIN_HW
~AXP2101Adc()=default
bool read(Channel ch, float &out) override
Read an ADC channel value.
static constexpr uint8_t ADC_VBUS_VOLTAGE_HW
static constexpr uint8_t ADC_DIE_TEMP_HW
Core I2C communication layer for the AXP2101 PMIC.
bool disableChannels(Channel mask)
Disable one or more ADC channels by Channel enum.
bool enableChannels(Channel mask)
Enable one or more ADC channels by Channel enum.
Channel
ADC channel bitmask.