efm32tg11b540_pac/cmu/
hfclkstatus.rs1#[doc = "Register `HFCLKSTATUS` reader"]
2pub struct R(crate::R<HFCLKSTATUS_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<HFCLKSTATUS_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<HFCLKSTATUS_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<HFCLKSTATUS_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "HFCLK Selected\n\nValue on reset: 1"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18#[repr(u8)]
19pub enum SELECTED_A {
20 #[doc = "1: HFRCO is selected as HFCLK clock source"]
21 HFRCO = 1,
22 #[doc = "2: HFXO is selected as HFCLK clock source"]
23 HFXO = 2,
24 #[doc = "3: LFRCO is selected as HFCLK clock source"]
25 LFRCO = 3,
26 #[doc = "4: LFXO is selected as HFCLK clock source"]
27 LFXO = 4,
28 #[doc = "5: HFRCO divided by 2 is selected as HFCLK clock source"]
29 HFRCODIV2 = 5,
30 #[doc = "7: CLKIN0 is selected as HFCLK clock source"]
31 CLKIN0 = 7,
32}
33impl From<SELECTED_A> for u8 {
34 #[inline(always)]
35 fn from(variant: SELECTED_A) -> Self {
36 variant as _
37 }
38}
39#[doc = "Field `SELECTED` reader - HFCLK Selected"]
40pub type SELECTED_R = crate::FieldReader<u8, SELECTED_A>;
41impl SELECTED_R {
42 #[doc = "Get enumerated values variant"]
43 #[inline(always)]
44 pub fn variant(&self) -> Option<SELECTED_A> {
45 match self.bits {
46 1 => Some(SELECTED_A::HFRCO),
47 2 => Some(SELECTED_A::HFXO),
48 3 => Some(SELECTED_A::LFRCO),
49 4 => Some(SELECTED_A::LFXO),
50 5 => Some(SELECTED_A::HFRCODIV2),
51 7 => Some(SELECTED_A::CLKIN0),
52 _ => None,
53 }
54 }
55 #[doc = "Checks if the value of the field is `HFRCO`"]
56 #[inline(always)]
57 pub fn is_hfrco(&self) -> bool {
58 *self == SELECTED_A::HFRCO
59 }
60 #[doc = "Checks if the value of the field is `HFXO`"]
61 #[inline(always)]
62 pub fn is_hfxo(&self) -> bool {
63 *self == SELECTED_A::HFXO
64 }
65 #[doc = "Checks if the value of the field is `LFRCO`"]
66 #[inline(always)]
67 pub fn is_lfrco(&self) -> bool {
68 *self == SELECTED_A::LFRCO
69 }
70 #[doc = "Checks if the value of the field is `LFXO`"]
71 #[inline(always)]
72 pub fn is_lfxo(&self) -> bool {
73 *self == SELECTED_A::LFXO
74 }
75 #[doc = "Checks if the value of the field is `HFRCODIV2`"]
76 #[inline(always)]
77 pub fn is_hfrcodiv2(&self) -> bool {
78 *self == SELECTED_A::HFRCODIV2
79 }
80 #[doc = "Checks if the value of the field is `CLKIN0`"]
81 #[inline(always)]
82 pub fn is_clkin0(&self) -> bool {
83 *self == SELECTED_A::CLKIN0
84 }
85}
86impl R {
87 #[doc = "Bits 0:2 - HFCLK Selected"]
88 #[inline(always)]
89 pub fn selected(&self) -> SELECTED_R {
90 SELECTED_R::new((self.bits & 7) as u8)
91 }
92}
93#[doc = "HFCLK Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [hfclkstatus](index.html) module"]
94pub struct HFCLKSTATUS_SPEC;
95impl crate::RegisterSpec for HFCLKSTATUS_SPEC {
96 type Ux = u32;
97}
98#[doc = "`read()` method returns [hfclkstatus::R](R) reader structure"]
99impl crate::Readable for HFCLKSTATUS_SPEC {
100 type Reader = R;
101}
102#[doc = "`reset()` method sets HFCLKSTATUS to value 0x01"]
103impl crate::Resettable for HFCLKSTATUS_SPEC {
104 #[inline(always)]
105 fn reset_value() -> Self::Ux {
106 0x01
107 }
108}