Skip to main content

Fmc

Struct Fmc 

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

Owns the flash memory controller.

Implementations§

Source§

impl Fmc

Source

pub fn with_unlocked<R>( &mut self, f: impl FnOnce(&mut UnlockedFmc<'_>) -> R, ) -> R

Unlocks CTL, runs f, locks it again, and returns what f returned.

The unlocked handle cannot outlive the call, so the flash is never left writable.

Source

pub fn release(self) -> Fmc

Returns the peripheral with its interrupts off.

Source

pub fn is_protected(&self, page: Page) -> bool

Whether the option bytes protect page from being erased or programmed.

This is what stands behind Error::WriteProtected. Protection comes in groups of four pages, so neighbours share the answer.

Source

pub fn protection_level(&self) -> ProtectionLevel

The security protection level the option bytes ask for.

Source

pub fn option_error(&self) -> bool

Whether the option bytes failed their checksum, in which case the defaults were loaded instead of them.

Source

pub fn user_option(&self) -> u8

The user option byte, raw; read_option_bytes decodes it.

Source

pub fn data_option(&self) -> u16

The two user data bytes of the option block, raw — the silicon attaches no meaning to them.

Source

pub fn product_id_code(&self) -> u32

The product ID code, fixed in silicon and read-only.

Source

pub fn read_option_bytes(&self) -> OptionBytes

The option bytes as they were loaded at reset.

This is the block to change and hand to UnlockedFmc::write_option_bytes; it reads what is in force, so a block written since the last reset is not what comes back.

Source

pub fn reload_option_bytes(&mut self) -> !

Reloads the option bytes, which resets the part and therefore never returns.

This is how a written block takes effect without cycling the power.

Source

pub fn set_prefetch(&mut self, on: bool)

Turns the prefetch buffer on or off; it comes up on after reset.

Off, every fetch waits out the wait states of its own, which is slower on average but takes the buffer out of the timing.

Source

pub fn is_prefetch_enabled(&self) -> bool

Whether the prefetch buffer is on.

Source

pub fn take_error(&mut self) -> Option<Error>

Returns the error the last operation ended with, clearing its flag.

Source

pub fn is_listening(&self, event: Event) -> bool

Whether event currently raises an interrupt.

Source

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

Clears the flag behind event, which is what stops it re-entering the handler.

For Event::Error this drops every error flag at once; use take_error instead to learn which one it was, it clears the flag as well.

Auto Trait Implementations§

§

impl !Sync for Fmc

§

impl Freeze for Fmc

§

impl RefUnwindSafe for Fmc

§

impl Send for Fmc

§

impl Unpin for Fmc

§

impl UnsafeUnpin for Fmc

§

impl UnwindSafe for Fmc

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.