pub type R = crate::R<CTRLrs>;
pub type W = crate::W<CTRLrs>;
pub type EnR = crate::BitReader;
pub type EnW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DebugrunR = crate::BitReader;
pub type DebugrunW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Em2runR = crate::BitReader;
pub type Em2runW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Em3runR = crate::BitReader;
pub type Em3runW<'a, REG> = crate::BitWriter<'a, REG>;
pub type LockR = crate::BitReader;
pub type LockW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Em4blockR = crate::BitReader;
pub type Em4blockW<'a, REG> = crate::BitWriter<'a, REG>;
pub type SwoscblockR = crate::BitReader;
pub type SwoscblockW<'a, REG> = crate::BitWriter<'a, REG>;
pub type PerselR = crate::FieldReader;
pub type PerselW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CLKSEL {
Ulfrco = 0,
Lfrco = 1,
Lfxo = 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::Ulfrco),
1 => Some(CLKSEL::Lfrco),
2 => Some(CLKSEL::Lfxo),
_ => None,
}
}
#[inline(always)]
pub fn is_ulfrco(&self) -> bool {
*self == CLKSEL::Ulfrco
}
#[inline(always)]
pub fn is_lfrco(&self) -> bool {
*self == CLKSEL::Lfrco
}
#[inline(always)]
pub fn is_lfxo(&self) -> bool {
*self == CLKSEL::Lfxo
}
}
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 ulfrco(self) -> &'a mut crate::W<REG> {
self.variant(CLKSEL::Ulfrco)
}
#[inline(always)]
pub fn lfrco(self) -> &'a mut crate::W<REG> {
self.variant(CLKSEL::Lfrco)
}
#[inline(always)]
pub fn lfxo(self) -> &'a mut crate::W<REG> {
self.variant(CLKSEL::Lfxo)
}
}
pub type WarnselR = crate::FieldReader;
pub type WarnselW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
pub type WinselR = crate::FieldReader;
pub type WinselW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
pub type ClrsrcR = crate::BitReader;
pub type ClrsrcW<'a, REG> = crate::BitWriter<'a, REG>;
pub type WdogrstdisR = crate::BitReader;
pub type WdogrstdisW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn en(&self) -> EnR {
EnR::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn debugrun(&self) -> DebugrunR {
DebugrunR::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn em2run(&self) -> Em2runR {
Em2runR::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn em3run(&self) -> Em3runR {
Em3runR::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn lock(&self) -> LockR {
LockR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn em4block(&self) -> Em4blockR {
Em4blockR::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn swoscblock(&self) -> SwoscblockR {
SwoscblockR::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn persel(&self) -> PerselR {
PerselR::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn clksel(&self) -> ClkselR {
ClkselR::new(((self.bits >> 12) & 3) as u8)
}
#[inline(always)]
pub fn warnsel(&self) -> WarnselR {
WarnselR::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn winsel(&self) -> WinselR {
WinselR::new(((self.bits >> 24) & 7) as u8)
}
#[inline(always)]
pub fn clrsrc(&self) -> ClrsrcR {
ClrsrcR::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn wdogrstdis(&self) -> WdogrstdisR {
WdogrstdisR::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL")
.field("en", &self.en())
.field("debugrun", &self.debugrun())
.field("em2run", &self.em2run())
.field("em3run", &self.em3run())
.field("lock", &self.lock())
.field("em4block", &self.em4block())
.field("swoscblock", &self.swoscblock())
.field("persel", &self.persel())
.field("clksel", &self.clksel())
.field("warnsel", &self.warnsel())
.field("winsel", &self.winsel())
.field("clrsrc", &self.clrsrc())
.field("wdogrstdis", &self.wdogrstdis())
.finish()
}
}
impl W {
#[inline(always)]
pub fn en(&mut self) -> EnW<'_, CTRLrs> {
EnW::new(self, 0)
}
#[inline(always)]
pub fn debugrun(&mut self) -> DebugrunW<'_, CTRLrs> {
DebugrunW::new(self, 1)
}
#[inline(always)]
pub fn em2run(&mut self) -> Em2runW<'_, CTRLrs> {
Em2runW::new(self, 2)
}
#[inline(always)]
pub fn em3run(&mut self) -> Em3runW<'_, CTRLrs> {
Em3runW::new(self, 3)
}
#[inline(always)]
pub fn lock(&mut self) -> LockW<'_, CTRLrs> {
LockW::new(self, 4)
}
#[inline(always)]
pub fn em4block(&mut self) -> Em4blockW<'_, CTRLrs> {
Em4blockW::new(self, 5)
}
#[inline(always)]
pub fn swoscblock(&mut self) -> SwoscblockW<'_, CTRLrs> {
SwoscblockW::new(self, 6)
}
#[inline(always)]
pub fn persel(&mut self) -> PerselW<'_, CTRLrs> {
PerselW::new(self, 8)
}
#[inline(always)]
pub fn clksel(&mut self) -> ClkselW<'_, CTRLrs> {
ClkselW::new(self, 12)
}
#[inline(always)]
pub fn warnsel(&mut self) -> WarnselW<'_, CTRLrs> {
WarnselW::new(self, 16)
}
#[inline(always)]
pub fn winsel(&mut self) -> WinselW<'_, CTRLrs> {
WinselW::new(self, 24)
}
#[inline(always)]
pub fn clrsrc(&mut self) -> ClrsrcW<'_, CTRLrs> {
ClrsrcW::new(self, 30)
}
#[inline(always)]
pub fn wdogrstdis(&mut self) -> WdogrstdisW<'_, CTRLrs> {
WdogrstdisW::new(self, 31)
}
}
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 {
const RESET_VALUE: u32 = 0x0f00;
}