Code: Select all
...
esp_light_sleep_start();
printf("WakeUP!\n");
/* Determine wake up reason */
const char* wakeup_reason;
switch (esp_sleep_get_wakeup_cause()) {
case ESP_SLEEP_WAKEUP_TIMER:
wakeup_reason = "timer";
break;
case ESP_SLEEP_WAKEUP_GPIO:
wakeup_reason = "pin";
break;
default:
wakeup_reason = "other";
break;
}
printf("Returned from light sleep, reason: %s\n", wakeup_reason);
...
Is there a saved value for this? Or do I have to do a kind of "trick" of reading the GPIO right after the interrupt? Any better way than that?
Thank you.
Gustavo