Skip to content

Commit 0261cac

Browse files
committed
Stop StateMachine explicitly on deinit
1 parent c174b7c commit 0261cac

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
@@ -91,8 +91,6 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode
9191
false, // Wait for txstall
9292
false, 32, false); // in settings
9393

94-
common_hal_rp2pio_statemachine_run(&self->state_machine, encoder_init, MP_ARRAY_SIZE(encoder_init));
95-
9694
// We're guaranteed by the init code that some output will be available promptly
9795
uint8_t quiescent_state;
9896
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
@@ -553,6 +553,8 @@ void common_hal_rp2pio_statemachine_set_frequency(rp2pio_statemachine_obj_t *sel
553553
}
554554

555555
void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins) {
556+
common_hal_rp2pio_statemachine_stop(self);
557+
556558
uint8_t sm = self->state_machine;
557559
uint8_t pio_index = pio_get_index(self->pio);
558560
common_hal_mcu_disable_interrupts();

0 commit comments

Comments
 (0)