98 en2 |= (hwMask >> 8) & 0xFF;
99 if (RegTraits::hasSpecialEnablement(ch)) {
106 int val = _core.readReg(RegTraits::ADC_EN1_ADDR);
107 if (val < 0)
return false;
109 if (_core.writeReg(RegTraits::ADC_EN1_ADDR,
static_cast<uint8_t
>(val)) < 0) {
114 int val = _core.readReg(RegTraits::ADC_EN2_ADDR);
115 if (val < 0)
return false;
117 if (_core.writeReg(RegTraits::ADC_EN2_ADDR,
static_cast<uint8_t
>(val)) < 0) {
126 forEachChannel(mask, [&](uint32_t bit) {
128 if (RegTraits::hasSpecialEnablement(ch)) {
129 RegTraits::disableSpecialChannel(_core, ch);
137template<
typename CoreType,
typename RegTraits>
138uint16_t AXP1xxAdc<CoreType, RegTraits>::readH8L4(uint8_t regH, uint8_t regL)
140 int h = _core.readReg(regH);
141 int l = _core.readReg(regL);
142 if (h < 0 || l < 0)
return 0;
143 return (
static_cast<uint16_t
>(h) << 4) | (l & 0x0F);
146template<
typename CoreType,
typename RegTraits>
147uint16_t AXP1xxAdc<CoreType, RegTraits>::readH8L5(uint8_t regH, uint8_t regL)
149 int h = _core.readReg(regH);
150 int l = _core.readReg(regL);
151 if (h < 0 || l < 0)
return 0;
152 return (
static_cast<uint16_t
>(h) << 5) | (l & 0x1F);
155template<
typename CoreType,
typename RegTraits>
161 return RegTraits::readChannel(_core, ch, out);