Skip to main content

mcxa_pac/cmp0/
rrcr0.rs

1#[doc = "Register `RRCR0` reader"]
2pub type R = crate::R<Rrcr0Spec>;
3#[doc = "Register `RRCR0` writer"]
4pub type W = crate::W<Rrcr0Spec>;
5#[doc = "Round-Robin Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum RrEn {
9    #[doc = "0: Disable"]
10    Disable = 0,
11    #[doc = "1: Enable"]
12    Enable = 1,
13}
14impl From<RrEn> for bool {
15    #[inline(always)]
16    fn from(variant: RrEn) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `RR_EN` reader - Round-Robin Enable"]
21pub type RrEnR = crate::BitReader<RrEn>;
22impl RrEnR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> RrEn {
26        match self.bits {
27            false => RrEn::Disable,
28            true => RrEn::Enable,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_disable(&self) -> bool {
34        *self == RrEn::Disable
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_enable(&self) -> bool {
39        *self == RrEn::Enable
40    }
41}
42#[doc = "Field `RR_EN` writer - Round-Robin Enable"]
43pub type RrEnW<'a, REG> = crate::BitWriter<'a, REG, RrEn>;
44impl<'a, REG> RrEnW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disable"]
49    #[inline(always)]
50    pub fn disable(self) -> &'a mut crate::W<REG> {
51        self.variant(RrEn::Disable)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn enable(self) -> &'a mut crate::W<REG> {
56        self.variant(RrEn::Enable)
57    }
58}
59#[doc = "Round-Robin Trigger Select\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum RrTrgSel {
63    #[doc = "0: External trigger"]
64    Enable = 0,
65    #[doc = "1: Internal trigger"]
66    Disable = 1,
67}
68impl From<RrTrgSel> for bool {
69    #[inline(always)]
70    fn from(variant: RrTrgSel) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `RR_TRG_SEL` reader - Round-Robin Trigger Select"]
75pub type RrTrgSelR = crate::BitReader<RrTrgSel>;
76impl RrTrgSelR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> RrTrgSel {
80        match self.bits {
81            false => RrTrgSel::Enable,
82            true => RrTrgSel::Disable,
83        }
84    }
85    #[doc = "External trigger"]
86    #[inline(always)]
87    pub fn is_enable(&self) -> bool {
88        *self == RrTrgSel::Enable
89    }
90    #[doc = "Internal trigger"]
91    #[inline(always)]
92    pub fn is_disable(&self) -> bool {
93        *self == RrTrgSel::Disable
94    }
95}
96#[doc = "Field `RR_TRG_SEL` writer - Round-Robin Trigger Select"]
97pub type RrTrgSelW<'a, REG> = crate::BitWriter<'a, REG, RrTrgSel>;
98impl<'a, REG> RrTrgSelW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "External trigger"]
103    #[inline(always)]
104    pub fn enable(self) -> &'a mut crate::W<REG> {
105        self.variant(RrTrgSel::Enable)
106    }
107    #[doc = "Internal trigger"]
108    #[inline(always)]
109    pub fn disable(self) -> &'a mut crate::W<REG> {
110        self.variant(RrTrgSel::Disable)
111    }
112}
113#[doc = "Number of Sample Clocks\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116#[repr(u8)]
117pub enum RrNsam {
118    #[doc = "0: 0 clock"]
119    Wait0 = 0,
120    #[doc = "1: 1 clock"]
121    Wait1 = 1,
122    #[doc = "2: 2 clocks"]
123    Wait2 = 2,
124    #[doc = "3: 3 clocks"]
125    Wait3 = 3,
126}
127impl From<RrNsam> for u8 {
128    #[inline(always)]
129    fn from(variant: RrNsam) -> Self {
130        variant as _
131    }
132}
133impl crate::FieldSpec for RrNsam {
134    type Ux = u8;
135}
136impl crate::IsEnum for RrNsam {}
137#[doc = "Field `RR_NSAM` reader - Number of Sample Clocks"]
138pub type RrNsamR = crate::FieldReader<RrNsam>;
139impl RrNsamR {
140    #[doc = "Get enumerated values variant"]
141    #[inline(always)]
142    pub const fn variant(&self) -> RrNsam {
143        match self.bits {
144            0 => RrNsam::Wait0,
145            1 => RrNsam::Wait1,
146            2 => RrNsam::Wait2,
147            3 => RrNsam::Wait3,
148            _ => unreachable!(),
149        }
150    }
151    #[doc = "0 clock"]
152    #[inline(always)]
153    pub fn is_wait_0(&self) -> bool {
154        *self == RrNsam::Wait0
155    }
156    #[doc = "1 clock"]
157    #[inline(always)]
158    pub fn is_wait_1(&self) -> bool {
159        *self == RrNsam::Wait1
160    }
161    #[doc = "2 clocks"]
162    #[inline(always)]
163    pub fn is_wait_2(&self) -> bool {
164        *self == RrNsam::Wait2
165    }
166    #[doc = "3 clocks"]
167    #[inline(always)]
168    pub fn is_wait_3(&self) -> bool {
169        *self == RrNsam::Wait3
170    }
171}
172#[doc = "Field `RR_NSAM` writer - Number of Sample Clocks"]
173pub type RrNsamW<'a, REG> = crate::FieldWriter<'a, REG, 2, RrNsam, crate::Safe>;
174impl<'a, REG> RrNsamW<'a, REG>
175where
176    REG: crate::Writable + crate::RegisterSpec,
177    REG::Ux: From<u8>,
178{
179    #[doc = "0 clock"]
180    #[inline(always)]
181    pub fn wait_0(self) -> &'a mut crate::W<REG> {
182        self.variant(RrNsam::Wait0)
183    }
184    #[doc = "1 clock"]
185    #[inline(always)]
186    pub fn wait_1(self) -> &'a mut crate::W<REG> {
187        self.variant(RrNsam::Wait1)
188    }
189    #[doc = "2 clocks"]
190    #[inline(always)]
191    pub fn wait_2(self) -> &'a mut crate::W<REG> {
192        self.variant(RrNsam::Wait2)
193    }
194    #[doc = "3 clocks"]
195    #[inline(always)]
196    pub fn wait_3(self) -> &'a mut crate::W<REG> {
197        self.variant(RrNsam::Wait3)
198    }
199}
200#[doc = "Round Robin Clock Source Select\n\nValue on reset: 0"]
201#[cfg_attr(feature = "defmt", derive(defmt::Format))]
202#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203#[repr(u8)]
204pub enum RrClkSel {
205    #[doc = "0: Select Round Robin clock Source 0"]
206    Rr0 = 0,
207    #[doc = "1: Select Round Robin clock Source 1"]
208    Rr1 = 1,
209    #[doc = "2: Select Round Robin clock Source 2"]
210    Rr2 = 2,
211    #[doc = "3: Select Round Robin clock Source 3"]
212    Rr3 = 3,
213}
214impl From<RrClkSel> for u8 {
215    #[inline(always)]
216    fn from(variant: RrClkSel) -> Self {
217        variant as _
218    }
219}
220impl crate::FieldSpec for RrClkSel {
221    type Ux = u8;
222}
223impl crate::IsEnum for RrClkSel {}
224#[doc = "Field `RR_CLK_SEL` reader - Round Robin Clock Source Select"]
225pub type RrClkSelR = crate::FieldReader<RrClkSel>;
226impl RrClkSelR {
227    #[doc = "Get enumerated values variant"]
228    #[inline(always)]
229    pub const fn variant(&self) -> RrClkSel {
230        match self.bits {
231            0 => RrClkSel::Rr0,
232            1 => RrClkSel::Rr1,
233            2 => RrClkSel::Rr2,
234            3 => RrClkSel::Rr3,
235            _ => unreachable!(),
236        }
237    }
238    #[doc = "Select Round Robin clock Source 0"]
239    #[inline(always)]
240    pub fn is_rr0(&self) -> bool {
241        *self == RrClkSel::Rr0
242    }
243    #[doc = "Select Round Robin clock Source 1"]
244    #[inline(always)]
245    pub fn is_rr1(&self) -> bool {
246        *self == RrClkSel::Rr1
247    }
248    #[doc = "Select Round Robin clock Source 2"]
249    #[inline(always)]
250    pub fn is_rr2(&self) -> bool {
251        *self == RrClkSel::Rr2
252    }
253    #[doc = "Select Round Robin clock Source 3"]
254    #[inline(always)]
255    pub fn is_rr3(&self) -> bool {
256        *self == RrClkSel::Rr3
257    }
258}
259#[doc = "Field `RR_CLK_SEL` writer - Round Robin Clock Source Select"]
260pub type RrClkSelW<'a, REG> = crate::FieldWriter<'a, REG, 2, RrClkSel, crate::Safe>;
261impl<'a, REG> RrClkSelW<'a, REG>
262where
263    REG: crate::Writable + crate::RegisterSpec,
264    REG::Ux: From<u8>,
265{
266    #[doc = "Select Round Robin clock Source 0"]
267    #[inline(always)]
268    pub fn rr0(self) -> &'a mut crate::W<REG> {
269        self.variant(RrClkSel::Rr0)
270    }
271    #[doc = "Select Round Robin clock Source 1"]
272    #[inline(always)]
273    pub fn rr1(self) -> &'a mut crate::W<REG> {
274        self.variant(RrClkSel::Rr1)
275    }
276    #[doc = "Select Round Robin clock Source 2"]
277    #[inline(always)]
278    pub fn rr2(self) -> &'a mut crate::W<REG> {
279        self.variant(RrClkSel::Rr2)
280    }
281    #[doc = "Select Round Robin clock Source 3"]
282    #[inline(always)]
283    pub fn rr3(self) -> &'a mut crate::W<REG> {
284        self.variant(RrClkSel::Rr3)
285    }
286}
287#[doc = "Initialization Delay Modulus\n\nValue on reset: 0"]
288#[cfg_attr(feature = "defmt", derive(defmt::Format))]
289#[derive(Clone, Copy, Debug, PartialEq, Eq)]
290#[repr(u8)]
291pub enum RrInitmod {
292    #[doc = "0: 63 cycles (same as 111111b)"]
293    Mod63 = 0,
294    #[doc = "1: 1 to 63 cycles"]
295    Mod1_63_1 = 1,
296    #[doc = "2: 1 to 63 cycles"]
297    Mod1_63_2 = 2,
298    #[doc = "3: 1 to 63 cycles"]
299    Mod1_63_3 = 3,
300    #[doc = "4: 1 to 63 cycles"]
301    Mod1_63_4 = 4,
302    #[doc = "5: 1 to 63 cycles"]
303    Mod1_63_5 = 5,
304    #[doc = "6: 1 to 63 cycles"]
305    Mod1_63_6 = 6,
306    #[doc = "7: 1 to 63 cycles"]
307    Mod1_63_7 = 7,
308    #[doc = "8: 1 to 63 cycles"]
309    Mod1_63_8 = 8,
310    #[doc = "9: 1 to 63 cycles"]
311    Mod1_63_9 = 9,
312}
313impl From<RrInitmod> for u8 {
314    #[inline(always)]
315    fn from(variant: RrInitmod) -> Self {
316        variant as _
317    }
318}
319impl crate::FieldSpec for RrInitmod {
320    type Ux = u8;
321}
322impl crate::IsEnum for RrInitmod {}
323#[doc = "Field `RR_INITMOD` reader - Initialization Delay Modulus"]
324pub type RrInitmodR = crate::FieldReader<RrInitmod>;
325impl RrInitmodR {
326    #[doc = "Get enumerated values variant"]
327    #[inline(always)]
328    pub const fn variant(&self) -> Option<RrInitmod> {
329        match self.bits {
330            0 => Some(RrInitmod::Mod63),
331            1 => Some(RrInitmod::Mod1_63_1),
332            2 => Some(RrInitmod::Mod1_63_2),
333            3 => Some(RrInitmod::Mod1_63_3),
334            4 => Some(RrInitmod::Mod1_63_4),
335            5 => Some(RrInitmod::Mod1_63_5),
336            6 => Some(RrInitmod::Mod1_63_6),
337            7 => Some(RrInitmod::Mod1_63_7),
338            8 => Some(RrInitmod::Mod1_63_8),
339            9 => Some(RrInitmod::Mod1_63_9),
340            _ => None,
341        }
342    }
343    #[doc = "63 cycles (same as 111111b)"]
344    #[inline(always)]
345    pub fn is_mod_63(&self) -> bool {
346        *self == RrInitmod::Mod63
347    }
348    #[doc = "1 to 63 cycles"]
349    #[inline(always)]
350    pub fn is_mod_1_63_1(&self) -> bool {
351        *self == RrInitmod::Mod1_63_1
352    }
353    #[doc = "1 to 63 cycles"]
354    #[inline(always)]
355    pub fn is_mod_1_63_2(&self) -> bool {
356        *self == RrInitmod::Mod1_63_2
357    }
358    #[doc = "1 to 63 cycles"]
359    #[inline(always)]
360    pub fn is_mod_1_63_3(&self) -> bool {
361        *self == RrInitmod::Mod1_63_3
362    }
363    #[doc = "1 to 63 cycles"]
364    #[inline(always)]
365    pub fn is_mod_1_63_4(&self) -> bool {
366        *self == RrInitmod::Mod1_63_4
367    }
368    #[doc = "1 to 63 cycles"]
369    #[inline(always)]
370    pub fn is_mod_1_63_5(&self) -> bool {
371        *self == RrInitmod::Mod1_63_5
372    }
373    #[doc = "1 to 63 cycles"]
374    #[inline(always)]
375    pub fn is_mod_1_63_6(&self) -> bool {
376        *self == RrInitmod::Mod1_63_6
377    }
378    #[doc = "1 to 63 cycles"]
379    #[inline(always)]
380    pub fn is_mod_1_63_7(&self) -> bool {
381        *self == RrInitmod::Mod1_63_7
382    }
383    #[doc = "1 to 63 cycles"]
384    #[inline(always)]
385    pub fn is_mod_1_63_8(&self) -> bool {
386        *self == RrInitmod::Mod1_63_8
387    }
388    #[doc = "1 to 63 cycles"]
389    #[inline(always)]
390    pub fn is_mod_1_63_9(&self) -> bool {
391        *self == RrInitmod::Mod1_63_9
392    }
393}
394#[doc = "Field `RR_INITMOD` writer - Initialization Delay Modulus"]
395pub type RrInitmodW<'a, REG> = crate::FieldWriter<'a, REG, 6, RrInitmod>;
396impl<'a, REG> RrInitmodW<'a, REG>
397where
398    REG: crate::Writable + crate::RegisterSpec,
399    REG::Ux: From<u8>,
400{
401    #[doc = "63 cycles (same as 111111b)"]
402    #[inline(always)]
403    pub fn mod_63(self) -> &'a mut crate::W<REG> {
404        self.variant(RrInitmod::Mod63)
405    }
406    #[doc = "1 to 63 cycles"]
407    #[inline(always)]
408    pub fn mod_1_63_1(self) -> &'a mut crate::W<REG> {
409        self.variant(RrInitmod::Mod1_63_1)
410    }
411    #[doc = "1 to 63 cycles"]
412    #[inline(always)]
413    pub fn mod_1_63_2(self) -> &'a mut crate::W<REG> {
414        self.variant(RrInitmod::Mod1_63_2)
415    }
416    #[doc = "1 to 63 cycles"]
417    #[inline(always)]
418    pub fn mod_1_63_3(self) -> &'a mut crate::W<REG> {
419        self.variant(RrInitmod::Mod1_63_3)
420    }
421    #[doc = "1 to 63 cycles"]
422    #[inline(always)]
423    pub fn mod_1_63_4(self) -> &'a mut crate::W<REG> {
424        self.variant(RrInitmod::Mod1_63_4)
425    }
426    #[doc = "1 to 63 cycles"]
427    #[inline(always)]
428    pub fn mod_1_63_5(self) -> &'a mut crate::W<REG> {
429        self.variant(RrInitmod::Mod1_63_5)
430    }
431    #[doc = "1 to 63 cycles"]
432    #[inline(always)]
433    pub fn mod_1_63_6(self) -> &'a mut crate::W<REG> {
434        self.variant(RrInitmod::Mod1_63_6)
435    }
436    #[doc = "1 to 63 cycles"]
437    #[inline(always)]
438    pub fn mod_1_63_7(self) -> &'a mut crate::W<REG> {
439        self.variant(RrInitmod::Mod1_63_7)
440    }
441    #[doc = "1 to 63 cycles"]
442    #[inline(always)]
443    pub fn mod_1_63_8(self) -> &'a mut crate::W<REG> {
444        self.variant(RrInitmod::Mod1_63_8)
445    }
446    #[doc = "1 to 63 cycles"]
447    #[inline(always)]
448    pub fn mod_1_63_9(self) -> &'a mut crate::W<REG> {
449        self.variant(RrInitmod::Mod1_63_9)
450    }
451}
452#[doc = "Number of Sample for One Channel\n\nValue on reset: 0"]
453#[cfg_attr(feature = "defmt", derive(defmt::Format))]
454#[derive(Clone, Copy, Debug, PartialEq, Eq)]
455#[repr(u8)]
456pub enum RrSampleCnt {
457    #[doc = "0: 1 samples"]
458    Sample0 = 0,
459    #[doc = "1: 2 samples"]
460    Sample1 = 1,
461    #[doc = "2: 3 samples"]
462    Sample2 = 2,
463    #[doc = "3: 4 samples"]
464    Sample3 = 3,
465    #[doc = "4: 5 samples"]
466    Sample4 = 4,
467    #[doc = "5: 6 samples"]
468    Sample5 = 5,
469    #[doc = "6: 7 samples"]
470    Sample6 = 6,
471    #[doc = "7: 8 samples"]
472    Sample7 = 7,
473    #[doc = "8: 9 samples"]
474    Sample8 = 8,
475    #[doc = "9: 10 samples"]
476    Sample9 = 9,
477    #[doc = "10: 11 samples"]
478    Sample10 = 10,
479    #[doc = "11: 12 samples"]
480    Sample11 = 11,
481    #[doc = "12: 13 samples"]
482    Sample12 = 12,
483    #[doc = "13: 14 samples"]
484    Sample13 = 13,
485    #[doc = "14: 15 samples"]
486    Sample14 = 14,
487    #[doc = "15: 16 samples"]
488    Sample15 = 15,
489}
490impl From<RrSampleCnt> for u8 {
491    #[inline(always)]
492    fn from(variant: RrSampleCnt) -> Self {
493        variant as _
494    }
495}
496impl crate::FieldSpec for RrSampleCnt {
497    type Ux = u8;
498}
499impl crate::IsEnum for RrSampleCnt {}
500#[doc = "Field `RR_SAMPLE_CNT` reader - Number of Sample for One Channel"]
501pub type RrSampleCntR = crate::FieldReader<RrSampleCnt>;
502impl RrSampleCntR {
503    #[doc = "Get enumerated values variant"]
504    #[inline(always)]
505    pub const fn variant(&self) -> RrSampleCnt {
506        match self.bits {
507            0 => RrSampleCnt::Sample0,
508            1 => RrSampleCnt::Sample1,
509            2 => RrSampleCnt::Sample2,
510            3 => RrSampleCnt::Sample3,
511            4 => RrSampleCnt::Sample4,
512            5 => RrSampleCnt::Sample5,
513            6 => RrSampleCnt::Sample6,
514            7 => RrSampleCnt::Sample7,
515            8 => RrSampleCnt::Sample8,
516            9 => RrSampleCnt::Sample9,
517            10 => RrSampleCnt::Sample10,
518            11 => RrSampleCnt::Sample11,
519            12 => RrSampleCnt::Sample12,
520            13 => RrSampleCnt::Sample13,
521            14 => RrSampleCnt::Sample14,
522            15 => RrSampleCnt::Sample15,
523            _ => unreachable!(),
524        }
525    }
526    #[doc = "1 samples"]
527    #[inline(always)]
528    pub fn is_sample_0(&self) -> bool {
529        *self == RrSampleCnt::Sample0
530    }
531    #[doc = "2 samples"]
532    #[inline(always)]
533    pub fn is_sample_1(&self) -> bool {
534        *self == RrSampleCnt::Sample1
535    }
536    #[doc = "3 samples"]
537    #[inline(always)]
538    pub fn is_sample_2(&self) -> bool {
539        *self == RrSampleCnt::Sample2
540    }
541    #[doc = "4 samples"]
542    #[inline(always)]
543    pub fn is_sample_3(&self) -> bool {
544        *self == RrSampleCnt::Sample3
545    }
546    #[doc = "5 samples"]
547    #[inline(always)]
548    pub fn is_sample_4(&self) -> bool {
549        *self == RrSampleCnt::Sample4
550    }
551    #[doc = "6 samples"]
552    #[inline(always)]
553    pub fn is_sample_5(&self) -> bool {
554        *self == RrSampleCnt::Sample5
555    }
556    #[doc = "7 samples"]
557    #[inline(always)]
558    pub fn is_sample_6(&self) -> bool {
559        *self == RrSampleCnt::Sample6
560    }
561    #[doc = "8 samples"]
562    #[inline(always)]
563    pub fn is_sample_7(&self) -> bool {
564        *self == RrSampleCnt::Sample7
565    }
566    #[doc = "9 samples"]
567    #[inline(always)]
568    pub fn is_sample_8(&self) -> bool {
569        *self == RrSampleCnt::Sample8
570    }
571    #[doc = "10 samples"]
572    #[inline(always)]
573    pub fn is_sample_9(&self) -> bool {
574        *self == RrSampleCnt::Sample9
575    }
576    #[doc = "11 samples"]
577    #[inline(always)]
578    pub fn is_sample_10(&self) -> bool {
579        *self == RrSampleCnt::Sample10
580    }
581    #[doc = "12 samples"]
582    #[inline(always)]
583    pub fn is_sample_11(&self) -> bool {
584        *self == RrSampleCnt::Sample11
585    }
586    #[doc = "13 samples"]
587    #[inline(always)]
588    pub fn is_sample_12(&self) -> bool {
589        *self == RrSampleCnt::Sample12
590    }
591    #[doc = "14 samples"]
592    #[inline(always)]
593    pub fn is_sample_13(&self) -> bool {
594        *self == RrSampleCnt::Sample13
595    }
596    #[doc = "15 samples"]
597    #[inline(always)]
598    pub fn is_sample_14(&self) -> bool {
599        *self == RrSampleCnt::Sample14
600    }
601    #[doc = "16 samples"]
602    #[inline(always)]
603    pub fn is_sample_15(&self) -> bool {
604        *self == RrSampleCnt::Sample15
605    }
606}
607#[doc = "Field `RR_SAMPLE_CNT` writer - Number of Sample for One Channel"]
608pub type RrSampleCntW<'a, REG> = crate::FieldWriter<'a, REG, 4, RrSampleCnt, crate::Safe>;
609impl<'a, REG> RrSampleCntW<'a, REG>
610where
611    REG: crate::Writable + crate::RegisterSpec,
612    REG::Ux: From<u8>,
613{
614    #[doc = "1 samples"]
615    #[inline(always)]
616    pub fn sample_0(self) -> &'a mut crate::W<REG> {
617        self.variant(RrSampleCnt::Sample0)
618    }
619    #[doc = "2 samples"]
620    #[inline(always)]
621    pub fn sample_1(self) -> &'a mut crate::W<REG> {
622        self.variant(RrSampleCnt::Sample1)
623    }
624    #[doc = "3 samples"]
625    #[inline(always)]
626    pub fn sample_2(self) -> &'a mut crate::W<REG> {
627        self.variant(RrSampleCnt::Sample2)
628    }
629    #[doc = "4 samples"]
630    #[inline(always)]
631    pub fn sample_3(self) -> &'a mut crate::W<REG> {
632        self.variant(RrSampleCnt::Sample3)
633    }
634    #[doc = "5 samples"]
635    #[inline(always)]
636    pub fn sample_4(self) -> &'a mut crate::W<REG> {
637        self.variant(RrSampleCnt::Sample4)
638    }
639    #[doc = "6 samples"]
640    #[inline(always)]
641    pub fn sample_5(self) -> &'a mut crate::W<REG> {
642        self.variant(RrSampleCnt::Sample5)
643    }
644    #[doc = "7 samples"]
645    #[inline(always)]
646    pub fn sample_6(self) -> &'a mut crate::W<REG> {
647        self.variant(RrSampleCnt::Sample6)
648    }
649    #[doc = "8 samples"]
650    #[inline(always)]
651    pub fn sample_7(self) -> &'a mut crate::W<REG> {
652        self.variant(RrSampleCnt::Sample7)
653    }
654    #[doc = "9 samples"]
655    #[inline(always)]
656    pub fn sample_8(self) -> &'a mut crate::W<REG> {
657        self.variant(RrSampleCnt::Sample8)
658    }
659    #[doc = "10 samples"]
660    #[inline(always)]
661    pub fn sample_9(self) -> &'a mut crate::W<REG> {
662        self.variant(RrSampleCnt::Sample9)
663    }
664    #[doc = "11 samples"]
665    #[inline(always)]
666    pub fn sample_10(self) -> &'a mut crate::W<REG> {
667        self.variant(RrSampleCnt::Sample10)
668    }
669    #[doc = "12 samples"]
670    #[inline(always)]
671    pub fn sample_11(self) -> &'a mut crate::W<REG> {
672        self.variant(RrSampleCnt::Sample11)
673    }
674    #[doc = "13 samples"]
675    #[inline(always)]
676    pub fn sample_12(self) -> &'a mut crate::W<REG> {
677        self.variant(RrSampleCnt::Sample12)
678    }
679    #[doc = "14 samples"]
680    #[inline(always)]
681    pub fn sample_13(self) -> &'a mut crate::W<REG> {
682        self.variant(RrSampleCnt::Sample13)
683    }
684    #[doc = "15 samples"]
685    #[inline(always)]
686    pub fn sample_14(self) -> &'a mut crate::W<REG> {
687        self.variant(RrSampleCnt::Sample14)
688    }
689    #[doc = "16 samples"]
690    #[inline(always)]
691    pub fn sample_15(self) -> &'a mut crate::W<REG> {
692        self.variant(RrSampleCnt::Sample15)
693    }
694}
695#[doc = "Sample Time Threshold\n\nValue on reset: 0"]
696#[cfg_attr(feature = "defmt", derive(defmt::Format))]
697#[derive(Clone, Copy, Debug, PartialEq, Eq)]
698#[repr(u8)]
699pub enum RrSampleThreshold {
700    #[doc = "0: At least 1 sampled \"1\", the final result is \"1\""]
701    Sample0 = 0,
702    #[doc = "1: At least 2 sampled \"1\", the final result is \"1\""]
703    Sample1 = 1,
704    #[doc = "2: At least 3 sampled \"1\", the final result is \"1\""]
705    Sample2 = 2,
706    #[doc = "3: At least 4 sampled \"1\", the final result is \"1\""]
707    Sample3 = 3,
708    #[doc = "4: At least 5 sampled \"1\", the final result is \"1\""]
709    Sample4 = 4,
710    #[doc = "5: At least 6 sampled \"1\", the final result is \"1\""]
711    Sample5 = 5,
712    #[doc = "6: At least 7 sampled \"1\", the final result is \"1\""]
713    Sample6 = 6,
714    #[doc = "7: At least 8 sampled \"1\", the final result is \"1\""]
715    Sample7 = 7,
716    #[doc = "8: At least 9 sampled \"1\", the final result is \"1\""]
717    Sample8 = 8,
718    #[doc = "9: At least 10 sampled \"1\", the final result is \"1\""]
719    Sample9 = 9,
720    #[doc = "10: At least 11 sampled \"1\", the final result is \"1\""]
721    Sample10 = 10,
722    #[doc = "11: At least 12 sampled \"1\", the final result is \"1\""]
723    Sample11 = 11,
724    #[doc = "12: At least 13 sampled \"1\", the final result is \"1\""]
725    Sample12 = 12,
726    #[doc = "13: At least 14 sampled \"1\", the final result is \"1\""]
727    Sample13 = 13,
728    #[doc = "14: At least 15 sampled \"1\", the final result is \"1\""]
729    Sample14 = 14,
730    #[doc = "15: At least 16 sampled \"1\", the final result is \"1\""]
731    Sample15 = 15,
732}
733impl From<RrSampleThreshold> for u8 {
734    #[inline(always)]
735    fn from(variant: RrSampleThreshold) -> Self {
736        variant as _
737    }
738}
739impl crate::FieldSpec for RrSampleThreshold {
740    type Ux = u8;
741}
742impl crate::IsEnum for RrSampleThreshold {}
743#[doc = "Field `RR_SAMPLE_THRESHOLD` reader - Sample Time Threshold"]
744pub type RrSampleThresholdR = crate::FieldReader<RrSampleThreshold>;
745impl RrSampleThresholdR {
746    #[doc = "Get enumerated values variant"]
747    #[inline(always)]
748    pub const fn variant(&self) -> RrSampleThreshold {
749        match self.bits {
750            0 => RrSampleThreshold::Sample0,
751            1 => RrSampleThreshold::Sample1,
752            2 => RrSampleThreshold::Sample2,
753            3 => RrSampleThreshold::Sample3,
754            4 => RrSampleThreshold::Sample4,
755            5 => RrSampleThreshold::Sample5,
756            6 => RrSampleThreshold::Sample6,
757            7 => RrSampleThreshold::Sample7,
758            8 => RrSampleThreshold::Sample8,
759            9 => RrSampleThreshold::Sample9,
760            10 => RrSampleThreshold::Sample10,
761            11 => RrSampleThreshold::Sample11,
762            12 => RrSampleThreshold::Sample12,
763            13 => RrSampleThreshold::Sample13,
764            14 => RrSampleThreshold::Sample14,
765            15 => RrSampleThreshold::Sample15,
766            _ => unreachable!(),
767        }
768    }
769    #[doc = "At least 1 sampled \"1\", the final result is \"1\""]
770    #[inline(always)]
771    pub fn is_sample_0(&self) -> bool {
772        *self == RrSampleThreshold::Sample0
773    }
774    #[doc = "At least 2 sampled \"1\", the final result is \"1\""]
775    #[inline(always)]
776    pub fn is_sample_1(&self) -> bool {
777        *self == RrSampleThreshold::Sample1
778    }
779    #[doc = "At least 3 sampled \"1\", the final result is \"1\""]
780    #[inline(always)]
781    pub fn is_sample_2(&self) -> bool {
782        *self == RrSampleThreshold::Sample2
783    }
784    #[doc = "At least 4 sampled \"1\", the final result is \"1\""]
785    #[inline(always)]
786    pub fn is_sample_3(&self) -> bool {
787        *self == RrSampleThreshold::Sample3
788    }
789    #[doc = "At least 5 sampled \"1\", the final result is \"1\""]
790    #[inline(always)]
791    pub fn is_sample_4(&self) -> bool {
792        *self == RrSampleThreshold::Sample4
793    }
794    #[doc = "At least 6 sampled \"1\", the final result is \"1\""]
795    #[inline(always)]
796    pub fn is_sample_5(&self) -> bool {
797        *self == RrSampleThreshold::Sample5
798    }
799    #[doc = "At least 7 sampled \"1\", the final result is \"1\""]
800    #[inline(always)]
801    pub fn is_sample_6(&self) -> bool {
802        *self == RrSampleThreshold::Sample6
803    }
804    #[doc = "At least 8 sampled \"1\", the final result is \"1\""]
805    #[inline(always)]
806    pub fn is_sample_7(&self) -> bool {
807        *self == RrSampleThreshold::Sample7
808    }
809    #[doc = "At least 9 sampled \"1\", the final result is \"1\""]
810    #[inline(always)]
811    pub fn is_sample_8(&self) -> bool {
812        *self == RrSampleThreshold::Sample8
813    }
814    #[doc = "At least 10 sampled \"1\", the final result is \"1\""]
815    #[inline(always)]
816    pub fn is_sample_9(&self) -> bool {
817        *self == RrSampleThreshold::Sample9
818    }
819    #[doc = "At least 11 sampled \"1\", the final result is \"1\""]
820    #[inline(always)]
821    pub fn is_sample_10(&self) -> bool {
822        *self == RrSampleThreshold::Sample10
823    }
824    #[doc = "At least 12 sampled \"1\", the final result is \"1\""]
825    #[inline(always)]
826    pub fn is_sample_11(&self) -> bool {
827        *self == RrSampleThreshold::Sample11
828    }
829    #[doc = "At least 13 sampled \"1\", the final result is \"1\""]
830    #[inline(always)]
831    pub fn is_sample_12(&self) -> bool {
832        *self == RrSampleThreshold::Sample12
833    }
834    #[doc = "At least 14 sampled \"1\", the final result is \"1\""]
835    #[inline(always)]
836    pub fn is_sample_13(&self) -> bool {
837        *self == RrSampleThreshold::Sample13
838    }
839    #[doc = "At least 15 sampled \"1\", the final result is \"1\""]
840    #[inline(always)]
841    pub fn is_sample_14(&self) -> bool {
842        *self == RrSampleThreshold::Sample14
843    }
844    #[doc = "At least 16 sampled \"1\", the final result is \"1\""]
845    #[inline(always)]
846    pub fn is_sample_15(&self) -> bool {
847        *self == RrSampleThreshold::Sample15
848    }
849}
850#[doc = "Field `RR_SAMPLE_THRESHOLD` writer - Sample Time Threshold"]
851pub type RrSampleThresholdW<'a, REG> = crate::FieldWriter<'a, REG, 4, RrSampleThreshold, crate::Safe>;
852impl<'a, REG> RrSampleThresholdW<'a, REG>
853where
854    REG: crate::Writable + crate::RegisterSpec,
855    REG::Ux: From<u8>,
856{
857    #[doc = "At least 1 sampled \"1\", the final result is \"1\""]
858    #[inline(always)]
859    pub fn sample_0(self) -> &'a mut crate::W<REG> {
860        self.variant(RrSampleThreshold::Sample0)
861    }
862    #[doc = "At least 2 sampled \"1\", the final result is \"1\""]
863    #[inline(always)]
864    pub fn sample_1(self) -> &'a mut crate::W<REG> {
865        self.variant(RrSampleThreshold::Sample1)
866    }
867    #[doc = "At least 3 sampled \"1\", the final result is \"1\""]
868    #[inline(always)]
869    pub fn sample_2(self) -> &'a mut crate::W<REG> {
870        self.variant(RrSampleThreshold::Sample2)
871    }
872    #[doc = "At least 4 sampled \"1\", the final result is \"1\""]
873    #[inline(always)]
874    pub fn sample_3(self) -> &'a mut crate::W<REG> {
875        self.variant(RrSampleThreshold::Sample3)
876    }
877    #[doc = "At least 5 sampled \"1\", the final result is \"1\""]
878    #[inline(always)]
879    pub fn sample_4(self) -> &'a mut crate::W<REG> {
880        self.variant(RrSampleThreshold::Sample4)
881    }
882    #[doc = "At least 6 sampled \"1\", the final result is \"1\""]
883    #[inline(always)]
884    pub fn sample_5(self) -> &'a mut crate::W<REG> {
885        self.variant(RrSampleThreshold::Sample5)
886    }
887    #[doc = "At least 7 sampled \"1\", the final result is \"1\""]
888    #[inline(always)]
889    pub fn sample_6(self) -> &'a mut crate::W<REG> {
890        self.variant(RrSampleThreshold::Sample6)
891    }
892    #[doc = "At least 8 sampled \"1\", the final result is \"1\""]
893    #[inline(always)]
894    pub fn sample_7(self) -> &'a mut crate::W<REG> {
895        self.variant(RrSampleThreshold::Sample7)
896    }
897    #[doc = "At least 9 sampled \"1\", the final result is \"1\""]
898    #[inline(always)]
899    pub fn sample_8(self) -> &'a mut crate::W<REG> {
900        self.variant(RrSampleThreshold::Sample8)
901    }
902    #[doc = "At least 10 sampled \"1\", the final result is \"1\""]
903    #[inline(always)]
904    pub fn sample_9(self) -> &'a mut crate::W<REG> {
905        self.variant(RrSampleThreshold::Sample9)
906    }
907    #[doc = "At least 11 sampled \"1\", the final result is \"1\""]
908    #[inline(always)]
909    pub fn sample_10(self) -> &'a mut crate::W<REG> {
910        self.variant(RrSampleThreshold::Sample10)
911    }
912    #[doc = "At least 12 sampled \"1\", the final result is \"1\""]
913    #[inline(always)]
914    pub fn sample_11(self) -> &'a mut crate::W<REG> {
915        self.variant(RrSampleThreshold::Sample11)
916    }
917    #[doc = "At least 13 sampled \"1\", the final result is \"1\""]
918    #[inline(always)]
919    pub fn sample_12(self) -> &'a mut crate::W<REG> {
920        self.variant(RrSampleThreshold::Sample12)
921    }
922    #[doc = "At least 14 sampled \"1\", the final result is \"1\""]
923    #[inline(always)]
924    pub fn sample_13(self) -> &'a mut crate::W<REG> {
925        self.variant(RrSampleThreshold::Sample13)
926    }
927    #[doc = "At least 15 sampled \"1\", the final result is \"1\""]
928    #[inline(always)]
929    pub fn sample_14(self) -> &'a mut crate::W<REG> {
930        self.variant(RrSampleThreshold::Sample14)
931    }
932    #[doc = "At least 16 sampled \"1\", the final result is \"1\""]
933    #[inline(always)]
934    pub fn sample_15(self) -> &'a mut crate::W<REG> {
935        self.variant(RrSampleThreshold::Sample15)
936    }
937}
938impl R {
939    #[doc = "Bit 0 - Round-Robin Enable"]
940    #[inline(always)]
941    pub fn rr_en(&self) -> RrEnR {
942        RrEnR::new((self.bits & 1) != 0)
943    }
944    #[doc = "Bit 1 - Round-Robin Trigger Select"]
945    #[inline(always)]
946    pub fn rr_trg_sel(&self) -> RrTrgSelR {
947        RrTrgSelR::new(((self.bits >> 1) & 1) != 0)
948    }
949    #[doc = "Bits 8:9 - Number of Sample Clocks"]
950    #[inline(always)]
951    pub fn rr_nsam(&self) -> RrNsamR {
952        RrNsamR::new(((self.bits >> 8) & 3) as u8)
953    }
954    #[doc = "Bits 12:13 - Round Robin Clock Source Select"]
955    #[inline(always)]
956    pub fn rr_clk_sel(&self) -> RrClkSelR {
957        RrClkSelR::new(((self.bits >> 12) & 3) as u8)
958    }
959    #[doc = "Bits 16:21 - Initialization Delay Modulus"]
960    #[inline(always)]
961    pub fn rr_initmod(&self) -> RrInitmodR {
962        RrInitmodR::new(((self.bits >> 16) & 0x3f) as u8)
963    }
964    #[doc = "Bits 24:27 - Number of Sample for One Channel"]
965    #[inline(always)]
966    pub fn rr_sample_cnt(&self) -> RrSampleCntR {
967        RrSampleCntR::new(((self.bits >> 24) & 0x0f) as u8)
968    }
969    #[doc = "Bits 28:31 - Sample Time Threshold"]
970    #[inline(always)]
971    pub fn rr_sample_threshold(&self) -> RrSampleThresholdR {
972        RrSampleThresholdR::new(((self.bits >> 28) & 0x0f) as u8)
973    }
974}
975#[cfg(feature = "debug")]
976impl core::fmt::Debug for R {
977    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
978        f.debug_struct("RRCR0")
979            .field("rr_en", &self.rr_en())
980            .field("rr_trg_sel", &self.rr_trg_sel())
981            .field("rr_nsam", &self.rr_nsam())
982            .field("rr_clk_sel", &self.rr_clk_sel())
983            .field("rr_initmod", &self.rr_initmod())
984            .field("rr_sample_cnt", &self.rr_sample_cnt())
985            .field("rr_sample_threshold", &self.rr_sample_threshold())
986            .finish()
987    }
988}
989impl W {
990    #[doc = "Bit 0 - Round-Robin Enable"]
991    #[inline(always)]
992    pub fn rr_en(&mut self) -> RrEnW<'_, Rrcr0Spec> {
993        RrEnW::new(self, 0)
994    }
995    #[doc = "Bit 1 - Round-Robin Trigger Select"]
996    #[inline(always)]
997    pub fn rr_trg_sel(&mut self) -> RrTrgSelW<'_, Rrcr0Spec> {
998        RrTrgSelW::new(self, 1)
999    }
1000    #[doc = "Bits 8:9 - Number of Sample Clocks"]
1001    #[inline(always)]
1002    pub fn rr_nsam(&mut self) -> RrNsamW<'_, Rrcr0Spec> {
1003        RrNsamW::new(self, 8)
1004    }
1005    #[doc = "Bits 12:13 - Round Robin Clock Source Select"]
1006    #[inline(always)]
1007    pub fn rr_clk_sel(&mut self) -> RrClkSelW<'_, Rrcr0Spec> {
1008        RrClkSelW::new(self, 12)
1009    }
1010    #[doc = "Bits 16:21 - Initialization Delay Modulus"]
1011    #[inline(always)]
1012    pub fn rr_initmod(&mut self) -> RrInitmodW<'_, Rrcr0Spec> {
1013        RrInitmodW::new(self, 16)
1014    }
1015    #[doc = "Bits 24:27 - Number of Sample for One Channel"]
1016    #[inline(always)]
1017    pub fn rr_sample_cnt(&mut self) -> RrSampleCntW<'_, Rrcr0Spec> {
1018        RrSampleCntW::new(self, 24)
1019    }
1020    #[doc = "Bits 28:31 - Sample Time Threshold"]
1021    #[inline(always)]
1022    pub fn rr_sample_threshold(&mut self) -> RrSampleThresholdW<'_, Rrcr0Spec> {
1023        RrSampleThresholdW::new(self, 28)
1024    }
1025}
1026#[doc = "Round Robin Control Register 0\n\nYou can [`read`](crate::Reg::read) this register and get [`rrcr0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rrcr0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
1027pub struct Rrcr0Spec;
1028impl crate::RegisterSpec for Rrcr0Spec {
1029    type Ux = u32;
1030}
1031#[doc = "`read()` method returns [`rrcr0::R`](R) reader structure"]
1032impl crate::Readable for Rrcr0Spec {}
1033#[doc = "`write(|w| ..)` method takes [`rrcr0::W`](W) writer structure"]
1034impl crate::Writable for Rrcr0Spec {
1035    type Safety = crate::Unsafe;
1036}
1037#[doc = "`reset()` method sets RRCR0 to value 0"]
1038impl crate::Resettable for Rrcr0Spec {}