Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix interrupt::free.
  • Loading branch information
reitermarkus committed May 8, 2022
commit 6d18397d006ac321dee093f44568f245b479da9c
6 changes: 3 additions & 3 deletions src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ pub unsafe fn enable() {
#[inline]
pub fn free<F, R>(f: F) -> R
where
F: FnOnce(&CriticalSection) -> R,
F: FnOnce(CriticalSection<'_>) -> R,
{
let primask = crate::register::primask::read();

// disable interrupts
disable();

let r = f(unsafe { &CriticalSection::new() });
let r = f(unsafe { CriticalSection::new() });

// If the interrupts were active before our `disable` call, then re-enable
// them. Otherwise, keep them disabled
Expand All @@ -85,7 +85,7 @@ where
#[inline]
pub fn free<F, R>(_: F) -> R
where
F: FnOnce(&CriticalSection) -> R,
F: FnOnce(CriticalSection<'_>) -> R,
{
panic!("cortex_m::interrupt::free() is only functional on cortex-m platforms");
}