efm32pg12_pac/cmu/
hfclksel.rs

1#[doc = "Writer for register HFCLKSEL"]
2pub type W = crate::W<u32, super::HFCLKSEL>;
3#[doc = "Register HFCLKSEL `reset()`'s with value 0"]
4impl crate::ResetValue for super::HFCLKSEL {
5    type Type = u32;
6    #[inline(always)]
7    fn reset_value() -> Self::Type {
8        0
9    }
10}
11#[doc = "HFCLK Select\n\nValue on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq)]
13#[repr(u8)]
14pub enum HF_AW {
15    #[doc = "1: Select HFRCO as HFCLK"]
16    HFRCO = 1,
17    #[doc = "2: Select HFXO as HFCLK"]
18    HFXO = 2,
19    #[doc = "3: Select LFRCO as HFCLK"]
20    LFRCO = 3,
21    #[doc = "4: Select LFXO as HFCLK"]
22    LFXO = 4,
23    #[doc = "5: Select HFRCO divided by 2 as HFCLK"]
24    HFRCODIV2 = 5,
25    #[doc = "7: Select CLKIN0 as HFCLK"]
26    CLKIN0 = 7,
27}
28impl From<HF_AW> for u8 {
29    #[inline(always)]
30    fn from(variant: HF_AW) -> Self {
31        variant as _
32    }
33}
34#[doc = "Write proxy for field `HF`"]
35pub struct HF_W<'a> {
36    w: &'a mut W,
37}
38impl<'a> HF_W<'a> {
39    #[doc = r"Writes `variant` to the field"]
40    #[inline(always)]
41    pub fn variant(self, variant: HF_AW) -> &'a mut W {
42        unsafe { self.bits(variant.into()) }
43    }
44    #[doc = "Select HFRCO as HFCLK"]
45    #[inline(always)]
46    pub fn hfrco(self) -> &'a mut W {
47        self.variant(HF_AW::HFRCO)
48    }
49    #[doc = "Select HFXO as HFCLK"]
50    #[inline(always)]
51    pub fn hfxo(self) -> &'a mut W {
52        self.variant(HF_AW::HFXO)
53    }
54    #[doc = "Select LFRCO as HFCLK"]
55    #[inline(always)]
56    pub fn lfrco(self) -> &'a mut W {
57        self.variant(HF_AW::LFRCO)
58    }
59    #[doc = "Select LFXO as HFCLK"]
60    #[inline(always)]
61    pub fn lfxo(self) -> &'a mut W {
62        self.variant(HF_AW::LFXO)
63    }
64    #[doc = "Select HFRCO divided by 2 as HFCLK"]
65    #[inline(always)]
66    pub fn hfrcodiv2(self) -> &'a mut W {
67        self.variant(HF_AW::HFRCODIV2)
68    }
69    #[doc = "Select CLKIN0 as HFCLK"]
70    #[inline(always)]
71    pub fn clkin0(self) -> &'a mut W {
72        self.variant(HF_AW::CLKIN0)
73    }
74    #[doc = r"Writes raw bits to the field"]
75    #[inline(always)]
76    pub unsafe fn bits(self, value: u8) -> &'a mut W {
77        self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07);
78        self.w
79    }
80}
81impl W {
82    #[doc = "Bits 0:2 - HFCLK Select"]
83    #[inline(always)]
84    pub fn hf(&mut self) -> HF_W {
85        HF_W { w: self }
86    }
87}