mcxa-pac 0.2.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
#[doc = "Register `TIMCFG[%s]` reader"]
pub type R = crate::R<TimcfgSpec>;
#[doc = "Register `TIMCFG[%s]` writer"]
pub type W = crate::W<TimcfgSpec>;
#[doc = "Timer Start\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tstart {
    #[doc = "0: Disabled"]
    Disable = 0,
    #[doc = "1: Enabled"]
    Enable = 1,
}
impl From<Tstart> for bool {
    #[inline(always)]
    fn from(variant: Tstart) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TSTART` reader - Timer Start"]
pub type TstartR = crate::BitReader<Tstart>;
impl TstartR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tstart {
        match self.bits {
            false => Tstart::Disable,
            true => Tstart::Enable,
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == Tstart::Disable
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Tstart::Enable
    }
}
#[doc = "Field `TSTART` writer - Timer Start"]
pub type TstartW<'a, REG> = crate::BitWriter<'a, REG, Tstart>;
impl<'a, REG> TstartW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(Tstart::Disable)
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Tstart::Enable)
    }
}
#[doc = "Timer Stop\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Tstop {
    #[doc = "0: Disabled"]
    StopDisable = 0,
    #[doc = "1: Enabled on timer compare"]
    EnableTmrcmp = 1,
    #[doc = "2: Enabled on timer disable"]
    EnableTmrdisable = 2,
    #[doc = "3: Enabled on timer compare and timer disable"]
    EnableTmrCmpDis = 3,
}
impl From<Tstop> for u8 {
    #[inline(always)]
    fn from(variant: Tstop) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Tstop {
    type Ux = u8;
}
impl crate::IsEnum for Tstop {}
#[doc = "Field `TSTOP` reader - Timer Stop"]
pub type TstopR = crate::FieldReader<Tstop>;
impl TstopR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tstop {
        match self.bits {
            0 => Tstop::StopDisable,
            1 => Tstop::EnableTmrcmp,
            2 => Tstop::EnableTmrdisable,
            3 => Tstop::EnableTmrCmpDis,
            _ => unreachable!(),
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_stop_disable(&self) -> bool {
        *self == Tstop::StopDisable
    }
    #[doc = "Enabled on timer compare"]
    #[inline(always)]
    pub fn is_enable_tmrcmp(&self) -> bool {
        *self == Tstop::EnableTmrcmp
    }
    #[doc = "Enabled on timer disable"]
    #[inline(always)]
    pub fn is_enable_tmrdisable(&self) -> bool {
        *self == Tstop::EnableTmrdisable
    }
    #[doc = "Enabled on timer compare and timer disable"]
    #[inline(always)]
    pub fn is_enable_tmr_cmp_dis(&self) -> bool {
        *self == Tstop::EnableTmrCmpDis
    }
}
#[doc = "Field `TSTOP` writer - Timer Stop"]
pub type TstopW<'a, REG> = crate::FieldWriter<'a, REG, 2, Tstop, crate::Safe>;
impl<'a, REG> TstopW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn stop_disable(self) -> &'a mut crate::W<REG> {
        self.variant(Tstop::StopDisable)
    }
    #[doc = "Enabled on timer compare"]
    #[inline(always)]
    pub fn enable_tmrcmp(self) -> &'a mut crate::W<REG> {
        self.variant(Tstop::EnableTmrcmp)
    }
    #[doc = "Enabled on timer disable"]
    #[inline(always)]
    pub fn enable_tmrdisable(self) -> &'a mut crate::W<REG> {
        self.variant(Tstop::EnableTmrdisable)
    }
    #[doc = "Enabled on timer compare and timer disable"]
    #[inline(always)]
    pub fn enable_tmr_cmp_dis(self) -> &'a mut crate::W<REG> {
        self.variant(Tstop::EnableTmrCmpDis)
    }
}
#[doc = "Timer Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Timena {
    #[doc = "0: Timer always enabled"]
    Enable = 0,
    #[doc = "1: Timer enabled on timer n-1 enable"]
    TmrNminus1En = 1,
    #[doc = "2: Timer enabled on trigger high"]
    TmrTrighiEn = 2,
    #[doc = "3: Timer enabled on trigger high and pin high"]
    TmrTrigPinHiEn = 3,
    #[doc = "4: Timer enabled on pin rising edge"]
    TmrPinriseEn = 4,
    #[doc = "5: Timer enabled on pin rising edge and trigger high"]
    TmrPinriseTrighiEn = 5,
    #[doc = "6: Timer enabled on trigger rising edge"]
    TmrTrigriseEn = 6,
    #[doc = "7: Timer enabled on trigger rising or falling edge"]
    TmrTrigedgeEn = 7,
}
impl From<Timena> for u8 {
    #[inline(always)]
    fn from(variant: Timena) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Timena {
    type Ux = u8;
}
impl crate::IsEnum for Timena {}
#[doc = "Field `TIMENA` reader - Timer Enable"]
pub type TimenaR = crate::FieldReader<Timena>;
impl TimenaR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Timena {
        match self.bits {
            0 => Timena::Enable,
            1 => Timena::TmrNminus1En,
            2 => Timena::TmrTrighiEn,
            3 => Timena::TmrTrigPinHiEn,
            4 => Timena::TmrPinriseEn,
            5 => Timena::TmrPinriseTrighiEn,
            6 => Timena::TmrTrigriseEn,
            7 => Timena::TmrTrigedgeEn,
            _ => unreachable!(),
        }
    }
    #[doc = "Timer always enabled"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Timena::Enable
    }
    #[doc = "Timer enabled on timer n-1 enable"]
    #[inline(always)]
    pub fn is_tmr_nminus1_en(&self) -> bool {
        *self == Timena::TmrNminus1En
    }
    #[doc = "Timer enabled on trigger high"]
    #[inline(always)]
    pub fn is_tmr_trighi_en(&self) -> bool {
        *self == Timena::TmrTrighiEn
    }
    #[doc = "Timer enabled on trigger high and pin high"]
    #[inline(always)]
    pub fn is_tmr_trig_pin_hi_en(&self) -> bool {
        *self == Timena::TmrTrigPinHiEn
    }
    #[doc = "Timer enabled on pin rising edge"]
    #[inline(always)]
    pub fn is_tmr_pinrise_en(&self) -> bool {
        *self == Timena::TmrPinriseEn
    }
    #[doc = "Timer enabled on pin rising edge and trigger high"]
    #[inline(always)]
    pub fn is_tmr_pinrise_trighi_en(&self) -> bool {
        *self == Timena::TmrPinriseTrighiEn
    }
    #[doc = "Timer enabled on trigger rising edge"]
    #[inline(always)]
    pub fn is_tmr_trigrise_en(&self) -> bool {
        *self == Timena::TmrTrigriseEn
    }
    #[doc = "Timer enabled on trigger rising or falling edge"]
    #[inline(always)]
    pub fn is_tmr_trigedge_en(&self) -> bool {
        *self == Timena::TmrTrigedgeEn
    }
}
#[doc = "Field `TIMENA` writer - Timer Enable"]
pub type TimenaW<'a, REG> = crate::FieldWriter<'a, REG, 3, Timena, crate::Safe>;
impl<'a, REG> TimenaW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Timer always enabled"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::Enable)
    }
    #[doc = "Timer enabled on timer n-1 enable"]
    #[inline(always)]
    pub fn tmr_nminus1_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrNminus1En)
    }
    #[doc = "Timer enabled on trigger high"]
    #[inline(always)]
    pub fn tmr_trighi_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrTrighiEn)
    }
    #[doc = "Timer enabled on trigger high and pin high"]
    #[inline(always)]
    pub fn tmr_trig_pin_hi_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrTrigPinHiEn)
    }
    #[doc = "Timer enabled on pin rising edge"]
    #[inline(always)]
    pub fn tmr_pinrise_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrPinriseEn)
    }
    #[doc = "Timer enabled on pin rising edge and trigger high"]
    #[inline(always)]
    pub fn tmr_pinrise_trighi_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrPinriseTrighiEn)
    }
    #[doc = "Timer enabled on trigger rising edge"]
    #[inline(always)]
    pub fn tmr_trigrise_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrTrigriseEn)
    }
    #[doc = "Timer enabled on trigger rising or falling edge"]
    #[inline(always)]
    pub fn tmr_trigedge_en(self) -> &'a mut crate::W<REG> {
        self.variant(Timena::TmrTrigedgeEn)
    }
}
#[doc = "Timer Disable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Timdis {
    #[doc = "0: Timer never disabled"]
    Never = 0,
    #[doc = "1: Timer disabled on timer n-1 disable"]
    TmrNminus1 = 1,
    #[doc = "2: Timer disabled on timer compare (upper 8 bits match and decrement)"]
    TmrCmp = 2,
    #[doc = "3: Timer disabled on timer compare (upper 8 bits match and decrement) and trigger low"]
    TmrCmpTriglow = 3,
    #[doc = "4: Timer disabled on pin rising or falling edge"]
    PinEdge = 4,
    #[doc = "5: Timer disabled on pin rising or falling edge provided trigger is high"]
    PinEdgeTrighi = 5,
    #[doc = "6: Timer disabled on trigger falling edge"]
    TrigFalledge = 6,
}
impl From<Timdis> for u8 {
    #[inline(always)]
    fn from(variant: Timdis) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Timdis {
    type Ux = u8;
}
impl crate::IsEnum for Timdis {}
#[doc = "Field `TIMDIS` reader - Timer Disable"]
pub type TimdisR = crate::FieldReader<Timdis>;
impl TimdisR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Timdis> {
        match self.bits {
            0 => Some(Timdis::Never),
            1 => Some(Timdis::TmrNminus1),
            2 => Some(Timdis::TmrCmp),
            3 => Some(Timdis::TmrCmpTriglow),
            4 => Some(Timdis::PinEdge),
            5 => Some(Timdis::PinEdgeTrighi),
            6 => Some(Timdis::TrigFalledge),
            _ => None,
        }
    }
    #[doc = "Timer never disabled"]
    #[inline(always)]
    pub fn is_never(&self) -> bool {
        *self == Timdis::Never
    }
    #[doc = "Timer disabled on timer n-1 disable"]
    #[inline(always)]
    pub fn is_tmr_nminus1(&self) -> bool {
        *self == Timdis::TmrNminus1
    }
    #[doc = "Timer disabled on timer compare (upper 8 bits match and decrement)"]
    #[inline(always)]
    pub fn is_tmr_cmp(&self) -> bool {
        *self == Timdis::TmrCmp
    }
    #[doc = "Timer disabled on timer compare (upper 8 bits match and decrement) and trigger low"]
    #[inline(always)]
    pub fn is_tmr_cmp_triglow(&self) -> bool {
        *self == Timdis::TmrCmpTriglow
    }
    #[doc = "Timer disabled on pin rising or falling edge"]
    #[inline(always)]
    pub fn is_pin_edge(&self) -> bool {
        *self == Timdis::PinEdge
    }
    #[doc = "Timer disabled on pin rising or falling edge provided trigger is high"]
    #[inline(always)]
    pub fn is_pin_edge_trighi(&self) -> bool {
        *self == Timdis::PinEdgeTrighi
    }
    #[doc = "Timer disabled on trigger falling edge"]
    #[inline(always)]
    pub fn is_trig_falledge(&self) -> bool {
        *self == Timdis::TrigFalledge
    }
}
#[doc = "Field `TIMDIS` writer - Timer Disable"]
pub type TimdisW<'a, REG> = crate::FieldWriter<'a, REG, 3, Timdis>;
impl<'a, REG> TimdisW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Timer never disabled"]
    #[inline(always)]
    pub fn never(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::Never)
    }
    #[doc = "Timer disabled on timer n-1 disable"]
    #[inline(always)]
    pub fn tmr_nminus1(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::TmrNminus1)
    }
    #[doc = "Timer disabled on timer compare (upper 8 bits match and decrement)"]
    #[inline(always)]
    pub fn tmr_cmp(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::TmrCmp)
    }
    #[doc = "Timer disabled on timer compare (upper 8 bits match and decrement) and trigger low"]
    #[inline(always)]
    pub fn tmr_cmp_triglow(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::TmrCmpTriglow)
    }
    #[doc = "Timer disabled on pin rising or falling edge"]
    #[inline(always)]
    pub fn pin_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::PinEdge)
    }
    #[doc = "Timer disabled on pin rising or falling edge provided trigger is high"]
    #[inline(always)]
    pub fn pin_edge_trighi(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::PinEdgeTrighi)
    }
    #[doc = "Timer disabled on trigger falling edge"]
    #[inline(always)]
    pub fn trig_falledge(self) -> &'a mut crate::W<REG> {
        self.variant(Timdis::TrigFalledge)
    }
}
#[doc = "Timer Reset\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Timrst {
    #[doc = "0: Never reset timer"]
    Never = 0,
    #[doc = "1: Timer reset on timer output high."]
    TmrOutHi = 1,
    #[doc = "2: Timer reset on timer pin equal to timer output"]
    PinEqTmrOut = 2,
    #[doc = "3: Timer reset on timer trigger equal to timer output"]
    TrigEqTmrOut = 3,
    #[doc = "4: Timer reset on timer pin rising edge"]
    PinRiseEdge = 4,
    #[doc = "6: Timer reset on trigger rising edge"]
    TrigRiseEdge = 6,
    #[doc = "7: Timer reset on trigger rising or falling edge"]
    TrigEdge = 7,
}
impl From<Timrst> for u8 {
    #[inline(always)]
    fn from(variant: Timrst) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Timrst {
    type Ux = u8;
}
impl crate::IsEnum for Timrst {}
#[doc = "Field `TIMRST` reader - Timer Reset"]
pub type TimrstR = crate::FieldReader<Timrst>;
impl TimrstR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Timrst> {
        match self.bits {
            0 => Some(Timrst::Never),
            1 => Some(Timrst::TmrOutHi),
            2 => Some(Timrst::PinEqTmrOut),
            3 => Some(Timrst::TrigEqTmrOut),
            4 => Some(Timrst::PinRiseEdge),
            6 => Some(Timrst::TrigRiseEdge),
            7 => Some(Timrst::TrigEdge),
            _ => None,
        }
    }
    #[doc = "Never reset timer"]
    #[inline(always)]
    pub fn is_never(&self) -> bool {
        *self == Timrst::Never
    }
    #[doc = "Timer reset on timer output high."]
    #[inline(always)]
    pub fn is_tmr_out_hi(&self) -> bool {
        *self == Timrst::TmrOutHi
    }
    #[doc = "Timer reset on timer pin equal to timer output"]
    #[inline(always)]
    pub fn is_pin_eq_tmr_out(&self) -> bool {
        *self == Timrst::PinEqTmrOut
    }
    #[doc = "Timer reset on timer trigger equal to timer output"]
    #[inline(always)]
    pub fn is_trig_eq_tmr_out(&self) -> bool {
        *self == Timrst::TrigEqTmrOut
    }
    #[doc = "Timer reset on timer pin rising edge"]
    #[inline(always)]
    pub fn is_pin_rise_edge(&self) -> bool {
        *self == Timrst::PinRiseEdge
    }
    #[doc = "Timer reset on trigger rising edge"]
    #[inline(always)]
    pub fn is_trig_rise_edge(&self) -> bool {
        *self == Timrst::TrigRiseEdge
    }
    #[doc = "Timer reset on trigger rising or falling edge"]
    #[inline(always)]
    pub fn is_trig_edge(&self) -> bool {
        *self == Timrst::TrigEdge
    }
}
#[doc = "Field `TIMRST` writer - Timer Reset"]
pub type TimrstW<'a, REG> = crate::FieldWriter<'a, REG, 3, Timrst>;
impl<'a, REG> TimrstW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Never reset timer"]
    #[inline(always)]
    pub fn never(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::Never)
    }
    #[doc = "Timer reset on timer output high."]
    #[inline(always)]
    pub fn tmr_out_hi(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::TmrOutHi)
    }
    #[doc = "Timer reset on timer pin equal to timer output"]
    #[inline(always)]
    pub fn pin_eq_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::PinEqTmrOut)
    }
    #[doc = "Timer reset on timer trigger equal to timer output"]
    #[inline(always)]
    pub fn trig_eq_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::TrigEqTmrOut)
    }
    #[doc = "Timer reset on timer pin rising edge"]
    #[inline(always)]
    pub fn pin_rise_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::PinRiseEdge)
    }
    #[doc = "Timer reset on trigger rising edge"]
    #[inline(always)]
    pub fn trig_rise_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::TrigRiseEdge)
    }
    #[doc = "Timer reset on trigger rising or falling edge"]
    #[inline(always)]
    pub fn trig_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Timrst::TrigEdge)
    }
}
#[doc = "Timer Decrement\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Timdec {
    #[doc = "0: Decrement counter on FLEXIO clock; shift clock equals timer output"]
    FlexioClkShiftclkTmrOut = 0,
    #[doc = "1: Decrement counter on trigger input (both edges); shift clock equals timer output"]
    TrigEdgeShiftclkTmrOut = 1,
    #[doc = "2: Decrement counter on pin input (both edges); shift clock equals pin input"]
    PinEdgeShiftclkTmrOut = 2,
    #[doc = "3: Decrement counter on trigger input (both edges); shift clock equals trigger input"]
    TrigEdgeShiftclkTrigIn = 3,
    #[doc = "4: Decrement counter on FLEXIO clock divided by 16; shift clock equals timer output"]
    FlexioClkDiv16ShiftclkTmrOut = 4,
    #[doc = "5: Decrement counter on FLEXIO clock divided by 256; shift clock equals timer output"]
    FlexioClkDiv256ShiftclkTmrOut = 5,
    #[doc = "6: Decrement counter on pin input (rising edge); shift clock equals pin input"]
    PinRiseShiftclkPinIn = 6,
    #[doc = "7: Decrement counter on trigger input (rising edge); shift clock equals trigger input"]
    TrigRiseShiftclkTrigIn = 7,
}
impl From<Timdec> for u8 {
    #[inline(always)]
    fn from(variant: Timdec) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Timdec {
    type Ux = u8;
}
impl crate::IsEnum for Timdec {}
#[doc = "Field `TIMDEC` reader - Timer Decrement"]
pub type TimdecR = crate::FieldReader<Timdec>;
impl TimdecR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Timdec {
        match self.bits {
            0 => Timdec::FlexioClkShiftclkTmrOut,
            1 => Timdec::TrigEdgeShiftclkTmrOut,
            2 => Timdec::PinEdgeShiftclkTmrOut,
            3 => Timdec::TrigEdgeShiftclkTrigIn,
            4 => Timdec::FlexioClkDiv16ShiftclkTmrOut,
            5 => Timdec::FlexioClkDiv256ShiftclkTmrOut,
            6 => Timdec::PinRiseShiftclkPinIn,
            7 => Timdec::TrigRiseShiftclkTrigIn,
            _ => unreachable!(),
        }
    }
    #[doc = "Decrement counter on FLEXIO clock; shift clock equals timer output"]
    #[inline(always)]
    pub fn is_flexio_clk_shiftclk_tmr_out(&self) -> bool {
        *self == Timdec::FlexioClkShiftclkTmrOut
    }
    #[doc = "Decrement counter on trigger input (both edges); shift clock equals timer output"]
    #[inline(always)]
    pub fn is_trig_edge_shiftclk_tmr_out(&self) -> bool {
        *self == Timdec::TrigEdgeShiftclkTmrOut
    }
    #[doc = "Decrement counter on pin input (both edges); shift clock equals pin input"]
    #[inline(always)]
    pub fn is_pin_edge_shiftclk_tmr_out(&self) -> bool {
        *self == Timdec::PinEdgeShiftclkTmrOut
    }
    #[doc = "Decrement counter on trigger input (both edges); shift clock equals trigger input"]
    #[inline(always)]
    pub fn is_trig_edge_shiftclk_trig_in(&self) -> bool {
        *self == Timdec::TrigEdgeShiftclkTrigIn
    }
    #[doc = "Decrement counter on FLEXIO clock divided by 16; shift clock equals timer output"]
    #[inline(always)]
    pub fn is_flexio_clk_div16_shiftclk_tmr_out(&self) -> bool {
        *self == Timdec::FlexioClkDiv16ShiftclkTmrOut
    }
    #[doc = "Decrement counter on FLEXIO clock divided by 256; shift clock equals timer output"]
    #[inline(always)]
    pub fn is_flexio_clk_div256_shiftclk_tmr_out(&self) -> bool {
        *self == Timdec::FlexioClkDiv256ShiftclkTmrOut
    }
    #[doc = "Decrement counter on pin input (rising edge); shift clock equals pin input"]
    #[inline(always)]
    pub fn is_pin_rise_shiftclk_pin_in(&self) -> bool {
        *self == Timdec::PinRiseShiftclkPinIn
    }
    #[doc = "Decrement counter on trigger input (rising edge); shift clock equals trigger input"]
    #[inline(always)]
    pub fn is_trig_rise_shiftclk_trig_in(&self) -> bool {
        *self == Timdec::TrigRiseShiftclkTrigIn
    }
}
#[doc = "Field `TIMDEC` writer - Timer Decrement"]
pub type TimdecW<'a, REG> = crate::FieldWriter<'a, REG, 3, Timdec, crate::Safe>;
impl<'a, REG> TimdecW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Decrement counter on FLEXIO clock; shift clock equals timer output"]
    #[inline(always)]
    pub fn flexio_clk_shiftclk_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::FlexioClkShiftclkTmrOut)
    }
    #[doc = "Decrement counter on trigger input (both edges); shift clock equals timer output"]
    #[inline(always)]
    pub fn trig_edge_shiftclk_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::TrigEdgeShiftclkTmrOut)
    }
    #[doc = "Decrement counter on pin input (both edges); shift clock equals pin input"]
    #[inline(always)]
    pub fn pin_edge_shiftclk_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::PinEdgeShiftclkTmrOut)
    }
    #[doc = "Decrement counter on trigger input (both edges); shift clock equals trigger input"]
    #[inline(always)]
    pub fn trig_edge_shiftclk_trig_in(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::TrigEdgeShiftclkTrigIn)
    }
    #[doc = "Decrement counter on FLEXIO clock divided by 16; shift clock equals timer output"]
    #[inline(always)]
    pub fn flexio_clk_div16_shiftclk_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::FlexioClkDiv16ShiftclkTmrOut)
    }
    #[doc = "Decrement counter on FLEXIO clock divided by 256; shift clock equals timer output"]
    #[inline(always)]
    pub fn flexio_clk_div256_shiftclk_tmr_out(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::FlexioClkDiv256ShiftclkTmrOut)
    }
    #[doc = "Decrement counter on pin input (rising edge); shift clock equals pin input"]
    #[inline(always)]
    pub fn pin_rise_shiftclk_pin_in(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::PinRiseShiftclkPinIn)
    }
    #[doc = "Decrement counter on trigger input (rising edge); shift clock equals trigger input"]
    #[inline(always)]
    pub fn trig_rise_shiftclk_trig_in(self) -> &'a mut crate::W<REG> {
        self.variant(Timdec::TrigRiseShiftclkTrigIn)
    }
}
#[doc = "Timer Output\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Timout {
    #[doc = "0: Logic one when enabled; not affected by timer reset"]
    One = 0,
    #[doc = "1: Logic zero when enabled; not affected by timer reset"]
    Zero = 1,
    #[doc = "2: Logic one when enabled and on timer reset"]
    OneTmrreset = 2,
    #[doc = "3: Logic zero when enabled and on timer reset"]
    ZeroTmrreset = 3,
}
impl From<Timout> for u8 {
    #[inline(always)]
    fn from(variant: Timout) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Timout {
    type Ux = u8;
}
impl crate::IsEnum for Timout {}
#[doc = "Field `TIMOUT` reader - Timer Output"]
pub type TimoutR = crate::FieldReader<Timout>;
impl TimoutR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Timout {
        match self.bits {
            0 => Timout::One,
            1 => Timout::Zero,
            2 => Timout::OneTmrreset,
            3 => Timout::ZeroTmrreset,
            _ => unreachable!(),
        }
    }
    #[doc = "Logic one when enabled; not affected by timer reset"]
    #[inline(always)]
    pub fn is_one(&self) -> bool {
        *self == Timout::One
    }
    #[doc = "Logic zero when enabled; not affected by timer reset"]
    #[inline(always)]
    pub fn is_zero(&self) -> bool {
        *self == Timout::Zero
    }
    #[doc = "Logic one when enabled and on timer reset"]
    #[inline(always)]
    pub fn is_one_tmrreset(&self) -> bool {
        *self == Timout::OneTmrreset
    }
    #[doc = "Logic zero when enabled and on timer reset"]
    #[inline(always)]
    pub fn is_zero_tmrreset(&self) -> bool {
        *self == Timout::ZeroTmrreset
    }
}
#[doc = "Field `TIMOUT` writer - Timer Output"]
pub type TimoutW<'a, REG> = crate::FieldWriter<'a, REG, 2, Timout, crate::Safe>;
impl<'a, REG> TimoutW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Logic one when enabled; not affected by timer reset"]
    #[inline(always)]
    pub fn one(self) -> &'a mut crate::W<REG> {
        self.variant(Timout::One)
    }
    #[doc = "Logic zero when enabled; not affected by timer reset"]
    #[inline(always)]
    pub fn zero(self) -> &'a mut crate::W<REG> {
        self.variant(Timout::Zero)
    }
    #[doc = "Logic one when enabled and on timer reset"]
    #[inline(always)]
    pub fn one_tmrreset(self) -> &'a mut crate::W<REG> {
        self.variant(Timout::OneTmrreset)
    }
    #[doc = "Logic zero when enabled and on timer reset"]
    #[inline(always)]
    pub fn zero_tmrreset(self) -> &'a mut crate::W<REG> {
        self.variant(Timout::ZeroTmrreset)
    }
}
impl R {
    #[doc = "Bit 1 - Timer Start"]
    #[inline(always)]
    pub fn tstart(&self) -> TstartR {
        TstartR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 4:5 - Timer Stop"]
    #[inline(always)]
    pub fn tstop(&self) -> TstopR {
        TstopR::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bits 8:10 - Timer Enable"]
    #[inline(always)]
    pub fn timena(&self) -> TimenaR {
        TimenaR::new(((self.bits >> 8) & 7) as u8)
    }
    #[doc = "Bits 12:14 - Timer Disable"]
    #[inline(always)]
    pub fn timdis(&self) -> TimdisR {
        TimdisR::new(((self.bits >> 12) & 7) as u8)
    }
    #[doc = "Bits 16:18 - Timer Reset"]
    #[inline(always)]
    pub fn timrst(&self) -> TimrstR {
        TimrstR::new(((self.bits >> 16) & 7) as u8)
    }
    #[doc = "Bits 20:22 - Timer Decrement"]
    #[inline(always)]
    pub fn timdec(&self) -> TimdecR {
        TimdecR::new(((self.bits >> 20) & 7) as u8)
    }
    #[doc = "Bits 24:25 - Timer Output"]
    #[inline(always)]
    pub fn timout(&self) -> TimoutR {
        TimoutR::new(((self.bits >> 24) & 3) 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("TIMCFG")
            .field("tstart", &self.tstart())
            .field("tstop", &self.tstop())
            .field("timena", &self.timena())
            .field("timdis", &self.timdis())
            .field("timrst", &self.timrst())
            .field("timdec", &self.timdec())
            .field("timout", &self.timout())
            .finish()
    }
}
impl W {
    #[doc = "Bit 1 - Timer Start"]
    #[inline(always)]
    pub fn tstart(&mut self) -> TstartW<'_, TimcfgSpec> {
        TstartW::new(self, 1)
    }
    #[doc = "Bits 4:5 - Timer Stop"]
    #[inline(always)]
    pub fn tstop(&mut self) -> TstopW<'_, TimcfgSpec> {
        TstopW::new(self, 4)
    }
    #[doc = "Bits 8:10 - Timer Enable"]
    #[inline(always)]
    pub fn timena(&mut self) -> TimenaW<'_, TimcfgSpec> {
        TimenaW::new(self, 8)
    }
    #[doc = "Bits 12:14 - Timer Disable"]
    #[inline(always)]
    pub fn timdis(&mut self) -> TimdisW<'_, TimcfgSpec> {
        TimdisW::new(self, 12)
    }
    #[doc = "Bits 16:18 - Timer Reset"]
    #[inline(always)]
    pub fn timrst(&mut self) -> TimrstW<'_, TimcfgSpec> {
        TimrstW::new(self, 16)
    }
    #[doc = "Bits 20:22 - Timer Decrement"]
    #[inline(always)]
    pub fn timdec(&mut self) -> TimdecW<'_, TimcfgSpec> {
        TimdecW::new(self, 20)
    }
    #[doc = "Bits 24:25 - Timer Output"]
    #[inline(always)]
    pub fn timout(&mut self) -> TimoutW<'_, TimcfgSpec> {
        TimoutW::new(self, 24)
    }
}
#[doc = "Timer Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`timcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`timcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct TimcfgSpec;
impl crate::RegisterSpec for TimcfgSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`timcfg::R`](R) reader structure"]
impl crate::Readable for TimcfgSpec {}
#[doc = "`write(|w| ..)` method takes [`timcfg::W`](W) writer structure"]
impl crate::Writable for TimcfgSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets TIMCFG[%s] to value 0"]
impl crate::Resettable for TimcfgSpec {}