(commit 8e30d80 Add wake stub code to modesp32.c)
(See Espressif Docs and examples at https://gist.github.com/igrr/54f7fbe0513ac14e1aea3fd7fbecfeab)
ESP32 supports running a “deep sleep wake stub” when coming out of deep sleep. This function runs immediately as soon as the chip wakes up - before any normal initialisation, bootloader, or ESP-IDF code has run. After the wake stub runs, the SoC can go back to sleep or continue to start ESP-IDF normally.
- Useful for silently counting input pulses or timer based sampling of a GPIO input and periodically booting to micropython to send updates via ESPNow or Wifi.
- However, there are some severe limitations on what you can do in the wake_stub
function (see docs).
- In particular all coding must be in C and access only ESP32 ROM functions.