Merge #598
598: Upgrade to embedded-storage 0.3.0 r=lulf a=lulf Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
This commit is contained in:
commit
965e3c436e
@ -63,7 +63,7 @@ futures = { version = "0.3.17", default-features = false }
|
|||||||
critical-section = "0.2.5"
|
critical-section = "0.2.5"
|
||||||
rand_core = "0.6.3"
|
rand_core = "0.6.3"
|
||||||
fixed = "1.10.0"
|
fixed = "1.10.0"
|
||||||
embedded-storage = "0.2.0"
|
embedded-storage = "0.3.0"
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
nrf-usbd = {version = "0.1.1"}
|
nrf-usbd = {version = "0.1.1"}
|
||||||
usb-device = "0.2.8"
|
usb-device = "0.2.8"
|
||||||
|
@ -8,7 +8,9 @@ use core::ptr;
|
|||||||
use core::slice;
|
use core::slice;
|
||||||
use embassy::util::Unborrow;
|
use embassy::util::Unborrow;
|
||||||
use embassy_hal_common::unborrow;
|
use embassy_hal_common::unborrow;
|
||||||
use embedded_storage::nor_flash::{MultiwriteNorFlash, NorFlash, ReadNorFlash};
|
use embedded_storage::nor_flash::{
|
||||||
|
ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash,
|
||||||
|
};
|
||||||
|
|
||||||
pub const PAGE_SIZE: usize = 4096;
|
pub const PAGE_SIZE: usize = 4096;
|
||||||
pub const FLASH_SIZE: usize = crate::chip::FLASH_SIZE;
|
pub const FLASH_SIZE: usize = crate::chip::FLASH_SIZE;
|
||||||
@ -20,6 +22,15 @@ pub enum Error {
|
|||||||
Unaligned,
|
Unaligned,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl NorFlashError for Error {
|
||||||
|
fn kind(&self) -> NorFlashErrorKind {
|
||||||
|
match self {
|
||||||
|
Self::OutOfBounds => NorFlashErrorKind::OutOfBounds,
|
||||||
|
Self::Unaligned => NorFlashErrorKind::NotAligned,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Nvmc<'d> {
|
pub struct Nvmc<'d> {
|
||||||
_p: PhantomData<&'d NVMC>,
|
_p: PhantomData<&'d NVMC>,
|
||||||
}
|
}
|
||||||
@ -43,9 +54,11 @@ impl<'d> Nvmc<'d> {
|
|||||||
|
|
||||||
impl<'d> MultiwriteNorFlash for Nvmc<'d> {}
|
impl<'d> MultiwriteNorFlash for Nvmc<'d> {}
|
||||||
|
|
||||||
impl<'d> ReadNorFlash for Nvmc<'d> {
|
impl<'d> ErrorType for Nvmc<'d> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d> ReadNorFlash for Nvmc<'d> {
|
||||||
const READ_SIZE: usize = 1;
|
const READ_SIZE: usize = 1;
|
||||||
|
|
||||||
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
|
@ -17,7 +17,7 @@ cortex-m-rt = "0.7.0"
|
|||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||||
rand = { version = "0.8.4", default-features = false }
|
rand = { version = "0.8.4", default-features = false }
|
||||||
embedded-storage = "0.2.0"
|
embedded-storage = "0.3.0"
|
||||||
|
|
||||||
usb-device = "0.2"
|
usb-device = "0.2"
|
||||||
usbd-serial = "0.1.1"
|
usbd-serial = "0.1.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user