pub type R = crate::R<OPTRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RDPROT {
Level1 = 0,
Level0 = 170,
Level2 = 204,
}
impl From<RDPROT> for u8 {
#[inline(always)]
fn from(variant: RDPROT) -> Self {
variant as _
}
}
impl crate::FieldSpec for RDPROT {
type Ux = u8;
}
impl crate::IsEnum for RDPROT {}
pub type RDPROT_R = crate::FieldReader<RDPROT>;
impl RDPROT_R {
#[inline(always)]
pub const fn variant(&self) -> Option<RDPROT> {
match self.bits {
0 => Some(RDPROT::Level1),
170 => Some(RDPROT::Level0),
204 => Some(RDPROT::Level2),
_ => None,
}
}
#[inline(always)]
pub fn is_level1(&self) -> bool {
*self == RDPROT::Level1
}
#[inline(always)]
pub fn is_level0(&self) -> bool {
*self == RDPROT::Level0
}
#[inline(always)]
pub fn is_level2(&self) -> bool {
*self == RDPROT::Level2
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum WPRMOD {
Disabled = 0,
Enabled = 1,
}
impl From<WPRMOD> for bool {
#[inline(always)]
fn from(variant: WPRMOD) -> Self {
variant as u8 != 0
}
}
pub type WPRMOD_R = crate::BitReader<WPRMOD>;
impl WPRMOD_R {
#[inline(always)]
pub const fn variant(&self) -> WPRMOD {
match self.bits {
false => WPRMOD::Disabled,
true => WPRMOD::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == WPRMOD::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == WPRMOD::Enabled
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum BOR_LEV {
BorOff = 0,
BorLevel1 = 1,
BorLevel2 = 2,
BorLevel3 = 3,
BorLevel4 = 4,
BorLevel5 = 5,
}
impl From<BOR_LEV> for u8 {
#[inline(always)]
fn from(variant: BOR_LEV) -> Self {
variant as _
}
}
impl crate::FieldSpec for BOR_LEV {
type Ux = u8;
}
impl crate::IsEnum for BOR_LEV {}
pub type BOR_LEV_R = crate::FieldReader<BOR_LEV>;
impl BOR_LEV_R {
#[inline(always)]
pub const fn variant(&self) -> Option<BOR_LEV> {
match self.bits {
0 => Some(BOR_LEV::BorOff),
1 => Some(BOR_LEV::BorLevel1),
2 => Some(BOR_LEV::BorLevel2),
3 => Some(BOR_LEV::BorLevel3),
4 => Some(BOR_LEV::BorLevel4),
5 => Some(BOR_LEV::BorLevel5),
_ => None,
}
}
#[inline(always)]
pub fn is_bor_off(&self) -> bool {
*self == BOR_LEV::BorOff
}
#[inline(always)]
pub fn is_bor_level1(&self) -> bool {
*self == BOR_LEV::BorLevel1
}
#[inline(always)]
pub fn is_bor_level2(&self) -> bool {
*self == BOR_LEV::BorLevel2
}
#[inline(always)]
pub fn is_bor_level3(&self) -> bool {
*self == BOR_LEV::BorLevel3
}
#[inline(always)]
pub fn is_bor_level4(&self) -> bool {
*self == BOR_LEV::BorLevel4
}
#[inline(always)]
pub fn is_bor_level5(&self) -> bool {
*self == BOR_LEV::BorLevel5
}
}
pub type WDG_SW_R = crate::BitReader;
pub type N_RST_STOP_R = crate::BitReader;
pub type N_RST_STDBY_R = crate::BitReader;
pub type BFB2_R = crate::BitReader;
pub type N_BOOT1_R = crate::BitReader;
impl R {
#[inline(always)]
pub fn rdprot(&self) -> RDPROT_R {
RDPROT_R::new((self.bits & 0xff) as u8)
}
#[inline(always)]
pub fn wprmod(&self) -> WPRMOD_R {
WPRMOD_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn bor_lev(&self) -> BOR_LEV_R {
BOR_LEV_R::new(((self.bits >> 16) & 0x0f) as u8)
}
#[inline(always)]
pub fn wdg_sw(&self) -> WDG_SW_R {
WDG_SW_R::new(((self.bits >> 20) & 1) != 0)
}
#[inline(always)]
pub fn n_rst_stop(&self) -> N_RST_STOP_R {
N_RST_STOP_R::new(((self.bits >> 21) & 1) != 0)
}
#[inline(always)]
pub fn n_rst_stdby(&self) -> N_RST_STDBY_R {
N_RST_STDBY_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn bfb2(&self) -> BFB2_R {
BFB2_R::new(((self.bits >> 23) & 1) != 0)
}
#[inline(always)]
pub fn n_boot1(&self) -> N_BOOT1_R {
N_BOOT1_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("OPTR")
.field("rdprot", &self.rdprot())
.field("wprmod", &self.wprmod())
.field("bor_lev", &self.bor_lev())
.field("wdg_sw", &self.wdg_sw())
.field("n_rst_stop", &self.n_rst_stop())
.field("n_rst_stdby", &self.n_rst_stdby())
.field("bfb2", &self.bfb2())
.field("n_boot1", &self.n_boot1())
.finish()
}
}
pub struct OPTRrs;
impl crate::RegisterSpec for OPTRrs {
type Ux = u32;
}
impl crate::Readable for OPTRrs {}
impl crate::Resettable for OPTRrs {
const RESET_VALUE: u32 = 0x00f8_0000;
}