Skip to content

Commit f2ce1e8

Browse files
committed
Add INTERRUPTS.md FAQ.
1 parent e9e734e commit f2ce1e8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

v3/docs/INTERRUPTS.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Examples needing great care:
2323
* Where arrival of data triggers an interrupt and subsequent interrupts may
2424
occur after a short period of time.
2525
* 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).
2727

2828
# 2. Alternatives to interrupts
2929

@@ -40,8 +40,9 @@ async def read_temp():
4040
temp = thermometer.read()
4141
await asyncio.sleep(60)
4242
```
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:
4546

4647
```python
4748
async def read_data():
@@ -69,8 +70,8 @@ machine-operated such as limit switches.
6970

7071
Devices such as UARTs and sockets are supported by the `uasyncio` stream
7172
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.
7475

7576
It is also possible to write device drivers in Python enabling the use of the
7677
stream mechanism. This is covered in
@@ -115,7 +116,7 @@ the reasons identified in
115116
[this doc](https://docs.micropython.org/en/latest/reference/isr_rules.html).
116117

117118
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`
119120
operations. This is because such code can pre-empt the `uasyncio` scheduler.
120121
This is discussed further below.
121122

@@ -130,7 +131,8 @@ solution is to use `uasyncio.ThreadSafeFlag`.
130131
## 3.3 Interfacing an ISR with uasyncio
131132

132133
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).
134136

135137
Assume a hardware device capable of raising an interrupt when data is
136138
available. The requirement is to read the device fast and subsequently process

0 commit comments

Comments
 (0)