efm32gg330_pac/cmu/
cmd.rs

1#[doc = "Register `CMD` writer"]
2pub struct W(crate::W<CMD_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<CMD_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<CMD_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<CMD_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 HFCLKSEL_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}
35impl From<HFCLKSEL_AW> for u8 {
36    #[inline(always)]
37    fn from(variant: HFCLKSEL_AW) -> Self {
38        variant as _
39    }
40}
41#[doc = "Field `HFCLKSEL` writer - HFCLK Select"]
42pub type HFCLKSEL_W<'a> = crate::FieldWriter<'a, u32, CMD_SPEC, u8, HFCLKSEL_AW, 3, 0>;
43impl<'a> HFCLKSEL_W<'a> {
44    #[doc = "Select HFRCO as HFCLK."]
45    #[inline(always)]
46    pub fn hfrco(self) -> &'a mut W {
47        self.variant(HFCLKSEL_AW::HFRCO)
48    }
49    #[doc = "Select HFXO as HFCLK."]
50    #[inline(always)]
51    pub fn hfxo(self) -> &'a mut W {
52        self.variant(HFCLKSEL_AW::HFXO)
53    }
54    #[doc = "Select LFRCO as HFCLK."]
55    #[inline(always)]
56    pub fn lfrco(self) -> &'a mut W {
57        self.variant(HFCLKSEL_AW::LFRCO)
58    }
59    #[doc = "Select LFXO as HFCLK."]
60    #[inline(always)]
61    pub fn lfxo(self) -> &'a mut W {
62        self.variant(HFCLKSEL_AW::LFXO)
63    }
64}
65#[doc = "Field `CALSTART` writer - Calibration Start"]
66pub type CALSTART_W<'a> = crate::BitWriter<'a, u32, CMD_SPEC, bool, 3>;
67#[doc = "Field `CALSTOP` writer - Calibration Stop"]
68pub type CALSTOP_W<'a> = crate::BitWriter<'a, u32, CMD_SPEC, bool, 4>;
69#[doc = "USB Core Clock Select\n\nValue on reset: 0"]
70#[derive(Clone, Copy, Debug, PartialEq)]
71#[repr(u8)]
72pub enum USBCCLKSEL_AW {
73    #[doc = "1: Select HFCLK (undivided) as HFCORECLKUSBC."]
74    HFCLKNODIV = 1,
75    #[doc = "2: Select LFXO as HFCORECLKUSBC."]
76    LFXO = 2,
77    #[doc = "3: Select LFRCO as HFCORECLKUSBC."]
78    LFRCO = 3,
79}
80impl From<USBCCLKSEL_AW> for u8 {
81    #[inline(always)]
82    fn from(variant: USBCCLKSEL_AW) -> Self {
83        variant as _
84    }
85}
86#[doc = "Field `USBCCLKSEL` writer - USB Core Clock Select"]
87pub type USBCCLKSEL_W<'a> = crate::FieldWriter<'a, u32, CMD_SPEC, u8, USBCCLKSEL_AW, 3, 5>;
88impl<'a> USBCCLKSEL_W<'a> {
89    #[doc = "Select HFCLK (undivided) as HFCORECLKUSBC."]
90    #[inline(always)]
91    pub fn hfclknodiv(self) -> &'a mut W {
92        self.variant(USBCCLKSEL_AW::HFCLKNODIV)
93    }
94    #[doc = "Select LFXO as HFCORECLKUSBC."]
95    #[inline(always)]
96    pub fn lfxo(self) -> &'a mut W {
97        self.variant(USBCCLKSEL_AW::LFXO)
98    }
99    #[doc = "Select LFRCO as HFCORECLKUSBC."]
100    #[inline(always)]
101    pub fn lfrco(self) -> &'a mut W {
102        self.variant(USBCCLKSEL_AW::LFRCO)
103    }
104}
105impl W {
106    #[doc = "Bits 0:2 - HFCLK Select"]
107    #[inline(always)]
108    pub fn hfclksel(&mut self) -> HFCLKSEL_W {
109        HFCLKSEL_W::new(self)
110    }
111    #[doc = "Bit 3 - Calibration Start"]
112    #[inline(always)]
113    pub fn calstart(&mut self) -> CALSTART_W {
114        CALSTART_W::new(self)
115    }
116    #[doc = "Bit 4 - Calibration Stop"]
117    #[inline(always)]
118    pub fn calstop(&mut self) -> CALSTOP_W {
119        CALSTOP_W::new(self)
120    }
121    #[doc = "Bits 5:7 - USB Core Clock Select"]
122    #[inline(always)]
123    pub fn usbcclksel(&mut self) -> USBCCLKSEL_W {
124        USBCCLKSEL_W::new(self)
125    }
126    #[doc = "Writes raw bits to the register."]
127    #[inline(always)]
128    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
129        self.0.bits(bits);
130        self
131    }
132}
133#[doc = "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 [cmd](index.html) module"]
134pub struct CMD_SPEC;
135impl crate::RegisterSpec for CMD_SPEC {
136    type Ux = u32;
137}
138#[doc = "`write(|w| ..)` method takes [cmd::W](W) writer structure"]
139impl crate::Writable for CMD_SPEC {
140    type Writer = W;
141}
142#[doc = "`reset()` method sets CMD to value 0"]
143impl crate::Resettable for CMD_SPEC {
144    #[inline(always)]
145    fn reset_value() -> Self::Ux {
146        0
147    }
148}