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}
462impl From<PRSSEL_A> for u8 {
463 #[inline(always)]
464 fn from(variant: PRSSEL_A) -> Self {
465 variant as _
466 }
467}
468#[doc = "Reader of field `PRSSEL`"]
469pub type PRSSEL_R = crate::R<u8, PRSSEL_A>;
470impl PRSSEL_R {
471 #[doc = r"Get enumerated values variant"]
472 #[inline(always)]
473 pub fn variant(&self) -> crate::Variant<u8, PRSSEL_A> {
474 use crate::Variant::*;
475 match self.bits {
476 0 => Val(PRSSEL_A::PRSCH0),
477 1 => Val(PRSSEL_A::PRSCH1),
478 2 => Val(PRSSEL_A::PRSCH2),
479 3 => Val(PRSSEL_A::PRSCH3),
480 4 => Val(PRSSEL_A::PRSCH4),
481 5 => Val(PRSSEL_A::PRSCH5),
482 6 => Val(PRSSEL_A::PRSCH6),
483 7 => Val(PRSSEL_A::PRSCH7),
484 8 => Val(PRSSEL_A::PRSCH8),
485 9 => Val(PRSSEL_A::PRSCH9),
486 10 => Val(PRSSEL_A::PRSCH10),
487 11 => Val(PRSSEL_A::PRSCH11),
488 i => Res(i),
489 }
490 }
491 #[doc = "Checks if the value of the field is `PRSCH0`"]
492 #[inline(always)]
493 pub fn is_prsch0(&self) -> bool {
494 *self == PRSSEL_A::PRSCH0
495 }
496 #[doc = "Checks if the value of the field is `PRSCH1`"]
497 #[inline(always)]
498 pub fn is_prsch1(&self) -> bool {
499 *self == PRSSEL_A::PRSCH1
500 }
501 #[doc = "Checks if the value of the field is `PRSCH2`"]
502 #[inline(always)]
503 pub fn is_prsch2(&self) -> bool {
504 *self == PRSSEL_A::PRSCH2
505 }
506 #[doc = "Checks if the value of the field is `PRSCH3`"]
507 #[inline(always)]
508 pub fn is_prsch3(&self) -> bool {
509 *self == PRSSEL_A::PRSCH3
510 }
511 #[doc = "Checks if the value of the field is `PRSCH4`"]
512 #[inline(always)]
513 pub fn is_prsch4(&self) -> bool {
514 *self == PRSSEL_A::PRSCH4
515 }
516 #[doc = "Checks if the value of the field is `PRSCH5`"]
517 #[inline(always)]
518 pub fn is_prsch5(&self) -> bool {
519 *self == PRSSEL_A::PRSCH5
520 }
521 #[doc = "Checks if the value of the field is `PRSCH6`"]
522 #[inline(always)]
523 pub fn is_prsch6(&self) -> bool {
524 *self == PRSSEL_A::PRSCH6
525 }
526 #[doc = "Checks if the value of the field is `PRSCH7`"]
527 #[inline(always)]
528 pub fn is_prsch7(&self) -> bool {
529 *self == PRSSEL_A::PRSCH7
530 }
531 #[doc = "Checks if the value of the field is `PRSCH8`"]
532 #[inline(always)]
533 pub fn is_prsch8(&self) -> bool {
534 *self == PRSSEL_A::PRSCH8
535 }
536 #[doc = "Checks if the value of the field is `PRSCH9`"]
537 #[inline(always)]
538 pub fn is_prsch9(&self) -> bool {
539 *self == PRSSEL_A::PRSCH9
540 }
541 #[doc = "Checks if the value of the field is `PRSCH10`"]
542 #[inline(always)]
543 pub fn is_prsch10(&self) -> bool {
544 *self == PRSSEL_A::PRSCH10
545 }
546 #[doc = "Checks if the value of the field is `PRSCH11`"]
547 #[inline(always)]
548 pub fn is_prsch11(&self) -> bool {
549 *self == PRSSEL_A::PRSCH11
550 }
551}
552#[doc = "Write proxy for field `PRSSEL`"]
553pub struct PRSSEL_W<'a> {
554 w: &'a mut W,
555}
556impl<'a> PRSSEL_W<'a> {
557 #[doc = r"Writes `variant` to the field"]
558 #[inline(always)]
559 pub fn variant(self, variant: PRSSEL_A) -> &'a mut W {
560 unsafe { self.bits(variant.into()) }
561 }
562 #[doc = "PRS Channel 0 selected as input"]
563 #[inline(always)]
564 pub fn prsch0(self) -> &'a mut W {
565 self.variant(PRSSEL_A::PRSCH0)
566 }
567 #[doc = "PRS Channel 1 selected as input"]
568 #[inline(always)]
569 pub fn prsch1(self) -> &'a mut W {
570 self.variant(PRSSEL_A::PRSCH1)
571 }
572 #[doc = "PRS Channel 2 selected as input"]
573 #[inline(always)]
574 pub fn prsch2(self) -> &'a mut W {
575 self.variant(PRSSEL_A::PRSCH2)
576 }
577 #[doc = "PRS Channel 3 selected as input"]
578 #[inline(always)]
579 pub fn prsch3(self) -> &'a mut W {
580 self.variant(PRSSEL_A::PRSCH3)
581 }
582 #[doc = "PRS Channel 4 selected as input"]
583 #[inline(always)]
584 pub fn prsch4(self) -> &'a mut W {
585 self.variant(PRSSEL_A::PRSCH4)
586 }
587 #[doc = "PRS Channel 5 selected as input"]
588 #[inline(always)]
589 pub fn prsch5(self) -> &'a mut W {
590 self.variant(PRSSEL_A::PRSCH5)
591 }
592 #[doc = "PRS Channel 6 selected as input"]
593 #[inline(always)]
594 pub fn prsch6(self) -> &'a mut W {
595 self.variant(PRSSEL_A::PRSCH6)
596 }
597 #[doc = "PRS Channel 7 selected as input"]
598 #[inline(always)]
599 pub fn prsch7(self) -> &'a mut W {
600 self.variant(PRSSEL_A::PRSCH7)
601 }
602 #[doc = "PRS Channel 8 selected as input"]
603 #[inline(always)]
604 pub fn prsch8(self) -> &'a mut W {
605 self.variant(PRSSEL_A::PRSCH8)
606 }
607 #[doc = "PRS Channel 9 selected as input"]
608 #[inline(always)]
609 pub fn prsch9(self) -> &'a mut W {
610 self.variant(PRSSEL_A::PRSCH9)
611 }
612 #[doc = "PRS Channel 10 selected as input"]
613 #[inline(always)]
614 pub fn prsch10(self) -> &'a mut W {
615 self.variant(PRSSEL_A::PRSCH10)
616 }
617 #[doc = "PRS Channel 11 selected as input"]
618 #[inline(always)]
619 pub fn prsch11(self) -> &'a mut W {
620 self.variant(PRSSEL_A::PRSCH11)
621 }
622 #[doc = r"Writes raw bits to the field"]
623 #[inline(always)]
624 pub unsafe fn bits(self, value: u8) -> &'a mut W {
625 self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
626 self.w
627 }
628}
629#[doc = "Input Capture Edge Select\n\nValue on reset: 0"]
630#[derive(Clone, Copy, Debug, PartialEq)]
631#[repr(u8)]
632pub enum ICEDGE_A {
633 #[doc = "0: Rising edges detected"]
634 RISING = 0,
635 #[doc = "1: Falling edges detected"]
636 FALLING = 1,
637 #[doc = "2: Both edges detected"]
638 BOTH = 2,
639 #[doc = "3: No edge detection, signal is left as it is"]
640 NONE = 3,
641}
642impl From<ICEDGE_A> for u8 {
643 #[inline(always)]
644 fn from(variant: ICEDGE_A) -> Self {
645 variant as _
646 }
647}
648#[doc = "Reader of field `ICEDGE`"]
649pub type ICEDGE_R = crate::R<u8, ICEDGE_A>;
650impl ICEDGE_R {
651 #[doc = r"Get enumerated values variant"]
652 #[inline(always)]
653 pub fn variant(&self) -> ICEDGE_A {
654 match self.bits {
655 0 => ICEDGE_A::RISING,
656 1 => ICEDGE_A::FALLING,
657 2 => ICEDGE_A::BOTH,
658 3 => ICEDGE_A::NONE,
659 _ => unreachable!(),
660 }
661 }
662 #[doc = "Checks if the value of the field is `RISING`"]
663 #[inline(always)]
664 pub fn is_rising(&self) -> bool {
665 *self == ICEDGE_A::RISING
666 }
667 #[doc = "Checks if the value of the field is `FALLING`"]
668 #[inline(always)]
669 pub fn is_falling(&self) -> bool {
670 *self == ICEDGE_A::FALLING
671 }
672 #[doc = "Checks if the value of the field is `BOTH`"]
673 #[inline(always)]
674 pub fn is_both(&self) -> bool {
675 *self == ICEDGE_A::BOTH
676 }
677 #[doc = "Checks if the value of the field is `NONE`"]
678 #[inline(always)]
679 pub fn is_none(&self) -> bool {
680 *self == ICEDGE_A::NONE
681 }
682}
683#[doc = "Write proxy for field `ICEDGE`"]
684pub struct ICEDGE_W<'a> {
685 w: &'a mut W,
686}
687impl<'a> ICEDGE_W<'a> {
688 #[doc = r"Writes `variant` to the field"]
689 #[inline(always)]
690 pub fn variant(self, variant: ICEDGE_A) -> &'a mut W {
691 {
692 self.bits(variant.into())
693 }
694 }
695 #[doc = "Rising edges detected"]
696 #[inline(always)]
697 pub fn rising(self) -> &'a mut W {
698 self.variant(ICEDGE_A::RISING)
699 }
700 #[doc = "Falling edges detected"]
701 #[inline(always)]
702 pub fn falling(self) -> &'a mut W {
703 self.variant(ICEDGE_A::FALLING)
704 }
705 #[doc = "Both edges detected"]
706 #[inline(always)]
707 pub fn both(self) -> &'a mut W {
708 self.variant(ICEDGE_A::BOTH)
709 }
710 #[doc = "No edge detection, signal is left as it is"]
711 #[inline(always)]
712 pub fn none(self) -> &'a mut W {
713 self.variant(ICEDGE_A::NONE)
714 }
715 #[doc = r"Writes raw bits to the field"]
716 #[inline(always)]
717 pub fn bits(self, value: u8) -> &'a mut W {
718 self.w.bits = (self.w.bits & !(0x03 << 24)) | (((value as u32) & 0x03) << 24);
719 self.w
720 }
721}
722#[doc = "Input Capture Event Control\n\nValue on reset: 0"]
723#[derive(Clone, Copy, Debug, PartialEq)]
724#[repr(u8)]
725pub enum ICEVCTRL_A {
726 #[doc = "0: PRS output pulse and interrupt flag set on every capture"]
727 EVERYEDGE = 0,
728 #[doc = "1: PRS output pulse and interrupt flag set on every second capture"]
729 EVERYSECONDEDGE = 1,
730 #[doc = "2: PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
731 RISING = 2,
732 #[doc = "3: PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
733 FALLING = 3,
734}
735impl From<ICEVCTRL_A> for u8 {
736 #[inline(always)]
737 fn from(variant: ICEVCTRL_A) -> Self {
738 variant as _
739 }
740}
741#[doc = "Reader of field `ICEVCTRL`"]
742pub type ICEVCTRL_R = crate::R<u8, ICEVCTRL_A>;
743impl ICEVCTRL_R {
744 #[doc = r"Get enumerated values variant"]
745 #[inline(always)]
746 pub fn variant(&self) -> ICEVCTRL_A {
747 match self.bits {
748 0 => ICEVCTRL_A::EVERYEDGE,
749 1 => ICEVCTRL_A::EVERYSECONDEDGE,
750 2 => ICEVCTRL_A::RISING,
751 3 => ICEVCTRL_A::FALLING,
752 _ => unreachable!(),
753 }
754 }
755 #[doc = "Checks if the value of the field is `EVERYEDGE`"]
756 #[inline(always)]
757 pub fn is_everyedge(&self) -> bool {
758 *self == ICEVCTRL_A::EVERYEDGE
759 }
760 #[doc = "Checks if the value of the field is `EVERYSECONDEDGE`"]
761 #[inline(always)]
762 pub fn is_everysecondedge(&self) -> bool {
763 *self == ICEVCTRL_A::EVERYSECONDEDGE
764 }
765 #[doc = "Checks if the value of the field is `RISING`"]
766 #[inline(always)]
767 pub fn is_rising(&self) -> bool {
768 *self == ICEVCTRL_A::RISING
769 }
770 #[doc = "Checks if the value of the field is `FALLING`"]
771 #[inline(always)]
772 pub fn is_falling(&self) -> bool {
773 *self == ICEVCTRL_A::FALLING
774 }
775}
776#[doc = "Write proxy for field `ICEVCTRL`"]
777pub struct ICEVCTRL_W<'a> {
778 w: &'a mut W,
779}
780impl<'a> ICEVCTRL_W<'a> {
781 #[doc = r"Writes `variant` to the field"]
782 #[inline(always)]
783 pub fn variant(self, variant: ICEVCTRL_A) -> &'a mut W {
784 {
785 self.bits(variant.into())
786 }
787 }
788 #[doc = "PRS output pulse and interrupt flag set on every capture"]
789 #[inline(always)]
790 pub fn everyedge(self) -> &'a mut W {
791 self.variant(ICEVCTRL_A::EVERYEDGE)
792 }
793 #[doc = "PRS output pulse and interrupt flag set on every second capture"]
794 #[inline(always)]
795 pub fn everysecondedge(self) -> &'a mut W {
796 self.variant(ICEVCTRL_A::EVERYSECONDEDGE)
797 }
798 #[doc = "PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
799 #[inline(always)]
800 pub fn rising(self) -> &'a mut W {
801 self.variant(ICEVCTRL_A::RISING)
802 }
803 #[doc = "PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
804 #[inline(always)]
805 pub fn falling(self) -> &'a mut W {
806 self.variant(ICEVCTRL_A::FALLING)
807 }
808 #[doc = r"Writes raw bits to the field"]
809 #[inline(always)]
810 pub fn bits(self, value: u8) -> &'a mut W {
811 self.w.bits = (self.w.bits & !(0x03 << 26)) | (((value as u32) & 0x03) << 26);
812 self.w
813 }
814}
815#[doc = "Reader of field `PRSCONF`"]
816pub type PRSCONF_R = crate::R<bool, bool>;
817#[doc = "Write proxy for field `PRSCONF`"]
818pub struct PRSCONF_W<'a> {
819 w: &'a mut W,
820}
821impl<'a> PRSCONF_W<'a> {
822 #[doc = r"Sets the field bit"]
823 #[inline(always)]
824 pub fn set_bit(self) -> &'a mut W {
825 self.bit(true)
826 }
827 #[doc = r"Clears the field bit"]
828 #[inline(always)]
829 pub fn clear_bit(self) -> &'a mut W {
830 self.bit(false)
831 }
832 #[doc = r"Writes raw bits to the field"]
833 #[inline(always)]
834 pub fn bit(self, value: bool) -> &'a mut W {
835 self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
836 self.w
837 }
838}
839#[doc = "Reader of field `INSEL`"]
840pub type INSEL_R = crate::R<bool, bool>;
841#[doc = "Write proxy for field `INSEL`"]
842pub struct INSEL_W<'a> {
843 w: &'a mut W,
844}
845impl<'a> INSEL_W<'a> {
846 #[doc = r"Sets the field bit"]
847 #[inline(always)]
848 pub fn set_bit(self) -> &'a mut W {
849 self.bit(true)
850 }
851 #[doc = r"Clears the field bit"]
852 #[inline(always)]
853 pub fn clear_bit(self) -> &'a mut W {
854 self.bit(false)
855 }
856 #[doc = r"Writes raw bits to the field"]
857 #[inline(always)]
858 pub fn bit(self, value: bool) -> &'a mut W {
859 self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
860 self.w
861 }
862}
863#[doc = "Reader of field `FILT`"]
864pub type FILT_R = crate::R<bool, bool>;
865#[doc = "Write proxy for field `FILT`"]
866pub struct FILT_W<'a> {
867 w: &'a mut W,
868}
869impl<'a> FILT_W<'a> {
870 #[doc = r"Sets the field bit"]
871 #[inline(always)]
872 pub fn set_bit(self) -> &'a mut W {
873 self.bit(true)
874 }
875 #[doc = r"Clears the field bit"]
876 #[inline(always)]
877 pub fn clear_bit(self) -> &'a mut W {
878 self.bit(false)
879 }
880 #[doc = r"Writes raw bits to the field"]
881 #[inline(always)]
882 pub fn bit(self, value: bool) -> &'a mut W {
883 self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
884 self.w
885 }
886}
887impl R {
888 #[doc = "Bits 0:1 - CC Channel Mode"]
889 #[inline(always)]
890 pub fn mode(&self) -> MODE_R {
891 MODE_R::new((self.bits & 0x03) as u8)
892 }
893 #[doc = "Bit 2 - Output Invert"]
894 #[inline(always)]
895 pub fn outinv(&self) -> OUTINV_R {
896 OUTINV_R::new(((self.bits >> 2) & 0x01) != 0)
897 }
898 #[doc = "Bit 4 - Compare Output Initial State"]
899 #[inline(always)]
900 pub fn coist(&self) -> COIST_R {
901 COIST_R::new(((self.bits >> 4) & 0x01) != 0)
902 }
903 #[doc = "Bits 8:9 - Compare Match Output Action"]
904 #[inline(always)]
905 pub fn cmoa(&self) -> CMOA_R {
906 CMOA_R::new(((self.bits >> 8) & 0x03) as u8)
907 }
908 #[doc = "Bits 10:11 - Counter Overflow Output Action"]
909 #[inline(always)]
910 pub fn cofoa(&self) -> COFOA_R {
911 COFOA_R::new(((self.bits >> 10) & 0x03) as u8)
912 }
913 #[doc = "Bits 12:13 - Counter Underflow Output Action"]
914 #[inline(always)]
915 pub fn cufoa(&self) -> CUFOA_R {
916 CUFOA_R::new(((self.bits >> 12) & 0x03) as u8)
917 }
918 #[doc = "Bits 16:19 - Compare/Capture Channel PRS Input Channel Selection"]
919 #[inline(always)]
920 pub fn prssel(&self) -> PRSSEL_R {
921 PRSSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
922 }
923 #[doc = "Bits 24:25 - Input Capture Edge Select"]
924 #[inline(always)]
925 pub fn icedge(&self) -> ICEDGE_R {
926 ICEDGE_R::new(((self.bits >> 24) & 0x03) as u8)
927 }
928 #[doc = "Bits 26:27 - Input Capture Event Control"]
929 #[inline(always)]
930 pub fn icevctrl(&self) -> ICEVCTRL_R {
931 ICEVCTRL_R::new(((self.bits >> 26) & 0x03) as u8)
932 }
933 #[doc = "Bit 28 - PRS Configuration"]
934 #[inline(always)]
935 pub fn prsconf(&self) -> PRSCONF_R {
936 PRSCONF_R::new(((self.bits >> 28) & 0x01) != 0)
937 }
938 #[doc = "Bit 29 - Input Selection"]
939 #[inline(always)]
940 pub fn insel(&self) -> INSEL_R {
941 INSEL_R::new(((self.bits >> 29) & 0x01) != 0)
942 }
943 #[doc = "Bit 30 - Digital Filter"]
944 #[inline(always)]
945 pub fn filt(&self) -> FILT_R {
946 FILT_R::new(((self.bits >> 30) & 0x01) != 0)
947 }
948}
949impl W {
950 #[doc = "Bits 0:1 - CC Channel Mode"]
951 #[inline(always)]
952 pub fn mode(&mut self) -> MODE_W {
953 MODE_W { w: self }
954 }
955 #[doc = "Bit 2 - Output Invert"]
956 #[inline(always)]
957 pub fn outinv(&mut self) -> OUTINV_W {
958 OUTINV_W { w: self }
959 }
960 #[doc = "Bit 4 - Compare Output Initial State"]
961 #[inline(always)]
962 pub fn coist(&mut self) -> COIST_W {
963 COIST_W { w: self }
964 }
965 #[doc = "Bits 8:9 - Compare Match Output Action"]
966 #[inline(always)]
967 pub fn cmoa(&mut self) -> CMOA_W {
968 CMOA_W { w: self }
969 }
970 #[doc = "Bits 10:11 - Counter Overflow Output Action"]
971 #[inline(always)]
972 pub fn cofoa(&mut self) -> COFOA_W {
973 COFOA_W { w: self }
974 }
975 #[doc = "Bits 12:13 - Counter Underflow Output Action"]
976 #[inline(always)]
977 pub fn cufoa(&mut self) -> CUFOA_W {
978 CUFOA_W { w: self }
979 }
980 #[doc = "Bits 16:19 - Compare/Capture Channel PRS Input Channel Selection"]
981 #[inline(always)]
982 pub fn prssel(&mut self) -> PRSSEL_W {
983 PRSSEL_W { w: self }
984 }
985 #[doc = "Bits 24:25 - Input Capture Edge Select"]
986 #[inline(always)]
987 pub fn icedge(&mut self) -> ICEDGE_W {
988 ICEDGE_W { w: self }
989 }
990 #[doc = "Bits 26:27 - Input Capture Event Control"]
991 #[inline(always)]
992 pub fn icevctrl(&mut self) -> ICEVCTRL_W {
993 ICEVCTRL_W { w: self }
994 }
995 #[doc = "Bit 28 - PRS Configuration"]
996 #[inline(always)]
997 pub fn prsconf(&mut self) -> PRSCONF_W {
998 PRSCONF_W { w: self }
999 }
1000 #[doc = "Bit 29 - Input Selection"]
1001 #[inline(always)]
1002 pub fn insel(&mut self) -> INSEL_W {
1003 INSEL_W { w: self }
1004 }
1005 #[doc = "Bit 30 - Digital Filter"]
1006 #[inline(always)]
1007 pub fn filt(&mut self) -> FILT_W {
1008 FILT_W { w: self }
1009 }
1010}