MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / initAxp

Function initAxp

Devices/m5stack-core2/Source/devices/Power.cpp:18–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18bool initAxp() {
19 const auto axp = createAxp192();
20 return axp->init([](auto* driver) {
21 axp192_ioctl(driver, AXP192_LDO2_SET_VOLTAGE, 3300); // LCD + SD
22 axp192_ioctl(driver, AXP192_LDO3_SET_VOLTAGE, 0); // VIB_MOTOR STOP
23 axp192_ioctl(driver, AXP192_DCDC3_SET_VOLTAGE, 3300);
24
25 axp192_ioctl(driver, AXP192_LDO2_ENABLE);
26 axp192_ioctl(driver, AXP192_LDO3_DISABLE);
27 axp192_ioctl(driver, AXP192_DCDC3_ENABLE);
28
29 axp192_write(driver, AXP192_PWM1_DUTY_CYCLE_2, 255); // PWM 255 (LED OFF)
30 axp192_write(driver, AXP192_GPIO1_CONTROL, 0x02); // GPIO1 PWM
31
32 // TODO: We could charge at 390mA according to the M5Unified code, but the AXP driver in M5Unified limits to 132mA, so it's unclear what the AXP supports.
33 return true;
34 });
35
36}

Callers 1

initBootFunction · 0.50

Calls 4

axp192_ioctlFunction · 0.85
axp192_writeFunction · 0.85
createAxp192Function · 0.70
initMethod · 0.45

Tested by

no test coverage detected