efm32pg1b200_pac/cmu/
hfclkstatus.rs

1#[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}
29impl From<SELECTED_A> for u8 {
30    #[inline(always)]
31    fn from(variant: SELECTED_A) -> Self {
32        variant as _
33    }
34}
35#[doc = "Field `SELECTED` reader - HFCLK Selected"]
36pub type SELECTED_R = crate::FieldReader<u8, SELECTED_A>;
37impl SELECTED_R {
38    #[doc = "Get enumerated values variant"]
39    #[inline(always)]
40    pub fn variant(&self) -> Option<SELECTED_A> {
41        match self.bits {
42            1 => Some(SELECTED_A::HFRCO),
43            2 => Some(SELECTED_A::HFXO),
44            3 => Some(SELECTED_A::LFRCO),
45            4 => Some(SELECTED_A::LFXO),
46            _ => None,
47        }
48    }
49    #[doc = "Checks if the value of the field is `HFRCO`"]
50    #[inline(always)]
51    pub fn is_hfrco(&self) -> bool {
52        *self == SELECTED_A::HFRCO
53    }
54    #[doc = "Checks if the value of the field is `HFXO`"]
55    #[inline(always)]
56    pub fn is_hfxo(&self) -> bool {
57        *self == SELECTED_A::HFXO
58    }
59    #[doc = "Checks if the value of the field is `LFRCO`"]
60    #[inline(always)]
61    pub fn is_lfrco(&self) -> bool {
62        *self == SELECTED_A::LFRCO
63    }
64    #[doc = "Checks if the value of the field is `LFXO`"]
65    #[inline(always)]
66    pub fn is_lfxo(&self) -> bool {
67        *self == SELECTED_A::LFXO
68    }
69}
70impl R {
71    #[doc = "Bits 0:2 - HFCLK Selected"]
72    #[inline(always)]
73    pub fn selected(&self) -> SELECTED_R {
74        SELECTED_R::new((self.bits & 7) as u8)
75    }
76}
77#[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"]
78pub struct HFCLKSTATUS_SPEC;
79impl crate::RegisterSpec for HFCLKSTATUS_SPEC {
80    type Ux = u32;
81}
82#[doc = "`read()` method returns [hfclkstatus::R](R) reader structure"]
83impl crate::Readable for HFCLKSTATUS_SPEC {
84    type Reader = R;
85}
86#[doc = "`reset()` method sets HFCLKSTATUS to value 0x01"]
87impl crate::Resettable for HFCLKSTATUS_SPEC {
88    #[inline(always)]
89    fn reset_value() -> Self::Ux {
90        0x01
91    }
92}