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<'_>
impl UnlockedFmc<'_>
Sourcepub fn erase_page(&mut self, page: Page) -> Result<(), Error>
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.
Sourcepub fn mass_erase(&mut self) -> Result<(), Error>
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.
Sourcepub fn program(&mut self, page: Page, index: u8, word: u32) -> Result<(), Error>
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.
Sourcepub fn write_option_bytes(&mut self, ob: &OptionBytes) -> Result<(), Error>
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.
Sourcepub fn listen(&mut self, event: Event)
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.