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
#[doc = "Register `FNCTL` reader"]
pub type R = crate::R<FNCTL_SPEC>;
#[doc = "Register `FNCTL` writer"]
pub type W = crate::W<FNCTL_SPEC>;
#[doc = "Touch-Sense TSIN Pad Turn\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PADT_A {
    #[doc = "0: TSIN0"]
    VALUE1 = 0,
    #[doc = "7: TSIN7"]
    VALUE2 = 7,
}
impl From<PADT_A> for u8 {
    #[inline(always)]
    fn from(variant: PADT_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for PADT_A {
    type Ux = u8;
}
impl crate::IsEnum for PADT_A {}
#[doc = "Field `PADT` reader - Touch-Sense TSIN Pad Turn"]
pub type PADT_R = crate::FieldReader<PADT_A>;
impl PADT_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<PADT_A> {
        match self.bits {
            0 => Some(PADT_A::VALUE1),
            7 => Some(PADT_A::VALUE2),
            _ => None,
        }
    }
    #[doc = "TSIN0"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == PADT_A::VALUE1
    }
    #[doc = "TSIN7"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == PADT_A::VALUE2
    }
}
#[doc = "Field `PADT` writer - Touch-Sense TSIN Pad Turn"]
pub type PADT_W<'a, REG> = crate::FieldWriter<'a, REG, 3, PADT_A>;
impl<'a, REG> PADT_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "TSIN0"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(PADT_A::VALUE1)
    }
    #[doc = "TSIN7"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(PADT_A::VALUE2)
    }
}
#[doc = "Software Control for Touch-Sense Pad Turn\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PADTSW_A {
    #[doc = "0: The hardware automatically enables the touch-sense inputs in sequence round-robin, starting from TSIN0."]
    VALUE1 = 0,
    #[doc = "1: Disable hardware control for software control only. The touch-sense input is configured in bit PADT."]
    VALUE2 = 1,
}
impl From<PADTSW_A> for bool {
    #[inline(always)]
    fn from(variant: PADTSW_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PADTSW` reader - Software Control for Touch-Sense Pad Turn"]
pub type PADTSW_R = crate::BitReader<PADTSW_A>;
impl PADTSW_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> PADTSW_A {
        match self.bits {
            false => PADTSW_A::VALUE1,
            true => PADTSW_A::VALUE2,
        }
    }
    #[doc = "The hardware automatically enables the touch-sense inputs in sequence round-robin, starting from TSIN0."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == PADTSW_A::VALUE1
    }
    #[doc = "Disable hardware control for software control only. The touch-sense input is configured in bit PADT."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == PADTSW_A::VALUE2
    }
}
#[doc = "Field `PADTSW` writer - Software Control for Touch-Sense Pad Turn"]
pub type PADTSW_W<'a, REG> = crate::BitWriter<'a, REG, PADTSW_A>;
impl<'a, REG> PADTSW_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The hardware automatically enables the touch-sense inputs in sequence round-robin, starting from TSIN0."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(PADTSW_A::VALUE1)
    }
    #[doc = "Disable hardware control for software control only. The touch-sense input is configured in bit PADT."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(PADTSW_A::VALUE2)
    }
}
#[doc = "Enable External Pull-up Configuration on Pin COLA\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EPULL_A {
    #[doc = "0: HW over-rule to enable internal pull-up is active on TSIN\\[x\\]
for set duration in touch-sense time slice. With this setting, it is not specified to assign the COLA to any pin."]
    VALUE1 = 0,
    #[doc = "1: Enable external pull-up: Output 1 on pin COLA for whole duration of touch-sense time slice."]
    VALUE2 = 1,
}
impl From<EPULL_A> for bool {
    #[inline(always)]
    fn from(variant: EPULL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `EPULL` reader - Enable External Pull-up Configuration on Pin COLA"]
pub type EPULL_R = crate::BitReader<EPULL_A>;
impl EPULL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> EPULL_A {
        match self.bits {
            false => EPULL_A::VALUE1,
            true => EPULL_A::VALUE2,
        }
    }
    #[doc = "HW over-rule to enable internal pull-up is active on TSIN\\[x\\]
for set duration in touch-sense time slice. With this setting, it is not specified to assign the COLA to any pin."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == EPULL_A::VALUE1
    }
    #[doc = "Enable external pull-up: Output 1 on pin COLA for whole duration of touch-sense time slice."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == EPULL_A::VALUE2
    }
}
#[doc = "Field `EPULL` writer - Enable External Pull-up Configuration on Pin COLA"]
pub type EPULL_W<'a, REG> = crate::BitWriter<'a, REG, EPULL_A>;
impl<'a, REG> EPULL_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "HW over-rule to enable internal pull-up is active on TSIN\\[x\\]
for set duration in touch-sense time slice. With this setting, it is not specified to assign the COLA to any pin."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(EPULL_A::VALUE1)
    }
    #[doc = "Enable external pull-up: Output 1 on pin COLA for whole duration of touch-sense time slice."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(EPULL_A::VALUE2)
    }
}
#[doc = "Field `FNCOL` reader - Previous Active Function/LED Column Status"]
pub type FNCOL_R = crate::FieldReader;
#[doc = "Accumulate Count on Touch-Sense Input\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ACCCNT_A {
    #[doc = "0: 1 time"]
    VALUE1 = 0,
    #[doc = "1: 2 times"]
    VALUE2 = 1,
    #[doc = "15: 16 times"]
    VALUE3 = 15,
}
impl From<ACCCNT_A> for u8 {
    #[inline(always)]
    fn from(variant: ACCCNT_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for ACCCNT_A {
    type Ux = u8;
}
impl crate::IsEnum for ACCCNT_A {}
#[doc = "Field `ACCCNT` reader - Accumulate Count on Touch-Sense Input"]
pub type ACCCNT_R = crate::FieldReader<ACCCNT_A>;
impl ACCCNT_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<ACCCNT_A> {
        match self.bits {
            0 => Some(ACCCNT_A::VALUE1),
            1 => Some(ACCCNT_A::VALUE2),
            15 => Some(ACCCNT_A::VALUE3),
            _ => None,
        }
    }
    #[doc = "1 time"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == ACCCNT_A::VALUE1
    }
    #[doc = "2 times"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == ACCCNT_A::VALUE2
    }
    #[doc = "16 times"]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == ACCCNT_A::VALUE3
    }
}
#[doc = "Field `ACCCNT` writer - Accumulate Count on Touch-Sense Input"]
pub type ACCCNT_W<'a, REG> = crate::FieldWriter<'a, REG, 4, ACCCNT_A>;
impl<'a, REG> ACCCNT_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "1 time"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(ACCCNT_A::VALUE1)
    }
    #[doc = "2 times"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(ACCCNT_A::VALUE2)
    }
    #[doc = "16 times"]
    #[inline(always)]
    pub fn value3(self) -> &'a mut crate::W<REG> {
        self.variant(ACCCNT_A::VALUE3)
    }
}
#[doc = "Common Compare Enable for Touch-Sense\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TSCCMP_A {
    #[doc = "0: Disable common compare for touch-sense"]
    VALUE1 = 0,
    #[doc = "1: Enable common compare for touch-sense"]
    VALUE2 = 1,
}
impl From<TSCCMP_A> for bool {
    #[inline(always)]
    fn from(variant: TSCCMP_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TSCCMP` reader - Common Compare Enable for Touch-Sense"]
pub type TSCCMP_R = crate::BitReader<TSCCMP_A>;
impl TSCCMP_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> TSCCMP_A {
        match self.bits {
            false => TSCCMP_A::VALUE1,
            true => TSCCMP_A::VALUE2,
        }
    }
    #[doc = "Disable common compare for touch-sense"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == TSCCMP_A::VALUE1
    }
    #[doc = "Enable common compare for touch-sense"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == TSCCMP_A::VALUE2
    }
}
#[doc = "Field `TSCCMP` writer - Common Compare Enable for Touch-Sense"]
pub type TSCCMP_W<'a, REG> = crate::BitWriter<'a, REG, TSCCMP_A>;
impl<'a, REG> TSCCMP_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable common compare for touch-sense"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(TSCCMP_A::VALUE1)
    }
    #[doc = "Enable common compare for touch-sense"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(TSCCMP_A::VALUE2)
    }
}
#[doc = "Extension for Touch-Sense Output for Pin-Low-Level\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TSOEXT_A {
    #[doc = "0: Extend by 1 ledts_clk"]
    VALUE1 = 0,
    #[doc = "1: Extend by 4 ledts_clk"]
    VALUE2 = 1,
    #[doc = "2: Extend by 8 ledts_clk"]
    VALUE3 = 2,
    #[doc = "3: Extend by 16 ledts_clk"]
    VALUE4 = 3,
}
impl From<TSOEXT_A> for u8 {
    #[inline(always)]
    fn from(variant: TSOEXT_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for TSOEXT_A {
    type Ux = u8;
}
impl crate::IsEnum for TSOEXT_A {}
#[doc = "Field `TSOEXT` reader - Extension for Touch-Sense Output for Pin-Low-Level"]
pub type TSOEXT_R = crate::FieldReader<TSOEXT_A>;
impl TSOEXT_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> TSOEXT_A {
        match self.bits {
            0 => TSOEXT_A::VALUE1,
            1 => TSOEXT_A::VALUE2,
            2 => TSOEXT_A::VALUE3,
            3 => TSOEXT_A::VALUE4,
            _ => unreachable!(),
        }
    }
    #[doc = "Extend by 1 ledts_clk"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == TSOEXT_A::VALUE1
    }
    #[doc = "Extend by 4 ledts_clk"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == TSOEXT_A::VALUE2
    }
    #[doc = "Extend by 8 ledts_clk"]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == TSOEXT_A::VALUE3
    }
    #[doc = "Extend by 16 ledts_clk"]
    #[inline(always)]
    pub fn is_value4(&self) -> bool {
        *self == TSOEXT_A::VALUE4
    }
}
#[doc = "Field `TSOEXT` writer - Extension for Touch-Sense Output for Pin-Low-Level"]
pub type TSOEXT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, TSOEXT_A, crate::Safe>;
impl<'a, REG> TSOEXT_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Extend by 1 ledts_clk"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(TSOEXT_A::VALUE1)
    }
    #[doc = "Extend by 4 ledts_clk"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(TSOEXT_A::VALUE2)
    }
    #[doc = "Extend by 8 ledts_clk"]
    #[inline(always)]
    pub fn value3(self) -> &'a mut crate::W<REG> {
        self.variant(TSOEXT_A::VALUE3)
    }
    #[doc = "Extend by 16 ledts_clk"]
    #[inline(always)]
    pub fn value4(self) -> &'a mut crate::W<REG> {
        self.variant(TSOEXT_A::VALUE4)
    }
}
#[doc = "TS-Counter Auto Reset\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TSCTRR_A {
    #[doc = "0: Disable TS-counter automatic reset"]
    VALUE1 = 0,
    #[doc = "1: Enable TS-counter automatic reset to 00H on the first pad turn of a new TSIN\\[x\\]. Triggered on compare match in time slice."]
    VALUE2 = 1,
}
impl From<TSCTRR_A> for bool {
    #[inline(always)]
    fn from(variant: TSCTRR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TSCTRR` reader - TS-Counter Auto Reset"]
pub type TSCTRR_R = crate::BitReader<TSCTRR_A>;
impl TSCTRR_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> TSCTRR_A {
        match self.bits {
            false => TSCTRR_A::VALUE1,
            true => TSCTRR_A::VALUE2,
        }
    }
    #[doc = "Disable TS-counter automatic reset"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == TSCTRR_A::VALUE1
    }
    #[doc = "Enable TS-counter automatic reset to 00H on the first pad turn of a new TSIN\\[x\\]. Triggered on compare match in time slice."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == TSCTRR_A::VALUE2
    }
}
#[doc = "Field `TSCTRR` writer - TS-Counter Auto Reset"]
pub type TSCTRR_W<'a, REG> = crate::BitWriter<'a, REG, TSCTRR_A>;
impl<'a, REG> TSCTRR_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable TS-counter automatic reset"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(TSCTRR_A::VALUE1)
    }
    #[doc = "Enable TS-counter automatic reset to 00H on the first pad turn of a new TSIN\\[x\\]. Triggered on compare match in time slice."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(TSCTRR_A::VALUE2)
    }
}
#[doc = "Saturation of TS-Counter\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TSCTRSAT_A {
    #[doc = "0: Disable"]
    VALUE1 = 0,
    #[doc = "1: Enable. TS-counter stops counting in the touch-sense time slice(s) of the same (extended) frame when it reaches FFH. Counter starts to count again on the first pad turn of a new TSIN\\[x\\], triggered on compare match."]
    VALUE2 = 1,
}
impl From<TSCTRSAT_A> for bool {
    #[inline(always)]
    fn from(variant: TSCTRSAT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TSCTRSAT` reader - Saturation of TS-Counter"]
pub type TSCTRSAT_R = crate::BitReader<TSCTRSAT_A>;
impl TSCTRSAT_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> TSCTRSAT_A {
        match self.bits {
            false => TSCTRSAT_A::VALUE1,
            true => TSCTRSAT_A::VALUE2,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == TSCTRSAT_A::VALUE1
    }
    #[doc = "Enable. TS-counter stops counting in the touch-sense time slice(s) of the same (extended) frame when it reaches FFH. Counter starts to count again on the first pad turn of a new TSIN\\[x\\], triggered on compare match."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == TSCTRSAT_A::VALUE2
    }
}
#[doc = "Field `TSCTRSAT` writer - Saturation of TS-Counter"]
pub type TSCTRSAT_W<'a, REG> = crate::BitWriter<'a, REG, TSCTRSAT_A>;
impl<'a, REG> TSCTRSAT_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(TSCTRSAT_A::VALUE1)
    }
    #[doc = "Enable. TS-counter stops counting in the touch-sense time slice(s) of the same (extended) frame when it reaches FFH. Counter starts to count again on the first pad turn of a new TSIN\\[x\\], triggered on compare match."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(TSCTRSAT_A::VALUE2)
    }
}
#[doc = "Number of Touch-Sense Input\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum NR_TSIN_A {
    #[doc = "0: 1"]
    VALUE1 = 0,
    #[doc = "7: 8"]
    VALUE2 = 7,
}
impl From<NR_TSIN_A> for u8 {
    #[inline(always)]
    fn from(variant: NR_TSIN_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for NR_TSIN_A {
    type Ux = u8;
}
impl crate::IsEnum for NR_TSIN_A {}
#[doc = "Field `NR_TSIN` reader - Number of Touch-Sense Input"]
pub type NR_TSIN_R = crate::FieldReader<NR_TSIN_A>;
impl NR_TSIN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<NR_TSIN_A> {
        match self.bits {
            0 => Some(NR_TSIN_A::VALUE1),
            7 => Some(NR_TSIN_A::VALUE2),
            _ => None,
        }
    }
    #[doc = "1"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == NR_TSIN_A::VALUE1
    }
    #[doc = "8"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == NR_TSIN_A::VALUE2
    }
}
#[doc = "Field `NR_TSIN` writer - Number of Touch-Sense Input"]
pub type NR_TSIN_W<'a, REG> = crate::FieldWriter<'a, REG, 3, NR_TSIN_A>;
impl<'a, REG> NR_TSIN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "1"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(NR_TSIN_A::VALUE1)
    }
    #[doc = "8"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(NR_TSIN_A::VALUE2)
    }
}
#[doc = "Active Level of LED Column\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COLLEV_A {
    #[doc = "0: Active low"]
    VALUE1 = 0,
    #[doc = "1: Active high"]
    VALUE2 = 1,
}
impl From<COLLEV_A> for bool {
    #[inline(always)]
    fn from(variant: COLLEV_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `COLLEV` reader - Active Level of LED Column"]
pub type COLLEV_R = crate::BitReader<COLLEV_A>;
impl COLLEV_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> COLLEV_A {
        match self.bits {
            false => COLLEV_A::VALUE1,
            true => COLLEV_A::VALUE2,
        }
    }
    #[doc = "Active low"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == COLLEV_A::VALUE1
    }
    #[doc = "Active high"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == COLLEV_A::VALUE2
    }
}
#[doc = "Field `COLLEV` writer - Active Level of LED Column"]
pub type COLLEV_W<'a, REG> = crate::BitWriter<'a, REG, COLLEV_A>;
impl<'a, REG> COLLEV_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Active low"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(COLLEV_A::VALUE1)
    }
    #[doc = "Active high"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(COLLEV_A::VALUE2)
    }
}
#[doc = "Number of LED Columns\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum NR_LEDCOL_A {
    #[doc = "0: 1 LED column"]
    VALUE1 = 0,
    #[doc = "1: 2 LED columns"]
    VALUE2 = 1,
    #[doc = "2: 3 LED columns"]
    VALUE3 = 2,
    #[doc = "3: 4 LED columns"]
    VALUE4 = 3,
    #[doc = "4: 5 LED columns"]
    VALUE5 = 4,
    #[doc = "5: 6 LED columns"]
    VALUE6 = 5,
    #[doc = "6: 7 LED columns"]
    VALUE7 = 6,
    #[doc = "7: 8 LED columns (max. LED columns = 7 if bit TS_EN = 1)"]
    VALUE8 = 7,
}
impl From<NR_LEDCOL_A> for u8 {
    #[inline(always)]
    fn from(variant: NR_LEDCOL_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for NR_LEDCOL_A {
    type Ux = u8;
}
impl crate::IsEnum for NR_LEDCOL_A {}
#[doc = "Field `NR_LEDCOL` reader - Number of LED Columns"]
pub type NR_LEDCOL_R = crate::FieldReader<NR_LEDCOL_A>;
impl NR_LEDCOL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> NR_LEDCOL_A {
        match self.bits {
            0 => NR_LEDCOL_A::VALUE1,
            1 => NR_LEDCOL_A::VALUE2,
            2 => NR_LEDCOL_A::VALUE3,
            3 => NR_LEDCOL_A::VALUE4,
            4 => NR_LEDCOL_A::VALUE5,
            5 => NR_LEDCOL_A::VALUE6,
            6 => NR_LEDCOL_A::VALUE7,
            7 => NR_LEDCOL_A::VALUE8,
            _ => unreachable!(),
        }
    }
    #[doc = "1 LED column"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE1
    }
    #[doc = "2 LED columns"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE2
    }
    #[doc = "3 LED columns"]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE3
    }
    #[doc = "4 LED columns"]
    #[inline(always)]
    pub fn is_value4(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE4
    }
    #[doc = "5 LED columns"]
    #[inline(always)]
    pub fn is_value5(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE5
    }
    #[doc = "6 LED columns"]
    #[inline(always)]
    pub fn is_value6(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE6
    }
    #[doc = "7 LED columns"]
    #[inline(always)]
    pub fn is_value7(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE7
    }
    #[doc = "8 LED columns (max. LED columns = 7 if bit TS_EN = 1)"]
    #[inline(always)]
    pub fn is_value8(&self) -> bool {
        *self == NR_LEDCOL_A::VALUE8
    }
}
#[doc = "Field `NR_LEDCOL` writer - Number of LED Columns"]
pub type NR_LEDCOL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, NR_LEDCOL_A, crate::Safe>;
impl<'a, REG> NR_LEDCOL_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "1 LED column"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE1)
    }
    #[doc = "2 LED columns"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE2)
    }
    #[doc = "3 LED columns"]
    #[inline(always)]
    pub fn value3(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE3)
    }
    #[doc = "4 LED columns"]
    #[inline(always)]
    pub fn value4(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE4)
    }
    #[doc = "5 LED columns"]
    #[inline(always)]
    pub fn value5(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE5)
    }
    #[doc = "6 LED columns"]
    #[inline(always)]
    pub fn value6(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE6)
    }
    #[doc = "7 LED columns"]
    #[inline(always)]
    pub fn value7(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE7)
    }
    #[doc = "8 LED columns (max. LED columns = 7 if bit TS_EN = 1)"]
    #[inline(always)]
    pub fn value8(self) -> &'a mut crate::W<REG> {
        self.variant(NR_LEDCOL_A::VALUE8)
    }
}
impl R {
    #[doc = "Bits 0:2 - Touch-Sense TSIN Pad Turn"]
    #[inline(always)]
    pub fn padt(&self) -> PADT_R {
        PADT_R::new((self.bits & 7) as u8)
    }
    #[doc = "Bit 3 - Software Control for Touch-Sense Pad Turn"]
    #[inline(always)]
    pub fn padtsw(&self) -> PADTSW_R {
        PADTSW_R::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Enable External Pull-up Configuration on Pin COLA"]
    #[inline(always)]
    pub fn epull(&self) -> EPULL_R {
        EPULL_R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bits 5:7 - Previous Active Function/LED Column Status"]
    #[inline(always)]
    pub fn fncol(&self) -> FNCOL_R {
        FNCOL_R::new(((self.bits >> 5) & 7) as u8)
    }
    #[doc = "Bits 16:19 - Accumulate Count on Touch-Sense Input"]
    #[inline(always)]
    pub fn acccnt(&self) -> ACCCNT_R {
        ACCCNT_R::new(((self.bits >> 16) & 0x0f) as u8)
    }
    #[doc = "Bit 20 - Common Compare Enable for Touch-Sense"]
    #[inline(always)]
    pub fn tsccmp(&self) -> TSCCMP_R {
        TSCCMP_R::new(((self.bits >> 20) & 1) != 0)
    }
    #[doc = "Bits 21:22 - Extension for Touch-Sense Output for Pin-Low-Level"]
    #[inline(always)]
    pub fn tsoext(&self) -> TSOEXT_R {
        TSOEXT_R::new(((self.bits >> 21) & 3) as u8)
    }
    #[doc = "Bit 23 - TS-Counter Auto Reset"]
    #[inline(always)]
    pub fn tsctrr(&self) -> TSCTRR_R {
        TSCTRR_R::new(((self.bits >> 23) & 1) != 0)
    }
    #[doc = "Bit 24 - Saturation of TS-Counter"]
    #[inline(always)]
    pub fn tsctrsat(&self) -> TSCTRSAT_R {
        TSCTRSAT_R::new(((self.bits >> 24) & 1) != 0)
    }
    #[doc = "Bits 25:27 - Number of Touch-Sense Input"]
    #[inline(always)]
    pub fn nr_tsin(&self) -> NR_TSIN_R {
        NR_TSIN_R::new(((self.bits >> 25) & 7) as u8)
    }
    #[doc = "Bit 28 - Active Level of LED Column"]
    #[inline(always)]
    pub fn collev(&self) -> COLLEV_R {
        COLLEV_R::new(((self.bits >> 28) & 1) != 0)
    }
    #[doc = "Bits 29:31 - Number of LED Columns"]
    #[inline(always)]
    pub fn nr_ledcol(&self) -> NR_LEDCOL_R {
        NR_LEDCOL_R::new(((self.bits >> 29) & 7) as u8)
    }
}
impl W {
    #[doc = "Bits 0:2 - Touch-Sense TSIN Pad Turn"]
    #[inline(always)]
    #[must_use]
    pub fn padt(&mut self) -> PADT_W<FNCTL_SPEC> {
        PADT_W::new(self, 0)
    }
    #[doc = "Bit 3 - Software Control for Touch-Sense Pad Turn"]
    #[inline(always)]
    #[must_use]
    pub fn padtsw(&mut self) -> PADTSW_W<FNCTL_SPEC> {
        PADTSW_W::new(self, 3)
    }
    #[doc = "Bit 4 - Enable External Pull-up Configuration on Pin COLA"]
    #[inline(always)]
    #[must_use]
    pub fn epull(&mut self) -> EPULL_W<FNCTL_SPEC> {
        EPULL_W::new(self, 4)
    }
    #[doc = "Bits 16:19 - Accumulate Count on Touch-Sense Input"]
    #[inline(always)]
    #[must_use]
    pub fn acccnt(&mut self) -> ACCCNT_W<FNCTL_SPEC> {
        ACCCNT_W::new(self, 16)
    }
    #[doc = "Bit 20 - Common Compare Enable for Touch-Sense"]
    #[inline(always)]
    #[must_use]
    pub fn tsccmp(&mut self) -> TSCCMP_W<FNCTL_SPEC> {
        TSCCMP_W::new(self, 20)
    }
    #[doc = "Bits 21:22 - Extension for Touch-Sense Output for Pin-Low-Level"]
    #[inline(always)]
    #[must_use]
    pub fn tsoext(&mut self) -> TSOEXT_W<FNCTL_SPEC> {
        TSOEXT_W::new(self, 21)
    }
    #[doc = "Bit 23 - TS-Counter Auto Reset"]
    #[inline(always)]
    #[must_use]
    pub fn tsctrr(&mut self) -> TSCTRR_W<FNCTL_SPEC> {
        TSCTRR_W::new(self, 23)
    }
    #[doc = "Bit 24 - Saturation of TS-Counter"]
    #[inline(always)]
    #[must_use]
    pub fn tsctrsat(&mut self) -> TSCTRSAT_W<FNCTL_SPEC> {
        TSCTRSAT_W::new(self, 24)
    }
    #[doc = "Bits 25:27 - Number of Touch-Sense Input"]
    #[inline(always)]
    #[must_use]
    pub fn nr_tsin(&mut self) -> NR_TSIN_W<FNCTL_SPEC> {
        NR_TSIN_W::new(self, 25)
    }
    #[doc = "Bit 28 - Active Level of LED Column"]
    #[inline(always)]
    #[must_use]
    pub fn collev(&mut self) -> COLLEV_W<FNCTL_SPEC> {
        COLLEV_W::new(self, 28)
    }
    #[doc = "Bits 29:31 - Number of LED Columns"]
    #[inline(always)]
    #[must_use]
    pub fn nr_ledcol(&mut self) -> NR_LEDCOL_W<FNCTL_SPEC> {
        NR_LEDCOL_W::new(self, 29)
    }
}
#[doc = "Function Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`fnctl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`fnctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct FNCTL_SPEC;
impl crate::RegisterSpec for FNCTL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [`fnctl::R`](R) reader structure"]
impl crate::Readable for FNCTL_SPEC {}
#[doc = "`write(|w| ..)` method takes [`fnctl::W`](W) writer structure"]
impl crate::Writable for FNCTL_SPEC {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets FNCTL to value 0"]
impl crate::Resettable for FNCTL_SPEC {
    const RESET_VALUE: u32 = 0;
}