nrf: replace PhantomData usages with PeripheralRef.

This commit is contained in:
Dario Nieuwenhuis
2022-07-23 15:13:47 +02:00
parent 19d1ef0e29
commit 709df0dc1d
12 changed files with 180 additions and 164 deletions

View File

@ -1,9 +1,8 @@
//! Nvmcerature sensor interface.
use core::marker::PhantomData;
use core::{ptr, slice};
use embassy_hal_common::into_ref;
use embassy_hal_common::{into_ref, PeripheralRef};
use embedded_storage::nor_flash::{
ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash,
};
@ -31,14 +30,13 @@ impl NorFlashError for Error {
}
pub struct Nvmc<'d> {
_p: PhantomData<&'d NVMC>,
_p: PeripheralRef<'d, NVMC>,
}
impl<'d> Nvmc<'d> {
pub fn new(_p: impl Peripheral<P = NVMC> + 'd) -> Self {
into_ref!(_p);
Self { _p: PhantomData }
Self { _p }
}
fn regs() -> &'static pac::nvmc::RegisterBlock {