Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- complete and rework Dma Stream API [#666]
- SPI bidi takes 2 pins [#526]
- `Fast Read Quad I/O (EBh)` in `qspi-w25q` example now matches W25QXX datasheet. [#682]
- `embedded-storage` version bumped to 0.3

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fugit-timer = "0.1.3"
rtic-monotonic = { version = "1.0", optional = true }
systick-monotonic = { version = "1.0", optional = true }
bitflags = "2.2"
embedded-storage = "0.2"
embedded-storage = "0.3"
vcell = "0.1.3"

[dependencies.time]
Expand Down
23 changes: 19 additions & 4 deletions src/flash.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use embedded_storage::nor_flash::{MultiwriteNorFlash, NorFlash, ReadNorFlash};
use embedded_storage::nor_flash::{
ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash,
};

use crate::pac::FLASH;
use crate::signature::FlashSize;
Expand Down Expand Up @@ -357,9 +359,24 @@ pub fn flash_sectors(flash_size: usize, dual_bank: bool) -> impl Iterator<Item =
}
}

impl ReadNorFlash for LockedFlash {
impl NorFlashError for Error {
fn kind(&self) -> NorFlashErrorKind {
match self {
Error::ProgrammingAlignment => NorFlashErrorKind::NotAligned,
_ => NorFlashErrorKind::Other,
}
}
}

impl ErrorType for LockedFlash {
type Error = Error;
}

impl ErrorType for UnlockedFlash<'_> {
type Error = Error;
}

impl ReadNorFlash for LockedFlash {
const READ_SIZE: usize = 1;

fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
Expand All @@ -374,8 +391,6 @@ impl ReadNorFlash for LockedFlash {
}

impl<'a> ReadNorFlash for UnlockedFlash<'a> {
type Error = Error;

const READ_SIZE: usize = 1;

fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
Expand Down