xmc4800/ledts0/
fnctl.rs

1#[doc = "Register `FNCTL` reader"]
2pub type R = crate::R<FNCTL_SPEC>;
3#[doc = "Register `FNCTL` writer"]
4pub type W = crate::W<FNCTL_SPEC>;
5#[doc = "Touch-Sense TSIN Pad Turn\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum PADT_A {
9    #[doc = "0: TSIN0"]
10    VALUE1 = 0,
11    #[doc = "7: TSIN7"]
12    VALUE2 = 7,
13}
14impl From<PADT_A> for u8 {
15    #[inline(always)]
16    fn from(variant: PADT_A) -> Self {
17        variant as _
18    }
19}
20impl crate::FieldSpec for PADT_A {
21    type Ux = u8;
22}
23impl crate::IsEnum for PADT_A {}
24#[doc = "Field `PADT` reader - Touch-Sense TSIN Pad Turn"]
25pub type PADT_R = crate::FieldReader<PADT_A>;
26impl PADT_R {
27    #[doc = "Get enumerated values variant"]
28    #[inline(always)]
29    pub const fn variant(&self) -> Option<PADT_A> {
30        match self.bits {
31            0 => Some(PADT_A::VALUE1),
32            7 => Some(PADT_A::VALUE2),
33            _ => None,
34        }
35    }
36    #[doc = "TSIN0"]
37    #[inline(always)]
38    pub fn is_value1(&self) -> bool {
39        *self == PADT_A::VALUE1
40    }
41    #[doc = "TSIN7"]
42    #[inline(always)]
43    pub fn is_value2(&self) -> bool {
44        *self == PADT_A::VALUE2
45    }
46}
47#[doc = "Field `PADT` writer - Touch-Sense TSIN Pad Turn"]
48pub type PADT_W<'a, REG> = crate::FieldWriter<'a, REG, 3, PADT_A>;
49impl<'a, REG> PADT_W<'a, REG>
50where
51    REG: crate::Writable + crate::RegisterSpec,
52    REG::Ux: From<u8>,
53{
54    #[doc = "TSIN0"]
55    #[inline(always)]
56    pub fn value1(self) -> &'a mut crate::W<REG> {
57        self.variant(PADT_A::VALUE1)
58    }
59    #[doc = "TSIN7"]
60    #[inline(always)]
61    pub fn value2(self) -> &'a mut crate::W<REG> {
62        self.variant(PADT_A::VALUE2)
63    }
64}
65#[doc = "Software Control for Touch-Sense Pad Turn\n\nValue on reset: 0"]
66#[derive(Clone, Copy, Debug, PartialEq, Eq)]
67pub enum PADTSW_A {
68    #[doc = "0: The hardware automatically enables the touch-sense inputs in sequence round-robin, starting from TSIN0."]
69    VALUE1 = 0,
70    #[doc = "1: Disable hardware control for software control only. The touch-sense input is configured in bit PADT."]
71    VALUE2 = 1,
72}
73impl From<PADTSW_A> for bool {
74    #[inline(always)]
75    fn from(variant: PADTSW_A) -> Self {
76        variant as u8 != 0
77    }
78}
79#[doc = "Field `PADTSW` reader - Software Control for Touch-Sense Pad Turn"]
80pub type PADTSW_R = crate::BitReader<PADTSW_A>;
81impl PADTSW_R {
82    #[doc = "Get enumerated values variant"]
83    #[inline(always)]
84    pub const fn variant(&self) -> PADTSW_A {
85        match self.bits {
86            false => PADTSW_A::VALUE1,
87            true => PADTSW_A::VALUE2,
88        }
89    }
90    #[doc = "The hardware automatically enables the touch-sense inputs in sequence round-robin, starting from TSIN0."]
91    #[inline(always)]
92    pub fn is_value1(&self) -> bool {
93        *self == PADTSW_A::VALUE1
94    }
95    #[doc = "Disable hardware control for software control only. The touch-sense input is configured in bit PADT."]
96    #[inline(always)]
97    pub fn is_value2(&self) -> bool {
98        *self == PADTSW_A::VALUE2
99    }
100}
101#[doc = "Field `PADTSW` writer - Software Control for Touch-Sense Pad Turn"]
102pub type PADTSW_W<'a, REG> = crate::BitWriter<'a, REG, PADTSW_A>;
103impl<'a, REG> PADTSW_W<'a, REG>
104where
105    REG: crate::Writable + crate::RegisterSpec,
106{
107    #[doc = "The hardware automatically enables the touch-sense inputs in sequence round-robin, starting from TSIN0."]
108    #[inline(always)]
109    pub fn value1(self) -> &'a mut crate::W<REG> {
110        self.variant(PADTSW_A::VALUE1)
111    }
112    #[doc = "Disable hardware control for software control only. The touch-sense input is configured in bit PADT."]
113    #[inline(always)]
114    pub fn value2(self) -> &'a mut crate::W<REG> {
115        self.variant(PADTSW_A::VALUE2)
116    }
117}
118#[doc = "Enable External Pull-up Configuration on Pin COLA\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120pub enum EPULL_A {
121    #[doc = "0: HW over-rule to enable internal pull-up is active on TSIN\\[x\\]
122for set duration in touch-sense time slice. With this setting, it is not specified to assign the COLA to any pin."]
123    VALUE1 = 0,
124    #[doc = "1: Enable external pull-up: Output 1 on pin COLA for whole duration of touch-sense time slice."]
125    VALUE2 = 1,
126}
127impl From<EPULL_A> for bool {
128    #[inline(always)]
129    fn from(variant: EPULL_A) -> Self {
130        variant as u8 != 0
131    }
132}
133#[doc = "Field `EPULL` reader - Enable External Pull-up Configuration on Pin COLA"]
134pub type EPULL_R = crate::BitReader<EPULL_A>;
135impl EPULL_R {
136    #[doc = "Get enumerated values variant"]
137    #[inline(always)]
138    pub const fn variant(&self) -> EPULL_A {
139        match self.bits {
140            false => EPULL_A::VALUE1,
141            true => EPULL_A::VALUE2,
142        }
143    }
144    #[doc = "HW over-rule to enable internal pull-up is active on TSIN\\[x\\]
145for set duration in touch-sense time slice. With this setting, it is not specified to assign the COLA to any pin."]
146    #[inline(always)]
147    pub fn is_value1(&self) -> bool {
148        *self == EPULL_A::VALUE1
149    }
150    #[doc = "Enable external pull-up: Output 1 on pin COLA for whole duration of touch-sense time slice."]
151    #[inline(always)]
152    pub fn is_value2(&self) -> bool {
153        *self == EPULL_A::VALUE2
154    }
155}
156#[doc = "Field `EPULL` writer - Enable External Pull-up Configuration on Pin COLA"]
157pub type EPULL_W<'a, REG> = crate::BitWriter<'a, REG, EPULL_A>;
158impl<'a, REG> EPULL_W<'a, REG>
159where
160    REG: crate::Writable + crate::RegisterSpec,
161{
162    #[doc = "HW over-rule to enable internal pull-up is active on TSIN\\[x\\]
163for set duration in touch-sense time slice. With this setting, it is not specified to assign the COLA to any pin."]
164    #[inline(always)]
165    pub fn value1(self) -> &'a mut crate::W<REG> {
166        self.variant(EPULL_A::VALUE1)
167    }
168    #[doc = "Enable external pull-up: Output 1 on pin COLA for whole duration of touch-sense time slice."]
169    #[inline(always)]
170    pub fn value2(self) -> &'a mut crate::W<REG> {
171        self.variant(EPULL_A::VALUE2)
172    }
173}
174#[doc = "Field `FNCOL` reader - Previous Active Function/LED Column Status"]
175pub type FNCOL_R = crate::FieldReader;
176#[doc = "Accumulate Count on Touch-Sense Input\n\nValue on reset: 0"]
177#[derive(Clone, Copy, Debug, PartialEq, Eq)]
178#[repr(u8)]
179pub enum ACCCNT_A {
180    #[doc = "0: 1 time"]
181    VALUE1 = 0,
182    #[doc = "1: 2 times"]
183    VALUE2 = 1,
184    #[doc = "15: 16 times"]
185    VALUE3 = 15,
186}
187impl From<ACCCNT_A> for u8 {
188    #[inline(always)]
189    fn from(variant: ACCCNT_A) -> Self {
190        variant as _
191    }
192}
193impl crate::FieldSpec for ACCCNT_A {
194    type Ux = u8;
195}
196impl crate::IsEnum for ACCCNT_A {}
197#[doc = "Field `ACCCNT` reader - Accumulate Count on Touch-Sense Input"]
198pub type ACCCNT_R = crate::FieldReader<ACCCNT_A>;
199impl ACCCNT_R {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> Option<ACCCNT_A> {
203        match self.bits {
204            0 => Some(ACCCNT_A::VALUE1),
205            1 => Some(ACCCNT_A::VALUE2),
206            15 => Some(ACCCNT_A::VALUE3),
207            _ => None,
208        }
209    }
210    #[doc = "1 time"]
211    #[inline(always)]
212    pub fn is_value1(&self) -> bool {
213        *self == ACCCNT_A::VALUE1
214    }
215    #[doc = "2 times"]
216    #[inline(always)]
217    pub fn is_value2(&self) -> bool {
218        *self == ACCCNT_A::VALUE2
219    }
220    #[doc = "16 times"]
221    #[inline(always)]
222    pub fn is_value3(&self) -> bool {
223        *self == ACCCNT_A::VALUE3
224    }
225}
226#[doc = "Field `ACCCNT` writer - Accumulate Count on Touch-Sense Input"]
227pub type ACCCNT_W<'a, REG> = crate::FieldWriter<'a, REG, 4, ACCCNT_A>;
228impl<'a, REG> ACCCNT_W<'a, REG>
229where
230    REG: crate::Writable + crate::RegisterSpec,
231    REG::Ux: From<u8>,
232{
233    #[doc = "1 time"]
234    #[inline(always)]
235    pub fn value1(self) -> &'a mut crate::W<REG> {
236        self.variant(ACCCNT_A::VALUE1)
237    }
238    #[doc = "2 times"]
239    #[inline(always)]
240    pub fn value2(self) -> &'a mut crate::W<REG> {
241        self.variant(ACCCNT_A::VALUE2)
242    }
243    #[doc = "16 times"]
244    #[inline(always)]
245    pub fn value3(self) -> &'a mut crate::W<REG> {
246        self.variant(ACCCNT_A::VALUE3)
247    }
248}
249#[doc = "Common Compare Enable for Touch-Sense\n\nValue on reset: 0"]
250#[derive(Clone, Copy, Debug, PartialEq, Eq)]
251pub enum TSCCMP_A {
252    #[doc = "0: Disable common compare for touch-sense"]
253    VALUE1 = 0,
254    #[doc = "1: Enable common compare for touch-sense"]
255    VALUE2 = 1,
256}
257impl From<TSCCMP_A> for bool {
258    #[inline(always)]
259    fn from(variant: TSCCMP_A) -> Self {
260        variant as u8 != 0
261    }
262}
263#[doc = "Field `TSCCMP` reader - Common Compare Enable for Touch-Sense"]
264pub type TSCCMP_R = crate::BitReader<TSCCMP_A>;
265impl TSCCMP_R {
266    #[doc = "Get enumerated values variant"]
267    #[inline(always)]
268    pub const fn variant(&self) -> TSCCMP_A {
269        match self.bits {
270            false => TSCCMP_A::VALUE1,
271            true => TSCCMP_A::VALUE2,
272        }
273    }
274    #[doc = "Disable common compare for touch-sense"]
275    #[inline(always)]
276    pub fn is_value1(&self) -> bool {
277        *self == TSCCMP_A::VALUE1
278    }
279    #[doc = "Enable common compare for touch-sense"]
280    #[inline(always)]
281    pub fn is_value2(&self) -> bool {
282        *self == TSCCMP_A::VALUE2
283    }
284}
285#[doc = "Field `TSCCMP` writer - Common Compare Enable for Touch-Sense"]
286pub type TSCCMP_W<'a, REG> = crate::BitWriter<'a, REG, TSCCMP_A>;
287impl<'a, REG> TSCCMP_W<'a, REG>
288where
289    REG: crate::Writable + crate::RegisterSpec,
290{
291    #[doc = "Disable common compare for touch-sense"]
292    #[inline(always)]
293    pub fn value1(self) -> &'a mut crate::W<REG> {
294        self.variant(TSCCMP_A::VALUE1)
295    }
296    #[doc = "Enable common compare for touch-sense"]
297    #[inline(always)]
298    pub fn value2(self) -> &'a mut crate::W<REG> {
299        self.variant(TSCCMP_A::VALUE2)
300    }
301}
302#[doc = "Extension for Touch-Sense Output for Pin-Low-Level\n\nValue on reset: 0"]
303#[derive(Clone, Copy, Debug, PartialEq, Eq)]
304#[repr(u8)]
305pub enum TSOEXT_A {
306    #[doc = "0: Extend by 1 ledts_clk"]
307    VALUE1 = 0,
308    #[doc = "1: Extend by 4 ledts_clk"]
309    VALUE2 = 1,
310    #[doc = "2: Extend by 8 ledts_clk"]
311    VALUE3 = 2,
312    #[doc = "3: Extend by 16 ledts_clk"]
313    VALUE4 = 3,
314}
315impl From<TSOEXT_A> for u8 {
316    #[inline(always)]
317    fn from(variant: TSOEXT_A) -> Self {
318        variant as _
319    }
320}
321impl crate::FieldSpec for TSOEXT_A {
322    type Ux = u8;
323}
324impl crate::IsEnum for TSOEXT_A {}
325#[doc = "Field `TSOEXT` reader - Extension for Touch-Sense Output for Pin-Low-Level"]
326pub type TSOEXT_R = crate::FieldReader<TSOEXT_A>;
327impl TSOEXT_R {
328    #[doc = "Get enumerated values variant"]
329    #[inline(always)]
330    pub const fn variant(&self) -> TSOEXT_A {
331        match self.bits {
332            0 => TSOEXT_A::VALUE1,
333            1 => TSOEXT_A::VALUE2,
334            2 => TSOEXT_A::VALUE3,
335            3 => TSOEXT_A::VALUE4,
336            _ => unreachable!(),
337        }
338    }
339    #[doc = "Extend by 1 ledts_clk"]
340    #[inline(always)]
341    pub fn is_value1(&self) -> bool {
342        *self == TSOEXT_A::VALUE1
343    }
344    #[doc = "Extend by 4 ledts_clk"]
345    #[inline(always)]
346    pub fn is_value2(&self) -> bool {
347        *self == TSOEXT_A::VALUE2
348    }
349    #[doc = "Extend by 8 ledts_clk"]
350    #[inline(always)]
351    pub fn is_value3(&self) -> bool {
352        *self == TSOEXT_A::VALUE3
353    }
354    #[doc = "Extend by 16 ledts_clk"]
355    #[inline(always)]
356    pub fn is_value4(&self) -> bool {
357        *self == TSOEXT_A::VALUE4
358    }
359}
360#[doc = "Field `TSOEXT` writer - Extension for Touch-Sense Output for Pin-Low-Level"]
361pub type TSOEXT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, TSOEXT_A, crate::Safe>;
362impl<'a, REG> TSOEXT_W<'a, REG>
363where
364    REG: crate::Writable + crate::RegisterSpec,
365    REG::Ux: From<u8>,
366{
367    #[doc = "Extend by 1 ledts_clk"]
368    #[inline(always)]
369    pub fn value1(self) -> &'a mut crate::W<REG> {
370        self.variant(TSOEXT_A::VALUE1)
371    }
372    #[doc = "Extend by 4 ledts_clk"]
373    #[inline(always)]
374    pub fn value2(self) -> &'a mut crate::W<REG> {
375        self.variant(TSOEXT_A::VALUE2)
376    }
377    #[doc = "Extend by 8 ledts_clk"]
378    #[inline(always)]
379    pub fn value3(self) -> &'a mut crate::W<REG> {
380        self.variant(TSOEXT_A::VALUE3)
381    }
382    #[doc = "Extend by 16 ledts_clk"]
383    #[inline(always)]
384    pub fn value4(self) -> &'a mut crate::W<REG> {
385        self.variant(TSOEXT_A::VALUE4)
386    }
387}
388#[doc = "TS-Counter Auto Reset\n\nValue on reset: 0"]
389#[derive(Clone, Copy, Debug, PartialEq, Eq)]
390pub enum TSCTRR_A {
391    #[doc = "0: Disable TS-counter automatic reset"]
392    VALUE1 = 0,
393    #[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."]
394    VALUE2 = 1,
395}
396impl From<TSCTRR_A> for bool {
397    #[inline(always)]
398    fn from(variant: TSCTRR_A) -> Self {
399        variant as u8 != 0
400    }
401}
402#[doc = "Field `TSCTRR` reader - TS-Counter Auto Reset"]
403pub type TSCTRR_R = crate::BitReader<TSCTRR_A>;
404impl TSCTRR_R {
405    #[doc = "Get enumerated values variant"]
406    #[inline(always)]
407    pub const fn variant(&self) -> TSCTRR_A {
408        match self.bits {
409            false => TSCTRR_A::VALUE1,
410            true => TSCTRR_A::VALUE2,
411        }
412    }
413    #[doc = "Disable TS-counter automatic reset"]
414    #[inline(always)]
415    pub fn is_value1(&self) -> bool {
416        *self == TSCTRR_A::VALUE1
417    }
418    #[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."]
419    #[inline(always)]
420    pub fn is_value2(&self) -> bool {
421        *self == TSCTRR_A::VALUE2
422    }
423}
424#[doc = "Field `TSCTRR` writer - TS-Counter Auto Reset"]
425pub type TSCTRR_W<'a, REG> = crate::BitWriter<'a, REG, TSCTRR_A>;
426impl<'a, REG> TSCTRR_W<'a, REG>
427where
428    REG: crate::Writable + crate::RegisterSpec,
429{
430    #[doc = "Disable TS-counter automatic reset"]
431    #[inline(always)]
432    pub fn value1(self) -> &'a mut crate::W<REG> {
433        self.variant(TSCTRR_A::VALUE1)
434    }
435    #[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."]
436    #[inline(always)]
437    pub fn value2(self) -> &'a mut crate::W<REG> {
438        self.variant(TSCTRR_A::VALUE2)
439    }
440}
441#[doc = "Saturation of TS-Counter\n\nValue on reset: 0"]
442#[derive(Clone, Copy, Debug, PartialEq, Eq)]
443pub enum TSCTRSAT_A {
444    #[doc = "0: Disable"]
445    VALUE1 = 0,
446    #[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."]
447    VALUE2 = 1,
448}
449impl From<TSCTRSAT_A> for bool {
450    #[inline(always)]
451    fn from(variant: TSCTRSAT_A) -> Self {
452        variant as u8 != 0
453    }
454}
455#[doc = "Field `TSCTRSAT` reader - Saturation of TS-Counter"]
456pub type TSCTRSAT_R = crate::BitReader<TSCTRSAT_A>;
457impl TSCTRSAT_R {
458    #[doc = "Get enumerated values variant"]
459    #[inline(always)]
460    pub const fn variant(&self) -> TSCTRSAT_A {
461        match self.bits {
462            false => TSCTRSAT_A::VALUE1,
463            true => TSCTRSAT_A::VALUE2,
464        }
465    }
466    #[doc = "Disable"]
467    #[inline(always)]
468    pub fn is_value1(&self) -> bool {
469        *self == TSCTRSAT_A::VALUE1
470    }
471    #[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."]
472    #[inline(always)]
473    pub fn is_value2(&self) -> bool {
474        *self == TSCTRSAT_A::VALUE2
475    }
476}
477#[doc = "Field `TSCTRSAT` writer - Saturation of TS-Counter"]
478pub type TSCTRSAT_W<'a, REG> = crate::BitWriter<'a, REG, TSCTRSAT_A>;
479impl<'a, REG> TSCTRSAT_W<'a, REG>
480where
481    REG: crate::Writable + crate::RegisterSpec,
482{
483    #[doc = "Disable"]
484    #[inline(always)]
485    pub fn value1(self) -> &'a mut crate::W<REG> {
486        self.variant(TSCTRSAT_A::VALUE1)
487    }
488    #[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."]
489    #[inline(always)]
490    pub fn value2(self) -> &'a mut crate::W<REG> {
491        self.variant(TSCTRSAT_A::VALUE2)
492    }
493}
494#[doc = "Number of Touch-Sense Input\n\nValue on reset: 0"]
495#[derive(Clone, Copy, Debug, PartialEq, Eq)]
496#[repr(u8)]
497pub enum NR_TSIN_A {
498    #[doc = "0: 1"]
499    VALUE1 = 0,
500    #[doc = "7: 8"]
501    VALUE2 = 7,
502}
503impl From<NR_TSIN_A> for u8 {
504    #[inline(always)]
505    fn from(variant: NR_TSIN_A) -> Self {
506        variant as _
507    }
508}
509impl crate::FieldSpec for NR_TSIN_A {
510    type Ux = u8;
511}
512impl crate::IsEnum for NR_TSIN_A {}
513#[doc = "Field `NR_TSIN` reader - Number of Touch-Sense Input"]
514pub type NR_TSIN_R = crate::FieldReader<NR_TSIN_A>;
515impl NR_TSIN_R {
516    #[doc = "Get enumerated values variant"]
517    #[inline(always)]
518    pub const fn variant(&self) -> Option<NR_TSIN_A> {
519        match self.bits {
520            0 => Some(NR_TSIN_A::VALUE1),
521            7 => Some(NR_TSIN_A::VALUE2),
522            _ => None,
523        }
524    }
525    #[doc = "1"]
526    #[inline(always)]
527    pub fn is_value1(&self) -> bool {
528        *self == NR_TSIN_A::VALUE1
529    }
530    #[doc = "8"]
531    #[inline(always)]
532    pub fn is_value2(&self) -> bool {
533        *self == NR_TSIN_A::VALUE2
534    }
535}
536#[doc = "Field `NR_TSIN` writer - Number of Touch-Sense Input"]
537pub type NR_TSIN_W<'a, REG> = crate::FieldWriter<'a, REG, 3, NR_TSIN_A>;
538impl<'a, REG> NR_TSIN_W<'a, REG>
539where
540    REG: crate::Writable + crate::RegisterSpec,
541    REG::Ux: From<u8>,
542{
543    #[doc = "1"]
544    #[inline(always)]
545    pub fn value1(self) -> &'a mut crate::W<REG> {
546        self.variant(NR_TSIN_A::VALUE1)
547    }
548    #[doc = "8"]
549    #[inline(always)]
550    pub fn value2(self) -> &'a mut crate::W<REG> {
551        self.variant(NR_TSIN_A::VALUE2)
552    }
553}
554#[doc = "Active Level of LED Column\n\nValue on reset: 0"]
555#[derive(Clone, Copy, Debug, PartialEq, Eq)]
556pub enum COLLEV_A {
557    #[doc = "0: Active low"]
558    VALUE1 = 0,
559    #[doc = "1: Active high"]
560    VALUE2 = 1,
561}
562impl From<COLLEV_A> for bool {
563    #[inline(always)]
564    fn from(variant: COLLEV_A) -> Self {
565        variant as u8 != 0
566    }
567}
568#[doc = "Field `COLLEV` reader - Active Level of LED Column"]
569pub type COLLEV_R = crate::BitReader<COLLEV_A>;
570impl COLLEV_R {
571    #[doc = "Get enumerated values variant"]
572    #[inline(always)]
573    pub const fn variant(&self) -> COLLEV_A {
574        match self.bits {
575            false => COLLEV_A::VALUE1,
576            true => COLLEV_A::VALUE2,
577        }
578    }
579    #[doc = "Active low"]
580    #[inline(always)]
581    pub fn is_value1(&self) -> bool {
582        *self == COLLEV_A::VALUE1
583    }
584    #[doc = "Active high"]
585    #[inline(always)]
586    pub fn is_value2(&self) -> bool {
587        *self == COLLEV_A::VALUE2
588    }
589}
590#[doc = "Field `COLLEV` writer - Active Level of LED Column"]
591pub type COLLEV_W<'a, REG> = crate::BitWriter<'a, REG, COLLEV_A>;
592impl<'a, REG> COLLEV_W<'a, REG>
593where
594    REG: crate::Writable + crate::RegisterSpec,
595{
596    #[doc = "Active low"]
597    #[inline(always)]
598    pub fn value1(self) -> &'a mut crate::W<REG> {
599        self.variant(COLLEV_A::VALUE1)
600    }
601    #[doc = "Active high"]
602    #[inline(always)]
603    pub fn value2(self) -> &'a mut crate::W<REG> {
604        self.variant(COLLEV_A::VALUE2)
605    }
606}
607#[doc = "Number of LED Columns\n\nValue on reset: 0"]
608#[derive(Clone, Copy, Debug, PartialEq, Eq)]
609#[repr(u8)]
610pub enum NR_LEDCOL_A {
611    #[doc = "0: 1 LED column"]
612    VALUE1 = 0,
613    #[doc = "1: 2 LED columns"]
614    VALUE2 = 1,
615    #[doc = "2: 3 LED columns"]
616    VALUE3 = 2,
617    #[doc = "3: 4 LED columns"]
618    VALUE4 = 3,
619    #[doc = "4: 5 LED columns"]
620    VALUE5 = 4,
621    #[doc = "5: 6 LED columns"]
622    VALUE6 = 5,
623    #[doc = "6: 7 LED columns"]
624    VALUE7 = 6,
625    #[doc = "7: 8 LED columns (max. LED columns = 7 if bit TS_EN = 1)"]
626    VALUE8 = 7,
627}
628impl From<NR_LEDCOL_A> for u8 {
629    #[inline(always)]
630    fn from(variant: NR_LEDCOL_A) -> Self {
631        variant as _
632    }
633}
634impl crate::FieldSpec for NR_LEDCOL_A {
635    type Ux = u8;
636}
637impl crate::IsEnum for NR_LEDCOL_A {}
638#[doc = "Field `NR_LEDCOL` reader - Number of LED Columns"]
639pub type NR_LEDCOL_R = crate::FieldReader<NR_LEDCOL_A>;
640impl NR_LEDCOL_R {
641    #[doc = "Get enumerated values variant"]
642    #[inline(always)]
643    pub const fn variant(&self) -> NR_LEDCOL_A {
644        match self.bits {
645            0 => NR_LEDCOL_A::VALUE1,
646            1 => NR_LEDCOL_A::VALUE2,
647            2 => NR_LEDCOL_A::VALUE3,
648            3 => NR_LEDCOL_A::VALUE4,
649            4 => NR_LEDCOL_A::VALUE5,
650            5 => NR_LEDCOL_A::VALUE6,
651            6 => NR_LEDCOL_A::VALUE7,
652            7 => NR_LEDCOL_A::VALUE8,
653            _ => unreachable!(),
654        }
655    }
656    #[doc = "1 LED column"]
657    #[inline(always)]
658    pub fn is_value1(&self) -> bool {
659        *self == NR_LEDCOL_A::VALUE1
660    }
661    #[doc = "2 LED columns"]
662    #[inline(always)]
663    pub fn is_value2(&self) -> bool {
664        *self == NR_LEDCOL_A::VALUE2
665    }
666    #[doc = "3 LED columns"]
667    #[inline(always)]
668    pub fn is_value3(&self) -> bool {
669        *self == NR_LEDCOL_A::VALUE3
670    }
671    #[doc = "4 LED columns"]
672    #[inline(always)]
673    pub fn is_value4(&self) -> bool {
674        *self == NR_LEDCOL_A::VALUE4
675    }
676    #[doc = "5 LED columns"]
677    #[inline(always)]
678    pub fn is_value5(&self) -> bool {
679        *self == NR_LEDCOL_A::VALUE5
680    }
681    #[doc = "6 LED columns"]
682    #[inline(always)]
683    pub fn is_value6(&self) -> bool {
684        *self == NR_LEDCOL_A::VALUE6
685    }
686    #[doc = "7 LED columns"]
687    #[inline(always)]
688    pub fn is_value7(&self) -> bool {
689        *self == NR_LEDCOL_A::VALUE7
690    }
691    #[doc = "8 LED columns (max. LED columns = 7 if bit TS_EN = 1)"]
692    #[inline(always)]
693    pub fn is_value8(&self) -> bool {
694        *self == NR_LEDCOL_A::VALUE8
695    }
696}
697#[doc = "Field `NR_LEDCOL` writer - Number of LED Columns"]
698pub type NR_LEDCOL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, NR_LEDCOL_A, crate::Safe>;
699impl<'a, REG> NR_LEDCOL_W<'a, REG>
700where
701    REG: crate::Writable + crate::RegisterSpec,
702    REG::Ux: From<u8>,
703{
704    #[doc = "1 LED column"]
705    #[inline(always)]
706    pub fn value1(self) -> &'a mut crate::W<REG> {
707        self.variant(NR_LEDCOL_A::VALUE1)
708    }
709    #[doc = "2 LED columns"]
710    #[inline(always)]
711    pub fn value2(self) -> &'a mut crate::W<REG> {
712        self.variant(NR_LEDCOL_A::VALUE2)
713    }
714    #[doc = "3 LED columns"]
715    #[inline(always)]
716    pub fn value3(self) -> &'a mut crate::W<REG> {
717        self.variant(NR_LEDCOL_A::VALUE3)
718    }
719    #[doc = "4 LED columns"]
720    #[inline(always)]
721    pub fn value4(self) -> &'a mut crate::W<REG> {
722        self.variant(NR_LEDCOL_A::VALUE4)
723    }
724    #[doc = "5 LED columns"]
725    #[inline(always)]
726    pub fn value5(self) -> &'a mut crate::W<REG> {
727        self.variant(NR_LEDCOL_A::VALUE5)
728    }
729    #[doc = "6 LED columns"]
730    #[inline(always)]
731    pub fn value6(self) -> &'a mut crate::W<REG> {
732        self.variant(NR_LEDCOL_A::VALUE6)
733    }
734    #[doc = "7 LED columns"]
735    #[inline(always)]
736    pub fn value7(self) -> &'a mut crate::W<REG> {
737        self.variant(NR_LEDCOL_A::VALUE7)
738    }
739    #[doc = "8 LED columns (max. LED columns = 7 if bit TS_EN = 1)"]
740    #[inline(always)]
741    pub fn value8(self) -> &'a mut crate::W<REG> {
742        self.variant(NR_LEDCOL_A::VALUE8)
743    }
744}
745impl R {
746    #[doc = "Bits 0:2 - Touch-Sense TSIN Pad Turn"]
747    #[inline(always)]
748    pub fn padt(&self) -> PADT_R {
749        PADT_R::new((self.bits & 7) as u8)
750    }
751    #[doc = "Bit 3 - Software Control for Touch-Sense Pad Turn"]
752    #[inline(always)]
753    pub fn padtsw(&self) -> PADTSW_R {
754        PADTSW_R::new(((self.bits >> 3) & 1) != 0)
755    }
756    #[doc = "Bit 4 - Enable External Pull-up Configuration on Pin COLA"]
757    #[inline(always)]
758    pub fn epull(&self) -> EPULL_R {
759        EPULL_R::new(((self.bits >> 4) & 1) != 0)
760    }
761    #[doc = "Bits 5:7 - Previous Active Function/LED Column Status"]
762    #[inline(always)]
763    pub fn fncol(&self) -> FNCOL_R {
764        FNCOL_R::new(((self.bits >> 5) & 7) as u8)
765    }
766    #[doc = "Bits 16:19 - Accumulate Count on Touch-Sense Input"]
767    #[inline(always)]
768    pub fn acccnt(&self) -> ACCCNT_R {
769        ACCCNT_R::new(((self.bits >> 16) & 0x0f) as u8)
770    }
771    #[doc = "Bit 20 - Common Compare Enable for Touch-Sense"]
772    #[inline(always)]
773    pub fn tsccmp(&self) -> TSCCMP_R {
774        TSCCMP_R::new(((self.bits >> 20) & 1) != 0)
775    }
776    #[doc = "Bits 21:22 - Extension for Touch-Sense Output for Pin-Low-Level"]
777    #[inline(always)]
778    pub fn tsoext(&self) -> TSOEXT_R {
779        TSOEXT_R::new(((self.bits >> 21) & 3) as u8)
780    }
781    #[doc = "Bit 23 - TS-Counter Auto Reset"]
782    #[inline(always)]
783    pub fn tsctrr(&self) -> TSCTRR_R {
784        TSCTRR_R::new(((self.bits >> 23) & 1) != 0)
785    }
786    #[doc = "Bit 24 - Saturation of TS-Counter"]
787    #[inline(always)]
788    pub fn tsctrsat(&self) -> TSCTRSAT_R {
789        TSCTRSAT_R::new(((self.bits >> 24) & 1) != 0)
790    }
791    #[doc = "Bits 25:27 - Number of Touch-Sense Input"]
792    #[inline(always)]
793    pub fn nr_tsin(&self) -> NR_TSIN_R {
794        NR_TSIN_R::new(((self.bits >> 25) & 7) as u8)
795    }
796    #[doc = "Bit 28 - Active Level of LED Column"]
797    #[inline(always)]
798    pub fn collev(&self) -> COLLEV_R {
799        COLLEV_R::new(((self.bits >> 28) & 1) != 0)
800    }
801    #[doc = "Bits 29:31 - Number of LED Columns"]
802    #[inline(always)]
803    pub fn nr_ledcol(&self) -> NR_LEDCOL_R {
804        NR_LEDCOL_R::new(((self.bits >> 29) & 7) as u8)
805    }
806}
807impl W {
808    #[doc = "Bits 0:2 - Touch-Sense TSIN Pad Turn"]
809    #[inline(always)]
810    pub fn padt(&mut self) -> PADT_W<FNCTL_SPEC> {
811        PADT_W::new(self, 0)
812    }
813    #[doc = "Bit 3 - Software Control for Touch-Sense Pad Turn"]
814    #[inline(always)]
815    pub fn padtsw(&mut self) -> PADTSW_W<FNCTL_SPEC> {
816        PADTSW_W::new(self, 3)
817    }
818    #[doc = "Bit 4 - Enable External Pull-up Configuration on Pin COLA"]
819    #[inline(always)]
820    pub fn epull(&mut self) -> EPULL_W<FNCTL_SPEC> {
821        EPULL_W::new(self, 4)
822    }
823    #[doc = "Bits 16:19 - Accumulate Count on Touch-Sense Input"]
824    #[inline(always)]
825    pub fn acccnt(&mut self) -> ACCCNT_W<FNCTL_SPEC> {
826        ACCCNT_W::new(self, 16)
827    }
828    #[doc = "Bit 20 - Common Compare Enable for Touch-Sense"]
829    #[inline(always)]
830    pub fn tsccmp(&mut self) -> TSCCMP_W<FNCTL_SPEC> {
831        TSCCMP_W::new(self, 20)
832    }
833    #[doc = "Bits 21:22 - Extension for Touch-Sense Output for Pin-Low-Level"]
834    #[inline(always)]
835    pub fn tsoext(&mut self) -> TSOEXT_W<FNCTL_SPEC> {
836        TSOEXT_W::new(self, 21)
837    }
838    #[doc = "Bit 23 - TS-Counter Auto Reset"]
839    #[inline(always)]
840    pub fn tsctrr(&mut self) -> TSCTRR_W<FNCTL_SPEC> {
841        TSCTRR_W::new(self, 23)
842    }
843    #[doc = "Bit 24 - Saturation of TS-Counter"]
844    #[inline(always)]
845    pub fn tsctrsat(&mut self) -> TSCTRSAT_W<FNCTL_SPEC> {
846        TSCTRSAT_W::new(self, 24)
847    }
848    #[doc = "Bits 25:27 - Number of Touch-Sense Input"]
849    #[inline(always)]
850    pub fn nr_tsin(&mut self) -> NR_TSIN_W<FNCTL_SPEC> {
851        NR_TSIN_W::new(self, 25)
852    }
853    #[doc = "Bit 28 - Active Level of LED Column"]
854    #[inline(always)]
855    pub fn collev(&mut self) -> COLLEV_W<FNCTL_SPEC> {
856        COLLEV_W::new(self, 28)
857    }
858    #[doc = "Bits 29:31 - Number of LED Columns"]
859    #[inline(always)]
860    pub fn nr_ledcol(&mut self) -> NR_LEDCOL_W<FNCTL_SPEC> {
861        NR_LEDCOL_W::new(self, 29)
862    }
863}
864#[doc = "Function Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`fnctl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fnctl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
865pub struct FNCTL_SPEC;
866impl crate::RegisterSpec for FNCTL_SPEC {
867    type Ux = u32;
868}
869#[doc = "`read()` method returns [`fnctl::R`](R) reader structure"]
870impl crate::Readable for FNCTL_SPEC {}
871#[doc = "`write(|w| ..)` method takes [`fnctl::W`](W) writer structure"]
872impl crate::Writable for FNCTL_SPEC {
873    type Safety = crate::Unsafe;
874    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
875    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
876}
877#[doc = "`reset()` method sets FNCTL to value 0"]
878impl crate::Resettable for FNCTL_SPEC {
879    const RESET_VALUE: u32 = 0;
880}