Trait embedded_storage_async::nor_flash::NorFlash
source · pub trait NorFlash: ReadNorFlash {
const WRITE_SIZE: usize;
const ERASE_SIZE: usize;
// Required methods
async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>;
async 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§
sourceasync fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>
async 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.
If power is lost during erase, contents of the page are undefined.
§Errors
Returns an error if the arguments are not aligned or out of bounds (the case where to > from
is considered out of bounds). The implementation can use the [check_erase
]
helper function.
sourceasync fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>
async 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.
§Errors
Returns an error if the arguments are not aligned or out of bounds. The implementation
can use the [check_write
] helper function.