Wake from light sleep from IO or Alarm

Altivecer
Posts: 15
Joined: Thu May 05, 2022 10:55 pm

Wake from light sleep from IO or Alarm

Postby Altivecer » Sat Jun 04, 2022 5:19 pm

Is there any way to wake up from sleep when an I/O goes low or when a timer alarm goes off?
gpio_wakeup_enable((gpio_num_t)SW_1, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable((gpio_num_t)SW_2, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable((gpio_num_t)SW_3, GPIO_INTR_LOW_LEVEL);
esp_sleep_enable_gpio_wakeup();
esp_light_sleep_start();

This works to wake up from any of three gpios going low.

But there is not a alarm_wakeup_enable or esp_sleep_enable_alarm.

There is esp_sleep_enable_timer_wakeup, but it requires a time-to-sleep and does not keep going.
It seems to work, but when a GPIO interrupt comes in, I'd have to keep track of how much time is left when calling esp_sleep_enable_timer_wakeup to put the code back to sleep.

Who is online

Users browsing this forum: Bing [Bot] and 86 guests