pub type R = crate::R<DADDRrs>;
pub type W = crate::W<DADDRrs>;
pub type ADD_R = crate::FieldReader;
pub type ADD_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 EF {
Disabled = 0,
Enabled = 1,
}
impl From<EF> for bool {
#[inline(always)]
fn from(variant: EF) -> Self {
variant as u8 != 0
}
}
pub type EF_R = crate::BitReader<EF>;
impl EF_R {
#[inline(always)]
pub const fn variant(&self) -> EF {
match self.bits {
false => EF::Disabled,
true => EF::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EF::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EF::Enabled
}
}
pub type EF_W<'a, REG> = crate::BitWriter<'a, REG, EF>;
impl<'a, REG> EF_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(EF::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(EF::Enabled)
}
}
impl R {
#[inline(always)]
pub fn add(&self) -> ADD_R {
ADD_R::new((self.bits & 0x7f) as u8)
}
#[inline(always)]
pub fn ef(&self) -> EF_R {
EF_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("DADDR")
.field("ef", &self.ef())
.field("add", &self.add())
.finish()
}
}
impl W {
#[inline(always)]
pub fn add(&mut self) -> ADD_W<DADDRrs> {
ADD_W::new(self, 0)
}
#[inline(always)]
pub fn ef(&mut self) -> EF_W<DADDRrs> {
EF_W::new(self, 7)
}
}
pub struct DADDRrs;
impl crate::RegisterSpec for DADDRrs {
type Ux = u32;
}
impl crate::Readable for DADDRrs {}
impl crate::Writable for DADDRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for DADDRrs {}