docs/machine: Change sleep to lightsleep and add timeout arguments.#4359
Closed
dpgeorge wants to merge 1 commit intomicropython:masterfrom
Closed
docs/machine: Change sleep to lightsleep and add timeout arguments.#4359dpgeorge wants to merge 1 commit intomicropython:masterfrom
dpgeorge wants to merge 1 commit intomicropython:masterfrom
Conversation
The machine.sleep() function can be misleading because it clashes with time.sleep() which has quite different semantics. So change it to machine.lightsleep() which shows that it is closer in behaviour to machine.deepsleep(). 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.
Contributor
|
+1 |
Member
Author
|
Merged in b16146d |
Member
Author
|
machine.lightsleep() for stm32 was implemented in 285d265, along with the optional arg for machine.deepsleep(). |
tannewt
pushed a commit
to tannewt/circuitpython
that referenced
this pull request
Mar 9, 2021
…-note Add caveat for usb_cdc.Serial.connected; fix another doc bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 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.