pub type R = crate::R<CDCFGR2rs>;
pub type W = crate::W<CDCFGR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CDPPRE1 {
Div2 = 4,
Div4 = 5,
Div8 = 6,
Div16 = 7,
Div1 = 0,
}
impl From<CDPPRE1> for u8 {
#[inline(always)]
fn from(variant: CDPPRE1) -> Self {
variant as _
}
}
impl crate::FieldSpec for CDPPRE1 {
type Ux = u8;
}
impl crate::IsEnum for CDPPRE1 {}
pub type CDPPRE1_R = crate::FieldReader<CDPPRE1>;
impl CDPPRE1_R {
#[inline(always)]
pub const fn variant(&self) -> CDPPRE1 {
match self.bits {
4 => CDPPRE1::Div2,
5 => CDPPRE1::Div4,
6 => CDPPRE1::Div8,
7 => CDPPRE1::Div16,
_ => CDPPRE1::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == CDPPRE1::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == CDPPRE1::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == CDPPRE1::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == CDPPRE1::Div16
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), CDPPRE1::Div1)
}
}
pub type CDPPRE1_W<'a, REG> = crate::FieldWriter<'a, REG, 3, CDPPRE1, crate::Safe>;
impl<'a, REG> CDPPRE1_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(CDPPRE1::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(CDPPRE1::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(CDPPRE1::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(CDPPRE1::Div16)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(CDPPRE1::Div1)
}
}
pub use CDPPRE1_R as CDPPRE2_R;
pub use CDPPRE1_W as CDPPRE2_W;
impl R {
#[inline(always)]
pub fn cdppre1(&self) -> CDPPRE1_R {
CDPPRE1_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn cdppre2(&self) -> CDPPRE2_R {
CDPPRE2_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("CDCFGR2")
.field("cdppre1", &self.cdppre1())
.field("cdppre2", &self.cdppre2())
.finish()
}
}
impl W {
#[inline(always)]
pub fn cdppre1(&mut self) -> CDPPRE1_W<CDCFGR2rs> {
CDPPRE1_W::new(self, 4)
}
#[inline(always)]
pub fn cdppre2(&mut self) -> CDPPRE2_W<CDCFGR2rs> {
CDPPRE2_W::new(self, 8)
}
}
pub struct CDCFGR2rs;
impl crate::RegisterSpec for CDCFGR2rs {
type Ux = u32;
}
impl crate::Readable for CDCFGR2rs {}
impl crate::Writable for CDCFGR2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CDCFGR2rs {}