efm32gg11b820_pac/cmu/
hfclksel.rs

1#[doc = "Register `HFCLKSEL` writer"]
2pub struct W(crate::W<HFCLKSEL_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<HFCLKSEL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl core::ops::DerefMut for W {
11    #[inline(always)]
12    fn deref_mut(&mut self) -> &mut Self::Target {
13        &mut self.0
14    }
15}
16impl From<crate::W<HFCLKSEL_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<HFCLKSEL_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "HFCLK Select\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24#[repr(u8)]
25pub enum HF_AW {
26    #[doc = "1: Select HFRCO as HFCLK"]
27    HFRCO = 1,
28    #[doc = "2: Select HFXO as HFCLK"]
29    HFXO = 2,
30    #[doc = "3: Select LFRCO as HFCLK"]
31    LFRCO = 3,
32    #[doc = "4: Select LFXO as HFCLK"]
33    LFXO = 4,
34    #[doc = "5: Select HFRCO divided by 2 as HFCLK"]
35    HFRCODIV2 = 5,
36    #[doc = "6: Select USHFRCO as HFCLK"]
37    USHFRCO = 6,
38    #[doc = "7: Select CLKIN0 as HFCLK"]
39    CLKIN0 = 7,
40}
41impl From<HF_AW> for u8 {
42    #[inline(always)]
43    fn from(variant: HF_AW) -> Self {
44        variant as _
45    }
46}
47#[doc = "Field `HF` writer - HFCLK Select"]
48pub type HF_W<'a> = crate::FieldWriter<'a, u32, HFCLKSEL_SPEC, u8, HF_AW, 3, 0>;
49impl<'a> HF_W<'a> {
50    #[doc = "Select HFRCO as HFCLK"]
51    #[inline(always)]
52    pub fn hfrco(self) -> &'a mut W {
53        self.variant(HF_AW::HFRCO)
54    }
55    #[doc = "Select HFXO as HFCLK"]
56    #[inline(always)]
57    pub fn hfxo(self) -> &'a mut W {
58        self.variant(HF_AW::HFXO)
59    }
60    #[doc = "Select LFRCO as HFCLK"]
61    #[inline(always)]
62    pub fn lfrco(self) -> &'a mut W {
63        self.variant(HF_AW::LFRCO)
64    }
65    #[doc = "Select LFXO as HFCLK"]
66    #[inline(always)]
67    pub fn lfxo(self) -> &'a mut W {
68        self.variant(HF_AW::LFXO)
69    }
70    #[doc = "Select HFRCO divided by 2 as HFCLK"]
71    #[inline(always)]
72    pub fn hfrcodiv2(self) -> &'a mut W {
73        self.variant(HF_AW::HFRCODIV2)
74    }
75    #[doc = "Select USHFRCO as HFCLK"]
76    #[inline(always)]
77    pub fn ushfrco(self) -> &'a mut W {
78        self.variant(HF_AW::USHFRCO)
79    }
80    #[doc = "Select CLKIN0 as HFCLK"]
81    #[inline(always)]
82    pub fn clkin0(self) -> &'a mut W {
83        self.variant(HF_AW::CLKIN0)
84    }
85}
86impl W {
87    #[doc = "Bits 0:2 - HFCLK Select"]
88    #[inline(always)]
89    pub fn hf(&mut self) -> HF_W {
90        HF_W::new(self)
91    }
92    #[doc = "Writes raw bits to the register."]
93    #[inline(always)]
94    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
95        self.0.bits(bits);
96        self
97    }
98}
99#[doc = "High Frequency Clock Select Command Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [hfclksel](index.html) module"]
100pub struct HFCLKSEL_SPEC;
101impl crate::RegisterSpec for HFCLKSEL_SPEC {
102    type Ux = u32;
103}
104#[doc = "`write(|w| ..)` method takes [hfclksel::W](W) writer structure"]
105impl crate::Writable for HFCLKSEL_SPEC {
106    type Writer = W;
107}
108#[doc = "`reset()` method sets HFCLKSEL to value 0"]
109impl crate::Resettable for HFCLKSEL_SPEC {
110    #[inline(always)]
111    fn reset_value() -> Self::Ux {
112        0
113    }
114}