efm32wg230_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-48 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-48 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-48 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-48 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 = "HFXO Boost Buffer Current\n\nValue on reset: 1"]
181#[derive(Clone, Copy, Debug, PartialEq)]
182#[repr(u8)]
183pub enum HFXOBUFCUR_A {
184    #[doc = "1: Boost Buffer Current level when HFXO is below or equal to 32 MHz."]
185    BOOSTUPTO32MHZ = 1,
186    #[doc = "3: Boost Buffer Current Level when HFXO is above 32 MHz."]
187    BOOSTABOVE32MHZ = 3,
188}
189impl From<HFXOBUFCUR_A> for u8 {
190    #[inline(always)]
191    fn from(variant: HFXOBUFCUR_A) -> Self {
192        variant as _
193    }
194}
195#[doc = "Field `HFXOBUFCUR` reader - HFXO Boost Buffer Current"]
196pub type HFXOBUFCUR_R = crate::FieldReader<u8, HFXOBUFCUR_A>;
197impl HFXOBUFCUR_R {
198    #[doc = "Get enumerated values variant"]
199    #[inline(always)]
200    pub fn variant(&self) -> Option<HFXOBUFCUR_A> {
201        match self.bits {
202            1 => Some(HFXOBUFCUR_A::BOOSTUPTO32MHZ),
203            3 => Some(HFXOBUFCUR_A::BOOSTABOVE32MHZ),
204            _ => None,
205        }
206    }
207    #[doc = "Checks if the value of the field is `BOOSTUPTO32MHZ`"]
208    #[inline(always)]
209    pub fn is_boostupto32mhz(&self) -> bool {
210        *self == HFXOBUFCUR_A::BOOSTUPTO32MHZ
211    }
212    #[doc = "Checks if the value of the field is `BOOSTABOVE32MHZ`"]
213    #[inline(always)]
214    pub fn is_boostabove32mhz(&self) -> bool {
215        *self == HFXOBUFCUR_A::BOOSTABOVE32MHZ
216    }
217}
218#[doc = "Field `HFXOBUFCUR` writer - HFXO Boost Buffer Current"]
219pub type HFXOBUFCUR_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, HFXOBUFCUR_A, 2, 5>;
220impl<'a> HFXOBUFCUR_W<'a> {
221    #[doc = "Boost Buffer Current level when HFXO is below or equal to 32 MHz."]
222    #[inline(always)]
223    pub fn boostupto32mhz(self) -> &'a mut W {
224        self.variant(HFXOBUFCUR_A::BOOSTUPTO32MHZ)
225    }
226    #[doc = "Boost Buffer Current Level when HFXO is above 32 MHz."]
227    #[inline(always)]
228    pub fn boostabove32mhz(self) -> &'a mut W {
229        self.variant(HFXOBUFCUR_A::BOOSTABOVE32MHZ)
230    }
231}
232#[doc = "Field `HFXOGLITCHDETEN` reader - HFXO Glitch Detector Enable"]
233pub type HFXOGLITCHDETEN_R = crate::BitReader<bool>;
234#[doc = "Field `HFXOGLITCHDETEN` writer - HFXO Glitch Detector Enable"]
235pub type HFXOGLITCHDETEN_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 7>;
236#[doc = "HFXO Timeout\n\nValue on reset: 3"]
237#[derive(Clone, Copy, Debug, PartialEq)]
238#[repr(u8)]
239pub enum HFXOTIMEOUT_A {
240    #[doc = "0: Timeout period of 8 cycles."]
241    _8CYCLES = 0,
242    #[doc = "1: Timeout period of 256 cycles."]
243    _256CYCLES = 1,
244    #[doc = "2: Timeout period of 1024 cycles."]
245    _1KCYCLES = 2,
246    #[doc = "3: Timeout period of 16384 cycles."]
247    _16KCYCLES = 3,
248}
249impl From<HFXOTIMEOUT_A> for u8 {
250    #[inline(always)]
251    fn from(variant: HFXOTIMEOUT_A) -> Self {
252        variant as _
253    }
254}
255#[doc = "Field `HFXOTIMEOUT` reader - HFXO Timeout"]
256pub type HFXOTIMEOUT_R = crate::FieldReader<u8, HFXOTIMEOUT_A>;
257impl HFXOTIMEOUT_R {
258    #[doc = "Get enumerated values variant"]
259    #[inline(always)]
260    pub fn variant(&self) -> HFXOTIMEOUT_A {
261        match self.bits {
262            0 => HFXOTIMEOUT_A::_8CYCLES,
263            1 => HFXOTIMEOUT_A::_256CYCLES,
264            2 => HFXOTIMEOUT_A::_1KCYCLES,
265            3 => HFXOTIMEOUT_A::_16KCYCLES,
266            _ => unreachable!(),
267        }
268    }
269    #[doc = "Checks if the value of the field is `_8CYCLES`"]
270    #[inline(always)]
271    pub fn is_8cycles(&self) -> bool {
272        *self == HFXOTIMEOUT_A::_8CYCLES
273    }
274    #[doc = "Checks if the value of the field is `_256CYCLES`"]
275    #[inline(always)]
276    pub fn is_256cycles(&self) -> bool {
277        *self == HFXOTIMEOUT_A::_256CYCLES
278    }
279    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
280    #[inline(always)]
281    pub fn is_1kcycles(&self) -> bool {
282        *self == HFXOTIMEOUT_A::_1KCYCLES
283    }
284    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
285    #[inline(always)]
286    pub fn is_16kcycles(&self) -> bool {
287        *self == HFXOTIMEOUT_A::_16KCYCLES
288    }
289}
290#[doc = "Field `HFXOTIMEOUT` writer - HFXO Timeout"]
291pub type HFXOTIMEOUT_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, HFXOTIMEOUT_A, 2, 9>;
292impl<'a> HFXOTIMEOUT_W<'a> {
293    #[doc = "Timeout period of 8 cycles."]
294    #[inline(always)]
295    pub fn _8cycles(self) -> &'a mut W {
296        self.variant(HFXOTIMEOUT_A::_8CYCLES)
297    }
298    #[doc = "Timeout period of 256 cycles."]
299    #[inline(always)]
300    pub fn _256cycles(self) -> &'a mut W {
301        self.variant(HFXOTIMEOUT_A::_256CYCLES)
302    }
303    #[doc = "Timeout period of 1024 cycles."]
304    #[inline(always)]
305    pub fn _1kcycles(self) -> &'a mut W {
306        self.variant(HFXOTIMEOUT_A::_1KCYCLES)
307    }
308    #[doc = "Timeout period of 16384 cycles."]
309    #[inline(always)]
310    pub fn _16kcycles(self) -> &'a mut W {
311        self.variant(HFXOTIMEOUT_A::_16KCYCLES)
312    }
313}
314#[doc = "LFXO Mode\n\nValue on reset: 0"]
315#[derive(Clone, Copy, Debug, PartialEq)]
316#[repr(u8)]
317pub enum LFXOMODE_A {
318    #[doc = "0: 32.768 kHz crystal oscillator."]
319    XTAL = 0,
320    #[doc = "1: An AC coupled buffer is coupled in series with LFXTAL_N pin, suitable for external sinus wave (32.768 kHz)."]
321    BUFEXTCLK = 1,
322    #[doc = "2: Digital external clock on LFXTAL_N pin. Oscillator is effectively bypassed."]
323    DIGEXTCLK = 2,
324}
325impl From<LFXOMODE_A> for u8 {
326    #[inline(always)]
327    fn from(variant: LFXOMODE_A) -> Self {
328        variant as _
329    }
330}
331#[doc = "Field `LFXOMODE` reader - LFXO Mode"]
332pub type LFXOMODE_R = crate::FieldReader<u8, LFXOMODE_A>;
333impl LFXOMODE_R {
334    #[doc = "Get enumerated values variant"]
335    #[inline(always)]
336    pub fn variant(&self) -> Option<LFXOMODE_A> {
337        match self.bits {
338            0 => Some(LFXOMODE_A::XTAL),
339            1 => Some(LFXOMODE_A::BUFEXTCLK),
340            2 => Some(LFXOMODE_A::DIGEXTCLK),
341            _ => None,
342        }
343    }
344    #[doc = "Checks if the value of the field is `XTAL`"]
345    #[inline(always)]
346    pub fn is_xtal(&self) -> bool {
347        *self == LFXOMODE_A::XTAL
348    }
349    #[doc = "Checks if the value of the field is `BUFEXTCLK`"]
350    #[inline(always)]
351    pub fn is_bufextclk(&self) -> bool {
352        *self == LFXOMODE_A::BUFEXTCLK
353    }
354    #[doc = "Checks if the value of the field is `DIGEXTCLK`"]
355    #[inline(always)]
356    pub fn is_digextclk(&self) -> bool {
357        *self == LFXOMODE_A::DIGEXTCLK
358    }
359}
360#[doc = "Field `LFXOMODE` writer - LFXO Mode"]
361pub type LFXOMODE_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, LFXOMODE_A, 2, 11>;
362impl<'a> LFXOMODE_W<'a> {
363    #[doc = "32.768 kHz crystal oscillator."]
364    #[inline(always)]
365    pub fn xtal(self) -> &'a mut W {
366        self.variant(LFXOMODE_A::XTAL)
367    }
368    #[doc = "An AC coupled buffer is coupled in series with LFXTAL_N pin, suitable for external sinus wave (32.768 kHz)."]
369    #[inline(always)]
370    pub fn bufextclk(self) -> &'a mut W {
371        self.variant(LFXOMODE_A::BUFEXTCLK)
372    }
373    #[doc = "Digital external clock on LFXTAL_N pin. Oscillator is effectively bypassed."]
374    #[inline(always)]
375    pub fn digextclk(self) -> &'a mut W {
376        self.variant(LFXOMODE_A::DIGEXTCLK)
377    }
378}
379#[doc = "Field `LFXOBOOST` reader - LFXO Start-up Boost Current"]
380pub type LFXOBOOST_R = crate::BitReader<bool>;
381#[doc = "Field `LFXOBOOST` writer - LFXO Start-up Boost Current"]
382pub type LFXOBOOST_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 13>;
383#[doc = "Field `HFCLKDIV` reader - HFCLK Division"]
384pub type HFCLKDIV_R = crate::FieldReader<u8, u8>;
385#[doc = "Field `HFCLKDIV` writer - HFCLK Division"]
386pub type HFCLKDIV_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 3, 14>;
387#[doc = "Field `LFXOBUFCUR` reader - LFXO Boost Buffer Current"]
388pub type LFXOBUFCUR_R = crate::BitReader<bool>;
389#[doc = "Field `LFXOBUFCUR` writer - LFXO Boost Buffer Current"]
390pub type LFXOBUFCUR_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 17>;
391#[doc = "LFXO Timeout\n\nValue on reset: 3"]
392#[derive(Clone, Copy, Debug, PartialEq)]
393#[repr(u8)]
394pub enum LFXOTIMEOUT_A {
395    #[doc = "0: Timeout period of 8 cycles."]
396    _8CYCLES = 0,
397    #[doc = "1: Timeout period of 1024 cycles."]
398    _1KCYCLES = 1,
399    #[doc = "2: Timeout period of 16384 cycles."]
400    _16KCYCLES = 2,
401    #[doc = "3: Timeout period of 32768 cycles."]
402    _32KCYCLES = 3,
403}
404impl From<LFXOTIMEOUT_A> for u8 {
405    #[inline(always)]
406    fn from(variant: LFXOTIMEOUT_A) -> Self {
407        variant as _
408    }
409}
410#[doc = "Field `LFXOTIMEOUT` reader - LFXO Timeout"]
411pub type LFXOTIMEOUT_R = crate::FieldReader<u8, LFXOTIMEOUT_A>;
412impl LFXOTIMEOUT_R {
413    #[doc = "Get enumerated values variant"]
414    #[inline(always)]
415    pub fn variant(&self) -> LFXOTIMEOUT_A {
416        match self.bits {
417            0 => LFXOTIMEOUT_A::_8CYCLES,
418            1 => LFXOTIMEOUT_A::_1KCYCLES,
419            2 => LFXOTIMEOUT_A::_16KCYCLES,
420            3 => LFXOTIMEOUT_A::_32KCYCLES,
421            _ => unreachable!(),
422        }
423    }
424    #[doc = "Checks if the value of the field is `_8CYCLES`"]
425    #[inline(always)]
426    pub fn is_8cycles(&self) -> bool {
427        *self == LFXOTIMEOUT_A::_8CYCLES
428    }
429    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
430    #[inline(always)]
431    pub fn is_1kcycles(&self) -> bool {
432        *self == LFXOTIMEOUT_A::_1KCYCLES
433    }
434    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
435    #[inline(always)]
436    pub fn is_16kcycles(&self) -> bool {
437        *self == LFXOTIMEOUT_A::_16KCYCLES
438    }
439    #[doc = "Checks if the value of the field is `_32KCYCLES`"]
440    #[inline(always)]
441    pub fn is_32kcycles(&self) -> bool {
442        *self == LFXOTIMEOUT_A::_32KCYCLES
443    }
444}
445#[doc = "Field `LFXOTIMEOUT` writer - LFXO Timeout"]
446pub type LFXOTIMEOUT_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, LFXOTIMEOUT_A, 2, 18>;
447impl<'a> LFXOTIMEOUT_W<'a> {
448    #[doc = "Timeout period of 8 cycles."]
449    #[inline(always)]
450    pub fn _8cycles(self) -> &'a mut W {
451        self.variant(LFXOTIMEOUT_A::_8CYCLES)
452    }
453    #[doc = "Timeout period of 1024 cycles."]
454    #[inline(always)]
455    pub fn _1kcycles(self) -> &'a mut W {
456        self.variant(LFXOTIMEOUT_A::_1KCYCLES)
457    }
458    #[doc = "Timeout period of 16384 cycles."]
459    #[inline(always)]
460    pub fn _16kcycles(self) -> &'a mut W {
461        self.variant(LFXOTIMEOUT_A::_16KCYCLES)
462    }
463    #[doc = "Timeout period of 32768 cycles."]
464    #[inline(always)]
465    pub fn _32kcycles(self) -> &'a mut W {
466        self.variant(LFXOTIMEOUT_A::_32KCYCLES)
467    }
468}
469#[doc = "Clock Output Select 0\n\nValue on reset: 0"]
470#[derive(Clone, Copy, Debug, PartialEq)]
471#[repr(u8)]
472pub enum CLKOUTSEL0_A {
473    #[doc = "0: HFRCO (directly from oscillator)."]
474    HFRCO = 0,
475    #[doc = "1: HFXO (directly from oscillator)."]
476    HFXO = 1,
477    #[doc = "2: HFCLK/2."]
478    HFCLK2 = 2,
479    #[doc = "3: HFCLK/4."]
480    HFCLK4 = 3,
481    #[doc = "4: HFCLK/8."]
482    HFCLK8 = 4,
483    #[doc = "5: HFCLK/16."]
484    HFCLK16 = 5,
485    #[doc = "6: ULFRCO (directly from oscillator)."]
486    ULFRCO = 6,
487    #[doc = "7: AUXHFRCO (directly from oscillator)."]
488    AUXHFRCO = 7,
489}
490impl From<CLKOUTSEL0_A> for u8 {
491    #[inline(always)]
492    fn from(variant: CLKOUTSEL0_A) -> Self {
493        variant as _
494    }
495}
496#[doc = "Field `CLKOUTSEL0` reader - Clock Output Select 0"]
497pub type CLKOUTSEL0_R = crate::FieldReader<u8, CLKOUTSEL0_A>;
498impl CLKOUTSEL0_R {
499    #[doc = "Get enumerated values variant"]
500    #[inline(always)]
501    pub fn variant(&self) -> CLKOUTSEL0_A {
502        match self.bits {
503            0 => CLKOUTSEL0_A::HFRCO,
504            1 => CLKOUTSEL0_A::HFXO,
505            2 => CLKOUTSEL0_A::HFCLK2,
506            3 => CLKOUTSEL0_A::HFCLK4,
507            4 => CLKOUTSEL0_A::HFCLK8,
508            5 => CLKOUTSEL0_A::HFCLK16,
509            6 => CLKOUTSEL0_A::ULFRCO,
510            7 => CLKOUTSEL0_A::AUXHFRCO,
511            _ => unreachable!(),
512        }
513    }
514    #[doc = "Checks if the value of the field is `HFRCO`"]
515    #[inline(always)]
516    pub fn is_hfrco(&self) -> bool {
517        *self == CLKOUTSEL0_A::HFRCO
518    }
519    #[doc = "Checks if the value of the field is `HFXO`"]
520    #[inline(always)]
521    pub fn is_hfxo(&self) -> bool {
522        *self == CLKOUTSEL0_A::HFXO
523    }
524    #[doc = "Checks if the value of the field is `HFCLK2`"]
525    #[inline(always)]
526    pub fn is_hfclk2(&self) -> bool {
527        *self == CLKOUTSEL0_A::HFCLK2
528    }
529    #[doc = "Checks if the value of the field is `HFCLK4`"]
530    #[inline(always)]
531    pub fn is_hfclk4(&self) -> bool {
532        *self == CLKOUTSEL0_A::HFCLK4
533    }
534    #[doc = "Checks if the value of the field is `HFCLK8`"]
535    #[inline(always)]
536    pub fn is_hfclk8(&self) -> bool {
537        *self == CLKOUTSEL0_A::HFCLK8
538    }
539    #[doc = "Checks if the value of the field is `HFCLK16`"]
540    #[inline(always)]
541    pub fn is_hfclk16(&self) -> bool {
542        *self == CLKOUTSEL0_A::HFCLK16
543    }
544    #[doc = "Checks if the value of the field is `ULFRCO`"]
545    #[inline(always)]
546    pub fn is_ulfrco(&self) -> bool {
547        *self == CLKOUTSEL0_A::ULFRCO
548    }
549    #[doc = "Checks if the value of the field is `AUXHFRCO`"]
550    #[inline(always)]
551    pub fn is_auxhfrco(&self) -> bool {
552        *self == CLKOUTSEL0_A::AUXHFRCO
553    }
554}
555#[doc = "Field `CLKOUTSEL0` writer - Clock Output Select 0"]
556pub type CLKOUTSEL0_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, CLKOUTSEL0_A, 3, 20>;
557impl<'a> CLKOUTSEL0_W<'a> {
558    #[doc = "HFRCO (directly from oscillator)."]
559    #[inline(always)]
560    pub fn hfrco(self) -> &'a mut W {
561        self.variant(CLKOUTSEL0_A::HFRCO)
562    }
563    #[doc = "HFXO (directly from oscillator)."]
564    #[inline(always)]
565    pub fn hfxo(self) -> &'a mut W {
566        self.variant(CLKOUTSEL0_A::HFXO)
567    }
568    #[doc = "HFCLK/2."]
569    #[inline(always)]
570    pub fn hfclk2(self) -> &'a mut W {
571        self.variant(CLKOUTSEL0_A::HFCLK2)
572    }
573    #[doc = "HFCLK/4."]
574    #[inline(always)]
575    pub fn hfclk4(self) -> &'a mut W {
576        self.variant(CLKOUTSEL0_A::HFCLK4)
577    }
578    #[doc = "HFCLK/8."]
579    #[inline(always)]
580    pub fn hfclk8(self) -> &'a mut W {
581        self.variant(CLKOUTSEL0_A::HFCLK8)
582    }
583    #[doc = "HFCLK/16."]
584    #[inline(always)]
585    pub fn hfclk16(self) -> &'a mut W {
586        self.variant(CLKOUTSEL0_A::HFCLK16)
587    }
588    #[doc = "ULFRCO (directly from oscillator)."]
589    #[inline(always)]
590    pub fn ulfrco(self) -> &'a mut W {
591        self.variant(CLKOUTSEL0_A::ULFRCO)
592    }
593    #[doc = "AUXHFRCO (directly from oscillator)."]
594    #[inline(always)]
595    pub fn auxhfrco(self) -> &'a mut W {
596        self.variant(CLKOUTSEL0_A::AUXHFRCO)
597    }
598}
599#[doc = "Clock Output Select 1\n\nValue on reset: 0"]
600#[derive(Clone, Copy, Debug, PartialEq)]
601#[repr(u8)]
602pub enum CLKOUTSEL1_A {
603    #[doc = "0: LFRCO (directly from oscillator)."]
604    LFRCO = 0,
605    #[doc = "1: LFXO (directly from oscillator)."]
606    LFXO = 1,
607    #[doc = "2: HFCLK (undivided)."]
608    HFCLK = 2,
609    #[doc = "3: LFXO (qualified)."]
610    LFXOQ = 3,
611    #[doc = "4: HFXO (qualified)."]
612    HFXOQ = 4,
613    #[doc = "5: LFRCO (qualified)."]
614    LFRCOQ = 5,
615    #[doc = "6: HFRCO (qualified)."]
616    HFRCOQ = 6,
617    #[doc = "7: AUXHFRCO (qualified)."]
618    AUXHFRCOQ = 7,
619}
620impl From<CLKOUTSEL1_A> for u8 {
621    #[inline(always)]
622    fn from(variant: CLKOUTSEL1_A) -> Self {
623        variant as _
624    }
625}
626#[doc = "Field `CLKOUTSEL1` reader - Clock Output Select 1"]
627pub type CLKOUTSEL1_R = crate::FieldReader<u8, CLKOUTSEL1_A>;
628impl CLKOUTSEL1_R {
629    #[doc = "Get enumerated values variant"]
630    #[inline(always)]
631    pub fn variant(&self) -> Option<CLKOUTSEL1_A> {
632        match self.bits {
633            0 => Some(CLKOUTSEL1_A::LFRCO),
634            1 => Some(CLKOUTSEL1_A::LFXO),
635            2 => Some(CLKOUTSEL1_A::HFCLK),
636            3 => Some(CLKOUTSEL1_A::LFXOQ),
637            4 => Some(CLKOUTSEL1_A::HFXOQ),
638            5 => Some(CLKOUTSEL1_A::LFRCOQ),
639            6 => Some(CLKOUTSEL1_A::HFRCOQ),
640            7 => Some(CLKOUTSEL1_A::AUXHFRCOQ),
641            _ => None,
642        }
643    }
644    #[doc = "Checks if the value of the field is `LFRCO`"]
645    #[inline(always)]
646    pub fn is_lfrco(&self) -> bool {
647        *self == CLKOUTSEL1_A::LFRCO
648    }
649    #[doc = "Checks if the value of the field is `LFXO`"]
650    #[inline(always)]
651    pub fn is_lfxo(&self) -> bool {
652        *self == CLKOUTSEL1_A::LFXO
653    }
654    #[doc = "Checks if the value of the field is `HFCLK`"]
655    #[inline(always)]
656    pub fn is_hfclk(&self) -> bool {
657        *self == CLKOUTSEL1_A::HFCLK
658    }
659    #[doc = "Checks if the value of the field is `LFXOQ`"]
660    #[inline(always)]
661    pub fn is_lfxoq(&self) -> bool {
662        *self == CLKOUTSEL1_A::LFXOQ
663    }
664    #[doc = "Checks if the value of the field is `HFXOQ`"]
665    #[inline(always)]
666    pub fn is_hfxoq(&self) -> bool {
667        *self == CLKOUTSEL1_A::HFXOQ
668    }
669    #[doc = "Checks if the value of the field is `LFRCOQ`"]
670    #[inline(always)]
671    pub fn is_lfrcoq(&self) -> bool {
672        *self == CLKOUTSEL1_A::LFRCOQ
673    }
674    #[doc = "Checks if the value of the field is `HFRCOQ`"]
675    #[inline(always)]
676    pub fn is_hfrcoq(&self) -> bool {
677        *self == CLKOUTSEL1_A::HFRCOQ
678    }
679    #[doc = "Checks if the value of the field is `AUXHFRCOQ`"]
680    #[inline(always)]
681    pub fn is_auxhfrcoq(&self) -> bool {
682        *self == CLKOUTSEL1_A::AUXHFRCOQ
683    }
684}
685#[doc = "Field `CLKOUTSEL1` writer - Clock Output Select 1"]
686pub type CLKOUTSEL1_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKOUTSEL1_A, 4, 23>;
687impl<'a> CLKOUTSEL1_W<'a> {
688    #[doc = "LFRCO (directly from oscillator)."]
689    #[inline(always)]
690    pub fn lfrco(self) -> &'a mut W {
691        self.variant(CLKOUTSEL1_A::LFRCO)
692    }
693    #[doc = "LFXO (directly from oscillator)."]
694    #[inline(always)]
695    pub fn lfxo(self) -> &'a mut W {
696        self.variant(CLKOUTSEL1_A::LFXO)
697    }
698    #[doc = "HFCLK (undivided)."]
699    #[inline(always)]
700    pub fn hfclk(self) -> &'a mut W {
701        self.variant(CLKOUTSEL1_A::HFCLK)
702    }
703    #[doc = "LFXO (qualified)."]
704    #[inline(always)]
705    pub fn lfxoq(self) -> &'a mut W {
706        self.variant(CLKOUTSEL1_A::LFXOQ)
707    }
708    #[doc = "HFXO (qualified)."]
709    #[inline(always)]
710    pub fn hfxoq(self) -> &'a mut W {
711        self.variant(CLKOUTSEL1_A::HFXOQ)
712    }
713    #[doc = "LFRCO (qualified)."]
714    #[inline(always)]
715    pub fn lfrcoq(self) -> &'a mut W {
716        self.variant(CLKOUTSEL1_A::LFRCOQ)
717    }
718    #[doc = "HFRCO (qualified)."]
719    #[inline(always)]
720    pub fn hfrcoq(self) -> &'a mut W {
721        self.variant(CLKOUTSEL1_A::HFRCOQ)
722    }
723    #[doc = "AUXHFRCO (qualified)."]
724    #[inline(always)]
725    pub fn auxhfrcoq(self) -> &'a mut W {
726        self.variant(CLKOUTSEL1_A::AUXHFRCOQ)
727    }
728}
729#[doc = "Field `DBGCLK` reader - Debug Clock"]
730pub type DBGCLK_R = crate::BitReader<bool>;
731#[doc = "Field `DBGCLK` writer - Debug Clock"]
732pub type DBGCLK_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 28>;
733#[doc = "Field `HFLE` reader - High-Frequency LE Interface"]
734pub type HFLE_R = crate::BitReader<bool>;
735#[doc = "Field `HFLE` writer - High-Frequency LE Interface"]
736pub type HFLE_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 30>;
737impl R {
738    #[doc = "Bits 0:1 - HFXO Mode"]
739    #[inline(always)]
740    pub fn hfxomode(&self) -> HFXOMODE_R {
741        HFXOMODE_R::new((self.bits & 3) as u8)
742    }
743    #[doc = "Bits 2:3 - HFXO Start-up Boost Current"]
744    #[inline(always)]
745    pub fn hfxoboost(&self) -> HFXOBOOST_R {
746        HFXOBOOST_R::new(((self.bits >> 2) & 3) as u8)
747    }
748    #[doc = "Bits 5:6 - HFXO Boost Buffer Current"]
749    #[inline(always)]
750    pub fn hfxobufcur(&self) -> HFXOBUFCUR_R {
751        HFXOBUFCUR_R::new(((self.bits >> 5) & 3) as u8)
752    }
753    #[doc = "Bit 7 - HFXO Glitch Detector Enable"]
754    #[inline(always)]
755    pub fn hfxoglitchdeten(&self) -> HFXOGLITCHDETEN_R {
756        HFXOGLITCHDETEN_R::new(((self.bits >> 7) & 1) != 0)
757    }
758    #[doc = "Bits 9:10 - HFXO Timeout"]
759    #[inline(always)]
760    pub fn hfxotimeout(&self) -> HFXOTIMEOUT_R {
761        HFXOTIMEOUT_R::new(((self.bits >> 9) & 3) as u8)
762    }
763    #[doc = "Bits 11:12 - LFXO Mode"]
764    #[inline(always)]
765    pub fn lfxomode(&self) -> LFXOMODE_R {
766        LFXOMODE_R::new(((self.bits >> 11) & 3) as u8)
767    }
768    #[doc = "Bit 13 - LFXO Start-up Boost Current"]
769    #[inline(always)]
770    pub fn lfxoboost(&self) -> LFXOBOOST_R {
771        LFXOBOOST_R::new(((self.bits >> 13) & 1) != 0)
772    }
773    #[doc = "Bits 14:16 - HFCLK Division"]
774    #[inline(always)]
775    pub fn hfclkdiv(&self) -> HFCLKDIV_R {
776        HFCLKDIV_R::new(((self.bits >> 14) & 7) as u8)
777    }
778    #[doc = "Bit 17 - LFXO Boost Buffer Current"]
779    #[inline(always)]
780    pub fn lfxobufcur(&self) -> LFXOBUFCUR_R {
781        LFXOBUFCUR_R::new(((self.bits >> 17) & 1) != 0)
782    }
783    #[doc = "Bits 18:19 - LFXO Timeout"]
784    #[inline(always)]
785    pub fn lfxotimeout(&self) -> LFXOTIMEOUT_R {
786        LFXOTIMEOUT_R::new(((self.bits >> 18) & 3) as u8)
787    }
788    #[doc = "Bits 20:22 - Clock Output Select 0"]
789    #[inline(always)]
790    pub fn clkoutsel0(&self) -> CLKOUTSEL0_R {
791        CLKOUTSEL0_R::new(((self.bits >> 20) & 7) as u8)
792    }
793    #[doc = "Bits 23:26 - Clock Output Select 1"]
794    #[inline(always)]
795    pub fn clkoutsel1(&self) -> CLKOUTSEL1_R {
796        CLKOUTSEL1_R::new(((self.bits >> 23) & 0x0f) as u8)
797    }
798    #[doc = "Bit 28 - Debug Clock"]
799    #[inline(always)]
800    pub fn dbgclk(&self) -> DBGCLK_R {
801        DBGCLK_R::new(((self.bits >> 28) & 1) != 0)
802    }
803    #[doc = "Bit 30 - High-Frequency LE Interface"]
804    #[inline(always)]
805    pub fn hfle(&self) -> HFLE_R {
806        HFLE_R::new(((self.bits >> 30) & 1) != 0)
807    }
808}
809impl W {
810    #[doc = "Bits 0:1 - HFXO Mode"]
811    #[inline(always)]
812    pub fn hfxomode(&mut self) -> HFXOMODE_W {
813        HFXOMODE_W::new(self)
814    }
815    #[doc = "Bits 2:3 - HFXO Start-up Boost Current"]
816    #[inline(always)]
817    pub fn hfxoboost(&mut self) -> HFXOBOOST_W {
818        HFXOBOOST_W::new(self)
819    }
820    #[doc = "Bits 5:6 - HFXO Boost Buffer Current"]
821    #[inline(always)]
822    pub fn hfxobufcur(&mut self) -> HFXOBUFCUR_W {
823        HFXOBUFCUR_W::new(self)
824    }
825    #[doc = "Bit 7 - HFXO Glitch Detector Enable"]
826    #[inline(always)]
827    pub fn hfxoglitchdeten(&mut self) -> HFXOGLITCHDETEN_W {
828        HFXOGLITCHDETEN_W::new(self)
829    }
830    #[doc = "Bits 9:10 - HFXO Timeout"]
831    #[inline(always)]
832    pub fn hfxotimeout(&mut self) -> HFXOTIMEOUT_W {
833        HFXOTIMEOUT_W::new(self)
834    }
835    #[doc = "Bits 11:12 - LFXO Mode"]
836    #[inline(always)]
837    pub fn lfxomode(&mut self) -> LFXOMODE_W {
838        LFXOMODE_W::new(self)
839    }
840    #[doc = "Bit 13 - LFXO Start-up Boost Current"]
841    #[inline(always)]
842    pub fn lfxoboost(&mut self) -> LFXOBOOST_W {
843        LFXOBOOST_W::new(self)
844    }
845    #[doc = "Bits 14:16 - HFCLK Division"]
846    #[inline(always)]
847    pub fn hfclkdiv(&mut self) -> HFCLKDIV_W {
848        HFCLKDIV_W::new(self)
849    }
850    #[doc = "Bit 17 - LFXO Boost Buffer Current"]
851    #[inline(always)]
852    pub fn lfxobufcur(&mut self) -> LFXOBUFCUR_W {
853        LFXOBUFCUR_W::new(self)
854    }
855    #[doc = "Bits 18:19 - LFXO Timeout"]
856    #[inline(always)]
857    pub fn lfxotimeout(&mut self) -> LFXOTIMEOUT_W {
858        LFXOTIMEOUT_W::new(self)
859    }
860    #[doc = "Bits 20:22 - Clock Output Select 0"]
861    #[inline(always)]
862    pub fn clkoutsel0(&mut self) -> CLKOUTSEL0_W {
863        CLKOUTSEL0_W::new(self)
864    }
865    #[doc = "Bits 23:26 - Clock Output Select 1"]
866    #[inline(always)]
867    pub fn clkoutsel1(&mut self) -> CLKOUTSEL1_W {
868        CLKOUTSEL1_W::new(self)
869    }
870    #[doc = "Bit 28 - Debug Clock"]
871    #[inline(always)]
872    pub fn dbgclk(&mut self) -> DBGCLK_W {
873        DBGCLK_W::new(self)
874    }
875    #[doc = "Bit 30 - High-Frequency LE Interface"]
876    #[inline(always)]
877    pub fn hfle(&mut self) -> HFLE_W {
878        HFLE_W::new(self)
879    }
880    #[doc = "Writes raw bits to the register."]
881    #[inline(always)]
882    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
883        self.0.bits(bits);
884        self
885    }
886}
887#[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"]
888pub struct CTRL_SPEC;
889impl crate::RegisterSpec for CTRL_SPEC {
890    type Ux = u32;
891}
892#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
893impl crate::Readable for CTRL_SPEC {
894    type Reader = R;
895}
896#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
897impl crate::Writable for CTRL_SPEC {
898    type Writer = W;
899}
900#[doc = "`reset()` method sets CTRL to value 0x000c_262c"]
901impl crate::Resettable for CTRL_SPEC {
902    #[inline(always)]
903    fn reset_value() -> Self::Ux {
904        0x000c_262c
905    }
906}