pub trait BlockDevice<Addr, SPI: Transfer<u8>, CS: OutputPin> {
    fn erase_sectors(
        &mut self,
        addr: Addr,
        amount: usize
    ) -> Result<(), Error<SPI, CS>>; fn erase_all(&mut self) -> Result<(), Error<SPI, CS>>; fn write_bytes(
        &mut self,
        addr: Addr,
        data: &mut [u8]
    ) -> Result<(), Error<SPI, CS>>; }
Expand description

A trait for writing and erasing operations on a memory chip.

Required Methods

Erases sectors from the memory chip.

Parameters
  • addr: The address to start erasing at. If the address is not on a sector boundary, the lower bits can be ignored in order to make it fit.

Erases the memory chip fully.

Warning: Full erase operations can take a significant amount of time. Check your device’s datasheet for precise numbers.

Writes bytes onto the memory chip. This method is supposed to assume that the sectors it is writing to have already been erased and should not do any erasing themselves.

Parameters
  • addr: The address to write to.
  • data: The bytes to write to addr.

Implementors