@@ -38,7 +38,7 @@ asyncio and includes a section for complete beginners.
38
38
5 . [ Interfacing hardware] ( ./TUTORIAL.md#5-interfacing-hardware )
39
39
5.1 [ Timing issues] ( ./TUTORIAL.md#51-timing-issues )
40
40
5.2 [ Polling hardware with a coroutine] ( ./TUTORIAL.md#52-polling-hardware-with-a-coroutine )
41
- 5.3 [ Using the stream mechnanism ] ( ./TUTORIAL.md#53-using-the-stream-mechanism )
41
+ 5.3 [ Using the stream mechanism ] ( ./TUTORIAL.md#53-using-the-stream-mechanism )
42
42
5.3.1 [ A UART driver example] ( ./TUTORIAL.md#531-a-uart-driver-example )
43
43
5.4 [ Writing streaming device drivers] ( ./TUTORIAL.md#54-writing-streaming-device-drivers )
44
44
5.5 [ A complete example: aremote.py] ( ./TUTORIAL.md#55-a-complete-example-aremotepy )
@@ -86,8 +86,8 @@ Except where detailed below, `asyncio` features of versions >3.4 are
86
86
unsupported. As stated above it is a subset; this document identifies supported
87
87
features.
88
88
89
- This tutoial advocates a consistent programming style with good compatibility
90
- with CPython V3.5 and above.
89
+ This tutorial aims to present a consistent programming style compatible with
90
+ CPython V3.5 and above.
91
91
92
92
## 0.1 Installing uasyncio on bare metal
93
93
@@ -101,7 +101,7 @@ Libraries to be installed are:
101
101
The ` queues ` and ` synchro ` modules are optional, but are required to run all
102
102
the examples below.
103
103
104
- The oficial approach is to use the ` upip ` utility as described
104
+ The official approach is to use the ` upip ` utility as described
105
105
[ here] ( https://github.com/micropython/micropython-lib ) . Network enabled
106
106
hardware has this included in the firmware so it can be run locally. This is
107
107
the preferred approach.
@@ -114,7 +114,7 @@ then copying the library to the target.
114
114
The need for Linux and the Unix build may be avoided by using
115
115
[ micropip.py] ( https://github.com/peterhinch/micropython-samples/tree/master/micropip ) .
116
116
This runs under Python 3.2 or above. Create a temporary directory on your PC
117
- and install to that. Then copy the contents of the temporary direcory to the
117
+ and install to that. Then copy the contents of the temporary directory to the
118
118
device. The following assume Linux and a temporary directory named ` ~/syn ` -
119
119
adapt to suit your OS. The first option requires that ` micropip.py ` has
120
120
executable permission.
@@ -374,7 +374,7 @@ offers "micro" implementations of `Event`, `Barrier`, `Semaphore` and
374
374
` Condition ` primitives. These are for use only with asyncio. They are not
375
375
thread safe and should not be used with the ` _thread ` module or from an
376
376
interrupt handler except where mentioned. A ` Lock ` primitive is provided which
377
- is an alterantive to the official implementation.
377
+ is an alternative to the official implementation.
378
378
379
379
Another synchronisation issue arises with producer and consumer coros. The
380
380
producer generates data which the consumer uses. Asyncio provides the ` Queue `
@@ -474,7 +474,7 @@ async def foo(event):
474
474
event.set()
475
475
```
476
476
477
- Where multiple coros wait on a single event synchronisationcan be achieved by
477
+ Where multiple coros wait on a single event synchronisation can be achieved by
478
478
means of an acknowledge event. Each coro needs a separate event.
479
479
480
480
``` python
@@ -619,7 +619,7 @@ no mechanism for verifying when cancellation has actually occurred. The `asyn`
619
619
library provides verification via the following classes:
620
620
621
621
1 . ` Cancellable ` This allows one or more tasks to be assigned to a group. A
622
- coro can cancel all tasks in the group, pausing until this has been acheived .
622
+ coro can cancel all tasks in the group, pausing until this has been achieved .
623
623
Documentation may be found [ here] ( ./PRIMITIVES.md#42-class-cancellable ) .
624
624
2 . ` NamedTask ` This enables a coro to be associated with a user-defined name.
625
625
The running status of named coros may be checked. For advanced usage more
@@ -1095,7 +1095,7 @@ class RecordOrientedUart():
1095
1095
def __iter__ (self ): # Not __await__ issue #2678
1096
1096
data = b ' '
1097
1097
while not data.endswith(self .DELIMITER ):
1098
- yield from asyncio.sleep(0 ) # Neccessary because:
1098
+ yield from asyncio.sleep(0 ) # Necessary because:
1099
1099
while not self .uart.any():
1100
1100
yield from asyncio.sleep(0 ) # timing may mean this is never called
1101
1101
data = b ' ' .join((data, self .uart.read(self .uart.any())))
@@ -1152,7 +1152,7 @@ async def receiver():
1152
1152
sreader = asyncio.StreamReader(uart)
1153
1153
while True :
1154
1154
res = await sreader.readline()
1155
- print (' Recieved ' , res)
1155
+ print (' Received ' , res)
1156
1156
1157
1157
loop = asyncio.get_event_loop()
1158
1158
loop.create_task(sender())
@@ -1357,7 +1357,7 @@ application design the [fast_io](./FASTPOLL.md) version can greatly reduce
1357
1357
this.
1358
1358
1359
1359
The demo program ` iorw.py ` illustrates a complete example. Note that, at the
1360
- time of writing there is a bug in ` uasyncio ` which prevents this from woking .
1360
+ time of writing there is a bug in ` uasyncio ` which prevents this from working .
1361
1361
See [ this GitHub thread] ( https://github.com/micropython/micropython/pull/3836#issuecomment-397317408 ) .
1362
1362
There are two solutions. A workround is to write two separate drivers, one
1363
1363
read-only and the other write-only. Alternatively the
@@ -1406,7 +1406,7 @@ run while acquisition is in progress.
1406
1406
1407
1407
Hanging usually occurs because a task has blocked without yielding: this will
1408
1408
hang the entire system. When developing it is useful to have a coro which
1409
- periodically toggles an onboard LED. This provides confirmtion that the
1409
+ periodically toggles an onboard LED. This provides confirmation that the
1410
1410
scheduler is running.
1411
1411
1412
1412
###### [ Contents] ( ./TUTORIAL.md#contents )
@@ -1470,7 +1470,7 @@ the outer loop:
1470
1470
def __await__ (self ):
1471
1471
data = b ' '
1472
1472
while not data.endswith(self .DELIMITER ):
1473
- yield from asyncio.sleep(0 ) # Neccessary because:
1473
+ yield from asyncio.sleep(0 ) # Necessary because:
1474
1474
while not self .uart.any():
1475
1475
yield from asyncio.sleep(0 ) # timing may mean this is never called
1476
1476
data = b ' ' .join((data, self .uart.read(self .uart.any())))
@@ -1630,7 +1630,7 @@ def event_loop():
1630
1630
# handle UART input
1631
1631
```
1632
1632
1633
- This works for simple examples but event loops rapidly become unweildy as the
1633
+ This works for simple examples but event loops rapidly become unwieldy as the
1634
1634
number of events increases. They also violate the principles of object oriented
1635
1635
programming by lumping much of the program logic in one place rather than
1636
1636
associating code with the object being controlled. We want to design a class
@@ -1800,7 +1800,7 @@ overrun the specified time. This is because while the delay is in progress
1800
1800
other tasks will run. When the delay period completes, execution will not
1801
1801
resume until the running task issues ` await ` or terminates. A well-behaved coro
1802
1802
will always issue ` await ` at regular intervals. Where a precise delay is
1803
- required, especially one below a few ms, it may be neccessary to use
1803
+ required, especially one below a few ms, it may be necessary to use
1804
1804
` utime.sleep_us(us) ` .
1805
1805
1806
1806
###### [ Contents] ( ./TUTORIAL.md#contents )
@@ -1812,7 +1812,7 @@ often one of disappointment. Surely pre-emptive is better? Why should I have to
1812
1812
explicitly yield control when the Python virtual machine can do it for me?
1813
1813
1814
1814
When it comes to embedded systems the cooperative model has two advantages.
1815
- Fistly , it is lightweight. It is possible to have large numbers of coroutines
1815
+ Firstly , it is lightweight. It is possible to have large numbers of coroutines
1816
1816
because unlike descheduled threads, paused coroutines contain little state.
1817
1817
Secondly it avoids some of the subtle problems associated with pre-emptive
1818
1818
scheduling. In practice cooperative multi-tasking is widely used, notably in
0 commit comments