mcxa-pac 0.1.1

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