Skip to main content

atsamd51n20a/oscctrl/dpll/
dpllctrlb.rs

1#[doc = "Reader of register DPLLCTRLB"]
2pub type R = crate::R<u32, super::DPLLCTRLB>;
3#[doc = "Writer for register DPLLCTRLB"]
4pub type W = crate::W<u32, super::DPLLCTRLB>;
5#[doc = "Register DPLLCTRLB `reset()`'s with value 0x20"]
6impl crate::ResetValue for super::DPLLCTRLB {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x20
11    }
12}
13#[doc = "Proportional Integral Filter Selection\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum FILTER_A {
17    #[doc = "0: Bandwidth = 92.7Khz and Damping Factor = 0.76"]
18    FILTER1 = 0,
19    #[doc = "1: Bandwidth = 131Khz and Damping Factor = 1.08"]
20    FILTER2 = 1,
21    #[doc = "2: Bandwidth = 46.4Khz and Damping Factor = 0.38"]
22    FILTER3 = 2,
23    #[doc = "3: Bandwidth = 65.6Khz and Damping Factor = 0.54"]
24    FILTER4 = 3,
25    #[doc = "4: Bandwidth = 131Khz and Damping Factor = 0.56"]
26    FILTER5 = 4,
27    #[doc = "5: Bandwidth = 185Khz and Damping Factor = 0.79"]
28    FILTER6 = 5,
29    #[doc = "6: Bandwidth = 65.6Khz and Damping Factor = 0.28"]
30    FILTER7 = 6,
31    #[doc = "7: Bandwidth = 92.7Khz and Damping Factor = 0.39"]
32    FILTER8 = 7,
33    #[doc = "8: Bandwidth = 46.4Khz and Damping Factor = 1.49"]
34    FILTER9 = 8,
35    #[doc = "9: Bandwidth = 65.6Khz and Damping Factor = 2.11"]
36    FILTER10 = 9,
37    #[doc = "10: Bandwidth = 23.2Khz and Damping Factor = 0.75"]
38    FILTER11 = 10,
39    #[doc = "11: Bandwidth = 32.8Khz and Damping Factor = 1.06"]
40    FILTER12 = 11,
41    #[doc = "12: Bandwidth = 65.6Khz and Damping Factor = 1.07"]
42    FILTER13 = 12,
43    #[doc = "13: Bandwidth = 92.7Khz and Damping Factor = 1.51"]
44    FILTER14 = 13,
45    #[doc = "14: Bandwidth = 32.8Khz and Damping Factor = 0.53"]
46    FILTER15 = 14,
47    #[doc = "15: Bandwidth = 46.4Khz and Damping Factor = 0.75"]
48    FILTER16 = 15,
49}
50impl From<FILTER_A> for u8 {
51    #[inline(always)]
52    fn from(variant: FILTER_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Reader of field `FILTER`"]
57pub type FILTER_R = crate::R<u8, FILTER_A>;
58impl FILTER_R {
59    #[doc = r"Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> FILTER_A {
62        match self.bits {
63            0 => FILTER_A::FILTER1,
64            1 => FILTER_A::FILTER2,
65            2 => FILTER_A::FILTER3,
66            3 => FILTER_A::FILTER4,
67            4 => FILTER_A::FILTER5,
68            5 => FILTER_A::FILTER6,
69            6 => FILTER_A::FILTER7,
70            7 => FILTER_A::FILTER8,
71            8 => FILTER_A::FILTER9,
72            9 => FILTER_A::FILTER10,
73            10 => FILTER_A::FILTER11,
74            11 => FILTER_A::FILTER12,
75            12 => FILTER_A::FILTER13,
76            13 => FILTER_A::FILTER14,
77            14 => FILTER_A::FILTER15,
78            15 => FILTER_A::FILTER16,
79            _ => unreachable!(),
80        }
81    }
82    #[doc = "Checks if the value of the field is `FILTER1`"]
83    #[inline(always)]
84    pub fn is_filter1(&self) -> bool {
85        *self == FILTER_A::FILTER1
86    }
87    #[doc = "Checks if the value of the field is `FILTER2`"]
88    #[inline(always)]
89    pub fn is_filter2(&self) -> bool {
90        *self == FILTER_A::FILTER2
91    }
92    #[doc = "Checks if the value of the field is `FILTER3`"]
93    #[inline(always)]
94    pub fn is_filter3(&self) -> bool {
95        *self == FILTER_A::FILTER3
96    }
97    #[doc = "Checks if the value of the field is `FILTER4`"]
98    #[inline(always)]
99    pub fn is_filter4(&self) -> bool {
100        *self == FILTER_A::FILTER4
101    }
102    #[doc = "Checks if the value of the field is `FILTER5`"]
103    #[inline(always)]
104    pub fn is_filter5(&self) -> bool {
105        *self == FILTER_A::FILTER5
106    }
107    #[doc = "Checks if the value of the field is `FILTER6`"]
108    #[inline(always)]
109    pub fn is_filter6(&self) -> bool {
110        *self == FILTER_A::FILTER6
111    }
112    #[doc = "Checks if the value of the field is `FILTER7`"]
113    #[inline(always)]
114    pub fn is_filter7(&self) -> bool {
115        *self == FILTER_A::FILTER7
116    }
117    #[doc = "Checks if the value of the field is `FILTER8`"]
118    #[inline(always)]
119    pub fn is_filter8(&self) -> bool {
120        *self == FILTER_A::FILTER8
121    }
122    #[doc = "Checks if the value of the field is `FILTER9`"]
123    #[inline(always)]
124    pub fn is_filter9(&self) -> bool {
125        *self == FILTER_A::FILTER9
126    }
127    #[doc = "Checks if the value of the field is `FILTER10`"]
128    #[inline(always)]
129    pub fn is_filter10(&self) -> bool {
130        *self == FILTER_A::FILTER10
131    }
132    #[doc = "Checks if the value of the field is `FILTER11`"]
133    #[inline(always)]
134    pub fn is_filter11(&self) -> bool {
135        *self == FILTER_A::FILTER11
136    }
137    #[doc = "Checks if the value of the field is `FILTER12`"]
138    #[inline(always)]
139    pub fn is_filter12(&self) -> bool {
140        *self == FILTER_A::FILTER12
141    }
142    #[doc = "Checks if the value of the field is `FILTER13`"]
143    #[inline(always)]
144    pub fn is_filter13(&self) -> bool {
145        *self == FILTER_A::FILTER13
146    }
147    #[doc = "Checks if the value of the field is `FILTER14`"]
148    #[inline(always)]
149    pub fn is_filter14(&self) -> bool {
150        *self == FILTER_A::FILTER14
151    }
152    #[doc = "Checks if the value of the field is `FILTER15`"]
153    #[inline(always)]
154    pub fn is_filter15(&self) -> bool {
155        *self == FILTER_A::FILTER15
156    }
157    #[doc = "Checks if the value of the field is `FILTER16`"]
158    #[inline(always)]
159    pub fn is_filter16(&self) -> bool {
160        *self == FILTER_A::FILTER16
161    }
162}
163#[doc = "Write proxy for field `FILTER`"]
164pub struct FILTER_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> FILTER_W<'a> {
168    #[doc = r"Writes `variant` to the field"]
169    #[inline(always)]
170    pub fn variant(self, variant: FILTER_A) -> &'a mut W {
171        {
172            self.bits(variant.into())
173        }
174    }
175    #[doc = "Bandwidth = 92.7Khz and Damping Factor = 0.76"]
176    #[inline(always)]
177    pub fn filter1(self) -> &'a mut W {
178        self.variant(FILTER_A::FILTER1)
179    }
180    #[doc = "Bandwidth = 131Khz and Damping Factor = 1.08"]
181    #[inline(always)]
182    pub fn filter2(self) -> &'a mut W {
183        self.variant(FILTER_A::FILTER2)
184    }
185    #[doc = "Bandwidth = 46.4Khz and Damping Factor = 0.38"]
186    #[inline(always)]
187    pub fn filter3(self) -> &'a mut W {
188        self.variant(FILTER_A::FILTER3)
189    }
190    #[doc = "Bandwidth = 65.6Khz and Damping Factor = 0.54"]
191    #[inline(always)]
192    pub fn filter4(self) -> &'a mut W {
193        self.variant(FILTER_A::FILTER4)
194    }
195    #[doc = "Bandwidth = 131Khz and Damping Factor = 0.56"]
196    #[inline(always)]
197    pub fn filter5(self) -> &'a mut W {
198        self.variant(FILTER_A::FILTER5)
199    }
200    #[doc = "Bandwidth = 185Khz and Damping Factor = 0.79"]
201    #[inline(always)]
202    pub fn filter6(self) -> &'a mut W {
203        self.variant(FILTER_A::FILTER6)
204    }
205    #[doc = "Bandwidth = 65.6Khz and Damping Factor = 0.28"]
206    #[inline(always)]
207    pub fn filter7(self) -> &'a mut W {
208        self.variant(FILTER_A::FILTER7)
209    }
210    #[doc = "Bandwidth = 92.7Khz and Damping Factor = 0.39"]
211    #[inline(always)]
212    pub fn filter8(self) -> &'a mut W {
213        self.variant(FILTER_A::FILTER8)
214    }
215    #[doc = "Bandwidth = 46.4Khz and Damping Factor = 1.49"]
216    #[inline(always)]
217    pub fn filter9(self) -> &'a mut W {
218        self.variant(FILTER_A::FILTER9)
219    }
220    #[doc = "Bandwidth = 65.6Khz and Damping Factor = 2.11"]
221    #[inline(always)]
222    pub fn filter10(self) -> &'a mut W {
223        self.variant(FILTER_A::FILTER10)
224    }
225    #[doc = "Bandwidth = 23.2Khz and Damping Factor = 0.75"]
226    #[inline(always)]
227    pub fn filter11(self) -> &'a mut W {
228        self.variant(FILTER_A::FILTER11)
229    }
230    #[doc = "Bandwidth = 32.8Khz and Damping Factor = 1.06"]
231    #[inline(always)]
232    pub fn filter12(self) -> &'a mut W {
233        self.variant(FILTER_A::FILTER12)
234    }
235    #[doc = "Bandwidth = 65.6Khz and Damping Factor = 1.07"]
236    #[inline(always)]
237    pub fn filter13(self) -> &'a mut W {
238        self.variant(FILTER_A::FILTER13)
239    }
240    #[doc = "Bandwidth = 92.7Khz and Damping Factor = 1.51"]
241    #[inline(always)]
242    pub fn filter14(self) -> &'a mut W {
243        self.variant(FILTER_A::FILTER14)
244    }
245    #[doc = "Bandwidth = 32.8Khz and Damping Factor = 0.53"]
246    #[inline(always)]
247    pub fn filter15(self) -> &'a mut W {
248        self.variant(FILTER_A::FILTER15)
249    }
250    #[doc = "Bandwidth = 46.4Khz and Damping Factor = 0.75"]
251    #[inline(always)]
252    pub fn filter16(self) -> &'a mut W {
253        self.variant(FILTER_A::FILTER16)
254    }
255    #[doc = r"Writes raw bits to the field"]
256    #[inline(always)]
257    pub fn bits(self, value: u8) -> &'a mut W {
258        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
259        self.w
260    }
261}
262#[doc = "Reader of field `WUF`"]
263pub type WUF_R = crate::R<bool, bool>;
264#[doc = "Write proxy for field `WUF`"]
265pub struct WUF_W<'a> {
266    w: &'a mut W,
267}
268impl<'a> WUF_W<'a> {
269    #[doc = r"Sets the field bit"]
270    #[inline(always)]
271    pub fn set_bit(self) -> &'a mut W {
272        self.bit(true)
273    }
274    #[doc = r"Clears the field bit"]
275    #[inline(always)]
276    pub fn clear_bit(self) -> &'a mut W {
277        self.bit(false)
278    }
279    #[doc = r"Writes raw bits to the field"]
280    #[inline(always)]
281    pub fn bit(self, value: bool) -> &'a mut W {
282        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
283        self.w
284    }
285}
286#[doc = "Reference Clock Selection\n\nValue on reset: 1"]
287#[derive(Clone, Copy, Debug, PartialEq)]
288#[repr(u8)]
289pub enum REFCLK_A {
290    #[doc = "0: Dedicated GCLK clock reference"]
291    GCLK = 0,
292    #[doc = "1: XOSC32K clock reference"]
293    XOSC32 = 1,
294    #[doc = "2: XOSC0 clock reference"]
295    XOSC0 = 2,
296    #[doc = "3: XOSC1 clock reference"]
297    XOSC1 = 3,
298}
299impl From<REFCLK_A> for u8 {
300    #[inline(always)]
301    fn from(variant: REFCLK_A) -> Self {
302        variant as _
303    }
304}
305#[doc = "Reader of field `REFCLK`"]
306pub type REFCLK_R = crate::R<u8, REFCLK_A>;
307impl REFCLK_R {
308    #[doc = r"Get enumerated values variant"]
309    #[inline(always)]
310    pub fn variant(&self) -> crate::Variant<u8, REFCLK_A> {
311        use crate::Variant::*;
312        match self.bits {
313            0 => Val(REFCLK_A::GCLK),
314            1 => Val(REFCLK_A::XOSC32),
315            2 => Val(REFCLK_A::XOSC0),
316            3 => Val(REFCLK_A::XOSC1),
317            i => Res(i),
318        }
319    }
320    #[doc = "Checks if the value of the field is `GCLK`"]
321    #[inline(always)]
322    pub fn is_gclk(&self) -> bool {
323        *self == REFCLK_A::GCLK
324    }
325    #[doc = "Checks if the value of the field is `XOSC32`"]
326    #[inline(always)]
327    pub fn is_xosc32(&self) -> bool {
328        *self == REFCLK_A::XOSC32
329    }
330    #[doc = "Checks if the value of the field is `XOSC0`"]
331    #[inline(always)]
332    pub fn is_xosc0(&self) -> bool {
333        *self == REFCLK_A::XOSC0
334    }
335    #[doc = "Checks if the value of the field is `XOSC1`"]
336    #[inline(always)]
337    pub fn is_xosc1(&self) -> bool {
338        *self == REFCLK_A::XOSC1
339    }
340}
341#[doc = "Write proxy for field `REFCLK`"]
342pub struct REFCLK_W<'a> {
343    w: &'a mut W,
344}
345impl<'a> REFCLK_W<'a> {
346    #[doc = r"Writes `variant` to the field"]
347    #[inline(always)]
348    pub fn variant(self, variant: REFCLK_A) -> &'a mut W {
349        unsafe { self.bits(variant.into()) }
350    }
351    #[doc = "Dedicated GCLK clock reference"]
352    #[inline(always)]
353    pub fn gclk(self) -> &'a mut W {
354        self.variant(REFCLK_A::GCLK)
355    }
356    #[doc = "XOSC32K clock reference"]
357    #[inline(always)]
358    pub fn xosc32(self) -> &'a mut W {
359        self.variant(REFCLK_A::XOSC32)
360    }
361    #[doc = "XOSC0 clock reference"]
362    #[inline(always)]
363    pub fn xosc0(self) -> &'a mut W {
364        self.variant(REFCLK_A::XOSC0)
365    }
366    #[doc = "XOSC1 clock reference"]
367    #[inline(always)]
368    pub fn xosc1(self) -> &'a mut W {
369        self.variant(REFCLK_A::XOSC1)
370    }
371    #[doc = r"Writes raw bits to the field"]
372    #[inline(always)]
373    pub unsafe fn bits(self, value: u8) -> &'a mut W {
374        self.w.bits = (self.w.bits & !(0x07 << 5)) | (((value as u32) & 0x07) << 5);
375        self.w
376    }
377}
378#[doc = "Lock Time\n\nValue on reset: 0"]
379#[derive(Clone, Copy, Debug, PartialEq)]
380#[repr(u8)]
381pub enum LTIME_A {
382    #[doc = "0: No time-out. Automatic lock"]
383    DEFAULT = 0,
384    #[doc = "4: Time-out if no lock within 800us"]
385    _800US = 4,
386    #[doc = "5: Time-out if no lock within 900us"]
387    _900US = 5,
388    #[doc = "6: Time-out if no lock within 1ms"]
389    _1MS = 6,
390    #[doc = "7: Time-out if no lock within 1.1ms"]
391    _1P1MS = 7,
392}
393impl From<LTIME_A> for u8 {
394    #[inline(always)]
395    fn from(variant: LTIME_A) -> Self {
396        variant as _
397    }
398}
399#[doc = "Reader of field `LTIME`"]
400pub type LTIME_R = crate::R<u8, LTIME_A>;
401impl LTIME_R {
402    #[doc = r"Get enumerated values variant"]
403    #[inline(always)]
404    pub fn variant(&self) -> crate::Variant<u8, LTIME_A> {
405        use crate::Variant::*;
406        match self.bits {
407            0 => Val(LTIME_A::DEFAULT),
408            4 => Val(LTIME_A::_800US),
409            5 => Val(LTIME_A::_900US),
410            6 => Val(LTIME_A::_1MS),
411            7 => Val(LTIME_A::_1P1MS),
412            i => Res(i),
413        }
414    }
415    #[doc = "Checks if the value of the field is `DEFAULT`"]
416    #[inline(always)]
417    pub fn is_default(&self) -> bool {
418        *self == LTIME_A::DEFAULT
419    }
420    #[doc = "Checks if the value of the field is `_800US`"]
421    #[inline(always)]
422    pub fn is_800us(&self) -> bool {
423        *self == LTIME_A::_800US
424    }
425    #[doc = "Checks if the value of the field is `_900US`"]
426    #[inline(always)]
427    pub fn is_900us(&self) -> bool {
428        *self == LTIME_A::_900US
429    }
430    #[doc = "Checks if the value of the field is `_1MS`"]
431    #[inline(always)]
432    pub fn is_1ms(&self) -> bool {
433        *self == LTIME_A::_1MS
434    }
435    #[doc = "Checks if the value of the field is `_1P1MS`"]
436    #[inline(always)]
437    pub fn is_1p1ms(&self) -> bool {
438        *self == LTIME_A::_1P1MS
439    }
440}
441#[doc = "Write proxy for field `LTIME`"]
442pub struct LTIME_W<'a> {
443    w: &'a mut W,
444}
445impl<'a> LTIME_W<'a> {
446    #[doc = r"Writes `variant` to the field"]
447    #[inline(always)]
448    pub fn variant(self, variant: LTIME_A) -> &'a mut W {
449        unsafe { self.bits(variant.into()) }
450    }
451    #[doc = "No time-out. Automatic lock"]
452    #[inline(always)]
453    pub fn default(self) -> &'a mut W {
454        self.variant(LTIME_A::DEFAULT)
455    }
456    #[doc = "Time-out if no lock within 800us"]
457    #[inline(always)]
458    pub fn _800us(self) -> &'a mut W {
459        self.variant(LTIME_A::_800US)
460    }
461    #[doc = "Time-out if no lock within 900us"]
462    #[inline(always)]
463    pub fn _900us(self) -> &'a mut W {
464        self.variant(LTIME_A::_900US)
465    }
466    #[doc = "Time-out if no lock within 1ms"]
467    #[inline(always)]
468    pub fn _1ms(self) -> &'a mut W {
469        self.variant(LTIME_A::_1MS)
470    }
471    #[doc = "Time-out if no lock within 1.1ms"]
472    #[inline(always)]
473    pub fn _1p1ms(self) -> &'a mut W {
474        self.variant(LTIME_A::_1P1MS)
475    }
476    #[doc = r"Writes raw bits to the field"]
477    #[inline(always)]
478    pub unsafe fn bits(self, value: u8) -> &'a mut W {
479        self.w.bits = (self.w.bits & !(0x07 << 8)) | (((value as u32) & 0x07) << 8);
480        self.w
481    }
482}
483#[doc = "Reader of field `LBYPASS`"]
484pub type LBYPASS_R = crate::R<bool, bool>;
485#[doc = "Write proxy for field `LBYPASS`"]
486pub struct LBYPASS_W<'a> {
487    w: &'a mut W,
488}
489impl<'a> LBYPASS_W<'a> {
490    #[doc = r"Sets the field bit"]
491    #[inline(always)]
492    pub fn set_bit(self) -> &'a mut W {
493        self.bit(true)
494    }
495    #[doc = r"Clears the field bit"]
496    #[inline(always)]
497    pub fn clear_bit(self) -> &'a mut W {
498        self.bit(false)
499    }
500    #[doc = r"Writes raw bits to the field"]
501    #[inline(always)]
502    pub fn bit(self, value: bool) -> &'a mut W {
503        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
504        self.w
505    }
506}
507#[doc = "Sigma-Delta DCO Filter Selection\n\nValue on reset: 0"]
508#[derive(Clone, Copy, Debug, PartialEq)]
509#[repr(u8)]
510pub enum DCOFILTER_A {
511    #[doc = "0: Capacitor(pF) = 0.5 and Bandwidth Fn (MHz) = 3.21"]
512    FILTER1 = 0,
513    #[doc = "1: Capacitor(pF) = 1 and Bandwidth Fn (MHz) = 1.6"]
514    FILTER2 = 1,
515    #[doc = "2: Capacitor(pF) = 1.5 and Bandwidth Fn (MHz) = 1.1"]
516    FILTER3 = 2,
517    #[doc = "3: Capacitor(pF) = 2 and Bandwidth Fn (MHz) = 0.8"]
518    FILTER4 = 3,
519    #[doc = "4: Capacitor(pF) = 2.5 and Bandwidth Fn (MHz) = 0.64"]
520    FILTER5 = 4,
521    #[doc = "5: Capacitor(pF) = 3 and Bandwidth Fn (MHz) = 0.55"]
522    FILTER6 = 5,
523    #[doc = "6: Capacitor(pF) = 3.5 and Bandwidth Fn (MHz) = 0.45"]
524    FILTER7 = 6,
525    #[doc = "7: Capacitor(pF) = 4 and Bandwidth Fn (MHz) = 0.4"]
526    FILTER8 = 7,
527}
528impl From<DCOFILTER_A> for u8 {
529    #[inline(always)]
530    fn from(variant: DCOFILTER_A) -> Self {
531        variant as _
532    }
533}
534#[doc = "Reader of field `DCOFILTER`"]
535pub type DCOFILTER_R = crate::R<u8, DCOFILTER_A>;
536impl DCOFILTER_R {
537    #[doc = r"Get enumerated values variant"]
538    #[inline(always)]
539    pub fn variant(&self) -> DCOFILTER_A {
540        match self.bits {
541            0 => DCOFILTER_A::FILTER1,
542            1 => DCOFILTER_A::FILTER2,
543            2 => DCOFILTER_A::FILTER3,
544            3 => DCOFILTER_A::FILTER4,
545            4 => DCOFILTER_A::FILTER5,
546            5 => DCOFILTER_A::FILTER6,
547            6 => DCOFILTER_A::FILTER7,
548            7 => DCOFILTER_A::FILTER8,
549            _ => unreachable!(),
550        }
551    }
552    #[doc = "Checks if the value of the field is `FILTER1`"]
553    #[inline(always)]
554    pub fn is_filter1(&self) -> bool {
555        *self == DCOFILTER_A::FILTER1
556    }
557    #[doc = "Checks if the value of the field is `FILTER2`"]
558    #[inline(always)]
559    pub fn is_filter2(&self) -> bool {
560        *self == DCOFILTER_A::FILTER2
561    }
562    #[doc = "Checks if the value of the field is `FILTER3`"]
563    #[inline(always)]
564    pub fn is_filter3(&self) -> bool {
565        *self == DCOFILTER_A::FILTER3
566    }
567    #[doc = "Checks if the value of the field is `FILTER4`"]
568    #[inline(always)]
569    pub fn is_filter4(&self) -> bool {
570        *self == DCOFILTER_A::FILTER4
571    }
572    #[doc = "Checks if the value of the field is `FILTER5`"]
573    #[inline(always)]
574    pub fn is_filter5(&self) -> bool {
575        *self == DCOFILTER_A::FILTER5
576    }
577    #[doc = "Checks if the value of the field is `FILTER6`"]
578    #[inline(always)]
579    pub fn is_filter6(&self) -> bool {
580        *self == DCOFILTER_A::FILTER6
581    }
582    #[doc = "Checks if the value of the field is `FILTER7`"]
583    #[inline(always)]
584    pub fn is_filter7(&self) -> bool {
585        *self == DCOFILTER_A::FILTER7
586    }
587    #[doc = "Checks if the value of the field is `FILTER8`"]
588    #[inline(always)]
589    pub fn is_filter8(&self) -> bool {
590        *self == DCOFILTER_A::FILTER8
591    }
592}
593#[doc = "Write proxy for field `DCOFILTER`"]
594pub struct DCOFILTER_W<'a> {
595    w: &'a mut W,
596}
597impl<'a> DCOFILTER_W<'a> {
598    #[doc = r"Writes `variant` to the field"]
599    #[inline(always)]
600    pub fn variant(self, variant: DCOFILTER_A) -> &'a mut W {
601        {
602            self.bits(variant.into())
603        }
604    }
605    #[doc = "Capacitor(pF) = 0.5 and Bandwidth Fn (MHz) = 3.21"]
606    #[inline(always)]
607    pub fn filter1(self) -> &'a mut W {
608        self.variant(DCOFILTER_A::FILTER1)
609    }
610    #[doc = "Capacitor(pF) = 1 and Bandwidth Fn (MHz) = 1.6"]
611    #[inline(always)]
612    pub fn filter2(self) -> &'a mut W {
613        self.variant(DCOFILTER_A::FILTER2)
614    }
615    #[doc = "Capacitor(pF) = 1.5 and Bandwidth Fn (MHz) = 1.1"]
616    #[inline(always)]
617    pub fn filter3(self) -> &'a mut W {
618        self.variant(DCOFILTER_A::FILTER3)
619    }
620    #[doc = "Capacitor(pF) = 2 and Bandwidth Fn (MHz) = 0.8"]
621    #[inline(always)]
622    pub fn filter4(self) -> &'a mut W {
623        self.variant(DCOFILTER_A::FILTER4)
624    }
625    #[doc = "Capacitor(pF) = 2.5 and Bandwidth Fn (MHz) = 0.64"]
626    #[inline(always)]
627    pub fn filter5(self) -> &'a mut W {
628        self.variant(DCOFILTER_A::FILTER5)
629    }
630    #[doc = "Capacitor(pF) = 3 and Bandwidth Fn (MHz) = 0.55"]
631    #[inline(always)]
632    pub fn filter6(self) -> &'a mut W {
633        self.variant(DCOFILTER_A::FILTER6)
634    }
635    #[doc = "Capacitor(pF) = 3.5 and Bandwidth Fn (MHz) = 0.45"]
636    #[inline(always)]
637    pub fn filter7(self) -> &'a mut W {
638        self.variant(DCOFILTER_A::FILTER7)
639    }
640    #[doc = "Capacitor(pF) = 4 and Bandwidth Fn (MHz) = 0.4"]
641    #[inline(always)]
642    pub fn filter8(self) -> &'a mut W {
643        self.variant(DCOFILTER_A::FILTER8)
644    }
645    #[doc = r"Writes raw bits to the field"]
646    #[inline(always)]
647    pub fn bits(self, value: u8) -> &'a mut W {
648        self.w.bits = (self.w.bits & !(0x07 << 12)) | (((value as u32) & 0x07) << 12);
649        self.w
650    }
651}
652#[doc = "Reader of field `DCOEN`"]
653pub type DCOEN_R = crate::R<bool, bool>;
654#[doc = "Write proxy for field `DCOEN`"]
655pub struct DCOEN_W<'a> {
656    w: &'a mut W,
657}
658impl<'a> DCOEN_W<'a> {
659    #[doc = r"Sets the field bit"]
660    #[inline(always)]
661    pub fn set_bit(self) -> &'a mut W {
662        self.bit(true)
663    }
664    #[doc = r"Clears the field bit"]
665    #[inline(always)]
666    pub fn clear_bit(self) -> &'a mut W {
667        self.bit(false)
668    }
669    #[doc = r"Writes raw bits to the field"]
670    #[inline(always)]
671    pub fn bit(self, value: bool) -> &'a mut W {
672        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
673        self.w
674    }
675}
676#[doc = "Reader of field `DIV`"]
677pub type DIV_R = crate::R<u16, u16>;
678#[doc = "Write proxy for field `DIV`"]
679pub struct DIV_W<'a> {
680    w: &'a mut W,
681}
682impl<'a> DIV_W<'a> {
683    #[doc = r"Writes raw bits to the field"]
684    #[inline(always)]
685    pub unsafe fn bits(self, value: u16) -> &'a mut W {
686        self.w.bits = (self.w.bits & !(0x07ff << 16)) | (((value as u32) & 0x07ff) << 16);
687        self.w
688    }
689}
690impl R {
691    #[doc = "Bits 0:3 - Proportional Integral Filter Selection"]
692    #[inline(always)]
693    pub fn filter(&self) -> FILTER_R {
694        FILTER_R::new((self.bits & 0x0f) as u8)
695    }
696    #[doc = "Bit 4 - Wake Up Fast"]
697    #[inline(always)]
698    pub fn wuf(&self) -> WUF_R {
699        WUF_R::new(((self.bits >> 4) & 0x01) != 0)
700    }
701    #[doc = "Bits 5:7 - Reference Clock Selection"]
702    #[inline(always)]
703    pub fn refclk(&self) -> REFCLK_R {
704        REFCLK_R::new(((self.bits >> 5) & 0x07) as u8)
705    }
706    #[doc = "Bits 8:10 - Lock Time"]
707    #[inline(always)]
708    pub fn ltime(&self) -> LTIME_R {
709        LTIME_R::new(((self.bits >> 8) & 0x07) as u8)
710    }
711    #[doc = "Bit 11 - Lock Bypass"]
712    #[inline(always)]
713    pub fn lbypass(&self) -> LBYPASS_R {
714        LBYPASS_R::new(((self.bits >> 11) & 0x01) != 0)
715    }
716    #[doc = "Bits 12:14 - Sigma-Delta DCO Filter Selection"]
717    #[inline(always)]
718    pub fn dcofilter(&self) -> DCOFILTER_R {
719        DCOFILTER_R::new(((self.bits >> 12) & 0x07) as u8)
720    }
721    #[doc = "Bit 15 - DCO Filter Enable"]
722    #[inline(always)]
723    pub fn dcoen(&self) -> DCOEN_R {
724        DCOEN_R::new(((self.bits >> 15) & 0x01) != 0)
725    }
726    #[doc = "Bits 16:26 - Clock Divider"]
727    #[inline(always)]
728    pub fn div(&self) -> DIV_R {
729        DIV_R::new(((self.bits >> 16) & 0x07ff) as u16)
730    }
731}
732impl W {
733    #[doc = "Bits 0:3 - Proportional Integral Filter Selection"]
734    #[inline(always)]
735    pub fn filter(&mut self) -> FILTER_W {
736        FILTER_W { w: self }
737    }
738    #[doc = "Bit 4 - Wake Up Fast"]
739    #[inline(always)]
740    pub fn wuf(&mut self) -> WUF_W {
741        WUF_W { w: self }
742    }
743    #[doc = "Bits 5:7 - Reference Clock Selection"]
744    #[inline(always)]
745    pub fn refclk(&mut self) -> REFCLK_W {
746        REFCLK_W { w: self }
747    }
748    #[doc = "Bits 8:10 - Lock Time"]
749    #[inline(always)]
750    pub fn ltime(&mut self) -> LTIME_W {
751        LTIME_W { w: self }
752    }
753    #[doc = "Bit 11 - Lock Bypass"]
754    #[inline(always)]
755    pub fn lbypass(&mut self) -> LBYPASS_W {
756        LBYPASS_W { w: self }
757    }
758    #[doc = "Bits 12:14 - Sigma-Delta DCO Filter Selection"]
759    #[inline(always)]
760    pub fn dcofilter(&mut self) -> DCOFILTER_W {
761        DCOFILTER_W { w: self }
762    }
763    #[doc = "Bit 15 - DCO Filter Enable"]
764    #[inline(always)]
765    pub fn dcoen(&mut self) -> DCOEN_W {
766        DCOEN_W { w: self }
767    }
768    #[doc = "Bits 16:26 - Clock Divider"]
769    #[inline(always)]
770    pub fn div(&mut self) -> DIV_W {
771        DIV_W { w: self }
772    }
773}