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/nvmc.rs | |
| parent | 19d1ef0e29fdd0bf0407cbe37c388e8a87e7ddfe (diff) | |
nrf: replace PhantomData usages with PeripheralRef.
Diffstat (limited to 'embassy-nrf/src/nvmc.rs')
| -rw-r--r-- | embassy-nrf/src/nvmc.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/embassy-nrf/src/nvmc.rs b/embassy-nrf/src/nvmc.rs index 731def46a..cd6100339 100644 --- a/embassy-nrf/src/nvmc.rs +++ b/embassy-nrf/src/nvmc.rs | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | //! Nvmcerature sensor interface. | 1 | //! Nvmcerature sensor interface. |
| 2 | 2 | ||
| 3 | use core::marker::PhantomData; | ||
| 4 | use core::{ptr, slice}; | 3 | use core::{ptr, slice}; |
| 5 | 4 | ||
| 6 | use embassy_hal_common::into_ref; | 5 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 7 | use embedded_storage::nor_flash::{ | 6 | use embedded_storage::nor_flash::{ |
| 8 | ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash, | 7 | ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash, |
| 9 | }; | 8 | }; |
| @@ -31,14 +30,13 @@ impl NorFlashError for Error { | |||
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | pub struct Nvmc<'d> { | 32 | pub struct Nvmc<'d> { |
| 34 | _p: PhantomData<&'d NVMC>, | 33 | _p: PeripheralRef<'d, NVMC>, |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | impl<'d> Nvmc<'d> { | 36 | impl<'d> Nvmc<'d> { |
| 38 | pub fn new(_p: impl Peripheral<P = NVMC> + 'd) -> Self { | 37 | pub fn new(_p: impl Peripheral<P = NVMC> + 'd) -> Self { |
| 39 | into_ref!(_p); | 38 | into_ref!(_p); |
| 40 | 39 | Self { _p } | |
| 41 | Self { _p: PhantomData } | ||
| 42 | } | 40 | } |
| 43 | 41 | ||
| 44 | fn regs() -> &'static pac::nvmc::RegisterBlock { | 42 | fn regs() -> &'static pac::nvmc::RegisterBlock { |
