mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-26 00:32:33 +00:00
Upgrade to embedded-storage 0.3.0
This commit is contained in:
parent
d06b0628e0
commit
f79624c3e6
@ -63,7 +63,7 @@ futures = { version = "0.3.17", default-features = false }
|
||||
critical-section = "0.2.5"
|
||||
rand_core = "0.6.3"
|
||||
fixed = "1.10.0"
|
||||
embedded-storage = "0.2.0"
|
||||
embedded-storage = "0.3.0"
|
||||
cfg-if = "1.0.0"
|
||||
nrf-usbd = {version = "0.1.1"}
|
||||
usb-device = "0.2.8"
|
||||
|
@ -8,7 +8,9 @@ use core::ptr;
|
||||
use core::slice;
|
||||
use embassy::util::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 FLASH_SIZE: usize = crate::chip::FLASH_SIZE;
|
||||
@ -20,6 +22,15 @@ pub enum Error {
|
||||
Unaligned,
|
||||
}
|
||||
|
||||
impl NorFlashError for Error {
|
||||
fn kind(&self) -> NorFlashErrorKind {
|
||||
match self {
|
||||
Self::OutOfBounds => NorFlashErrorKind::OutOfBounds,
|
||||
Self::Unaligned => NorFlashErrorKind::NotAligned,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Nvmc<'d> {
|
||||
_p: PhantomData<&'d NVMC>,
|
||||
}
|
||||
@ -43,9 +54,11 @@ impl<'d> Nvmc<'d> {
|
||||
|
||||
impl<'d> MultiwriteNorFlash for Nvmc<'d> {}
|
||||
|
||||
impl<'d> ReadNorFlash for Nvmc<'d> {
|
||||
impl<'d> ErrorType for Nvmc<'d> {
|
||||
type Error = Error;
|
||||
}
|
||||
|
||||
impl<'d> ReadNorFlash for Nvmc<'d> {
|
||||
const READ_SIZE: usize = 1;
|
||||
|
||||
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"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
rand = { version = "0.8.4", default-features = false }
|
||||
embedded-storage = "0.2.0"
|
||||
embedded-storage = "0.3.0"
|
||||
|
||||
usb-device = "0.2"
|
||||
usbd-serial = "0.1.1"
|
||||
|
Loading…
Reference in New Issue
Block a user