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§

source

const WRITE_SIZE: usize

The minumum number of bytes the storage peripheral can write

source

const ERASE_SIZE: usize

The minumum number of bytes the storage peripheral can erase

Required Methods§

source

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.

source

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: NorFlash> NorFlash for &mut T

source§

const WRITE_SIZE: usize = T::WRITE_SIZE

source§

const ERASE_SIZE: usize = T::ERASE_SIZE

source§

fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>

source§

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

Implementors§