pub trait Flash {
type Error: Debug;
// Required methods
fn read(&mut self, addr: u32, buf: &mut [u8]) -> Result<(), Self::Error>;
fn write(&mut self, addr: u32, data: &mut [u8]) -> Result<(), Self::Error>;
fn erase(&mut self, addr: u32) -> Result<(), Self::Error>;
// Provided method
fn erase_all(&mut self, count: usize) -> Result<(), Self::Error> { ... }
}Expand description
Trait for flash memory operations
Implement this trait for your flash hardware to use with Storage.
The trait is generic over the error type to support different hardware backends.
Required Associated Types§
Required Methods§
Sourcefn read(&mut self, addr: u32, buf: &mut [u8]) -> Result<(), Self::Error>
fn read(&mut self, addr: u32, buf: &mut [u8]) -> Result<(), Self::Error>
Read data from flash memory at the specified byte address
§Arguments
addr- The byte address to read frombuf- The buffer to read data into
Provided Methods§
Implementors§
Source§impl<T: Eeprom24xTrait> Flash for T
Flash trait implementation for AT24Cxx EEPROM chips
impl<T: Eeprom24xTrait> Flash for T
Flash trait implementation for AT24Cxx EEPROM chips