Skip to content

Commit

Permalink
Also enable Atomic* when target_has_atomic=8
Browse files Browse the repository at this point in the history
  • Loading branch information
9names committed Jun 8, 2024
1 parent 797dc95 commit d346553
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions embedded-hal-bus/src/i2c/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod mutex;
pub use mutex::*;
mod critical_section;
pub use self::critical_section::*;
#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
mod atomic;
#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
pub use atomic::*;
4 changes: 2 additions & 2 deletions embedded-hal-bus/src/spi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ pub use refcell::*;
mod mutex;
#[cfg(feature = "std")]
pub use mutex::*;
#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
mod atomic;
mod critical_section;
mod shared;
#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
pub use atomic::*;

pub use self::critical_section::*;
Expand Down
8 changes: 4 additions & 4 deletions embedded-hal-bus/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#[allow(unused_imports)]
use core::cell::UnsafeCell;

#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
/// Cell type used by [`spi::AtomicDevice`](crate::spi::AtomicDevice) and [`i2c::AtomicDevice`](crate::i2c::AtomicDevice).
///
/// To use `AtomicDevice`, you must wrap the bus with this struct, and then
Expand All @@ -12,12 +12,12 @@ pub struct AtomicCell<BUS> {
pub(crate) bus: UnsafeCell<BUS>,
pub(crate) busy: portable_atomic::AtomicBool,
}
#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
unsafe impl<BUS: Send> Send for AtomicCell<BUS> {}
#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
unsafe impl<BUS: Send> Sync for AtomicCell<BUS> {}

#[cfg(feature = "atomic-device")]
#[cfg(any(feature = "atomic-device", target_has_atomic = "8"))]
impl<BUS> AtomicCell<BUS> {
/// Create a new `AtomicCell`
pub fn new(bus: BUS) -> Self {
Expand Down

0 comments on commit d346553

Please sign in to comment.