efm32pg12_pac/cmu/
hfxotimeoutctrl.rs

1#[doc = "Reader of register HFXOTIMEOUTCTRL"]
2pub type R = crate::R<u32, super::HFXOTIMEOUTCTRL>;
3#[doc = "Writer for register HFXOTIMEOUTCTRL"]
4pub type W = crate::W<u32, super::HFXOTIMEOUTCTRL>;
5#[doc = "Register HFXOTIMEOUTCTRL `reset()`'s with value 0x0002_a067"]
6impl crate::ResetValue for super::HFXOTIMEOUTCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0002_a067
11    }
12}
13#[doc = "Wait Duration in HFXO Startup Enable Wait State\n\nValue on reset: 7"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum STARTUPTIMEOUT_A {
17    #[doc = "0: Timeout period of 2 cycles"]
18    _2CYCLES = 0,
19    #[doc = "1: Timeout period of 4 cycles"]
20    _4CYCLES = 1,
21    #[doc = "2: Timeout period of 16 cycles"]
22    _16CYCLES = 2,
23    #[doc = "3: Timeout period of 32 cycles"]
24    _32CYCLES = 3,
25    #[doc = "4: Timeout period of 256 cycles"]
26    _256CYCLES = 4,
27    #[doc = "5: Timeout period of 1024 cycles"]
28    _1KCYCLES = 5,
29    #[doc = "6: Timeout period of 2048 cycles"]
30    _2KCYCLES = 6,
31    #[doc = "7: Timeout period of 4096 cycles"]
32    _4KCYCLES = 7,
33    #[doc = "8: Timeout period of 8192 cycles"]
34    _8KCYCLES = 8,
35    #[doc = "9: Timeout period of 16384 cycles"]
36    _16KCYCLES = 9,
37    #[doc = "10: Timeout period of 32768 cycles"]
38    _32KCYCLES = 10,
39}
40impl From<STARTUPTIMEOUT_A> for u8 {
41    #[inline(always)]
42    fn from(variant: STARTUPTIMEOUT_A) -> Self {
43        variant as _
44    }
45}
46#[doc = "Reader of field `STARTUPTIMEOUT`"]
47pub type STARTUPTIMEOUT_R = crate::R<u8, STARTUPTIMEOUT_A>;
48impl STARTUPTIMEOUT_R {
49    #[doc = r"Get enumerated values variant"]
50    #[inline(always)]
51    pub fn variant(&self) -> crate::Variant<u8, STARTUPTIMEOUT_A> {
52        use crate::Variant::*;
53        match self.bits {
54            0 => Val(STARTUPTIMEOUT_A::_2CYCLES),
55            1 => Val(STARTUPTIMEOUT_A::_4CYCLES),
56            2 => Val(STARTUPTIMEOUT_A::_16CYCLES),
57            3 => Val(STARTUPTIMEOUT_A::_32CYCLES),
58            4 => Val(STARTUPTIMEOUT_A::_256CYCLES),
59            5 => Val(STARTUPTIMEOUT_A::_1KCYCLES),
60            6 => Val(STARTUPTIMEOUT_A::_2KCYCLES),
61            7 => Val(STARTUPTIMEOUT_A::_4KCYCLES),
62            8 => Val(STARTUPTIMEOUT_A::_8KCYCLES),
63            9 => Val(STARTUPTIMEOUT_A::_16KCYCLES),
64            10 => Val(STARTUPTIMEOUT_A::_32KCYCLES),
65            i => Res(i),
66        }
67    }
68    #[doc = "Checks if the value of the field is `_2CYCLES`"]
69    #[inline(always)]
70    pub fn is_2cycles(&self) -> bool {
71        *self == STARTUPTIMEOUT_A::_2CYCLES
72    }
73    #[doc = "Checks if the value of the field is `_4CYCLES`"]
74    #[inline(always)]
75    pub fn is_4cycles(&self) -> bool {
76        *self == STARTUPTIMEOUT_A::_4CYCLES
77    }
78    #[doc = "Checks if the value of the field is `_16CYCLES`"]
79    #[inline(always)]
80    pub fn is_16cycles(&self) -> bool {
81        *self == STARTUPTIMEOUT_A::_16CYCLES
82    }
83    #[doc = "Checks if the value of the field is `_32CYCLES`"]
84    #[inline(always)]
85    pub fn is_32cycles(&self) -> bool {
86        *self == STARTUPTIMEOUT_A::_32CYCLES
87    }
88    #[doc = "Checks if the value of the field is `_256CYCLES`"]
89    #[inline(always)]
90    pub fn is_256cycles(&self) -> bool {
91        *self == STARTUPTIMEOUT_A::_256CYCLES
92    }
93    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
94    #[inline(always)]
95    pub fn is_1kcycles(&self) -> bool {
96        *self == STARTUPTIMEOUT_A::_1KCYCLES
97    }
98    #[doc = "Checks if the value of the field is `_2KCYCLES`"]
99    #[inline(always)]
100    pub fn is_2kcycles(&self) -> bool {
101        *self == STARTUPTIMEOUT_A::_2KCYCLES
102    }
103    #[doc = "Checks if the value of the field is `_4KCYCLES`"]
104    #[inline(always)]
105    pub fn is_4kcycles(&self) -> bool {
106        *self == STARTUPTIMEOUT_A::_4KCYCLES
107    }
108    #[doc = "Checks if the value of the field is `_8KCYCLES`"]
109    #[inline(always)]
110    pub fn is_8kcycles(&self) -> bool {
111        *self == STARTUPTIMEOUT_A::_8KCYCLES
112    }
113    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
114    #[inline(always)]
115    pub fn is_16kcycles(&self) -> bool {
116        *self == STARTUPTIMEOUT_A::_16KCYCLES
117    }
118    #[doc = "Checks if the value of the field is `_32KCYCLES`"]
119    #[inline(always)]
120    pub fn is_32kcycles(&self) -> bool {
121        *self == STARTUPTIMEOUT_A::_32KCYCLES
122    }
123}
124#[doc = "Write proxy for field `STARTUPTIMEOUT`"]
125pub struct STARTUPTIMEOUT_W<'a> {
126    w: &'a mut W,
127}
128impl<'a> STARTUPTIMEOUT_W<'a> {
129    #[doc = r"Writes `variant` to the field"]
130    #[inline(always)]
131    pub fn variant(self, variant: STARTUPTIMEOUT_A) -> &'a mut W {
132        unsafe { self.bits(variant.into()) }
133    }
134    #[doc = "Timeout period of 2 cycles"]
135    #[inline(always)]
136    pub fn _2cycles(self) -> &'a mut W {
137        self.variant(STARTUPTIMEOUT_A::_2CYCLES)
138    }
139    #[doc = "Timeout period of 4 cycles"]
140    #[inline(always)]
141    pub fn _4cycles(self) -> &'a mut W {
142        self.variant(STARTUPTIMEOUT_A::_4CYCLES)
143    }
144    #[doc = "Timeout period of 16 cycles"]
145    #[inline(always)]
146    pub fn _16cycles(self) -> &'a mut W {
147        self.variant(STARTUPTIMEOUT_A::_16CYCLES)
148    }
149    #[doc = "Timeout period of 32 cycles"]
150    #[inline(always)]
151    pub fn _32cycles(self) -> &'a mut W {
152        self.variant(STARTUPTIMEOUT_A::_32CYCLES)
153    }
154    #[doc = "Timeout period of 256 cycles"]
155    #[inline(always)]
156    pub fn _256cycles(self) -> &'a mut W {
157        self.variant(STARTUPTIMEOUT_A::_256CYCLES)
158    }
159    #[doc = "Timeout period of 1024 cycles"]
160    #[inline(always)]
161    pub fn _1kcycles(self) -> &'a mut W {
162        self.variant(STARTUPTIMEOUT_A::_1KCYCLES)
163    }
164    #[doc = "Timeout period of 2048 cycles"]
165    #[inline(always)]
166    pub fn _2kcycles(self) -> &'a mut W {
167        self.variant(STARTUPTIMEOUT_A::_2KCYCLES)
168    }
169    #[doc = "Timeout period of 4096 cycles"]
170    #[inline(always)]
171    pub fn _4kcycles(self) -> &'a mut W {
172        self.variant(STARTUPTIMEOUT_A::_4KCYCLES)
173    }
174    #[doc = "Timeout period of 8192 cycles"]
175    #[inline(always)]
176    pub fn _8kcycles(self) -> &'a mut W {
177        self.variant(STARTUPTIMEOUT_A::_8KCYCLES)
178    }
179    #[doc = "Timeout period of 16384 cycles"]
180    #[inline(always)]
181    pub fn _16kcycles(self) -> &'a mut W {
182        self.variant(STARTUPTIMEOUT_A::_16KCYCLES)
183    }
184    #[doc = "Timeout period of 32768 cycles"]
185    #[inline(always)]
186    pub fn _32kcycles(self) -> &'a mut W {
187        self.variant(STARTUPTIMEOUT_A::_32KCYCLES)
188    }
189    #[doc = r"Writes raw bits to the field"]
190    #[inline(always)]
191    pub unsafe fn bits(self, value: u8) -> &'a mut W {
192        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
193        self.w
194    }
195}
196#[doc = "Wait Duration in HFXO Startup Steady Wait State\n\nValue on reset: 6"]
197#[derive(Clone, Copy, Debug, PartialEq)]
198#[repr(u8)]
199pub enum STEADYTIMEOUT_A {
200    #[doc = "0: Timeout period of 2 cycles"]
201    _2CYCLES = 0,
202    #[doc = "1: Timeout period of 4 cycles"]
203    _4CYCLES = 1,
204    #[doc = "2: Timeout period of 16 cycles"]
205    _16CYCLES = 2,
206    #[doc = "3: Timeout period of 32 cycles"]
207    _32CYCLES = 3,
208    #[doc = "4: Timeout period of 256 cycles"]
209    _256CYCLES = 4,
210    #[doc = "5: Timeout period of 1024 cycles"]
211    _1KCYCLES = 5,
212    #[doc = "6: Timeout period of 2048 cycles"]
213    _2KCYCLES = 6,
214    #[doc = "7: Timeout period of 4096 cycles"]
215    _4KCYCLES = 7,
216    #[doc = "8: Timeout period of 8192 cycles"]
217    _8KCYCLES = 8,
218    #[doc = "9: Timeout period of 16384 cycles"]
219    _16KCYCLES = 9,
220    #[doc = "10: Timeout period of 32768 cycles"]
221    _32KCYCLES = 10,
222}
223impl From<STEADYTIMEOUT_A> for u8 {
224    #[inline(always)]
225    fn from(variant: STEADYTIMEOUT_A) -> Self {
226        variant as _
227    }
228}
229#[doc = "Reader of field `STEADYTIMEOUT`"]
230pub type STEADYTIMEOUT_R = crate::R<u8, STEADYTIMEOUT_A>;
231impl STEADYTIMEOUT_R {
232    #[doc = r"Get enumerated values variant"]
233    #[inline(always)]
234    pub fn variant(&self) -> crate::Variant<u8, STEADYTIMEOUT_A> {
235        use crate::Variant::*;
236        match self.bits {
237            0 => Val(STEADYTIMEOUT_A::_2CYCLES),
238            1 => Val(STEADYTIMEOUT_A::_4CYCLES),
239            2 => Val(STEADYTIMEOUT_A::_16CYCLES),
240            3 => Val(STEADYTIMEOUT_A::_32CYCLES),
241            4 => Val(STEADYTIMEOUT_A::_256CYCLES),
242            5 => Val(STEADYTIMEOUT_A::_1KCYCLES),
243            6 => Val(STEADYTIMEOUT_A::_2KCYCLES),
244            7 => Val(STEADYTIMEOUT_A::_4KCYCLES),
245            8 => Val(STEADYTIMEOUT_A::_8KCYCLES),
246            9 => Val(STEADYTIMEOUT_A::_16KCYCLES),
247            10 => Val(STEADYTIMEOUT_A::_32KCYCLES),
248            i => Res(i),
249        }
250    }
251    #[doc = "Checks if the value of the field is `_2CYCLES`"]
252    #[inline(always)]
253    pub fn is_2cycles(&self) -> bool {
254        *self == STEADYTIMEOUT_A::_2CYCLES
255    }
256    #[doc = "Checks if the value of the field is `_4CYCLES`"]
257    #[inline(always)]
258    pub fn is_4cycles(&self) -> bool {
259        *self == STEADYTIMEOUT_A::_4CYCLES
260    }
261    #[doc = "Checks if the value of the field is `_16CYCLES`"]
262    #[inline(always)]
263    pub fn is_16cycles(&self) -> bool {
264        *self == STEADYTIMEOUT_A::_16CYCLES
265    }
266    #[doc = "Checks if the value of the field is `_32CYCLES`"]
267    #[inline(always)]
268    pub fn is_32cycles(&self) -> bool {
269        *self == STEADYTIMEOUT_A::_32CYCLES
270    }
271    #[doc = "Checks if the value of the field is `_256CYCLES`"]
272    #[inline(always)]
273    pub fn is_256cycles(&self) -> bool {
274        *self == STEADYTIMEOUT_A::_256CYCLES
275    }
276    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
277    #[inline(always)]
278    pub fn is_1kcycles(&self) -> bool {
279        *self == STEADYTIMEOUT_A::_1KCYCLES
280    }
281    #[doc = "Checks if the value of the field is `_2KCYCLES`"]
282    #[inline(always)]
283    pub fn is_2kcycles(&self) -> bool {
284        *self == STEADYTIMEOUT_A::_2KCYCLES
285    }
286    #[doc = "Checks if the value of the field is `_4KCYCLES`"]
287    #[inline(always)]
288    pub fn is_4kcycles(&self) -> bool {
289        *self == STEADYTIMEOUT_A::_4KCYCLES
290    }
291    #[doc = "Checks if the value of the field is `_8KCYCLES`"]
292    #[inline(always)]
293    pub fn is_8kcycles(&self) -> bool {
294        *self == STEADYTIMEOUT_A::_8KCYCLES
295    }
296    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
297    #[inline(always)]
298    pub fn is_16kcycles(&self) -> bool {
299        *self == STEADYTIMEOUT_A::_16KCYCLES
300    }
301    #[doc = "Checks if the value of the field is `_32KCYCLES`"]
302    #[inline(always)]
303    pub fn is_32kcycles(&self) -> bool {
304        *self == STEADYTIMEOUT_A::_32KCYCLES
305    }
306}
307#[doc = "Write proxy for field `STEADYTIMEOUT`"]
308pub struct STEADYTIMEOUT_W<'a> {
309    w: &'a mut W,
310}
311impl<'a> STEADYTIMEOUT_W<'a> {
312    #[doc = r"Writes `variant` to the field"]
313    #[inline(always)]
314    pub fn variant(self, variant: STEADYTIMEOUT_A) -> &'a mut W {
315        unsafe { self.bits(variant.into()) }
316    }
317    #[doc = "Timeout period of 2 cycles"]
318    #[inline(always)]
319    pub fn _2cycles(self) -> &'a mut W {
320        self.variant(STEADYTIMEOUT_A::_2CYCLES)
321    }
322    #[doc = "Timeout period of 4 cycles"]
323    #[inline(always)]
324    pub fn _4cycles(self) -> &'a mut W {
325        self.variant(STEADYTIMEOUT_A::_4CYCLES)
326    }
327    #[doc = "Timeout period of 16 cycles"]
328    #[inline(always)]
329    pub fn _16cycles(self) -> &'a mut W {
330        self.variant(STEADYTIMEOUT_A::_16CYCLES)
331    }
332    #[doc = "Timeout period of 32 cycles"]
333    #[inline(always)]
334    pub fn _32cycles(self) -> &'a mut W {
335        self.variant(STEADYTIMEOUT_A::_32CYCLES)
336    }
337    #[doc = "Timeout period of 256 cycles"]
338    #[inline(always)]
339    pub fn _256cycles(self) -> &'a mut W {
340        self.variant(STEADYTIMEOUT_A::_256CYCLES)
341    }
342    #[doc = "Timeout period of 1024 cycles"]
343    #[inline(always)]
344    pub fn _1kcycles(self) -> &'a mut W {
345        self.variant(STEADYTIMEOUT_A::_1KCYCLES)
346    }
347    #[doc = "Timeout period of 2048 cycles"]
348    #[inline(always)]
349    pub fn _2kcycles(self) -> &'a mut W {
350        self.variant(STEADYTIMEOUT_A::_2KCYCLES)
351    }
352    #[doc = "Timeout period of 4096 cycles"]
353    #[inline(always)]
354    pub fn _4kcycles(self) -> &'a mut W {
355        self.variant(STEADYTIMEOUT_A::_4KCYCLES)
356    }
357    #[doc = "Timeout period of 8192 cycles"]
358    #[inline(always)]
359    pub fn _8kcycles(self) -> &'a mut W {
360        self.variant(STEADYTIMEOUT_A::_8KCYCLES)
361    }
362    #[doc = "Timeout period of 16384 cycles"]
363    #[inline(always)]
364    pub fn _16kcycles(self) -> &'a mut W {
365        self.variant(STEADYTIMEOUT_A::_16KCYCLES)
366    }
367    #[doc = "Timeout period of 32768 cycles"]
368    #[inline(always)]
369    pub fn _32kcycles(self) -> &'a mut W {
370        self.variant(STEADYTIMEOUT_A::_32KCYCLES)
371    }
372    #[doc = r"Writes raw bits to the field"]
373    #[inline(always)]
374    pub unsafe fn bits(self, value: u8) -> &'a mut W {
375        self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4);
376        self.w
377    }
378}
379#[doc = "Wait Duration in HFXO Peak Detection Wait State\n\nValue on reset: 10"]
380#[derive(Clone, Copy, Debug, PartialEq)]
381#[repr(u8)]
382pub enum PEAKDETTIMEOUT_A {
383    #[doc = "0: Timeout period of 2 cycles"]
384    _2CYCLES = 0,
385    #[doc = "1: Timeout period of 4 cycles"]
386    _4CYCLES = 1,
387    #[doc = "2: Timeout period of 16 cycles"]
388    _16CYCLES = 2,
389    #[doc = "3: Timeout period of 32 cycles"]
390    _32CYCLES = 3,
391    #[doc = "4: Timeout period of 256 cycles"]
392    _256CYCLES = 4,
393    #[doc = "5: Timeout period of 1024 cycles"]
394    _1KCYCLES = 5,
395    #[doc = "6: Timeout period of 2048 cycles"]
396    _2KCYCLES = 6,
397    #[doc = "7: Timeout period of 4096 cycles"]
398    _4KCYCLES = 7,
399    #[doc = "8: Timeout period of 8192 cycles"]
400    _8KCYCLES = 8,
401    #[doc = "9: Timeout period of 16384 cycles"]
402    _16KCYCLES = 9,
403    #[doc = "10: Timeout period of 32768 cycles"]
404    _32KCYCLES = 10,
405}
406impl From<PEAKDETTIMEOUT_A> for u8 {
407    #[inline(always)]
408    fn from(variant: PEAKDETTIMEOUT_A) -> Self {
409        variant as _
410    }
411}
412#[doc = "Reader of field `PEAKDETTIMEOUT`"]
413pub type PEAKDETTIMEOUT_R = crate::R<u8, PEAKDETTIMEOUT_A>;
414impl PEAKDETTIMEOUT_R {
415    #[doc = r"Get enumerated values variant"]
416    #[inline(always)]
417    pub fn variant(&self) -> crate::Variant<u8, PEAKDETTIMEOUT_A> {
418        use crate::Variant::*;
419        match self.bits {
420            0 => Val(PEAKDETTIMEOUT_A::_2CYCLES),
421            1 => Val(PEAKDETTIMEOUT_A::_4CYCLES),
422            2 => Val(PEAKDETTIMEOUT_A::_16CYCLES),
423            3 => Val(PEAKDETTIMEOUT_A::_32CYCLES),
424            4 => Val(PEAKDETTIMEOUT_A::_256CYCLES),
425            5 => Val(PEAKDETTIMEOUT_A::_1KCYCLES),
426            6 => Val(PEAKDETTIMEOUT_A::_2KCYCLES),
427            7 => Val(PEAKDETTIMEOUT_A::_4KCYCLES),
428            8 => Val(PEAKDETTIMEOUT_A::_8KCYCLES),
429            9 => Val(PEAKDETTIMEOUT_A::_16KCYCLES),
430            10 => Val(PEAKDETTIMEOUT_A::_32KCYCLES),
431            i => Res(i),
432        }
433    }
434    #[doc = "Checks if the value of the field is `_2CYCLES`"]
435    #[inline(always)]
436    pub fn is_2cycles(&self) -> bool {
437        *self == PEAKDETTIMEOUT_A::_2CYCLES
438    }
439    #[doc = "Checks if the value of the field is `_4CYCLES`"]
440    #[inline(always)]
441    pub fn is_4cycles(&self) -> bool {
442        *self == PEAKDETTIMEOUT_A::_4CYCLES
443    }
444    #[doc = "Checks if the value of the field is `_16CYCLES`"]
445    #[inline(always)]
446    pub fn is_16cycles(&self) -> bool {
447        *self == PEAKDETTIMEOUT_A::_16CYCLES
448    }
449    #[doc = "Checks if the value of the field is `_32CYCLES`"]
450    #[inline(always)]
451    pub fn is_32cycles(&self) -> bool {
452        *self == PEAKDETTIMEOUT_A::_32CYCLES
453    }
454    #[doc = "Checks if the value of the field is `_256CYCLES`"]
455    #[inline(always)]
456    pub fn is_256cycles(&self) -> bool {
457        *self == PEAKDETTIMEOUT_A::_256CYCLES
458    }
459    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
460    #[inline(always)]
461    pub fn is_1kcycles(&self) -> bool {
462        *self == PEAKDETTIMEOUT_A::_1KCYCLES
463    }
464    #[doc = "Checks if the value of the field is `_2KCYCLES`"]
465    #[inline(always)]
466    pub fn is_2kcycles(&self) -> bool {
467        *self == PEAKDETTIMEOUT_A::_2KCYCLES
468    }
469    #[doc = "Checks if the value of the field is `_4KCYCLES`"]
470    #[inline(always)]
471    pub fn is_4kcycles(&self) -> bool {
472        *self == PEAKDETTIMEOUT_A::_4KCYCLES
473    }
474    #[doc = "Checks if the value of the field is `_8KCYCLES`"]
475    #[inline(always)]
476    pub fn is_8kcycles(&self) -> bool {
477        *self == PEAKDETTIMEOUT_A::_8KCYCLES
478    }
479    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
480    #[inline(always)]
481    pub fn is_16kcycles(&self) -> bool {
482        *self == PEAKDETTIMEOUT_A::_16KCYCLES
483    }
484    #[doc = "Checks if the value of the field is `_32KCYCLES`"]
485    #[inline(always)]
486    pub fn is_32kcycles(&self) -> bool {
487        *self == PEAKDETTIMEOUT_A::_32KCYCLES
488    }
489}
490#[doc = "Write proxy for field `PEAKDETTIMEOUT`"]
491pub struct PEAKDETTIMEOUT_W<'a> {
492    w: &'a mut W,
493}
494impl<'a> PEAKDETTIMEOUT_W<'a> {
495    #[doc = r"Writes `variant` to the field"]
496    #[inline(always)]
497    pub fn variant(self, variant: PEAKDETTIMEOUT_A) -> &'a mut W {
498        unsafe { self.bits(variant.into()) }
499    }
500    #[doc = "Timeout period of 2 cycles"]
501    #[inline(always)]
502    pub fn _2cycles(self) -> &'a mut W {
503        self.variant(PEAKDETTIMEOUT_A::_2CYCLES)
504    }
505    #[doc = "Timeout period of 4 cycles"]
506    #[inline(always)]
507    pub fn _4cycles(self) -> &'a mut W {
508        self.variant(PEAKDETTIMEOUT_A::_4CYCLES)
509    }
510    #[doc = "Timeout period of 16 cycles"]
511    #[inline(always)]
512    pub fn _16cycles(self) -> &'a mut W {
513        self.variant(PEAKDETTIMEOUT_A::_16CYCLES)
514    }
515    #[doc = "Timeout period of 32 cycles"]
516    #[inline(always)]
517    pub fn _32cycles(self) -> &'a mut W {
518        self.variant(PEAKDETTIMEOUT_A::_32CYCLES)
519    }
520    #[doc = "Timeout period of 256 cycles"]
521    #[inline(always)]
522    pub fn _256cycles(self) -> &'a mut W {
523        self.variant(PEAKDETTIMEOUT_A::_256CYCLES)
524    }
525    #[doc = "Timeout period of 1024 cycles"]
526    #[inline(always)]
527    pub fn _1kcycles(self) -> &'a mut W {
528        self.variant(PEAKDETTIMEOUT_A::_1KCYCLES)
529    }
530    #[doc = "Timeout period of 2048 cycles"]
531    #[inline(always)]
532    pub fn _2kcycles(self) -> &'a mut W {
533        self.variant(PEAKDETTIMEOUT_A::_2KCYCLES)
534    }
535    #[doc = "Timeout period of 4096 cycles"]
536    #[inline(always)]
537    pub fn _4kcycles(self) -> &'a mut W {
538        self.variant(PEAKDETTIMEOUT_A::_4KCYCLES)
539    }
540    #[doc = "Timeout period of 8192 cycles"]
541    #[inline(always)]
542    pub fn _8kcycles(self) -> &'a mut W {
543        self.variant(PEAKDETTIMEOUT_A::_8KCYCLES)
544    }
545    #[doc = "Timeout period of 16384 cycles"]
546    #[inline(always)]
547    pub fn _16kcycles(self) -> &'a mut W {
548        self.variant(PEAKDETTIMEOUT_A::_16KCYCLES)
549    }
550    #[doc = "Timeout period of 32768 cycles"]
551    #[inline(always)]
552    pub fn _32kcycles(self) -> &'a mut W {
553        self.variant(PEAKDETTIMEOUT_A::_32KCYCLES)
554    }
555    #[doc = r"Writes raw bits to the field"]
556    #[inline(always)]
557    pub unsafe fn bits(self, value: u8) -> &'a mut W {
558        self.w.bits = (self.w.bits & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12);
559        self.w
560    }
561}
562#[doc = "Wait Duration in HFXO Shunt Current Optimization Wait State\n\nValue on reset: 2"]
563#[derive(Clone, Copy, Debug, PartialEq)]
564#[repr(u8)]
565pub enum SHUNTOPTTIMEOUT_A {
566    #[doc = "0: Timeout period of 2 cycles"]
567    _2CYCLES = 0,
568    #[doc = "1: Timeout period of 4 cycles"]
569    _4CYCLES = 1,
570    #[doc = "2: Timeout period of 16 cycles"]
571    _16CYCLES = 2,
572    #[doc = "3: Timeout period of 32 cycles"]
573    _32CYCLES = 3,
574    #[doc = "4: Timeout period of 256 cycles"]
575    _256CYCLES = 4,
576    #[doc = "5: Timeout period of 1024 cycles"]
577    _1KCYCLES = 5,
578    #[doc = "6: Timeout period of 2048 cycles"]
579    _2KCYCLES = 6,
580    #[doc = "7: Timeout period of 4096 cycles"]
581    _4KCYCLES = 7,
582    #[doc = "8: Timeout period of 8192 cycles"]
583    _8KCYCLES = 8,
584    #[doc = "9: Timeout period of 16384 cycles"]
585    _16KCYCLES = 9,
586    #[doc = "10: Timeout period of 32768 cycles"]
587    _32KCYCLES = 10,
588}
589impl From<SHUNTOPTTIMEOUT_A> for u8 {
590    #[inline(always)]
591    fn from(variant: SHUNTOPTTIMEOUT_A) -> Self {
592        variant as _
593    }
594}
595#[doc = "Reader of field `SHUNTOPTTIMEOUT`"]
596pub type SHUNTOPTTIMEOUT_R = crate::R<u8, SHUNTOPTTIMEOUT_A>;
597impl SHUNTOPTTIMEOUT_R {
598    #[doc = r"Get enumerated values variant"]
599    #[inline(always)]
600    pub fn variant(&self) -> crate::Variant<u8, SHUNTOPTTIMEOUT_A> {
601        use crate::Variant::*;
602        match self.bits {
603            0 => Val(SHUNTOPTTIMEOUT_A::_2CYCLES),
604            1 => Val(SHUNTOPTTIMEOUT_A::_4CYCLES),
605            2 => Val(SHUNTOPTTIMEOUT_A::_16CYCLES),
606            3 => Val(SHUNTOPTTIMEOUT_A::_32CYCLES),
607            4 => Val(SHUNTOPTTIMEOUT_A::_256CYCLES),
608            5 => Val(SHUNTOPTTIMEOUT_A::_1KCYCLES),
609            6 => Val(SHUNTOPTTIMEOUT_A::_2KCYCLES),
610            7 => Val(SHUNTOPTTIMEOUT_A::_4KCYCLES),
611            8 => Val(SHUNTOPTTIMEOUT_A::_8KCYCLES),
612            9 => Val(SHUNTOPTTIMEOUT_A::_16KCYCLES),
613            10 => Val(SHUNTOPTTIMEOUT_A::_32KCYCLES),
614            i => Res(i),
615        }
616    }
617    #[doc = "Checks if the value of the field is `_2CYCLES`"]
618    #[inline(always)]
619    pub fn is_2cycles(&self) -> bool {
620        *self == SHUNTOPTTIMEOUT_A::_2CYCLES
621    }
622    #[doc = "Checks if the value of the field is `_4CYCLES`"]
623    #[inline(always)]
624    pub fn is_4cycles(&self) -> bool {
625        *self == SHUNTOPTTIMEOUT_A::_4CYCLES
626    }
627    #[doc = "Checks if the value of the field is `_16CYCLES`"]
628    #[inline(always)]
629    pub fn is_16cycles(&self) -> bool {
630        *self == SHUNTOPTTIMEOUT_A::_16CYCLES
631    }
632    #[doc = "Checks if the value of the field is `_32CYCLES`"]
633    #[inline(always)]
634    pub fn is_32cycles(&self) -> bool {
635        *self == SHUNTOPTTIMEOUT_A::_32CYCLES
636    }
637    #[doc = "Checks if the value of the field is `_256CYCLES`"]
638    #[inline(always)]
639    pub fn is_256cycles(&self) -> bool {
640        *self == SHUNTOPTTIMEOUT_A::_256CYCLES
641    }
642    #[doc = "Checks if the value of the field is `_1KCYCLES`"]
643    #[inline(always)]
644    pub fn is_1kcycles(&self) -> bool {
645        *self == SHUNTOPTTIMEOUT_A::_1KCYCLES
646    }
647    #[doc = "Checks if the value of the field is `_2KCYCLES`"]
648    #[inline(always)]
649    pub fn is_2kcycles(&self) -> bool {
650        *self == SHUNTOPTTIMEOUT_A::_2KCYCLES
651    }
652    #[doc = "Checks if the value of the field is `_4KCYCLES`"]
653    #[inline(always)]
654    pub fn is_4kcycles(&self) -> bool {
655        *self == SHUNTOPTTIMEOUT_A::_4KCYCLES
656    }
657    #[doc = "Checks if the value of the field is `_8KCYCLES`"]
658    #[inline(always)]
659    pub fn is_8kcycles(&self) -> bool {
660        *self == SHUNTOPTTIMEOUT_A::_8KCYCLES
661    }
662    #[doc = "Checks if the value of the field is `_16KCYCLES`"]
663    #[inline(always)]
664    pub fn is_16kcycles(&self) -> bool {
665        *self == SHUNTOPTTIMEOUT_A::_16KCYCLES
666    }
667    #[doc = "Checks if the value of the field is `_32KCYCLES`"]
668    #[inline(always)]
669    pub fn is_32kcycles(&self) -> bool {
670        *self == SHUNTOPTTIMEOUT_A::_32KCYCLES
671    }
672}
673#[doc = "Write proxy for field `SHUNTOPTTIMEOUT`"]
674pub struct SHUNTOPTTIMEOUT_W<'a> {
675    w: &'a mut W,
676}
677impl<'a> SHUNTOPTTIMEOUT_W<'a> {
678    #[doc = r"Writes `variant` to the field"]
679    #[inline(always)]
680    pub fn variant(self, variant: SHUNTOPTTIMEOUT_A) -> &'a mut W {
681        unsafe { self.bits(variant.into()) }
682    }
683    #[doc = "Timeout period of 2 cycles"]
684    #[inline(always)]
685    pub fn _2cycles(self) -> &'a mut W {
686        self.variant(SHUNTOPTTIMEOUT_A::_2CYCLES)
687    }
688    #[doc = "Timeout period of 4 cycles"]
689    #[inline(always)]
690    pub fn _4cycles(self) -> &'a mut W {
691        self.variant(SHUNTOPTTIMEOUT_A::_4CYCLES)
692    }
693    #[doc = "Timeout period of 16 cycles"]
694    #[inline(always)]
695    pub fn _16cycles(self) -> &'a mut W {
696        self.variant(SHUNTOPTTIMEOUT_A::_16CYCLES)
697    }
698    #[doc = "Timeout period of 32 cycles"]
699    #[inline(always)]
700    pub fn _32cycles(self) -> &'a mut W {
701        self.variant(SHUNTOPTTIMEOUT_A::_32CYCLES)
702    }
703    #[doc = "Timeout period of 256 cycles"]
704    #[inline(always)]
705    pub fn _256cycles(self) -> &'a mut W {
706        self.variant(SHUNTOPTTIMEOUT_A::_256CYCLES)
707    }
708    #[doc = "Timeout period of 1024 cycles"]
709    #[inline(always)]
710    pub fn _1kcycles(self) -> &'a mut W {
711        self.variant(SHUNTOPTTIMEOUT_A::_1KCYCLES)
712    }
713    #[doc = "Timeout period of 2048 cycles"]
714    #[inline(always)]
715    pub fn _2kcycles(self) -> &'a mut W {
716        self.variant(SHUNTOPTTIMEOUT_A::_2KCYCLES)
717    }
718    #[doc = "Timeout period of 4096 cycles"]
719    #[inline(always)]
720    pub fn _4kcycles(self) -> &'a mut W {
721        self.variant(SHUNTOPTTIMEOUT_A::_4KCYCLES)
722    }
723    #[doc = "Timeout period of 8192 cycles"]
724    #[inline(always)]
725    pub fn _8kcycles(self) -> &'a mut W {
726        self.variant(SHUNTOPTTIMEOUT_A::_8KCYCLES)
727    }
728    #[doc = "Timeout period of 16384 cycles"]
729    #[inline(always)]
730    pub fn _16kcycles(self) -> &'a mut W {
731        self.variant(SHUNTOPTTIMEOUT_A::_16KCYCLES)
732    }
733    #[doc = "Timeout period of 32768 cycles"]
734    #[inline(always)]
735    pub fn _32kcycles(self) -> &'a mut W {
736        self.variant(SHUNTOPTTIMEOUT_A::_32KCYCLES)
737    }
738    #[doc = r"Writes raw bits to the field"]
739    #[inline(always)]
740    pub unsafe fn bits(self, value: u8) -> &'a mut W {
741        self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
742        self.w
743    }
744}
745impl R {
746    #[doc = "Bits 0:3 - Wait Duration in HFXO Startup Enable Wait State"]
747    #[inline(always)]
748    pub fn startuptimeout(&self) -> STARTUPTIMEOUT_R {
749        STARTUPTIMEOUT_R::new((self.bits & 0x0f) as u8)
750    }
751    #[doc = "Bits 4:7 - Wait Duration in HFXO Startup Steady Wait State"]
752    #[inline(always)]
753    pub fn steadytimeout(&self) -> STEADYTIMEOUT_R {
754        STEADYTIMEOUT_R::new(((self.bits >> 4) & 0x0f) as u8)
755    }
756    #[doc = "Bits 12:15 - Wait Duration in HFXO Peak Detection Wait State"]
757    #[inline(always)]
758    pub fn peakdettimeout(&self) -> PEAKDETTIMEOUT_R {
759        PEAKDETTIMEOUT_R::new(((self.bits >> 12) & 0x0f) as u8)
760    }
761    #[doc = "Bits 16:19 - Wait Duration in HFXO Shunt Current Optimization Wait State"]
762    #[inline(always)]
763    pub fn shuntopttimeout(&self) -> SHUNTOPTTIMEOUT_R {
764        SHUNTOPTTIMEOUT_R::new(((self.bits >> 16) & 0x0f) as u8)
765    }
766}
767impl W {
768    #[doc = "Bits 0:3 - Wait Duration in HFXO Startup Enable Wait State"]
769    #[inline(always)]
770    pub fn startuptimeout(&mut self) -> STARTUPTIMEOUT_W {
771        STARTUPTIMEOUT_W { w: self }
772    }
773    #[doc = "Bits 4:7 - Wait Duration in HFXO Startup Steady Wait State"]
774    #[inline(always)]
775    pub fn steadytimeout(&mut self) -> STEADYTIMEOUT_W {
776        STEADYTIMEOUT_W { w: self }
777    }
778    #[doc = "Bits 12:15 - Wait Duration in HFXO Peak Detection Wait State"]
779    #[inline(always)]
780    pub fn peakdettimeout(&mut self) -> PEAKDETTIMEOUT_W {
781        PEAKDETTIMEOUT_W { w: self }
782    }
783    #[doc = "Bits 16:19 - Wait Duration in HFXO Shunt Current Optimization Wait State"]
784    #[inline(always)]
785    pub fn shuntopttimeout(&mut self) -> SHUNTOPTTIMEOUT_W {
786        SHUNTOPTTIMEOUT_W { w: self }
787    }
788}