Skip to main content

OptionBytes

Struct OptionBytes 

Source
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

Source

pub const fn no_protection(self) -> Self

Leaves the flash readable by a debugger.

Source

pub const fn protection_low(self) -> Self

Refuses debugger access. Going back to no_protection later mass-erases the main flash.

Source

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.

Source

pub const fn free_watchdog(self, watchdog: FreeWatchdog) -> Self

Picks which free watchdog the part starts with.

Source

pub const fn deep_sleep(self, entry: LowPowerEntry) -> Self

Says what entering deep-sleep does.

Source

pub const fn standby(self, entry: LowPowerEntry) -> Self

Says what entering standby does.

Source

pub const fn boot1(self, boot1: Boot1) -> Self

Sets the level BOOT1 is taken to have.

Source

pub const fn vdda_monitor(self, monitor: VddaMonitor) -> Self

Turns the VDDA monitor on or off.

Source

pub const fn sram_parity(self, parity: SramParity) -> Self

Turns the SRAM parity check on or off.

Source

pub const fn data(self, data: u16) -> Self

Sets the two user data bytes, which the silicon never reads itself.

Source

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.

Source

pub const fn unprotect(self, page: Page) -> Self

Opens page, and with it the three pages sharing its OB_WP bit.

Source

pub const fn protection(&self) -> ProtectionLevel

The protection level this block asks for.

Source

pub const fn get_free_watchdog(&self) -> FreeWatchdog

Which free watchdog the part starts with.

Source

pub const fn get_deep_sleep(&self) -> LowPowerEntry

What entering deep-sleep does.

Source

pub const fn get_standby(&self) -> LowPowerEntry

What entering standby does.

Source

pub const fn get_boot1(&self) -> Boot1

The level BOOT1 is taken to have.

Source

pub const fn get_vdda_monitor(&self) -> VddaMonitor

Whether the VDDA monitor is on.

Source

pub const fn get_sram_parity(&self) -> SramParity

Whether the SRAM parity check is on.

Source

pub const fn data_bytes(&self) -> u16

The two user data bytes.

Source

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

Source§

fn clone(&self) -> OptionBytes

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for OptionBytes

Source§

impl Default for OptionBytes

Source§

fn default() -> Self

The state the part leaves the factory in: no protection, and every other byte erased.

Source§

impl Eq for OptionBytes

Source§

impl Format for OptionBytes

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for OptionBytes

Source§

fn eq(&self, other: &OptionBytes) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OptionBytes

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.