SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP202AdcTraits.hpp
Go to the documentation of this file.
1
39#pragma once
40
41#include "AXP202Core.hpp"
42#include "AXP202Regs.hpp"
43#include "../axp1xx/AXP1xxAdcTraits.hpp"
44
45namespace axp1xx
46{
47
59template<>
61{
62public:
63 static constexpr uint8_t ADC_EN1_ADDR = axp202_regs::adc::ADC_EN1;
64 static constexpr uint8_t ADC_EN2_ADDR = axp202_regs::adc::ADC_EN2;
65
69 static uint32_t getChannelMask(PmicAdcBase::Channel ch);
70
75 {
76 (void)ch;
77 return false;
78 }
79
84 {
85 (void)core;
86 (void)ch;
87 return true;
88 }
89
94 {
95 (void)core;
96 (void)ch;
97 return true;
98 }
99
103 static bool readChannel(AXP202Core &core, PmicAdcBase::Channel ch, float &out);
104
105private:
109 static uint16_t readRegisterH8L4(AXP202Core &core, uint8_t regH, uint8_t regL);
110};
111
112} // namespace axp1xx
113
114// Forward include AXP202Regs for the implementation
115#include "AXP202Regs.hpp"
116
117// Include inline implementation
@license MIT License
@license MIT License
@license MIT License
Channel
ADC channel bitmask.
static bool hasSpecialEnablement(PmicAdcBase::Channel ch)
AXP202 does not require special channel enablement.
static bool enableSpecialChannel(AXP202Core &core, PmicAdcBase::Channel ch)
No special enablement needed for AXP202.
static bool disableSpecialChannel(AXP202Core &core, PmicAdcBase::Channel ch)
No special disablement needed for AXP202.
Base traits class for AXP1xxAdc template specialization.
static constexpr uint8_t ADC_EN2_ADDR
ADC_EN2 register address.
static bool readChannel(CoreType &core, PmicAdcBase::Channel ch, float &out)
Main ADC channel reading implementation.
static constexpr uint8_t ADC_EN1_ADDR
ADC_EN1 register address.
static uint32_t getChannelMask(PmicAdcBase::Channel ch)
Map a Channel enum to its hardware enable mask.
static constexpr uint8_t ADC_EN2
static constexpr uint8_t ADC_EN1