pub struct Flash<'d, MODE = Async> { /* private fields */ }
Expand description
Internal flash memory driver.
Implementations§
Source§impl<'d> Flash<'d, Blocking>
impl<'d> Flash<'d, Blocking>
Sourcepub fn new_blocking(p: Peri<'d, FLASH>) -> Self
pub fn new_blocking(p: Peri<'d, FLASH>) -> Self
Create a new flash driver, usable in blocking mode.
Source§impl<'d, MODE> Flash<'d, MODE>
impl<'d, MODE> Flash<'d, MODE>
Sourcepub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking>
pub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking>
Split this flash driver into one instance per flash memory region.
See module-level documentation for details on how memory regions work.
Sourcepub fn blocking_read(
&mut self,
offset: u32,
bytes: &mut [u8],
) -> Result<(), Error>
pub fn blocking_read( &mut self, offset: u32, bytes: &mut [u8], ) -> Result<(), Error>
Blocking read.
NOTE: offset
is an offset from the flash start, NOT an absolute address.
For example, to read address 0x0800_1234
you have to use offset 0x1234
.
Source§impl<'d> Flash<'d, Blocking>
impl<'d> Flash<'d, Blocking>
Sourcepub fn eeprom_write_u8(&mut self, offset: u32, value: u8) -> Result<(), Error>
pub fn eeprom_write_u8(&mut self, offset: u32, value: u8) -> Result<(), Error>
Writes a single byte to EEPROM at the given offset.
Sourcepub fn eeprom_write_u16(&mut self, offset: u32, value: u16) -> Result<(), Error>
pub fn eeprom_write_u16(&mut self, offset: u32, value: u16) -> Result<(), Error>
Writes a single 16-bit value to EEPROM at the given offset.
Returns an error if the offset is not 2-byte aligned.
Sourcepub fn eeprom_write_u32(&mut self, offset: u32, value: u32) -> Result<(), Error>
pub fn eeprom_write_u32(&mut self, offset: u32, value: u32) -> Result<(), Error>
Writes a single 32-bit value to EEPROM at the given offset.
Returns an error if the offset is not 4-byte aligned.
Sourcepub fn eeprom_write_u8_slice(
&mut self,
offset: u32,
data: &[u8],
) -> Result<(), Error>
pub fn eeprom_write_u8_slice( &mut self, offset: u32, data: &[u8], ) -> Result<(), Error>
Writes a slice of bytes to EEPROM at the given offset.
Sourcepub fn eeprom_write_u16_slice(
&mut self,
offset: u32,
data: &[u16],
) -> Result<(), Error>
pub fn eeprom_write_u16_slice( &mut self, offset: u32, data: &[u16], ) -> Result<(), Error>
Writes a slice of 16-bit values to EEPROM at the given offset.
Returns an error if the offset is not 2-byte aligned.
Sourcepub fn eeprom_write_u32_slice(
&mut self,
offset: u32,
data: &[u32],
) -> Result<(), Error>
pub fn eeprom_write_u32_slice( &mut self, offset: u32, data: &[u32], ) -> Result<(), Error>
Writes a slice of 32-bit values to EEPROM at the given offset.
Returns an error if the offset is not 4-byte aligned.
Sourcepub fn eeprom_write_slice(
&mut self,
offset: u32,
data: &[u8],
) -> Result<(), Error>
pub fn eeprom_write_slice( &mut self, offset: u32, data: &[u8], ) -> Result<(), Error>
Writes a byte slice to EEPROM at the given offset, handling alignment.
This method will write unaligned prefix and suffix as bytes, and aligned middle as u32.
Sourcepub fn eeprom_read_u8(&self, offset: u32) -> Result<u8, Error>
pub fn eeprom_read_u8(&self, offset: u32) -> Result<u8, Error>
Reads a single byte from EEPROM at the given offset.
Sourcepub fn eeprom_read_u16(&self, offset: u32) -> Result<u16, Error>
pub fn eeprom_read_u16(&self, offset: u32) -> Result<u16, Error>
Reads a single 16-bit value from EEPROM at the given offset.
Returns an error if the offset is not 2-byte aligned.