Struct stm32_metapac::flash::regs::Cr
#[repr(transparent)]pub struct Cr(pub u32);
Expand description
FLASH control register.
Tuple Fields§
§0: u32
Implementations§
§impl Cr
impl Cr
pub const fn lock(&self) -> bool
pub const fn lock(&self) -> bool
Configuration lock bit When this bit is set write to all other bits in this register, and to FLASH_IER register, are ignored. Clearing this bit requires the correct write sequence to FLASH_KEYR register (see this register for details). If a wrong sequence is executed, or if the unlock sequence is performed twice, this bit remains locked until the next system reset. During the write access to set LOCK bit from 0 to 1, it is possible to change the other bits of this register.
pub fn set_lock(&mut self, val: bool)
pub fn set_lock(&mut self, val: bool)
Configuration lock bit When this bit is set write to all other bits in this register, and to FLASH_IER register, are ignored. Clearing this bit requires the correct write sequence to FLASH_KEYR register (see this register for details). If a wrong sequence is executed, or if the unlock sequence is performed twice, this bit remains locked until the next system reset. During the write access to set LOCK bit from 0 to 1, it is possible to change the other bits of this register.
pub const fn pg(&self) -> bool
pub const fn pg(&self) -> bool
Internal buffer control bit Setting this bit enables internal buffer for write operations. This allows preparing program operations even if a sector or bank erase is ongoing. When PG is cleared, the internal buffer is disabled for write operations, and all the data stored in the buffer but not sent to the operation queue are lost.
pub fn set_pg(&mut self, val: bool)
pub fn set_pg(&mut self, val: bool)
Internal buffer control bit Setting this bit enables internal buffer for write operations. This allows preparing program operations even if a sector or bank erase is ongoing. When PG is cleared, the internal buffer is disabled for write operations, and all the data stored in the buffer but not sent to the operation queue are lost.
pub const fn ser(&self) -> bool
pub const fn ser(&self) -> bool
Sector erase request Setting this bit requests a sector erase. Write protection error is triggered when a sector erase is required on at least one protected sector. BER has a higher priority than SER: if both bits are set, the embedded Flash memory executes a bank erase.
pub fn set_ser(&mut self, val: bool)
pub fn set_ser(&mut self, val: bool)
Sector erase request Setting this bit requests a sector erase. Write protection error is triggered when a sector erase is required on at least one protected sector. BER has a higher priority than SER: if both bits are set, the embedded Flash memory executes a bank erase.
pub const fn ber(&self) -> bool
pub const fn ber(&self) -> bool
Bank erase request Setting this bit requests a bank erase operation (user Flash memory only). Write protection error is triggered when a bank erase is required and some sectors are protected. BER has a higher priority than SER: if both are set, the embedded Flash memory executes a bank erase.
pub fn set_ber(&mut self, val: bool)
pub fn set_ber(&mut self, val: bool)
Bank erase request Setting this bit requests a bank erase operation (user Flash memory only). Write protection error is triggered when a bank erase is required and some sectors are protected. BER has a higher priority than SER: if both are set, the embedded Flash memory executes a bank erase.
pub const fn fw(&self) -> bool
pub const fn fw(&self) -> bool
Force write This bit forces a write operation even if the write buffer is not full. In this case all bits not written are set by hardware. The embedded Flash memory resets FW when the corresponding operation has been acknowledged. Note: Using a force-write operation prevents the application from updating later the missing bits with something else than 1, because it is likely that it will lead to permanent ECC error. Write forcing is effective only if the write buffer is not empty (in particular, FW does not start several write operations when the force-write operations are performed consecutively).
pub fn set_fw(&mut self, val: bool)
pub fn set_fw(&mut self, val: bool)
Force write This bit forces a write operation even if the write buffer is not full. In this case all bits not written are set by hardware. The embedded Flash memory resets FW when the corresponding operation has been acknowledged. Note: Using a force-write operation prevents the application from updating later the missing bits with something else than 1, because it is likely that it will lead to permanent ECC error. Write forcing is effective only if the write buffer is not empty (in particular, FW does not start several write operations when the force-write operations are performed consecutively).
pub const fn start(&self) -> bool
pub const fn start(&self) -> bool
Erase start control bit This bit is used to start a sector erase or a bank erase operation. The embedded Flash memory resets START when the corresponding operation has been acknowledged. The user application cannot access any embedded Flash memory register until the operation is acknowledged.
pub fn set_start(&mut self, val: bool)
pub fn set_start(&mut self, val: bool)
Erase start control bit This bit is used to start a sector erase or a bank erase operation. The embedded Flash memory resets START when the corresponding operation has been acknowledged. The user application cannot access any embedded Flash memory register until the operation is acknowledged.
pub const fn ssn(&self) -> u8
pub const fn ssn(&self) -> u8
Sector erase selection number These bits are used to select the target sector for an erase operation (they are unused otherwise). …
pub fn set_ssn(&mut self, val: u8)
pub fn set_ssn(&mut self, val: u8)
Sector erase selection number These bits are used to select the target sector for an erase operation (they are unused otherwise). …
pub const fn pg_otp(&self) -> bool
pub const fn pg_otp(&self) -> bool
Program Enable for OTP Area Set this bit to enable write operations to OTP area.
pub fn set_pg_otp(&mut self, val: bool)
pub fn set_pg_otp(&mut self, val: bool)
Program Enable for OTP Area Set this bit to enable write operations to OTP area.
pub const fn crc_en(&self) -> bool
pub const fn crc_en(&self) -> bool
CRC enable Setting this bit enables the CRC calculation. CRC_EN does not start CRC calculation but enables CRC configuration through FLASH_CRCCR register. When CRC calculation is performed it can be disabled by clearing CRC_EN bit. Doing so sets CRCDATA to 0x0, clears CRC configuration and resets the content of FLASH_CRCDATAR register.
pub fn set_crc_en(&mut self, val: bool)
pub fn set_crc_en(&mut self, val: bool)
CRC enable Setting this bit enables the CRC calculation. CRC_EN does not start CRC calculation but enables CRC configuration through FLASH_CRCCR register. When CRC calculation is performed it can be disabled by clearing CRC_EN bit. Doing so sets CRCDATA to 0x0, clears CRC configuration and resets the content of FLASH_CRCDATAR register.
pub const fn all_banks(&self) -> bool
pub const fn all_banks(&self) -> bool
All banks select bit When this bit is set the erase is done on all Flash Memory sectors. ALL_BANKS is used only if a bank erase is required (BER=1). In all others operations, this control bit is ignored.
pub fn set_all_banks(&mut self, val: bool)
pub fn set_all_banks(&mut self, val: bool)
All banks select bit When this bit is set the erase is done on all Flash Memory sectors. ALL_BANKS is used only if a bank erase is required (BER=1). In all others operations, this control bit is ignored.
Trait Implementations§
impl Copy for Cr
impl Eq for Cr
impl StructuralPartialEq for Cr
Auto Trait Implementations§
impl Freeze for Cr
impl RefUnwindSafe for Cr
impl Send for Cr
impl Sync for Cr
impl Unpin for Cr
impl UnwindSafe for Cr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)