Skip to content

Commit c26efb2

Browse files
committed
TUTORIAL.md: Minor fixes.
1 parent bdd98cd commit c26efb2

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

v3/docs/TUTORIAL.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ REPL.
1010
# Contents
1111

1212
0. [Introduction](./TUTORIAL.md#0-introduction)
13-
0.1 [Installing uasyncio on bare metal](./TUTORIAL.md#01-installing-uasyncio-on-bare-metal)
13+
0.1 [Installing uasyncio](./TUTORIAL.md#01-installing-uasyncio)
1414
1. [Cooperative scheduling](./TUTORIAL.md#1-cooperative-scheduling)
1515
1.1 [Modules](./TUTORIAL.md#11-modules)
1616
     1.1.1 [Primitives](./TUTORIAL.md#111-primitives)
@@ -92,7 +92,7 @@ source of confusion.
9292

9393
Most of this document assumes some familiarity with asynchronous programming.
9494
For those new to it an introduction may be found
95-
[in section 7](./TUTORIAL.md#8-notes-for-beginners).
95+
[in section 8](./TUTORIAL.md#8-notes-for-beginners).
9696

9797
The MicroPython `uasyncio` library comprises a subset of Python's `asyncio`
9898
library. It is designed for use on microcontrollers. As such it has a small RAM
@@ -105,24 +105,24 @@ responsive to events such as user interaction.
105105
Another major application area for asyncio is in network programming: many
106106
guides to this may be found online.
107107

108-
Note that MicroPython is based on Python 3.4 with minimal Python 3.5 additions.
108+
Note that MicroPython is based on Python 3.4 with additions from later versions.
109109
This version of `uasyncio` supports a subset of CPython 3.8 `asyncio`. This
110110
document identifies supported features. Except where stated program samples run
111111
under MicroPython and CPython 3.8.
112112

113113
This tutorial aims to present a consistent programming style compatible with
114114
CPython V3.8 and above.
115115

116-
## 0.1 Installing uasyncio on bare metal
116+
## 0.1 Installing uasyncio
117117

118-
No installation is necessary if a daily build of firmware is installed or
119-
release build V1.13 or later. The version may be checked by issuing at
120-
the REPL:
118+
Firmware builds after V1.13 incorporate `uasyncio`. The version may be checked
119+
by issuing at the REPL:
121120
```python
122121
import uasyncio
123122
print(uasyncio.__version__)
124123
```
125-
Version 3 will print a version number. Older versions will throw an exception.
124+
Version 3 will print a version number. Older versions will throw an exception:
125+
installing updated firmware is highly recommended.
126126

127127
###### [Main README](../README.md)
128128

@@ -143,11 +143,12 @@ The directory `primitives` contains a Python package containing the following:
143143
* Additional Python primitives including an ISR-compatible version of `Event`
144144
and a software retriggerable delay class.
145145
* Primitives for interfacing hardware. These comprise classes for debouncing
146-
switches and pushbuttonsand an asynchronous ADC class. These are documented
146+
switches and pushbuttons and an asynchronous ADC class. These are documented
147147
[here](./DRIVERS.md).
148148

149149
To install this Python package copy the `primitives` directory tree and its
150-
contents to your hardware's filesystem.
150+
contents to your hardware's filesystem. There is no need to copy the `tests`
151+
subdirectory.
151152

152153
### 1.1.2 Demo programs
153154

@@ -545,8 +546,8 @@ A further set of primitives for synchronising hardware are detailed in
545546
To install the primitives, copy the `primitives` directory and contents to the
546547
target. A primitive is loaded by issuing (for example):
547548
```python
548-
from primitives.semaphore import Semaphore, BoundedSemaphore
549-
from primitives.queue import Queue
549+
from primitives import Semaphore, BoundedSemaphore
550+
from primitives import Queue
550551
```
551552
When `uasyncio` acquires official versions of the CPython primitives the
552553
invocation lines alone should be changed. e.g. :
@@ -715,7 +716,7 @@ evt2 = Event()
715716
# Launch tasks that might trigger these events
716717
evt = await WaitAny((evt1, evt2))
717718
# One or other was triggered
718-
if evt == evt1:
719+
if evt is evt1:
719720
evt1.clear()
720721
# evt1 was triggered
721722
else:
@@ -909,7 +910,7 @@ following illustrates tasks accessing a resource one at a time:
909910

910911
```python
911912
import uasyncio as asyncio
912-
from primitives.semaphore import Semaphore
913+
from primitives import Semaphore
913914

914915
async def foo(n, sema):
915916
print('foo {} waiting for semaphore'.format(n))
@@ -973,7 +974,7 @@ Asynchronous methods:
973974

974975
```python
975976
import uasyncio as asyncio
976-
from primitives.queue import Queue
977+
from primitives import Queue
977978

978979
async def slow_process():
979980
await asyncio.sleep(2)
@@ -1132,7 +1133,7 @@ run at different speeds. The `Barrier` synchronises these loops. This can run
11321133
on a Pyboard.
11331134
```python
11341135
import uasyncio as asyncio
1135-
from primitives.barrier import Barrier
1136+
from primitives import Barrier
11361137
from machine import UART
11371138
import ujson
11381139

@@ -1259,7 +1260,7 @@ running. One second after the triggering ceases, the callback runs.
12591260

12601261
```python
12611262
import uasyncio as asyncio
1262-
from primitives.delay_ms import Delay_ms
1263+
from primitives import Delay_ms
12631264

12641265
async def my_app():
12651266
d = Delay_ms(callback, ('Callback running',))
@@ -1283,7 +1284,7 @@ This example illustrates multiple tasks waiting on a `Delay_ms`. No callback is
12831284
used.
12841285
```python
12851286
import uasyncio as asyncio
1286-
from primitives.delay_ms import Delay_ms
1287+
from primitives import Delay_ms
12871288

12881289
async def foo(n, d):
12891290
await d.wait()
@@ -1334,7 +1335,7 @@ using it:
13341335

13351336
```python
13361337
import uasyncio as asyncio
1337-
from primitives.message import Message
1338+
from primitives import Message
13381339

13391340
async def waiter(msg):
13401341
print('Waiting for message')
@@ -1373,7 +1374,7 @@ Asynchronous Method:
13731374

13741375
The following example shows multiple tasks awaiting a `Message`.
13751376
```python
1376-
from primitives.message import Message
1377+
from primitives import Message
13771378
import uasyncio as asyncio
13781379

13791380
async def bar(msg, n):

0 commit comments

Comments
 (0)