Trait embedded_storage::nor_flash::NorFlash
source · pub trait NorFlash: ReadNorFlash {
const WRITE_SIZE: usize;
const ERASE_SIZE: usize;
// Required methods
fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>;
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
}
Expand description
NOR flash trait.
Required Associated Constants§
sourceconst WRITE_SIZE: usize
const WRITE_SIZE: usize
The minumum number of bytes the storage peripheral can write
sourceconst ERASE_SIZE: usize
const ERASE_SIZE: usize
The minumum number of bytes the storage peripheral can erase
Required Methods§
sourcefn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>
fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>
Erase the given storage range, clearing all data within [from..to]
.
The given range will contain all 1s afterwards.
This should return an error if the range is not aligned to a proper
erase resolution
If power is lost during erase, contents of the page are undefined.
from
and to
must both be multiples of ERASE_SIZE
and from
<= to
.
sourcefn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>
If power is lost during write, the contents of the written words are undefined,
but the rest of the page is guaranteed to be unchanged.
It is not allowed to write to the same word twice.
offset
and bytes.len()
must both be multiples of WRITE_SIZE
.
Object Safety§
This trait is not object safe.