|
1 | 1 | # A low power usayncio adaptation
|
2 | 2 |
|
3 |
| -This is specific to Pyboards including the D series. |
4 | 3 | Release 0.11 9th April 2019
|
5 | 4 |
|
6 | 5 | API change: low power applications must now import `rtc_time_cfg` and set its
|
7 | 6 | `enabled` flag.
|
8 |
| -Now supports Pyboard D. |
| 7 | +This is specific to Pyboards including the D series. |
9 | 8 |
|
10 | 9 | 1. [Introduction](./README.md#1-introduction)
|
11 | 10 | 2. [Installation](./README.md#2-installation)
|
@@ -146,9 +145,10 @@ scheduler is again paused (if `latency` > 0).
|
146 | 145 |
|
147 | 146 | #### 3.2.1.1 Timing Accuracy and rollover
|
148 | 147 |
|
149 |
| -A minor limitation is that the Pyboard RTC cannot resolve times of less than |
150 |
| -4ms so there is a theoretical reduction in the accuracy of delays. In practice, |
151 |
| -as explained in the [tutorial](../TUTORIAL.md), issuing |
| 148 | +A minor limitation is that the Pyboard 1.x RTC cannot resolve times of less |
| 149 | +than 4ms so there is a theoretical reduction in the accuracy of delays. This |
| 150 | +does not apply to the Pyboard D. In practice this is somewhat academic. As |
| 151 | +explained in the [tutorial](../TUTORIAL.md), issuing |
152 | 152 |
|
153 | 153 | ```python
|
154 | 154 | await asyncio.sleep_ms(t)
|
@@ -248,9 +248,10 @@ comparable to Pyboard 1.x.
|
248 | 248 |
|
249 | 249 | This provides the following.
|
250 | 250 |
|
251 |
| -Variable: |
| 251 | +Variables (treat as read-only): |
252 | 252 | * `use_utime` `True` if the `uasyncio` timebase is `utime`, `False` if it is
|
253 |
| - the RTC. Treat as read-only. |
| 253 | + the RTC. |
| 254 | + * `d_series` `True` if running on Pyboard D, `False` if on Pyboard 1.x. |
254 | 255 |
|
255 | 256 | Functions:
|
256 | 257 | If the timebase is `utime` these are references to the corresponding `utime`
|
@@ -403,16 +404,18 @@ the design of the scheduler beyond the use of a different timebase. It does,
|
403 | 404 | however, rely on the fact that the scheduler algorithm behaves as described
|
404 | 405 | above.
|
405 | 406 |
|
406 |
| -`rtc_time` imports `rtc_time_cfg` and quits if `rtc_time_cfg.enabled` is |
407 |
| -`False`. This ensures that `uasyncio` will only be affected by the `rtc_time` |
408 |
| -module if `rtc_time` has specifically been enabled by application code. |
409 |
| - |
410 |
| -The `rtc_time` module ensures that `uasyncio` uses `utime` for timing if the |
411 |
| -module is present in the path but is unused. This can occur because of an |
412 |
| -active USB connection or if running on an an incompatible platform. |
413 |
| - |
414 |
| -The above precautions ensures that application behaviour and performance are |
415 |
| -unaffected unless `rtc_time` has been enabled, a USB connection is absent, and |
416 |
| -the hardware is a Pyboard 1.x or Pyboard D. |
| 407 | +By default `uasyncio` uses the `utime` module for timing. For the timing to be |
| 408 | +derived from the RTC the following conditions must be met: |
| 409 | + * Hardware must be a Pyboard 1.x, Pyboard D or compatible (i.e. able to use |
| 410 | + the `pyb` module). |
| 411 | + * The application must import `rtc_time_cfg` and set its `enabled` flag `True` |
| 412 | + before importing `uasyncio`. |
| 413 | + * `uasyncio` must be the `fast_io` version 2.4 or later. |
| 414 | + * The `rtc_time` module must be on the MicroPython search path. |
| 415 | + * There must be no active USB connection. |
| 416 | + |
| 417 | +These constraints ensure there is no performance penalty unless an application |
| 418 | +specifically requires micropower operation. They also enable a USB connection |
| 419 | +to work if required for debugging. |
417 | 420 |
|
418 | 421 | ###### [Contents](./README.md#a-low-power-usayncio-adaptation)
|
0 commit comments