MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / startDeepSleep

Method startDeepSleep

lib/hal/HalGPIO.cpp:228–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226unsigned long HalGPIO::getPowerButtonHeldTime() const { return inputMgr.getPowerButtonHeldTime(); }
227
228void HalGPIO::startDeepSleep() {
229 // Ensure that the power button has been released to avoid immediately turning back on if you're holding it
230 while (inputMgr.isPressed(BTN_POWER)) {
231 delay(50);
232 inputMgr.update();
233 }
234 // Arm the wakeup trigger *after* the button is released
235 esp_deep_sleep_enable_gpio_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_GPIO_WAKEUP_GPIO_LOW);
236 // Enter Deep Sleep
237 esp_deep_sleep_start();
238}
239
240void HalGPIO::verifyPowerButtonWakeup(uint16_t requiredDurationMs, bool shortPressAllowed) {
241 if (shortPressAllowed) {

Callers 3

enterDeepSleepFunction · 0.45
setupFunction · 0.45

Calls 2

isPressedMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected