Ad the ability to read the PIO PC location? #16964
Unanswered
dclaar
asked this question in
RP2040 / Pico
Replies: 2 comments 2 replies
-
I'm agnostic on reading the PIO PC. In the specific use case of a debouncer I don't think it's a very good API, requiring the user code to regularly poll N state machines. You really want each debounced switch to trigger a callback or set an At the moment I can't think of a neat way of doing this with multiple SM's. |
Beta Was this translation helpful? Give feedback.
2 replies
-
You can use a viper function: # -*- coding: UTF-8 -*-
# vim: fileencoding=utf-8: ts=4: sw=4: expandtab:
@micropython.viper
def pio_pc(sm: int) -> int:
p0: ptr32 = ptr32(1344274432)
p1: ptr32 = ptr32(1345323008)
if sm < 4: return p0[53 + sm * 6]
else: return p1[53 + (sm-4) * 6] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The code doesn't currently support reading the PIO PC. Would this be a reasonable thing to add?
Use case:
I found this interesting PIO button debouncer. You determine the button state by reading the PIO PC with
pio_sm_get_pc
. I think most of the rest of it is already possible with the existing PIO support: Would it be reasonable to add this functionality?Beta Was this translation helpful? Give feedback.
All reactions