File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ rust-version = "1.61"
18
18
19
19
[dependencies ]
20
20
bare-metal = { version = " 0.2.4" , features = [" const-fn" ] }
21
- critical-section = { version = " 1.0.0" , optional = true }
21
+ critical-section = " 1.0.0"
22
22
volatile-register = " 0.2.2"
23
23
bitfield = " 0.13.2"
24
24
eh0 = { package = " embedded-hal" , version = " 0.2.4" }
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ pub unsafe fn enable() {
51
51
/// Execute closure `f` in an interrupt-free context.
52
52
///
53
53
/// This as also known as a "critical section".
54
+ #[ cfg( cortex_m) ]
54
55
#[ inline]
55
56
pub fn free < F , R > ( f : F ) -> R
56
57
where
72
73
73
74
r
74
75
}
76
+
77
+ // Make a `free()` function available to allow checking dependencies without specifying a target,
78
+ // but that will panic at runtime if executed.
79
+ #[ doc( hidden) ]
80
+ #[ cfg( not( cortex_m) ) ]
81
+ #[ inline]
82
+ pub fn free < F , R > ( _: F ) -> R
83
+ where
84
+ F : FnOnce ( & CriticalSection ) -> R ,
85
+ {
86
+ panic ! ( "cortex_m::interrupt::free() is only functional on cortex-m platforms" ) ;
87
+ }
Original file line number Diff line number Diff line change 60
60
use core:: marker:: PhantomData ;
61
61
use core:: ops;
62
62
63
- use crate :: interrupt;
64
-
65
63
#[ cfg( feature = "cm7" ) ]
66
64
pub mod ac;
67
65
#[ cfg( not( armv6m) ) ]
@@ -165,7 +163,7 @@ impl Peripherals {
165
163
/// Returns all the core peripherals *once*
166
164
#[ inline]
167
165
pub fn take ( ) -> Option < Self > {
168
- interrupt:: free ( |_| {
166
+ crate :: interrupt:: free ( |_| {
169
167
if unsafe { TAKEN } {
170
168
None
171
169
} else {
Original file line number Diff line number Diff line change 1
1
//! Prelude
2
2
3
- pub use embedded_hal :: prelude:: * ;
3
+ pub use eh0 :: prelude:: * ;
You can’t perform that action at this time.
0 commit comments