| 16 | } |
| 17 | |
| 18 | bool 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 | } |
no test coverage detected