mirror of
https://github.com/micropython/micropython.git
synced 2026-01-28 06:40:19 +01:00
docs/library: Document that sleep(0)/sleep_ms(0) run the scheduler.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
8e3ee303ce
commit
baf75e21d3
@@ -130,6 +130,10 @@ Functions
|
||||
a critical region but they will not be executed until that region
|
||||
is exited. An example of a critical region is a preempting interrupt
|
||||
handler (an IRQ).
|
||||
- Inside native code functions, scheduled functions are not called unless
|
||||
the native code calls a function that specifically does so.
|
||||
- ``time.sleep`` and ``time.sleep_ms``, including zero-duration sleeps,
|
||||
will call scheduled functions.
|
||||
|
||||
A use for this function is to schedule a callback from a preempting IRQ.
|
||||
Such an IRQ puts restrictions on the code that runs in the IRQ (for example
|
||||
|
||||
@@ -71,6 +71,9 @@ Functions
|
||||
other boards may not accept a floating-point argument, for compatibility with
|
||||
them use `sleep_ms()` and `sleep_us()` functions.
|
||||
|
||||
Calling ``sleep``, including ``sleep(0)`` is guaranteed to call pending callback
|
||||
functions.
|
||||
|
||||
.. function:: sleep_ms(ms)
|
||||
|
||||
Delay for given number of milliseconds, should be positive or 0.
|
||||
@@ -80,6 +83,9 @@ Functions
|
||||
interrupt handlers or other threads. Passing in 0 for *ms* will still allow
|
||||
this other processing to occur. Use `sleep_us()` for more precise delays.
|
||||
|
||||
Calling ``sleep_ms``, including ``sleep_ms(0)`` is guaranteed to call
|
||||
pending callback functions.
|
||||
|
||||
.. function:: sleep_us(us)
|
||||
|
||||
Delay for given number of microseconds, should be positive or 0.
|
||||
|
||||
Reference in New Issue
Block a user