Skip to content

Commit 82d24dc

Browse files
committed
Switch atomic-polyfill to portable-atomic
1 parent 78da5ca commit 82d24dc

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

hal/Cargo.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ features = ["samd21g", "samd21g-rt", "unproven", "usb"]
3131

3232
[dependencies]
3333
aes = "0.7.5"
34-
atomic-polyfill = "0.1.8"
3534
bitfield = "0.13"
3635
bitflags = "1.2.1"
3736
cipher = "0.3"
@@ -43,6 +42,7 @@ nb = "1.0"
4342
num-traits = {version = "0.2.14", default-features = false}
4443
opaque-debug = "0.3.0"
4544
paste = "1.0.11"
45+
portable-atomic = {version = "1.5.0", optional = true, default-features = false}
4646
rand_core = "0.6"
4747
seq-macro = "0.3"
4848
typenum = "1.12.0"
@@ -97,9 +97,6 @@ atsame53n = {version = "0.13.0", path = "../pac/atsame53n", optional = true}
9797
atsame54n = {version = "0.13.0", path = "../pac/atsame54n", optional = true}
9898
atsame54p = {version = "0.13.0", path = "../pac/atsame54p", optional = true}
9999

100-
101-
102-
103100
#===============================================================================
104101
# Features
105102
#===============================================================================
@@ -201,6 +198,7 @@ async = [
201198
"embassy-sync",
202199
"embedded-hal-async",
203200
"futures",
201+
"portable-atomic"
204202
]
205203

206204
#===============================================================================

hal/src/async_hal/timer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::{ehal::timer::CountDown, timer_traits::InterruptDrivenTimer, typelevel::Sealed};
2-
use atomic_polyfill::AtomicBool;
32
use core::{
43
future::poll_fn,
54
sync::atomic::Ordering,
@@ -9,6 +8,7 @@ use cortex_m::interrupt::InterruptNumber;
98
use cortex_m_interrupt::NvicInterruptRegistration;
109
use embassy_sync::waitqueue::AtomicWaker;
1110
use fugit::{MicrosDurationU32, MillisDurationU32, NanosDurationU32};
11+
use portable_atomic::AtomicBool;
1212

1313
#[cfg(feature = "thumbv6")]
1414
use crate::thumbv6m::timer;

hal/src/dmac/channel/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl<Id: ChId, S: Status> Channel<Id, S> {
264264
}
265265

266266
/// Stop transfer on channel whether or not the transfer has completed
267+
#[inline]
267268
pub(crate) fn stop(&mut self) {
268269
self.regs.chctrla.modify(|_, w| w.enable().clear_bit());
269270
}
@@ -274,10 +275,12 @@ impl<Id: ChId, S: Status> Channel<Id, S> {
274275
!self.regs.chctrla.read().enable().bit_is_set()
275276
}
276277

277-
/// Returns whether the transfer's success status.
278+
/// Returns the transfer's success status.
279+
#[allow(dead_code)]
280+
#[inline]
278281
pub(crate) fn xfer_success(&mut self) -> super::Result<()> {
279-
let is_ok = self.regs.chintflag.read().terr().bit_is_clear();
280-
is_ok.then_some(()).ok_or(super::Error::TransferError)
282+
let success = self.regs.chintflag.read().terr().bit_is_clear();
283+
success.then_some(()).ok_or(super::Error::TransferError)
281284
}
282285
}
283286

hal/src/dmac/dma_controller.rs

+1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ impl DmaController {
335335
with_num_channels!(define_split);
336336
}
337337

338+
#[cfg(feature = "async")]
338339
macro_rules! define_split_future {
339340
($num_channels:literal) => {
340341
seq!(N in 0..$num_channels {

hal/src/sercom/i2c/flags.rs

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub enum Error {
8585
Dma(crate::dmac::Error),
8686
}
8787

88+
#[cfg(feature = "async")]
8889
impl embedded_hal_async::i2c::Error for Error {
8990
// _ pattern reachable when "dma" feature enabled.
9091
#[allow(unreachable_patterns)]

hal/src/sercom/spi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ bitflags! {
417417
}
418418
}
419419

420+
#[allow(dead_code)]
420421
impl Flags {
421422
pub(super) const RX: Self = unsafe { Self::from_bits_unchecked(RX_FLAG_MASK) };
422423
pub(super) const TX: Self = unsafe { Self::from_bits_unchecked(TX_FLAG_MASK) };

0 commit comments

Comments
 (0)