pub type R = crate::R<PCSELrs>;
pub type W = crate::W<PCSELrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum PCSEL {
NotPreselected = 0,
Preselected = 1,
}
impl From<PCSEL> for u32 {
#[inline(always)]
fn from(variant: PCSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for PCSEL {
type Ux = u32;
}
impl crate::IsEnum for PCSEL {}
pub type PCSEL_R = crate::FieldReader<PCSEL>;
impl PCSEL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PCSEL> {
match self.bits {
0 => Some(PCSEL::NotPreselected),
1 => Some(PCSEL::Preselected),
_ => None,
}
}
#[inline(always)]
pub fn is_not_preselected(&self) -> bool {
*self == PCSEL::NotPreselected
}
#[inline(always)]
pub fn is_preselected(&self) -> bool {
*self == PCSEL::Preselected
}
}
pub type PCSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 20, PCSEL>;
impl<'a, REG> PCSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u32>,
{
#[inline(always)]
pub fn not_preselected(self) -> &'a mut crate::W<REG> {
self.variant(PCSEL::NotPreselected)
}
#[inline(always)]
pub fn preselected(self) -> &'a mut crate::W<REG> {
self.variant(PCSEL::Preselected)
}
}
impl R {
#[inline(always)]
pub fn pcsel(&self) -> PCSEL_R {
PCSEL_R::new(self.bits & 0x000f_ffff)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PCSEL").field("pcsel", &self.pcsel()).finish()
}
}
impl W {
#[inline(always)]
pub fn pcsel(&mut self) -> PCSEL_W<PCSELrs> {
PCSEL_W::new(self, 0)
}
}
pub struct PCSELrs;
impl crate::RegisterSpec for PCSELrs {
type Ux = u32;
}
impl crate::Readable for PCSELrs {}
impl crate::Writable for PCSELrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for PCSELrs {}