pub trait FlashAlgorithm: Sized + 'static {
    fn new(
        address: u32,
        clock: u32,
        function: Function
    ) -> Result<Self, ErrorCode>; fn erase_all(&mut self) -> Result<(), ErrorCode>; fn erase_sector(&mut self, address: u32) -> Result<(), ErrorCode>; fn program_page(
        &mut self,
        address: u32,
        size: u32,
        data: *const u8
    ) -> Result<(), ErrorCode>; }

Required Methods§

Initialize the flash algorithm.

It can happen that the flash algorithm does not need any specific initialization for the function to be executed or no initialization at all. It is up to the implementor to decide this.

Arguments
  • address - The start address of the flash region to program.
  • clock - The clock speed in Hertz for programming the device.
  • function - The function for which this initialization is for.

Erase entire chip. Will only be called after FlashAlgorithm::new() with Function::Erase.

Erase sector. Will only be called after FlashAlgorithm::new() with Function::Erase.

Arguments
  • address - The start address of the flash sector to erase.

Program bytes. Will only be called after FlashAlgorithm::new() with Function::Program.

Arguments
  • address - The start address of the flash page to program.
  • size - Specifies the size of the data buffer.
  • data - The data to be written to the page.

Implementors§