ESP32-C3 wakeup from deepsleep not happening through GPIO1
GPIO1 of ESP32-C3 is a RTC GPIO and should be able to wakeup the device from deepsleep mode.
But it seems, in micropython, the GPIO1 is not defined as wakeup.
I want to wake my device using GPIO1. Please help with this.
esp32: Add esp32.wake_on_gpio.
Summary
Some boards support waking up from deepsleep via GPIO pins (for instance ESP32C3, ESP32C6), but this is not currently supported by MicroPython. This commit adds support for waking with GPIO in a similar interface to waking with ext0, ext1, touch and ulp. This commit adds documentation for this new function as well.
This is a long standing request, with a lot of chatter online. Over the years there have been several attempts to add this (https://github.com/micropython/micropython/pull/15498, https://github.com/micropython/micropython/pull/13333 and https://github.com/micropython/micropython/pull/9583), but with no success. I also explain below why my approach is better (it is based on the existing PRs, so thanks to @m-cas, @puppet13th and @ondiiik).
Testing
Tested ESP32_GENERIC_C3with:
import machine
import esp32
esp32.wake_on_gpio((machine.Pin(5),machine.Pin(2)), esp32.WAKEUP_ANY_HIGH)
machine.deepsleep()
and checked that the relevant pins wake up from deepsleep.
Trade-offs and Alternatives
The existing PRs mentioned above modify wake_on_ex1, testing if the port is specifically ESP32C3. My solution adds a wake_on_gpio which is a similar interface, and tests for the SOC capabilities.