Skip to content

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

Closed
dpgeorge wants to merge 1 commit intomicropython:masterfrom
dpgeorge:docs-machine-sleep
Closed

docs/machine: Change sleep to lightsleep and add timeout arguments.#4359
dpgeorge wants to merge 1 commit intomicropython:masterfrom
dpgeorge:docs-machine-sleep

Conversation

@dpgeorge
Copy link
Copy Markdown
Member

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.

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.
@dpgeorge dpgeorge added rfc Request for Comment docs labels Dec 15, 2018
@pfalcon
Copy link
Copy Markdown
Contributor

pfalcon commented Dec 15, 2018

+1

@dpgeorge
Copy link
Copy Markdown
Member Author

Merged in b16146d

@dpgeorge dpgeorge closed this Jan 27, 2019
@dpgeorge dpgeorge deleted the docs-machine-sleep branch January 27, 2019 00:15
@dpgeorge
Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs rfc Request for Comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants