pub type R = crate::R<HFCLKSTATUSrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SELECTED {
Hfrco = 1,
Hfxo = 2,
Lfrco = 3,
Lfxo = 4,
}
impl From<SELECTED> for u8 {
#[inline(always)]
fn from(variant: SELECTED) -> Self {
variant as _
}
}
impl crate::FieldSpec for SELECTED {
type Ux = u8;
}
impl crate::IsEnum for SELECTED {}
pub type SelectedR = crate::FieldReader<SELECTED>;
impl SelectedR {
#[inline(always)]
pub const fn variant(&self) -> Option<SELECTED> {
match self.bits {
1 => Some(SELECTED::Hfrco),
2 => Some(SELECTED::Hfxo),
3 => Some(SELECTED::Lfrco),
4 => Some(SELECTED::Lfxo),
_ => None,
}
}
#[inline(always)]
pub fn is_hfrco(&self) -> bool {
*self == SELECTED::Hfrco
}
#[inline(always)]
pub fn is_hfxo(&self) -> bool {
*self == SELECTED::Hfxo
}
#[inline(always)]
pub fn is_lfrco(&self) -> bool {
*self == SELECTED::Lfrco
}
#[inline(always)]
pub fn is_lfxo(&self) -> bool {
*self == SELECTED::Lfxo
}
}
impl R {
#[inline(always)]
pub fn selected(&self) -> SelectedR {
SelectedR::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("HFCLKSTATUS")
.field("selected", &self.selected())
.finish()
}
}
pub struct HFCLKSTATUSrs;
impl crate::RegisterSpec for HFCLKSTATUSrs {
type Ux = u32;
}
impl crate::Readable for HFCLKSTATUSrs {}
impl crate::Resettable for HFCLKSTATUSrs {
const RESET_VALUE: u32 = 0x01;
}