diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-23 15:13:47 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-23 15:13:47 +0200 |
| commit | 709df0dc1dfff577fb79bbc2f67ea84670072456 (patch) | |
| tree | 4a54aee47c0d3881b9e0bc809e075728cee8eeae /embassy-nrf/src/spim.rs | |
| parent | 19d1ef0e29fdd0bf0407cbe37c388e8a87e7ddfe (diff) | |
nrf: replace PhantomData usages with PeripheralRef.
Diffstat (limited to 'embassy-nrf/src/spim.rs')
| -rw-r--r-- | embassy-nrf/src/spim.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index a6b0be076..a512b4813 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![macro_use] | 1 | #![macro_use] |
| 2 | 2 | ||
| 3 | use core::marker::PhantomData; | ||
| 4 | use core::sync::atomic::{compiler_fence, Ordering}; | 3 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 5 | use core::task::Poll; | 4 | use core::task::Poll; |
| 6 | 5 | ||
| @@ -31,7 +30,7 @@ pub enum Error { | |||
| 31 | /// | 30 | /// |
| 32 | /// For more details about EasyDMA, consult the module documentation. | 31 | /// For more details about EasyDMA, consult the module documentation. |
| 33 | pub struct Spim<'d, T: Instance> { | 32 | pub struct Spim<'d, T: Instance> { |
| 34 | phantom: PhantomData<&'d mut T>, | 33 | _p: PeripheralRef<'d, T>, |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | #[non_exhaustive] | 36 | #[non_exhaustive] |
| @@ -94,14 +93,14 @@ impl<'d, T: Instance> Spim<'d, T> { | |||
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | fn new_inner( | 95 | fn new_inner( |
| 97 | _spim: impl Peripheral<P = T> + 'd, | 96 | spim: impl Peripheral<P = T> + 'd, |
| 98 | irq: impl Peripheral<P = T::Interrupt> + 'd, | 97 | irq: impl Peripheral<P = T::Interrupt> + 'd, |
| 99 | sck: PeripheralRef<'d, AnyPin>, | 98 | sck: PeripheralRef<'d, AnyPin>, |
| 100 | miso: Option<PeripheralRef<'d, AnyPin>>, | 99 | miso: Option<PeripheralRef<'d, AnyPin>>, |
| 101 | mosi: Option<PeripheralRef<'d, AnyPin>>, | 100 | mosi: Option<PeripheralRef<'d, AnyPin>>, |
| 102 | config: Config, | 101 | config: Config, |
| 103 | ) -> Self { | 102 | ) -> Self { |
| 104 | into_ref!(irq); | 103 | into_ref!(spim, irq); |
| 105 | 104 | ||
| 106 | let r = T::regs(); | 105 | let r = T::regs(); |
| 107 | 106 | ||
| @@ -181,7 +180,7 @@ impl<'d, T: Instance> Spim<'d, T> { | |||
| 181 | irq.unpend(); | 180 | irq.unpend(); |
| 182 | irq.enable(); | 181 | irq.enable(); |
| 183 | 182 | ||
| 184 | Self { phantom: PhantomData } | 183 | Self { _p: spim } |
| 185 | } | 184 | } |
| 186 | 185 | ||
| 187 | fn on_interrupt(_: *mut ()) { | 186 | fn on_interrupt(_: *mut ()) { |
