-
Notifications
You must be signed in to change notification settings - Fork 1.3k
rp2040: implement rotaryio #4226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is similar to the approach I was thinking: https://github.com/micropython/micropython/pull/6894/files Use PIO to debounce and deduplicate pin values. Push the value out and trigger an interrupt on it. I want to do this soon so moving to 6.2.0 milestone. Its a natural fit with usb_hid projects. |
The micropython state decoder looks like a solid design for "x4" quadrature decoding that avoids some problems that more naive implementations have. Crucially,
Tracking the previous direction (positive or negative) in an attempt to decode changes in both bits simultaneously I think is of dubious value but it doesn't seem to hurt (doesn't affect the behavior when only one bit transition at a time is ever seen) and could make some designs that run just at the margin of the maximum work better, as long as there's enough "physicality" to the quadrature inputs that they don't instantly reverse from "+ludicrous_speed" to "-ludicrous_speed" instantly. |
Sorry! I'm hoping to get to this very soon! Hopefully today or Monday. |
@tannewt shared with me some initial code related to rotaryio, but it's incomplete: https://github.com/tannewt/circuitpython/tree/rp2040_rotaryio |
Fixed by #4329. |
Can confirm this now working in latest nightly builds (cannot build myself due to M1 silicon config error). Might be that assignation of encoder pins A & B is flipped. I have :
working in correct orientation (clockwise increment, counter-clockwise decrement), however, GP3 is connected to B and GP is connected to A. Switch the wires, the encoder goes the wrong way, or code as
to receive error :
|
@jepler want to support descending pins too? |
I may look at this in conjunction with #3895. If I can get a good reference implementation going, then it will be easy to port.
The text was updated successfully, but these errors were encountered: