pub type R = crate::R<CTRLrs>;
pub type W = crate::W<CTRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODE {
Up = 0,
Down = 1,
Updown = 2,
Qdec = 3,
}
impl From<MODE> for u8 {
#[inline(always)]
fn from(variant: MODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for MODE {
type Ux = u8;
}
impl crate::IsEnum for MODE {}
pub type ModeR = crate::FieldReader<MODE>;
impl ModeR {
#[inline(always)]
pub const fn variant(&self) -> MODE {
match self.bits {
0 => MODE::Up,
1 => MODE::Down,
2 => MODE::Updown,
3 => MODE::Qdec,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_up(&self) -> bool {
*self == MODE::Up
}
#[inline(always)]
pub fn is_down(&self) -> bool {
*self == MODE::Down
}
#[inline(always)]
pub fn is_updown(&self) -> bool {
*self == MODE::Updown
}
#[inline(always)]
pub fn is_qdec(&self) -> bool {
*self == MODE::Qdec
}
}
pub type ModeW<'a, REG> = crate::FieldWriter<'a, REG, 2, MODE, crate::Safe>;
impl<'a, REG> ModeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn up(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Up)
}
#[inline(always)]
pub fn down(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Down)
}
#[inline(always)]
pub fn updown(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Updown)
}
#[inline(always)]
pub fn qdec(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Qdec)
}
}
pub type SyncR = crate::BitReader;
pub type SyncW<'a, REG> = crate::BitWriter<'a, REG>;
pub type OsmenR = crate::BitReader;
pub type OsmenW<'a, REG> = crate::BitWriter<'a, REG>;
pub type QdmR = crate::BitReader;
pub type QdmW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DebugrunR = crate::BitReader;
pub type DebugrunW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DmaclractR = crate::BitReader;
pub type DmaclractW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RISEA {
None = 0,
Start = 1,
Stop = 2,
Reloadstart = 3,
}
impl From<RISEA> for u8 {
#[inline(always)]
fn from(variant: RISEA) -> Self {
variant as _
}
}
impl crate::FieldSpec for RISEA {
type Ux = u8;
}
impl crate::IsEnum for RISEA {}
pub type RiseaR = crate::FieldReader<RISEA>;
impl RiseaR {
#[inline(always)]
pub const fn variant(&self) -> RISEA {
match self.bits {
0 => RISEA::None,
1 => RISEA::Start,
2 => RISEA::Stop,
3 => RISEA::Reloadstart,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == RISEA::None
}
#[inline(always)]
pub fn is_start(&self) -> bool {
*self == RISEA::Start
}
#[inline(always)]
pub fn is_stop(&self) -> bool {
*self == RISEA::Stop
}
#[inline(always)]
pub fn is_reloadstart(&self) -> bool {
*self == RISEA::Reloadstart
}
}
pub type RiseaW<'a, REG> = crate::FieldWriter<'a, REG, 2, RISEA, crate::Safe>;
impl<'a, REG> RiseaW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn none(self) -> &'a mut crate::W<REG> {
self.variant(RISEA::None)
}
#[inline(always)]
pub fn start(self) -> &'a mut crate::W<REG> {
self.variant(RISEA::Start)
}
#[inline(always)]
pub fn stop(self) -> &'a mut crate::W<REG> {
self.variant(RISEA::Stop)
}
#[inline(always)]
pub fn reloadstart(self) -> &'a mut crate::W<REG> {
self.variant(RISEA::Reloadstart)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FALLA {
None = 0,
Start = 1,
Stop = 2,
Reloadstart = 3,
}
impl From<FALLA> for u8 {
#[inline(always)]
fn from(variant: FALLA) -> Self {
variant as _
}
}
impl crate::FieldSpec for FALLA {
type Ux = u8;
}
impl crate::IsEnum for FALLA {}
pub type FallaR = crate::FieldReader<FALLA>;
impl FallaR {
#[inline(always)]
pub const fn variant(&self) -> FALLA {
match self.bits {
0 => FALLA::None,
1 => FALLA::Start,
2 => FALLA::Stop,
3 => FALLA::Reloadstart,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == FALLA::None
}
#[inline(always)]
pub fn is_start(&self) -> bool {
*self == FALLA::Start
}
#[inline(always)]
pub fn is_stop(&self) -> bool {
*self == FALLA::Stop
}
#[inline(always)]
pub fn is_reloadstart(&self) -> bool {
*self == FALLA::Reloadstart
}
}
pub type FallaW<'a, REG> = crate::FieldWriter<'a, REG, 2, FALLA, crate::Safe>;
impl<'a, REG> FallaW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn none(self) -> &'a mut crate::W<REG> {
self.variant(FALLA::None)
}
#[inline(always)]
pub fn start(self) -> &'a mut crate::W<REG> {
self.variant(FALLA::Start)
}
#[inline(always)]
pub fn stop(self) -> &'a mut crate::W<REG> {
self.variant(FALLA::Stop)
}
#[inline(always)]
pub fn reloadstart(self) -> &'a mut crate::W<REG> {
self.variant(FALLA::Reloadstart)
}
}
pub type X2cntR = crate::BitReader;
pub type X2cntW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CLKSEL {
Preschfperclk = 0,
Cc1 = 1,
Timerouf = 2,
}
impl From<CLKSEL> for u8 {
#[inline(always)]
fn from(variant: CLKSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for CLKSEL {
type Ux = u8;
}
impl crate::IsEnum for CLKSEL {}
pub type ClkselR = crate::FieldReader<CLKSEL>;
impl ClkselR {
#[inline(always)]
pub const fn variant(&self) -> Option<CLKSEL> {
match self.bits {
0 => Some(CLKSEL::Preschfperclk),
1 => Some(CLKSEL::Cc1),
2 => Some(CLKSEL::Timerouf),
_ => None,
}
}
#[inline(always)]
pub fn is_preschfperclk(&self) -> bool {
*self == CLKSEL::Preschfperclk
}
#[inline(always)]
pub fn is_cc1(&self) -> bool {
*self == CLKSEL::Cc1
}
#[inline(always)]
pub fn is_timerouf(&self) -> bool {
*self == CLKSEL::Timerouf
}
}
pub type ClkselW<'a, REG> = crate::FieldWriter<'a, REG, 2, CLKSEL>;
impl<'a, REG> ClkselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn preschfperclk(self) -> &'a mut crate::W<REG> {
self.variant(CLKSEL::Preschfperclk)
}
#[inline(always)]
pub fn cc1(self) -> &'a mut crate::W<REG> {
self.variant(CLKSEL::Cc1)
}
#[inline(always)]
pub fn timerouf(self) -> &'a mut crate::W<REG> {
self.variant(CLKSEL::Timerouf)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRESC {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
Div16 = 4,
Div32 = 5,
Div64 = 6,
Div128 = 7,
Div256 = 8,
Div512 = 9,
Div1024 = 10,
}
impl From<PRESC> for u8 {
#[inline(always)]
fn from(variant: PRESC) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRESC {
type Ux = u8;
}
impl crate::IsEnum for PRESC {}
pub type PrescR = crate::FieldReader<PRESC>;
impl PrescR {
#[inline(always)]
pub const fn variant(&self) -> Option<PRESC> {
match self.bits {
0 => Some(PRESC::Div1),
1 => Some(PRESC::Div2),
2 => Some(PRESC::Div4),
3 => Some(PRESC::Div8),
4 => Some(PRESC::Div16),
5 => Some(PRESC::Div32),
6 => Some(PRESC::Div64),
7 => Some(PRESC::Div128),
8 => Some(PRESC::Div256),
9 => Some(PRESC::Div512),
10 => Some(PRESC::Div1024),
_ => None,
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == PRESC::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PRESC::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PRESC::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PRESC::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == PRESC::Div16
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == PRESC::Div32
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == PRESC::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == PRESC::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == PRESC::Div256
}
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == PRESC::Div512
}
#[inline(always)]
pub fn is_div1024(&self) -> bool {
*self == PRESC::Div1024
}
}
pub type PrescW<'a, REG> = crate::FieldWriter<'a, REG, 4, PRESC>;
impl<'a, REG> PrescW<'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(PRESC::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div16)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div32)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div256)
}
#[inline(always)]
pub fn div512(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div512)
}
#[inline(always)]
pub fn div1024(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div1024)
}
}
pub type AtiR = crate::BitReader;
pub type AtiW<'a, REG> = crate::BitWriter<'a, REG>;
pub type RsscoistR = crate::BitReader;
pub type RsscoistW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn mode(&self) -> ModeR {
ModeR::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn sync(&self) -> SyncR {
SyncR::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn osmen(&self) -> OsmenR {
OsmenR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn qdm(&self) -> QdmR {
QdmR::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn debugrun(&self) -> DebugrunR {
DebugrunR::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn dmaclract(&self) -> DmaclractR {
DmaclractR::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn risea(&self) -> RiseaR {
RiseaR::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn falla(&self) -> FallaR {
FallaR::new(((self.bits >> 10) & 3) as u8)
}
#[inline(always)]
pub fn x2cnt(&self) -> X2cntR {
X2cntR::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn clksel(&self) -> ClkselR {
ClkselR::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn presc(&self) -> PrescR {
PrescR::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn ati(&self) -> AtiR {
AtiR::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn rsscoist(&self) -> RsscoistR {
RsscoistR::new(((self.bits >> 29) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL")
.field("mode", &self.mode())
.field("sync", &self.sync())
.field("osmen", &self.osmen())
.field("qdm", &self.qdm())
.field("debugrun", &self.debugrun())
.field("dmaclract", &self.dmaclract())
.field("risea", &self.risea())
.field("falla", &self.falla())
.field("x2cnt", &self.x2cnt())
.field("clksel", &self.clksel())
.field("presc", &self.presc())
.field("ati", &self.ati())
.field("rsscoist", &self.rsscoist())
.finish()
}
}
impl W {
#[inline(always)]
pub fn mode(&mut self) -> ModeW<'_, CTRLrs> {
ModeW::new(self, 0)
}
#[inline(always)]
pub fn sync(&mut self) -> SyncW<'_, CTRLrs> {
SyncW::new(self, 3)
}
#[inline(always)]
pub fn osmen(&mut self) -> OsmenW<'_, CTRLrs> {
OsmenW::new(self, 4)
}
#[inline(always)]
pub fn qdm(&mut self) -> QdmW<'_, CTRLrs> {
QdmW::new(self, 5)
}
#[inline(always)]
pub fn debugrun(&mut self) -> DebugrunW<'_, CTRLrs> {
DebugrunW::new(self, 6)
}
#[inline(always)]
pub fn dmaclract(&mut self) -> DmaclractW<'_, CTRLrs> {
DmaclractW::new(self, 7)
}
#[inline(always)]
pub fn risea(&mut self) -> RiseaW<'_, CTRLrs> {
RiseaW::new(self, 8)
}
#[inline(always)]
pub fn falla(&mut self) -> FallaW<'_, CTRLrs> {
FallaW::new(self, 10)
}
#[inline(always)]
pub fn x2cnt(&mut self) -> X2cntW<'_, CTRLrs> {
X2cntW::new(self, 13)
}
#[inline(always)]
pub fn clksel(&mut self) -> ClkselW<'_, CTRLrs> {
ClkselW::new(self, 16)
}
#[inline(always)]
pub fn presc(&mut self) -> PrescW<'_, CTRLrs> {
PrescW::new(self, 24)
}
#[inline(always)]
pub fn ati(&mut self) -> AtiW<'_, CTRLrs> {
AtiW::new(self, 28)
}
#[inline(always)]
pub fn rsscoist(&mut self) -> RsscoistW<'_, CTRLrs> {
RsscoistW::new(self, 29)
}
}
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 {}