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

Function powerOn

Devices/lilygo-tdeck/Source/Init.cpp:16–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14constexpr auto TDECK_POWERON_GPIO = GPIO_NUM_10;
15
16static bool powerOn() {
17 gpio_config_t device_power_signal_config = {
18 .pin_bit_mask = BIT64(TDECK_POWERON_GPIO),
19 .mode = GPIO_MODE_OUTPUT,
20 .pull_up_en = GPIO_PULLUP_DISABLE,
21 .pull_down_en = GPIO_PULLDOWN_DISABLE,
22 .intr_type = GPIO_INTR_DISABLE,
23 };
24
25 if (gpio_config(&device_power_signal_config) != ESP_OK) {
26 return false;
27 }
28
29 if (gpio_set_level(TDECK_POWERON_GPIO, 1) != ESP_OK) {
30 return false;
31 }
32
33 // Avoids crash when no SD card is inserted. It's unknown why, but likely is related to power draw.
34 tt::kernel::delayMillis(100);
35
36 return true;
37}
38
39bool initBoot() {
40 LOGGER.info(LOG_MESSAGE_POWER_ON_START);

Callers 1

initBootFunction · 0.70

Calls 1

delayMillisFunction · 0.85

Tested by

no test coverage detected