stm32f1_staging/stm32f107/wwdg/
cfr.rspub type R = crate::R<CFRrs>;
pub type W = crate::W<CFRrs>;
pub type W_R = crate::FieldReader;
pub type W_W<'a, REG> = crate::FieldWriter<'a, REG, 7, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum WDGTB {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
}
impl From<WDGTB> for u8 {
#[inline(always)]
fn from(variant: WDGTB) -> Self {
variant as _
}
}
impl crate::FieldSpec for WDGTB {
type Ux = u8;
}
impl crate::IsEnum for WDGTB {}
pub type WDGTB_R = crate::FieldReader<WDGTB>;
impl WDGTB_R {
#[inline(always)]
pub const fn variant(&self) -> WDGTB {
match self.bits {
0 => WDGTB::Div1,
1 => WDGTB::Div2,
2 => WDGTB::Div4,
3 => WDGTB::Div8,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == WDGTB::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == WDGTB::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == WDGTB::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == WDGTB::Div8
}
}
pub type WDGTB_W<'a, REG> = crate::FieldWriter<'a, REG, 2, WDGTB, crate::Safe>;
impl<'a, REG> WDGTB_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(WDGTB::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(WDGTB::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(WDGTB::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(WDGTB::Div8)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EWIW {
Enable = 1,
}
impl From<EWIW> for bool {
#[inline(always)]
fn from(variant: EWIW) -> Self {
variant as u8 != 0
}
}
pub type EWI_R = crate::BitReader<EWIW>;
impl EWI_R {
#[inline(always)]
pub const fn variant(&self) -> Option<EWIW> {
match self.bits {
true => Some(EWIW::Enable),
_ => None,
}
}
#[inline(always)]
pub fn is_enable(&self) -> bool {
*self == EWIW::Enable
}
}
pub type EWI_W<'a, REG> = crate::BitWriter<'a, REG, EWIW>;
impl<'a, REG> EWI_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn enable(self) -> &'a mut crate::W<REG> {
self.variant(EWIW::Enable)
}
}
impl R {
#[inline(always)]
pub fn w(&self) -> W_R {
W_R::new((self.bits & 0x7f) as u8)
}
#[inline(always)]
pub fn wdgtb(&self) -> WDGTB_R {
WDGTB_R::new(((self.bits >> 7) & 3) as u8)
}
#[inline(always)]
pub fn ewi(&self) -> EWI_R {
EWI_R::new(((self.bits >> 9) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFR")
.field("w", &self.w())
.field("ewi", &self.ewi())
.field("wdgtb", &self.wdgtb())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn w(&mut self) -> W_W<CFRrs> {
W_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn wdgtb(&mut self) -> WDGTB_W<CFRrs> {
WDGTB_W::new(self, 7)
}
#[inline(always)]
#[must_use]
pub fn ewi(&mut self) -> EWI_W<CFRrs> {
EWI_W::new(self, 9)
}
}
pub struct CFRrs;
impl crate::RegisterSpec for CFRrs {
type Ux = u32;
}
impl crate::Readable for CFRrs {}
impl crate::Writable for CFRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for CFRrs {
const RESET_VALUE: u32 = 0x7f;
}