efm32pg1b_pac/cmu/
hfclkstatus.rs1pub type R = crate::R<HFCLKSTATUSrs>;
3#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum SELECTED {
10 Hfrco = 1,
12 Hfxo = 2,
14 Lfrco = 3,
16 Lfxo = 4,
18}
19impl From<SELECTED> for u8 {
20 #[inline(always)]
21 fn from(variant: SELECTED) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for SELECTED {
26 type Ux = u8;
27}
28impl crate::IsEnum for SELECTED {}
29pub type SelectedR = crate::FieldReader<SELECTED>;
31impl SelectedR {
32 #[inline(always)]
34 pub const fn variant(&self) -> Option<SELECTED> {
35 match self.bits {
36 1 => Some(SELECTED::Hfrco),
37 2 => Some(SELECTED::Hfxo),
38 3 => Some(SELECTED::Lfrco),
39 4 => Some(SELECTED::Lfxo),
40 _ => None,
41 }
42 }
43 #[inline(always)]
45 pub fn is_hfrco(&self) -> bool {
46 *self == SELECTED::Hfrco
47 }
48 #[inline(always)]
50 pub fn is_hfxo(&self) -> bool {
51 *self == SELECTED::Hfxo
52 }
53 #[inline(always)]
55 pub fn is_lfrco(&self) -> bool {
56 *self == SELECTED::Lfrco
57 }
58 #[inline(always)]
60 pub fn is_lfxo(&self) -> bool {
61 *self == SELECTED::Lfxo
62 }
63}
64impl R {
65 #[inline(always)]
67 pub fn selected(&self) -> SelectedR {
68 SelectedR::new((self.bits & 7) as u8)
69 }
70}
71impl core::fmt::Debug for R {
72 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
73 f.debug_struct("HFCLKSTATUS")
74 .field("selected", &self.selected())
75 .finish()
76 }
77}
78pub struct HFCLKSTATUSrs;
82impl crate::RegisterSpec for HFCLKSTATUSrs {
83 type Ux = u32;
84}
85impl crate::Readable for HFCLKSTATUSrs {}
87impl crate::Resettable for HFCLKSTATUSrs {
89 const RESET_VALUE: u32 = 0x01;
90}