extmod/uasyncio/core.py: Support alternative timebase. #8771
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The aim is to support power reduction on STM and possibly other platforms.
The script below, when run on ESP32-S2, reduces current consumption by an order of magnitude compared with pure
uasyncio
code. In practice thelightsleep
time may be changed dynamically to trade off latency against power consumption.Unfortunately this does not work on STM because during
lightsleep
theuasyncio
timebase stops. In my fork ofuasyncio V2
I solved this by conditionally importing a timebase which used the RTC as a timing source. The change in this PR copies this approach.Demo code:
Current, when powered from a LiPo, reduces from ~22mA to ~2mA.