Closed epmoyer closed 3 years ago
Ah, of course!
rotary.
on the import; my bad. Will fix.Cheers!
rotary_irq_pico.py
to rotary_irq_rp2.py
because:
rp2
is the platform name (because rp2040
is the chip name).rp2
.rp2
is more generic. The code should work with any board that uses the rp2040 (and probably future rp2xxx chips), not just the Pico board specifically.example_asyncio_class.py
to use different pins (GPIOs, technically) for rotary_encoder_2
for the rp2 since the rp2's pin accessible GPIOs only go up to GP28 (and the code was using 32 and 33). I didn't want to change the behavior for the existing boards so I made it use 16 and 17 on the rp2. It's up to you if you'd prefer to leave it that way, or change the other boards to use some lower number that all boards have in common. The Pico would work with anything in the range 0-22, or 26-28.Apologies for not updating/validating all the examples the first time around! Here is the test output from running on the Pico:
And my test fixture for the 2 encoder case:
Cheers!
Hi Eric, @epmoyer Thanks a ton for making this PR and doing all the testing! I tried all the examples on a rPi Pico board and they work well. I reviewed the changes to the code and docs - it looks solid. There are just a couple of minor changes that I recommend. I looked at the default pins in the examples and would like to change them to clk=13, and dt=14 (single encoder examples). For the two encoder example, change them to clk=13, dt=14, and clk=18, dt=19. Why? this uses the same pins for ESP32 and rPi Pico boards. And, it avoids using any ESP strapping pins. (I used pin 15 in the original examples, which was a poor choice as it goes against the recommendations outlined in the rotary documentation). It was always the intent that users will need to customize the pin selections, but this will at least be an improvement on the original pin choices. Note that the pin naming conventions is completely different for the PyBoards (e.g. "X7", "Y5", "X21", etc).
Please take look and see if these proposed changes make sense to you. If so, change your PR code and I'll merge the PR. If not, let's continue the discussion and figure out a good path forwards.
Review comments follow ...
All changes incorporated. Thanks for taking the time to review/comment! I know giving someone a PR is like giving them a puppy :) Hopefully this little guy won't make trouble. Now run to Mike little Pico, and be a good boy... 🐕
I re-ran the tests just to make sure the pin changes caused no problems.
Looks great ! Thanks again. Mike
Mike, fantastic job on this project. It was a pleasure to work with.
I have added Pico support; which was remarkably easy due to the excellent structure and documentation; kudos! I am developing/testing on a Raspberry Pico with a Keyes KY-040 and it is running rock solid for me.