Skip to main content

UnlockedFmc

Struct UnlockedFmc 

Source
pub struct UnlockedFmc<'a> { /* private fields */ }
Expand description

The flash controller with CTL unlocked, borrowed for the body of Fmc::with_unlocked and locked again when that call returns.

Implementations§

Source§

impl UnlockedFmc<'_>

Source

pub fn erase_page(&mut self, page: Page) -> Result<(), Error>

Erases one page, blocking until it is done.

The whole page reads back as 0xFF; nothing here checks what the page holds.

§Errors

Error::WriteProtected if page is write-protected.

Source

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

Erases the whole main flash, blocking until it is done.

That includes the code running the call, so this only makes sense from SRAM or from a debugger.

§Errors

Error::WriteProtected if any page is write-protected.

Source

pub fn program(&mut self, page: Page, index: u8, word: u32) -> Result<(), Error>

Programs one 32-bit word, index counting words from the start of page, and blocks until it is done.

Programming only clears bits, so the word has to be erased first.

§Errors

Error::WriteProtected if page is write-protected, Error::Program if the word holds anything but 0xFFFF_FFFF.

Source

pub fn write_option_bytes(&mut self, ob: &OptionBytes) -> Result<(), Error>

Erases the option byte block and programs ob in its place, blocking until it is done.

The whole block goes at once because erasing takes it all: read it with Fmc::read_option_bytes, change what you need, write it back.

Nothing here takes effect until the option bytes are loaded again, by Fmc::reload_option_bytes or by the next power-up.

§Errors

The first error the erase or the programming reports. The rest of the call is skipped, leaving the block erased or partly programmed.

Source

pub fn listen(&mut self, event: Event)

Raises an interrupt on event, which still has to be unmasked in the NVIC.

The interrupt outlives Fmc::with_unlocked: locking CTL again leaves it enabled.

ENDF is a level, and it rises while a blocking operation still holds the controller, so a handler has nothing to clear it with: mask the line in the NVIC inside the handler, then unpend and unmask it once the call has returned.

Source

pub fn unlisten(&mut self, event: Event)

Stops event from raising an interrupt.

Auto Trait Implementations§

§

impl<'a> !Sync for UnlockedFmc<'a>

§

impl<'a> !UnwindSafe for UnlockedFmc<'a>

§

impl<'a> Freeze for UnlockedFmc<'a>

§

impl<'a> RefUnwindSafe for UnlockedFmc<'a>

§

impl<'a> Send for UnlockedFmc<'a>

§

impl<'a> Unpin for UnlockedFmc<'a>

§

impl<'a> UnsafeUnpin for UnlockedFmc<'a>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.