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

Function powerOn

Devices/m5stack-papers3/Source/Init.cpp:10–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8constexpr gpio_num_t USB_DETECT_PIN = GPIO_NUM_5;
9
10static bool powerOn() {
11 if (gpio_reset_pin(CHARGE_STATUS_PIN) != ESP_OK) {
12 LOGGER.error("Failed to reset CHARGE_STATUS_PIN");
13 return false;
14 }
15
16 if (gpio_set_direction(CHARGE_STATUS_PIN, GPIO_MODE_INPUT) != ESP_OK) {
17 LOGGER.error("Failed to set direction for CHARGE_STATUS_PIN");
18 return false;
19 }
20
21 if (gpio_reset_pin(USB_DETECT_PIN) != ESP_OK) {
22 LOGGER.error("Failed to reset USB_DETECT_PIN");
23 return false;
24 }
25
26 if (gpio_set_direction(USB_DETECT_PIN, GPIO_MODE_INPUT) != ESP_OK) {
27 LOGGER.error("Failed to set direction for USB_DETECT_PIN");
28 return false;
29 }
30
31 // VBAT_PIN is used as ADC input; only reset it here to clear any previous
32 // configuration. The ADC driver (ChargeFromAdcVoltage) configures it for ADC use.
33 if (gpio_reset_pin(VBAT_PIN) != ESP_OK) {
34 LOGGER.error("Failed to reset VBAT_PIN");
35 return false;
36 }
37 return true;
38}
39
40bool initBoot() {
41 LOGGER.info("Power on");

Callers 1

initBootFunction · 0.70

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected