efm32wg230_pac/timer1/
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}
386impl From<PRSSEL_A> for u8 {
387    #[inline(always)]
388    fn from(variant: PRSSEL_A) -> Self {
389        variant as _
390    }
391}
392#[doc = "Field `PRSSEL` reader - Compare/Capture Channel PRS Input Channel Selection"]
393pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
394impl PRSSEL_R {
395    #[doc = "Get enumerated values variant"]
396    #[inline(always)]
397    pub fn variant(&self) -> Option<PRSSEL_A> {
398        match self.bits {
399            0 => Some(PRSSEL_A::PRSCH0),
400            1 => Some(PRSSEL_A::PRSCH1),
401            2 => Some(PRSSEL_A::PRSCH2),
402            3 => Some(PRSSEL_A::PRSCH3),
403            4 => Some(PRSSEL_A::PRSCH4),
404            5 => Some(PRSSEL_A::PRSCH5),
405            6 => Some(PRSSEL_A::PRSCH6),
406            7 => Some(PRSSEL_A::PRSCH7),
407            8 => Some(PRSSEL_A::PRSCH8),
408            9 => Some(PRSSEL_A::PRSCH9),
409            10 => Some(PRSSEL_A::PRSCH10),
410            11 => Some(PRSSEL_A::PRSCH11),
411            _ => None,
412        }
413    }
414    #[doc = "Checks if the value of the field is `PRSCH0`"]
415    #[inline(always)]
416    pub fn is_prsch0(&self) -> bool {
417        *self == PRSSEL_A::PRSCH0
418    }
419    #[doc = "Checks if the value of the field is `PRSCH1`"]
420    #[inline(always)]
421    pub fn is_prsch1(&self) -> bool {
422        *self == PRSSEL_A::PRSCH1
423    }
424    #[doc = "Checks if the value of the field is `PRSCH2`"]
425    #[inline(always)]
426    pub fn is_prsch2(&self) -> bool {
427        *self == PRSSEL_A::PRSCH2
428    }
429    #[doc = "Checks if the value of the field is `PRSCH3`"]
430    #[inline(always)]
431    pub fn is_prsch3(&self) -> bool {
432        *self == PRSSEL_A::PRSCH3
433    }
434    #[doc = "Checks if the value of the field is `PRSCH4`"]
435    #[inline(always)]
436    pub fn is_prsch4(&self) -> bool {
437        *self == PRSSEL_A::PRSCH4
438    }
439    #[doc = "Checks if the value of the field is `PRSCH5`"]
440    #[inline(always)]
441    pub fn is_prsch5(&self) -> bool {
442        *self == PRSSEL_A::PRSCH5
443    }
444    #[doc = "Checks if the value of the field is `PRSCH6`"]
445    #[inline(always)]
446    pub fn is_prsch6(&self) -> bool {
447        *self == PRSSEL_A::PRSCH6
448    }
449    #[doc = "Checks if the value of the field is `PRSCH7`"]
450    #[inline(always)]
451    pub fn is_prsch7(&self) -> bool {
452        *self == PRSSEL_A::PRSCH7
453    }
454    #[doc = "Checks if the value of the field is `PRSCH8`"]
455    #[inline(always)]
456    pub fn is_prsch8(&self) -> bool {
457        *self == PRSSEL_A::PRSCH8
458    }
459    #[doc = "Checks if the value of the field is `PRSCH9`"]
460    #[inline(always)]
461    pub fn is_prsch9(&self) -> bool {
462        *self == PRSSEL_A::PRSCH9
463    }
464    #[doc = "Checks if the value of the field is `PRSCH10`"]
465    #[inline(always)]
466    pub fn is_prsch10(&self) -> bool {
467        *self == PRSSEL_A::PRSCH10
468    }
469    #[doc = "Checks if the value of the field is `PRSCH11`"]
470    #[inline(always)]
471    pub fn is_prsch11(&self) -> bool {
472        *self == PRSSEL_A::PRSCH11
473    }
474}
475#[doc = "Field `PRSSEL` writer - Compare/Capture Channel PRS Input Channel Selection"]
476pub type PRSSEL_W<'a> = crate::FieldWriter<'a, u32, CC2_CTRL_SPEC, u8, PRSSEL_A, 4, 16>;
477impl<'a> PRSSEL_W<'a> {
478    #[doc = "PRS Channel 0 selected as input"]
479    #[inline(always)]
480    pub fn prsch0(self) -> &'a mut W {
481        self.variant(PRSSEL_A::PRSCH0)
482    }
483    #[doc = "PRS Channel 1 selected as input"]
484    #[inline(always)]
485    pub fn prsch1(self) -> &'a mut W {
486        self.variant(PRSSEL_A::PRSCH1)
487    }
488    #[doc = "PRS Channel 2 selected as input"]
489    #[inline(always)]
490    pub fn prsch2(self) -> &'a mut W {
491        self.variant(PRSSEL_A::PRSCH2)
492    }
493    #[doc = "PRS Channel 3 selected as input"]
494    #[inline(always)]
495    pub fn prsch3(self) -> &'a mut W {
496        self.variant(PRSSEL_A::PRSCH3)
497    }
498    #[doc = "PRS Channel 4 selected as input"]
499    #[inline(always)]
500    pub fn prsch4(self) -> &'a mut W {
501        self.variant(PRSSEL_A::PRSCH4)
502    }
503    #[doc = "PRS Channel 5 selected as input"]
504    #[inline(always)]
505    pub fn prsch5(self) -> &'a mut W {
506        self.variant(PRSSEL_A::PRSCH5)
507    }
508    #[doc = "PRS Channel 6 selected as input"]
509    #[inline(always)]
510    pub fn prsch6(self) -> &'a mut W {
511        self.variant(PRSSEL_A::PRSCH6)
512    }
513    #[doc = "PRS Channel 7 selected as input"]
514    #[inline(always)]
515    pub fn prsch7(self) -> &'a mut W {
516        self.variant(PRSSEL_A::PRSCH7)
517    }
518    #[doc = "PRS Channel 8 selected as input"]
519    #[inline(always)]
520    pub fn prsch8(self) -> &'a mut W {
521        self.variant(PRSSEL_A::PRSCH8)
522    }
523    #[doc = "PRS Channel 9 selected as input"]
524    #[inline(always)]
525    pub fn prsch9(self) -> &'a mut W {
526        self.variant(PRSSEL_A::PRSCH9)
527    }
528    #[doc = "PRS Channel 10 selected as input"]
529    #[inline(always)]
530    pub fn prsch10(self) -> &'a mut W {
531        self.variant(PRSSEL_A::PRSCH10)
532    }
533    #[doc = "PRS Channel 11 selected as input"]
534    #[inline(always)]
535    pub fn prsch11(self) -> &'a mut W {
536        self.variant(PRSSEL_A::PRSCH11)
537    }
538}
539#[doc = "Field `INSEL` reader - Input Selection"]
540pub type INSEL_R = crate::BitReader<bool>;
541#[doc = "Field `INSEL` writer - Input Selection"]
542pub type INSEL_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 20>;
543#[doc = "Field `FILT` reader - Digital Filter"]
544pub type FILT_R = crate::BitReader<bool>;
545#[doc = "Field `FILT` writer - Digital Filter"]
546pub type FILT_W<'a> = crate::BitWriter<'a, u32, CC2_CTRL_SPEC, bool, 21>;
547#[doc = "Input Capture Edge Select\n\nValue on reset: 0"]
548#[derive(Clone, Copy, Debug, PartialEq)]
549#[repr(u8)]
550pub enum ICEDGE_A {
551    #[doc = "0: Rising edges detected"]
552    RISING = 0,
553    #[doc = "1: Falling edges detected"]
554    FALLING = 1,
555    #[doc = "2: Both edges detected"]
556    BOTH = 2,
557    #[doc = "3: No edge detection, signal is left as it is"]
558    NONE = 3,
559}
560impl From<ICEDGE_A> for u8 {
561    #[inline(always)]
562    fn from(variant: ICEDGE_A) -> Self {
563        variant as _
564    }
565}
566#[doc = "Field `ICEDGE` reader - Input Capture Edge Select"]
567pub type ICEDGE_R = crate::FieldReader<u8, ICEDGE_A>;
568impl ICEDGE_R {
569    #[doc = "Get enumerated values variant"]
570    #[inline(always)]
571    pub fn variant(&self) -> ICEDGE_A {
572        match self.bits {
573            0 => ICEDGE_A::RISING,
574            1 => ICEDGE_A::FALLING,
575            2 => ICEDGE_A::BOTH,
576            3 => ICEDGE_A::NONE,
577            _ => unreachable!(),
578        }
579    }
580    #[doc = "Checks if the value of the field is `RISING`"]
581    #[inline(always)]
582    pub fn is_rising(&self) -> bool {
583        *self == ICEDGE_A::RISING
584    }
585    #[doc = "Checks if the value of the field is `FALLING`"]
586    #[inline(always)]
587    pub fn is_falling(&self) -> bool {
588        *self == ICEDGE_A::FALLING
589    }
590    #[doc = "Checks if the value of the field is `BOTH`"]
591    #[inline(always)]
592    pub fn is_both(&self) -> bool {
593        *self == ICEDGE_A::BOTH
594    }
595    #[doc = "Checks if the value of the field is `NONE`"]
596    #[inline(always)]
597    pub fn is_none(&self) -> bool {
598        *self == ICEDGE_A::NONE
599    }
600}
601#[doc = "Field `ICEDGE` writer - Input Capture Edge Select"]
602pub type ICEDGE_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, ICEDGE_A, 2, 24>;
603impl<'a> ICEDGE_W<'a> {
604    #[doc = "Rising edges detected"]
605    #[inline(always)]
606    pub fn rising(self) -> &'a mut W {
607        self.variant(ICEDGE_A::RISING)
608    }
609    #[doc = "Falling edges detected"]
610    #[inline(always)]
611    pub fn falling(self) -> &'a mut W {
612        self.variant(ICEDGE_A::FALLING)
613    }
614    #[doc = "Both edges detected"]
615    #[inline(always)]
616    pub fn both(self) -> &'a mut W {
617        self.variant(ICEDGE_A::BOTH)
618    }
619    #[doc = "No edge detection, signal is left as it is"]
620    #[inline(always)]
621    pub fn none(self) -> &'a mut W {
622        self.variant(ICEDGE_A::NONE)
623    }
624}
625#[doc = "Input Capture Event Control\n\nValue on reset: 0"]
626#[derive(Clone, Copy, Debug, PartialEq)]
627#[repr(u8)]
628pub enum ICEVCTRL_A {
629    #[doc = "0: PRS output pulse, interrupt flag and DMA request set on every capture"]
630    EVERYEDGE = 0,
631    #[doc = "1: PRS output pulse, interrupt flag and DMA request set on every second capture"]
632    EVERYSECONDEDGE = 1,
633    #[doc = "2: PRS output pulse, interrupt flag and DMA request set on rising edge only (if ICEDGE = BOTH)"]
634    RISING = 2,
635    #[doc = "3: PRS output pulse, interrupt flag and DMA request set on falling edge only (if ICEDGE = BOTH)"]
636    FALLING = 3,
637}
638impl From<ICEVCTRL_A> for u8 {
639    #[inline(always)]
640    fn from(variant: ICEVCTRL_A) -> Self {
641        variant as _
642    }
643}
644#[doc = "Field `ICEVCTRL` reader - Input Capture Event Control"]
645pub type ICEVCTRL_R = crate::FieldReader<u8, ICEVCTRL_A>;
646impl ICEVCTRL_R {
647    #[doc = "Get enumerated values variant"]
648    #[inline(always)]
649    pub fn variant(&self) -> ICEVCTRL_A {
650        match self.bits {
651            0 => ICEVCTRL_A::EVERYEDGE,
652            1 => ICEVCTRL_A::EVERYSECONDEDGE,
653            2 => ICEVCTRL_A::RISING,
654            3 => ICEVCTRL_A::FALLING,
655            _ => unreachable!(),
656        }
657    }
658    #[doc = "Checks if the value of the field is `EVERYEDGE`"]
659    #[inline(always)]
660    pub fn is_everyedge(&self) -> bool {
661        *self == ICEVCTRL_A::EVERYEDGE
662    }
663    #[doc = "Checks if the value of the field is `EVERYSECONDEDGE`"]
664    #[inline(always)]
665    pub fn is_everysecondedge(&self) -> bool {
666        *self == ICEVCTRL_A::EVERYSECONDEDGE
667    }
668    #[doc = "Checks if the value of the field is `RISING`"]
669    #[inline(always)]
670    pub fn is_rising(&self) -> bool {
671        *self == ICEVCTRL_A::RISING
672    }
673    #[doc = "Checks if the value of the field is `FALLING`"]
674    #[inline(always)]
675    pub fn is_falling(&self) -> bool {
676        *self == ICEVCTRL_A::FALLING
677    }
678}
679#[doc = "Field `ICEVCTRL` writer - Input Capture Event Control"]
680pub type ICEVCTRL_W<'a> = crate::FieldWriterSafe<'a, u32, CC2_CTRL_SPEC, u8, ICEVCTRL_A, 2, 26>;
681impl<'a> ICEVCTRL_W<'a> {
682    #[doc = "PRS output pulse, interrupt flag and DMA request set on every capture"]
683    #[inline(always)]
684    pub fn everyedge(self) -> &'a mut W {
685        self.variant(ICEVCTRL_A::EVERYEDGE)
686    }
687    #[doc = "PRS output pulse, interrupt flag and DMA request set on every second capture"]
688    #[inline(always)]
689    pub fn everysecondedge(self) -> &'a mut W {
690        self.variant(ICEVCTRL_A::EVERYSECONDEDGE)
691    }
692    #[doc = "PRS output pulse, interrupt flag and DMA request set on rising edge only (if ICEDGE = BOTH)"]
693    #[inline(always)]
694    pub fn rising(self) -> &'a mut W {
695        self.variant(ICEVCTRL_A::RISING)
696    }
697    #[doc = "PRS output pulse, interrupt flag and DMA request set on falling edge only (if ICEDGE = BOTH)"]
698    #[inline(always)]
699    pub fn falling(self) -> &'a mut W {
700        self.variant(ICEVCTRL_A::FALLING)
701    }
702}
703impl R {
704    #[doc = "Bits 0:1 - CC Channel Mode"]
705    #[inline(always)]
706    pub fn mode(&self) -> MODE_R {
707        MODE_R::new((self.bits & 3) as u8)
708    }
709    #[doc = "Bit 2 - Output Invert"]
710    #[inline(always)]
711    pub fn outinv(&self) -> OUTINV_R {
712        OUTINV_R::new(((self.bits >> 2) & 1) != 0)
713    }
714    #[doc = "Bit 4 - Compare Output Initial State"]
715    #[inline(always)]
716    pub fn coist(&self) -> COIST_R {
717        COIST_R::new(((self.bits >> 4) & 1) != 0)
718    }
719    #[doc = "Bits 8:9 - Compare Match Output Action"]
720    #[inline(always)]
721    pub fn cmoa(&self) -> CMOA_R {
722        CMOA_R::new(((self.bits >> 8) & 3) as u8)
723    }
724    #[doc = "Bits 10:11 - Counter Overflow Output Action"]
725    #[inline(always)]
726    pub fn cofoa(&self) -> COFOA_R {
727        COFOA_R::new(((self.bits >> 10) & 3) as u8)
728    }
729    #[doc = "Bits 12:13 - Counter Underflow Output Action"]
730    #[inline(always)]
731    pub fn cufoa(&self) -> CUFOA_R {
732        CUFOA_R::new(((self.bits >> 12) & 3) as u8)
733    }
734    #[doc = "Bits 16:19 - Compare/Capture Channel PRS Input Channel Selection"]
735    #[inline(always)]
736    pub fn prssel(&self) -> PRSSEL_R {
737        PRSSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
738    }
739    #[doc = "Bit 20 - Input Selection"]
740    #[inline(always)]
741    pub fn insel(&self) -> INSEL_R {
742        INSEL_R::new(((self.bits >> 20) & 1) != 0)
743    }
744    #[doc = "Bit 21 - Digital Filter"]
745    #[inline(always)]
746    pub fn filt(&self) -> FILT_R {
747        FILT_R::new(((self.bits >> 21) & 1) != 0)
748    }
749    #[doc = "Bits 24:25 - Input Capture Edge Select"]
750    #[inline(always)]
751    pub fn icedge(&self) -> ICEDGE_R {
752        ICEDGE_R::new(((self.bits >> 24) & 3) as u8)
753    }
754    #[doc = "Bits 26:27 - Input Capture Event Control"]
755    #[inline(always)]
756    pub fn icevctrl(&self) -> ICEVCTRL_R {
757        ICEVCTRL_R::new(((self.bits >> 26) & 3) as u8)
758    }
759}
760impl W {
761    #[doc = "Bits 0:1 - CC Channel Mode"]
762    #[inline(always)]
763    pub fn mode(&mut self) -> MODE_W {
764        MODE_W::new(self)
765    }
766    #[doc = "Bit 2 - Output Invert"]
767    #[inline(always)]
768    pub fn outinv(&mut self) -> OUTINV_W {
769        OUTINV_W::new(self)
770    }
771    #[doc = "Bit 4 - Compare Output Initial State"]
772    #[inline(always)]
773    pub fn coist(&mut self) -> COIST_W {
774        COIST_W::new(self)
775    }
776    #[doc = "Bits 8:9 - Compare Match Output Action"]
777    #[inline(always)]
778    pub fn cmoa(&mut self) -> CMOA_W {
779        CMOA_W::new(self)
780    }
781    #[doc = "Bits 10:11 - Counter Overflow Output Action"]
782    #[inline(always)]
783    pub fn cofoa(&mut self) -> COFOA_W {
784        COFOA_W::new(self)
785    }
786    #[doc = "Bits 12:13 - Counter Underflow Output Action"]
787    #[inline(always)]
788    pub fn cufoa(&mut self) -> CUFOA_W {
789        CUFOA_W::new(self)
790    }
791    #[doc = "Bits 16:19 - Compare/Capture Channel PRS Input Channel Selection"]
792    #[inline(always)]
793    pub fn prssel(&mut self) -> PRSSEL_W {
794        PRSSEL_W::new(self)
795    }
796    #[doc = "Bit 20 - Input Selection"]
797    #[inline(always)]
798    pub fn insel(&mut self) -> INSEL_W {
799        INSEL_W::new(self)
800    }
801    #[doc = "Bit 21 - Digital Filter"]
802    #[inline(always)]
803    pub fn filt(&mut self) -> FILT_W {
804        FILT_W::new(self)
805    }
806    #[doc = "Bits 24:25 - Input Capture Edge Select"]
807    #[inline(always)]
808    pub fn icedge(&mut self) -> ICEDGE_W {
809        ICEDGE_W::new(self)
810    }
811    #[doc = "Bits 26:27 - Input Capture Event Control"]
812    #[inline(always)]
813    pub fn icevctrl(&mut self) -> ICEVCTRL_W {
814        ICEVCTRL_W::new(self)
815    }
816    #[doc = "Writes raw bits to the register."]
817    #[inline(always)]
818    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
819        self.0.bits(bits);
820        self
821    }
822}
823#[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"]
824pub struct CC2_CTRL_SPEC;
825impl crate::RegisterSpec for CC2_CTRL_SPEC {
826    type Ux = u32;
827}
828#[doc = "`read()` method returns [cc2_ctrl::R](R) reader structure"]
829impl crate::Readable for CC2_CTRL_SPEC {
830    type Reader = R;
831}
832#[doc = "`write(|w| ..)` method takes [cc2_ctrl::W](W) writer structure"]
833impl crate::Writable for CC2_CTRL_SPEC {
834    type Writer = W;
835}
836#[doc = "`reset()` method sets CC2_CTRL to value 0"]
837impl crate::Resettable for CC2_CTRL_SPEC {
838    #[inline(always)]
839    fn reset_value() -> Self::Ux {
840        0
841    }
842}