File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 3
3
#[ allow( unused_imports) ]
4
4
use core:: cell:: UnsafeCell ;
5
5
6
+ #[ cfg( not( feature = "portable-atomic" ) ) ]
7
+ use core:: sync:: atomic:: AtomicBool ;
8
+ #[ cfg( feature = "portable-atomic" ) ]
9
+ use portable_atomic:: AtomicBool ;
10
+
6
11
#[ cfg( any( feature = "portable-atomic" , target_has_atomic = "8" ) ) ]
7
12
/// Cell type used by [`spi::AtomicDevice`](crate::spi::AtomicDevice) and [`i2c::AtomicDevice`](crate::i2c::AtomicDevice).
8
13
///
9
14
/// To use `AtomicDevice`, you must wrap the bus with this struct, and then
10
15
/// construct multiple `AtomicDevice` instances with references to it.
11
16
pub struct AtomicCell < BUS > {
12
17
pub ( crate ) bus : UnsafeCell < BUS > ,
13
- pub ( crate ) busy : portable_atomic :: AtomicBool ,
18
+ pub ( crate ) busy : AtomicBool ,
14
19
}
15
20
#[ cfg( any( feature = "portable-atomic" , target_has_atomic = "8" ) ) ]
16
21
unsafe impl < BUS : Send > Send for AtomicCell < BUS > { }
@@ -23,7 +28,7 @@ impl<BUS> AtomicCell<BUS> {
23
28
pub fn new ( bus : BUS ) -> Self {
24
29
Self {
25
30
bus : UnsafeCell :: new ( bus) ,
26
- busy : portable_atomic :: AtomicBool :: from ( false ) ,
31
+ busy : AtomicBool :: from ( false ) ,
27
32
}
28
33
}
29
34
}
You can’t perform that action at this time.
0 commit comments