diff options
| author | Rukai <[email protected]> | 2021-05-17 20:23:04 +1000 |
|---|---|---|
| committer | Rukai <[email protected]> | 2021-05-17 20:23:04 +1000 |
| commit | 3e83acc1cb683f74a10b42489c52200b945efa9d (patch) | |
| tree | 5fc5995aa6a7e59e5472d705be180f84c4a7d6ae | |
| parent | 149ddf2f29bf6e7fd15a45e164fafac936197599 (diff) | |
Fix unused field warnings
| -rw-r--r-- | embassy-nrf/src/buffered_uarte.rs | 9 | ||||
| -rw-r--r-- | embassy-nrf/src/pwm.rs | 6 | ||||
| -rw-r--r-- | embassy-nrf/src/qspi.rs | 8 | ||||
| -rw-r--r-- | embassy-nrf/src/saadc.rs | 8 | ||||
| -rw-r--r-- | embassy-nrf/src/spim.rs | 8 | ||||
| -rw-r--r-- | embassy-nrf/src/twim.rs | 8 |
6 files changed, 15 insertions, 32 deletions
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 @@ | |||
| 1 | use core::cmp::min; | 1 | use core::cmp::min; |
| 2 | use core::marker::PhantomData; | ||
| 2 | use core::mem; | 3 | use core::mem; |
| 3 | use core::pin::Pin; | 4 | use core::pin::Pin; |
| 4 | use core::sync::atomic::{compiler_fence, Ordering}; | 5 | use core::sync::atomic::{compiler_fence, Ordering}; |
| @@ -34,7 +35,7 @@ enum TxState { | |||
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | struct State<'d, U: UarteInstance, T: TimerInstance> { | 37 | struct State<'d, U: UarteInstance, T: TimerInstance> { |
| 37 | uarte: U, | 38 | phantom: PhantomData<&'d mut U>, |
| 38 | timer: T, | 39 | timer: T, |
| 39 | _ppi_ch1: Ppi<'d, AnyConfigurableChannel>, | 40 | _ppi_ch1: Ppi<'d, AnyConfigurableChannel>, |
| 40 | _ppi_ch2: Ppi<'d, AnyConfigurableChannel>, | 41 | _ppi_ch2: Ppi<'d, AnyConfigurableChannel>, |
| @@ -63,7 +64,7 @@ pub struct BufferedUarte<'d, U: UarteInstance, T: TimerInstance> { | |||
| 63 | impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { | 64 | impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { |
| 64 | /// unsafe: may not leak self or futures | 65 | /// unsafe: may not leak self or futures |
| 65 | pub unsafe fn new( | 66 | pub unsafe fn new( |
| 66 | uarte: impl Unborrow<Target = U> + 'd, | 67 | _uarte: impl Unborrow<Target = U> + 'd, |
| 67 | timer: impl Unborrow<Target = T> + 'd, | 68 | timer: impl Unborrow<Target = T> + 'd, |
| 68 | ppi_ch1: impl Unborrow<Target = impl ConfigurableChannel> + 'd, | 69 | ppi_ch1: impl Unborrow<Target = impl ConfigurableChannel> + 'd, |
| 69 | ppi_ch2: impl Unborrow<Target = impl ConfigurableChannel> + 'd, | 70 | ppi_ch2: impl Unborrow<Target = impl ConfigurableChannel> + 'd, |
| @@ -76,7 +77,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { | |||
| 76 | rx_buffer: &'d mut [u8], | 77 | rx_buffer: &'d mut [u8], |
| 77 | tx_buffer: &'d mut [u8], | 78 | tx_buffer: &'d mut [u8], |
| 78 | ) -> Self { | 79 | ) -> Self { |
| 79 | unborrow!(uarte, timer, ppi_ch1, ppi_ch2, irq, rxd, txd, cts, rts); | 80 | unborrow!(timer, ppi_ch1, ppi_ch2, irq, rxd, txd, cts, rts); |
| 80 | 81 | ||
| 81 | let r = U::regs(); | 82 | let r = U::regs(); |
| 82 | let rt = timer.regs(); | 83 | let rt = timer.regs(); |
| @@ -158,7 +159,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { | |||
| 158 | BufferedUarte { | 159 | BufferedUarte { |
| 159 | inner: PeripheralMutex::new( | 160 | inner: PeripheralMutex::new( |
| 160 | State { | 161 | State { |
| 161 | uarte, | 162 | phantom: PhantomData, |
| 162 | timer, | 163 | timer, |
| 163 | _ppi_ch1: ppi_ch1, | 164 | _ppi_ch1: ppi_ch1, |
| 164 | _ppi_ch2: ppi_ch2, | 165 | _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 { | |||
| 26 | 26 | ||
| 27 | /// Interface to the UARTE peripheral | 27 | /// Interface to the UARTE peripheral |
| 28 | pub struct Pwm<'d, T: Instance> { | 28 | pub struct Pwm<'d, T: Instance> { |
| 29 | peri: T, | ||
| 30 | phantom: PhantomData<&'d mut T>, | 29 | phantom: PhantomData<&'d mut T>, |
| 31 | } | 30 | } |
| 32 | 31 | ||
| @@ -41,13 +40,13 @@ impl<'d, T: Instance> Pwm<'d, T> { | |||
| 41 | /// or [`receive`](Pwm::receive). | 40 | /// or [`receive`](Pwm::receive). |
| 42 | #[allow(unused_unsafe)] | 41 | #[allow(unused_unsafe)] |
| 43 | pub fn new( | 42 | pub fn new( |
| 44 | pwm: impl Unborrow<Target = T> + 'd, | 43 | _pwm: impl Unborrow<Target = T> + 'd, |
| 45 | ch0: impl Unborrow<Target = impl GpioOptionalPin> + 'd, | 44 | ch0: impl Unborrow<Target = impl GpioOptionalPin> + 'd, |
| 46 | ch1: impl Unborrow<Target = impl GpioOptionalPin> + 'd, | 45 | ch1: impl Unborrow<Target = impl GpioOptionalPin> + 'd, |
| 47 | ch2: impl Unborrow<Target = impl GpioOptionalPin> + 'd, | 46 | ch2: impl Unborrow<Target = impl GpioOptionalPin> + 'd, |
| 48 | ch3: impl Unborrow<Target = impl GpioOptionalPin> + 'd, | 47 | ch3: impl Unborrow<Target = impl GpioOptionalPin> + 'd, |
| 49 | ) -> Self { | 48 | ) -> Self { |
| 50 | unborrow!(pwm, ch0, ch1, ch2, ch3); | 49 | unborrow!(ch0, ch1, ch2, ch3); |
| 51 | 50 | ||
| 52 | let r = T::regs(); | 51 | let r = T::regs(); |
| 53 | let s = T::state(); | 52 | let s = T::state(); |
| @@ -97,7 +96,6 @@ impl<'d, T: Instance> Pwm<'d, T> { | |||
| 97 | r.loop_.write(|w| w.cnt().disabled()); | 96 | r.loop_.write(|w| w.cnt().disabled()); |
| 98 | 97 | ||
| 99 | Self { | 98 | Self { |
| 100 | peri: pwm, | ||
| 101 | phantom: PhantomData, | 99 | phantom: PhantomData, |
| 102 | } | 100 | } |
| 103 | } | 101 | } |
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 { | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | pub struct Qspi<'d, T: Instance> { | 57 | pub struct Qspi<'d, T: Instance> { |
| 58 | peri: T, | ||
| 59 | irq: T::Interrupt, | ||
| 60 | phantom: PhantomData<&'d mut T>, | 58 | phantom: PhantomData<&'d mut T>, |
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | impl<'d, T: Instance> Qspi<'d, T> { | 61 | impl<'d, T: Instance> Qspi<'d, T> { |
| 64 | pub fn new( | 62 | pub fn new( |
| 65 | qspi: impl Unborrow<Target = T> + 'd, | 63 | _qspi: impl Unborrow<Target = T> + 'd, |
| 66 | irq: impl Unborrow<Target = T::Interrupt> + 'd, | 64 | irq: impl Unborrow<Target = T::Interrupt> + 'd, |
| 67 | sck: impl Unborrow<Target = impl GpioPin> + 'd, | 65 | sck: impl Unborrow<Target = impl GpioPin> + 'd, |
| 68 | csn: impl Unborrow<Target = impl GpioPin> + 'd, | 66 | csn: impl Unborrow<Target = impl GpioPin> + 'd, |
| @@ -72,7 +70,7 @@ impl<'d, T: Instance> Qspi<'d, T> { | |||
| 72 | io3: impl Unborrow<Target = impl GpioPin> + 'd, | 70 | io3: impl Unborrow<Target = impl GpioPin> + 'd, |
| 73 | config: Config, | 71 | config: Config, |
| 74 | ) -> Self { | 72 | ) -> Self { |
| 75 | unborrow!(qspi, irq, sck, csn, io0, io1, io2, io3); | 73 | unborrow!(irq, sck, csn, io0, io1, io2, io3); |
| 76 | 74 | ||
| 77 | let r = T::regs(); | 75 | let r = T::regs(); |
| 78 | 76 | ||
| @@ -139,8 +137,6 @@ impl<'d, T: Instance> Qspi<'d, T> { | |||
| 139 | irq.enable(); | 137 | irq.enable(); |
| 140 | 138 | ||
| 141 | Self { | 139 | Self { |
| 142 | peri: qspi, | ||
| 143 | irq, | ||
| 144 | phantom: PhantomData, | 140 | phantom: PhantomData, |
| 145 | } | 141 | } |
| 146 | } | 142 | } |
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 {} | |||
| 32 | 32 | ||
| 33 | /// One-shot saadc. Continuous sample mode TODO. | 33 | /// One-shot saadc. Continuous sample mode TODO. |
| 34 | pub struct OneShot<'d, T: PositivePin> { | 34 | pub struct OneShot<'d, T: PositivePin> { |
| 35 | peri: peripherals::SAADC, | ||
| 36 | positive_pin: T, | ||
| 37 | irq: interrupt::SAADC, | 35 | irq: interrupt::SAADC, |
| 38 | phantom: PhantomData<(&'d mut peripherals::SAADC, &'d mut T)>, | 36 | phantom: PhantomData<(&'d mut peripherals::SAADC, &'d mut T)>, |
| 39 | } | 37 | } |
| @@ -71,12 +69,12 @@ impl Default for Config { | |||
| 71 | 69 | ||
| 72 | impl<'d, T: PositivePin> OneShot<'d, T> { | 70 | impl<'d, T: PositivePin> OneShot<'d, T> { |
| 73 | pub fn new( | 71 | pub fn new( |
| 74 | saadc: impl Unborrow<Target = peripherals::SAADC> + 'd, | 72 | _saadc: impl Unborrow<Target = peripherals::SAADC> + 'd, |
| 75 | irq: impl Unborrow<Target = interrupt::SAADC> + 'd, | 73 | irq: impl Unborrow<Target = interrupt::SAADC> + 'd, |
| 76 | positive_pin: impl Unborrow<Target = T> + 'd, | 74 | positive_pin: impl Unborrow<Target = T> + 'd, |
| 77 | config: Config, | 75 | config: Config, |
| 78 | ) -> Self { | 76 | ) -> Self { |
| 79 | unborrow!(saadc, irq, positive_pin); | 77 | unborrow!(irq, positive_pin); |
| 80 | 78 | ||
| 81 | let r = unsafe { &*SAADC::ptr() }; | 79 | let r = unsafe { &*SAADC::ptr() }; |
| 82 | 80 | ||
| @@ -118,8 +116,6 @@ impl<'d, T: PositivePin> OneShot<'d, T> { | |||
| 118 | r.intenclr.write(|w| unsafe { w.bits(0x003F_FFFF) }); | 116 | r.intenclr.write(|w| unsafe { w.bits(0x003F_FFFF) }); |
| 119 | 117 | ||
| 120 | Self { | 118 | Self { |
| 121 | peri: saadc, | ||
| 122 | positive_pin, | ||
| 123 | irq, | 119 | irq, |
| 124 | phantom: PhantomData, | 120 | phantom: PhantomData, |
| 125 | } | 121 | } |
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 { | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | pub struct Spim<'d, T: Instance> { | 32 | pub struct Spim<'d, T: Instance> { |
| 33 | peri: T, | ||
| 34 | irq: T::Interrupt, | ||
| 35 | phantom: PhantomData<&'d mut T>, | 33 | phantom: PhantomData<&'d mut T>, |
| 36 | } | 34 | } |
| 37 | 35 | ||
| @@ -54,14 +52,14 @@ impl Default for Config { | |||
| 54 | 52 | ||
| 55 | impl<'d, T: Instance> Spim<'d, T> { | 53 | impl<'d, T: Instance> Spim<'d, T> { |
| 56 | pub fn new( | 54 | pub fn new( |
| 57 | spim: impl Unborrow<Target = T> + 'd, | 55 | _spim: impl Unborrow<Target = T> + 'd, |
| 58 | irq: impl Unborrow<Target = T::Interrupt> + 'd, | 56 | irq: impl Unborrow<Target = T::Interrupt> + 'd, |
| 59 | sck: impl Unborrow<Target = impl GpioPin> + 'd, | 57 | sck: impl Unborrow<Target = impl GpioPin> + 'd, |
| 60 | miso: impl Unborrow<Target = impl OptionalPin> + 'd, | 58 | miso: impl Unborrow<Target = impl OptionalPin> + 'd, |
| 61 | mosi: impl Unborrow<Target = impl OptionalPin> + 'd, | 59 | mosi: impl Unborrow<Target = impl OptionalPin> + 'd, |
| 62 | config: Config, | 60 | config: Config, |
| 63 | ) -> Self { | 61 | ) -> Self { |
| 64 | unborrow!(spim, irq, sck, miso, mosi); | 62 | unborrow!(irq, sck, miso, mosi); |
| 65 | 63 | ||
| 66 | let r = T::regs(); | 64 | let r = T::regs(); |
| 67 | 65 | ||
| @@ -140,8 +138,6 @@ impl<'d, T: Instance> Spim<'d, T> { | |||
| 140 | irq.enable(); | 138 | irq.enable(); |
| 141 | 139 | ||
| 142 | Self { | 140 | Self { |
| 143 | peri: spim, | ||
| 144 | irq, | ||
| 145 | phantom: PhantomData, | 141 | phantom: PhantomData, |
| 146 | } | 142 | } |
| 147 | } | 143 | } |
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 { | |||
| 42 | 42 | ||
| 43 | /// Interface to a TWIM instance. | 43 | /// Interface to a TWIM instance. |
| 44 | pub struct Twim<'d, T: Instance> { | 44 | pub struct Twim<'d, T: Instance> { |
| 45 | peri: T, | ||
| 46 | irq: T::Interrupt, | ||
| 47 | phantom: PhantomData<&'d mut T>, | 45 | phantom: PhantomData<&'d mut T>, |
| 48 | } | 46 | } |
| 49 | 47 | ||
| 50 | impl<'d, T: Instance> Twim<'d, T> { | 48 | impl<'d, T: Instance> Twim<'d, T> { |
| 51 | pub fn new( | 49 | pub fn new( |
| 52 | twim: impl Unborrow<Target = T> + 'd, | 50 | _twim: impl Unborrow<Target = T> + 'd, |
| 53 | irq: impl Unborrow<Target = T::Interrupt> + 'd, | 51 | irq: impl Unborrow<Target = T::Interrupt> + 'd, |
| 54 | sda: impl Unborrow<Target = impl GpioPin> + 'd, | 52 | sda: impl Unborrow<Target = impl GpioPin> + 'd, |
| 55 | scl: impl Unborrow<Target = impl GpioPin> + 'd, | 53 | scl: impl Unborrow<Target = impl GpioPin> + 'd, |
| 56 | config: Config, | 54 | config: Config, |
| 57 | ) -> Self { | 55 | ) -> Self { |
| 58 | unborrow!(twim, irq, sda, scl); | 56 | unborrow!(irq, sda, scl); |
| 59 | 57 | ||
| 60 | let r = T::regs(); | 58 | let r = T::regs(); |
| 61 | 59 | ||
| @@ -94,8 +92,6 @@ impl<'d, T: Instance> Twim<'d, T> { | |||
| 94 | irq.enable(); | 92 | irq.enable(); |
| 95 | 93 | ||
| 96 | Self { | 94 | Self { |
| 97 | peri: twim, | ||
| 98 | irq, | ||
| 99 | phantom: PhantomData, | 95 | phantom: PhantomData, |
| 100 | } | 96 | } |
| 101 | } | 97 | } |
