Skip to content

esp32: Add esp32.wake_on_gpio. #17518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meirarmon
Copy link
Contributor

@meirarmon meirarmon commented Jun 17, 2025

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 (#15498, #13333 and #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.

@meirarmon meirarmon force-pushed the esp32-wake-on-gpio branch 4 times, most recently from f6c619a to c9561f2 Compare June 20, 2025 10:41
Some boards support waking up via GPIO pins, 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.

Signed-off-by: Meir Armon <meirarmon@gmail.com>
@meirarmon meirarmon force-pushed the esp32-wake-on-gpio branch from c9561f2 to a12c15c Compare June 20, 2025 10:56
@meirarmon meirarmon marked this pull request as ready for review June 20, 2025 11:43
@meirarmon
Copy link
Contributor Author

@dpgeorge as specified in the description, this is a feature request that is very long standing (several years at least). I think that my implementation should satisify your standards, and if it does, I would appreciate serious consideration and merging this for the next release. Thank you for maintaining MicroPython and all of your hard work :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy