diff --git a/embassy-extras/src/peripheral.rs b/embassy-extras/src/peripheral.rs index 396ab543..725a58a4 100644 --- a/embassy-extras/src/peripheral.rs +++ b/embassy-extras/src/peripheral.rs @@ -140,36 +140,17 @@ impl PeripheralMutex { pub fn with(self: Pin<&mut Self>, f: impl FnOnce(&mut S) -> R) -> R { let this = unsafe { self.get_unchecked_mut() }; - let was_enabled = this.irq.is_enabled(); this.irq.disable(); // Safety: it's OK to get a &mut to the state, since the irq is disabled. let state = unsafe { &mut *this.state.get() }; let r = f(state); - if was_enabled { - this.irq.enable(); - } + this.irq.enable(); r } - /// Enables the wrapped interrupt. - pub fn enable(&self) { - // This is fine to do before initialization, because we haven't set the handler yet. - self.irq.enable() - } - - /// Disables the wrapped interrupt. - pub fn disable(&self) { - self.irq.disable() - } - - /// Returns whether the wrapped interrupt is enabled. - pub fn is_enabled(&self) -> bool { - self.irq.is_enabled() - } - /// Returns whether the wrapped interrupt is currently in a pending state. pub fn is_pending(&self) -> bool { self.irq.is_pending() diff --git a/embassy-extras/src/peripheral_shared.rs b/embassy-extras/src/peripheral_shared.rs index ae9ae693..788ac3f9 100644 --- a/embassy-extras/src/peripheral_shared.rs +++ b/embassy-extras/src/peripheral_shared.rs @@ -79,22 +79,6 @@ impl Peripheral { &self.into_ref().get_ref().state } - /// Enables the wrapped interrupt. - pub fn enable(&self) { - // This is fine to do before initialization, because we haven't set the handler yet. - self.irq.enable() - } - - /// Disables the wrapped interrupt. - pub fn disable(&self) { - self.irq.disable() - } - - /// Returns whether the wrapped interrupt is enabled. - pub fn is_enabled(&self) -> bool { - self.irq.is_enabled() - } - /// Returns whether the wrapped interrupt is currently in a pending state. pub fn is_pending(&self) -> bool { self.irq.is_pending()