pub struct OptionBytes { /* private fields */ }Expand description
The option byte block as a whole, read with Fmc::read_option_bytes and
written back with UnlockedFmc::write_option_bytes.
Writing goes through the whole block because erasing does: option bytes lose every byte at once, so a single field cannot be changed on its own. Read the block, change what you need, write it back.
Implementations§
Source§impl OptionBytes
impl OptionBytes
Sourcepub const fn no_protection(self) -> Self
pub const fn no_protection(self) -> Self
Leaves the flash readable by a debugger.
Sourcepub const fn protection_low(self) -> Self
pub const fn protection_low(self) -> Self
Refuses debugger access. Going back to
no_protection later mass-erases the main flash.
Sourcepub const fn protection_high_forever(self) -> Self
pub const fn protection_high_forever(self) -> Self
Refuses debugger access for good: after this the option bytes themselves can no longer be erased or reprogrammed, so no later call can undo it and the part keeps this setting for the rest of its life.
Sourcepub const fn free_watchdog(self, watchdog: FreeWatchdog) -> Self
pub const fn free_watchdog(self, watchdog: FreeWatchdog) -> Self
Picks which free watchdog the part starts with.
Sourcepub const fn deep_sleep(self, entry: LowPowerEntry) -> Self
pub const fn deep_sleep(self, entry: LowPowerEntry) -> Self
Says what entering deep-sleep does.
Sourcepub const fn standby(self, entry: LowPowerEntry) -> Self
pub const fn standby(self, entry: LowPowerEntry) -> Self
Says what entering standby does.
Sourcepub const fn vdda_monitor(self, monitor: VddaMonitor) -> Self
pub const fn vdda_monitor(self, monitor: VddaMonitor) -> Self
Turns the VDDA monitor on or off.
Sourcepub const fn sram_parity(self, parity: SramParity) -> Self
pub const fn sram_parity(self, parity: SramParity) -> Self
Turns the SRAM parity check on or off.
Sourcepub const fn data(self, data: u16) -> Self
pub const fn data(self, data: u16) -> Self
Sets the two user data bytes, which the silicon never reads itself.
Sourcepub const fn protect(self, page: Page) -> Self
pub const fn protect(self, page: Page) -> Self
Closes page to erasing and programming.
One OB_WP bit covers four pages, so this closes the three neighbours of
page along with it.
Sourcepub const fn unprotect(self, page: Page) -> Self
pub const fn unprotect(self, page: Page) -> Self
Opens page, and with it the three pages sharing its OB_WP bit.
Sourcepub const fn protection(&self) -> ProtectionLevel
pub const fn protection(&self) -> ProtectionLevel
The protection level this block asks for.
Sourcepub const fn get_free_watchdog(&self) -> FreeWatchdog
pub const fn get_free_watchdog(&self) -> FreeWatchdog
Which free watchdog the part starts with.
Sourcepub const fn get_deep_sleep(&self) -> LowPowerEntry
pub const fn get_deep_sleep(&self) -> LowPowerEntry
What entering deep-sleep does.
Sourcepub const fn get_standby(&self) -> LowPowerEntry
pub const fn get_standby(&self) -> LowPowerEntry
What entering standby does.
Sourcepub const fn get_vdda_monitor(&self) -> VddaMonitor
pub const fn get_vdda_monitor(&self) -> VddaMonitor
Whether the VDDA monitor is on.
Sourcepub const fn get_sram_parity(&self) -> SramParity
pub const fn get_sram_parity(&self) -> SramParity
Whether the SRAM parity check is on.
Sourcepub const fn data_bytes(&self) -> u16
pub const fn data_bytes(&self) -> u16
The two user data bytes.
Sourcepub const fn is_protected(&self, page: Page) -> bool
pub const fn is_protected(&self, page: Page) -> bool
Whether this block closes page to erasing and programming.
Trait Implementations§
Source§impl Clone for OptionBytes
impl Clone for OptionBytes
Source§fn clone(&self) -> OptionBytes
fn clone(&self) -> OptionBytes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more