Skip to content

Commit 6ab1d51

Browse files
committed
Use portable-atomic
1 parent 3c9d75c commit 6ab1d51

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ rust-version = "1.59"
1313
[dependencies]
1414
embedded-hal = { version = "0.2.6", features = ["unproven"] }
1515
nb = "1.0.0"
16-
atomic-polyfill = "1.0.2"
1716
riscv = { version = "0.10.1", features = ["critical-section-single-hart"] }
1817
e310x = { version = "0.11.0", features = ["rt", "critical-section"] }
1918

19+
[target.'cfg(not(target_has_atomic = "32"))'.dependencies]
20+
portable-atomic = { version = "1.4", default-features = false, features = ["unsafe-assume-single-core"] }
21+
2022
[features]
2123
g002 = ["e310x/g002"]
2224
virq = []

src/gpio.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
//! General Purpose I/O
22
3-
use atomic_polyfill::{AtomicU32, Ordering};
43
use core::marker::PhantomData;
54

5+
#[cfg(target_has_atomic = "32")]
6+
use core::sync::atomic::{AtomicU32, Ordering};
7+
#[cfg(not(target_has_atomic = "32"))]
8+
use portable_atomic::{AtomicU32, Ordering};
9+
610
/// GpioExt trait extends the GPIO0 peripheral.
711
pub trait GpioExt {
812
/// The parts to split the GPIO into.

0 commit comments

Comments
 (0)