pub type R = crate::R<CH4_CTRLrs>;
pub type W = crate::W<CH4_CTRLrs>;
pub type SigselR = crate::FieldReader;
pub type SigselW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SOURCESEL {
None = 0,
Prsl = 1,
Prsh = 2,
Acmp0 = 6,
Acmp1 = 7,
Adc0 = 8,
Usart0 = 16,
Usart1 = 17,
Timer0 = 28,
Timer1 = 29,
Rtcc = 41,
Gpiol = 48,
Gpioh = 49,
Letimer0 = 52,
Pcnt0 = 54,
Cryotimer = 60,
Cmu = 61,
Cm4 = 67,
}
impl From<SOURCESEL> for u8 {
#[inline(always)]
fn from(variant: SOURCESEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for SOURCESEL {
type Ux = u8;
}
impl crate::IsEnum for SOURCESEL {}
pub type SourceselR = crate::FieldReader<SOURCESEL>;
impl SourceselR {
#[inline(always)]
pub const fn variant(&self) -> Option<SOURCESEL> {
match self.bits {
0 => Some(SOURCESEL::None),
1 => Some(SOURCESEL::Prsl),
2 => Some(SOURCESEL::Prsh),
6 => Some(SOURCESEL::Acmp0),
7 => Some(SOURCESEL::Acmp1),
8 => Some(SOURCESEL::Adc0),
16 => Some(SOURCESEL::Usart0),
17 => Some(SOURCESEL::Usart1),
28 => Some(SOURCESEL::Timer0),
29 => Some(SOURCESEL::Timer1),
41 => Some(SOURCESEL::Rtcc),
48 => Some(SOURCESEL::Gpiol),
49 => Some(SOURCESEL::Gpioh),
52 => Some(SOURCESEL::Letimer0),
54 => Some(SOURCESEL::Pcnt0),
60 => Some(SOURCESEL::Cryotimer),
61 => Some(SOURCESEL::Cmu),
67 => Some(SOURCESEL::Cm4),
_ => None,
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == SOURCESEL::None
}
#[inline(always)]
pub fn is_prsl(&self) -> bool {
*self == SOURCESEL::Prsl
}
#[inline(always)]
pub fn is_prsh(&self) -> bool {
*self == SOURCESEL::Prsh
}
#[inline(always)]
pub fn is_acmp0(&self) -> bool {
*self == SOURCESEL::Acmp0
}
#[inline(always)]
pub fn is_acmp1(&self) -> bool {
*self == SOURCESEL::Acmp1
}
#[inline(always)]
pub fn is_adc0(&self) -> bool {
*self == SOURCESEL::Adc0
}
#[inline(always)]
pub fn is_usart0(&self) -> bool {
*self == SOURCESEL::Usart0
}
#[inline(always)]
pub fn is_usart1(&self) -> bool {
*self == SOURCESEL::Usart1
}
#[inline(always)]
pub fn is_timer0(&self) -> bool {
*self == SOURCESEL::Timer0
}
#[inline(always)]
pub fn is_timer1(&self) -> bool {
*self == SOURCESEL::Timer1
}
#[inline(always)]
pub fn is_rtcc(&self) -> bool {
*self == SOURCESEL::Rtcc
}
#[inline(always)]
pub fn is_gpiol(&self) -> bool {
*self == SOURCESEL::Gpiol
}
#[inline(always)]
pub fn is_gpioh(&self) -> bool {
*self == SOURCESEL::Gpioh
}
#[inline(always)]
pub fn is_letimer0(&self) -> bool {
*self == SOURCESEL::Letimer0
}
#[inline(always)]
pub fn is_pcnt0(&self) -> bool {
*self == SOURCESEL::Pcnt0
}
#[inline(always)]
pub fn is_cryotimer(&self) -> bool {
*self == SOURCESEL::Cryotimer
}
#[inline(always)]
pub fn is_cmu(&self) -> bool {
*self == SOURCESEL::Cmu
}
#[inline(always)]
pub fn is_cm4(&self) -> bool {
*self == SOURCESEL::Cm4
}
}
pub type SourceselW<'a, REG> = crate::FieldWriter<'a, REG, 7, SOURCESEL>;
impl<'a, REG> SourceselW<'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(SOURCESEL::None)
}
#[inline(always)]
pub fn prsl(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Prsl)
}
#[inline(always)]
pub fn prsh(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Prsh)
}
#[inline(always)]
pub fn acmp0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Acmp0)
}
#[inline(always)]
pub fn acmp1(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Acmp1)
}
#[inline(always)]
pub fn adc0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Adc0)
}
#[inline(always)]
pub fn usart0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Usart0)
}
#[inline(always)]
pub fn usart1(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Usart1)
}
#[inline(always)]
pub fn timer0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Timer0)
}
#[inline(always)]
pub fn timer1(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Timer1)
}
#[inline(always)]
pub fn rtcc(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Rtcc)
}
#[inline(always)]
pub fn gpiol(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Gpiol)
}
#[inline(always)]
pub fn gpioh(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Gpioh)
}
#[inline(always)]
pub fn letimer0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Letimer0)
}
#[inline(always)]
pub fn pcnt0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Pcnt0)
}
#[inline(always)]
pub fn cryotimer(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Cryotimer)
}
#[inline(always)]
pub fn cmu(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Cmu)
}
#[inline(always)]
pub fn cm4(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Cm4)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EDSEL {
Off = 0,
Posedge = 1,
Negedge = 2,
Bothedges = 3,
}
impl From<EDSEL> for u8 {
#[inline(always)]
fn from(variant: EDSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for EDSEL {
type Ux = u8;
}
impl crate::IsEnum for EDSEL {}
pub type EdselR = crate::FieldReader<EDSEL>;
impl EdselR {
#[inline(always)]
pub const fn variant(&self) -> EDSEL {
match self.bits {
0 => EDSEL::Off,
1 => EDSEL::Posedge,
2 => EDSEL::Negedge,
3 => EDSEL::Bothedges,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == EDSEL::Off
}
#[inline(always)]
pub fn is_posedge(&self) -> bool {
*self == EDSEL::Posedge
}
#[inline(always)]
pub fn is_negedge(&self) -> bool {
*self == EDSEL::Negedge
}
#[inline(always)]
pub fn is_bothedges(&self) -> bool {
*self == EDSEL::Bothedges
}
}
pub type EdselW<'a, REG> = crate::FieldWriter<'a, REG, 2, EDSEL, crate::Safe>;
impl<'a, REG> EdselW<'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(EDSEL::Off)
}
#[inline(always)]
pub fn posedge(self) -> &'a mut crate::W<REG> {
self.variant(EDSEL::Posedge)
}
#[inline(always)]
pub fn negedge(self) -> &'a mut crate::W<REG> {
self.variant(EDSEL::Negedge)
}
#[inline(always)]
pub fn bothedges(self) -> &'a mut crate::W<REG> {
self.variant(EDSEL::Bothedges)
}
}
pub type StretchR = crate::BitReader;
pub type StretchW<'a, REG> = crate::BitWriter<'a, REG>;
pub type InvR = crate::BitReader;
pub type InvW<'a, REG> = crate::BitWriter<'a, REG>;
pub type OrprevR = crate::BitReader;
pub type OrprevW<'a, REG> = crate::BitWriter<'a, REG>;
pub type AndnextR = crate::BitReader;
pub type AndnextW<'a, REG> = crate::BitWriter<'a, REG>;
pub type AsyncreflR = crate::BitReader;
pub type AsyncreflW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn sigsel(&self) -> SigselR {
SigselR::new((self.bits & 7) as u8)
}
#[inline(always)]
pub fn sourcesel(&self) -> SourceselR {
SourceselR::new(((self.bits >> 8) & 0x7f) as u8)
}
#[inline(always)]
pub fn edsel(&self) -> EdselR {
EdselR::new(((self.bits >> 20) & 3) as u8)
}
#[inline(always)]
pub fn stretch(&self) -> StretchR {
StretchR::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn inv(&self) -> InvR {
InvR::new(((self.bits >> 26) & 1) != 0)
}
#[inline(always)]
pub fn orprev(&self) -> OrprevR {
OrprevR::new(((self.bits >> 27) & 1) != 0)
}
#[inline(always)]
pub fn andnext(&self) -> AndnextR {
AndnextR::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn asyncrefl(&self) -> AsyncreflR {
AsyncreflR::new(((self.bits >> 30) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CH4_CTRL")
.field("sigsel", &self.sigsel())
.field("sourcesel", &self.sourcesel())
.field("edsel", &self.edsel())
.field("stretch", &self.stretch())
.field("inv", &self.inv())
.field("orprev", &self.orprev())
.field("andnext", &self.andnext())
.field("asyncrefl", &self.asyncrefl())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sigsel(&mut self) -> SigselW<'_, CH4_CTRLrs> {
SigselW::new(self, 0)
}
#[inline(always)]
pub fn sourcesel(&mut self) -> SourceselW<'_, CH4_CTRLrs> {
SourceselW::new(self, 8)
}
#[inline(always)]
pub fn edsel(&mut self) -> EdselW<'_, CH4_CTRLrs> {
EdselW::new(self, 20)
}
#[inline(always)]
pub fn stretch(&mut self) -> StretchW<'_, CH4_CTRLrs> {
StretchW::new(self, 25)
}
#[inline(always)]
pub fn inv(&mut self) -> InvW<'_, CH4_CTRLrs> {
InvW::new(self, 26)
}
#[inline(always)]
pub fn orprev(&mut self) -> OrprevW<'_, CH4_CTRLrs> {
OrprevW::new(self, 27)
}
#[inline(always)]
pub fn andnext(&mut self) -> AndnextW<'_, CH4_CTRLrs> {
AndnextW::new(self, 28)
}
#[inline(always)]
pub fn asyncrefl(&mut self) -> AsyncreflW<'_, CH4_CTRLrs> {
AsyncreflW::new(self, 30)
}
}
pub struct CH4_CTRLrs;
impl crate::RegisterSpec for CH4_CTRLrs {
type Ux = u32;
}
impl crate::Readable for CH4_CTRLrs {}
impl crate::Writable for CH4_CTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CH4_CTRLrs {}