pub type R = crate::R<CC2_CTRLrs>;
pub type W = crate::W<CC2_CTRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODE {
Off = 0,
Inputcapture = 1,
Outputcompare = 2,
}
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) -> Option<MODE> {
match self.bits {
0 => Some(MODE::Off),
1 => Some(MODE::Inputcapture),
2 => Some(MODE::Outputcompare),
_ => None,
}
}
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == MODE::Off
}
#[inline(always)]
pub fn is_inputcapture(&self) -> bool {
*self == MODE::Inputcapture
}
#[inline(always)]
pub fn is_outputcompare(&self) -> bool {
*self == MODE::Outputcompare
}
}
pub type ModeW<'a, REG> = crate::FieldWriter<'a, REG, 2, MODE>;
impl<'a, REG> ModeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn off(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Off)
}
#[inline(always)]
pub fn inputcapture(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Inputcapture)
}
#[inline(always)]
pub fn outputcompare(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Outputcompare)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CMOA {
Pulse = 0,
Toggle = 1,
Clear = 2,
Set = 3,
}
impl From<CMOA> for u8 {
#[inline(always)]
fn from(variant: CMOA) -> Self {
variant as _
}
}
impl crate::FieldSpec for CMOA {
type Ux = u8;
}
impl crate::IsEnum for CMOA {}
pub type CmoaR = crate::FieldReader<CMOA>;
impl CmoaR {
#[inline(always)]
pub const fn variant(&self) -> CMOA {
match self.bits {
0 => CMOA::Pulse,
1 => CMOA::Toggle,
2 => CMOA::Clear,
3 => CMOA::Set,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_pulse(&self) -> bool {
*self == CMOA::Pulse
}
#[inline(always)]
pub fn is_toggle(&self) -> bool {
*self == CMOA::Toggle
}
#[inline(always)]
pub fn is_clear(&self) -> bool {
*self == CMOA::Clear
}
#[inline(always)]
pub fn is_set(&self) -> bool {
*self == CMOA::Set
}
}
pub type CmoaW<'a, REG> = crate::FieldWriter<'a, REG, 2, CMOA, crate::Safe>;
impl<'a, REG> CmoaW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn pulse(self) -> &'a mut crate::W<REG> {
self.variant(CMOA::Pulse)
}
#[inline(always)]
pub fn toggle(self) -> &'a mut crate::W<REG> {
self.variant(CMOA::Toggle)
}
#[inline(always)]
pub fn clear(self) -> &'a mut crate::W<REG> {
self.variant(CMOA::Clear)
}
#[inline(always)]
pub fn set_(self) -> &'a mut crate::W<REG> {
self.variant(CMOA::Set)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ICEDGE {
Rising = 0,
Falling = 1,
Both = 2,
None = 3,
}
impl From<ICEDGE> for u8 {
#[inline(always)]
fn from(variant: ICEDGE) -> Self {
variant as _
}
}
impl crate::FieldSpec for ICEDGE {
type Ux = u8;
}
impl crate::IsEnum for ICEDGE {}
pub type IcedgeR = crate::FieldReader<ICEDGE>;
impl IcedgeR {
#[inline(always)]
pub const fn variant(&self) -> ICEDGE {
match self.bits {
0 => ICEDGE::Rising,
1 => ICEDGE::Falling,
2 => ICEDGE::Both,
3 => ICEDGE::None,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_rising(&self) -> bool {
*self == ICEDGE::Rising
}
#[inline(always)]
pub fn is_falling(&self) -> bool {
*self == ICEDGE::Falling
}
#[inline(always)]
pub fn is_both(&self) -> bool {
*self == ICEDGE::Both
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == ICEDGE::None
}
}
pub type IcedgeW<'a, REG> = crate::FieldWriter<'a, REG, 2, ICEDGE, crate::Safe>;
impl<'a, REG> IcedgeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn rising(self) -> &'a mut crate::W<REG> {
self.variant(ICEDGE::Rising)
}
#[inline(always)]
pub fn falling(self) -> &'a mut crate::W<REG> {
self.variant(ICEDGE::Falling)
}
#[inline(always)]
pub fn both(self) -> &'a mut crate::W<REG> {
self.variant(ICEDGE::Both)
}
#[inline(always)]
pub fn none(self) -> &'a mut crate::W<REG> {
self.variant(ICEDGE::None)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRSSEL {
Prsch0 = 0,
Prsch1 = 1,
Prsch2 = 2,
Prsch3 = 3,
Prsch4 = 4,
Prsch5 = 5,
Prsch6 = 6,
Prsch7 = 7,
Prsch8 = 8,
Prsch9 = 9,
Prsch10 = 10,
Prsch11 = 11,
}
impl From<PRSSEL> for u8 {
#[inline(always)]
fn from(variant: PRSSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRSSEL {
type Ux = u8;
}
impl crate::IsEnum for PRSSEL {}
pub type PrsselR = crate::FieldReader<PRSSEL>;
impl PrsselR {
#[inline(always)]
pub const fn variant(&self) -> Option<PRSSEL> {
match self.bits {
0 => Some(PRSSEL::Prsch0),
1 => Some(PRSSEL::Prsch1),
2 => Some(PRSSEL::Prsch2),
3 => Some(PRSSEL::Prsch3),
4 => Some(PRSSEL::Prsch4),
5 => Some(PRSSEL::Prsch5),
6 => Some(PRSSEL::Prsch6),
7 => Some(PRSSEL::Prsch7),
8 => Some(PRSSEL::Prsch8),
9 => Some(PRSSEL::Prsch9),
10 => Some(PRSSEL::Prsch10),
11 => Some(PRSSEL::Prsch11),
_ => None,
}
}
#[inline(always)]
pub fn is_prsch0(&self) -> bool {
*self == PRSSEL::Prsch0
}
#[inline(always)]
pub fn is_prsch1(&self) -> bool {
*self == PRSSEL::Prsch1
}
#[inline(always)]
pub fn is_prsch2(&self) -> bool {
*self == PRSSEL::Prsch2
}
#[inline(always)]
pub fn is_prsch3(&self) -> bool {
*self == PRSSEL::Prsch3
}
#[inline(always)]
pub fn is_prsch4(&self) -> bool {
*self == PRSSEL::Prsch4
}
#[inline(always)]
pub fn is_prsch5(&self) -> bool {
*self == PRSSEL::Prsch5
}
#[inline(always)]
pub fn is_prsch6(&self) -> bool {
*self == PRSSEL::Prsch6
}
#[inline(always)]
pub fn is_prsch7(&self) -> bool {
*self == PRSSEL::Prsch7
}
#[inline(always)]
pub fn is_prsch8(&self) -> bool {
*self == PRSSEL::Prsch8
}
#[inline(always)]
pub fn is_prsch9(&self) -> bool {
*self == PRSSEL::Prsch9
}
#[inline(always)]
pub fn is_prsch10(&self) -> bool {
*self == PRSSEL::Prsch10
}
#[inline(always)]
pub fn is_prsch11(&self) -> bool {
*self == PRSSEL::Prsch11
}
}
pub type PrsselW<'a, REG> = crate::FieldWriter<'a, REG, 4, PRSSEL>;
impl<'a, REG> PrsselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn prsch0(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch0)
}
#[inline(always)]
pub fn prsch1(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch1)
}
#[inline(always)]
pub fn prsch2(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch2)
}
#[inline(always)]
pub fn prsch3(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch3)
}
#[inline(always)]
pub fn prsch4(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch4)
}
#[inline(always)]
pub fn prsch5(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch5)
}
#[inline(always)]
pub fn prsch6(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch6)
}
#[inline(always)]
pub fn prsch7(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch7)
}
#[inline(always)]
pub fn prsch8(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch8)
}
#[inline(always)]
pub fn prsch9(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch9)
}
#[inline(always)]
pub fn prsch10(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch10)
}
#[inline(always)]
pub fn prsch11(self) -> &'a mut crate::W<REG> {
self.variant(PRSSEL::Prsch11)
}
}
pub type CompbaseR = crate::BitReader;
pub type CompbaseW<'a, REG> = crate::BitWriter<'a, REG>;
pub type CompmaskR = crate::FieldReader;
pub type CompmaskW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
pub type DayccR = crate::BitReader;
pub type DayccW<'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 cmoa(&self) -> CmoaR {
CmoaR::new(((self.bits >> 2) & 3) as u8)
}
#[inline(always)]
pub fn icedge(&self) -> IcedgeR {
IcedgeR::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn prssel(&self) -> PrsselR {
PrsselR::new(((self.bits >> 6) & 0x0f) as u8)
}
#[inline(always)]
pub fn compbase(&self) -> CompbaseR {
CompbaseR::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn compmask(&self) -> CompmaskR {
CompmaskR::new(((self.bits >> 12) & 0x1f) as u8)
}
#[inline(always)]
pub fn daycc(&self) -> DayccR {
DayccR::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("CC2_CTRL")
.field("mode", &self.mode())
.field("cmoa", &self.cmoa())
.field("icedge", &self.icedge())
.field("prssel", &self.prssel())
.field("compbase", &self.compbase())
.field("compmask", &self.compmask())
.field("daycc", &self.daycc())
.finish()
}
}
impl W {
#[inline(always)]
pub fn mode(&mut self) -> ModeW<'_, CC2_CTRLrs> {
ModeW::new(self, 0)
}
#[inline(always)]
pub fn cmoa(&mut self) -> CmoaW<'_, CC2_CTRLrs> {
CmoaW::new(self, 2)
}
#[inline(always)]
pub fn icedge(&mut self) -> IcedgeW<'_, CC2_CTRLrs> {
IcedgeW::new(self, 4)
}
#[inline(always)]
pub fn prssel(&mut self) -> PrsselW<'_, CC2_CTRLrs> {
PrsselW::new(self, 6)
}
#[inline(always)]
pub fn compbase(&mut self) -> CompbaseW<'_, CC2_CTRLrs> {
CompbaseW::new(self, 11)
}
#[inline(always)]
pub fn compmask(&mut self) -> CompmaskW<'_, CC2_CTRLrs> {
CompmaskW::new(self, 12)
}
#[inline(always)]
pub fn daycc(&mut self) -> DayccW<'_, CC2_CTRLrs> {
DayccW::new(self, 17)
}
}
pub struct CC2_CTRLrs;
impl crate::RegisterSpec for CC2_CTRLrs {
type Ux = u32;
}
impl crate::Readable for CC2_CTRLrs {}
impl crate::Writable for CC2_CTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CC2_CTRLrs {}