Passing parameters to state machine in PIO #9362
-
Hello all, I am working on defining a state machine using the PIO functionality of raspberry Pico. I am using micropython for defining the program. In my state machine, I would like to set the scratch registers 'x' and 'y' by passing user-defined parameters to the state machine program. However, it seems there is no direct way to pass arguments to the state machine program. I was wondering if anyone has any hints on how to solve this issue? thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
If I understand what you want to do, you need to first put data into PIO and then PULL from inside an SM. import rp2
@rp2.asm_pio()
def pio_function():
pull()
mov(x, osr)
sm_0 = rp2.StateMachine(0, pio_function, freq=10_000)
user_parameter = int(input("Write user input: "))
sm_0.put(user_parameter) Something along those lines. BR |
Beta Was this translation helpful? Give feedback.
If I understand what you want to do, you need to first put data into PIO and then PULL from inside an SM.
Something along those lines.
BR