efm32tg222_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 = "HFXO Mode\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum HFXOMODE_A {
41    #[doc = "0: 4-32 MHz crystal oscillator."]
42    XTAL = 0,
43    #[doc = "1: An AC coupled buffer is coupled in series with HFXTAL_N, suitable for external sine wave (4-32 MHz). The sine wave should have a minimum of 200 mV peak to peak."]
44    BUFEXTCLK = 1,
45    #[doc = "2: Digital external clock on HFXTAL_N pin. Oscillator is effectively bypassed."]
46    DIGEXTCLK = 2,
47}
48impl From<HFXOMODE_A> for u8 {
49    #[inline(always)]
50    fn from(variant: HFXOMODE_A) -> Self {
51        variant as _
52    }
53}
54#[doc = "Field `HFXOMODE` reader - HFXO Mode"]
55pub type HFXOMODE_R = crate::FieldReader<u8, HFXOMODE_A>;
56impl HFXOMODE_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<HFXOMODE_A> {
60        match self.bits {
61            0 => Some(HFXOMODE_A::XTAL),
62            1 => Some(HFXOMODE_A::BUFEXTCLK),
63            2 => Some(HFXOMODE_A::DIGEXTCLK),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `XTAL`"]
68    #[inline(always)]
69    pub fn is_xtal(&self) -> bool {
70        *self == HFXOMODE_A::XTAL
71    }
72    #[doc = "Checks if the value of the field is `BUFEXTCLK`"]
73    #[inline(always)]
74    pub fn is_bufextclk(&self) -> bool {
75        *self == HFXOMODE_A::BUFEXTCLK
76    }
77    #[doc = "Checks if the value of the field is `DIGEXTCLK`"]
78    #[inline(always)]
79    pub fn is_digextclk(&self) -> bool {
80        *self == HFXOMODE_A::DIGEXTCLK
81    }
82}
83#[doc = "Field `HFXOMODE` writer - HFXO Mode"]
84pub type HFXOMODE_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, HFXOMODE_A, 2, 0>;
85impl<'a> HFXOMODE_W<'a> {
86    #[doc = "4-32 MHz crystal oscillator."]
87    #[inline(always)]
88    pub fn xtal(self) -> &'a mut W {
89        self.variant(HFXOMODE_A::XTAL)
90    }
91    #[doc = "An AC coupled buffer is coupled in series with HFXTAL_N, suitable for external sine wave (4-32 MHz). The sine wave should have a minimum of 200 mV peak to peak."]
92    #[inline(always)]
93    pub fn bufextclk(self) -> &'a mut W {
94        self.variant(HFXOMODE_A::BUFEXTCLK)
95    }
96    #[doc = "Digital external clock on HFXTAL_N pin. Oscillator is effectively bypassed."]
97    #[inline(always)]
98    pub fn digextclk(self) -> &'a mut W {
99        self.variant(HFXOMODE_A::DIGEXTCLK)
100    }
101}
102#[doc = "HFXO Start-up Boost Current\n\nValue on reset: 3"]
103#[derive(Clone, Copy, Debug, PartialEq)]
104#[repr(u8)]
105pub enum HFXOBOOST_A {
106    #[doc = "0: 50 %."]
107    _50PCENT = 0,
108    #[doc = "1: 70 %."]
109    _70PCENT = 1,
110    #[doc = "2: 80 %."]
111    _80PCENT = 2,
112    #[doc = "3: 100 % (default)."]
113    _100PCENT = 3,
114}
115impl From<HFXOBOOST_A> for u8 {
116    #[inline(always)]
117    fn from(variant: HFXOBOOST_A) -> Self {
118        variant as _
119    }
120}
121#[doc = "Field `HFXOBOOST` reader - HFXO Start-up Boost Current"]
122pub type HFXOBOOST_R = crate::FieldReader<u8, HFXOBOOST_A>;
123impl HFXOBOOST_R {
124    #[doc = "Get enumerated values variant"]
125    #[inline(always)]
126    pub fn variant(&self) -> HFXOBOOST_A {
127        match self.bits {
128            0 => HFXOBOOST_A::_50PCENT,
129            1 => HFXOBOOST_A::_70PCENT,
130            2 => HFXOBOOST_A::_80PCENT,
131            3 => HFXOBOOST_A::_100PCENT,
132            _ => unreachable!(),
133        }
134    }
135    #[doc = "Checks if the value of the field is `_50PCENT`"]
136    #[inline(always)]
137    pub fn is_50pcent(&self) -> bool {
138        *self == HFXOBOOST_A::_50PCENT
139    }
140    #[doc = "Checks if the value of the field is `_70PCENT`"]
141    #[inline(always)]
142    pub fn is_70pcent(&self) -> bool {
143        *self == HFXOBOOST_A::_70PCENT
144    }
145    #[doc = "Checks if the value of the field is `_80PCENT`"]
146    #[inline(always)]
147    pub fn is_80pcent(&self) -> bool {
148        *self == HFXOBOOST_A::_80PCENT
149    }
150    #[doc = "Checks if the value of the field is `_100PCENT`"]
151    #[inline(always)]
152    pub fn is_100pcent(&self) -> bool {
153        *self == HFXOBOOST_A::_100PCENT
154    }
155}
156#[doc = "Field `HFXOBOOST` writer - HFXO Start-up Boost Current"]
157pub type HFXOBOOST_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, HFXOBOOST_A, 2, 2>;
158impl<'a> HFXOBOOST_W<'a> {
159    #[doc = "50 %."]
160    #[inline(always)]
161    pub fn _50pcent(self) -> &'a mut W {
162        self.variant(HFXOBOOST_A::_50PCENT)
163    }
164    #[doc = "70 %."]
165    #[inline(always)]
166    pub fn _70pcent(self) -> &'a mut W {
167        self.variant(HFXOBOOST_A::_70PCENT)
168    }
169    #[doc = "80 %."]
170    #[inline(always)]
171    pub fn _80pcent(self) -> &'a mut W {
172        self.variant(HFXOBOOST_A::_80PCENT)
173    }
174    #[doc = "100 % (default)."]
175    #[inline(always)]
176    pub fn _100pcent(self) -> &'a mut W {
177        self.variant(HFXOBOOST_A::_100PCENT)
178    }
179}
180#[doc = "Field `HFXOBUFCUR` reader - HFXO Boost Buffer Current"]
181pub type HFXOBUFCUR_R = crate::FieldReader<u8, u8>;
182#[doc = "Field `HFXOBUFCUR` writer - HFXO Boost Buffer Current"]
183pub type HFXOBUFCUR_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 2, 5>;
184#[doc = "Field `HFXOGLITCHDETEN` reader - HFXO Glitch Detector Enable"]
185pub type HFXOGLITCHDETEN_R = crate::BitReader<bool>;
186#[doc = "Field `HFXOGLITCHDETEN` writer - HFXO Glitch Detector Enable"]
187pub type HFXOGLITCHDETEN_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 7>;
188#[doc = "HFXO Timeout\n\nValue on reset: 3"]
189#[derive(Clone, Copy, Debug, PartialEq)]
190#[repr(u8)]
191pub enum HFXOTIMEOUT_A {
192    #[doc = "0: Timeout period of 8 cycles."]
193    _8CYCLES = 0,
194    #[doc = "1: Timeout period of 256 cycles."]
195    _256CYCLES = 1,
196    #[doc = "2: Timeout period of 1024 cycles."]
197    _1KCYCLES = 2,
198    #[doc = "3: Timeout period of 16384 cycles."]
199    _16KCYCLES = 3,
200}
201impl From<HFXOTIMEOUT_A> for u8 {
202    #[inline(always)]
203    fn from(variant: HFXOTIMEOUT_A) -> Self {
204        variant as _
205    }
206}
207#[doc = "Field `HFXOTIMEOUT` reader - HFXO Timeout"]
208pub type HFXOTIMEOUT_R = crate::FieldReader<u8, HFXOTIMEOUT_A>;
209impl HFXOTIMEOUT_R {
210    #[doc = "Get enumerated values variant"]
211    #[inline(always)]
212    pub fn variant(&self) -> HFXOTIMEOUT_A {
213        match self.bits {
214            0 => HFXOTIMEOUT_A::_8CYCLES,
215            1 => HFXOTIMEOUT_A::_256CYCLES,
216            2 => HFXOTIMEOUT_A::_1KCYCLES,
217            3 => HFXOTIMEOUT_A::_16KCYCLES,
218            _ => unreachable!(),
219        }
220    }
221    #[doc = "Checks if the value of the field is `_8CYCLES`"]
222    #[inline(always)]
223    pub fn is_8cycles(&self) -> bool {
224        *self == HFXOTIMEOUT_A::_8CYCLES
225    }
226    #[doc = "Checks if the value of the field is `_256CYCLES`"]
227    #[inline(always)]
228    pub fn is_256cycles(&self) -> bool {
229        *self == HFXOTIMEOUT_A::_256CYCLES
230    }
231    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
232    #[inline(always)]
233    pub fn is_1kcycles(&self) -> bool {
234        *self == HFXOTIMEOUT_A::_1KCYCLES
235    }
236    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
237    #[inline(always)]
238    pub fn is_16kcycles(&self) -> bool {
239        *self == HFXOTIMEOUT_A::_16KCYCLES
240    }
241}
242#[doc = "Field `HFXOTIMEOUT` writer - HFXO Timeout"]
243pub type HFXOTIMEOUT_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, HFXOTIMEOUT_A, 2, 9>;
244impl<'a> HFXOTIMEOUT_W<'a> {
245    #[doc = "Timeout period of 8 cycles."]
246    #[inline(always)]
247    pub fn _8cycles(self) -> &'a mut W {
248        self.variant(HFXOTIMEOUT_A::_8CYCLES)
249    }
250    #[doc = "Timeout period of 256 cycles."]
251    #[inline(always)]
252    pub fn _256cycles(self) -> &'a mut W {
253        self.variant(HFXOTIMEOUT_A::_256CYCLES)
254    }
255    #[doc = "Timeout period of 1024 cycles."]
256    #[inline(always)]
257    pub fn _1kcycles(self) -> &'a mut W {
258        self.variant(HFXOTIMEOUT_A::_1KCYCLES)
259    }
260    #[doc = "Timeout period of 16384 cycles."]
261    #[inline(always)]
262    pub fn _16kcycles(self) -> &'a mut W {
263        self.variant(HFXOTIMEOUT_A::_16KCYCLES)
264    }
265}
266#[doc = "LFXO Mode\n\nValue on reset: 0"]
267#[derive(Clone, Copy, Debug, PartialEq)]
268#[repr(u8)]
269pub enum LFXOMODE_A {
270    #[doc = "0: 32.768 kHz crystal oscillator."]
271    XTAL = 0,
272    #[doc = "1: An AC coupled buffer is coupled in series with LFXTAL_N pin, suitable for external sinus wave (32.768 kHz)."]
273    BUFEXTCLK = 1,
274    #[doc = "2: Digital external clock on LFXTAL_N pin. Oscillator is effectively bypassed."]
275    DIGEXTCLK = 2,
276}
277impl From<LFXOMODE_A> for u8 {
278    #[inline(always)]
279    fn from(variant: LFXOMODE_A) -> Self {
280        variant as _
281    }
282}
283#[doc = "Field `LFXOMODE` reader - LFXO Mode"]
284pub type LFXOMODE_R = crate::FieldReader<u8, LFXOMODE_A>;
285impl LFXOMODE_R {
286    #[doc = "Get enumerated values variant"]
287    #[inline(always)]
288    pub fn variant(&self) -> Option<LFXOMODE_A> {
289        match self.bits {
290            0 => Some(LFXOMODE_A::XTAL),
291            1 => Some(LFXOMODE_A::BUFEXTCLK),
292            2 => Some(LFXOMODE_A::DIGEXTCLK),
293            _ => None,
294        }
295    }
296    #[doc = "Checks if the value of the field is `XTAL`"]
297    #[inline(always)]
298    pub fn is_xtal(&self) -> bool {
299        *self == LFXOMODE_A::XTAL
300    }
301    #[doc = "Checks if the value of the field is `BUFEXTCLK`"]
302    #[inline(always)]
303    pub fn is_bufextclk(&self) -> bool {
304        *self == LFXOMODE_A::BUFEXTCLK
305    }
306    #[doc = "Checks if the value of the field is `DIGEXTCLK`"]
307    #[inline(always)]
308    pub fn is_digextclk(&self) -> bool {
309        *self == LFXOMODE_A::DIGEXTCLK
310    }
311}
312#[doc = "Field `LFXOMODE` writer - LFXO Mode"]
313pub type LFXOMODE_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, LFXOMODE_A, 2, 11>;
314impl<'a> LFXOMODE_W<'a> {
315    #[doc = "32.768 kHz crystal oscillator."]
316    #[inline(always)]
317    pub fn xtal(self) -> &'a mut W {
318        self.variant(LFXOMODE_A::XTAL)
319    }
320    #[doc = "An AC coupled buffer is coupled in series with LFXTAL_N pin, suitable for external sinus wave (32.768 kHz)."]
321    #[inline(always)]
322    pub fn bufextclk(self) -> &'a mut W {
323        self.variant(LFXOMODE_A::BUFEXTCLK)
324    }
325    #[doc = "Digital external clock on LFXTAL_N pin. Oscillator is effectively bypassed."]
326    #[inline(always)]
327    pub fn digextclk(self) -> &'a mut W {
328        self.variant(LFXOMODE_A::DIGEXTCLK)
329    }
330}
331#[doc = "Field `LFXOBOOST` reader - LFXO Start-up Boost Current"]
332pub type LFXOBOOST_R = crate::BitReader<bool>;
333#[doc = "Field `LFXOBOOST` writer - LFXO Start-up Boost Current"]
334pub type LFXOBOOST_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 13>;
335#[doc = "Field `LFXOBUFCUR` reader - LFXO Boost Buffer Current"]
336pub type LFXOBUFCUR_R = crate::BitReader<bool>;
337#[doc = "Field `LFXOBUFCUR` writer - LFXO Boost Buffer Current"]
338pub type LFXOBUFCUR_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 17>;
339#[doc = "LFXO Timeout\n\nValue on reset: 3"]
340#[derive(Clone, Copy, Debug, PartialEq)]
341#[repr(u8)]
342pub enum LFXOTIMEOUT_A {
343    #[doc = "0: Timeout period of 8 cycles."]
344    _8CYCLES = 0,
345    #[doc = "1: Timeout period of 1024 cycles."]
346    _1KCYCLES = 1,
347    #[doc = "2: Timeout period of 16384 cycles."]
348    _16KCYCLES = 2,
349    #[doc = "3: Timeout period of 32768 cycles."]
350    _32KCYCLES = 3,
351}
352impl From<LFXOTIMEOUT_A> for u8 {
353    #[inline(always)]
354    fn from(variant: LFXOTIMEOUT_A) -> Self {
355        variant as _
356    }
357}
358#[doc = "Field `LFXOTIMEOUT` reader - LFXO Timeout"]
359pub type LFXOTIMEOUT_R = crate::FieldReader<u8, LFXOTIMEOUT_A>;
360impl LFXOTIMEOUT_R {
361    #[doc = "Get enumerated values variant"]
362    #[inline(always)]
363    pub fn variant(&self) -> LFXOTIMEOUT_A {
364        match self.bits {
365            0 => LFXOTIMEOUT_A::_8CYCLES,
366            1 => LFXOTIMEOUT_A::_1KCYCLES,
367            2 => LFXOTIMEOUT_A::_16KCYCLES,
368            3 => LFXOTIMEOUT_A::_32KCYCLES,
369            _ => unreachable!(),
370        }
371    }
372    #[doc = "Checks if the value of the field is `_8CYCLES`"]
373    #[inline(always)]
374    pub fn is_8cycles(&self) -> bool {
375        *self == LFXOTIMEOUT_A::_8CYCLES
376    }
377    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
378    #[inline(always)]
379    pub fn is_1kcycles(&self) -> bool {
380        *self == LFXOTIMEOUT_A::_1KCYCLES
381    }
382    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
383    #[inline(always)]
384    pub fn is_16kcycles(&self) -> bool {
385        *self == LFXOTIMEOUT_A::_16KCYCLES
386    }
387    #[doc = "Checks if the value of the field is `_32KCYCLES`"]
388    #[inline(always)]
389    pub fn is_32kcycles(&self) -> bool {
390        *self == LFXOTIMEOUT_A::_32KCYCLES
391    }
392}
393#[doc = "Field `LFXOTIMEOUT` writer - LFXO Timeout"]
394pub type LFXOTIMEOUT_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, LFXOTIMEOUT_A, 2, 18>;
395impl<'a> LFXOTIMEOUT_W<'a> {
396    #[doc = "Timeout period of 8 cycles."]
397    #[inline(always)]
398    pub fn _8cycles(self) -> &'a mut W {
399        self.variant(LFXOTIMEOUT_A::_8CYCLES)
400    }
401    #[doc = "Timeout period of 1024 cycles."]
402    #[inline(always)]
403    pub fn _1kcycles(self) -> &'a mut W {
404        self.variant(LFXOTIMEOUT_A::_1KCYCLES)
405    }
406    #[doc = "Timeout period of 16384 cycles."]
407    #[inline(always)]
408    pub fn _16kcycles(self) -> &'a mut W {
409        self.variant(LFXOTIMEOUT_A::_16KCYCLES)
410    }
411    #[doc = "Timeout period of 32768 cycles."]
412    #[inline(always)]
413    pub fn _32kcycles(self) -> &'a mut W {
414        self.variant(LFXOTIMEOUT_A::_32KCYCLES)
415    }
416}
417#[doc = "Clock Output Select 0\n\nValue on reset: 0"]
418#[derive(Clone, Copy, Debug, PartialEq)]
419#[repr(u8)]
420pub enum CLKOUTSEL0_A {
421    #[doc = "0: HFRCO (directly from oscillator)."]
422    HFRCO = 0,
423    #[doc = "1: HFXO (directly from oscillator)."]
424    HFXO = 1,
425    #[doc = "2: HFCLK/2."]
426    HFCLK2 = 2,
427    #[doc = "3: HFCLK/4."]
428    HFCLK4 = 3,
429    #[doc = "4: HFCLK/8."]
430    HFCLK8 = 4,
431    #[doc = "5: HFCLK/16."]
432    HFCLK16 = 5,
433    #[doc = "6: ULFRCO (directly from oscillator)."]
434    ULFRCO = 6,
435    #[doc = "7: AUXHFRCO (directly from oscillator)."]
436    AUXHFRCO = 7,
437}
438impl From<CLKOUTSEL0_A> for u8 {
439    #[inline(always)]
440    fn from(variant: CLKOUTSEL0_A) -> Self {
441        variant as _
442    }
443}
444#[doc = "Field `CLKOUTSEL0` reader - Clock Output Select 0"]
445pub type CLKOUTSEL0_R = crate::FieldReader<u8, CLKOUTSEL0_A>;
446impl CLKOUTSEL0_R {
447    #[doc = "Get enumerated values variant"]
448    #[inline(always)]
449    pub fn variant(&self) -> CLKOUTSEL0_A {
450        match self.bits {
451            0 => CLKOUTSEL0_A::HFRCO,
452            1 => CLKOUTSEL0_A::HFXO,
453            2 => CLKOUTSEL0_A::HFCLK2,
454            3 => CLKOUTSEL0_A::HFCLK4,
455            4 => CLKOUTSEL0_A::HFCLK8,
456            5 => CLKOUTSEL0_A::HFCLK16,
457            6 => CLKOUTSEL0_A::ULFRCO,
458            7 => CLKOUTSEL0_A::AUXHFRCO,
459            _ => unreachable!(),
460        }
461    }
462    #[doc = "Checks if the value of the field is `HFRCO`"]
463    #[inline(always)]
464    pub fn is_hfrco(&self) -> bool {
465        *self == CLKOUTSEL0_A::HFRCO
466    }
467    #[doc = "Checks if the value of the field is `HFXO`"]
468    #[inline(always)]
469    pub fn is_hfxo(&self) -> bool {
470        *self == CLKOUTSEL0_A::HFXO
471    }
472    #[doc = "Checks if the value of the field is `HFCLK2`"]
473    #[inline(always)]
474    pub fn is_hfclk2(&self) -> bool {
475        *self == CLKOUTSEL0_A::HFCLK2
476    }
477    #[doc = "Checks if the value of the field is `HFCLK4`"]
478    #[inline(always)]
479    pub fn is_hfclk4(&self) -> bool {
480        *self == CLKOUTSEL0_A::HFCLK4
481    }
482    #[doc = "Checks if the value of the field is `HFCLK8`"]
483    #[inline(always)]
484    pub fn is_hfclk8(&self) -> bool {
485        *self == CLKOUTSEL0_A::HFCLK8
486    }
487    #[doc = "Checks if the value of the field is `HFCLK16`"]
488    #[inline(always)]
489    pub fn is_hfclk16(&self) -> bool {
490        *self == CLKOUTSEL0_A::HFCLK16
491    }
492    #[doc = "Checks if the value of the field is `ULFRCO`"]
493    #[inline(always)]
494    pub fn is_ulfrco(&self) -> bool {
495        *self == CLKOUTSEL0_A::ULFRCO
496    }
497    #[doc = "Checks if the value of the field is `AUXHFRCO`"]
498    #[inline(always)]
499    pub fn is_auxhfrco(&self) -> bool {
500        *self == CLKOUTSEL0_A::AUXHFRCO
501    }
502}
503#[doc = "Field `CLKOUTSEL0` writer - Clock Output Select 0"]
504pub type CLKOUTSEL0_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, CLKOUTSEL0_A, 3, 20>;
505impl<'a> CLKOUTSEL0_W<'a> {
506    #[doc = "HFRCO (directly from oscillator)."]
507    #[inline(always)]
508    pub fn hfrco(self) -> &'a mut W {
509        self.variant(CLKOUTSEL0_A::HFRCO)
510    }
511    #[doc = "HFXO (directly from oscillator)."]
512    #[inline(always)]
513    pub fn hfxo(self) -> &'a mut W {
514        self.variant(CLKOUTSEL0_A::HFXO)
515    }
516    #[doc = "HFCLK/2."]
517    #[inline(always)]
518    pub fn hfclk2(self) -> &'a mut W {
519        self.variant(CLKOUTSEL0_A::HFCLK2)
520    }
521    #[doc = "HFCLK/4."]
522    #[inline(always)]
523    pub fn hfclk4(self) -> &'a mut W {
524        self.variant(CLKOUTSEL0_A::HFCLK4)
525    }
526    #[doc = "HFCLK/8."]
527    #[inline(always)]
528    pub fn hfclk8(self) -> &'a mut W {
529        self.variant(CLKOUTSEL0_A::HFCLK8)
530    }
531    #[doc = "HFCLK/16."]
532    #[inline(always)]
533    pub fn hfclk16(self) -> &'a mut W {
534        self.variant(CLKOUTSEL0_A::HFCLK16)
535    }
536    #[doc = "ULFRCO (directly from oscillator)."]
537    #[inline(always)]
538    pub fn ulfrco(self) -> &'a mut W {
539        self.variant(CLKOUTSEL0_A::ULFRCO)
540    }
541    #[doc = "AUXHFRCO (directly from oscillator)."]
542    #[inline(always)]
543    pub fn auxhfrco(self) -> &'a mut W {
544        self.variant(CLKOUTSEL0_A::AUXHFRCO)
545    }
546}
547#[doc = "Clock Output Select 1\n\nValue on reset: 0"]
548#[derive(Clone, Copy, Debug, PartialEq)]
549#[repr(u8)]
550pub enum CLKOUTSEL1_A {
551    #[doc = "0: LFRCO (directly from oscillator)."]
552    LFRCO = 0,
553    #[doc = "1: LFXO (directly from oscillator)."]
554    LFXO = 1,
555    #[doc = "2: HFCLK."]
556    HFCLK = 2,
557    #[doc = "3: LFXO (qualified)."]
558    LFXOQ = 3,
559    #[doc = "4: HFXO (qualified)."]
560    HFXOQ = 4,
561    #[doc = "5: LFRCO (qualified)."]
562    LFRCOQ = 5,
563    #[doc = "6: HFRCO (qualified)."]
564    HFRCOQ = 6,
565    #[doc = "7: AUXHFRCO (qualified)."]
566    AUXHFRCOQ = 7,
567}
568impl From<CLKOUTSEL1_A> for u8 {
569    #[inline(always)]
570    fn from(variant: CLKOUTSEL1_A) -> Self {
571        variant as _
572    }
573}
574#[doc = "Field `CLKOUTSEL1` reader - Clock Output Select 1"]
575pub type CLKOUTSEL1_R = crate::FieldReader<u8, CLKOUTSEL1_A>;
576impl CLKOUTSEL1_R {
577    #[doc = "Get enumerated values variant"]
578    #[inline(always)]
579    pub fn variant(&self) -> Option<CLKOUTSEL1_A> {
580        match self.bits {
581            0 => Some(CLKOUTSEL1_A::LFRCO),
582            1 => Some(CLKOUTSEL1_A::LFXO),
583            2 => Some(CLKOUTSEL1_A::HFCLK),
584            3 => Some(CLKOUTSEL1_A::LFXOQ),
585            4 => Some(CLKOUTSEL1_A::HFXOQ),
586            5 => Some(CLKOUTSEL1_A::LFRCOQ),
587            6 => Some(CLKOUTSEL1_A::HFRCOQ),
588            7 => Some(CLKOUTSEL1_A::AUXHFRCOQ),
589            _ => None,
590        }
591    }
592    #[doc = "Checks if the value of the field is `LFRCO`"]
593    #[inline(always)]
594    pub fn is_lfrco(&self) -> bool {
595        *self == CLKOUTSEL1_A::LFRCO
596    }
597    #[doc = "Checks if the value of the field is `LFXO`"]
598    #[inline(always)]
599    pub fn is_lfxo(&self) -> bool {
600        *self == CLKOUTSEL1_A::LFXO
601    }
602    #[doc = "Checks if the value of the field is `HFCLK`"]
603    #[inline(always)]
604    pub fn is_hfclk(&self) -> bool {
605        *self == CLKOUTSEL1_A::HFCLK
606    }
607    #[doc = "Checks if the value of the field is `LFXOQ`"]
608    #[inline(always)]
609    pub fn is_lfxoq(&self) -> bool {
610        *self == CLKOUTSEL1_A::LFXOQ
611    }
612    #[doc = "Checks if the value of the field is `HFXOQ`"]
613    #[inline(always)]
614    pub fn is_hfxoq(&self) -> bool {
615        *self == CLKOUTSEL1_A::HFXOQ
616    }
617    #[doc = "Checks if the value of the field is `LFRCOQ`"]
618    #[inline(always)]
619    pub fn is_lfrcoq(&self) -> bool {
620        *self == CLKOUTSEL1_A::LFRCOQ
621    }
622    #[doc = "Checks if the value of the field is `HFRCOQ`"]
623    #[inline(always)]
624    pub fn is_hfrcoq(&self) -> bool {
625        *self == CLKOUTSEL1_A::HFRCOQ
626    }
627    #[doc = "Checks if the value of the field is `AUXHFRCOQ`"]
628    #[inline(always)]
629    pub fn is_auxhfrcoq(&self) -> bool {
630        *self == CLKOUTSEL1_A::AUXHFRCOQ
631    }
632}
633#[doc = "Field `CLKOUTSEL1` writer - Clock Output Select 1"]
634pub type CLKOUTSEL1_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKOUTSEL1_A, 4, 23>;
635impl<'a> CLKOUTSEL1_W<'a> {
636    #[doc = "LFRCO (directly from oscillator)."]
637    #[inline(always)]
638    pub fn lfrco(self) -> &'a mut W {
639        self.variant(CLKOUTSEL1_A::LFRCO)
640    }
641    #[doc = "LFXO (directly from oscillator)."]
642    #[inline(always)]
643    pub fn lfxo(self) -> &'a mut W {
644        self.variant(CLKOUTSEL1_A::LFXO)
645    }
646    #[doc = "HFCLK."]
647    #[inline(always)]
648    pub fn hfclk(self) -> &'a mut W {
649        self.variant(CLKOUTSEL1_A::HFCLK)
650    }
651    #[doc = "LFXO (qualified)."]
652    #[inline(always)]
653    pub fn lfxoq(self) -> &'a mut W {
654        self.variant(CLKOUTSEL1_A::LFXOQ)
655    }
656    #[doc = "HFXO (qualified)."]
657    #[inline(always)]
658    pub fn hfxoq(self) -> &'a mut W {
659        self.variant(CLKOUTSEL1_A::HFXOQ)
660    }
661    #[doc = "LFRCO (qualified)."]
662    #[inline(always)]
663    pub fn lfrcoq(self) -> &'a mut W {
664        self.variant(CLKOUTSEL1_A::LFRCOQ)
665    }
666    #[doc = "HFRCO (qualified)."]
667    #[inline(always)]
668    pub fn hfrcoq(self) -> &'a mut W {
669        self.variant(CLKOUTSEL1_A::HFRCOQ)
670    }
671    #[doc = "AUXHFRCO (qualified)."]
672    #[inline(always)]
673    pub fn auxhfrcoq(self) -> &'a mut W {
674        self.variant(CLKOUTSEL1_A::AUXHFRCOQ)
675    }
676}
677#[doc = "Field `DBGCLK` reader - Debug Clock"]
678pub type DBGCLK_R = crate::BitReader<bool>;
679#[doc = "Field `DBGCLK` writer - Debug Clock"]
680pub type DBGCLK_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 28>;
681impl R {
682    #[doc = "Bits 0:1 - HFXO Mode"]
683    #[inline(always)]
684    pub fn hfxomode(&self) -> HFXOMODE_R {
685        HFXOMODE_R::new((self.bits & 3) as u8)
686    }
687    #[doc = "Bits 2:3 - HFXO Start-up Boost Current"]
688    #[inline(always)]
689    pub fn hfxoboost(&self) -> HFXOBOOST_R {
690        HFXOBOOST_R::new(((self.bits >> 2) & 3) as u8)
691    }
692    #[doc = "Bits 5:6 - HFXO Boost Buffer Current"]
693    #[inline(always)]
694    pub fn hfxobufcur(&self) -> HFXOBUFCUR_R {
695        HFXOBUFCUR_R::new(((self.bits >> 5) & 3) as u8)
696    }
697    #[doc = "Bit 7 - HFXO Glitch Detector Enable"]
698    #[inline(always)]
699    pub fn hfxoglitchdeten(&self) -> HFXOGLITCHDETEN_R {
700        HFXOGLITCHDETEN_R::new(((self.bits >> 7) & 1) != 0)
701    }
702    #[doc = "Bits 9:10 - HFXO Timeout"]
703    #[inline(always)]
704    pub fn hfxotimeout(&self) -> HFXOTIMEOUT_R {
705        HFXOTIMEOUT_R::new(((self.bits >> 9) & 3) as u8)
706    }
707    #[doc = "Bits 11:12 - LFXO Mode"]
708    #[inline(always)]
709    pub fn lfxomode(&self) -> LFXOMODE_R {
710        LFXOMODE_R::new(((self.bits >> 11) & 3) as u8)
711    }
712    #[doc = "Bit 13 - LFXO Start-up Boost Current"]
713    #[inline(always)]
714    pub fn lfxoboost(&self) -> LFXOBOOST_R {
715        LFXOBOOST_R::new(((self.bits >> 13) & 1) != 0)
716    }
717    #[doc = "Bit 17 - LFXO Boost Buffer Current"]
718    #[inline(always)]
719    pub fn lfxobufcur(&self) -> LFXOBUFCUR_R {
720        LFXOBUFCUR_R::new(((self.bits >> 17) & 1) != 0)
721    }
722    #[doc = "Bits 18:19 - LFXO Timeout"]
723    #[inline(always)]
724    pub fn lfxotimeout(&self) -> LFXOTIMEOUT_R {
725        LFXOTIMEOUT_R::new(((self.bits >> 18) & 3) as u8)
726    }
727    #[doc = "Bits 20:22 - Clock Output Select 0"]
728    #[inline(always)]
729    pub fn clkoutsel0(&self) -> CLKOUTSEL0_R {
730        CLKOUTSEL0_R::new(((self.bits >> 20) & 7) as u8)
731    }
732    #[doc = "Bits 23:26 - Clock Output Select 1"]
733    #[inline(always)]
734    pub fn clkoutsel1(&self) -> CLKOUTSEL1_R {
735        CLKOUTSEL1_R::new(((self.bits >> 23) & 0x0f) as u8)
736    }
737    #[doc = "Bit 28 - Debug Clock"]
738    #[inline(always)]
739    pub fn dbgclk(&self) -> DBGCLK_R {
740        DBGCLK_R::new(((self.bits >> 28) & 1) != 0)
741    }
742}
743impl W {
744    #[doc = "Bits 0:1 - HFXO Mode"]
745    #[inline(always)]
746    pub fn hfxomode(&mut self) -> HFXOMODE_W {
747        HFXOMODE_W::new(self)
748    }
749    #[doc = "Bits 2:3 - HFXO Start-up Boost Current"]
750    #[inline(always)]
751    pub fn hfxoboost(&mut self) -> HFXOBOOST_W {
752        HFXOBOOST_W::new(self)
753    }
754    #[doc = "Bits 5:6 - HFXO Boost Buffer Current"]
755    #[inline(always)]
756    pub fn hfxobufcur(&mut self) -> HFXOBUFCUR_W {
757        HFXOBUFCUR_W::new(self)
758    }
759    #[doc = "Bit 7 - HFXO Glitch Detector Enable"]
760    #[inline(always)]
761    pub fn hfxoglitchdeten(&mut self) -> HFXOGLITCHDETEN_W {
762        HFXOGLITCHDETEN_W::new(self)
763    }
764    #[doc = "Bits 9:10 - HFXO Timeout"]
765    #[inline(always)]
766    pub fn hfxotimeout(&mut self) -> HFXOTIMEOUT_W {
767        HFXOTIMEOUT_W::new(self)
768    }
769    #[doc = "Bits 11:12 - LFXO Mode"]
770    #[inline(always)]
771    pub fn lfxomode(&mut self) -> LFXOMODE_W {
772        LFXOMODE_W::new(self)
773    }
774    #[doc = "Bit 13 - LFXO Start-up Boost Current"]
775    #[inline(always)]
776    pub fn lfxoboost(&mut self) -> LFXOBOOST_W {
777        LFXOBOOST_W::new(self)
778    }
779    #[doc = "Bit 17 - LFXO Boost Buffer Current"]
780    #[inline(always)]
781    pub fn lfxobufcur(&mut self) -> LFXOBUFCUR_W {
782        LFXOBUFCUR_W::new(self)
783    }
784    #[doc = "Bits 18:19 - LFXO Timeout"]
785    #[inline(always)]
786    pub fn lfxotimeout(&mut self) -> LFXOTIMEOUT_W {
787        LFXOTIMEOUT_W::new(self)
788    }
789    #[doc = "Bits 20:22 - Clock Output Select 0"]
790    #[inline(always)]
791    pub fn clkoutsel0(&mut self) -> CLKOUTSEL0_W {
792        CLKOUTSEL0_W::new(self)
793    }
794    #[doc = "Bits 23:26 - Clock Output Select 1"]
795    #[inline(always)]
796    pub fn clkoutsel1(&mut self) -> CLKOUTSEL1_W {
797        CLKOUTSEL1_W::new(self)
798    }
799    #[doc = "Bit 28 - Debug Clock"]
800    #[inline(always)]
801    pub fn dbgclk(&mut self) -> DBGCLK_W {
802        DBGCLK_W::new(self)
803    }
804    #[doc = "Writes raw bits to the register."]
805    #[inline(always)]
806    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
807        self.0.bits(bits);
808        self
809    }
810}
811#[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"]
812pub struct CTRL_SPEC;
813impl crate::RegisterSpec for CTRL_SPEC {
814    type Ux = u32;
815}
816#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
817impl crate::Readable for CTRL_SPEC {
818    type Reader = R;
819}
820#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
821impl crate::Writable for CTRL_SPEC {
822    type Writer = W;
823}
824#[doc = "`reset()` method sets CTRL to value 0x000c_262c"]
825impl crate::Resettable for CTRL_SPEC {
826    #[inline(always)]
827    fn reset_value() -> Self::Ux {
828        0x000c_262c
829    }
830}