pub type R = crate::R<AMTCRrs>;
pub type W = crate::W<AMTCRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EN {
Disabled = 0,
Enabled = 1,
}
impl From<EN> for bool {
#[inline(always)]
fn from(variant: EN) -> Self {
variant as u8 != 0
}
}
pub type EN_R = crate::BitReader<EN>;
impl EN_R {
#[inline(always)]
pub const fn variant(&self) -> EN {
match self.bits {
false => EN::Disabled,
true => EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EN::Enabled
}
}
pub type EN_W<'a, REG> = crate::BitWriter<'a, REG, EN>;
impl<'a, REG> EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(EN::Enabled)
}
}
pub type DT_R = crate::FieldReader;
pub type DT_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
impl R {
#[inline(always)]
pub fn en(&self) -> EN_R {
EN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn dt(&self) -> DT_R {
DT_R::new(((self.bits >> 8) & 0xff) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AMTCR")
.field("dt", &self.dt())
.field("en", &self.en())
.finish()
}
}
impl W {
#[inline(always)]
pub fn en(&mut self) -> EN_W<AMTCRrs> {
EN_W::new(self, 0)
}
#[inline(always)]
pub fn dt(&mut self) -> DT_W<AMTCRrs> {
DT_W::new(self, 8)
}
}
pub struct AMTCRrs;
impl crate::RegisterSpec for AMTCRrs {
type Ux = u32;
}
impl crate::Readable for AMTCRrs {}
impl crate::Writable for AMTCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AMTCRrs {}