pub type R = crate::R<REQSELrs>;
pub type W = crate::W<REQSELrs>;
pub type SigselR = crate::FieldReader;
pub type SigselW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SOURCESEL {
None = 0,
Prs = 1,
Adc0 = 8,
Usart0 = 12,
Usart1 = 13,
Leuart0 = 16,
I2c0 = 20,
Timer0 = 24,
Timer1 = 25,
Msc = 48,
Crypto = 49,
}
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::Prs),
8 => Some(SOURCESEL::Adc0),
12 => Some(SOURCESEL::Usart0),
13 => Some(SOURCESEL::Usart1),
16 => Some(SOURCESEL::Leuart0),
20 => Some(SOURCESEL::I2c0),
24 => Some(SOURCESEL::Timer0),
25 => Some(SOURCESEL::Timer1),
48 => Some(SOURCESEL::Msc),
49 => Some(SOURCESEL::Crypto),
_ => None,
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == SOURCESEL::None
}
#[inline(always)]
pub fn is_prs(&self) -> bool {
*self == SOURCESEL::Prs
}
#[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_leuart0(&self) -> bool {
*self == SOURCESEL::Leuart0
}
#[inline(always)]
pub fn is_i2c0(&self) -> bool {
*self == SOURCESEL::I2c0
}
#[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_msc(&self) -> bool {
*self == SOURCESEL::Msc
}
#[inline(always)]
pub fn is_crypto(&self) -> bool {
*self == SOURCESEL::Crypto
}
}
pub type SourceselW<'a, REG> = crate::FieldWriter<'a, REG, 6, 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 prs(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Prs)
}
#[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 leuart0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Leuart0)
}
#[inline(always)]
pub fn i2c0(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::I2c0)
}
#[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 msc(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Msc)
}
#[inline(always)]
pub fn crypto(self) -> &'a mut crate::W<REG> {
self.variant(SOURCESEL::Crypto)
}
}
impl R {
#[inline(always)]
pub fn sigsel(&self) -> SigselR {
SigselR::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn sourcesel(&self) -> SourceselR {
SourceselR::new(((self.bits >> 16) & 0x3f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("REQSEL")
.field("sigsel", &self.sigsel())
.field("sourcesel", &self.sourcesel())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sigsel(&mut self) -> SigselW<'_, REQSELrs> {
SigselW::new(self, 0)
}
#[inline(always)]
pub fn sourcesel(&mut self) -> SourceselW<'_, REQSELrs> {
SourceselW::new(self, 16)
}
}
pub struct REQSELrs;
impl crate::RegisterSpec for REQSELrs {
type Ux = u32;
}
impl crate::Readable for REQSELrs {}
impl crate::Writable for REQSELrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for REQSELrs {}