efm32pg1b200_pac/cmu/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Clock Output Select 0\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum CLKOUTSEL0_A {
41    #[doc = "0: Disabled"]
42    DISABLED = 0,
43    #[doc = "1: ULFRCO (directly from oscillator)"]
44    ULFRCO = 1,
45    #[doc = "2: LFRCO (directly from oscillator)"]
46    LFRCO = 2,
47    #[doc = "3: LFXO (directly from oscillator)"]
48    LFXO = 3,
49    #[doc = "6: HFXO (directly from oscillator)"]
50    HFXO = 6,
51    #[doc = "7: HFEXPCLK"]
52    HFEXPCLK = 7,
53    #[doc = "9: ULFRCO (qualified)"]
54    ULFRCOQ = 9,
55    #[doc = "10: LFRCO (qualified)"]
56    LFRCOQ = 10,
57    #[doc = "11: LFXO (qualified)"]
58    LFXOQ = 11,
59    #[doc = "12: HFRCO (qualified)"]
60    HFRCOQ = 12,
61    #[doc = "13: AUXHFRCO (qualified)"]
62    AUXHFRCOQ = 13,
63    #[doc = "14: HFXO (qualified)"]
64    HFXOQ = 14,
65    #[doc = "15: HFSRCCLK"]
66    HFSRCCLK = 15,
67}
68impl From<CLKOUTSEL0_A> for u8 {
69    #[inline(always)]
70    fn from(variant: CLKOUTSEL0_A) -> Self {
71        variant as _
72    }
73}
74#[doc = "Field `CLKOUTSEL0` reader - Clock Output Select 0"]
75pub type CLKOUTSEL0_R = crate::FieldReader<u8, CLKOUTSEL0_A>;
76impl CLKOUTSEL0_R {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub fn variant(&self) -> Option<CLKOUTSEL0_A> {
80        match self.bits {
81            0 => Some(CLKOUTSEL0_A::DISABLED),
82            1 => Some(CLKOUTSEL0_A::ULFRCO),
83            2 => Some(CLKOUTSEL0_A::LFRCO),
84            3 => Some(CLKOUTSEL0_A::LFXO),
85            6 => Some(CLKOUTSEL0_A::HFXO),
86            7 => Some(CLKOUTSEL0_A::HFEXPCLK),
87            9 => Some(CLKOUTSEL0_A::ULFRCOQ),
88            10 => Some(CLKOUTSEL0_A::LFRCOQ),
89            11 => Some(CLKOUTSEL0_A::LFXOQ),
90            12 => Some(CLKOUTSEL0_A::HFRCOQ),
91            13 => Some(CLKOUTSEL0_A::AUXHFRCOQ),
92            14 => Some(CLKOUTSEL0_A::HFXOQ),
93            15 => Some(CLKOUTSEL0_A::HFSRCCLK),
94            _ => None,
95        }
96    }
97    #[doc = "Checks if the value of the field is `DISABLED`"]
98    #[inline(always)]
99    pub fn is_disabled(&self) -> bool {
100        *self == CLKOUTSEL0_A::DISABLED
101    }
102    #[doc = "Checks if the value of the field is `ULFRCO`"]
103    #[inline(always)]
104    pub fn is_ulfrco(&self) -> bool {
105        *self == CLKOUTSEL0_A::ULFRCO
106    }
107    #[doc = "Checks if the value of the field is `LFRCO`"]
108    #[inline(always)]
109    pub fn is_lfrco(&self) -> bool {
110        *self == CLKOUTSEL0_A::LFRCO
111    }
112    #[doc = "Checks if the value of the field is `LFXO`"]
113    #[inline(always)]
114    pub fn is_lfxo(&self) -> bool {
115        *self == CLKOUTSEL0_A::LFXO
116    }
117    #[doc = "Checks if the value of the field is `HFXO`"]
118    #[inline(always)]
119    pub fn is_hfxo(&self) -> bool {
120        *self == CLKOUTSEL0_A::HFXO
121    }
122    #[doc = "Checks if the value of the field is `HFEXPCLK`"]
123    #[inline(always)]
124    pub fn is_hfexpclk(&self) -> bool {
125        *self == CLKOUTSEL0_A::HFEXPCLK
126    }
127    #[doc = "Checks if the value of the field is `ULFRCOQ`"]
128    #[inline(always)]
129    pub fn is_ulfrcoq(&self) -> bool {
130        *self == CLKOUTSEL0_A::ULFRCOQ
131    }
132    #[doc = "Checks if the value of the field is `LFRCOQ`"]
133    #[inline(always)]
134    pub fn is_lfrcoq(&self) -> bool {
135        *self == CLKOUTSEL0_A::LFRCOQ
136    }
137    #[doc = "Checks if the value of the field is `LFXOQ`"]
138    #[inline(always)]
139    pub fn is_lfxoq(&self) -> bool {
140        *self == CLKOUTSEL0_A::LFXOQ
141    }
142    #[doc = "Checks if the value of the field is `HFRCOQ`"]
143    #[inline(always)]
144    pub fn is_hfrcoq(&self) -> bool {
145        *self == CLKOUTSEL0_A::HFRCOQ
146    }
147    #[doc = "Checks if the value of the field is `AUXHFRCOQ`"]
148    #[inline(always)]
149    pub fn is_auxhfrcoq(&self) -> bool {
150        *self == CLKOUTSEL0_A::AUXHFRCOQ
151    }
152    #[doc = "Checks if the value of the field is `HFXOQ`"]
153    #[inline(always)]
154    pub fn is_hfxoq(&self) -> bool {
155        *self == CLKOUTSEL0_A::HFXOQ
156    }
157    #[doc = "Checks if the value of the field is `HFSRCCLK`"]
158    #[inline(always)]
159    pub fn is_hfsrcclk(&self) -> bool {
160        *self == CLKOUTSEL0_A::HFSRCCLK
161    }
162}
163#[doc = "Field `CLKOUTSEL0` writer - Clock Output Select 0"]
164pub type CLKOUTSEL0_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKOUTSEL0_A, 4, 0>;
165impl<'a> CLKOUTSEL0_W<'a> {
166    #[doc = "Disabled"]
167    #[inline(always)]
168    pub fn disabled(self) -> &'a mut W {
169        self.variant(CLKOUTSEL0_A::DISABLED)
170    }
171    #[doc = "ULFRCO (directly from oscillator)"]
172    #[inline(always)]
173    pub fn ulfrco(self) -> &'a mut W {
174        self.variant(CLKOUTSEL0_A::ULFRCO)
175    }
176    #[doc = "LFRCO (directly from oscillator)"]
177    #[inline(always)]
178    pub fn lfrco(self) -> &'a mut W {
179        self.variant(CLKOUTSEL0_A::LFRCO)
180    }
181    #[doc = "LFXO (directly from oscillator)"]
182    #[inline(always)]
183    pub fn lfxo(self) -> &'a mut W {
184        self.variant(CLKOUTSEL0_A::LFXO)
185    }
186    #[doc = "HFXO (directly from oscillator)"]
187    #[inline(always)]
188    pub fn hfxo(self) -> &'a mut W {
189        self.variant(CLKOUTSEL0_A::HFXO)
190    }
191    #[doc = "HFEXPCLK"]
192    #[inline(always)]
193    pub fn hfexpclk(self) -> &'a mut W {
194        self.variant(CLKOUTSEL0_A::HFEXPCLK)
195    }
196    #[doc = "ULFRCO (qualified)"]
197    #[inline(always)]
198    pub fn ulfrcoq(self) -> &'a mut W {
199        self.variant(CLKOUTSEL0_A::ULFRCOQ)
200    }
201    #[doc = "LFRCO (qualified)"]
202    #[inline(always)]
203    pub fn lfrcoq(self) -> &'a mut W {
204        self.variant(CLKOUTSEL0_A::LFRCOQ)
205    }
206    #[doc = "LFXO (qualified)"]
207    #[inline(always)]
208    pub fn lfxoq(self) -> &'a mut W {
209        self.variant(CLKOUTSEL0_A::LFXOQ)
210    }
211    #[doc = "HFRCO (qualified)"]
212    #[inline(always)]
213    pub fn hfrcoq(self) -> &'a mut W {
214        self.variant(CLKOUTSEL0_A::HFRCOQ)
215    }
216    #[doc = "AUXHFRCO (qualified)"]
217    #[inline(always)]
218    pub fn auxhfrcoq(self) -> &'a mut W {
219        self.variant(CLKOUTSEL0_A::AUXHFRCOQ)
220    }
221    #[doc = "HFXO (qualified)"]
222    #[inline(always)]
223    pub fn hfxoq(self) -> &'a mut W {
224        self.variant(CLKOUTSEL0_A::HFXOQ)
225    }
226    #[doc = "HFSRCCLK"]
227    #[inline(always)]
228    pub fn hfsrcclk(self) -> &'a mut W {
229        self.variant(CLKOUTSEL0_A::HFSRCCLK)
230    }
231}
232#[doc = "Clock Output Select 1\n\nValue on reset: 0"]
233#[derive(Clone, Copy, Debug, PartialEq)]
234#[repr(u8)]
235pub enum CLKOUTSEL1_A {
236    #[doc = "0: Disabled"]
237    DISABLED = 0,
238    #[doc = "1: ULFRCO (directly from oscillator)"]
239    ULFRCO = 1,
240    #[doc = "2: LFRCO (directly from oscillator)"]
241    LFRCO = 2,
242    #[doc = "3: LFXO (directly from oscillator)"]
243    LFXO = 3,
244    #[doc = "6: HFXO (directly from oscillator)"]
245    HFXO = 6,
246    #[doc = "7: HFEXPCLK"]
247    HFEXPCLK = 7,
248    #[doc = "9: ULFRCO (qualified)"]
249    ULFRCOQ = 9,
250    #[doc = "10: LFRCO (qualified)"]
251    LFRCOQ = 10,
252    #[doc = "11: LFXO (qualified)"]
253    LFXOQ = 11,
254    #[doc = "12: HFRCO (qualified)"]
255    HFRCOQ = 12,
256    #[doc = "13: AUXHFRCO (qualified)"]
257    AUXHFRCOQ = 13,
258    #[doc = "14: HFXO (qualified)"]
259    HFXOQ = 14,
260    #[doc = "15: HFSRCCLK"]
261    HFSRCCLK = 15,
262}
263impl From<CLKOUTSEL1_A> for u8 {
264    #[inline(always)]
265    fn from(variant: CLKOUTSEL1_A) -> Self {
266        variant as _
267    }
268}
269#[doc = "Field `CLKOUTSEL1` reader - Clock Output Select 1"]
270pub type CLKOUTSEL1_R = crate::FieldReader<u8, CLKOUTSEL1_A>;
271impl CLKOUTSEL1_R {
272    #[doc = "Get enumerated values variant"]
273    #[inline(always)]
274    pub fn variant(&self) -> Option<CLKOUTSEL1_A> {
275        match self.bits {
276            0 => Some(CLKOUTSEL1_A::DISABLED),
277            1 => Some(CLKOUTSEL1_A::ULFRCO),
278            2 => Some(CLKOUTSEL1_A::LFRCO),
279            3 => Some(CLKOUTSEL1_A::LFXO),
280            6 => Some(CLKOUTSEL1_A::HFXO),
281            7 => Some(CLKOUTSEL1_A::HFEXPCLK),
282            9 => Some(CLKOUTSEL1_A::ULFRCOQ),
283            10 => Some(CLKOUTSEL1_A::LFRCOQ),
284            11 => Some(CLKOUTSEL1_A::LFXOQ),
285            12 => Some(CLKOUTSEL1_A::HFRCOQ),
286            13 => Some(CLKOUTSEL1_A::AUXHFRCOQ),
287            14 => Some(CLKOUTSEL1_A::HFXOQ),
288            15 => Some(CLKOUTSEL1_A::HFSRCCLK),
289            _ => None,
290        }
291    }
292    #[doc = "Checks if the value of the field is `DISABLED`"]
293    #[inline(always)]
294    pub fn is_disabled(&self) -> bool {
295        *self == CLKOUTSEL1_A::DISABLED
296    }
297    #[doc = "Checks if the value of the field is `ULFRCO`"]
298    #[inline(always)]
299    pub fn is_ulfrco(&self) -> bool {
300        *self == CLKOUTSEL1_A::ULFRCO
301    }
302    #[doc = "Checks if the value of the field is `LFRCO`"]
303    #[inline(always)]
304    pub fn is_lfrco(&self) -> bool {
305        *self == CLKOUTSEL1_A::LFRCO
306    }
307    #[doc = "Checks if the value of the field is `LFXO`"]
308    #[inline(always)]
309    pub fn is_lfxo(&self) -> bool {
310        *self == CLKOUTSEL1_A::LFXO
311    }
312    #[doc = "Checks if the value of the field is `HFXO`"]
313    #[inline(always)]
314    pub fn is_hfxo(&self) -> bool {
315        *self == CLKOUTSEL1_A::HFXO
316    }
317    #[doc = "Checks if the value of the field is `HFEXPCLK`"]
318    #[inline(always)]
319    pub fn is_hfexpclk(&self) -> bool {
320        *self == CLKOUTSEL1_A::HFEXPCLK
321    }
322    #[doc = "Checks if the value of the field is `ULFRCOQ`"]
323    #[inline(always)]
324    pub fn is_ulfrcoq(&self) -> bool {
325        *self == CLKOUTSEL1_A::ULFRCOQ
326    }
327    #[doc = "Checks if the value of the field is `LFRCOQ`"]
328    #[inline(always)]
329    pub fn is_lfrcoq(&self) -> bool {
330        *self == CLKOUTSEL1_A::LFRCOQ
331    }
332    #[doc = "Checks if the value of the field is `LFXOQ`"]
333    #[inline(always)]
334    pub fn is_lfxoq(&self) -> bool {
335        *self == CLKOUTSEL1_A::LFXOQ
336    }
337    #[doc = "Checks if the value of the field is `HFRCOQ`"]
338    #[inline(always)]
339    pub fn is_hfrcoq(&self) -> bool {
340        *self == CLKOUTSEL1_A::HFRCOQ
341    }
342    #[doc = "Checks if the value of the field is `AUXHFRCOQ`"]
343    #[inline(always)]
344    pub fn is_auxhfrcoq(&self) -> bool {
345        *self == CLKOUTSEL1_A::AUXHFRCOQ
346    }
347    #[doc = "Checks if the value of the field is `HFXOQ`"]
348    #[inline(always)]
349    pub fn is_hfxoq(&self) -> bool {
350        *self == CLKOUTSEL1_A::HFXOQ
351    }
352    #[doc = "Checks if the value of the field is `HFSRCCLK`"]
353    #[inline(always)]
354    pub fn is_hfsrcclk(&self) -> bool {
355        *self == CLKOUTSEL1_A::HFSRCCLK
356    }
357}
358#[doc = "Field `CLKOUTSEL1` writer - Clock Output Select 1"]
359pub type CLKOUTSEL1_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKOUTSEL1_A, 4, 5>;
360impl<'a> CLKOUTSEL1_W<'a> {
361    #[doc = "Disabled"]
362    #[inline(always)]
363    pub fn disabled(self) -> &'a mut W {
364        self.variant(CLKOUTSEL1_A::DISABLED)
365    }
366    #[doc = "ULFRCO (directly from oscillator)"]
367    #[inline(always)]
368    pub fn ulfrco(self) -> &'a mut W {
369        self.variant(CLKOUTSEL1_A::ULFRCO)
370    }
371    #[doc = "LFRCO (directly from oscillator)"]
372    #[inline(always)]
373    pub fn lfrco(self) -> &'a mut W {
374        self.variant(CLKOUTSEL1_A::LFRCO)
375    }
376    #[doc = "LFXO (directly from oscillator)"]
377    #[inline(always)]
378    pub fn lfxo(self) -> &'a mut W {
379        self.variant(CLKOUTSEL1_A::LFXO)
380    }
381    #[doc = "HFXO (directly from oscillator)"]
382    #[inline(always)]
383    pub fn hfxo(self) -> &'a mut W {
384        self.variant(CLKOUTSEL1_A::HFXO)
385    }
386    #[doc = "HFEXPCLK"]
387    #[inline(always)]
388    pub fn hfexpclk(self) -> &'a mut W {
389        self.variant(CLKOUTSEL1_A::HFEXPCLK)
390    }
391    #[doc = "ULFRCO (qualified)"]
392    #[inline(always)]
393    pub fn ulfrcoq(self) -> &'a mut W {
394        self.variant(CLKOUTSEL1_A::ULFRCOQ)
395    }
396    #[doc = "LFRCO (qualified)"]
397    #[inline(always)]
398    pub fn lfrcoq(self) -> &'a mut W {
399        self.variant(CLKOUTSEL1_A::LFRCOQ)
400    }
401    #[doc = "LFXO (qualified)"]
402    #[inline(always)]
403    pub fn lfxoq(self) -> &'a mut W {
404        self.variant(CLKOUTSEL1_A::LFXOQ)
405    }
406    #[doc = "HFRCO (qualified)"]
407    #[inline(always)]
408    pub fn hfrcoq(self) -> &'a mut W {
409        self.variant(CLKOUTSEL1_A::HFRCOQ)
410    }
411    #[doc = "AUXHFRCO (qualified)"]
412    #[inline(always)]
413    pub fn auxhfrcoq(self) -> &'a mut W {
414        self.variant(CLKOUTSEL1_A::AUXHFRCOQ)
415    }
416    #[doc = "HFXO (qualified)"]
417    #[inline(always)]
418    pub fn hfxoq(self) -> &'a mut W {
419        self.variant(CLKOUTSEL1_A::HFXOQ)
420    }
421    #[doc = "HFSRCCLK"]
422    #[inline(always)]
423    pub fn hfsrcclk(self) -> &'a mut W {
424        self.variant(CLKOUTSEL1_A::HFSRCCLK)
425    }
426}
427#[doc = "Field `WSHFLE` reader - Wait State for High-Frequency LE Interface"]
428pub type WSHFLE_R = crate::BitReader<bool>;
429#[doc = "Field `WSHFLE` writer - Wait State for High-Frequency LE Interface"]
430pub type WSHFLE_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 16>;
431#[doc = "Field `HFPERCLKEN` reader - HFPERCLK Enable"]
432pub type HFPERCLKEN_R = crate::BitReader<bool>;
433#[doc = "Field `HFPERCLKEN` writer - HFPERCLK Enable"]
434pub type HFPERCLKEN_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 20>;
435impl R {
436    #[doc = "Bits 0:3 - Clock Output Select 0"]
437    #[inline(always)]
438    pub fn clkoutsel0(&self) -> CLKOUTSEL0_R {
439        CLKOUTSEL0_R::new((self.bits & 0x0f) as u8)
440    }
441    #[doc = "Bits 5:8 - Clock Output Select 1"]
442    #[inline(always)]
443    pub fn clkoutsel1(&self) -> CLKOUTSEL1_R {
444        CLKOUTSEL1_R::new(((self.bits >> 5) & 0x0f) as u8)
445    }
446    #[doc = "Bit 16 - Wait State for High-Frequency LE Interface"]
447    #[inline(always)]
448    pub fn wshfle(&self) -> WSHFLE_R {
449        WSHFLE_R::new(((self.bits >> 16) & 1) != 0)
450    }
451    #[doc = "Bit 20 - HFPERCLK Enable"]
452    #[inline(always)]
453    pub fn hfperclken(&self) -> HFPERCLKEN_R {
454        HFPERCLKEN_R::new(((self.bits >> 20) & 1) != 0)
455    }
456}
457impl W {
458    #[doc = "Bits 0:3 - Clock Output Select 0"]
459    #[inline(always)]
460    pub fn clkoutsel0(&mut self) -> CLKOUTSEL0_W {
461        CLKOUTSEL0_W::new(self)
462    }
463    #[doc = "Bits 5:8 - Clock Output Select 1"]
464    #[inline(always)]
465    pub fn clkoutsel1(&mut self) -> CLKOUTSEL1_W {
466        CLKOUTSEL1_W::new(self)
467    }
468    #[doc = "Bit 16 - Wait State for High-Frequency LE Interface"]
469    #[inline(always)]
470    pub fn wshfle(&mut self) -> WSHFLE_W {
471        WSHFLE_W::new(self)
472    }
473    #[doc = "Bit 20 - HFPERCLK Enable"]
474    #[inline(always)]
475    pub fn hfperclken(&mut self) -> HFPERCLKEN_W {
476        HFPERCLKEN_W::new(self)
477    }
478    #[doc = "Writes raw bits to the register."]
479    #[inline(always)]
480    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
481        self.0.bits(bits);
482        self
483    }
484}
485#[doc = "CMU Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrl](index.html) module"]
486pub struct CTRL_SPEC;
487impl crate::RegisterSpec for CTRL_SPEC {
488    type Ux = u32;
489}
490#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
491impl crate::Readable for CTRL_SPEC {
492    type Reader = R;
493}
494#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
495impl crate::Writable for CTRL_SPEC {
496    type Writer = W;
497}
498#[doc = "`reset()` method sets CTRL to value 0x0030_0000"]
499impl crate::Resettable for CTRL_SPEC {
500    #[inline(always)]
501    fn reset_value() -> Self::Ux {
502        0x0030_0000
503    }
504}