30#include "../../../SensorBuildOpt.h"
31#if !SENSORLIB_EXCLUDE_PMIC_AXP517
46 const uint8_t bit = 6;
55 if (cur < 0)
return false;
57 return _core.
writeReg(reg, (uint8_t)cur) >= 0;
64 if (cur < 0)
return false;
65 return (cur & 0x04) != 0;
78 uint8_t code = (uint8_t)((v >> 5) & 0x07);
80 out.type = mapResult(code);
Result readResult() override
Read the current BC1.2 detection result.
bool enableAutoDetect(bool enable) override
Enable or disable automatic BC1.2 detection.
AXP517Bc12(AXP517Core &core)
Construct an AXP517 BC1.2 driver.
bool isDetecting() override
Check if BC1.2 detection is currently in progress.
bool triggerDetect() override
Trigger a BC1.2 detection cycle.
AXP517 low-level core driver.
PortType
Common detected port/source type.
@ SDP
Standard Downstream Port (USB 500mA/900mA)
@ None
no valid detection / not connected
@ DCP
Dedicated Charging Port.
@ CDP
Charging Downstream Port.
bool clrRegBit(uint8_t reg, uint8_t bit)
int readReg(uint8_t reg) const
int writeReg(uint8_t reg, uint8_t val)
bool setRegBit(uint8_t reg, uint8_t bit)
bool detecting
detection in progress
static constexpr uint8_t CTRL3
BC1.2 control3.
static constexpr uint8_t CTRL0
BC1.2 control0.
static constexpr uint8_t BC_DETECT
BC_detect (status/result)