atsamd51p19a/oscctrl/
xoscctrl.rs

1#[doc = "Reader of register XOSCCTRL[%s]"]
2pub type R = crate::R<u32, super::XOSCCTRL>;
3#[doc = "Writer for register XOSCCTRL[%s]"]
4pub type W = crate::W<u32, super::XOSCCTRL>;
5#[doc = "Register XOSCCTRL[%s]
6`reset()`'s with value 0x80"]
7impl crate::ResetValue for super::XOSCCTRL {
8    type Type = u32;
9    #[inline(always)]
10    fn reset_value() -> Self::Type {
11        0x80
12    }
13}
14#[doc = "Reader of field `ENABLE`"]
15pub type ENABLE_R = crate::R<bool, bool>;
16#[doc = "Write proxy for field `ENABLE`"]
17pub struct ENABLE_W<'a> {
18    w: &'a mut W,
19}
20impl<'a> ENABLE_W<'a> {
21    #[doc = r"Sets the field bit"]
22    #[inline(always)]
23    pub fn set_bit(self) -> &'a mut W {
24        self.bit(true)
25    }
26    #[doc = r"Clears the field bit"]
27    #[inline(always)]
28    pub fn clear_bit(self) -> &'a mut W {
29        self.bit(false)
30    }
31    #[doc = r"Writes raw bits to the field"]
32    #[inline(always)]
33    pub fn bit(self, value: bool) -> &'a mut W {
34        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
35        self.w
36    }
37}
38#[doc = "Reader of field `XTALEN`"]
39pub type XTALEN_R = crate::R<bool, bool>;
40#[doc = "Write proxy for field `XTALEN`"]
41pub struct XTALEN_W<'a> {
42    w: &'a mut W,
43}
44impl<'a> XTALEN_W<'a> {
45    #[doc = r"Sets the field bit"]
46    #[inline(always)]
47    pub fn set_bit(self) -> &'a mut W {
48        self.bit(true)
49    }
50    #[doc = r"Clears the field bit"]
51    #[inline(always)]
52    pub fn clear_bit(self) -> &'a mut W {
53        self.bit(false)
54    }
55    #[doc = r"Writes raw bits to the field"]
56    #[inline(always)]
57    pub fn bit(self, value: bool) -> &'a mut W {
58        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
59        self.w
60    }
61}
62#[doc = "Reader of field `RUNSTDBY`"]
63pub type RUNSTDBY_R = crate::R<bool, bool>;
64#[doc = "Write proxy for field `RUNSTDBY`"]
65pub struct RUNSTDBY_W<'a> {
66    w: &'a mut W,
67}
68impl<'a> RUNSTDBY_W<'a> {
69    #[doc = r"Sets the field bit"]
70    #[inline(always)]
71    pub fn set_bit(self) -> &'a mut W {
72        self.bit(true)
73    }
74    #[doc = r"Clears the field bit"]
75    #[inline(always)]
76    pub fn clear_bit(self) -> &'a mut W {
77        self.bit(false)
78    }
79    #[doc = r"Writes raw bits to the field"]
80    #[inline(always)]
81    pub fn bit(self, value: bool) -> &'a mut W {
82        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
83        self.w
84    }
85}
86#[doc = "Reader of field `ONDEMAND`"]
87pub type ONDEMAND_R = crate::R<bool, bool>;
88#[doc = "Write proxy for field `ONDEMAND`"]
89pub struct ONDEMAND_W<'a> {
90    w: &'a mut W,
91}
92impl<'a> ONDEMAND_W<'a> {
93    #[doc = r"Sets the field bit"]
94    #[inline(always)]
95    pub fn set_bit(self) -> &'a mut W {
96        self.bit(true)
97    }
98    #[doc = r"Clears the field bit"]
99    #[inline(always)]
100    pub fn clear_bit(self) -> &'a mut W {
101        self.bit(false)
102    }
103    #[doc = r"Writes raw bits to the field"]
104    #[inline(always)]
105    pub fn bit(self, value: bool) -> &'a mut W {
106        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
107        self.w
108    }
109}
110#[doc = "Reader of field `LOWBUFGAIN`"]
111pub type LOWBUFGAIN_R = crate::R<bool, bool>;
112#[doc = "Write proxy for field `LOWBUFGAIN`"]
113pub struct LOWBUFGAIN_W<'a> {
114    w: &'a mut W,
115}
116impl<'a> LOWBUFGAIN_W<'a> {
117    #[doc = r"Sets the field bit"]
118    #[inline(always)]
119    pub fn set_bit(self) -> &'a mut W {
120        self.bit(true)
121    }
122    #[doc = r"Clears the field bit"]
123    #[inline(always)]
124    pub fn clear_bit(self) -> &'a mut W {
125        self.bit(false)
126    }
127    #[doc = r"Writes raw bits to the field"]
128    #[inline(always)]
129    pub fn bit(self, value: bool) -> &'a mut W {
130        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
131        self.w
132    }
133}
134#[doc = "Reader of field `IPTAT`"]
135pub type IPTAT_R = crate::R<u8, u8>;
136#[doc = "Write proxy for field `IPTAT`"]
137pub struct IPTAT_W<'a> {
138    w: &'a mut W,
139}
140impl<'a> IPTAT_W<'a> {
141    #[doc = r"Writes raw bits to the field"]
142    #[inline(always)]
143    pub unsafe fn bits(self, value: u8) -> &'a mut W {
144        self.w.bits = (self.w.bits & !(0x03 << 9)) | (((value as u32) & 0x03) << 9);
145        self.w
146    }
147}
148#[doc = "Reader of field `IMULT`"]
149pub type IMULT_R = crate::R<u8, u8>;
150#[doc = "Write proxy for field `IMULT`"]
151pub struct IMULT_W<'a> {
152    w: &'a mut W,
153}
154impl<'a> IMULT_W<'a> {
155    #[doc = r"Writes raw bits to the field"]
156    #[inline(always)]
157    pub unsafe fn bits(self, value: u8) -> &'a mut W {
158        self.w.bits = (self.w.bits & !(0x0f << 11)) | (((value as u32) & 0x0f) << 11);
159        self.w
160    }
161}
162#[doc = "Reader of field `ENALC`"]
163pub type ENALC_R = crate::R<bool, bool>;
164#[doc = "Write proxy for field `ENALC`"]
165pub struct ENALC_W<'a> {
166    w: &'a mut W,
167}
168impl<'a> ENALC_W<'a> {
169    #[doc = r"Sets the field bit"]
170    #[inline(always)]
171    pub fn set_bit(self) -> &'a mut W {
172        self.bit(true)
173    }
174    #[doc = r"Clears the field bit"]
175    #[inline(always)]
176    pub fn clear_bit(self) -> &'a mut W {
177        self.bit(false)
178    }
179    #[doc = r"Writes raw bits to the field"]
180    #[inline(always)]
181    pub fn bit(self, value: bool) -> &'a mut W {
182        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
183        self.w
184    }
185}
186#[doc = "Reader of field `CFDEN`"]
187pub type CFDEN_R = crate::R<bool, bool>;
188#[doc = "Write proxy for field `CFDEN`"]
189pub struct CFDEN_W<'a> {
190    w: &'a mut W,
191}
192impl<'a> CFDEN_W<'a> {
193    #[doc = r"Sets the field bit"]
194    #[inline(always)]
195    pub fn set_bit(self) -> &'a mut W {
196        self.bit(true)
197    }
198    #[doc = r"Clears the field bit"]
199    #[inline(always)]
200    pub fn clear_bit(self) -> &'a mut W {
201        self.bit(false)
202    }
203    #[doc = r"Writes raw bits to the field"]
204    #[inline(always)]
205    pub fn bit(self, value: bool) -> &'a mut W {
206        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
207        self.w
208    }
209}
210#[doc = "Reader of field `SWBEN`"]
211pub type SWBEN_R = crate::R<bool, bool>;
212#[doc = "Write proxy for field `SWBEN`"]
213pub struct SWBEN_W<'a> {
214    w: &'a mut W,
215}
216impl<'a> SWBEN_W<'a> {
217    #[doc = r"Sets the field bit"]
218    #[inline(always)]
219    pub fn set_bit(self) -> &'a mut W {
220        self.bit(true)
221    }
222    #[doc = r"Clears the field bit"]
223    #[inline(always)]
224    pub fn clear_bit(self) -> &'a mut W {
225        self.bit(false)
226    }
227    #[doc = r"Writes raw bits to the field"]
228    #[inline(always)]
229    pub fn bit(self, value: bool) -> &'a mut W {
230        self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
231        self.w
232    }
233}
234#[doc = "Start-Up Time\n\nValue on reset: 0"]
235#[derive(Clone, Copy, Debug, PartialEq)]
236#[repr(u8)]
237pub enum STARTUP_A {
238    #[doc = "0: 31 us"]
239    CYCLE1 = 0,
240    #[doc = "1: 61 us"]
241    CYCLE2 = 1,
242    #[doc = "2: 122 us"]
243    CYCLE4 = 2,
244    #[doc = "3: 244 us"]
245    CYCLE8 = 3,
246    #[doc = "4: 488 us"]
247    CYCLE16 = 4,
248    #[doc = "5: 977 us"]
249    CYCLE32 = 5,
250    #[doc = "6: 1953 us"]
251    CYCLE64 = 6,
252    #[doc = "7: 3906 us"]
253    CYCLE128 = 7,
254    #[doc = "8: 7813 us"]
255    CYCLE256 = 8,
256    #[doc = "9: 15625 us"]
257    CYCLE512 = 9,
258    #[doc = "10: 31250 us"]
259    CYCLE1024 = 10,
260    #[doc = "11: 62500 us"]
261    CYCLE2048 = 11,
262    #[doc = "12: 125000 us"]
263    CYCLE4096 = 12,
264    #[doc = "13: 250000 us"]
265    CYCLE8192 = 13,
266    #[doc = "14: 500000 us"]
267    CYCLE16384 = 14,
268    #[doc = "15: 1000000 us"]
269    CYCLE32768 = 15,
270}
271impl From<STARTUP_A> for u8 {
272    #[inline(always)]
273    fn from(variant: STARTUP_A) -> Self {
274        variant as _
275    }
276}
277#[doc = "Reader of field `STARTUP`"]
278pub type STARTUP_R = crate::R<u8, STARTUP_A>;
279impl STARTUP_R {
280    #[doc = r"Get enumerated values variant"]
281    #[inline(always)]
282    pub fn variant(&self) -> STARTUP_A {
283        match self.bits {
284            0 => STARTUP_A::CYCLE1,
285            1 => STARTUP_A::CYCLE2,
286            2 => STARTUP_A::CYCLE4,
287            3 => STARTUP_A::CYCLE8,
288            4 => STARTUP_A::CYCLE16,
289            5 => STARTUP_A::CYCLE32,
290            6 => STARTUP_A::CYCLE64,
291            7 => STARTUP_A::CYCLE128,
292            8 => STARTUP_A::CYCLE256,
293            9 => STARTUP_A::CYCLE512,
294            10 => STARTUP_A::CYCLE1024,
295            11 => STARTUP_A::CYCLE2048,
296            12 => STARTUP_A::CYCLE4096,
297            13 => STARTUP_A::CYCLE8192,
298            14 => STARTUP_A::CYCLE16384,
299            15 => STARTUP_A::CYCLE32768,
300            _ => unreachable!(),
301        }
302    }
303    #[doc = "Checks if the value of the field is `CYCLE1`"]
304    #[inline(always)]
305    pub fn is_cycle1(&self) -> bool {
306        *self == STARTUP_A::CYCLE1
307    }
308    #[doc = "Checks if the value of the field is `CYCLE2`"]
309    #[inline(always)]
310    pub fn is_cycle2(&self) -> bool {
311        *self == STARTUP_A::CYCLE2
312    }
313    #[doc = "Checks if the value of the field is `CYCLE4`"]
314    #[inline(always)]
315    pub fn is_cycle4(&self) -> bool {
316        *self == STARTUP_A::CYCLE4
317    }
318    #[doc = "Checks if the value of the field is `CYCLE8`"]
319    #[inline(always)]
320    pub fn is_cycle8(&self) -> bool {
321        *self == STARTUP_A::CYCLE8
322    }
323    #[doc = "Checks if the value of the field is `CYCLE16`"]
324    #[inline(always)]
325    pub fn is_cycle16(&self) -> bool {
326        *self == STARTUP_A::CYCLE16
327    }
328    #[doc = "Checks if the value of the field is `CYCLE32`"]
329    #[inline(always)]
330    pub fn is_cycle32(&self) -> bool {
331        *self == STARTUP_A::CYCLE32
332    }
333    #[doc = "Checks if the value of the field is `CYCLE64`"]
334    #[inline(always)]
335    pub fn is_cycle64(&self) -> bool {
336        *self == STARTUP_A::CYCLE64
337    }
338    #[doc = "Checks if the value of the field is `CYCLE128`"]
339    #[inline(always)]
340    pub fn is_cycle128(&self) -> bool {
341        *self == STARTUP_A::CYCLE128
342    }
343    #[doc = "Checks if the value of the field is `CYCLE256`"]
344    #[inline(always)]
345    pub fn is_cycle256(&self) -> bool {
346        *self == STARTUP_A::CYCLE256
347    }
348    #[doc = "Checks if the value of the field is `CYCLE512`"]
349    #[inline(always)]
350    pub fn is_cycle512(&self) -> bool {
351        *self == STARTUP_A::CYCLE512
352    }
353    #[doc = "Checks if the value of the field is `CYCLE1024`"]
354    #[inline(always)]
355    pub fn is_cycle1024(&self) -> bool {
356        *self == STARTUP_A::CYCLE1024
357    }
358    #[doc = "Checks if the value of the field is `CYCLE2048`"]
359    #[inline(always)]
360    pub fn is_cycle2048(&self) -> bool {
361        *self == STARTUP_A::CYCLE2048
362    }
363    #[doc = "Checks if the value of the field is `CYCLE4096`"]
364    #[inline(always)]
365    pub fn is_cycle4096(&self) -> bool {
366        *self == STARTUP_A::CYCLE4096
367    }
368    #[doc = "Checks if the value of the field is `CYCLE8192`"]
369    #[inline(always)]
370    pub fn is_cycle8192(&self) -> bool {
371        *self == STARTUP_A::CYCLE8192
372    }
373    #[doc = "Checks if the value of the field is `CYCLE16384`"]
374    #[inline(always)]
375    pub fn is_cycle16384(&self) -> bool {
376        *self == STARTUP_A::CYCLE16384
377    }
378    #[doc = "Checks if the value of the field is `CYCLE32768`"]
379    #[inline(always)]
380    pub fn is_cycle32768(&self) -> bool {
381        *self == STARTUP_A::CYCLE32768
382    }
383}
384#[doc = "Write proxy for field `STARTUP`"]
385pub struct STARTUP_W<'a> {
386    w: &'a mut W,
387}
388impl<'a> STARTUP_W<'a> {
389    #[doc = r"Writes `variant` to the field"]
390    #[inline(always)]
391    pub fn variant(self, variant: STARTUP_A) -> &'a mut W {
392        {
393            self.bits(variant.into())
394        }
395    }
396    #[doc = "31 us"]
397    #[inline(always)]
398    pub fn cycle1(self) -> &'a mut W {
399        self.variant(STARTUP_A::CYCLE1)
400    }
401    #[doc = "61 us"]
402    #[inline(always)]
403    pub fn cycle2(self) -> &'a mut W {
404        self.variant(STARTUP_A::CYCLE2)
405    }
406    #[doc = "122 us"]
407    #[inline(always)]
408    pub fn cycle4(self) -> &'a mut W {
409        self.variant(STARTUP_A::CYCLE4)
410    }
411    #[doc = "244 us"]
412    #[inline(always)]
413    pub fn cycle8(self) -> &'a mut W {
414        self.variant(STARTUP_A::CYCLE8)
415    }
416    #[doc = "488 us"]
417    #[inline(always)]
418    pub fn cycle16(self) -> &'a mut W {
419        self.variant(STARTUP_A::CYCLE16)
420    }
421    #[doc = "977 us"]
422    #[inline(always)]
423    pub fn cycle32(self) -> &'a mut W {
424        self.variant(STARTUP_A::CYCLE32)
425    }
426    #[doc = "1953 us"]
427    #[inline(always)]
428    pub fn cycle64(self) -> &'a mut W {
429        self.variant(STARTUP_A::CYCLE64)
430    }
431    #[doc = "3906 us"]
432    #[inline(always)]
433    pub fn cycle128(self) -> &'a mut W {
434        self.variant(STARTUP_A::CYCLE128)
435    }
436    #[doc = "7813 us"]
437    #[inline(always)]
438    pub fn cycle256(self) -> &'a mut W {
439        self.variant(STARTUP_A::CYCLE256)
440    }
441    #[doc = "15625 us"]
442    #[inline(always)]
443    pub fn cycle512(self) -> &'a mut W {
444        self.variant(STARTUP_A::CYCLE512)
445    }
446    #[doc = "31250 us"]
447    #[inline(always)]
448    pub fn cycle1024(self) -> &'a mut W {
449        self.variant(STARTUP_A::CYCLE1024)
450    }
451    #[doc = "62500 us"]
452    #[inline(always)]
453    pub fn cycle2048(self) -> &'a mut W {
454        self.variant(STARTUP_A::CYCLE2048)
455    }
456    #[doc = "125000 us"]
457    #[inline(always)]
458    pub fn cycle4096(self) -> &'a mut W {
459        self.variant(STARTUP_A::CYCLE4096)
460    }
461    #[doc = "250000 us"]
462    #[inline(always)]
463    pub fn cycle8192(self) -> &'a mut W {
464        self.variant(STARTUP_A::CYCLE8192)
465    }
466    #[doc = "500000 us"]
467    #[inline(always)]
468    pub fn cycle16384(self) -> &'a mut W {
469        self.variant(STARTUP_A::CYCLE16384)
470    }
471    #[doc = "1000000 us"]
472    #[inline(always)]
473    pub fn cycle32768(self) -> &'a mut W {
474        self.variant(STARTUP_A::CYCLE32768)
475    }
476    #[doc = r"Writes raw bits to the field"]
477    #[inline(always)]
478    pub fn bits(self, value: u8) -> &'a mut W {
479        self.w.bits = (self.w.bits & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
480        self.w
481    }
482}
483#[doc = "Clock Failure Detector Prescaler\n\nValue on reset: 0"]
484#[derive(Clone, Copy, Debug, PartialEq)]
485#[repr(u8)]
486pub enum CFDPRESC_A {
487    #[doc = "0: 48 MHz"]
488    DIV1 = 0,
489    #[doc = "1: 24 MHz"]
490    DIV2 = 1,
491    #[doc = "2: 12 MHz"]
492    DIV4 = 2,
493    #[doc = "3: 6 MHz"]
494    DIV8 = 3,
495    #[doc = "4: 3 MHz"]
496    DIV16 = 4,
497    #[doc = "5: 1.5 MHz"]
498    DIV32 = 5,
499    #[doc = "6: 0.75 MHz"]
500    DIV64 = 6,
501    #[doc = "7: 0.3125 MHz"]
502    DIV128 = 7,
503}
504impl From<CFDPRESC_A> for u8 {
505    #[inline(always)]
506    fn from(variant: CFDPRESC_A) -> Self {
507        variant as _
508    }
509}
510#[doc = "Reader of field `CFDPRESC`"]
511pub type CFDPRESC_R = crate::R<u8, CFDPRESC_A>;
512impl CFDPRESC_R {
513    #[doc = r"Get enumerated values variant"]
514    #[inline(always)]
515    pub fn variant(&self) -> crate::Variant<u8, CFDPRESC_A> {
516        use crate::Variant::*;
517        match self.bits {
518            0 => Val(CFDPRESC_A::DIV1),
519            1 => Val(CFDPRESC_A::DIV2),
520            2 => Val(CFDPRESC_A::DIV4),
521            3 => Val(CFDPRESC_A::DIV8),
522            4 => Val(CFDPRESC_A::DIV16),
523            5 => Val(CFDPRESC_A::DIV32),
524            6 => Val(CFDPRESC_A::DIV64),
525            7 => Val(CFDPRESC_A::DIV128),
526            i => Res(i),
527        }
528    }
529    #[doc = "Checks if the value of the field is `DIV1`"]
530    #[inline(always)]
531    pub fn is_div1(&self) -> bool {
532        *self == CFDPRESC_A::DIV1
533    }
534    #[doc = "Checks if the value of the field is `DIV2`"]
535    #[inline(always)]
536    pub fn is_div2(&self) -> bool {
537        *self == CFDPRESC_A::DIV2
538    }
539    #[doc = "Checks if the value of the field is `DIV4`"]
540    #[inline(always)]
541    pub fn is_div4(&self) -> bool {
542        *self == CFDPRESC_A::DIV4
543    }
544    #[doc = "Checks if the value of the field is `DIV8`"]
545    #[inline(always)]
546    pub fn is_div8(&self) -> bool {
547        *self == CFDPRESC_A::DIV8
548    }
549    #[doc = "Checks if the value of the field is `DIV16`"]
550    #[inline(always)]
551    pub fn is_div16(&self) -> bool {
552        *self == CFDPRESC_A::DIV16
553    }
554    #[doc = "Checks if the value of the field is `DIV32`"]
555    #[inline(always)]
556    pub fn is_div32(&self) -> bool {
557        *self == CFDPRESC_A::DIV32
558    }
559    #[doc = "Checks if the value of the field is `DIV64`"]
560    #[inline(always)]
561    pub fn is_div64(&self) -> bool {
562        *self == CFDPRESC_A::DIV64
563    }
564    #[doc = "Checks if the value of the field is `DIV128`"]
565    #[inline(always)]
566    pub fn is_div128(&self) -> bool {
567        *self == CFDPRESC_A::DIV128
568    }
569}
570#[doc = "Write proxy for field `CFDPRESC`"]
571pub struct CFDPRESC_W<'a> {
572    w: &'a mut W,
573}
574impl<'a> CFDPRESC_W<'a> {
575    #[doc = r"Writes `variant` to the field"]
576    #[inline(always)]
577    pub fn variant(self, variant: CFDPRESC_A) -> &'a mut W {
578        unsafe { self.bits(variant.into()) }
579    }
580    #[doc = "48 MHz"]
581    #[inline(always)]
582    pub fn div1(self) -> &'a mut W {
583        self.variant(CFDPRESC_A::DIV1)
584    }
585    #[doc = "24 MHz"]
586    #[inline(always)]
587    pub fn div2(self) -> &'a mut W {
588        self.variant(CFDPRESC_A::DIV2)
589    }
590    #[doc = "12 MHz"]
591    #[inline(always)]
592    pub fn div4(self) -> &'a mut W {
593        self.variant(CFDPRESC_A::DIV4)
594    }
595    #[doc = "6 MHz"]
596    #[inline(always)]
597    pub fn div8(self) -> &'a mut W {
598        self.variant(CFDPRESC_A::DIV8)
599    }
600    #[doc = "3 MHz"]
601    #[inline(always)]
602    pub fn div16(self) -> &'a mut W {
603        self.variant(CFDPRESC_A::DIV16)
604    }
605    #[doc = "1.5 MHz"]
606    #[inline(always)]
607    pub fn div32(self) -> &'a mut W {
608        self.variant(CFDPRESC_A::DIV32)
609    }
610    #[doc = "0.75 MHz"]
611    #[inline(always)]
612    pub fn div64(self) -> &'a mut W {
613        self.variant(CFDPRESC_A::DIV64)
614    }
615    #[doc = "0.3125 MHz"]
616    #[inline(always)]
617    pub fn div128(self) -> &'a mut W {
618        self.variant(CFDPRESC_A::DIV128)
619    }
620    #[doc = r"Writes raw bits to the field"]
621    #[inline(always)]
622    pub unsafe fn bits(self, value: u8) -> &'a mut W {
623        self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24);
624        self.w
625    }
626}
627impl R {
628    #[doc = "Bit 1 - Oscillator Enable"]
629    #[inline(always)]
630    pub fn enable(&self) -> ENABLE_R {
631        ENABLE_R::new(((self.bits >> 1) & 0x01) != 0)
632    }
633    #[doc = "Bit 2 - Crystal Oscillator Enable"]
634    #[inline(always)]
635    pub fn xtalen(&self) -> XTALEN_R {
636        XTALEN_R::new(((self.bits >> 2) & 0x01) != 0)
637    }
638    #[doc = "Bit 6 - Run in Standby"]
639    #[inline(always)]
640    pub fn runstdby(&self) -> RUNSTDBY_R {
641        RUNSTDBY_R::new(((self.bits >> 6) & 0x01) != 0)
642    }
643    #[doc = "Bit 7 - On Demand Control"]
644    #[inline(always)]
645    pub fn ondemand(&self) -> ONDEMAND_R {
646        ONDEMAND_R::new(((self.bits >> 7) & 0x01) != 0)
647    }
648    #[doc = "Bit 8 - Low Buffer Gain Enable"]
649    #[inline(always)]
650    pub fn lowbufgain(&self) -> LOWBUFGAIN_R {
651        LOWBUFGAIN_R::new(((self.bits >> 8) & 0x01) != 0)
652    }
653    #[doc = "Bits 9:10 - Oscillator Current Reference"]
654    #[inline(always)]
655    pub fn iptat(&self) -> IPTAT_R {
656        IPTAT_R::new(((self.bits >> 9) & 0x03) as u8)
657    }
658    #[doc = "Bits 11:14 - Oscillator Current Multiplier"]
659    #[inline(always)]
660    pub fn imult(&self) -> IMULT_R {
661        IMULT_R::new(((self.bits >> 11) & 0x0f) as u8)
662    }
663    #[doc = "Bit 15 - Automatic Loop Control Enable"]
664    #[inline(always)]
665    pub fn enalc(&self) -> ENALC_R {
666        ENALC_R::new(((self.bits >> 15) & 0x01) != 0)
667    }
668    #[doc = "Bit 16 - Clock Failure Detector Enable"]
669    #[inline(always)]
670    pub fn cfden(&self) -> CFDEN_R {
671        CFDEN_R::new(((self.bits >> 16) & 0x01) != 0)
672    }
673    #[doc = "Bit 17 - Xosc Clock Switch Enable"]
674    #[inline(always)]
675    pub fn swben(&self) -> SWBEN_R {
676        SWBEN_R::new(((self.bits >> 17) & 0x01) != 0)
677    }
678    #[doc = "Bits 20:23 - Start-Up Time"]
679    #[inline(always)]
680    pub fn startup(&self) -> STARTUP_R {
681        STARTUP_R::new(((self.bits >> 20) & 0x0f) as u8)
682    }
683    #[doc = "Bits 24:27 - Clock Failure Detector Prescaler"]
684    #[inline(always)]
685    pub fn cfdpresc(&self) -> CFDPRESC_R {
686        CFDPRESC_R::new(((self.bits >> 24) & 0x0f) as u8)
687    }
688}
689impl W {
690    #[doc = "Bit 1 - Oscillator Enable"]
691    #[inline(always)]
692    pub fn enable(&mut self) -> ENABLE_W {
693        ENABLE_W { w: self }
694    }
695    #[doc = "Bit 2 - Crystal Oscillator Enable"]
696    #[inline(always)]
697    pub fn xtalen(&mut self) -> XTALEN_W {
698        XTALEN_W { w: self }
699    }
700    #[doc = "Bit 6 - Run in Standby"]
701    #[inline(always)]
702    pub fn runstdby(&mut self) -> RUNSTDBY_W {
703        RUNSTDBY_W { w: self }
704    }
705    #[doc = "Bit 7 - On Demand Control"]
706    #[inline(always)]
707    pub fn ondemand(&mut self) -> ONDEMAND_W {
708        ONDEMAND_W { w: self }
709    }
710    #[doc = "Bit 8 - Low Buffer Gain Enable"]
711    #[inline(always)]
712    pub fn lowbufgain(&mut self) -> LOWBUFGAIN_W {
713        LOWBUFGAIN_W { w: self }
714    }
715    #[doc = "Bits 9:10 - Oscillator Current Reference"]
716    #[inline(always)]
717    pub fn iptat(&mut self) -> IPTAT_W {
718        IPTAT_W { w: self }
719    }
720    #[doc = "Bits 11:14 - Oscillator Current Multiplier"]
721    #[inline(always)]
722    pub fn imult(&mut self) -> IMULT_W {
723        IMULT_W { w: self }
724    }
725    #[doc = "Bit 15 - Automatic Loop Control Enable"]
726    #[inline(always)]
727    pub fn enalc(&mut self) -> ENALC_W {
728        ENALC_W { w: self }
729    }
730    #[doc = "Bit 16 - Clock Failure Detector Enable"]
731    #[inline(always)]
732    pub fn cfden(&mut self) -> CFDEN_W {
733        CFDEN_W { w: self }
734    }
735    #[doc = "Bit 17 - Xosc Clock Switch Enable"]
736    #[inline(always)]
737    pub fn swben(&mut self) -> SWBEN_W {
738        SWBEN_W { w: self }
739    }
740    #[doc = "Bits 20:23 - Start-Up Time"]
741    #[inline(always)]
742    pub fn startup(&mut self) -> STARTUP_W {
743        STARTUP_W { w: self }
744    }
745    #[doc = "Bits 24:27 - Clock Failure Detector Prescaler"]
746    #[inline(always)]
747    pub fn cfdpresc(&mut self) -> CFDPRESC_W {
748        CFDPRESC_W { w: self }
749    }
750}