pub struct LockedFlash { /* private fields */ }
Expand description

Read-only flash

Examples

use stm32f4xx_hal::pac::Peripherals;
use stm32f4xx_hal::flash::LockedFlash;
use embedded_storage::nor_flash::ReadNorFlash;

let dp = Peripherals::take().unwrap();
let mut flash = LockedFlash::new(dp.FLASH);
println!("Flash capacity: {}", ReadNorFlash::capacity(&flash));

let mut buf = [0u8; 64];
ReadNorFlash::read(&mut flash, 0x0, &mut buf).unwrap();
println!("First 64 bytes of flash memory: {:?}", buf);

Implementations

Trait Implementations

Memory-mapped address
Size in bytes
Unlock flash for erasing/programming until this method’s result is dropped Read more
Returns flash memory sector of a given offset. Returns none if offset is out of range.
Returns a read-only view of flash memory
An enumeration of storage errors
The minumum number of bytes the storage peripheral can read
Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading bytes.len() bytes. Read more
The capacity of the peripheral in bytes.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.