SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP192AdcTraits.hpp
Go to the documentation of this file.
1
36#pragma once
37
38#include "AXP192Core.hpp"
39#include "AXP192Regs.hpp"
40#include "../axp1xx/AXP1xxAdcTraits.hpp"
41
42namespace axp1xx
43{
44
56template<>
58{
59public:
60 static constexpr uint8_t ADC_EN1_ADDR = axp192_regs::adc::ADC_EN1;
61 static constexpr uint8_t ADC_EN2_ADDR = axp192_regs::adc::ADC_EN2;
62
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
111 static bool readChannel(AXP192Core &core, PmicAdcBase::Channel ch, float &out);
112
113private:
117 static uint16_t readH8L4(AXP192Core &core, uint8_t regH, uint8_t regL);
118
122 static uint16_t readH8L5(AXP192Core &core, uint8_t regH, uint8_t regL);
123};
124
125} // namespace axp1xx
126
127// Include inline implementation
@license MIT License
@license MIT License
@license MIT License
Channel
ADC channel bitmask.
static bool disableSpecialChannel(AXP192Core &core, PmicAdcBase::Channel ch)
No special disablement needed for AXP192.
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.
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