pub type R = crate::R<OPTRrs>;
pub type W = crate::W<OPTRrs>;
pub type RDP_R = crate::FieldReader;
pub type RDP_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
pub type BOR_LEV_R = crate::FieldReader;
pub type BOR_LEV_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
pub type N_RST_STOP_R = crate::BitReader;
pub type N_RST_STOP_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type N_RST_STDBY_R = crate::BitReader;
pub type N_RST_STDBY_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type N_RST_SHDW_R = crate::BitReader;
pub type N_RST_SHDW_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type IWDG_SW_R = crate::BitReader;
pub type IWDG_SW_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type IWDG_STOP_R = crate::BitReader;
pub type IWDG_STOP_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type IWDG_STDBY_R = crate::BitReader;
pub type IWDG_STDBY_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type WWDG_SW_R = crate::BitReader;
pub type WWDG_SW_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BFB2 {
Disabled = 0,
Enabled = 1,
}
impl From<BFB2> for bool {
#[inline(always)]
fn from(variant: BFB2) -> Self {
variant as u8 != 0
}
}
pub type BFB2_R = crate::BitReader<BFB2>;
impl BFB2_R {
#[inline(always)]
pub const fn variant(&self) -> BFB2 {
match self.bits {
false => BFB2::Disabled,
true => BFB2::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BFB2::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BFB2::Enabled
}
}
pub type BFB2_W<'a, REG> = crate::BitWriter<'a, REG, BFB2>;
impl<'a, REG> BFB2_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BFB2::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BFB2::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DBANK {
SingleBankMode = 0,
DualBankMode = 1,
}
impl From<DBANK> for bool {
#[inline(always)]
fn from(variant: DBANK) -> Self {
variant as u8 != 0
}
}
pub type DBANK_R = crate::BitReader<DBANK>;
impl DBANK_R {
#[inline(always)]
pub const fn variant(&self) -> DBANK {
match self.bits {
false => DBANK::SingleBankMode,
true => DBANK::DualBankMode,
}
}
#[inline(always)]
pub fn is_single_bank_mode(&self) -> bool {
*self == DBANK::SingleBankMode
}
#[inline(always)]
pub fn is_dual_bank_mode(&self) -> bool {
*self == DBANK::DualBankMode
}
}
pub type DBANK_W<'a, REG> = crate::BitWriter<'a, REG, DBANK>;
impl<'a, REG> DBANK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn single_bank_mode(self) -> &'a mut crate::W<REG> {
self.variant(DBANK::SingleBankMode)
}
#[inline(always)]
pub fn dual_bank_mode(self) -> &'a mut crate::W<REG> {
self.variant(DBANK::DualBankMode)
}
}
pub type N_BOOT1_R = crate::BitReader;
pub type N_BOOT1_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type SRAM2_PE_R = crate::BitReader;
pub type SRAM2_PE_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type CCMSRAM_RST_R = crate::BitReader;
pub type CCMSRAM_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type N_SWBOOT0_R = crate::BitReader;
pub type N_SWBOOT0_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type N_BOOT0_R = crate::BitReader;
pub type N_BOOT0_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type NRST_MODE_R = crate::FieldReader;
pub type NRST_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
pub type IRHEN_R = crate::BitReader;
pub type IRHEN_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn rdp(&self) -> RDP_R {
RDP_R::new((self.bits & 0xff) as u8)
}
#[inline(always)]
pub fn bor_lev(&self) -> BOR_LEV_R {
BOR_LEV_R::new(((self.bits >> 8) & 7) as u8)
}
#[inline(always)]
pub fn n_rst_stop(&self) -> N_RST_STOP_R {
N_RST_STOP_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn n_rst_stdby(&self) -> N_RST_STDBY_R {
N_RST_STDBY_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn n_rst_shdw(&self) -> N_RST_SHDW_R {
N_RST_SHDW_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn iwdg_sw(&self) -> IWDG_SW_R {
IWDG_SW_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn iwdg_stop(&self) -> IWDG_STOP_R {
IWDG_STOP_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn iwdg_stdby(&self) -> IWDG_STDBY_R {
IWDG_STDBY_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn wwdg_sw(&self) -> WWDG_SW_R {
WWDG_SW_R::new(((self.bits >> 19) & 1) != 0)
}
#[inline(always)]
pub fn bfb2(&self) -> BFB2_R {
BFB2_R::new(((self.bits >> 20) & 1) != 0)
}
#[inline(always)]
pub fn dbank(&self) -> DBANK_R {
DBANK_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn n_boot1(&self) -> N_BOOT1_R {
N_BOOT1_R::new(((self.bits >> 23) & 1) != 0)
}
#[inline(always)]
pub fn sram2_pe(&self) -> SRAM2_PE_R {
SRAM2_PE_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn ccmsram_rst(&self) -> CCMSRAM_RST_R {
CCMSRAM_RST_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn n_swboot0(&self) -> N_SWBOOT0_R {
N_SWBOOT0_R::new(((self.bits >> 26) & 1) != 0)
}
#[inline(always)]
pub fn n_boot0(&self) -> N_BOOT0_R {
N_BOOT0_R::new(((self.bits >> 27) & 1) != 0)
}
#[inline(always)]
pub fn nrst_mode(&self) -> NRST_MODE_R {
NRST_MODE_R::new(((self.bits >> 28) & 3) as u8)
}
#[inline(always)]
pub fn irhen(&self) -> IRHEN_R {
IRHEN_R::new(((self.bits >> 30) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("OPTR")
.field("rdp", &self.rdp())
.field("bor_lev", &self.bor_lev())
.field("n_rst_stop", &self.n_rst_stop())
.field("n_rst_stdby", &self.n_rst_stdby())
.field("n_rst_shdw", &self.n_rst_shdw())
.field("iwdg_sw", &self.iwdg_sw())
.field("iwdg_stop", &self.iwdg_stop())
.field("iwdg_stdby", &self.iwdg_stdby())
.field("wwdg_sw", &self.wwdg_sw())
.field("bfb2", &self.bfb2())
.field("dbank", &self.dbank())
.field("n_boot1", &self.n_boot1())
.field("sram2_pe", &self.sram2_pe())
.field("ccmsram_rst", &self.ccmsram_rst())
.field("n_swboot0", &self.n_swboot0())
.field("n_boot0", &self.n_boot0())
.field("nrst_mode", &self.nrst_mode())
.field("irhen", &self.irhen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn rdp(&mut self) -> RDP_W<OPTRrs> {
RDP_W::new(self, 0)
}
#[inline(always)]
pub fn bor_lev(&mut self) -> BOR_LEV_W<OPTRrs> {
BOR_LEV_W::new(self, 8)
}
#[inline(always)]
pub fn n_rst_stop(&mut self) -> N_RST_STOP_W<OPTRrs> {
N_RST_STOP_W::new(self, 12)
}
#[inline(always)]
pub fn n_rst_stdby(&mut self) -> N_RST_STDBY_W<OPTRrs> {
N_RST_STDBY_W::new(self, 13)
}
#[inline(always)]
pub fn n_rst_shdw(&mut self) -> N_RST_SHDW_W<OPTRrs> {
N_RST_SHDW_W::new(self, 14)
}
#[inline(always)]
pub fn iwdg_sw(&mut self) -> IWDG_SW_W<OPTRrs> {
IWDG_SW_W::new(self, 16)
}
#[inline(always)]
pub fn iwdg_stop(&mut self) -> IWDG_STOP_W<OPTRrs> {
IWDG_STOP_W::new(self, 17)
}
#[inline(always)]
pub fn iwdg_stdby(&mut self) -> IWDG_STDBY_W<OPTRrs> {
IWDG_STDBY_W::new(self, 18)
}
#[inline(always)]
pub fn wwdg_sw(&mut self) -> WWDG_SW_W<OPTRrs> {
WWDG_SW_W::new(self, 19)
}
#[inline(always)]
pub fn bfb2(&mut self) -> BFB2_W<OPTRrs> {
BFB2_W::new(self, 20)
}
#[inline(always)]
pub fn dbank(&mut self) -> DBANK_W<OPTRrs> {
DBANK_W::new(self, 22)
}
#[inline(always)]
pub fn n_boot1(&mut self) -> N_BOOT1_W<OPTRrs> {
N_BOOT1_W::new(self, 23)
}
#[inline(always)]
pub fn sram2_pe(&mut self) -> SRAM2_PE_W<OPTRrs> {
SRAM2_PE_W::new(self, 24)
}
#[inline(always)]
pub fn ccmsram_rst(&mut self) -> CCMSRAM_RST_W<OPTRrs> {
CCMSRAM_RST_W::new(self, 25)
}
#[inline(always)]
pub fn n_swboot0(&mut self) -> N_SWBOOT0_W<OPTRrs> {
N_SWBOOT0_W::new(self, 26)
}
#[inline(always)]
pub fn n_boot0(&mut self) -> N_BOOT0_W<OPTRrs> {
N_BOOT0_W::new(self, 27)
}
#[inline(always)]
pub fn nrst_mode(&mut self) -> NRST_MODE_W<OPTRrs> {
NRST_MODE_W::new(self, 28)
}
#[inline(always)]
pub fn irhen(&mut self) -> IRHEN_W<OPTRrs> {
IRHEN_W::new(self, 30)
}
}
pub struct OPTRrs;
impl crate::RegisterSpec for OPTRrs {
type Ux = u32;
}
impl crate::Readable for OPTRrs {}
impl crate::Writable for OPTRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for OPTRrs {
const RESET_VALUE: u32 = 0xf000_0000;
}