@@ -23,7 +23,7 @@ Examples needing great care:
23
23
* Where arrival of data triggers an interrupt and subsequent interrupts may
24
24
occur after a short period of time.
25
25
* Where arrival of an interrupt triggers complex application behaviour: see
26
- notes on [ context] ( ./INTERRUPTS.md#32-context )
26
+ notes on [ context] ( ./INTERRUPTS.md#32-context ) .
27
27
28
28
# 2. Alternatives to interrupts
29
29
@@ -40,8 +40,9 @@ async def read_temp():
40
40
temp = thermometer.read()
41
41
await asyncio.sleep(60 )
42
42
```
43
- In cases where interrupts arrive slowly it is worth considering whether there
44
- is any gain in using an interrupt rather than polling the hardware:
43
+ In cases where interrupts arrive at a low frequency it is worth considering
44
+ whether there is any gain in using an interrupt rather than polling the
45
+ hardware:
45
46
46
47
``` python
47
48
async def read_data ():
@@ -69,8 +70,8 @@ machine-operated such as limit switches.
69
70
70
71
Devices such as UARTs and sockets are supported by the ` uasyncio ` stream
71
72
mechanism. The UART driver uses interrupts at a firmware level, but exposes
72
- its interface to ` uasyncio ` by the ` StreamReader ` and ` StreamWriter ` classes.
73
- These greatly simplify the use of such devices.
73
+ its interface to ` uasyncio ` by means of the ` StreamReader ` and ` StreamWriter `
74
+ classes. These greatly simplify the use of such devices.
74
75
75
76
It is also possible to write device drivers in Python enabling the use of the
76
77
stream mechanism. This is covered in
@@ -115,7 +116,7 @@ the reasons identified in
115
116
[ this doc] ( https://docs.micropython.org/en/latest/reference/isr_rules.html ) .
116
117
117
118
Note that using ` micropython.schedule ` does not address every issue associated
118
- with ISR context. In particular restictions remain on the use of ` uasyncio `
119
+ with ISR context because restictions remain on the use of ` uasyncio `
119
120
operations. This is because such code can pre-empt the ` uasyncio ` scheduler.
120
121
This is discussed further below.
121
122
@@ -130,7 +131,8 @@ solution is to use `uasyncio.ThreadSafeFlag`.
130
131
## 3.3 Interfacing an ISR with uasyncio
131
132
132
133
This should be read in conjunction with the discussion of the ` ThreadSafeFlag `
133
- in [ the tutorial] ( ./TUTORIAL.md#36-threadsafeflag ) .
134
+ in [ the official docs] ( https://docs.micropython.org/en/latest/library/uasyncio.html#class-threadsafeflag )
135
+ and [ the tutorial] ( ./TUTORIAL.md#36-threadsafeflag ) .
134
136
135
137
Assume a hardware device capable of raising an interrupt when data is
136
138
available. The requirement is to read the device fast and subsequently process
0 commit comments