57 default:
return "Invalid";
66 Serial.println(
"\n=== AXP517 BC1.2 Example ===\n");
69 Serial.println(
"Failed to init AXP517!");
70 while (1) delay(1000);
77 Serial.println(
"BC1.2 Auto Detect: Enabled");
79 Serial.println(
"\nConnect USB device to test...\n");
84 static uint32_t lastCheck = 0;
87 if (millis() - lastCheck > 500) {
92 if (result.type != lastType) {
93 Serial.println(
"\n=== BC1.2 Result ===");
94 Serial.print(
"Status: ");
95 Serial.println(result.detecting ?
"Detected" :
"Not detected");
96 Serial.print(
"Port Type: ");
98 Serial.print(
"Raw Code: 0x");
99 Serial.println(result.raw, HEX);
100 lastType = result.
type;
const char * portTypeName(PmicBc12Base::PortType type)
Result readResult() override
Read the current BC1.2 detection result.
bool enableAutoDetect(bool enable) override
Enable or disable automatic BC1.2 detection.
High-level driver facade for the X-Powers AXP517 PMIC.
bool enableModule(Module module, bool enable)
Enable or disable a functional module.
AXP517Bc12 & bc12()
Access the AXP517 BC1.2 driver.
bool begin(SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
Initialization using a custom communication interface.
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.