efm32jg12b_pac/efm32jg12b500/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 = "Field `CLKOUTSEL0` reader - Clock Output Select 0"]
38pub type CLKOUTSEL0_R = crate::FieldReader<u8, CLKOUTSEL0_A>;
39#[doc = "Clock Output Select 0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CLKOUTSEL0_A {
43    #[doc = "0: Disabled"]
44    DISABLED = 0,
45    #[doc = "1: ULFRCO (directly from oscillator)"]
46    ULFRCO = 1,
47    #[doc = "2: LFRCO (directly from oscillator)"]
48    LFRCO = 2,
49    #[doc = "3: LFXO (directly from oscillator)"]
50    LFXO = 3,
51    #[doc = "6: HFXO (directly from oscillator)"]
52    HFXO = 6,
53    #[doc = "7: HFEXPCLK"]
54    HFEXPCLK = 7,
55    #[doc = "9: ULFRCO (qualified)"]
56    ULFRCOQ = 9,
57    #[doc = "10: LFRCO (qualified)"]
58    LFRCOQ = 10,
59    #[doc = "11: LFXO (qualified)"]
60    LFXOQ = 11,
61    #[doc = "12: HFRCO (qualified)"]
62    HFRCOQ = 12,
63    #[doc = "13: AUXHFRCO (qualified)"]
64    AUXHFRCOQ = 13,
65    #[doc = "14: HFXO (qualified)"]
66    HFXOQ = 14,
67    #[doc = "15: HFSRCCLK"]
68    HFSRCCLK = 15,
69}
70impl From<CLKOUTSEL0_A> for u8 {
71    #[inline(always)]
72    fn from(variant: CLKOUTSEL0_A) -> Self {
73        variant as _
74    }
75}
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, const O: u8> =
165    crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKOUTSEL0_A, 4, O>;
166impl<'a, const O: u8> CLKOUTSEL0_W<'a, O> {
167    #[doc = "Disabled"]
168    #[inline(always)]
169    pub fn disabled(self) -> &'a mut W {
170        self.variant(CLKOUTSEL0_A::DISABLED)
171    }
172    #[doc = "ULFRCO (directly from oscillator)"]
173    #[inline(always)]
174    pub fn ulfrco(self) -> &'a mut W {
175        self.variant(CLKOUTSEL0_A::ULFRCO)
176    }
177    #[doc = "LFRCO (directly from oscillator)"]
178    #[inline(always)]
179    pub fn lfrco(self) -> &'a mut W {
180        self.variant(CLKOUTSEL0_A::LFRCO)
181    }
182    #[doc = "LFXO (directly from oscillator)"]
183    #[inline(always)]
184    pub fn lfxo(self) -> &'a mut W {
185        self.variant(CLKOUTSEL0_A::LFXO)
186    }
187    #[doc = "HFXO (directly from oscillator)"]
188    #[inline(always)]
189    pub fn hfxo(self) -> &'a mut W {
190        self.variant(CLKOUTSEL0_A::HFXO)
191    }
192    #[doc = "HFEXPCLK"]
193    #[inline(always)]
194    pub fn hfexpclk(self) -> &'a mut W {
195        self.variant(CLKOUTSEL0_A::HFEXPCLK)
196    }
197    #[doc = "ULFRCO (qualified)"]
198    #[inline(always)]
199    pub fn ulfrcoq(self) -> &'a mut W {
200        self.variant(CLKOUTSEL0_A::ULFRCOQ)
201    }
202    #[doc = "LFRCO (qualified)"]
203    #[inline(always)]
204    pub fn lfrcoq(self) -> &'a mut W {
205        self.variant(CLKOUTSEL0_A::LFRCOQ)
206    }
207    #[doc = "LFXO (qualified)"]
208    #[inline(always)]
209    pub fn lfxoq(self) -> &'a mut W {
210        self.variant(CLKOUTSEL0_A::LFXOQ)
211    }
212    #[doc = "HFRCO (qualified)"]
213    #[inline(always)]
214    pub fn hfrcoq(self) -> &'a mut W {
215        self.variant(CLKOUTSEL0_A::HFRCOQ)
216    }
217    #[doc = "AUXHFRCO (qualified)"]
218    #[inline(always)]
219    pub fn auxhfrcoq(self) -> &'a mut W {
220        self.variant(CLKOUTSEL0_A::AUXHFRCOQ)
221    }
222    #[doc = "HFXO (qualified)"]
223    #[inline(always)]
224    pub fn hfxoq(self) -> &'a mut W {
225        self.variant(CLKOUTSEL0_A::HFXOQ)
226    }
227    #[doc = "HFSRCCLK"]
228    #[inline(always)]
229    pub fn hfsrcclk(self) -> &'a mut W {
230        self.variant(CLKOUTSEL0_A::HFSRCCLK)
231    }
232}
233#[doc = "Field `CLKOUTSEL1` reader - Clock Output Select 1"]
234pub type CLKOUTSEL1_R = crate::FieldReader<u8, CLKOUTSEL1_A>;
235#[doc = "Clock Output Select 1\n\nValue on reset: 0"]
236#[derive(Clone, Copy, Debug, PartialEq, Eq)]
237#[repr(u8)]
238pub enum CLKOUTSEL1_A {
239    #[doc = "0: Disabled"]
240    DISABLED = 0,
241    #[doc = "1: ULFRCO (directly from oscillator)"]
242    ULFRCO = 1,
243    #[doc = "2: LFRCO (directly from oscillator)"]
244    LFRCO = 2,
245    #[doc = "3: LFXO (directly from oscillator)"]
246    LFXO = 3,
247    #[doc = "6: HFXO (directly from oscillator)"]
248    HFXO = 6,
249    #[doc = "7: HFEXPCLK"]
250    HFEXPCLK = 7,
251    #[doc = "9: ULFRCO (qualified)"]
252    ULFRCOQ = 9,
253    #[doc = "10: LFRCO (qualified)"]
254    LFRCOQ = 10,
255    #[doc = "11: LFXO (qualified)"]
256    LFXOQ = 11,
257    #[doc = "12: HFRCO (qualified)"]
258    HFRCOQ = 12,
259    #[doc = "13: AUXHFRCO (qualified)"]
260    AUXHFRCOQ = 13,
261    #[doc = "14: HFXO (qualified)"]
262    HFXOQ = 14,
263    #[doc = "15: HFSRCCLK"]
264    HFSRCCLK = 15,
265}
266impl From<CLKOUTSEL1_A> for u8 {
267    #[inline(always)]
268    fn from(variant: CLKOUTSEL1_A) -> Self {
269        variant as _
270    }
271}
272impl CLKOUTSEL1_R {
273    #[doc = "Get enumerated values variant"]
274    #[inline(always)]
275    pub fn variant(&self) -> Option<CLKOUTSEL1_A> {
276        match self.bits {
277            0 => Some(CLKOUTSEL1_A::DISABLED),
278            1 => Some(CLKOUTSEL1_A::ULFRCO),
279            2 => Some(CLKOUTSEL1_A::LFRCO),
280            3 => Some(CLKOUTSEL1_A::LFXO),
281            6 => Some(CLKOUTSEL1_A::HFXO),
282            7 => Some(CLKOUTSEL1_A::HFEXPCLK),
283            9 => Some(CLKOUTSEL1_A::ULFRCOQ),
284            10 => Some(CLKOUTSEL1_A::LFRCOQ),
285            11 => Some(CLKOUTSEL1_A::LFXOQ),
286            12 => Some(CLKOUTSEL1_A::HFRCOQ),
287            13 => Some(CLKOUTSEL1_A::AUXHFRCOQ),
288            14 => Some(CLKOUTSEL1_A::HFXOQ),
289            15 => Some(CLKOUTSEL1_A::HFSRCCLK),
290            _ => None,
291        }
292    }
293    #[doc = "Checks if the value of the field is `DISABLED`"]
294    #[inline(always)]
295    pub fn is_disabled(&self) -> bool {
296        *self == CLKOUTSEL1_A::DISABLED
297    }
298    #[doc = "Checks if the value of the field is `ULFRCO`"]
299    #[inline(always)]
300    pub fn is_ulfrco(&self) -> bool {
301        *self == CLKOUTSEL1_A::ULFRCO
302    }
303    #[doc = "Checks if the value of the field is `LFRCO`"]
304    #[inline(always)]
305    pub fn is_lfrco(&self) -> bool {
306        *self == CLKOUTSEL1_A::LFRCO
307    }
308    #[doc = "Checks if the value of the field is `LFXO`"]
309    #[inline(always)]
310    pub fn is_lfxo(&self) -> bool {
311        *self == CLKOUTSEL1_A::LFXO
312    }
313    #[doc = "Checks if the value of the field is `HFXO`"]
314    #[inline(always)]
315    pub fn is_hfxo(&self) -> bool {
316        *self == CLKOUTSEL1_A::HFXO
317    }
318    #[doc = "Checks if the value of the field is `HFEXPCLK`"]
319    #[inline(always)]
320    pub fn is_hfexpclk(&self) -> bool {
321        *self == CLKOUTSEL1_A::HFEXPCLK
322    }
323    #[doc = "Checks if the value of the field is `ULFRCOQ`"]
324    #[inline(always)]
325    pub fn is_ulfrcoq(&self) -> bool {
326        *self == CLKOUTSEL1_A::ULFRCOQ
327    }
328    #[doc = "Checks if the value of the field is `LFRCOQ`"]
329    #[inline(always)]
330    pub fn is_lfrcoq(&self) -> bool {
331        *self == CLKOUTSEL1_A::LFRCOQ
332    }
333    #[doc = "Checks if the value of the field is `LFXOQ`"]
334    #[inline(always)]
335    pub fn is_lfxoq(&self) -> bool {
336        *self == CLKOUTSEL1_A::LFXOQ
337    }
338    #[doc = "Checks if the value of the field is `HFRCOQ`"]
339    #[inline(always)]
340    pub fn is_hfrcoq(&self) -> bool {
341        *self == CLKOUTSEL1_A::HFRCOQ
342    }
343    #[doc = "Checks if the value of the field is `AUXHFRCOQ`"]
344    #[inline(always)]
345    pub fn is_auxhfrcoq(&self) -> bool {
346        *self == CLKOUTSEL1_A::AUXHFRCOQ
347    }
348    #[doc = "Checks if the value of the field is `HFXOQ`"]
349    #[inline(always)]
350    pub fn is_hfxoq(&self) -> bool {
351        *self == CLKOUTSEL1_A::HFXOQ
352    }
353    #[doc = "Checks if the value of the field is `HFSRCCLK`"]
354    #[inline(always)]
355    pub fn is_hfsrcclk(&self) -> bool {
356        *self == CLKOUTSEL1_A::HFSRCCLK
357    }
358}
359#[doc = "Field `CLKOUTSEL1` writer - Clock Output Select 1"]
360pub type CLKOUTSEL1_W<'a, const O: u8> =
361    crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKOUTSEL1_A, 4, O>;
362impl<'a, const O: u8> CLKOUTSEL1_W<'a, O> {
363    #[doc = "Disabled"]
364    #[inline(always)]
365    pub fn disabled(self) -> &'a mut W {
366        self.variant(CLKOUTSEL1_A::DISABLED)
367    }
368    #[doc = "ULFRCO (directly from oscillator)"]
369    #[inline(always)]
370    pub fn ulfrco(self) -> &'a mut W {
371        self.variant(CLKOUTSEL1_A::ULFRCO)
372    }
373    #[doc = "LFRCO (directly from oscillator)"]
374    #[inline(always)]
375    pub fn lfrco(self) -> &'a mut W {
376        self.variant(CLKOUTSEL1_A::LFRCO)
377    }
378    #[doc = "LFXO (directly from oscillator)"]
379    #[inline(always)]
380    pub fn lfxo(self) -> &'a mut W {
381        self.variant(CLKOUTSEL1_A::LFXO)
382    }
383    #[doc = "HFXO (directly from oscillator)"]
384    #[inline(always)]
385    pub fn hfxo(self) -> &'a mut W {
386        self.variant(CLKOUTSEL1_A::HFXO)
387    }
388    #[doc = "HFEXPCLK"]
389    #[inline(always)]
390    pub fn hfexpclk(self) -> &'a mut W {
391        self.variant(CLKOUTSEL1_A::HFEXPCLK)
392    }
393    #[doc = "ULFRCO (qualified)"]
394    #[inline(always)]
395    pub fn ulfrcoq(self) -> &'a mut W {
396        self.variant(CLKOUTSEL1_A::ULFRCOQ)
397    }
398    #[doc = "LFRCO (qualified)"]
399    #[inline(always)]
400    pub fn lfrcoq(self) -> &'a mut W {
401        self.variant(CLKOUTSEL1_A::LFRCOQ)
402    }
403    #[doc = "LFXO (qualified)"]
404    #[inline(always)]
405    pub fn lfxoq(self) -> &'a mut W {
406        self.variant(CLKOUTSEL1_A::LFXOQ)
407    }
408    #[doc = "HFRCO (qualified)"]
409    #[inline(always)]
410    pub fn hfrcoq(self) -> &'a mut W {
411        self.variant(CLKOUTSEL1_A::HFRCOQ)
412    }
413    #[doc = "AUXHFRCO (qualified)"]
414    #[inline(always)]
415    pub fn auxhfrcoq(self) -> &'a mut W {
416        self.variant(CLKOUTSEL1_A::AUXHFRCOQ)
417    }
418    #[doc = "HFXO (qualified)"]
419    #[inline(always)]
420    pub fn hfxoq(self) -> &'a mut W {
421        self.variant(CLKOUTSEL1_A::HFXOQ)
422    }
423    #[doc = "HFSRCCLK"]
424    #[inline(always)]
425    pub fn hfsrcclk(self) -> &'a mut W {
426        self.variant(CLKOUTSEL1_A::HFSRCCLK)
427    }
428}
429#[doc = "Field `WSHFLE` reader - Wait State for High-Frequency LE Interface"]
430pub type WSHFLE_R = crate::BitReader<bool>;
431#[doc = "Field `WSHFLE` writer - Wait State for High-Frequency LE Interface"]
432pub type WSHFLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
433#[doc = "Field `HFPERCLKEN` reader - HFPERCLK Enable"]
434pub type HFPERCLKEN_R = crate::BitReader<bool>;
435#[doc = "Field `HFPERCLKEN` writer - HFPERCLK Enable"]
436pub type HFPERCLKEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
437impl R {
438    #[doc = "Bits 0:3 - Clock Output Select 0"]
439    #[inline(always)]
440    pub fn clkoutsel0(&self) -> CLKOUTSEL0_R {
441        CLKOUTSEL0_R::new((self.bits & 0x0f) as u8)
442    }
443    #[doc = "Bits 5:8 - Clock Output Select 1"]
444    #[inline(always)]
445    pub fn clkoutsel1(&self) -> CLKOUTSEL1_R {
446        CLKOUTSEL1_R::new(((self.bits >> 5) & 0x0f) as u8)
447    }
448    #[doc = "Bit 16 - Wait State for High-Frequency LE Interface"]
449    #[inline(always)]
450    pub fn wshfle(&self) -> WSHFLE_R {
451        WSHFLE_R::new(((self.bits >> 16) & 1) != 0)
452    }
453    #[doc = "Bit 20 - HFPERCLK Enable"]
454    #[inline(always)]
455    pub fn hfperclken(&self) -> HFPERCLKEN_R {
456        HFPERCLKEN_R::new(((self.bits >> 20) & 1) != 0)
457    }
458}
459impl W {
460    #[doc = "Bits 0:3 - Clock Output Select 0"]
461    #[inline(always)]
462    #[must_use]
463    pub fn clkoutsel0(&mut self) -> CLKOUTSEL0_W<0> {
464        CLKOUTSEL0_W::new(self)
465    }
466    #[doc = "Bits 5:8 - Clock Output Select 1"]
467    #[inline(always)]
468    #[must_use]
469    pub fn clkoutsel1(&mut self) -> CLKOUTSEL1_W<5> {
470        CLKOUTSEL1_W::new(self)
471    }
472    #[doc = "Bit 16 - Wait State for High-Frequency LE Interface"]
473    #[inline(always)]
474    #[must_use]
475    pub fn wshfle(&mut self) -> WSHFLE_W<16> {
476        WSHFLE_W::new(self)
477    }
478    #[doc = "Bit 20 - HFPERCLK Enable"]
479    #[inline(always)]
480    #[must_use]
481    pub fn hfperclken(&mut self) -> HFPERCLKEN_W<20> {
482        HFPERCLKEN_W::new(self)
483    }
484    #[doc = "Writes raw bits to the register."]
485    #[inline(always)]
486    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
487        self.0.bits(bits);
488        self
489    }
490}
491#[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"]
492pub struct CTRL_SPEC;
493impl crate::RegisterSpec for CTRL_SPEC {
494    type Ux = u32;
495}
496#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
497impl crate::Readable for CTRL_SPEC {
498    type Reader = R;
499}
500#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
501impl crate::Writable for CTRL_SPEC {
502    type Writer = W;
503    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
504    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
505}
506#[doc = "`reset()` method sets CTRL to value 0x0030_0000"]
507impl crate::Resettable for CTRL_SPEC {
508    const RESET_VALUE: Self::Ux = 0x0030_0000;
509}