efm32jg12b_pac/efm32jg12b500/wtimer0/
cc0_ctrl.rs

1#[doc = "Register `CC0_CTRL` reader"]
2pub struct R(crate::R<CC0_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CC0_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CC0_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CC0_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CC0_CTRL` writer"]
17pub struct W(crate::W<CC0_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CC0_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<CC0_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CC0_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `MODE` reader - CC Channel Mode"]
38pub type MODE_R = crate::FieldReader<u8, MODE_A>;
39#[doc = "CC Channel Mode\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum MODE_A {
43    #[doc = "0: Compare/Capture channel turned off"]
44    OFF = 0,
45    #[doc = "1: Input capture"]
46    INPUTCAPTURE = 1,
47    #[doc = "2: Output compare"]
48    OUTPUTCOMPARE = 2,
49    #[doc = "3: Pulse-Width Modulation"]
50    PWM = 3,
51}
52impl From<MODE_A> for u8 {
53    #[inline(always)]
54    fn from(variant: MODE_A) -> Self {
55        variant as _
56    }
57}
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, const O: u8> = crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, MODE_A, 2, O>;
93impl<'a, const O: u8> MODE_W<'a, O> {
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, const O: u8> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, O>;
123#[doc = "Field `CMOA` reader - Compare Match Output Action"]
124pub type CMOA_R = crate::FieldReader<u8, CMOA_A>;
125#[doc = "Compare Match Output Action\n\nValue on reset: 0"]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127#[repr(u8)]
128pub enum CMOA_A {
129    #[doc = "0: No action on compare match"]
130    NONE = 0,
131    #[doc = "1: Toggle output on compare match"]
132    TOGGLE = 1,
133    #[doc = "2: Clear output on compare match"]
134    CLEAR = 2,
135    #[doc = "3: Set output on compare match"]
136    SET = 3,
137}
138impl From<CMOA_A> for u8 {
139    #[inline(always)]
140    fn from(variant: CMOA_A) -> Self {
141        variant as _
142    }
143}
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, const O: u8> = crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, CMOA_A, 2, O>;
179impl<'a, const O: u8> CMOA_W<'a, O> {
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 = "Field `COFOA` reader - Counter Overflow Output Action"]
202pub type COFOA_R = crate::FieldReader<u8, COFOA_A>;
203#[doc = "Counter Overflow Output Action\n\nValue on reset: 0"]
204#[derive(Clone, Copy, Debug, PartialEq, Eq)]
205#[repr(u8)]
206pub enum COFOA_A {
207    #[doc = "0: No action on counter overflow"]
208    NONE = 0,
209    #[doc = "1: Toggle output on counter overflow"]
210    TOGGLE = 1,
211    #[doc = "2: Clear output on counter overflow"]
212    CLEAR = 2,
213    #[doc = "3: Set output on counter overflow"]
214    SET = 3,
215}
216impl From<COFOA_A> for u8 {
217    #[inline(always)]
218    fn from(variant: COFOA_A) -> Self {
219        variant as _
220    }
221}
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, const O: u8> =
257    crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, COFOA_A, 2, O>;
258impl<'a, const O: u8> COFOA_W<'a, O> {
259    #[doc = "No action on counter overflow"]
260    #[inline(always)]
261    pub fn none(self) -> &'a mut W {
262        self.variant(COFOA_A::NONE)
263    }
264    #[doc = "Toggle output on counter overflow"]
265    #[inline(always)]
266    pub fn toggle(self) -> &'a mut W {
267        self.variant(COFOA_A::TOGGLE)
268    }
269    #[doc = "Clear output on counter overflow"]
270    #[inline(always)]
271    pub fn clear(self) -> &'a mut W {
272        self.variant(COFOA_A::CLEAR)
273    }
274    #[doc = "Set output on counter overflow"]
275    #[inline(always)]
276    pub fn set(self) -> &'a mut W {
277        self.variant(COFOA_A::SET)
278    }
279}
280#[doc = "Field `CUFOA` reader - Counter Underflow Output Action"]
281pub type CUFOA_R = crate::FieldReader<u8, CUFOA_A>;
282#[doc = "Counter Underflow Output Action\n\nValue on reset: 0"]
283#[derive(Clone, Copy, Debug, PartialEq, Eq)]
284#[repr(u8)]
285pub enum CUFOA_A {
286    #[doc = "0: No action on counter underflow"]
287    NONE = 0,
288    #[doc = "1: Toggle output on counter underflow"]
289    TOGGLE = 1,
290    #[doc = "2: Clear output on counter underflow"]
291    CLEAR = 2,
292    #[doc = "3: Set output on counter underflow"]
293    SET = 3,
294}
295impl From<CUFOA_A> for u8 {
296    #[inline(always)]
297    fn from(variant: CUFOA_A) -> Self {
298        variant as _
299    }
300}
301impl CUFOA_R {
302    #[doc = "Get enumerated values variant"]
303    #[inline(always)]
304    pub fn variant(&self) -> CUFOA_A {
305        match self.bits {
306            0 => CUFOA_A::NONE,
307            1 => CUFOA_A::TOGGLE,
308            2 => CUFOA_A::CLEAR,
309            3 => CUFOA_A::SET,
310            _ => unreachable!(),
311        }
312    }
313    #[doc = "Checks if the value of the field is `NONE`"]
314    #[inline(always)]
315    pub fn is_none(&self) -> bool {
316        *self == CUFOA_A::NONE
317    }
318    #[doc = "Checks if the value of the field is `TOGGLE`"]
319    #[inline(always)]
320    pub fn is_toggle(&self) -> bool {
321        *self == CUFOA_A::TOGGLE
322    }
323    #[doc = "Checks if the value of the field is `CLEAR`"]
324    #[inline(always)]
325    pub fn is_clear(&self) -> bool {
326        *self == CUFOA_A::CLEAR
327    }
328    #[doc = "Checks if the value of the field is `SET`"]
329    #[inline(always)]
330    pub fn is_set(&self) -> bool {
331        *self == CUFOA_A::SET
332    }
333}
334#[doc = "Field `CUFOA` writer - Counter Underflow Output Action"]
335pub type CUFOA_W<'a, const O: u8> =
336    crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, CUFOA_A, 2, O>;
337impl<'a, const O: u8> CUFOA_W<'a, O> {
338    #[doc = "No action on counter underflow"]
339    #[inline(always)]
340    pub fn none(self) -> &'a mut W {
341        self.variant(CUFOA_A::NONE)
342    }
343    #[doc = "Toggle output on counter underflow"]
344    #[inline(always)]
345    pub fn toggle(self) -> &'a mut W {
346        self.variant(CUFOA_A::TOGGLE)
347    }
348    #[doc = "Clear output on counter underflow"]
349    #[inline(always)]
350    pub fn clear(self) -> &'a mut W {
351        self.variant(CUFOA_A::CLEAR)
352    }
353    #[doc = "Set output on counter underflow"]
354    #[inline(always)]
355    pub fn set(self) -> &'a mut W {
356        self.variant(CUFOA_A::SET)
357    }
358}
359#[doc = "Field `PRSSEL` reader - Compare/Capture Channel PRS Input Channel Selection"]
360pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
361#[doc = "Compare/Capture Channel PRS Input Channel Selection\n\nValue on reset: 0"]
362#[derive(Clone, Copy, Debug, PartialEq, Eq)]
363#[repr(u8)]
364pub enum PRSSEL_A {
365    #[doc = "0: PRS Channel 0 selected as input"]
366    PRSCH0 = 0,
367    #[doc = "1: PRS Channel 1 selected as input"]
368    PRSCH1 = 1,
369    #[doc = "2: PRS Channel 2 selected as input"]
370    PRSCH2 = 2,
371    #[doc = "3: PRS Channel 3 selected as input"]
372    PRSCH3 = 3,
373    #[doc = "4: PRS Channel 4 selected as input"]
374    PRSCH4 = 4,
375    #[doc = "5: PRS Channel 5 selected as input"]
376    PRSCH5 = 5,
377    #[doc = "6: PRS Channel 6 selected as input"]
378    PRSCH6 = 6,
379    #[doc = "7: PRS Channel 7 selected as input"]
380    PRSCH7 = 7,
381    #[doc = "8: PRS Channel 8 selected as input"]
382    PRSCH8 = 8,
383    #[doc = "9: PRS Channel 9 selected as input"]
384    PRSCH9 = 9,
385    #[doc = "10: PRS Channel 10 selected as input"]
386    PRSCH10 = 10,
387    #[doc = "11: PRS Channel 11 selected as input"]
388    PRSCH11 = 11,
389}
390impl From<PRSSEL_A> for u8 {
391    #[inline(always)]
392    fn from(variant: PRSSEL_A) -> Self {
393        variant as _
394    }
395}
396impl PRSSEL_R {
397    #[doc = "Get enumerated values variant"]
398    #[inline(always)]
399    pub fn variant(&self) -> Option<PRSSEL_A> {
400        match self.bits {
401            0 => Some(PRSSEL_A::PRSCH0),
402            1 => Some(PRSSEL_A::PRSCH1),
403            2 => Some(PRSSEL_A::PRSCH2),
404            3 => Some(PRSSEL_A::PRSCH3),
405            4 => Some(PRSSEL_A::PRSCH4),
406            5 => Some(PRSSEL_A::PRSCH5),
407            6 => Some(PRSSEL_A::PRSCH6),
408            7 => Some(PRSSEL_A::PRSCH7),
409            8 => Some(PRSSEL_A::PRSCH8),
410            9 => Some(PRSSEL_A::PRSCH9),
411            10 => Some(PRSSEL_A::PRSCH10),
412            11 => Some(PRSSEL_A::PRSCH11),
413            _ => None,
414        }
415    }
416    #[doc = "Checks if the value of the field is `PRSCH0`"]
417    #[inline(always)]
418    pub fn is_prsch0(&self) -> bool {
419        *self == PRSSEL_A::PRSCH0
420    }
421    #[doc = "Checks if the value of the field is `PRSCH1`"]
422    #[inline(always)]
423    pub fn is_prsch1(&self) -> bool {
424        *self == PRSSEL_A::PRSCH1
425    }
426    #[doc = "Checks if the value of the field is `PRSCH2`"]
427    #[inline(always)]
428    pub fn is_prsch2(&self) -> bool {
429        *self == PRSSEL_A::PRSCH2
430    }
431    #[doc = "Checks if the value of the field is `PRSCH3`"]
432    #[inline(always)]
433    pub fn is_prsch3(&self) -> bool {
434        *self == PRSSEL_A::PRSCH3
435    }
436    #[doc = "Checks if the value of the field is `PRSCH4`"]
437    #[inline(always)]
438    pub fn is_prsch4(&self) -> bool {
439        *self == PRSSEL_A::PRSCH4
440    }
441    #[doc = "Checks if the value of the field is `PRSCH5`"]
442    #[inline(always)]
443    pub fn is_prsch5(&self) -> bool {
444        *self == PRSSEL_A::PRSCH5
445    }
446    #[doc = "Checks if the value of the field is `PRSCH6`"]
447    #[inline(always)]
448    pub fn is_prsch6(&self) -> bool {
449        *self == PRSSEL_A::PRSCH6
450    }
451    #[doc = "Checks if the value of the field is `PRSCH7`"]
452    #[inline(always)]
453    pub fn is_prsch7(&self) -> bool {
454        *self == PRSSEL_A::PRSCH7
455    }
456    #[doc = "Checks if the value of the field is `PRSCH8`"]
457    #[inline(always)]
458    pub fn is_prsch8(&self) -> bool {
459        *self == PRSSEL_A::PRSCH8
460    }
461    #[doc = "Checks if the value of the field is `PRSCH9`"]
462    #[inline(always)]
463    pub fn is_prsch9(&self) -> bool {
464        *self == PRSSEL_A::PRSCH9
465    }
466    #[doc = "Checks if the value of the field is `PRSCH10`"]
467    #[inline(always)]
468    pub fn is_prsch10(&self) -> bool {
469        *self == PRSSEL_A::PRSCH10
470    }
471    #[doc = "Checks if the value of the field is `PRSCH11`"]
472    #[inline(always)]
473    pub fn is_prsch11(&self) -> bool {
474        *self == PRSSEL_A::PRSCH11
475    }
476}
477#[doc = "Field `PRSSEL` writer - Compare/Capture Channel PRS Input Channel Selection"]
478pub type PRSSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CC0_CTRL_SPEC, u8, PRSSEL_A, 4, O>;
479impl<'a, const O: u8> PRSSEL_W<'a, O> {
480    #[doc = "PRS Channel 0 selected as input"]
481    #[inline(always)]
482    pub fn prsch0(self) -> &'a mut W {
483        self.variant(PRSSEL_A::PRSCH0)
484    }
485    #[doc = "PRS Channel 1 selected as input"]
486    #[inline(always)]
487    pub fn prsch1(self) -> &'a mut W {
488        self.variant(PRSSEL_A::PRSCH1)
489    }
490    #[doc = "PRS Channel 2 selected as input"]
491    #[inline(always)]
492    pub fn prsch2(self) -> &'a mut W {
493        self.variant(PRSSEL_A::PRSCH2)
494    }
495    #[doc = "PRS Channel 3 selected as input"]
496    #[inline(always)]
497    pub fn prsch3(self) -> &'a mut W {
498        self.variant(PRSSEL_A::PRSCH3)
499    }
500    #[doc = "PRS Channel 4 selected as input"]
501    #[inline(always)]
502    pub fn prsch4(self) -> &'a mut W {
503        self.variant(PRSSEL_A::PRSCH4)
504    }
505    #[doc = "PRS Channel 5 selected as input"]
506    #[inline(always)]
507    pub fn prsch5(self) -> &'a mut W {
508        self.variant(PRSSEL_A::PRSCH5)
509    }
510    #[doc = "PRS Channel 6 selected as input"]
511    #[inline(always)]
512    pub fn prsch6(self) -> &'a mut W {
513        self.variant(PRSSEL_A::PRSCH6)
514    }
515    #[doc = "PRS Channel 7 selected as input"]
516    #[inline(always)]
517    pub fn prsch7(self) -> &'a mut W {
518        self.variant(PRSSEL_A::PRSCH7)
519    }
520    #[doc = "PRS Channel 8 selected as input"]
521    #[inline(always)]
522    pub fn prsch8(self) -> &'a mut W {
523        self.variant(PRSSEL_A::PRSCH8)
524    }
525    #[doc = "PRS Channel 9 selected as input"]
526    #[inline(always)]
527    pub fn prsch9(self) -> &'a mut W {
528        self.variant(PRSSEL_A::PRSCH9)
529    }
530    #[doc = "PRS Channel 10 selected as input"]
531    #[inline(always)]
532    pub fn prsch10(self) -> &'a mut W {
533        self.variant(PRSSEL_A::PRSCH10)
534    }
535    #[doc = "PRS Channel 11 selected as input"]
536    #[inline(always)]
537    pub fn prsch11(self) -> &'a mut W {
538        self.variant(PRSSEL_A::PRSCH11)
539    }
540}
541#[doc = "Field `ICEDGE` reader - Input Capture Edge Select"]
542pub type ICEDGE_R = crate::FieldReader<u8, ICEDGE_A>;
543#[doc = "Input Capture Edge Select\n\nValue on reset: 0"]
544#[derive(Clone, Copy, Debug, PartialEq, Eq)]
545#[repr(u8)]
546pub enum ICEDGE_A {
547    #[doc = "0: Rising edges detected"]
548    RISING = 0,
549    #[doc = "1: Falling edges detected"]
550    FALLING = 1,
551    #[doc = "2: Both edges detected"]
552    BOTH = 2,
553    #[doc = "3: No edge detection, signal is left as it is"]
554    NONE = 3,
555}
556impl From<ICEDGE_A> for u8 {
557    #[inline(always)]
558    fn from(variant: ICEDGE_A) -> Self {
559        variant as _
560    }
561}
562impl ICEDGE_R {
563    #[doc = "Get enumerated values variant"]
564    #[inline(always)]
565    pub fn variant(&self) -> ICEDGE_A {
566        match self.bits {
567            0 => ICEDGE_A::RISING,
568            1 => ICEDGE_A::FALLING,
569            2 => ICEDGE_A::BOTH,
570            3 => ICEDGE_A::NONE,
571            _ => unreachable!(),
572        }
573    }
574    #[doc = "Checks if the value of the field is `RISING`"]
575    #[inline(always)]
576    pub fn is_rising(&self) -> bool {
577        *self == ICEDGE_A::RISING
578    }
579    #[doc = "Checks if the value of the field is `FALLING`"]
580    #[inline(always)]
581    pub fn is_falling(&self) -> bool {
582        *self == ICEDGE_A::FALLING
583    }
584    #[doc = "Checks if the value of the field is `BOTH`"]
585    #[inline(always)]
586    pub fn is_both(&self) -> bool {
587        *self == ICEDGE_A::BOTH
588    }
589    #[doc = "Checks if the value of the field is `NONE`"]
590    #[inline(always)]
591    pub fn is_none(&self) -> bool {
592        *self == ICEDGE_A::NONE
593    }
594}
595#[doc = "Field `ICEDGE` writer - Input Capture Edge Select"]
596pub type ICEDGE_W<'a, const O: u8> =
597    crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, ICEDGE_A, 2, O>;
598impl<'a, const O: u8> ICEDGE_W<'a, O> {
599    #[doc = "Rising edges detected"]
600    #[inline(always)]
601    pub fn rising(self) -> &'a mut W {
602        self.variant(ICEDGE_A::RISING)
603    }
604    #[doc = "Falling edges detected"]
605    #[inline(always)]
606    pub fn falling(self) -> &'a mut W {
607        self.variant(ICEDGE_A::FALLING)
608    }
609    #[doc = "Both edges detected"]
610    #[inline(always)]
611    pub fn both(self) -> &'a mut W {
612        self.variant(ICEDGE_A::BOTH)
613    }
614    #[doc = "No edge detection, signal is left as it is"]
615    #[inline(always)]
616    pub fn none(self) -> &'a mut W {
617        self.variant(ICEDGE_A::NONE)
618    }
619}
620#[doc = "Field `ICEVCTRL` reader - Input Capture Event Control"]
621pub type ICEVCTRL_R = crate::FieldReader<u8, ICEVCTRL_A>;
622#[doc = "Input Capture Event Control\n\nValue on reset: 0"]
623#[derive(Clone, Copy, Debug, PartialEq, Eq)]
624#[repr(u8)]
625pub enum ICEVCTRL_A {
626    #[doc = "0: PRS output pulse and interrupt flag set on every capture"]
627    EVERYEDGE = 0,
628    #[doc = "1: PRS output pulse and interrupt flag set on every second capture"]
629    EVERYSECONDEDGE = 1,
630    #[doc = "2: PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
631    RISING = 2,
632    #[doc = "3: PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
633    FALLING = 3,
634}
635impl From<ICEVCTRL_A> for u8 {
636    #[inline(always)]
637    fn from(variant: ICEVCTRL_A) -> Self {
638        variant as _
639    }
640}
641impl ICEVCTRL_R {
642    #[doc = "Get enumerated values variant"]
643    #[inline(always)]
644    pub fn variant(&self) -> ICEVCTRL_A {
645        match self.bits {
646            0 => ICEVCTRL_A::EVERYEDGE,
647            1 => ICEVCTRL_A::EVERYSECONDEDGE,
648            2 => ICEVCTRL_A::RISING,
649            3 => ICEVCTRL_A::FALLING,
650            _ => unreachable!(),
651        }
652    }
653    #[doc = "Checks if the value of the field is `EVERYEDGE`"]
654    #[inline(always)]
655    pub fn is_everyedge(&self) -> bool {
656        *self == ICEVCTRL_A::EVERYEDGE
657    }
658    #[doc = "Checks if the value of the field is `EVERYSECONDEDGE`"]
659    #[inline(always)]
660    pub fn is_everysecondedge(&self) -> bool {
661        *self == ICEVCTRL_A::EVERYSECONDEDGE
662    }
663    #[doc = "Checks if the value of the field is `RISING`"]
664    #[inline(always)]
665    pub fn is_rising(&self) -> bool {
666        *self == ICEVCTRL_A::RISING
667    }
668    #[doc = "Checks if the value of the field is `FALLING`"]
669    #[inline(always)]
670    pub fn is_falling(&self) -> bool {
671        *self == ICEVCTRL_A::FALLING
672    }
673}
674#[doc = "Field `ICEVCTRL` writer - Input Capture Event Control"]
675pub type ICEVCTRL_W<'a, const O: u8> =
676    crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, ICEVCTRL_A, 2, O>;
677impl<'a, const O: u8> ICEVCTRL_W<'a, O> {
678    #[doc = "PRS output pulse and interrupt flag set on every capture"]
679    #[inline(always)]
680    pub fn everyedge(self) -> &'a mut W {
681        self.variant(ICEVCTRL_A::EVERYEDGE)
682    }
683    #[doc = "PRS output pulse and interrupt flag set on every second capture"]
684    #[inline(always)]
685    pub fn everysecondedge(self) -> &'a mut W {
686        self.variant(ICEVCTRL_A::EVERYSECONDEDGE)
687    }
688    #[doc = "PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
689    #[inline(always)]
690    pub fn rising(self) -> &'a mut W {
691        self.variant(ICEVCTRL_A::RISING)
692    }
693    #[doc = "PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
694    #[inline(always)]
695    pub fn falling(self) -> &'a mut W {
696        self.variant(ICEVCTRL_A::FALLING)
697    }
698}
699#[doc = "Field `PRSCONF` reader - PRS Configuration"]
700pub type PRSCONF_R = crate::BitReader<bool>;
701#[doc = "Field `PRSCONF` writer - PRS Configuration"]
702pub type PRSCONF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, O>;
703#[doc = "Field `INSEL` reader - Input Selection"]
704pub type INSEL_R = crate::BitReader<bool>;
705#[doc = "Field `INSEL` writer - Input Selection"]
706pub type INSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, O>;
707#[doc = "Field `FILT` reader - Digital Filter"]
708pub type FILT_R = crate::BitReader<bool>;
709#[doc = "Field `FILT` writer - Digital Filter"]
710pub type FILT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, O>;
711impl R {
712    #[doc = "Bits 0:1 - CC Channel Mode"]
713    #[inline(always)]
714    pub fn mode(&self) -> MODE_R {
715        MODE_R::new((self.bits & 3) as u8)
716    }
717    #[doc = "Bit 2 - Output Invert"]
718    #[inline(always)]
719    pub fn outinv(&self) -> OUTINV_R {
720        OUTINV_R::new(((self.bits >> 2) & 1) != 0)
721    }
722    #[doc = "Bit 4 - Compare Output Initial State"]
723    #[inline(always)]
724    pub fn coist(&self) -> COIST_R {
725        COIST_R::new(((self.bits >> 4) & 1) != 0)
726    }
727    #[doc = "Bits 8:9 - Compare Match Output Action"]
728    #[inline(always)]
729    pub fn cmoa(&self) -> CMOA_R {
730        CMOA_R::new(((self.bits >> 8) & 3) as u8)
731    }
732    #[doc = "Bits 10:11 - Counter Overflow Output Action"]
733    #[inline(always)]
734    pub fn cofoa(&self) -> COFOA_R {
735        COFOA_R::new(((self.bits >> 10) & 3) as u8)
736    }
737    #[doc = "Bits 12:13 - Counter Underflow Output Action"]
738    #[inline(always)]
739    pub fn cufoa(&self) -> CUFOA_R {
740        CUFOA_R::new(((self.bits >> 12) & 3) as u8)
741    }
742    #[doc = "Bits 16:19 - Compare/Capture Channel PRS Input Channel Selection"]
743    #[inline(always)]
744    pub fn prssel(&self) -> PRSSEL_R {
745        PRSSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
746    }
747    #[doc = "Bits 24:25 - Input Capture Edge Select"]
748    #[inline(always)]
749    pub fn icedge(&self) -> ICEDGE_R {
750        ICEDGE_R::new(((self.bits >> 24) & 3) as u8)
751    }
752    #[doc = "Bits 26:27 - Input Capture Event Control"]
753    #[inline(always)]
754    pub fn icevctrl(&self) -> ICEVCTRL_R {
755        ICEVCTRL_R::new(((self.bits >> 26) & 3) as u8)
756    }
757    #[doc = "Bit 28 - PRS Configuration"]
758    #[inline(always)]
759    pub fn prsconf(&self) -> PRSCONF_R {
760        PRSCONF_R::new(((self.bits >> 28) & 1) != 0)
761    }
762    #[doc = "Bit 29 - Input Selection"]
763    #[inline(always)]
764    pub fn insel(&self) -> INSEL_R {
765        INSEL_R::new(((self.bits >> 29) & 1) != 0)
766    }
767    #[doc = "Bit 30 - Digital Filter"]
768    #[inline(always)]
769    pub fn filt(&self) -> FILT_R {
770        FILT_R::new(((self.bits >> 30) & 1) != 0)
771    }
772}
773impl W {
774    #[doc = "Bits 0:1 - CC Channel Mode"]
775    #[inline(always)]
776    #[must_use]
777    pub fn mode(&mut self) -> MODE_W<0> {
778        MODE_W::new(self)
779    }
780    #[doc = "Bit 2 - Output Invert"]
781    #[inline(always)]
782    #[must_use]
783    pub fn outinv(&mut self) -> OUTINV_W<2> {
784        OUTINV_W::new(self)
785    }
786    #[doc = "Bit 4 - Compare Output Initial State"]
787    #[inline(always)]
788    #[must_use]
789    pub fn coist(&mut self) -> COIST_W<4> {
790        COIST_W::new(self)
791    }
792    #[doc = "Bits 8:9 - Compare Match Output Action"]
793    #[inline(always)]
794    #[must_use]
795    pub fn cmoa(&mut self) -> CMOA_W<8> {
796        CMOA_W::new(self)
797    }
798    #[doc = "Bits 10:11 - Counter Overflow Output Action"]
799    #[inline(always)]
800    #[must_use]
801    pub fn cofoa(&mut self) -> COFOA_W<10> {
802        COFOA_W::new(self)
803    }
804    #[doc = "Bits 12:13 - Counter Underflow Output Action"]
805    #[inline(always)]
806    #[must_use]
807    pub fn cufoa(&mut self) -> CUFOA_W<12> {
808        CUFOA_W::new(self)
809    }
810    #[doc = "Bits 16:19 - Compare/Capture Channel PRS Input Channel Selection"]
811    #[inline(always)]
812    #[must_use]
813    pub fn prssel(&mut self) -> PRSSEL_W<16> {
814        PRSSEL_W::new(self)
815    }
816    #[doc = "Bits 24:25 - Input Capture Edge Select"]
817    #[inline(always)]
818    #[must_use]
819    pub fn icedge(&mut self) -> ICEDGE_W<24> {
820        ICEDGE_W::new(self)
821    }
822    #[doc = "Bits 26:27 - Input Capture Event Control"]
823    #[inline(always)]
824    #[must_use]
825    pub fn icevctrl(&mut self) -> ICEVCTRL_W<26> {
826        ICEVCTRL_W::new(self)
827    }
828    #[doc = "Bit 28 - PRS Configuration"]
829    #[inline(always)]
830    #[must_use]
831    pub fn prsconf(&mut self) -> PRSCONF_W<28> {
832        PRSCONF_W::new(self)
833    }
834    #[doc = "Bit 29 - Input Selection"]
835    #[inline(always)]
836    #[must_use]
837    pub fn insel(&mut self) -> INSEL_W<29> {
838        INSEL_W::new(self)
839    }
840    #[doc = "Bit 30 - Digital Filter"]
841    #[inline(always)]
842    #[must_use]
843    pub fn filt(&mut self) -> FILT_W<30> {
844        FILT_W::new(self)
845    }
846    #[doc = "Writes raw bits to the register."]
847    #[inline(always)]
848    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
849        self.0.bits(bits);
850        self
851    }
852}
853#[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 [cc0_ctrl](index.html) module"]
854pub struct CC0_CTRL_SPEC;
855impl crate::RegisterSpec for CC0_CTRL_SPEC {
856    type Ux = u32;
857}
858#[doc = "`read()` method returns [cc0_ctrl::R](R) reader structure"]
859impl crate::Readable for CC0_CTRL_SPEC {
860    type Reader = R;
861}
862#[doc = "`write(|w| ..)` method takes [cc0_ctrl::W](W) writer structure"]
863impl crate::Writable for CC0_CTRL_SPEC {
864    type Writer = W;
865    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
866    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
867}
868#[doc = "`reset()` method sets CC0_CTRL to value 0"]
869impl crate::Resettable for CC0_CTRL_SPEC {
870    const RESET_VALUE: Self::Ux = 0;
871}