Update embassy-stm32

This commit is contained in:
Dario Nieuwenhuis
2022-07-23 01:29:35 +02:00
parent e0521ea249
commit 8a9d2f59af
26 changed files with 433 additions and 361 deletions

View File

@ -1,6 +1,4 @@
use core::marker::PhantomData;
use embassy_hal_common::unborrow;
use embassy_hal_common::{unborrow, Unborrowed};
use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash};
pub use crate::pac::{ERASE_SIZE, ERASE_VALUE, FLASH_BASE, FLASH_SIZE, WRITE_SIZE};
@ -16,20 +14,16 @@ const FLASH_END: usize = FLASH_BASE + FLASH_SIZE;
mod family;
pub struct Flash<'d> {
_inner: FLASH,
_phantom: PhantomData<&'d mut FLASH>,
_inner: Unborrowed<'d, FLASH>,
}
impl<'d> Flash<'d> {
pub fn new(p: impl Unborrow<Target = FLASH>) -> Self {
pub fn new(p: impl Unborrow<Target = FLASH> + 'd) -> Self {
unborrow!(p);
Self {
_inner: p,
_phantom: PhantomData,
}
Self { _inner: p }
}
pub fn unlock(p: impl Unborrow<Target = FLASH>) -> Self {
pub fn unlock(p: impl Unborrow<Target = FLASH> + 'd) -> Self {
let flash = Self::new(p);
unsafe { family::unlock() };