pub struct Fmc { /* private fields */ }Expand description
Owns the flash memory controller.
Implementations§
Source§impl Fmc
impl Fmc
Sourcepub fn with_unlocked<R>(
&mut self,
f: impl FnOnce(&mut UnlockedFmc<'_>) -> R,
) -> R
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.
Sourcepub fn is_protected(&self, page: Page) -> bool
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.
Sourcepub fn protection_level(&self) -> ProtectionLevel
pub fn protection_level(&self) -> ProtectionLevel
The security protection level the option bytes ask for.
Sourcepub fn option_error(&self) -> bool
pub fn option_error(&self) -> bool
Whether the option bytes failed their checksum, in which case the defaults were loaded instead of them.
Sourcepub fn user_option(&self) -> u8
pub fn user_option(&self) -> u8
The user option byte, raw;
read_option_bytes decodes it.
Sourcepub fn data_option(&self) -> u16
pub fn data_option(&self) -> u16
The two user data bytes of the option block, raw — the silicon attaches no meaning to them.
Sourcepub fn product_id_code(&self) -> u32
pub fn product_id_code(&self) -> u32
The product ID code, fixed in silicon and read-only.
Sourcepub fn read_option_bytes(&self) -> OptionBytes
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.
Sourcepub fn reload_option_bytes(&mut self) -> !
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.
Sourcepub fn set_prefetch(&mut self, on: bool)
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.
Sourcepub fn is_prefetch_enabled(&self) -> bool
pub fn is_prefetch_enabled(&self) -> bool
Whether the prefetch buffer is on.
Sourcepub fn take_error(&mut self) -> Option<Error>
pub fn take_error(&mut self) -> Option<Error>
Returns the error the last operation ended with, clearing its flag.
Sourcepub fn is_listening(&self, event: Event) -> bool
pub fn is_listening(&self, event: Event) -> bool
Whether event currently raises an interrupt.
Sourcepub fn clear_interrupt(&mut self, event: Event)
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.