1
- # 1. Guide to uasyncio
1
+ # 1. Guide to asyncio
2
2
3
- MicroPython's ` uasyncio ` is pre-installed on all platforms except severely
3
+ MicroPython's ` asyncio ` is pre-installed on all platforms except severely
4
4
constrained ones such as the 1MB ESP8266. It supports CPython 3.8 syntax and
5
5
aims to be a compatible subset of ` asyncio ` . The current version is 3.0.0.
6
6
7
7
## 1.1 Documents
8
8
9
- [ uasyncio official docs] ( http://docs.micropython.org/en/latest/library/asyncio.html )
9
+ [ asyncio official docs] ( http://docs.micropython.org/en/latest/library/asyncio.html )
10
10
11
11
[ Tutorial] ( ./docs/TUTORIAL.md ) Intended for users with all levels of experience
12
12
of asynchronous programming, including beginners.
@@ -16,26 +16,26 @@ describes device drivers for switches, pushbuttons, ESP32 touch buttons, ADC's
16
16
and incremental encoders.
17
17
18
18
[ Interrupts] ( https://github.com/peterhinch/micropython-async/blob/master/v3/docs/INTERRUPTS.md )
19
- is a guide to interfacing interrupts to ` uasyncio ` .
19
+ is a guide to interfacing interrupts to ` asyncio ` .
20
20
21
21
[ Event-based programming] ( ./docs/EVENTS.md ) is a guide to a way of writing
22
22
applications and device drivers which largely does away with callbacks. The doc
23
- assumes some knowledge of ` uasyncio ` .
23
+ assumes some knowledge of ` asyncio ` .
24
24
25
25
[ Threading] ( ./docs/THREADING.md ) is a guide to the use of multi-threaded and
26
- multi-core programming. Code is offered to enable a ` uasyncio ` application to
26
+ multi-core programming. Code is offered to enable a ` asyncio ` application to
27
27
deal with blocking functions.
28
28
29
29
## 1.2 Debugging tools
30
30
31
31
[ aiorepl] ( https://github.com/micropython/micropython-lib/tree/master/micropython/aiorepl )
32
32
This official tool enables an application to launch a REPL which is active
33
33
while the application is running. From this you can modify and query the
34
- application and run ` uasyncio ` scripts concurrently with the running
34
+ application and run ` asyncio ` scripts concurrently with the running
35
35
application.
36
36
37
37
[ monitor] ( https://github.com/peterhinch/micropython-monitor ) enables a running
38
- ` uasyncio ` application to be monitored using a Pi Pico, ideally with a scope or
38
+ ` asyncio ` application to be monitored using a Pi Pico, ideally with a scope or
39
39
logic analyser. Normally requires only one GPIO pin on the target.
40
40
41
41
![ Image] ( https://github.com/peterhinch/micropython-monitor/raw/master/images/monitor.jpg )
@@ -58,14 +58,14 @@ Documented in the [tutorial](./docs/TUTORIAL.md). Comprises:
58
58
### 1.3.3 Threadsafe primitives
59
59
60
60
[ This doc] ( https://github.com/peterhinch/micropython-async/blob/master/v3/docs/THREADING.md )
61
- describes issues linking ` uasyncio ` code with code running on other cores or in
61
+ describes issues linking ` asyncio ` code with code running on other cores or in
62
62
other threads. The ` threadsafe ` directory provides:
63
63
64
64
* A threadsafe primitive ` Message ` .
65
65
* ` ThreadSafeQueue `
66
66
* ` ThreadSafeEvent ` Extends ` ThreadsafeFlag ` .
67
67
68
- The doc also provides code to enable ` uasyncio ` to handle blocking functions
68
+ The doc also provides code to enable ` asyncio ` to handle blocking functions
69
69
using threading.
70
70
71
71
### 1.3.4 Asynchronous device drivers
@@ -101,24 +101,24 @@ useful in their own right:
101
101
102
102
These notes are intended for users familiar with ` asyncio ` under CPython.
103
103
104
- The MicroPython language is based on CPython 3.4. The ` uasyncio ` library now
104
+ The MicroPython language is based on CPython 3.4. The ` asyncio ` library now
105
105
supports a subset of the CPython 3.8 ` asyncio ` library. There are non-standard
106
106
extensions to optimise services such as millisecond level timing. Its design
107
107
focus is on high performance. Scheduling runs without RAM allocation.
108
108
109
- The ` uasyncio ` library supports the following features:
109
+ The ` asyncio ` library supports the following features:
110
110
111
111
* ` async def ` and ` await ` syntax.
112
112
* Awaitable classes (using ` __iter__ ` rather than ` __await__ ` ).
113
113
* Asynchronous context managers.
114
114
* Asynchronous iterators.
115
- * ` uasyncio .sleep(seconds)` .
116
- * Timeouts (` uasyncio .wait_for` ).
115
+ * ` asyncio .sleep(seconds)` .
116
+ * Timeouts (` asyncio .wait_for` ).
117
117
* Task cancellation (` Task.cancel ` ).
118
118
* Gather.
119
119
120
120
It supports millisecond level timing with the following:
121
- * ` uasyncio .sleep_ms(time)`
121
+ * ` asyncio .sleep_ms(time)`
122
122
123
123
It includes the following CPython compatible synchronisation primitives:
124
124
* ` Event ` .
0 commit comments