← index #7849PR #4359
Related · high · value 0.723
QUERY · ISSUE

STM32 sleep wake time problem

openby china-zhangdjopened 2021-09-24updated 2024-10-02
port-stm32
rtc.wakeup(ms)
machine.lightsleep(ms)

Do these two functions use the same wake-up source?
What is the maximum value of ms?

CANDIDATE · PULL REQUEST

docs/machine: Change sleep to lightsleep and add timeout arguments.

closedby dpgeorgeopened 2018-12-15updated 2019-01-27
rfcdocs

The machine.sleep() function can be misleading because it clashes with time.sleep() which has quite different semantics. So I propose to change it to machine.lightsleep() which shows that it is closer in behaviour to machine.deepsleep(), and update the wording of these functions in an attempt to make them generic.

Also, add an optional argument to these two sleep functions to specify a maximum time to sleep for. This is a common operation and underlying hardware usually has a special way of performing this operation.

The existing machine.sleep() function will remain for backwards compatibility purposes, and it can simply be an alias for machine.lightsleep() without arguments. The behaviour will be the same.

This PR only changes the docs. If it goes through then I'll follow with implementations on the ports that already have these functions.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied