Skip to main content

atsamd21e18a/tcc0/
evctrl.rs

1#[doc = "Reader of register EVCTRL"]
2pub type R = crate::R<u32, super::EVCTRL>;
3#[doc = "Writer for register EVCTRL"]
4pub type W = crate::W<u32, super::EVCTRL>;
5#[doc = "Register EVCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::EVCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Timer/counter Input Event0 Action\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum EVACT0_A {
17    #[doc = "0: Event action disabled"]
18    OFF = 0,
19    #[doc = "1: Start, restart or re-trigger counter on event"]
20    RETRIGGER = 1,
21    #[doc = "2: Count on event"]
22    COUNTEV = 2,
23    #[doc = "3: Start counter on event"]
24    START = 3,
25    #[doc = "4: Increment counter on event"]
26    INC = 4,
27    #[doc = "5: Count on active state of asynchronous event"]
28    COUNT = 5,
29    #[doc = "7: Non-recoverable fault"]
30    FAULT = 7,
31}
32impl From<EVACT0_A> for u8 {
33    #[inline(always)]
34    fn from(variant: EVACT0_A) -> Self {
35        variant as _
36    }
37}
38#[doc = "Reader of field `EVACT0`"]
39pub type EVACT0_R = crate::R<u8, EVACT0_A>;
40impl EVACT0_R {
41    #[doc = r"Get enumerated values variant"]
42    #[inline(always)]
43    pub fn variant(&self) -> crate::Variant<u8, EVACT0_A> {
44        use crate::Variant::*;
45        match self.bits {
46            0 => Val(EVACT0_A::OFF),
47            1 => Val(EVACT0_A::RETRIGGER),
48            2 => Val(EVACT0_A::COUNTEV),
49            3 => Val(EVACT0_A::START),
50            4 => Val(EVACT0_A::INC),
51            5 => Val(EVACT0_A::COUNT),
52            7 => Val(EVACT0_A::FAULT),
53            i => Res(i),
54        }
55    }
56    #[doc = "Checks if the value of the field is `OFF`"]
57    #[inline(always)]
58    pub fn is_off(&self) -> bool {
59        *self == EVACT0_A::OFF
60    }
61    #[doc = "Checks if the value of the field is `RETRIGGER`"]
62    #[inline(always)]
63    pub fn is_retrigger(&self) -> bool {
64        *self == EVACT0_A::RETRIGGER
65    }
66    #[doc = "Checks if the value of the field is `COUNTEV`"]
67    #[inline(always)]
68    pub fn is_countev(&self) -> bool {
69        *self == EVACT0_A::COUNTEV
70    }
71    #[doc = "Checks if the value of the field is `START`"]
72    #[inline(always)]
73    pub fn is_start(&self) -> bool {
74        *self == EVACT0_A::START
75    }
76    #[doc = "Checks if the value of the field is `INC`"]
77    #[inline(always)]
78    pub fn is_inc(&self) -> bool {
79        *self == EVACT0_A::INC
80    }
81    #[doc = "Checks if the value of the field is `COUNT`"]
82    #[inline(always)]
83    pub fn is_count(&self) -> bool {
84        *self == EVACT0_A::COUNT
85    }
86    #[doc = "Checks if the value of the field is `FAULT`"]
87    #[inline(always)]
88    pub fn is_fault(&self) -> bool {
89        *self == EVACT0_A::FAULT
90    }
91}
92#[doc = "Write proxy for field `EVACT0`"]
93pub struct EVACT0_W<'a> {
94    w: &'a mut W,
95}
96impl<'a> EVACT0_W<'a> {
97    #[doc = r"Writes `variant` to the field"]
98    #[inline(always)]
99    pub fn variant(self, variant: EVACT0_A) -> &'a mut W {
100        unsafe { self.bits(variant.into()) }
101    }
102    #[doc = "Event action disabled"]
103    #[inline(always)]
104    pub fn off(self) -> &'a mut W {
105        self.variant(EVACT0_A::OFF)
106    }
107    #[doc = "Start, restart or re-trigger counter on event"]
108    #[inline(always)]
109    pub fn retrigger(self) -> &'a mut W {
110        self.variant(EVACT0_A::RETRIGGER)
111    }
112    #[doc = "Count on event"]
113    #[inline(always)]
114    pub fn countev(self) -> &'a mut W {
115        self.variant(EVACT0_A::COUNTEV)
116    }
117    #[doc = "Start counter on event"]
118    #[inline(always)]
119    pub fn start(self) -> &'a mut W {
120        self.variant(EVACT0_A::START)
121    }
122    #[doc = "Increment counter on event"]
123    #[inline(always)]
124    pub fn inc(self) -> &'a mut W {
125        self.variant(EVACT0_A::INC)
126    }
127    #[doc = "Count on active state of asynchronous event"]
128    #[inline(always)]
129    pub fn count(self) -> &'a mut W {
130        self.variant(EVACT0_A::COUNT)
131    }
132    #[doc = "Non-recoverable fault"]
133    #[inline(always)]
134    pub fn fault(self) -> &'a mut W {
135        self.variant(EVACT0_A::FAULT)
136    }
137    #[doc = r"Writes raw bits to the field"]
138    #[inline(always)]
139    pub unsafe fn bits(self, value: u8) -> &'a mut W {
140        self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07);
141        self.w
142    }
143}
144#[doc = "Timer/counter Input Event1 Action\n\nValue on reset: 0"]
145#[derive(Clone, Copy, Debug, PartialEq)]
146#[repr(u8)]
147pub enum EVACT1_A {
148    #[doc = "0: Event action disabled"]
149    OFF = 0,
150    #[doc = "1: Re-trigger counter on event"]
151    RETRIGGER = 1,
152    #[doc = "2: Direction control"]
153    DIR = 2,
154    #[doc = "3: Stop counter on event"]
155    STOP = 3,
156    #[doc = "4: Decrement counter on event"]
157    DEC = 4,
158    #[doc = "5: Period capture value in CC0 register, pulse width capture value in CC1 register"]
159    PPW = 5,
160    #[doc = "6: Period capture value in CC1 register, pulse width capture value in CC0 register"]
161    PWP = 6,
162    #[doc = "7: Non-recoverable fault"]
163    FAULT = 7,
164}
165impl From<EVACT1_A> for u8 {
166    #[inline(always)]
167    fn from(variant: EVACT1_A) -> Self {
168        variant as _
169    }
170}
171#[doc = "Reader of field `EVACT1`"]
172pub type EVACT1_R = crate::R<u8, EVACT1_A>;
173impl EVACT1_R {
174    #[doc = r"Get enumerated values variant"]
175    #[inline(always)]
176    pub fn variant(&self) -> EVACT1_A {
177        match self.bits {
178            0 => EVACT1_A::OFF,
179            1 => EVACT1_A::RETRIGGER,
180            2 => EVACT1_A::DIR,
181            3 => EVACT1_A::STOP,
182            4 => EVACT1_A::DEC,
183            5 => EVACT1_A::PPW,
184            6 => EVACT1_A::PWP,
185            7 => EVACT1_A::FAULT,
186            _ => unreachable!(),
187        }
188    }
189    #[doc = "Checks if the value of the field is `OFF`"]
190    #[inline(always)]
191    pub fn is_off(&self) -> bool {
192        *self == EVACT1_A::OFF
193    }
194    #[doc = "Checks if the value of the field is `RETRIGGER`"]
195    #[inline(always)]
196    pub fn is_retrigger(&self) -> bool {
197        *self == EVACT1_A::RETRIGGER
198    }
199    #[doc = "Checks if the value of the field is `DIR`"]
200    #[inline(always)]
201    pub fn is_dir(&self) -> bool {
202        *self == EVACT1_A::DIR
203    }
204    #[doc = "Checks if the value of the field is `STOP`"]
205    #[inline(always)]
206    pub fn is_stop(&self) -> bool {
207        *self == EVACT1_A::STOP
208    }
209    #[doc = "Checks if the value of the field is `DEC`"]
210    #[inline(always)]
211    pub fn is_dec(&self) -> bool {
212        *self == EVACT1_A::DEC
213    }
214    #[doc = "Checks if the value of the field is `PPW`"]
215    #[inline(always)]
216    pub fn is_ppw(&self) -> bool {
217        *self == EVACT1_A::PPW
218    }
219    #[doc = "Checks if the value of the field is `PWP`"]
220    #[inline(always)]
221    pub fn is_pwp(&self) -> bool {
222        *self == EVACT1_A::PWP
223    }
224    #[doc = "Checks if the value of the field is `FAULT`"]
225    #[inline(always)]
226    pub fn is_fault(&self) -> bool {
227        *self == EVACT1_A::FAULT
228    }
229}
230#[doc = "Write proxy for field `EVACT1`"]
231pub struct EVACT1_W<'a> {
232    w: &'a mut W,
233}
234impl<'a> EVACT1_W<'a> {
235    #[doc = r"Writes `variant` to the field"]
236    #[inline(always)]
237    pub fn variant(self, variant: EVACT1_A) -> &'a mut W {
238        {
239            self.bits(variant.into())
240        }
241    }
242    #[doc = "Event action disabled"]
243    #[inline(always)]
244    pub fn off(self) -> &'a mut W {
245        self.variant(EVACT1_A::OFF)
246    }
247    #[doc = "Re-trigger counter on event"]
248    #[inline(always)]
249    pub fn retrigger(self) -> &'a mut W {
250        self.variant(EVACT1_A::RETRIGGER)
251    }
252    #[doc = "Direction control"]
253    #[inline(always)]
254    pub fn dir(self) -> &'a mut W {
255        self.variant(EVACT1_A::DIR)
256    }
257    #[doc = "Stop counter on event"]
258    #[inline(always)]
259    pub fn stop(self) -> &'a mut W {
260        self.variant(EVACT1_A::STOP)
261    }
262    #[doc = "Decrement counter on event"]
263    #[inline(always)]
264    pub fn dec(self) -> &'a mut W {
265        self.variant(EVACT1_A::DEC)
266    }
267    #[doc = "Period capture value in CC0 register, pulse width capture value in CC1 register"]
268    #[inline(always)]
269    pub fn ppw(self) -> &'a mut W {
270        self.variant(EVACT1_A::PPW)
271    }
272    #[doc = "Period capture value in CC1 register, pulse width capture value in CC0 register"]
273    #[inline(always)]
274    pub fn pwp(self) -> &'a mut W {
275        self.variant(EVACT1_A::PWP)
276    }
277    #[doc = "Non-recoverable fault"]
278    #[inline(always)]
279    pub fn fault(self) -> &'a mut W {
280        self.variant(EVACT1_A::FAULT)
281    }
282    #[doc = r"Writes raw bits to the field"]
283    #[inline(always)]
284    pub fn bits(self, value: u8) -> &'a mut W {
285        self.w.bits = (self.w.bits & !(0x07 << 3)) | (((value as u32) & 0x07) << 3);
286        self.w
287    }
288}
289#[doc = "Timer/counter Output Event Mode\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291#[repr(u8)]
292pub enum CNTSEL_A {
293    #[doc = "0: An interrupt/event is generated when a new counter cycle starts"]
294    START = 0,
295    #[doc = "1: An interrupt/event is generated when a counter cycle ends"]
296    END = 1,
297    #[doc = "2: An interrupt/event is generated when a counter cycle ends, except for the first and last cycles"]
298    BETWEEN = 2,
299    #[doc = "3: An interrupt/event is generated when a new counter cycle starts or a counter cycle ends"]
300    BOUNDARY = 3,
301}
302impl From<CNTSEL_A> for u8 {
303    #[inline(always)]
304    fn from(variant: CNTSEL_A) -> Self {
305        variant as _
306    }
307}
308#[doc = "Reader of field `CNTSEL`"]
309pub type CNTSEL_R = crate::R<u8, CNTSEL_A>;
310impl CNTSEL_R {
311    #[doc = r"Get enumerated values variant"]
312    #[inline(always)]
313    pub fn variant(&self) -> CNTSEL_A {
314        match self.bits {
315            0 => CNTSEL_A::START,
316            1 => CNTSEL_A::END,
317            2 => CNTSEL_A::BETWEEN,
318            3 => CNTSEL_A::BOUNDARY,
319            _ => unreachable!(),
320        }
321    }
322    #[doc = "Checks if the value of the field is `START`"]
323    #[inline(always)]
324    pub fn is_start(&self) -> bool {
325        *self == CNTSEL_A::START
326    }
327    #[doc = "Checks if the value of the field is `END`"]
328    #[inline(always)]
329    pub fn is_end(&self) -> bool {
330        *self == CNTSEL_A::END
331    }
332    #[doc = "Checks if the value of the field is `BETWEEN`"]
333    #[inline(always)]
334    pub fn is_between(&self) -> bool {
335        *self == CNTSEL_A::BETWEEN
336    }
337    #[doc = "Checks if the value of the field is `BOUNDARY`"]
338    #[inline(always)]
339    pub fn is_boundary(&self) -> bool {
340        *self == CNTSEL_A::BOUNDARY
341    }
342}
343#[doc = "Write proxy for field `CNTSEL`"]
344pub struct CNTSEL_W<'a> {
345    w: &'a mut W,
346}
347impl<'a> CNTSEL_W<'a> {
348    #[doc = r"Writes `variant` to the field"]
349    #[inline(always)]
350    pub fn variant(self, variant: CNTSEL_A) -> &'a mut W {
351        {
352            self.bits(variant.into())
353        }
354    }
355    #[doc = "An interrupt/event is generated when a new counter cycle starts"]
356    #[inline(always)]
357    pub fn start(self) -> &'a mut W {
358        self.variant(CNTSEL_A::START)
359    }
360    #[doc = "An interrupt/event is generated when a counter cycle ends"]
361    #[inline(always)]
362    pub fn end(self) -> &'a mut W {
363        self.variant(CNTSEL_A::END)
364    }
365    #[doc = "An interrupt/event is generated when a counter cycle ends, except for the first and last cycles"]
366    #[inline(always)]
367    pub fn between(self) -> &'a mut W {
368        self.variant(CNTSEL_A::BETWEEN)
369    }
370    #[doc = "An interrupt/event is generated when a new counter cycle starts or a counter cycle ends"]
371    #[inline(always)]
372    pub fn boundary(self) -> &'a mut W {
373        self.variant(CNTSEL_A::BOUNDARY)
374    }
375    #[doc = r"Writes raw bits to the field"]
376    #[inline(always)]
377    pub fn bits(self, value: u8) -> &'a mut W {
378        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
379        self.w
380    }
381}
382#[doc = "Reader of field `OVFEO`"]
383pub type OVFEO_R = crate::R<bool, bool>;
384#[doc = "Write proxy for field `OVFEO`"]
385pub struct OVFEO_W<'a> {
386    w: &'a mut W,
387}
388impl<'a> OVFEO_W<'a> {
389    #[doc = r"Sets the field bit"]
390    #[inline(always)]
391    pub fn set_bit(self) -> &'a mut W {
392        self.bit(true)
393    }
394    #[doc = r"Clears the field bit"]
395    #[inline(always)]
396    pub fn clear_bit(self) -> &'a mut W {
397        self.bit(false)
398    }
399    #[doc = r"Writes raw bits to the field"]
400    #[inline(always)]
401    pub fn bit(self, value: bool) -> &'a mut W {
402        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
403        self.w
404    }
405}
406#[doc = "Reader of field `TRGEO`"]
407pub type TRGEO_R = crate::R<bool, bool>;
408#[doc = "Write proxy for field `TRGEO`"]
409pub struct TRGEO_W<'a> {
410    w: &'a mut W,
411}
412impl<'a> TRGEO_W<'a> {
413    #[doc = r"Sets the field bit"]
414    #[inline(always)]
415    pub fn set_bit(self) -> &'a mut W {
416        self.bit(true)
417    }
418    #[doc = r"Clears the field bit"]
419    #[inline(always)]
420    pub fn clear_bit(self) -> &'a mut W {
421        self.bit(false)
422    }
423    #[doc = r"Writes raw bits to the field"]
424    #[inline(always)]
425    pub fn bit(self, value: bool) -> &'a mut W {
426        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
427        self.w
428    }
429}
430#[doc = "Reader of field `CNTEO`"]
431pub type CNTEO_R = crate::R<bool, bool>;
432#[doc = "Write proxy for field `CNTEO`"]
433pub struct CNTEO_W<'a> {
434    w: &'a mut W,
435}
436impl<'a> CNTEO_W<'a> {
437    #[doc = r"Sets the field bit"]
438    #[inline(always)]
439    pub fn set_bit(self) -> &'a mut W {
440        self.bit(true)
441    }
442    #[doc = r"Clears the field bit"]
443    #[inline(always)]
444    pub fn clear_bit(self) -> &'a mut W {
445        self.bit(false)
446    }
447    #[doc = r"Writes raw bits to the field"]
448    #[inline(always)]
449    pub fn bit(self, value: bool) -> &'a mut W {
450        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
451        self.w
452    }
453}
454#[doc = "Reader of field `TCINV0`"]
455pub type TCINV0_R = crate::R<bool, bool>;
456#[doc = "Write proxy for field `TCINV0`"]
457pub struct TCINV0_W<'a> {
458    w: &'a mut W,
459}
460impl<'a> TCINV0_W<'a> {
461    #[doc = r"Sets the field bit"]
462    #[inline(always)]
463    pub fn set_bit(self) -> &'a mut W {
464        self.bit(true)
465    }
466    #[doc = r"Clears the field bit"]
467    #[inline(always)]
468    pub fn clear_bit(self) -> &'a mut W {
469        self.bit(false)
470    }
471    #[doc = r"Writes raw bits to the field"]
472    #[inline(always)]
473    pub fn bit(self, value: bool) -> &'a mut W {
474        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
475        self.w
476    }
477}
478#[doc = "Reader of field `TCINV1`"]
479pub type TCINV1_R = crate::R<bool, bool>;
480#[doc = "Write proxy for field `TCINV1`"]
481pub struct TCINV1_W<'a> {
482    w: &'a mut W,
483}
484impl<'a> TCINV1_W<'a> {
485    #[doc = r"Sets the field bit"]
486    #[inline(always)]
487    pub fn set_bit(self) -> &'a mut W {
488        self.bit(true)
489    }
490    #[doc = r"Clears the field bit"]
491    #[inline(always)]
492    pub fn clear_bit(self) -> &'a mut W {
493        self.bit(false)
494    }
495    #[doc = r"Writes raw bits to the field"]
496    #[inline(always)]
497    pub fn bit(self, value: bool) -> &'a mut W {
498        self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
499        self.w
500    }
501}
502#[doc = "Reader of field `TCEI0`"]
503pub type TCEI0_R = crate::R<bool, bool>;
504#[doc = "Write proxy for field `TCEI0`"]
505pub struct TCEI0_W<'a> {
506    w: &'a mut W,
507}
508impl<'a> TCEI0_W<'a> {
509    #[doc = r"Sets the field bit"]
510    #[inline(always)]
511    pub fn set_bit(self) -> &'a mut W {
512        self.bit(true)
513    }
514    #[doc = r"Clears the field bit"]
515    #[inline(always)]
516    pub fn clear_bit(self) -> &'a mut W {
517        self.bit(false)
518    }
519    #[doc = r"Writes raw bits to the field"]
520    #[inline(always)]
521    pub fn bit(self, value: bool) -> &'a mut W {
522        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
523        self.w
524    }
525}
526#[doc = "Reader of field `TCEI1`"]
527pub type TCEI1_R = crate::R<bool, bool>;
528#[doc = "Write proxy for field `TCEI1`"]
529pub struct TCEI1_W<'a> {
530    w: &'a mut W,
531}
532impl<'a> TCEI1_W<'a> {
533    #[doc = r"Sets the field bit"]
534    #[inline(always)]
535    pub fn set_bit(self) -> &'a mut W {
536        self.bit(true)
537    }
538    #[doc = r"Clears the field bit"]
539    #[inline(always)]
540    pub fn clear_bit(self) -> &'a mut W {
541        self.bit(false)
542    }
543    #[doc = r"Writes raw bits to the field"]
544    #[inline(always)]
545    pub fn bit(self, value: bool) -> &'a mut W {
546        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
547        self.w
548    }
549}
550#[doc = "Reader of field `MCEI0`"]
551pub type MCEI0_R = crate::R<bool, bool>;
552#[doc = "Write proxy for field `MCEI0`"]
553pub struct MCEI0_W<'a> {
554    w: &'a mut W,
555}
556impl<'a> MCEI0_W<'a> {
557    #[doc = r"Sets the field bit"]
558    #[inline(always)]
559    pub fn set_bit(self) -> &'a mut W {
560        self.bit(true)
561    }
562    #[doc = r"Clears the field bit"]
563    #[inline(always)]
564    pub fn clear_bit(self) -> &'a mut W {
565        self.bit(false)
566    }
567    #[doc = r"Writes raw bits to the field"]
568    #[inline(always)]
569    pub fn bit(self, value: bool) -> &'a mut W {
570        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
571        self.w
572    }
573}
574#[doc = "Reader of field `MCEI1`"]
575pub type MCEI1_R = crate::R<bool, bool>;
576#[doc = "Write proxy for field `MCEI1`"]
577pub struct MCEI1_W<'a> {
578    w: &'a mut W,
579}
580impl<'a> MCEI1_W<'a> {
581    #[doc = r"Sets the field bit"]
582    #[inline(always)]
583    pub fn set_bit(self) -> &'a mut W {
584        self.bit(true)
585    }
586    #[doc = r"Clears the field bit"]
587    #[inline(always)]
588    pub fn clear_bit(self) -> &'a mut W {
589        self.bit(false)
590    }
591    #[doc = r"Writes raw bits to the field"]
592    #[inline(always)]
593    pub fn bit(self, value: bool) -> &'a mut W {
594        self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
595        self.w
596    }
597}
598#[doc = "Reader of field `MCEI2`"]
599pub type MCEI2_R = crate::R<bool, bool>;
600#[doc = "Write proxy for field `MCEI2`"]
601pub struct MCEI2_W<'a> {
602    w: &'a mut W,
603}
604impl<'a> MCEI2_W<'a> {
605    #[doc = r"Sets the field bit"]
606    #[inline(always)]
607    pub fn set_bit(self) -> &'a mut W {
608        self.bit(true)
609    }
610    #[doc = r"Clears the field bit"]
611    #[inline(always)]
612    pub fn clear_bit(self) -> &'a mut W {
613        self.bit(false)
614    }
615    #[doc = r"Writes raw bits to the field"]
616    #[inline(always)]
617    pub fn bit(self, value: bool) -> &'a mut W {
618        self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18);
619        self.w
620    }
621}
622#[doc = "Reader of field `MCEI3`"]
623pub type MCEI3_R = crate::R<bool, bool>;
624#[doc = "Write proxy for field `MCEI3`"]
625pub struct MCEI3_W<'a> {
626    w: &'a mut W,
627}
628impl<'a> MCEI3_W<'a> {
629    #[doc = r"Sets the field bit"]
630    #[inline(always)]
631    pub fn set_bit(self) -> &'a mut W {
632        self.bit(true)
633    }
634    #[doc = r"Clears the field bit"]
635    #[inline(always)]
636    pub fn clear_bit(self) -> &'a mut W {
637        self.bit(false)
638    }
639    #[doc = r"Writes raw bits to the field"]
640    #[inline(always)]
641    pub fn bit(self, value: bool) -> &'a mut W {
642        self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
643        self.w
644    }
645}
646#[doc = "Reader of field `MCEO0`"]
647pub type MCEO0_R = crate::R<bool, bool>;
648#[doc = "Write proxy for field `MCEO0`"]
649pub struct MCEO0_W<'a> {
650    w: &'a mut W,
651}
652impl<'a> MCEO0_W<'a> {
653    #[doc = r"Sets the field bit"]
654    #[inline(always)]
655    pub fn set_bit(self) -> &'a mut W {
656        self.bit(true)
657    }
658    #[doc = r"Clears the field bit"]
659    #[inline(always)]
660    pub fn clear_bit(self) -> &'a mut W {
661        self.bit(false)
662    }
663    #[doc = r"Writes raw bits to the field"]
664    #[inline(always)]
665    pub fn bit(self, value: bool) -> &'a mut W {
666        self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
667        self.w
668    }
669}
670#[doc = "Reader of field `MCEO1`"]
671pub type MCEO1_R = crate::R<bool, bool>;
672#[doc = "Write proxy for field `MCEO1`"]
673pub struct MCEO1_W<'a> {
674    w: &'a mut W,
675}
676impl<'a> MCEO1_W<'a> {
677    #[doc = r"Sets the field bit"]
678    #[inline(always)]
679    pub fn set_bit(self) -> &'a mut W {
680        self.bit(true)
681    }
682    #[doc = r"Clears the field bit"]
683    #[inline(always)]
684    pub fn clear_bit(self) -> &'a mut W {
685        self.bit(false)
686    }
687    #[doc = r"Writes raw bits to the field"]
688    #[inline(always)]
689    pub fn bit(self, value: bool) -> &'a mut W {
690        self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25);
691        self.w
692    }
693}
694#[doc = "Reader of field `MCEO2`"]
695pub type MCEO2_R = crate::R<bool, bool>;
696#[doc = "Write proxy for field `MCEO2`"]
697pub struct MCEO2_W<'a> {
698    w: &'a mut W,
699}
700impl<'a> MCEO2_W<'a> {
701    #[doc = r"Sets the field bit"]
702    #[inline(always)]
703    pub fn set_bit(self) -> &'a mut W {
704        self.bit(true)
705    }
706    #[doc = r"Clears the field bit"]
707    #[inline(always)]
708    pub fn clear_bit(self) -> &'a mut W {
709        self.bit(false)
710    }
711    #[doc = r"Writes raw bits to the field"]
712    #[inline(always)]
713    pub fn bit(self, value: bool) -> &'a mut W {
714        self.w.bits = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26);
715        self.w
716    }
717}
718#[doc = "Reader of field `MCEO3`"]
719pub type MCEO3_R = crate::R<bool, bool>;
720#[doc = "Write proxy for field `MCEO3`"]
721pub struct MCEO3_W<'a> {
722    w: &'a mut W,
723}
724impl<'a> MCEO3_W<'a> {
725    #[doc = r"Sets the field bit"]
726    #[inline(always)]
727    pub fn set_bit(self) -> &'a mut W {
728        self.bit(true)
729    }
730    #[doc = r"Clears the field bit"]
731    #[inline(always)]
732    pub fn clear_bit(self) -> &'a mut W {
733        self.bit(false)
734    }
735    #[doc = r"Writes raw bits to the field"]
736    #[inline(always)]
737    pub fn bit(self, value: bool) -> &'a mut W {
738        self.w.bits = (self.w.bits & !(0x01 << 27)) | (((value as u32) & 0x01) << 27);
739        self.w
740    }
741}
742impl R {
743    #[doc = "Bits 0:2 - Timer/counter Input Event0 Action"]
744    #[inline(always)]
745    pub fn evact0(&self) -> EVACT0_R {
746        EVACT0_R::new((self.bits & 0x07) as u8)
747    }
748    #[doc = "Bits 3:5 - Timer/counter Input Event1 Action"]
749    #[inline(always)]
750    pub fn evact1(&self) -> EVACT1_R {
751        EVACT1_R::new(((self.bits >> 3) & 0x07) as u8)
752    }
753    #[doc = "Bits 6:7 - Timer/counter Output Event Mode"]
754    #[inline(always)]
755    pub fn cntsel(&self) -> CNTSEL_R {
756        CNTSEL_R::new(((self.bits >> 6) & 0x03) as u8)
757    }
758    #[doc = "Bit 8 - Overflow/Underflow Output Event Enable"]
759    #[inline(always)]
760    pub fn ovfeo(&self) -> OVFEO_R {
761        OVFEO_R::new(((self.bits >> 8) & 0x01) != 0)
762    }
763    #[doc = "Bit 9 - Retrigger Output Event Enable"]
764    #[inline(always)]
765    pub fn trgeo(&self) -> TRGEO_R {
766        TRGEO_R::new(((self.bits >> 9) & 0x01) != 0)
767    }
768    #[doc = "Bit 10 - Timer/counter Output Event Enable"]
769    #[inline(always)]
770    pub fn cnteo(&self) -> CNTEO_R {
771        CNTEO_R::new(((self.bits >> 10) & 0x01) != 0)
772    }
773    #[doc = "Bit 12 - Inverted Event 0 Input Enable"]
774    #[inline(always)]
775    pub fn tcinv0(&self) -> TCINV0_R {
776        TCINV0_R::new(((self.bits >> 12) & 0x01) != 0)
777    }
778    #[doc = "Bit 13 - Inverted Event 1 Input Enable"]
779    #[inline(always)]
780    pub fn tcinv1(&self) -> TCINV1_R {
781        TCINV1_R::new(((self.bits >> 13) & 0x01) != 0)
782    }
783    #[doc = "Bit 14 - Timer/counter Event 0 Input Enable"]
784    #[inline(always)]
785    pub fn tcei0(&self) -> TCEI0_R {
786        TCEI0_R::new(((self.bits >> 14) & 0x01) != 0)
787    }
788    #[doc = "Bit 15 - Timer/counter Event 1 Input Enable"]
789    #[inline(always)]
790    pub fn tcei1(&self) -> TCEI1_R {
791        TCEI1_R::new(((self.bits >> 15) & 0x01) != 0)
792    }
793    #[doc = "Bit 16 - Match or Capture Channel 0 Event Input Enable"]
794    #[inline(always)]
795    pub fn mcei0(&self) -> MCEI0_R {
796        MCEI0_R::new(((self.bits >> 16) & 0x01) != 0)
797    }
798    #[doc = "Bit 17 - Match or Capture Channel 1 Event Input Enable"]
799    #[inline(always)]
800    pub fn mcei1(&self) -> MCEI1_R {
801        MCEI1_R::new(((self.bits >> 17) & 0x01) != 0)
802    }
803    #[doc = "Bit 18 - Match or Capture Channel 2 Event Input Enable"]
804    #[inline(always)]
805    pub fn mcei2(&self) -> MCEI2_R {
806        MCEI2_R::new(((self.bits >> 18) & 0x01) != 0)
807    }
808    #[doc = "Bit 19 - Match or Capture Channel 3 Event Input Enable"]
809    #[inline(always)]
810    pub fn mcei3(&self) -> MCEI3_R {
811        MCEI3_R::new(((self.bits >> 19) & 0x01) != 0)
812    }
813    #[doc = "Bit 24 - Match or Capture Channel 0 Event Output Enable"]
814    #[inline(always)]
815    pub fn mceo0(&self) -> MCEO0_R {
816        MCEO0_R::new(((self.bits >> 24) & 0x01) != 0)
817    }
818    #[doc = "Bit 25 - Match or Capture Channel 1 Event Output Enable"]
819    #[inline(always)]
820    pub fn mceo1(&self) -> MCEO1_R {
821        MCEO1_R::new(((self.bits >> 25) & 0x01) != 0)
822    }
823    #[doc = "Bit 26 - Match or Capture Channel 2 Event Output Enable"]
824    #[inline(always)]
825    pub fn mceo2(&self) -> MCEO2_R {
826        MCEO2_R::new(((self.bits >> 26) & 0x01) != 0)
827    }
828    #[doc = "Bit 27 - Match or Capture Channel 3 Event Output Enable"]
829    #[inline(always)]
830    pub fn mceo3(&self) -> MCEO3_R {
831        MCEO3_R::new(((self.bits >> 27) & 0x01) != 0)
832    }
833}
834impl W {
835    #[doc = "Bits 0:2 - Timer/counter Input Event0 Action"]
836    #[inline(always)]
837    pub fn evact0(&mut self) -> EVACT0_W {
838        EVACT0_W { w: self }
839    }
840    #[doc = "Bits 3:5 - Timer/counter Input Event1 Action"]
841    #[inline(always)]
842    pub fn evact1(&mut self) -> EVACT1_W {
843        EVACT1_W { w: self }
844    }
845    #[doc = "Bits 6:7 - Timer/counter Output Event Mode"]
846    #[inline(always)]
847    pub fn cntsel(&mut self) -> CNTSEL_W {
848        CNTSEL_W { w: self }
849    }
850    #[doc = "Bit 8 - Overflow/Underflow Output Event Enable"]
851    #[inline(always)]
852    pub fn ovfeo(&mut self) -> OVFEO_W {
853        OVFEO_W { w: self }
854    }
855    #[doc = "Bit 9 - Retrigger Output Event Enable"]
856    #[inline(always)]
857    pub fn trgeo(&mut self) -> TRGEO_W {
858        TRGEO_W { w: self }
859    }
860    #[doc = "Bit 10 - Timer/counter Output Event Enable"]
861    #[inline(always)]
862    pub fn cnteo(&mut self) -> CNTEO_W {
863        CNTEO_W { w: self }
864    }
865    #[doc = "Bit 12 - Inverted Event 0 Input Enable"]
866    #[inline(always)]
867    pub fn tcinv0(&mut self) -> TCINV0_W {
868        TCINV0_W { w: self }
869    }
870    #[doc = "Bit 13 - Inverted Event 1 Input Enable"]
871    #[inline(always)]
872    pub fn tcinv1(&mut self) -> TCINV1_W {
873        TCINV1_W { w: self }
874    }
875    #[doc = "Bit 14 - Timer/counter Event 0 Input Enable"]
876    #[inline(always)]
877    pub fn tcei0(&mut self) -> TCEI0_W {
878        TCEI0_W { w: self }
879    }
880    #[doc = "Bit 15 - Timer/counter Event 1 Input Enable"]
881    #[inline(always)]
882    pub fn tcei1(&mut self) -> TCEI1_W {
883        TCEI1_W { w: self }
884    }
885    #[doc = "Bit 16 - Match or Capture Channel 0 Event Input Enable"]
886    #[inline(always)]
887    pub fn mcei0(&mut self) -> MCEI0_W {
888        MCEI0_W { w: self }
889    }
890    #[doc = "Bit 17 - Match or Capture Channel 1 Event Input Enable"]
891    #[inline(always)]
892    pub fn mcei1(&mut self) -> MCEI1_W {
893        MCEI1_W { w: self }
894    }
895    #[doc = "Bit 18 - Match or Capture Channel 2 Event Input Enable"]
896    #[inline(always)]
897    pub fn mcei2(&mut self) -> MCEI2_W {
898        MCEI2_W { w: self }
899    }
900    #[doc = "Bit 19 - Match or Capture Channel 3 Event Input Enable"]
901    #[inline(always)]
902    pub fn mcei3(&mut self) -> MCEI3_W {
903        MCEI3_W { w: self }
904    }
905    #[doc = "Bit 24 - Match or Capture Channel 0 Event Output Enable"]
906    #[inline(always)]
907    pub fn mceo0(&mut self) -> MCEO0_W {
908        MCEO0_W { w: self }
909    }
910    #[doc = "Bit 25 - Match or Capture Channel 1 Event Output Enable"]
911    #[inline(always)]
912    pub fn mceo1(&mut self) -> MCEO1_W {
913        MCEO1_W { w: self }
914    }
915    #[doc = "Bit 26 - Match or Capture Channel 2 Event Output Enable"]
916    #[inline(always)]
917    pub fn mceo2(&mut self) -> MCEO2_W {
918        MCEO2_W { w: self }
919    }
920    #[doc = "Bit 27 - Match or Capture Channel 3 Event Output Enable"]
921    #[inline(always)]
922    pub fn mceo3(&mut self) -> MCEO3_W {
923        MCEO3_W { w: self }
924    }
925}