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"
1818
1919[dependencies ]
2020bare-metal = { version = " 0.2.4" , features = [" const-fn" ] }
21- critical-section = { version = " 1.0.0" , optional = true }
21+ critical-section = " 1.0.0"
2222volatile-register = " 0.2.2"
2323bitfield = " 0.13.2"
2424eh0 = { 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() {
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]
5556pub fn free < F , R > ( f : F ) -> R
5657where
7273
7374 r
7475}
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 6060use core:: marker:: PhantomData ;
6161use core:: ops;
6262
63- use crate :: interrupt;
64-
6563#[ cfg( feature = "cm7" ) ]
6664pub mod ac;
6765#[ cfg( not( armv6m) ) ]
@@ -165,7 +163,7 @@ impl Peripherals {
165163 /// Returns all the core peripherals *once*
166164 #[ inline]
167165 pub fn take ( ) -> Option < Self > {
168- interrupt:: free ( |_| {
166+ crate :: interrupt:: free ( |_| {
169167 if unsafe { TAKEN } {
170168 None
171169 } else {
Original file line number Diff line number Diff line change 11//! Prelude
22
3- pub use embedded_hal :: prelude:: * ;
3+ pub use eh0 :: prelude:: * ;
You can’t perform that action at this time.
0 commit comments