From 17e78175a69dc96ea8f71c41949cbc705d82b51a Mon Sep 17 00:00:00 2001 From: pennae Date: Wed, 3 May 2023 11:21:58 +0200 Subject: [PATCH] rp/pio: disable state machines on drop --- embassy-rp/src/pio.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs index 32e9be74..d05eef04 100644 --- a/embassy-rp/src/pio.rs +++ b/embassy-rp/src/pio.rs @@ -324,6 +324,9 @@ pub struct PioStateMachineInstance<'d, PIO: PioInstance, const SM: usize> { impl<'d, PIO: PioInstance, const SM: usize> Drop for PioStateMachineInstance<'d, PIO, SM> { fn drop(&mut self) { + unsafe { + PIO::PIO.ctrl().write_clear(|w| w.set_sm_enable(1 << SM)); + } on_pio_drop::(); } }