Replies: 1 comment
-
I am answering my own question(s). No, you can't use the HW timers directly if you are using esp_light_sleep to power down the CPU. And lots of other approaches fails as well. The solution for me was to use the esp_timer.h functions, which provide for multiple one-time and/or periodic timers and it works across a light_sleep. One caveat: timers will NOT trigger in the midst of a light sleep and will be deferred until light_sleep finishes. At that point, the timer times are recalculated and any timers which should have triggered will now take place. Breaking a longish light_sleep into a loop with multiple shorter sleeps can minimize this matter. |
Beta Was this translation helpful? Give feedback.
-
In my sketch I use to following to cause a wakeup in sleepTime usec.
esp_sleep_enable_timer_wakeup(sleepTime); // value in microsec: time left to wake up
esp_light_sleep_start();
...
I also want to code timer interrupts myself, using the four general purpose timers (0...3) to handle multiple cyclic events.
Am I free to use any of the four timers, and to invoke esp_light_sleep_start as well?
Beta Was this translation helpful? Give feedback.
All reactions