Struct Flash

Source
pub struct Flash { /* private fields */ }
Expand description

Embedded flash memory.

Implementations§

Source§

impl Flash

Source

pub fn new(flash: FLASH) -> Self

Creates a new Flash instance.

Source

pub fn unlock(&mut self)

Unlocks the flash memory.

Source

pub fn lock(&mut self)

Locks the flash memory.

Source

pub fn erase_sector( &mut self, sector_number: u8, ) -> Result<EraseSequence<'_>, Error>

Starts a sector erase sequence.

The returned EraseSequence object can be used to wait for the completion of the erase sequence by blocking on the wait method.

Source

pub fn blocking_erase_sector(&mut self, sector_number: u8) -> Result<(), Error>

Erases a flash sector.

This method blocks until the sector is erased or an error occurred.

Source

pub fn mass_erase(&mut self) -> Result<EraseSequence<'_>, Error>

Starts a mass erases of the flash memory.

The returned EraseSequence object can be used to wait for the completion of the erase sequence by blocking on the wait method.

Source

pub fn blocking_mass_erase(&mut self) -> Result<(), Error>

Mass erases the flash memory.

This method blocks until the flash is erased or an error occurred.

Source

pub fn program<'a, 'b>( &'a mut self, start_offset: usize, data: &'b [u8], ) -> Result<ProgrammingSequence<'a, 'b>, Error>

Starts a programming sequence.

Note that you must block on the wait method in the returned ProgrammingSequence object in order to program all bytes.

Source

pub fn blocking_program( &mut self, start_offset: usize, data: &[u8], ) -> Result<(), Error>

Programs a block of flash memory.

This method blocks until the block is programed or an error occurred.

Source

pub fn free(self) -> FLASH

Releases the flash peripheral.

Auto Trait Implementations§

§

impl Freeze for Flash

§

impl RefUnwindSafe for Flash

§

impl Send for Flash

§

impl !Sync for Flash

§

impl Unpin for Flash

§

impl UnwindSafe for Flash

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.