stm32f1_staging/stm32f100/wwdg/
cr.rspub type R = crate::R<CRrs>;
pub type W = crate::W<CRrs>;
pub type T_R = crate::FieldReader;
pub type T_W<'a, REG> = crate::FieldWriter<'a, REG, 7, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum WDGA {
Disabled = 0,
Enabled = 1,
}
impl From<WDGA> for bool {
#[inline(always)]
fn from(variant: WDGA) -> Self {
variant as u8 != 0
}
}
pub type WDGA_R = crate::BitReader<WDGA>;
impl WDGA_R {
#[inline(always)]
pub const fn variant(&self) -> WDGA {
match self.bits {
false => WDGA::Disabled,
true => WDGA::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == WDGA::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == WDGA::Enabled
}
}
pub type WDGA_W<'a, REG> = crate::BitWriter<'a, REG, WDGA>;
impl<'a, REG> WDGA_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(WDGA::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(WDGA::Enabled)
}
}
impl R {
#[inline(always)]
pub fn t(&self) -> T_R {
T_R::new((self.bits & 0x7f) as u8)
}
#[inline(always)]
pub fn wdga(&self) -> WDGA_R {
WDGA_R::new(((self.bits >> 7) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("t", &self.t())
.field("wdga", &self.wdga())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn t(&mut self) -> T_W<CRrs> {
T_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn wdga(&mut self) -> WDGA_W<CRrs> {
WDGA_W::new(self, 7)
}
}
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
type Ux = u32;
}
impl crate::Readable for CRrs {}
impl crate::Writable for CRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for CRrs {
const RESET_VALUE: u32 = 0x7f;
}