-
Notifications
You must be signed in to change notification settings - Fork 1.3k
rp2: Add StateMachine(may_exec=, offset=) #8223
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
Conversation
and also sanity-check the init instructions, thanks to the newly factored-out checker. Closes: adafruit#8221
and it also adds offset= which is needed for encoder implementations like https://github.com/adamgreen/QuadratureDecoder/blob/master/QuadratureDecoder.pio |
a discord user reports this doesn't work right, so I'll need to revisit it and do more testing |
I tested this today with a QT Py RP2040 & jog wheel encoder. Tests
|
@Ultrawipf please re-test if you have the time & interest! |
updated yet again and using https://gist.github.com/jepler/0f162eb04c2b4e36e9ae9d6a228e4112 as test of I also manually tested that offset conflicts are detected, though the error message says "All state machines in use" when the real problem is that the requested load address was not available. This interactive session shows how the "same" program can be loaded multiple times at offset 0, then a 2nd program can be loaded at offset 0 of the second SM. A third program can't be loaded at offset 0 (it'd have to go in the third SM) but it can be loaded at another offset.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactor. Very cool to see these advanced uses of PIO.
Co-authored-by: Scott Shawcroft <[email protected]>
leave as a single structure because it's more efficient to call functions with 4 or fewer arguments, and having two struct pointers would make `consider_instruction` have 5 arguments instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the updates!
and also sanity-check the init instructions, thanks to the newly factored-out checker.
Closes: #8221
Not yet tested on hardware!