@@ -164,15 +164,15 @@ the rate at which callbacks occur.
164
164
anthropoid ape it's debatable whether it produces anything useful :)
165
165
3 . ` encoder_rp2.py ` Version specific to Raspberry Pico RP2 chip. This uses the
166
166
PIO and Viper code to achieve fast response - upto ~ 10K transitions/s.
167
- 4 . ` encoder.py ` An old Pyboard-specific version.
168
- 5 . [ Asynchronous driver] ( https://github.com/peterhinch/micropython-async/blob/master/v3/docs/DRIVERS.md#6-quadrature-encoders )
167
+ 4 . [ Asynchronous driver] ( https://github.com/peterhinch/micropython-async/blob/master/v3/docs/DRIVERS.md#6-quadrature-encoders )
169
168
for ` uasyncio ` applications.
170
169
171
- These were written for encoders producing logic outputs. For switches, adapt
172
- the pull definition to provide a pull up or pull down as required, or provide
173
- physical resistors. The latter is my preferred solution as the internal
174
- resistors on most platforms have a rather high value posing a risk of slow
175
- edges.
170
+ For mechanical encoders consider the need for pull up or pull down resistors.
171
+
172
+ Applications which just require the maintenance of a position count would
173
+ normally use ` encoder_portable.py ` . Where callbacks are required, or tracking
174
+ of detent positions is needed, the asynchronous driver is preferred for reasons
175
+ covered in this document.
176
176
177
177
# 7. Algorithm
178
178
@@ -267,7 +267,9 @@ required to track these exactly, for example triggering a callback on each
267
267
[ asynchronous driver] ( https://github.com/peterhinch/micropython-async/blob/master/v3/docs/DRIVERS.md#6-quadrature-encoders )
268
268
with a division ratio of 4. Rate limiting is essential. Testing with a
269
269
mechanical encoder with Schmitt trigger preconditioning (see below) produced
270
- good results with tracking maintained exactly.
270
+ good results with tracking maintained exactly. Some encoders, described as
271
+ "half step", have two detents per revolution. These can be handled by setting
272
+ ` div=2 ` on this driver.
271
273
272
274
It is almost certainly impossible to provide exact tracking on platforms which
273
275
support only soft IRQ's because garbage collection results in interrupt latency
0 commit comments