pub type R = crate::R<D2CFGRrs>;
pub type W = crate::W<D2CFGRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum D2PPRE1 {
Div2 = 4,
Div4 = 5,
Div8 = 6,
Div16 = 7,
Div1 = 0,
}
impl From<D2PPRE1> for u8 {
#[inline(always)]
fn from(variant: D2PPRE1) -> Self {
variant as _
}
}
impl crate::FieldSpec for D2PPRE1 {
type Ux = u8;
}
impl crate::IsEnum for D2PPRE1 {}
pub type D2PPRE1_R = crate::FieldReader<D2PPRE1>;
impl D2PPRE1_R {
#[inline(always)]
pub const fn variant(&self) -> D2PPRE1 {
match self.bits {
4 => D2PPRE1::Div2,
5 => D2PPRE1::Div4,
6 => D2PPRE1::Div8,
7 => D2PPRE1::Div16,
_ => D2PPRE1::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == D2PPRE1::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == D2PPRE1::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == D2PPRE1::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == D2PPRE1::Div16
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), D2PPRE1::Div1)
}
}
pub type D2PPRE1_W<'a, REG> = crate::FieldWriter<'a, REG, 3, D2PPRE1, crate::Safe>;
impl<'a, REG> D2PPRE1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(D2PPRE1::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(D2PPRE1::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(D2PPRE1::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(D2PPRE1::Div16)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(D2PPRE1::Div1)
}
}
pub use D2PPRE1_R as D2PPRE2_R;
pub use D2PPRE1_W as D2PPRE2_W;
impl R {
#[inline(always)]
pub fn d2ppre1(&self) -> D2PPRE1_R {
D2PPRE1_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn d2ppre2(&self) -> D2PPRE2_R {
D2PPRE2_R::new(((self.bits >> 8) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("D2CFGR")
.field("d2ppre1", &self.d2ppre1())
.field("d2ppre2", &self.d2ppre2())
.finish()
}
}
impl W {
#[inline(always)]
pub fn d2ppre1(&mut self) -> D2PPRE1_W<D2CFGRrs> {
D2PPRE1_W::new(self, 4)
}
#[inline(always)]
pub fn d2ppre2(&mut self) -> D2PPRE2_W<D2CFGRrs> {
D2PPRE2_W::new(self, 8)
}
}
pub struct D2CFGRrs;
impl crate::RegisterSpec for D2CFGRrs {
type Ux = u32;
}
impl crate::Readable for D2CFGRrs {}
impl crate::Writable for D2CFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for D2CFGRrs {}