diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index 49e8dd2b6..b4ec70913 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs @@ -1,4 +1,5 @@ use core::cmp::min; +use core::marker::PhantomData; use core::mem; use core::pin::Pin; use core::sync::atomic::{compiler_fence, Ordering}; @@ -34,7 +35,7 @@ enum TxState { } struct State<'d, U: UarteInstance, T: TimerInstance> { - uarte: U, + phantom: PhantomData<&'d mut U>, timer: T, _ppi_ch1: Ppi<'d, AnyConfigurableChannel>, _ppi_ch2: Ppi<'d, AnyConfigurableChannel>, @@ -63,7 +64,7 @@ pub struct BufferedUarte<'d, U: UarteInstance, T: TimerInstance> { impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { /// unsafe: may not leak self or futures pub unsafe fn new( - uarte: impl Unborrow + 'd, + _uarte: impl Unborrow + 'd, timer: impl Unborrow + 'd, ppi_ch1: impl Unborrow + 'd, ppi_ch2: impl Unborrow + 'd, @@ -76,7 +77,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { rx_buffer: &'d mut [u8], tx_buffer: &'d mut [u8], ) -> Self { - unborrow!(uarte, timer, ppi_ch1, ppi_ch2, irq, rxd, txd, cts, rts); + unborrow!(timer, ppi_ch1, ppi_ch2, irq, rxd, txd, cts, rts); let r = U::regs(); let rt = timer.regs(); @@ -158,7 +159,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { BufferedUarte { inner: PeripheralMutex::new( State { - uarte, + phantom: PhantomData, timer, _ppi_ch1: ppi_ch1, _ppi_ch2: ppi_ch2, diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index da933cc80..8fc16a3ba 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs @@ -26,7 +26,6 @@ pub enum Prescaler { /// Interface to the UARTE peripheral pub struct Pwm<'d, T: Instance> { - peri: T, phantom: PhantomData<&'d mut T>, } @@ -41,13 +40,13 @@ impl<'d, T: Instance> Pwm<'d, T> { /// or [`receive`](Pwm::receive). #[allow(unused_unsafe)] pub fn new( - pwm: impl Unborrow + 'd, + _pwm: impl Unborrow + 'd, ch0: impl Unborrow + 'd, ch1: impl Unborrow + 'd, ch2: impl Unborrow + 'd, ch3: impl Unborrow + 'd, ) -> Self { - unborrow!(pwm, ch0, ch1, ch2, ch3); + unborrow!(ch0, ch1, ch2, ch3); let r = T::regs(); let s = T::state(); @@ -97,7 +96,6 @@ impl<'d, T: Instance> Pwm<'d, T> { r.loop_.write(|w| w.cnt().disabled()); Self { - peri: pwm, phantom: PhantomData, } } diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index ea19ccf51..e5d21ceaf 100644 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs @@ -55,14 +55,12 @@ impl Default for Config { } pub struct Qspi<'d, T: Instance> { - peri: T, - irq: T::Interrupt, phantom: PhantomData<&'d mut T>, } impl<'d, T: Instance> Qspi<'d, T> { pub fn new( - qspi: impl Unborrow + 'd, + _qspi: impl Unborrow + 'd, irq: impl Unborrow + 'd, sck: impl Unborrow + 'd, csn: impl Unborrow + 'd, @@ -72,7 +70,7 @@ impl<'d, T: Instance> Qspi<'d, T> { io3: impl Unborrow + 'd, config: Config, ) -> Self { - unborrow!(qspi, irq, sck, csn, io0, io1, io2, io3); + unborrow!(irq, sck, csn, io0, io1, io2, io3); let r = T::regs(); @@ -139,8 +137,6 @@ impl<'d, T: Instance> Qspi<'d, T> { irq.enable(); Self { - peri: qspi, - irq, phantom: PhantomData, } } diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index 448d0334c..33dab8d1a 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs @@ -32,8 +32,6 @@ pub enum Error {} /// One-shot saadc. Continuous sample mode TODO. pub struct OneShot<'d, T: PositivePin> { - peri: peripherals::SAADC, - positive_pin: T, irq: interrupt::SAADC, phantom: PhantomData<(&'d mut peripherals::SAADC, &'d mut T)>, } @@ -71,12 +69,12 @@ impl Default for Config { impl<'d, T: PositivePin> OneShot<'d, T> { pub fn new( - saadc: impl Unborrow + 'd, + _saadc: impl Unborrow + 'd, irq: impl Unborrow + 'd, positive_pin: impl Unborrow + 'd, config: Config, ) -> Self { - unborrow!(saadc, irq, positive_pin); + unborrow!(irq, positive_pin); let r = unsafe { &*SAADC::ptr() }; @@ -118,8 +116,6 @@ impl<'d, T: PositivePin> OneShot<'d, T> { r.intenclr.write(|w| unsafe { w.bits(0x003F_FFFF) }); Self { - peri: saadc, - positive_pin, irq, phantom: PhantomData, } diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index e5d077306..bb43b7c7c 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs @@ -30,8 +30,6 @@ pub enum Error { } pub struct Spim<'d, T: Instance> { - peri: T, - irq: T::Interrupt, phantom: PhantomData<&'d mut T>, } @@ -54,14 +52,14 @@ impl Default for Config { impl<'d, T: Instance> Spim<'d, T> { pub fn new( - spim: impl Unborrow + 'd, + _spim: impl Unborrow + 'd, irq: impl Unborrow + 'd, sck: impl Unborrow + 'd, miso: impl Unborrow + 'd, mosi: impl Unborrow + 'd, config: Config, ) -> Self { - unborrow!(spim, irq, sck, miso, mosi); + unborrow!(irq, sck, miso, mosi); let r = T::regs(); @@ -140,8 +138,6 @@ impl<'d, T: Instance> Spim<'d, T> { irq.enable(); Self { - peri: spim, - irq, phantom: PhantomData, } } diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 3e0fbc3d0..05c4c260f 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs @@ -42,20 +42,18 @@ impl Default for Config { /// Interface to a TWIM instance. pub struct Twim<'d, T: Instance> { - peri: T, - irq: T::Interrupt, phantom: PhantomData<&'d mut T>, } impl<'d, T: Instance> Twim<'d, T> { pub fn new( - twim: impl Unborrow + 'd, + _twim: impl Unborrow + 'd, irq: impl Unborrow + 'd, sda: impl Unborrow + 'd, scl: impl Unborrow + 'd, config: Config, ) -> Self { - unborrow!(twim, irq, sda, scl); + unborrow!(irq, sda, scl); let r = T::regs(); @@ -94,8 +92,6 @@ impl<'d, T: Instance> Twim<'d, T> { irq.enable(); Self { - peri: twim, - irq, phantom: PhantomData, } }