Skip to content

Commit 3e9daec

Browse files
authored
Merge pull request #5244 from dhalbert/stop-pio-on-deinit
Stop StateMachine explicitly on deinit
2 parents 8edf0c5 + 0261cac commit 3e9daec

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode
9292
false, 32, false, // in settings
9393
false); // Not user-interruptible.
9494

95-
common_hal_rp2pio_statemachine_run(&self->state_machine, encoder_init, MP_ARRAY_SIZE(encoder_init));
96-
9795
// We're guaranteed by the init code that some output will be available promptly
9896
uint8_t quiescent_state;
9997
common_hal_rp2pio_statemachine_readinto(&self->state_machine, &quiescent_state, 1, 1);

ports/raspberrypi/common-hal/rp2pio/StateMachine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ void common_hal_rp2pio_statemachine_set_frequency(rp2pio_statemachine_obj_t *sel
559559
}
560560

561561
void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins) {
562+
common_hal_rp2pio_statemachine_stop(self);
563+
562564
uint8_t sm = self->state_machine;
563565
uint8_t pio_index = pio_get_index(self->pio);
564566
common_hal_mcu_disable_interrupts();

0 commit comments

Comments
 (0)