mcxa-pac 0.3.0

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
#[doc = "Register `CMDH1` reader"]
pub type R = crate::R<Cmdh1Spec>;
#[doc = "Register `CMDH1` writer"]
pub type W = crate::W<Cmdh1Spec>;
#[doc = "Compare Function Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Cmpen {
    #[doc = "0: Compare disabled."]
    DisabledAlwaysStoreResult = 0,
    #[doc = "2: Compare enabled. Store on true."]
    CompareResultStoreIfTrue = 2,
    #[doc = "3: Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
    CompareResultKeepConvertingUntilTrueStoreIfTrue = 3,
}
impl From<Cmpen> for u8 {
    #[inline(always)]
    fn from(variant: Cmpen) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Cmpen {
    type Ux = u8;
}
impl crate::IsEnum for Cmpen {}
#[doc = "Field `CMPEN` reader - Compare Function Enable"]
pub type CmpenR = crate::FieldReader<Cmpen>;
impl CmpenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Cmpen> {
        match self.bits {
            0 => Some(Cmpen::DisabledAlwaysStoreResult),
            2 => Some(Cmpen::CompareResultStoreIfTrue),
            3 => Some(Cmpen::CompareResultKeepConvertingUntilTrueStoreIfTrue),
            _ => None,
        }
    }
    #[doc = "Compare disabled."]
    #[inline(always)]
    pub fn is_disabled_always_store_result(&self) -> bool {
        *self == Cmpen::DisabledAlwaysStoreResult
    }
    #[doc = "Compare enabled. Store on true."]
    #[inline(always)]
    pub fn is_compare_result_store_if_true(&self) -> bool {
        *self == Cmpen::CompareResultStoreIfTrue
    }
    #[doc = "Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
    #[inline(always)]
    pub fn is_compare_result_keep_converting_until_true_store_if_true(&self) -> bool {
        *self == Cmpen::CompareResultKeepConvertingUntilTrueStoreIfTrue
    }
}
#[doc = "Field `CMPEN` writer - Compare Function Enable"]
pub type CmpenW<'a, REG> = crate::FieldWriter<'a, REG, 2, Cmpen>;
impl<'a, REG> CmpenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Compare disabled."]
    #[inline(always)]
    pub fn disabled_always_store_result(self) -> &'a mut crate::W<REG> {
        self.variant(Cmpen::DisabledAlwaysStoreResult)
    }
    #[doc = "Compare enabled. Store on true."]
    #[inline(always)]
    pub fn compare_result_store_if_true(self) -> &'a mut crate::W<REG> {
        self.variant(Cmpen::CompareResultStoreIfTrue)
    }
    #[doc = "Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
    #[inline(always)]
    pub fn compare_result_keep_converting_until_true_store_if_true(self) -> &'a mut crate::W<REG> {
        self.variant(Cmpen::CompareResultKeepConvertingUntilTrueStoreIfTrue)
    }
}
#[doc = "Wait for Trigger Assertion before Execution.\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum WaitTrig {
    #[doc = "0: This command will be automatically executed."]
    Disabled = 0,
    #[doc = "1: The active trigger must be asserted again before executing this command."]
    Enabled = 1,
}
impl From<WaitTrig> for bool {
    #[inline(always)]
    fn from(variant: WaitTrig) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `WAIT_TRIG` reader - Wait for Trigger Assertion before Execution."]
pub type WaitTrigR = crate::BitReader<WaitTrig>;
impl WaitTrigR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> WaitTrig {
        match self.bits {
            false => WaitTrig::Disabled,
            true => WaitTrig::Enabled,
        }
    }
    #[doc = "This command will be automatically executed."]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == WaitTrig::Disabled
    }
    #[doc = "The active trigger must be asserted again before executing this command."]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == WaitTrig::Enabled
    }
}
#[doc = "Field `WAIT_TRIG` writer - Wait for Trigger Assertion before Execution."]
pub type WaitTrigW<'a, REG> = crate::BitWriter<'a, REG, WaitTrig>;
impl<'a, REG> WaitTrigW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "This command will be automatically executed."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(WaitTrig::Disabled)
    }
    #[doc = "The active trigger must be asserted again before executing this command."]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(WaitTrig::Enabled)
    }
}
#[doc = "Loop with Increment\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Lwi {
    #[doc = "0: Auto channel increment disabled"]
    Disabled = 0,
    #[doc = "1: Auto channel increment enabled"]
    Enabled = 1,
}
impl From<Lwi> for bool {
    #[inline(always)]
    fn from(variant: Lwi) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LWI` reader - Loop with Increment"]
pub type LwiR = crate::BitReader<Lwi>;
impl LwiR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Lwi {
        match self.bits {
            false => Lwi::Disabled,
            true => Lwi::Enabled,
        }
    }
    #[doc = "Auto channel increment disabled"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Lwi::Disabled
    }
    #[doc = "Auto channel increment enabled"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Lwi::Enabled
    }
}
#[doc = "Field `LWI` writer - Loop with Increment"]
pub type LwiW<'a, REG> = crate::BitWriter<'a, REG, Lwi>;
impl<'a, REG> LwiW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Auto channel increment disabled"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Lwi::Disabled)
    }
    #[doc = "Auto channel increment enabled"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Lwi::Enabled)
    }
}
#[doc = "Sample Time Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Sts {
    #[doc = "0: Minimum sample time of 3.5 ADCK cycles."]
    Sample3p5 = 0,
    #[doc = "1: 3.5 + 21 ADCK cycles; 5.5 ADCK cycles total sample time."]
    Sample5p5 = 1,
    #[doc = "2: 3.5 + 22 ADCK cycles; 7.5 ADCK cycles total sample time."]
    Sample7p5 = 2,
    #[doc = "3: 3.5 + 23 ADCK cycles; 11.5 ADCK cycles total sample time."]
    Sample11p5 = 3,
    #[doc = "4: 3.5 + 24 ADCK cycles; 19.5 ADCK cycles total sample time."]
    Sample19p5 = 4,
    #[doc = "5: 3.5 + 25 ADCK cycles; 35.5 ADCK cycles total sample time."]
    Sample35p5 = 5,
    #[doc = "6: 3.5 + 26 ADCK cycles; 67.5 ADCK cycles total sample time."]
    Sample67p5 = 6,
    #[doc = "7: 3.5 + 27 ADCK cycles; 131.5 ADCK cycles total sample time."]
    Sample131p5 = 7,
}
impl From<Sts> for u8 {
    #[inline(always)]
    fn from(variant: Sts) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Sts {
    type Ux = u8;
}
impl crate::IsEnum for Sts {}
#[doc = "Field `STS` reader - Sample Time Select"]
pub type StsR = crate::FieldReader<Sts>;
impl StsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Sts {
        match self.bits {
            0 => Sts::Sample3p5,
            1 => Sts::Sample5p5,
            2 => Sts::Sample7p5,
            3 => Sts::Sample11p5,
            4 => Sts::Sample19p5,
            5 => Sts::Sample35p5,
            6 => Sts::Sample67p5,
            7 => Sts::Sample131p5,
            _ => unreachable!(),
        }
    }
    #[doc = "Minimum sample time of 3.5 ADCK cycles."]
    #[inline(always)]
    pub fn is_sample_3p5(&self) -> bool {
        *self == Sts::Sample3p5
    }
    #[doc = "3.5 + 21 ADCK cycles; 5.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_5p5(&self) -> bool {
        *self == Sts::Sample5p5
    }
    #[doc = "3.5 + 22 ADCK cycles; 7.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_7p5(&self) -> bool {
        *self == Sts::Sample7p5
    }
    #[doc = "3.5 + 23 ADCK cycles; 11.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_11p5(&self) -> bool {
        *self == Sts::Sample11p5
    }
    #[doc = "3.5 + 24 ADCK cycles; 19.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_19p5(&self) -> bool {
        *self == Sts::Sample19p5
    }
    #[doc = "3.5 + 25 ADCK cycles; 35.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_35p5(&self) -> bool {
        *self == Sts::Sample35p5
    }
    #[doc = "3.5 + 26 ADCK cycles; 67.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_67p5(&self) -> bool {
        *self == Sts::Sample67p5
    }
    #[doc = "3.5 + 27 ADCK cycles; 131.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn is_sample_131p5(&self) -> bool {
        *self == Sts::Sample131p5
    }
}
#[doc = "Field `STS` writer - Sample Time Select"]
pub type StsW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sts, crate::Safe>;
impl<'a, REG> StsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Minimum sample time of 3.5 ADCK cycles."]
    #[inline(always)]
    pub fn sample_3p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample3p5)
    }
    #[doc = "3.5 + 21 ADCK cycles; 5.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_5p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample5p5)
    }
    #[doc = "3.5 + 22 ADCK cycles; 7.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_7p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample7p5)
    }
    #[doc = "3.5 + 23 ADCK cycles; 11.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_11p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample11p5)
    }
    #[doc = "3.5 + 24 ADCK cycles; 19.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_19p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample19p5)
    }
    #[doc = "3.5 + 25 ADCK cycles; 35.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_35p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample35p5)
    }
    #[doc = "3.5 + 26 ADCK cycles; 67.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_67p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample67p5)
    }
    #[doc = "3.5 + 27 ADCK cycles; 131.5 ADCK cycles total sample time."]
    #[inline(always)]
    pub fn sample_131p5(self) -> &'a mut crate::W<REG> {
        self.variant(Sts::Sample131p5)
    }
}
#[doc = "Hardware Average Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Avgs {
    #[doc = "0: Single conversion."]
    NoAverage = 0,
    #[doc = "1: 2 conversions averaged."]
    Average2 = 1,
    #[doc = "2: 4 conversions averaged."]
    Average4 = 2,
    #[doc = "3: 8 conversions averaged."]
    Average8 = 3,
    #[doc = "4: 16 conversions averaged."]
    Average16 = 4,
    #[doc = "5: 32 conversions averaged."]
    Average32 = 5,
    #[doc = "6: 64 conversions averaged."]
    Average64 = 6,
    #[doc = "7: 128 conversions averaged."]
    Average128 = 7,
    #[doc = "8: 256 conversions averaged."]
    Average256 = 8,
    #[doc = "9: 512 conversions averaged."]
    Average512 = 9,
    #[doc = "10: 1024 conversions averaged."]
    Average1024 = 10,
}
impl From<Avgs> for u8 {
    #[inline(always)]
    fn from(variant: Avgs) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Avgs {
    type Ux = u8;
}
impl crate::IsEnum for Avgs {}
#[doc = "Field `AVGS` reader - Hardware Average Select"]
pub type AvgsR = crate::FieldReader<Avgs>;
impl AvgsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Avgs> {
        match self.bits {
            0 => Some(Avgs::NoAverage),
            1 => Some(Avgs::Average2),
            2 => Some(Avgs::Average4),
            3 => Some(Avgs::Average8),
            4 => Some(Avgs::Average16),
            5 => Some(Avgs::Average32),
            6 => Some(Avgs::Average64),
            7 => Some(Avgs::Average128),
            8 => Some(Avgs::Average256),
            9 => Some(Avgs::Average512),
            10 => Some(Avgs::Average1024),
            _ => None,
        }
    }
    #[doc = "Single conversion."]
    #[inline(always)]
    pub fn is_no_average(&self) -> bool {
        *self == Avgs::NoAverage
    }
    #[doc = "2 conversions averaged."]
    #[inline(always)]
    pub fn is_average_2(&self) -> bool {
        *self == Avgs::Average2
    }
    #[doc = "4 conversions averaged."]
    #[inline(always)]
    pub fn is_average_4(&self) -> bool {
        *self == Avgs::Average4
    }
    #[doc = "8 conversions averaged."]
    #[inline(always)]
    pub fn is_average_8(&self) -> bool {
        *self == Avgs::Average8
    }
    #[doc = "16 conversions averaged."]
    #[inline(always)]
    pub fn is_average_16(&self) -> bool {
        *self == Avgs::Average16
    }
    #[doc = "32 conversions averaged."]
    #[inline(always)]
    pub fn is_average_32(&self) -> bool {
        *self == Avgs::Average32
    }
    #[doc = "64 conversions averaged."]
    #[inline(always)]
    pub fn is_average_64(&self) -> bool {
        *self == Avgs::Average64
    }
    #[doc = "128 conversions averaged."]
    #[inline(always)]
    pub fn is_average_128(&self) -> bool {
        *self == Avgs::Average128
    }
    #[doc = "256 conversions averaged."]
    #[inline(always)]
    pub fn is_average_256(&self) -> bool {
        *self == Avgs::Average256
    }
    #[doc = "512 conversions averaged."]
    #[inline(always)]
    pub fn is_average_512(&self) -> bool {
        *self == Avgs::Average512
    }
    #[doc = "1024 conversions averaged."]
    #[inline(always)]
    pub fn is_average_1024(&self) -> bool {
        *self == Avgs::Average1024
    }
}
#[doc = "Field `AVGS` writer - Hardware Average Select"]
pub type AvgsW<'a, REG> = crate::FieldWriter<'a, REG, 4, Avgs>;
impl<'a, REG> AvgsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Single conversion."]
    #[inline(always)]
    pub fn no_average(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::NoAverage)
    }
    #[doc = "2 conversions averaged."]
    #[inline(always)]
    pub fn average_2(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average2)
    }
    #[doc = "4 conversions averaged."]
    #[inline(always)]
    pub fn average_4(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average4)
    }
    #[doc = "8 conversions averaged."]
    #[inline(always)]
    pub fn average_8(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average8)
    }
    #[doc = "16 conversions averaged."]
    #[inline(always)]
    pub fn average_16(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average16)
    }
    #[doc = "32 conversions averaged."]
    #[inline(always)]
    pub fn average_32(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average32)
    }
    #[doc = "64 conversions averaged."]
    #[inline(always)]
    pub fn average_64(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average64)
    }
    #[doc = "128 conversions averaged."]
    #[inline(always)]
    pub fn average_128(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average128)
    }
    #[doc = "256 conversions averaged."]
    #[inline(always)]
    pub fn average_256(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average256)
    }
    #[doc = "512 conversions averaged."]
    #[inline(always)]
    pub fn average_512(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average512)
    }
    #[doc = "1024 conversions averaged."]
    #[inline(always)]
    pub fn average_1024(self) -> &'a mut crate::W<REG> {
        self.variant(Avgs::Average1024)
    }
}
#[doc = "Loop Count Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Loop {
    #[doc = "0: Looping not enabled. Command executes 1 time."]
    CmdExec1x = 0,
    #[doc = "1: Loop 1 time. Command executes 2 times."]
    CmdExec2x = 1,
    #[doc = "2: Loop 2 times. Command executes 3 times."]
    CmdExec3x = 2,
    #[doc = "3: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes3 = 3,
    #[doc = "4: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes4 = 4,
    #[doc = "5: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes5 = 5,
    #[doc = "6: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes6 = 6,
    #[doc = "7: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes7 = 7,
    #[doc = "8: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes8 = 8,
    #[doc = "9: Loop corresponding number of times. Command executes LOOP+1 times."]
    CmdExecutesCorrespondingTimes9 = 9,
    #[doc = "15: Loop 15 times. Command executes 16 times."]
    CmdExec15x = 15,
}
impl From<Loop> for u8 {
    #[inline(always)]
    fn from(variant: Loop) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Loop {
    type Ux = u8;
}
impl crate::IsEnum for Loop {}
#[doc = "Field `LOOP` reader - Loop Count Select"]
pub type LoopR = crate::FieldReader<Loop>;
impl LoopR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Loop> {
        match self.bits {
            0 => Some(Loop::CmdExec1x),
            1 => Some(Loop::CmdExec2x),
            2 => Some(Loop::CmdExec3x),
            3 => Some(Loop::CmdExecutesCorrespondingTimes3),
            4 => Some(Loop::CmdExecutesCorrespondingTimes4),
            5 => Some(Loop::CmdExecutesCorrespondingTimes5),
            6 => Some(Loop::CmdExecutesCorrespondingTimes6),
            7 => Some(Loop::CmdExecutesCorrespondingTimes7),
            8 => Some(Loop::CmdExecutesCorrespondingTimes8),
            9 => Some(Loop::CmdExecutesCorrespondingTimes9),
            15 => Some(Loop::CmdExec15x),
            _ => None,
        }
    }
    #[doc = "Looping not enabled. Command executes 1 time."]
    #[inline(always)]
    pub fn is_cmd_exec_1x(&self) -> bool {
        *self == Loop::CmdExec1x
    }
    #[doc = "Loop 1 time. Command executes 2 times."]
    #[inline(always)]
    pub fn is_cmd_exec_2x(&self) -> bool {
        *self == Loop::CmdExec2x
    }
    #[doc = "Loop 2 times. Command executes 3 times."]
    #[inline(always)]
    pub fn is_cmd_exec_3x(&self) -> bool {
        *self == Loop::CmdExec3x
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_3(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes3
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_4(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes4
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_5(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes5
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_6(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes6
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_7(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes7
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_8(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes8
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn is_cmd_executes_corresponding_times_9(&self) -> bool {
        *self == Loop::CmdExecutesCorrespondingTimes9
    }
    #[doc = "Loop 15 times. Command executes 16 times."]
    #[inline(always)]
    pub fn is_cmd_exec_15x(&self) -> bool {
        *self == Loop::CmdExec15x
    }
}
#[doc = "Field `LOOP` writer - Loop Count Select"]
pub type LoopW<'a, REG> = crate::FieldWriter<'a, REG, 4, Loop>;
impl<'a, REG> LoopW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Looping not enabled. Command executes 1 time."]
    #[inline(always)]
    pub fn cmd_exec_1x(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExec1x)
    }
    #[doc = "Loop 1 time. Command executes 2 times."]
    #[inline(always)]
    pub fn cmd_exec_2x(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExec2x)
    }
    #[doc = "Loop 2 times. Command executes 3 times."]
    #[inline(always)]
    pub fn cmd_exec_3x(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExec3x)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_3(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes3)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_4(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes4)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_5(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes5)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_6(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes6)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_7(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes7)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_8(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes8)
    }
    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
    #[inline(always)]
    pub fn cmd_executes_corresponding_times_9(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExecutesCorrespondingTimes9)
    }
    #[doc = "Loop 15 times. Command executes 16 times."]
    #[inline(always)]
    pub fn cmd_exec_15x(self) -> &'a mut crate::W<REG> {
        self.variant(Loop::CmdExec15x)
    }
}
#[doc = "Next Command Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Next {
    #[doc = "0: No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
    NoNextCmdTerminateOnFinish = 0,
    #[doc = "1: Select CMD1 command buffer register as next command."]
    DoCmd1Next = 1,
    #[doc = "2: Select corresponding CMD command buffer register as next command"]
    DoCorrespondingCmdNext2 = 2,
    #[doc = "3: Select corresponding CMD command buffer register as next command"]
    DoCorrespondingCmdNext3 = 3,
    #[doc = "4: Select corresponding CMD command buffer register as next command"]
    DoCorrespondingCmdNext4 = 4,
    #[doc = "5: Select corresponding CMD command buffer register as next command"]
    DoCorrespondingCmdNext5 = 5,
    #[doc = "6: Select corresponding CMD command buffer register as next command"]
    DoCorrespondingCmdNext6 = 6,
    #[doc = "7: Select CMD7 command buffer register as next command."]
    DoCmd7Next = 7,
}
impl From<Next> for u8 {
    #[inline(always)]
    fn from(variant: Next) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Next {
    type Ux = u8;
}
impl crate::IsEnum for Next {}
#[doc = "Field `NEXT` reader - Next Command Select"]
pub type NextR = crate::FieldReader<Next>;
impl NextR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Next {
        match self.bits {
            0 => Next::NoNextCmdTerminateOnFinish,
            1 => Next::DoCmd1Next,
            2 => Next::DoCorrespondingCmdNext2,
            3 => Next::DoCorrespondingCmdNext3,
            4 => Next::DoCorrespondingCmdNext4,
            5 => Next::DoCorrespondingCmdNext5,
            6 => Next::DoCorrespondingCmdNext6,
            7 => Next::DoCmd7Next,
            _ => unreachable!(),
        }
    }
    #[doc = "No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
    #[inline(always)]
    pub fn is_no_next_cmd_terminate_on_finish(&self) -> bool {
        *self == Next::NoNextCmdTerminateOnFinish
    }
    #[doc = "Select CMD1 command buffer register as next command."]
    #[inline(always)]
    pub fn is_do_cmd1_next(&self) -> bool {
        *self == Next::DoCmd1Next
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn is_do_corresponding_cmd_next_2(&self) -> bool {
        *self == Next::DoCorrespondingCmdNext2
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn is_do_corresponding_cmd_next_3(&self) -> bool {
        *self == Next::DoCorrespondingCmdNext3
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn is_do_corresponding_cmd_next_4(&self) -> bool {
        *self == Next::DoCorrespondingCmdNext4
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn is_do_corresponding_cmd_next_5(&self) -> bool {
        *self == Next::DoCorrespondingCmdNext5
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn is_do_corresponding_cmd_next_6(&self) -> bool {
        *self == Next::DoCorrespondingCmdNext6
    }
    #[doc = "Select CMD7 command buffer register as next command."]
    #[inline(always)]
    pub fn is_do_cmd7_next(&self) -> bool {
        *self == Next::DoCmd7Next
    }
}
#[doc = "Field `NEXT` writer - Next Command Select"]
pub type NextW<'a, REG> = crate::FieldWriter<'a, REG, 3, Next, crate::Safe>;
impl<'a, REG> NextW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
    #[inline(always)]
    pub fn no_next_cmd_terminate_on_finish(self) -> &'a mut crate::W<REG> {
        self.variant(Next::NoNextCmdTerminateOnFinish)
    }
    #[doc = "Select CMD1 command buffer register as next command."]
    #[inline(always)]
    pub fn do_cmd1_next(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCmd1Next)
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn do_corresponding_cmd_next_2(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCorrespondingCmdNext2)
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn do_corresponding_cmd_next_3(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCorrespondingCmdNext3)
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn do_corresponding_cmd_next_4(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCorrespondingCmdNext4)
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn do_corresponding_cmd_next_5(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCorrespondingCmdNext5)
    }
    #[doc = "Select corresponding CMD command buffer register as next command"]
    #[inline(always)]
    pub fn do_corresponding_cmd_next_6(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCorrespondingCmdNext6)
    }
    #[doc = "Select CMD7 command buffer register as next command."]
    #[inline(always)]
    pub fn do_cmd7_next(self) -> &'a mut crate::W<REG> {
        self.variant(Next::DoCmd7Next)
    }
}
impl R {
    #[doc = "Bits 0:1 - Compare Function Enable"]
    #[inline(always)]
    pub fn cmpen(&self) -> CmpenR {
        CmpenR::new((self.bits & 3) as u8)
    }
    #[doc = "Bit 2 - Wait for Trigger Assertion before Execution."]
    #[inline(always)]
    pub fn wait_trig(&self) -> WaitTrigR {
        WaitTrigR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 7 - Loop with Increment"]
    #[inline(always)]
    pub fn lwi(&self) -> LwiR {
        LwiR::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bits 8:10 - Sample Time Select"]
    #[inline(always)]
    pub fn sts(&self) -> StsR {
        StsR::new(((self.bits >> 8) & 7) as u8)
    }
    #[doc = "Bits 12:15 - Hardware Average Select"]
    #[inline(always)]
    pub fn avgs(&self) -> AvgsR {
        AvgsR::new(((self.bits >> 12) & 0x0f) as u8)
    }
    #[doc = "Bits 16:19 - Loop Count Select"]
    #[inline(always)]
    pub fn loop_(&self) -> LoopR {
        LoopR::new(((self.bits >> 16) & 0x0f) as u8)
    }
    #[doc = "Bits 24:26 - Next Command Select"]
    #[inline(always)]
    pub fn next(&self) -> NextR {
        NextR::new(((self.bits >> 24) & 7) 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("CMDH1")
            .field("cmpen", &self.cmpen())
            .field("wait_trig", &self.wait_trig())
            .field("lwi", &self.lwi())
            .field("sts", &self.sts())
            .field("avgs", &self.avgs())
            .field("loop_", &self.loop_())
            .field("next", &self.next())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:1 - Compare Function Enable"]
    #[inline(always)]
    pub fn cmpen(&mut self) -> CmpenW<'_, Cmdh1Spec> {
        CmpenW::new(self, 0)
    }
    #[doc = "Bit 2 - Wait for Trigger Assertion before Execution."]
    #[inline(always)]
    pub fn wait_trig(&mut self) -> WaitTrigW<'_, Cmdh1Spec> {
        WaitTrigW::new(self, 2)
    }
    #[doc = "Bit 7 - Loop with Increment"]
    #[inline(always)]
    pub fn lwi(&mut self) -> LwiW<'_, Cmdh1Spec> {
        LwiW::new(self, 7)
    }
    #[doc = "Bits 8:10 - Sample Time Select"]
    #[inline(always)]
    pub fn sts(&mut self) -> StsW<'_, Cmdh1Spec> {
        StsW::new(self, 8)
    }
    #[doc = "Bits 12:15 - Hardware Average Select"]
    #[inline(always)]
    pub fn avgs(&mut self) -> AvgsW<'_, Cmdh1Spec> {
        AvgsW::new(self, 12)
    }
    #[doc = "Bits 16:19 - Loop Count Select"]
    #[inline(always)]
    pub fn loop_(&mut self) -> LoopW<'_, Cmdh1Spec> {
        LoopW::new(self, 16)
    }
    #[doc = "Bits 24:26 - Next Command Select"]
    #[inline(always)]
    pub fn next(&mut self) -> NextW<'_, Cmdh1Spec> {
        NextW::new(self, 24)
    }
}
#[doc = "Command High Buffer Register\n\nYou can [`read`](crate::Reg::read) this register and get [`cmdh1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cmdh1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Cmdh1Spec;
impl crate::RegisterSpec for Cmdh1Spec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`cmdh1::R`](R) reader structure"]
impl crate::Readable for Cmdh1Spec {}
#[doc = "`write(|w| ..)` method takes [`cmdh1::W`](W) writer structure"]
impl crate::Writable for Cmdh1Spec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets CMDH1 to value 0"]
impl crate::Resettable for Cmdh1Spec {}