@@ -10,14 +10,14 @@ The driver and test programs run on the Pyboard and ESP8266.
10
10
11
11
# Files
12
12
13
- 1 . `` aremote.py ` ` The device driver.
14
- 2 . `` art.py ` ` A test program to characterise a remote.
15
- 3 . `` art1.py ` ` Control an onboard LED using a remote. The data and addresss
13
+ 1 . ` aremote.py ` The device driver.
14
+ 2 . ` art.py ` A test program to characterise a remote.
15
+ 3 . ` art1.py ` Control an onboard LED using a remote. The data and addresss
16
16
values need changing to match your characterised remote.
17
17
18
18
# Dependencies
19
19
20
- The driver requires the `` uasyncio `` library and the file `` asyn.py ` ` from this
20
+ The driver requires the ` uasyncio ` library and the file ` asyn.py ` from this
21
21
repository.
22
22
23
23
# Usage
@@ -36,10 +36,10 @@ Data values are 8 bit. Addresses may be 8 or 16 bit depending on whether the
36
36
remote uses extended addressing.
37
37
38
38
If a button is held down a repeat code is sent. In this event the driver
39
- returns a data value of `` REPEAT ` ` and the address associated with the last
39
+ returns a data value of ` REPEAT ` and the address associated with the last
40
40
valid data block.
41
41
42
- To characterise a remote run `` art.py ` ` and note the data value for each button
42
+ To characterise a remote run ` art.py ` and note the data value for each button
43
43
which is to be used. If the address is less than 256, extended addressing is
44
44
not in use.
45
45
@@ -48,7 +48,7 @@ not in use.
48
48
IR reception is inevitably subject to errors, notably if the remote is operated
49
49
near the limit of its range, if it is not pointed at the receiver or if its
50
50
batteries are low. So applications must check for, and usually ignore, errors.
51
- These are flagged by data values < `` REPEAT ` ` .
51
+ These are flagged by data values < ` REPEAT ` .
52
52
53
53
On the ESP8266 there is a further source of errors. This results from the large
54
54
and variable interrupt latency of the device which can exceed the pulse
@@ -62,21 +62,21 @@ Users tend to press the key again if no acknowledgement is received.
62
62
63
63
The constructor takes the following positional arguments.
64
64
65
- 1 . `` pin `` A `` Pin ` ` instance for the decoder chip.
66
- 2 . `` cb ` ` The user callback function.
67
- 3 . `` extended `` Set `` False ` ` to enable extra error checking if the remote
65
+ 1 . ` pin ` A ` Pin ` instance for the decoder chip.
66
+ 2 . ` cb ` The user callback function.
67
+ 3 . ` extended ` Set ` False ` to enable extra error checking if the remote
68
68
returns an 8 bit address.
69
69
4 . Further arguments, if provided, are passed to the callback.
70
70
71
71
The callback receives the following positional arguments:
72
72
73
73
1 . The data value returned from the remote.
74
74
2 . The address value returned from the remote.
75
- 3 . Any further arguments provided to the `` NEC_IR ` ` constructor.
75
+ 3 . Any further arguments provided to the ` NEC_IR ` constructor.
76
76
77
77
Negative data values are used to signal repeat codes and transmission errors.
78
78
79
- The test program `` art1.py ` ` provides an example of a minimal application.
79
+ The test program ` art1.py ` provides an example of a minimal application.
80
80
81
81
# How it works
82
82
@@ -103,7 +103,7 @@ interrupt in a burst sets an event, passing the time of the state change. A
103
103
coroutine waits on the event, yields for the duration of a data burst, then
104
104
decodes the stored data before calling the user-specified callback.
105
105
106
- Passing the time to the `` Event ` ` instance enables the coro to compensate for
106
+ Passing the time to the ` Event ` instance enables the coro to compensate for
107
107
any asyncio latency when setting its delay period.
108
108
109
109
The algorithm promotes interrupt handler speed over RAM use: the 276 bytes used
@@ -115,19 +115,19 @@ in the interrupt service routine.
115
115
Data values passed to the callback are normally positive. Negative values
116
116
indicate a repeat code or an error.
117
117
118
- `` REPEAT ` ` A repeat code was received.
118
+ ` REPEAT ` A repeat code was received.
119
119
120
- Any data value < `` REPEAT ` ` denotes an error. In general applications do not
120
+ Any data value < ` REPEAT ` denotes an error. In general applications do not
121
121
need to decode these, but they may be of use in debugging. For completeness
122
122
they are listed below.
123
123
124
- `` BADSTART ` ` A short (<= 4ms) start pulse was received. May occur due to IR
124
+ ` BADSTART ` A short (<= 4ms) start pulse was received. May occur due to IR
125
125
interference, e.g. from fluorescent lights. The TSOP4838 is prone to producing
126
126
200µs pulses on occasion, especially when using the ESP8266.
127
- `` BADBLOCK ` ` A normal data block: too few edges received. Occurs on the ESP8266
127
+ ` BADBLOCK ` A normal data block: too few edges received. Occurs on the ESP8266
128
128
owing to high interrupt latency.
129
- `` BADREP ` ` A repeat block: an incorrect number of edges were received.
130
- `` OVERRUN ` ` A normal data block: too many edges received.
131
- `` BADDATA ` ` Data did not match check byte.
132
- `` BADADDR `` Where `` extended `` is `` False ` ` the 8-bit address is checked
129
+ ` BADREP ` A repeat block: an incorrect number of edges were received.
130
+ ` OVERRUN ` A normal data block: too many edges received.
131
+ ` BADDATA ` Data did not match check byte.
132
+ ` BADADDR ` Where ` extended ` is ` False ` the 8-bit address is checked
133
133
against the check byte. This code is returned on failure.
0 commit comments