efm32gg12b810/wtimer0/
cc0_ctrl.rs

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