summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-07-24 09:15:38 +0200
committerDamien George <damien@micropython.org>2022-07-26 02:00:01 +1000
commit0c45a28d24e1a7f9ea5912c928d7b5a860a6514a (patch)
tree14c45e44a86ebf99e3789d0fa06988d9059a2623
parentf64862a766bf7c22feb1de75dadc69fb9e1aed4a (diff)
rp2/rp2_pio: Fix StateMachine.restart when PIO program is shared.
The state machines were not properly restarted in the case that the same PIO program was shared among multiple StateMachine instances. This is because only the first StateMachine to use the program would set the rp2_state_machine_initial_pc variable. See https://forum.micropython.org/viewtopic.php?f=21&t=12776&p=69464#p69464
-rw-r--r--ports/rp2/rp2_pio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/rp2/rp2_pio.c b/ports/rp2/rp2_pio.c
index 072644eba..eb85eb224 100644
--- a/ports/rp2/rp2_pio.c
+++ b/ports/rp2/rp2_pio.c
@@ -469,8 +469,8 @@ STATIC mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *sel
if (offset < 0) {
rp2_pio_add_program(&rp2_pio_obj[PIO_NUM(self->pio)], args[ARG_prog].u_obj);
offset = mp_obj_get_int(prog[PROG_OFFSET_PIO0 + PIO_NUM(self->pio)]);
- rp2_state_machine_initial_pc[self->id] = offset;
}
+ rp2_state_machine_initial_pc[self->id] = offset;
// Compute the clock divider.
uint16_t clkdiv_int;