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 33#[ allow( unused_imports) ]
44use core:: cell:: UnsafeCell ;
55
6+ #[ cfg( not( feature = "portable-atomic" ) ) ]
7+ use core:: sync:: atomic:: AtomicBool ;
8+ #[ cfg( feature = "portable-atomic" ) ]
9+ use portable_atomic:: AtomicBool ;
10+
611#[ cfg( any( feature = "portable-atomic" , target_has_atomic = "8" ) ) ]
712/// Cell type used by [`spi::AtomicDevice`](crate::spi::AtomicDevice) and [`i2c::AtomicDevice`](crate::i2c::AtomicDevice).
813///
914/// To use `AtomicDevice`, you must wrap the bus with this struct, and then
1015/// construct multiple `AtomicDevice` instances with references to it.
1116pub struct AtomicCell < BUS > {
1217 pub ( crate ) bus : UnsafeCell < BUS > ,
13- pub ( crate ) busy : portable_atomic :: AtomicBool ,
18+ pub ( crate ) busy : AtomicBool ,
1419}
1520#[ cfg( any( feature = "portable-atomic" , target_has_atomic = "8" ) ) ]
1621unsafe impl < BUS : Send > Send for AtomicCell < BUS > { }
@@ -23,7 +28,7 @@ impl<BUS> AtomicCell<BUS> {
2328 pub fn new ( bus : BUS ) -> Self {
2429 Self {
2530 bus : UnsafeCell :: new ( bus) ,
26- busy : portable_atomic :: AtomicBool :: from ( false ) ,
31+ busy : AtomicBool :: from ( false ) ,
2732 }
2833 }
2934}
You can’t perform that action at this time.
0 commit comments