efm32gg11b310_pac/timer0/
cc2_ctrl.rs

1#[doc = "Register `CC2_CTRL` reader"]
2pub struct R(crate::R<CC2_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CC2_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CC2_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CC2_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CC2_CTRL` writer"]
17pub struct W(crate::W<CC2_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CC2_CTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CC2_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CC2_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "CC Channel Mode\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum MODE_A {
41    #[doc = "0: Compare/Capture channel turned off"]
42    OFF = 0,
43    #[doc = "1: Input capture"]
44    INPUTCAPTURE = 1,
45    #[doc = "2: Output compare"]
46    OUTPUTCOMPARE = 2,
47    #[doc = "3: Pulse-Width Modulation"]
48    PWM = 3,
49}
50impl From<MODE_A> for u8 {
51    #[inline(always)]
52    fn from(variant: MODE_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Field `MODE` reader - CC Channel Mode"]
57pub type MODE_R = crate::FieldReader<u8, MODE_A>;
58impl MODE_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> MODE_A {
62        match self.bits {
63            0 => MODE_A::OFF,
64            1 => MODE_A::INPUTCAPTURE,
65            2 => MODE_A::OUTPUTCOMPARE,
66            3 => MODE_A::PWM,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `OFF`"]
71    #[inline(always)]
72    pub fn is_off(&self) -> bool {
73        *self == MODE_A::OFF
74    }
75    #[doc = "Checks if the value of the field is `INPUTCAPTURE`"]
76    #[inline(always)]
77    pub fn is_inputcapture(&self) -> bool {
78        *self == MODE_A::INPUTCAPTURE
79    }
80    #[doc = "Checks if the value of the field is `OUTPUTCOMPARE`"]
81    #[inline(always)]
82    pub fn is_outputcompare(&self) -> bool {
83        *self == MODE_A::OUTPUTCOMPARE
84    }
85    #[doc = "Checks if the value of the field is `PWM`"]
86    #[inline(always)]
87    pub fn is_pwm(&self) -> bool {
88        *self == MODE_A::PWM
89    }
90}
91#[doc = "Field `MODE` writer - CC Channel Mode"]
92pub type MODE_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, MODE_A, 2, 0>;
93impl<'a> MODE_W<'a> {
94    #[doc = "Compare/Capture channel turned off"]
95    #[inline(always)]
96    pub fn off(self) -> &'a mut W {
97        self.variant(MODE_A::OFF)
98    }
99    #[doc = "Input capture"]
100    #[inline(always)]
101    pub fn inputcapture(self) -> &'a mut W {
102        self.variant(MODE_A::INPUTCAPTURE)
103    }
104    #[doc = "Output compare"]
105    #[inline(always)]
106    pub fn outputcompare(self) -> &'a mut W {
107        self.variant(MODE_A::OUTPUTCOMPARE)
108    }
109    #[doc = "Pulse-Width Modulation"]
110    #[inline(always)]
111    pub fn pwm(self) -> &'a mut W {
112        self.variant(MODE_A::PWM)
113    }
114}
115#[doc = "Field `OUTINV` reader - Output Invert"]
116pub type OUTINV_R = crate::BitReader<bool>;
117#[doc = "Field `OUTINV` writer - Output Invert"]
118pub type OUTINV_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 2>;
119#[doc = "Field `COIST` reader - Compare Output Initial State"]
120pub type COIST_R = crate::BitReader<bool>;
121#[doc = "Field `COIST` writer - Compare Output Initial State"]
122pub type COIST_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 4>;
123#[doc = "Compare Match Output Action\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq)]
125#[repr(u8)]
126pub enum CMOA_A {
127    #[doc = "0: No action on compare match"]
128    NONE = 0,
129    #[doc = "1: Toggle output on compare match"]
130    TOGGLE = 1,
131    #[doc = "2: Clear output on compare match"]
132    CLEAR = 2,
133    #[doc = "3: Set output on compare match"]
134    SET = 3,
135}
136impl From<CMOA_A> for u8 {
137    #[inline(always)]
138    fn from(variant: CMOA_A) -> Self {
139        variant as _
140    }
141}
142#[doc = "Field `CMOA` reader - Compare Match Output Action"]
143pub type CMOA_R = crate::FieldReader<u8, CMOA_A>;
144impl CMOA_R {
145    #[doc = "Get enumerated values variant"]
146    #[inline(always)]
147    pub fn variant(&self) -> CMOA_A {
148        match self.bits {
149            0 => CMOA_A::NONE,
150            1 => CMOA_A::TOGGLE,
151            2 => CMOA_A::CLEAR,
152            3 => CMOA_A::SET,
153            _ => unreachable!(),
154        }
155    }
156    #[doc = "Checks if the value of the field is `NONE`"]
157    #[inline(always)]
158    pub fn is_none(&self) -> bool {
159        *self == CMOA_A::NONE
160    }
161    #[doc = "Checks if the value of the field is `TOGGLE`"]
162    #[inline(always)]
163    pub fn is_toggle(&self) -> bool {
164        *self == CMOA_A::TOGGLE
165    }
166    #[doc = "Checks if the value of the field is `CLEAR`"]
167    #[inline(always)]
168    pub fn is_clear(&self) -> bool {
169        *self == CMOA_A::CLEAR
170    }
171    #[doc = "Checks if the value of the field is `SET`"]
172    #[inline(always)]
173    pub fn is_set(&self) -> bool {
174        *self == CMOA_A::SET
175    }
176}
177#[doc = "Field `CMOA` writer - Compare Match Output Action"]
178pub type CMOA_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, CMOA_A, 2, 8>;
179impl<'a> CMOA_W<'a> {
180    #[doc = "No action on compare match"]
181    #[inline(always)]
182    pub fn none(self) -> &'a mut W {
183        self.variant(CMOA_A::NONE)
184    }
185    #[doc = "Toggle output on compare match"]
186    #[inline(always)]
187    pub fn toggle(self) -> &'a mut W {
188        self.variant(CMOA_A::TOGGLE)
189    }
190    #[doc = "Clear output on compare match"]
191    #[inline(always)]
192    pub fn clear(self) -> &'a mut W {
193        self.variant(CMOA_A::CLEAR)
194    }
195    #[doc = "Set output on compare match"]
196    #[inline(always)]
197    pub fn set(self) -> &'a mut W {
198        self.variant(CMOA_A::SET)
199    }
200}
201#[doc = "Counter Overflow Output Action\n\nValue on reset: 0"]
202#[derive(Clone, Copy, Debug, PartialEq)]
203#[repr(u8)]
204pub enum COFOA_A {
205    #[doc = "0: No action on counter overflow"]
206    NONE = 0,
207    #[doc = "1: Toggle output on counter overflow"]
208    TOGGLE = 1,
209    #[doc = "2: Clear output on counter overflow"]
210    CLEAR = 2,
211    #[doc = "3: Set output on counter overflow"]
212    SET = 3,
213}
214impl From<COFOA_A> for u8 {
215    #[inline(always)]
216    fn from(variant: COFOA_A) -> Self {
217        variant as _
218    }
219}
220#[doc = "Field `COFOA` reader - Counter Overflow Output Action"]
221pub type COFOA_R = crate::FieldReader<u8, COFOA_A>;
222impl COFOA_R {
223    #[doc = "Get enumerated values variant"]
224    #[inline(always)]
225    pub fn variant(&self) -> COFOA_A {
226        match self.bits {
227            0 => COFOA_A::NONE,
228            1 => COFOA_A::TOGGLE,
229            2 => COFOA_A::CLEAR,
230            3 => COFOA_A::SET,
231            _ => unreachable!(),
232        }
233    }
234    #[doc = "Checks if the value of the field is `NONE`"]
235    #[inline(always)]
236    pub fn is_none(&self) -> bool {
237        *self == COFOA_A::NONE
238    }
239    #[doc = "Checks if the value of the field is `TOGGLE`"]
240    #[inline(always)]
241    pub fn is_toggle(&self) -> bool {
242        *self == COFOA_A::TOGGLE
243    }
244    #[doc = "Checks if the value of the field is `CLEAR`"]
245    #[inline(always)]
246    pub fn is_clear(&self) -> bool {
247        *self == COFOA_A::CLEAR
248    }
249    #[doc = "Checks if the value of the field is `SET`"]
250    #[inline(always)]
251    pub fn is_set(&self) -> bool {
252        *self == COFOA_A::SET
253    }
254}
255#[doc = "Field `COFOA` writer - Counter Overflow Output Action"]
256pub type COFOA_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, COFOA_A, 2, 10>;
257impl<'a> COFOA_W<'a> {
258    #[doc = "No action on counter overflow"]
259    #[inline(always)]
260    pub fn none(self) -> &'a mut W {
261        self.variant(COFOA_A::NONE)
262    }
263    #[doc = "Toggle output on counter overflow"]
264    #[inline(always)]
265    pub fn toggle(self) -> &'a mut W {
266        self.variant(COFOA_A::TOGGLE)
267    }
268    #[doc = "Clear output on counter overflow"]
269    #[inline(always)]
270    pub fn clear(self) -> &'a mut W {
271        self.variant(COFOA_A::CLEAR)
272    }
273    #[doc = "Set output on counter overflow"]
274    #[inline(always)]
275    pub fn set(self) -> &'a mut W {
276        self.variant(COFOA_A::SET)
277    }
278}
279#[doc = "Counter Underflow Output Action\n\nValue on reset: 0"]
280#[derive(Clone, Copy, Debug, PartialEq)]
281#[repr(u8)]
282pub enum CUFOA_A {
283    #[doc = "0: No action on counter underflow"]
284    NONE = 0,
285    #[doc = "1: Toggle output on counter underflow"]
286    TOGGLE = 1,
287    #[doc = "2: Clear output on counter underflow"]
288    CLEAR = 2,
289    #[doc = "3: Set output on counter underflow"]
290    SET = 3,
291}
292impl From<CUFOA_A> for u8 {
293    #[inline(always)]
294    fn from(variant: CUFOA_A) -> Self {
295        variant as _
296    }
297}
298#[doc = "Field `CUFOA` reader - Counter Underflow Output Action"]
299pub type CUFOA_R = crate::FieldReader<u8, CUFOA_A>;
300impl CUFOA_R {
301    #[doc = "Get enumerated values variant"]
302    #[inline(always)]
303    pub fn variant(&self) -> CUFOA_A {
304        match self.bits {
305            0 => CUFOA_A::NONE,
306            1 => CUFOA_A::TOGGLE,
307            2 => CUFOA_A::CLEAR,
308            3 => CUFOA_A::SET,
309            _ => unreachable!(),
310        }
311    }
312    #[doc = "Checks if the value of the field is `NONE`"]
313    #[inline(always)]
314    pub fn is_none(&self) -> bool {
315        *self == CUFOA_A::NONE
316    }
317    #[doc = "Checks if the value of the field is `TOGGLE`"]
318    #[inline(always)]
319    pub fn is_toggle(&self) -> bool {
320        *self == CUFOA_A::TOGGLE
321    }
322    #[doc = "Checks if the value of the field is `CLEAR`"]
323    #[inline(always)]
324    pub fn is_clear(&self) -> bool {
325        *self == CUFOA_A::CLEAR
326    }
327    #[doc = "Checks if the value of the field is `SET`"]
328    #[inline(always)]
329    pub fn is_set(&self) -> bool {
330        *self == CUFOA_A::SET
331    }
332}
333#[doc = "Field `CUFOA` writer - Counter Underflow Output Action"]
334pub type CUFOA_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, CUFOA_A, 2, 12>;
335impl<'a> CUFOA_W<'a> {
336    #[doc = "No action on counter underflow"]
337    #[inline(always)]
338    pub fn none(self) -> &'a mut W {
339        self.variant(CUFOA_A::NONE)
340    }
341    #[doc = "Toggle output on counter underflow"]
342    #[inline(always)]
343    pub fn toggle(self) -> &'a mut W {
344        self.variant(CUFOA_A::TOGGLE)
345    }
346    #[doc = "Clear output on counter underflow"]
347    #[inline(always)]
348    pub fn clear(self) -> &'a mut W {
349        self.variant(CUFOA_A::CLEAR)
350    }
351    #[doc = "Set output on counter underflow"]
352    #[inline(always)]
353    pub fn set(self) -> &'a mut W {
354        self.variant(CUFOA_A::SET)
355    }
356}
357#[doc = "Compare/Capture Channel PRS Input Channel Selection\n\nValue on reset: 0"]
358#[derive(Clone, Copy, Debug, PartialEq)]
359#[repr(u8)]
360pub enum PRSSEL_A {
361    #[doc = "0: PRS Channel 0 selected as input"]
362    PRSCH0 = 0,
363    #[doc = "1: PRS Channel 1 selected as input"]
364    PRSCH1 = 1,
365    #[doc = "2: PRS Channel 2 selected as input"]
366    PRSCH2 = 2,
367    #[doc = "3: PRS Channel 3 selected as input"]
368    PRSCH3 = 3,
369    #[doc = "4: PRS Channel 4 selected as input"]
370    PRSCH4 = 4,
371    #[doc = "5: PRS Channel 5 selected as input"]
372    PRSCH5 = 5,
373    #[doc = "6: PRS Channel 6 selected as input"]
374    PRSCH6 = 6,
375    #[doc = "7: PRS Channel 7 selected as input"]
376    PRSCH7 = 7,
377    #[doc = "8: PRS Channel 8 selected as input"]
378    PRSCH8 = 8,
379    #[doc = "9: PRS Channel 9 selected as input"]
380    PRSCH9 = 9,
381    #[doc = "10: PRS Channel 10 selected as input"]
382    PRSCH10 = 10,
383    #[doc = "11: PRS Channel 11 selected as input"]
384    PRSCH11 = 11,
385    #[doc = "12: PRS Channel 12 selected as input"]
386    PRSCH12 = 12,
387    #[doc = "13: PRS Channel 13 selected as input"]
388    PRSCH13 = 13,
389    #[doc = "14: PRS Channel 14 selected as input"]
390    PRSCH14 = 14,
391    #[doc = "15: PRS Channel 15 selected as input"]
392    PRSCH15 = 15,
393    #[doc = "16: PRS Channel 16 selected as input"]
394    PRSCH16 = 16,
395    #[doc = "17: PRS Channel 17 selected as input"]
396    PRSCH17 = 17,
397    #[doc = "18: PRS Channel 18 selected as input"]
398    PRSCH18 = 18,
399    #[doc = "19: PRS Channel 19 selected as input"]
400    PRSCH19 = 19,
401    #[doc = "20: PRS Channel 20 selected as input"]
402    PRSCH20 = 20,
403    #[doc = "21: PRS Channel 21 selected as input"]
404    PRSCH21 = 21,
405    #[doc = "22: PRS Channel 22 selected as input"]
406    PRSCH22 = 22,
407    #[doc = "23: PRS Channel 23 selected as input"]
408    PRSCH23 = 23,
409}
410impl From<PRSSEL_A> for u8 {
411    #[inline(always)]
412    fn from(variant: PRSSEL_A) -> Self {
413        variant as _
414    }
415}
416#[doc = "Field `PRSSEL` reader - Compare/Capture Channel PRS Input Channel Selection"]
417pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
418impl PRSSEL_R {
419    #[doc = "Get enumerated values variant"]
420    #[inline(always)]
421    pub fn variant(&self) -> Option<PRSSEL_A> {
422        match self.bits {
423            0 => Some(PRSSEL_A::PRSCH0),
424            1 => Some(PRSSEL_A::PRSCH1),
425            2 => Some(PRSSEL_A::PRSCH2),
426            3 => Some(PRSSEL_A::PRSCH3),
427            4 => Some(PRSSEL_A::PRSCH4),
428            5 => Some(PRSSEL_A::PRSCH5),
429            6 => Some(PRSSEL_A::PRSCH6),
430            7 => Some(PRSSEL_A::PRSCH7),
431            8 => Some(PRSSEL_A::PRSCH8),
432            9 => Some(PRSSEL_A::PRSCH9),
433            10 => Some(PRSSEL_A::PRSCH10),
434            11 => Some(PRSSEL_A::PRSCH11),
435            12 => Some(PRSSEL_A::PRSCH12),
436            13 => Some(PRSSEL_A::PRSCH13),
437            14 => Some(PRSSEL_A::PRSCH14),
438            15 => Some(PRSSEL_A::PRSCH15),
439            16 => Some(PRSSEL_A::PRSCH16),
440            17 => Some(PRSSEL_A::PRSCH17),
441            18 => Some(PRSSEL_A::PRSCH18),
442            19 => Some(PRSSEL_A::PRSCH19),
443            20 => Some(PRSSEL_A::PRSCH20),
444            21 => Some(PRSSEL_A::PRSCH21),
445            22 => Some(PRSSEL_A::PRSCH22),
446            23 => Some(PRSSEL_A::PRSCH23),
447            _ => None,
448        }
449    }
450    #[doc = "Checks if the value of the field is `PRSCH0`"]
451    #[inline(always)]
452    pub fn is_prsch0(&self) -> bool {
453        *self == PRSSEL_A::PRSCH0
454    }
455    #[doc = "Checks if the value of the field is `PRSCH1`"]
456    #[inline(always)]
457    pub fn is_prsch1(&self) -> bool {
458        *self == PRSSEL_A::PRSCH1
459    }
460    #[doc = "Checks if the value of the field is `PRSCH2`"]
461    #[inline(always)]
462    pub fn is_prsch2(&self) -> bool {
463        *self == PRSSEL_A::PRSCH2
464    }
465    #[doc = "Checks if the value of the field is `PRSCH3`"]
466    #[inline(always)]
467    pub fn is_prsch3(&self) -> bool {
468        *self == PRSSEL_A::PRSCH3
469    }
470    #[doc = "Checks if the value of the field is `PRSCH4`"]
471    #[inline(always)]
472    pub fn is_prsch4(&self) -> bool {
473        *self == PRSSEL_A::PRSCH4
474    }
475    #[doc = "Checks if the value of the field is `PRSCH5`"]
476    #[inline(always)]
477    pub fn is_prsch5(&self) -> bool {
478        *self == PRSSEL_A::PRSCH5
479    }
480    #[doc = "Checks if the value of the field is `PRSCH6`"]
481    #[inline(always)]
482    pub fn is_prsch6(&self) -> bool {
483        *self == PRSSEL_A::PRSCH6
484    }
485    #[doc = "Checks if the value of the field is `PRSCH7`"]
486    #[inline(always)]
487    pub fn is_prsch7(&self) -> bool {
488        *self == PRSSEL_A::PRSCH7
489    }
490    #[doc = "Checks if the value of the field is `PRSCH8`"]
491    #[inline(always)]
492    pub fn is_prsch8(&self) -> bool {
493        *self == PRSSEL_A::PRSCH8
494    }
495    #[doc = "Checks if the value of the field is `PRSCH9`"]
496    #[inline(always)]
497    pub fn is_prsch9(&self) -> bool {
498        *self == PRSSEL_A::PRSCH9
499    }
500    #[doc = "Checks if the value of the field is `PRSCH10`"]
501    #[inline(always)]
502    pub fn is_prsch10(&self) -> bool {
503        *self == PRSSEL_A::PRSCH10
504    }
505    #[doc = "Checks if the value of the field is `PRSCH11`"]
506    #[inline(always)]
507    pub fn is_prsch11(&self) -> bool {
508        *self == PRSSEL_A::PRSCH11
509    }
510    #[doc = "Checks if the value of the field is `PRSCH12`"]
511    #[inline(always)]
512    pub fn is_prsch12(&self) -> bool {
513        *self == PRSSEL_A::PRSCH12
514    }
515    #[doc = "Checks if the value of the field is `PRSCH13`"]
516    #[inline(always)]
517    pub fn is_prsch13(&self) -> bool {
518        *self == PRSSEL_A::PRSCH13
519    }
520    #[doc = "Checks if the value of the field is `PRSCH14`"]
521    #[inline(always)]
522    pub fn is_prsch14(&self) -> bool {
523        *self == PRSSEL_A::PRSCH14
524    }
525    #[doc = "Checks if the value of the field is `PRSCH15`"]
526    #[inline(always)]
527    pub fn is_prsch15(&self) -> bool {
528        *self == PRSSEL_A::PRSCH15
529    }
530    #[doc = "Checks if the value of the field is `PRSCH16`"]
531    #[inline(always)]
532    pub fn is_prsch16(&self) -> bool {
533        *self == PRSSEL_A::PRSCH16
534    }
535    #[doc = "Checks if the value of the field is `PRSCH17`"]
536    #[inline(always)]
537    pub fn is_prsch17(&self) -> bool {
538        *self == PRSSEL_A::PRSCH17
539    }
540    #[doc = "Checks if the value of the field is `PRSCH18`"]
541    #[inline(always)]
542    pub fn is_prsch18(&self) -> bool {
543        *self == PRSSEL_A::PRSCH18
544    }
545    #[doc = "Checks if the value of the field is `PRSCH19`"]
546    #[inline(always)]
547    pub fn is_prsch19(&self) -> bool {
548        *self == PRSSEL_A::PRSCH19
549    }
550    #[doc = "Checks if the value of the field is `PRSCH20`"]
551    #[inline(always)]
552    pub fn is_prsch20(&self) -> bool {
553        *self == PRSSEL_A::PRSCH20
554    }
555    #[doc = "Checks if the value of the field is `PRSCH21`"]
556    #[inline(always)]
557    pub fn is_prsch21(&self) -> bool {
558        *self == PRSSEL_A::PRSCH21
559    }
560    #[doc = "Checks if the value of the field is `PRSCH22`"]
561    #[inline(always)]
562    pub fn is_prsch22(&self) -> bool {
563        *self == PRSSEL_A::PRSCH22
564    }
565    #[doc = "Checks if the value of the field is `PRSCH23`"]
566    #[inline(always)]
567    pub fn is_prsch23(&self) -> bool {
568        *self == PRSSEL_A::PRSCH23
569    }
570}
571#[doc = "Field `PRSSEL` writer - Compare/Capture Channel PRS Input Channel Selection"]
572pub type PRSSEL_W<'a> = crate::FieldWriter<'a, u32, CC2_CTRL_SPEC, u8, PRSSEL_A, 5, 16>;
573impl<'a> PRSSEL_W<'a> {
574    #[doc = "PRS Channel 0 selected as input"]
575    #[inline(always)]
576    pub fn prsch0(self) -> &'a mut W {
577        self.variant(PRSSEL_A::PRSCH0)
578    }
579    #[doc = "PRS Channel 1 selected as input"]
580    #[inline(always)]
581    pub fn prsch1(self) -> &'a mut W {
582        self.variant(PRSSEL_A::PRSCH1)
583    }
584    #[doc = "PRS Channel 2 selected as input"]
585    #[inline(always)]
586    pub fn prsch2(self) -> &'a mut W {
587        self.variant(PRSSEL_A::PRSCH2)
588    }
589    #[doc = "PRS Channel 3 selected as input"]
590    #[inline(always)]
591    pub fn prsch3(self) -> &'a mut W {
592        self.variant(PRSSEL_A::PRSCH3)
593    }
594    #[doc = "PRS Channel 4 selected as input"]
595    #[inline(always)]
596    pub fn prsch4(self) -> &'a mut W {
597        self.variant(PRSSEL_A::PRSCH4)
598    }
599    #[doc = "PRS Channel 5 selected as input"]
600    #[inline(always)]
601    pub fn prsch5(self) -> &'a mut W {
602        self.variant(PRSSEL_A::PRSCH5)
603    }
604    #[doc = "PRS Channel 6 selected as input"]
605    #[inline(always)]
606    pub fn prsch6(self) -> &'a mut W {
607        self.variant(PRSSEL_A::PRSCH6)
608    }
609    #[doc = "PRS Channel 7 selected as input"]
610    #[inline(always)]
611    pub fn prsch7(self) -> &'a mut W {
612        self.variant(PRSSEL_A::PRSCH7)
613    }
614    #[doc = "PRS Channel 8 selected as input"]
615    #[inline(always)]
616    pub fn prsch8(self) -> &'a mut W {
617        self.variant(PRSSEL_A::PRSCH8)
618    }
619    #[doc = "PRS Channel 9 selected as input"]
620    #[inline(always)]
621    pub fn prsch9(self) -> &'a mut W {
622        self.variant(PRSSEL_A::PRSCH9)
623    }
624    #[doc = "PRS Channel 10 selected as input"]
625    #[inline(always)]
626    pub fn prsch10(self) -> &'a mut W {
627        self.variant(PRSSEL_A::PRSCH10)
628    }
629    #[doc = "PRS Channel 11 selected as input"]
630    #[inline(always)]
631    pub fn prsch11(self) -> &'a mut W {
632        self.variant(PRSSEL_A::PRSCH11)
633    }
634    #[doc = "PRS Channel 12 selected as input"]
635    #[inline(always)]
636    pub fn prsch12(self) -> &'a mut W {
637        self.variant(PRSSEL_A::PRSCH12)
638    }
639    #[doc = "PRS Channel 13 selected as input"]
640    #[inline(always)]
641    pub fn prsch13(self) -> &'a mut W {
642        self.variant(PRSSEL_A::PRSCH13)
643    }
644    #[doc = "PRS Channel 14 selected as input"]
645    #[inline(always)]
646    pub fn prsch14(self) -> &'a mut W {
647        self.variant(PRSSEL_A::PRSCH14)
648    }
649    #[doc = "PRS Channel 15 selected as input"]
650    #[inline(always)]
651    pub fn prsch15(self) -> &'a mut W {
652        self.variant(PRSSEL_A::PRSCH15)
653    }
654    #[doc = "PRS Channel 16 selected as input"]
655    #[inline(always)]
656    pub fn prsch16(self) -> &'a mut W {
657        self.variant(PRSSEL_A::PRSCH16)
658    }
659    #[doc = "PRS Channel 17 selected as input"]
660    #[inline(always)]
661    pub fn prsch17(self) -> &'a mut W {
662        self.variant(PRSSEL_A::PRSCH17)
663    }
664    #[doc = "PRS Channel 18 selected as input"]
665    #[inline(always)]
666    pub fn prsch18(self) -> &'a mut W {
667        self.variant(PRSSEL_A::PRSCH18)
668    }
669    #[doc = "PRS Channel 19 selected as input"]
670    #[inline(always)]
671    pub fn prsch19(self) -> &'a mut W {
672        self.variant(PRSSEL_A::PRSCH19)
673    }
674    #[doc = "PRS Channel 20 selected as input"]
675    #[inline(always)]
676    pub fn prsch20(self) -> &'a mut W {
677        self.variant(PRSSEL_A::PRSCH20)
678    }
679    #[doc = "PRS Channel 21 selected as input"]
680    #[inline(always)]
681    pub fn prsch21(self) -> &'a mut W {
682        self.variant(PRSSEL_A::PRSCH21)
683    }
684    #[doc = "PRS Channel 22 selected as input"]
685    #[inline(always)]
686    pub fn prsch22(self) -> &'a mut W {
687        self.variant(PRSSEL_A::PRSCH22)
688    }
689    #[doc = "PRS Channel 23 selected as input"]
690    #[inline(always)]
691    pub fn prsch23(self) -> &'a mut W {
692        self.variant(PRSSEL_A::PRSCH23)
693    }
694}
695#[doc = "Input Capture Edge Select\n\nValue on reset: 0"]
696#[derive(Clone, Copy, Debug, PartialEq)]
697#[repr(u8)]
698pub enum ICEDGE_A {
699    #[doc = "0: Rising edges detected"]
700    RISING = 0,
701    #[doc = "1: Falling edges detected"]
702    FALLING = 1,
703    #[doc = "2: Both edges detected"]
704    BOTH = 2,
705    #[doc = "3: No edge detection, signal is left as it is"]
706    NONE = 3,
707}
708impl From<ICEDGE_A> for u8 {
709    #[inline(always)]
710    fn from(variant: ICEDGE_A) -> Self {
711        variant as _
712    }
713}
714#[doc = "Field `ICEDGE` reader - Input Capture Edge Select"]
715pub type ICEDGE_R = crate::FieldReader<u8, ICEDGE_A>;
716impl ICEDGE_R {
717    #[doc = "Get enumerated values variant"]
718    #[inline(always)]
719    pub fn variant(&self) -> ICEDGE_A {
720        match self.bits {
721            0 => ICEDGE_A::RISING,
722            1 => ICEDGE_A::FALLING,
723            2 => ICEDGE_A::BOTH,
724            3 => ICEDGE_A::NONE,
725            _ => unreachable!(),
726        }
727    }
728    #[doc = "Checks if the value of the field is `RISING`"]
729    #[inline(always)]
730    pub fn is_rising(&self) -> bool {
731        *self == ICEDGE_A::RISING
732    }
733    #[doc = "Checks if the value of the field is `FALLING`"]
734    #[inline(always)]
735    pub fn is_falling(&self) -> bool {
736        *self == ICEDGE_A::FALLING
737    }
738    #[doc = "Checks if the value of the field is `BOTH`"]
739    #[inline(always)]
740    pub fn is_both(&self) -> bool {
741        *self == ICEDGE_A::BOTH
742    }
743    #[doc = "Checks if the value of the field is `NONE`"]
744    #[inline(always)]
745    pub fn is_none(&self) -> bool {
746        *self == ICEDGE_A::NONE
747    }
748}
749#[doc = "Field `ICEDGE` writer - Input Capture Edge Select"]
750pub type ICEDGE_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, ICEDGE_A, 2, 24>;
751impl<'a> ICEDGE_W<'a> {
752    #[doc = "Rising edges detected"]
753    #[inline(always)]
754    pub fn rising(self) -> &'a mut W {
755        self.variant(ICEDGE_A::RISING)
756    }
757    #[doc = "Falling edges detected"]
758    #[inline(always)]
759    pub fn falling(self) -> &'a mut W {
760        self.variant(ICEDGE_A::FALLING)
761    }
762    #[doc = "Both edges detected"]
763    #[inline(always)]
764    pub fn both(self) -> &'a mut W {
765        self.variant(ICEDGE_A::BOTH)
766    }
767    #[doc = "No edge detection, signal is left as it is"]
768    #[inline(always)]
769    pub fn none(self) -> &'a mut W {
770        self.variant(ICEDGE_A::NONE)
771    }
772}
773#[doc = "Input Capture Event Control\n\nValue on reset: 0"]
774#[derive(Clone, Copy, Debug, PartialEq)]
775#[repr(u8)]
776pub enum ICEVCTRL_A {
777    #[doc = "0: PRS output pulse and interrupt flag set on every capture"]
778    EVERYEDGE = 0,
779    #[doc = "1: PRS output pulse and interrupt flag set on every second capture"]
780    EVERYSECONDEDGE = 1,
781    #[doc = "2: PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
782    RISING = 2,
783    #[doc = "3: PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
784    FALLING = 3,
785}
786impl From<ICEVCTRL_A> for u8 {
787    #[inline(always)]
788    fn from(variant: ICEVCTRL_A) -> Self {
789        variant as _
790    }
791}
792#[doc = "Field `ICEVCTRL` reader - Input Capture Event Control"]
793pub type ICEVCTRL_R = crate::FieldReader<u8, ICEVCTRL_A>;
794impl ICEVCTRL_R {
795    #[doc = "Get enumerated values variant"]
796    #[inline(always)]
797    pub fn variant(&self) -> ICEVCTRL_A {
798        match self.bits {
799            0 => ICEVCTRL_A::EVERYEDGE,
800            1 => ICEVCTRL_A::EVERYSECONDEDGE,
801            2 => ICEVCTRL_A::RISING,
802            3 => ICEVCTRL_A::FALLING,
803            _ => unreachable!(),
804        }
805    }
806    #[doc = "Checks if the value of the field is `EVERYEDGE`"]
807    #[inline(always)]
808    pub fn is_everyedge(&self) -> bool {
809        *self == ICEVCTRL_A::EVERYEDGE
810    }
811    #[doc = "Checks if the value of the field is `EVERYSECONDEDGE`"]
812    #[inline(always)]
813    pub fn is_everysecondedge(&self) -> bool {
814        *self == ICEVCTRL_A::EVERYSECONDEDGE
815    }
816    #[doc = "Checks if the value of the field is `RISING`"]
817    #[inline(always)]
818    pub fn is_rising(&self) -> bool {
819        *self == ICEVCTRL_A::RISING
820    }
821    #[doc = "Checks if the value of the field is `FALLING`"]
822    #[inline(always)]
823    pub fn is_falling(&self) -> bool {
824        *self == ICEVCTRL_A::FALLING
825    }
826}
827#[doc = "Field `ICEVCTRL` writer - Input Capture Event Control"]
828pub type ICEVCTRL_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, ICEVCTRL_A, 2, 26>;
829impl<'a> ICEVCTRL_W<'a> {
830    #[doc = "PRS output pulse and interrupt flag set on every capture"]
831    #[inline(always)]
832    pub fn everyedge(self) -> &'a mut W {
833        self.variant(ICEVCTRL_A::EVERYEDGE)
834    }
835    #[doc = "PRS output pulse and interrupt flag set on every second capture"]
836    #[inline(always)]
837    pub fn everysecondedge(self) -> &'a mut W {
838        self.variant(ICEVCTRL_A::EVERYSECONDEDGE)
839    }
840    #[doc = "PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
841    #[inline(always)]
842    pub fn rising(self) -> &'a mut W {
843        self.variant(ICEVCTRL_A::RISING)
844    }
845    #[doc = "PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
846    #[inline(always)]
847    pub fn falling(self) -> &'a mut W {
848        self.variant(ICEVCTRL_A::FALLING)
849    }
850}
851#[doc = "Field `PRSCONF` reader - PRS Configuration"]
852pub type PRSCONF_R = crate::BitReader<bool>;
853#[doc = "Field `PRSCONF` writer - PRS Configuration"]
854pub type PRSCONF_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 28>;
855#[doc = "Field `INSEL` reader - Input Selection"]
856pub type INSEL_R = crate::BitReader<bool>;
857#[doc = "Field `INSEL` writer - Input Selection"]
858pub type INSEL_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 29>;
859#[doc = "Field `FILT` reader - Digital Filter"]
860pub type FILT_R = crate::BitReader<bool>;
861#[doc = "Field `FILT` writer - Digital Filter"]
862pub type FILT_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 30>;
863impl R {
864    #[doc = "Bits 0:1 - CC Channel Mode"]
865    #[inline(always)]
866    pub fn mode(&self) -> MODE_R {
867        MODE_R::new((self.bits & 3) as u8)
868    }
869    #[doc = "Bit 2 - Output Invert"]
870    #[inline(always)]
871    pub fn outinv(&self) -> OUTINV_R {
872        OUTINV_R::new(((self.bits >> 2) & 1) != 0)
873    }
874    #[doc = "Bit 4 - Compare Output Initial State"]
875    #[inline(always)]
876    pub fn coist(&self) -> COIST_R {
877        COIST_R::new(((self.bits >> 4) & 1) != 0)
878    }
879    #[doc = "Bits 8:9 - Compare Match Output Action"]
880    #[inline(always)]
881    pub fn cmoa(&self) -> CMOA_R {
882        CMOA_R::new(((self.bits >> 8) & 3) as u8)
883    }
884    #[doc = "Bits 10:11 - Counter Overflow Output Action"]
885    #[inline(always)]
886    pub fn cofoa(&self) -> COFOA_R {
887        COFOA_R::new(((self.bits >> 10) & 3) as u8)
888    }
889    #[doc = "Bits 12:13 - Counter Underflow Output Action"]
890    #[inline(always)]
891    pub fn cufoa(&self) -> CUFOA_R {
892        CUFOA_R::new(((self.bits >> 12) & 3) as u8)
893    }
894    #[doc = "Bits 16:20 - Compare/Capture Channel PRS Input Channel Selection"]
895    #[inline(always)]
896    pub fn prssel(&self) -> PRSSEL_R {
897        PRSSEL_R::new(((self.bits >> 16) & 0x1f) as u8)
898    }
899    #[doc = "Bits 24:25 - Input Capture Edge Select"]
900    #[inline(always)]
901    pub fn icedge(&self) -> ICEDGE_R {
902        ICEDGE_R::new(((self.bits >> 24) & 3) as u8)
903    }
904    #[doc = "Bits 26:27 - Input Capture Event Control"]
905    #[inline(always)]
906    pub fn icevctrl(&self) -> ICEVCTRL_R {
907        ICEVCTRL_R::new(((self.bits >> 26) & 3) as u8)
908    }
909    #[doc = "Bit 28 - PRS Configuration"]
910    #[inline(always)]
911    pub fn prsconf(&self) -> PRSCONF_R {
912        PRSCONF_R::new(((self.bits >> 28) & 1) != 0)
913    }
914    #[doc = "Bit 29 - Input Selection"]
915    #[inline(always)]
916    pub fn insel(&self) -> INSEL_R {
917        INSEL_R::new(((self.bits >> 29) & 1) != 0)
918    }
919    #[doc = "Bit 30 - Digital Filter"]
920    #[inline(always)]
921    pub fn filt(&self) -> FILT_R {
922        FILT_R::new(((self.bits >> 30) & 1) != 0)
923    }
924}
925impl W {
926    #[doc = "Bits 0:1 - CC Channel Mode"]
927    #[inline(always)]
928    pub fn mode(&mut self) -> MODE_W {
929        MODE_W::new(self)
930    }
931    #[doc = "Bit 2 - Output Invert"]
932    #[inline(always)]
933    pub fn outinv(&mut self) -> OUTINV_W {
934        OUTINV_W::new(self)
935    }
936    #[doc = "Bit 4 - Compare Output Initial State"]
937    #[inline(always)]
938    pub fn coist(&mut self) -> COIST_W {
939        COIST_W::new(self)
940    }
941    #[doc = "Bits 8:9 - Compare Match Output Action"]
942    #[inline(always)]
943    pub fn cmoa(&mut self) -> CMOA_W {
944        CMOA_W::new(self)
945    }
946    #[doc = "Bits 10:11 - Counter Overflow Output Action"]
947    #[inline(always)]
948    pub fn cofoa(&mut self) -> COFOA_W {
949        COFOA_W::new(self)
950    }
951    #[doc = "Bits 12:13 - Counter Underflow Output Action"]
952    #[inline(always)]
953    pub fn cufoa(&mut self) -> CUFOA_W {
954        CUFOA_W::new(self)
955    }
956    #[doc = "Bits 16:20 - Compare/Capture Channel PRS Input Channel Selection"]
957    #[inline(always)]
958    pub fn prssel(&mut self) -> PRSSEL_W {
959        PRSSEL_W::new(self)
960    }
961    #[doc = "Bits 24:25 - Input Capture Edge Select"]
962    #[inline(always)]
963    pub fn icedge(&mut self) -> ICEDGE_W {
964        ICEDGE_W::new(self)
965    }
966    #[doc = "Bits 26:27 - Input Capture Event Control"]
967    #[inline(always)]
968    pub fn icevctrl(&mut self) -> ICEVCTRL_W {
969        ICEVCTRL_W::new(self)
970    }
971    #[doc = "Bit 28 - PRS Configuration"]
972    #[inline(always)]
973    pub fn prsconf(&mut self) -> PRSCONF_W {
974        PRSCONF_W::new(self)
975    }
976    #[doc = "Bit 29 - Input Selection"]
977    #[inline(always)]
978    pub fn insel(&mut self) -> INSEL_W {
979        INSEL_W::new(self)
980    }
981    #[doc = "Bit 30 - Digital Filter"]
982    #[inline(always)]
983    pub fn filt(&mut self) -> FILT_W {
984        FILT_W::new(self)
985    }
986    #[doc = "Writes raw bits to the register."]
987    #[inline(always)]
988    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
989        self.0.bits(bits);
990        self
991    }
992}
993#[doc = "CC Channel Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cc2_ctrl](index.html) module"]
994pub struct CC2_CTRL_SPEC;
995impl crate::RegisterSpec for CC2_CTRL_SPEC {
996    type Ux = u32;
997}
998#[doc = "`read()` method returns [cc2_ctrl::R](R) reader structure"]
999impl crate::Readable for CC2_CTRL_SPEC {
1000    type Reader = R;
1001}
1002#[doc = "`write(|w| ..)` method takes [cc2_ctrl::W](W) writer structure"]
1003impl crate::Writable for CC2_CTRL_SPEC {
1004    type Writer = W;
1005}
1006#[doc = "`reset()` method sets CC2_CTRL to value 0"]
1007impl crate::Resettable for CC2_CTRL_SPEC {
1008    #[inline(always)]
1009    fn reset_value() -> Self::Ux {
1010        0
1011    }
1012}