pub type R = crate::R<CTRLrs>;
pub type W = crate::W<CTRLrs>;
pub type EnableR = crate::BitReader;
pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DebugrunR = crate::BitReader;
pub type DebugrunW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Preccv0topR = crate::BitReader;
pub type Preccv0topW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Ccv1topR = crate::BitReader;
pub type Ccv1topW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CNTPRESC {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
Div16 = 4,
Div32 = 5,
Div64 = 6,
Div128 = 7,
Div256 = 8,
Div512 = 9,
Div1024 = 10,
Div2048 = 11,
Div4096 = 12,
Div8192 = 13,
Div16384 = 14,
Div32768 = 15,
}
impl From<CNTPRESC> for u8 {
#[inline(always)]
fn from(variant: CNTPRESC) -> Self {
variant as _
}
}
impl crate::FieldSpec for CNTPRESC {
type Ux = u8;
}
impl crate::IsEnum for CNTPRESC {}
pub type CntprescR = crate::FieldReader<CNTPRESC>;
impl CntprescR {
#[inline(always)]
pub const fn variant(&self) -> CNTPRESC {
match self.bits {
0 => CNTPRESC::Div1,
1 => CNTPRESC::Div2,
2 => CNTPRESC::Div4,
3 => CNTPRESC::Div8,
4 => CNTPRESC::Div16,
5 => CNTPRESC::Div32,
6 => CNTPRESC::Div64,
7 => CNTPRESC::Div128,
8 => CNTPRESC::Div256,
9 => CNTPRESC::Div512,
10 => CNTPRESC::Div1024,
11 => CNTPRESC::Div2048,
12 => CNTPRESC::Div4096,
13 => CNTPRESC::Div8192,
14 => CNTPRESC::Div16384,
15 => CNTPRESC::Div32768,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == CNTPRESC::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == CNTPRESC::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == CNTPRESC::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == CNTPRESC::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == CNTPRESC::Div16
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == CNTPRESC::Div32
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == CNTPRESC::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == CNTPRESC::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == CNTPRESC::Div256
}
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == CNTPRESC::Div512
}
#[inline(always)]
pub fn is_div1024(&self) -> bool {
*self == CNTPRESC::Div1024
}
#[inline(always)]
pub fn is_div2048(&self) -> bool {
*self == CNTPRESC::Div2048
}
#[inline(always)]
pub fn is_div4096(&self) -> bool {
*self == CNTPRESC::Div4096
}
#[inline(always)]
pub fn is_div8192(&self) -> bool {
*self == CNTPRESC::Div8192
}
#[inline(always)]
pub fn is_div16384(&self) -> bool {
*self == CNTPRESC::Div16384
}
#[inline(always)]
pub fn is_div32768(&self) -> bool {
*self == CNTPRESC::Div32768
}
}
pub type CntprescW<'a, REG> = crate::FieldWriter<'a, REG, 4, CNTPRESC, crate::Safe>;
impl<'a, REG> CntprescW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div16)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div32)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div256)
}
#[inline(always)]
pub fn div512(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div512)
}
#[inline(always)]
pub fn div1024(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div1024)
}
#[inline(always)]
pub fn div2048(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div2048)
}
#[inline(always)]
pub fn div4096(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div4096)
}
#[inline(always)]
pub fn div8192(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div8192)
}
#[inline(always)]
pub fn div16384(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div16384)
}
#[inline(always)]
pub fn div32768(self) -> &'a mut crate::W<REG> {
self.variant(CNTPRESC::Div32768)
}
}
pub type CnttickR = crate::BitReader;
pub type CnttickW<'a, REG> = crate::BitWriter<'a, REG>;
pub type OscfdetenR = crate::BitReader;
pub type OscfdetenW<'a, REG> = crate::BitWriter<'a, REG>;
pub type CntmodeR = crate::BitReader;
pub type CntmodeW<'a, REG> = crate::BitWriter<'a, REG>;
pub type LyearcorrdisR = crate::BitReader;
pub type LyearcorrdisW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn enable(&self) -> EnableR {
EnableR::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn debugrun(&self) -> DebugrunR {
DebugrunR::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn preccv0top(&self) -> Preccv0topR {
Preccv0topR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn ccv1top(&self) -> Ccv1topR {
Ccv1topR::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn cntpresc(&self) -> CntprescR {
CntprescR::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn cnttick(&self) -> CnttickR {
CnttickR::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn oscfdeten(&self) -> OscfdetenR {
OscfdetenR::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn cntmode(&self) -> CntmodeR {
CntmodeR::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn lyearcorrdis(&self) -> LyearcorrdisR {
LyearcorrdisR::new(((self.bits >> 17) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL")
.field("enable", &self.enable())
.field("debugrun", &self.debugrun())
.field("preccv0top", &self.preccv0top())
.field("ccv1top", &self.ccv1top())
.field("cntpresc", &self.cntpresc())
.field("cnttick", &self.cnttick())
.field("oscfdeten", &self.oscfdeten())
.field("cntmode", &self.cntmode())
.field("lyearcorrdis", &self.lyearcorrdis())
.finish()
}
}
impl W {
#[inline(always)]
pub fn enable(&mut self) -> EnableW<'_, CTRLrs> {
EnableW::new(self, 0)
}
#[inline(always)]
pub fn debugrun(&mut self) -> DebugrunW<'_, CTRLrs> {
DebugrunW::new(self, 2)
}
#[inline(always)]
pub fn preccv0top(&mut self) -> Preccv0topW<'_, CTRLrs> {
Preccv0topW::new(self, 4)
}
#[inline(always)]
pub fn ccv1top(&mut self) -> Ccv1topW<'_, CTRLrs> {
Ccv1topW::new(self, 5)
}
#[inline(always)]
pub fn cntpresc(&mut self) -> CntprescW<'_, CTRLrs> {
CntprescW::new(self, 8)
}
#[inline(always)]
pub fn cnttick(&mut self) -> CnttickW<'_, CTRLrs> {
CnttickW::new(self, 12)
}
#[inline(always)]
pub fn oscfdeten(&mut self) -> OscfdetenW<'_, CTRLrs> {
OscfdetenW::new(self, 15)
}
#[inline(always)]
pub fn cntmode(&mut self) -> CntmodeW<'_, CTRLrs> {
CntmodeW::new(self, 16)
}
#[inline(always)]
pub fn lyearcorrdis(&mut self) -> LyearcorrdisW<'_, CTRLrs> {
LyearcorrdisW::new(self, 17)
}
}
pub struct CTRLrs;
impl crate::RegisterSpec for CTRLrs {
type Ux = u32;
}
impl crate::Readable for CTRLrs {}
impl crate::Writable for CTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CTRLrs {}