pub type R = crate::R<LFACLKSELrs>;
pub type W = crate::W<LFACLKSELrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum LFA {
Disabled = 0,
Lfrco = 1,
Lfxo = 2,
Ulfrco = 4,
}
impl From<LFA> for u8 {
#[inline(always)]
fn from(variant: LFA) -> Self {
variant as _
}
}
impl crate::FieldSpec for LFA {
type Ux = u8;
}
impl crate::IsEnum for LFA {}
pub type LfaR = crate::FieldReader<LFA>;
impl LfaR {
#[inline(always)]
pub const fn variant(&self) -> Option<LFA> {
match self.bits {
0 => Some(LFA::Disabled),
1 => Some(LFA::Lfrco),
2 => Some(LFA::Lfxo),
4 => Some(LFA::Ulfrco),
_ => None,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == LFA::Disabled
}
#[inline(always)]
pub fn is_lfrco(&self) -> bool {
*self == LFA::Lfrco
}
#[inline(always)]
pub fn is_lfxo(&self) -> bool {
*self == LFA::Lfxo
}
#[inline(always)]
pub fn is_ulfrco(&self) -> bool {
*self == LFA::Ulfrco
}
}
pub type LfaW<'a, REG> = crate::FieldWriter<'a, REG, 3, LFA>;
impl<'a, REG> LfaW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(LFA::Disabled)
}
#[inline(always)]
pub fn lfrco(self) -> &'a mut crate::W<REG> {
self.variant(LFA::Lfrco)
}
#[inline(always)]
pub fn lfxo(self) -> &'a mut crate::W<REG> {
self.variant(LFA::Lfxo)
}
#[inline(always)]
pub fn ulfrco(self) -> &'a mut crate::W<REG> {
self.variant(LFA::Ulfrco)
}
}
impl R {
#[inline(always)]
pub fn lfa(&self) -> LfaR {
LfaR::new((self.bits & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LFACLKSEL")
.field("lfa", &self.lfa())
.finish()
}
}
impl W {
#[inline(always)]
pub fn lfa(&mut self) -> LfaW<'_, LFACLKSELrs> {
LfaW::new(self, 0)
}
}
pub struct LFACLKSELrs;
impl crate::RegisterSpec for LFACLKSELrs {
type Ux = u32;
}
impl crate::Readable for LFACLKSELrs {}
impl crate::Writable for LFACLKSELrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for LFACLKSELrs {}