Skip to content

Commit 62f0dec

Browse files
committed
cfg-gate interrupt::free to fix off-target tests
1 parent b8342cd commit 62f0dec

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cortex-m/src/interrupt.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub unsafe fn enable() {
5151
/// Execute closure `f` in an interrupt-free context.
5252
///
5353
/// This as also known as a "critical section".
54+
#[cfg(cortex_m)]
5455
#[inline]
5556
pub fn free<F, R>(f: F) -> R
5657
where
@@ -72,3 +73,12 @@ where
7273

7374
r
7475
}
76+
77+
/// No-operation included to continue presenting a `free()` method when
78+
/// the `cortex_m` cfg is not enabled.
79+
#[cfg(not(cortex_m))]
80+
pub fn free<F, R>(f: F) -> R
81+
where
82+
F: FnOnce(&CriticalSection) -> R,
83+
{
84+
}

cortex-m/src/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
//! Prelude
22
3-
pub use embedded_hal::prelude::*;
3+
pub use eh0::prelude::*;

0 commit comments

Comments
 (0)