Trait Flash

Source
pub trait Flash {
    type Page: AsMut<[u8]> + Default;

    // Required methods
    fn read_page(
        &self,
        page_number: usize,
        buf: &'static mut Self::Page,
    ) -> Result<(), (ErrorCode, &'static mut Self::Page)>;
    fn write_page(
        &self,
        page_number: usize,
        buf: &'static mut Self::Page,
    ) -> Result<(), (ErrorCode, &'static mut Self::Page)>;
    fn erase_page(&self, page_number: usize) -> Result<(), ErrorCode>;
}
Expand description

A page of writable persistent flash memory.

Required Associated Types§

Source

type Page: AsMut<[u8]> + Default

Type of a single flash page for the given implementation.

Required Methods§

Source

fn read_page( &self, page_number: usize, buf: &'static mut Self::Page, ) -> Result<(), (ErrorCode, &'static mut Self::Page)>

Read a page of flash into the buffer.

Source

fn write_page( &self, page_number: usize, buf: &'static mut Self::Page, ) -> Result<(), (ErrorCode, &'static mut Self::Page)>

Write a page of flash from the buffer.

Source

fn erase_page(&self, page_number: usize) -> Result<(), ErrorCode>

Erase a page of flash by setting every byte to 0xFF.

Implementors§

impl Flash for FlashCtrl<'_>

impl<F: Flash> Flash for FlashUser<'_, F>

impl Flash for AT24C<'_>

impl<'a, S: SpiMasterDevice<'a> + 'a, P: Pin + 'a, A: Alarm<'a> + 'a> Flash for MX25R6435F<'a, S, P, A>

impl Flash for FlashCtrl<'_>

impl Flash for Nvmc

impl Flash for FLASHCALW

impl Flash for Flash