1#[doc = "Reader of register CC1_CTRL"]
2pub type R = crate::R<u32, super::CC1_CTRL>;
3#[doc = "Writer for register CC1_CTRL"]
4pub type W = crate::W<u32, super::CC1_CTRL>;
5#[doc = "Register CC1_CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CC1_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}
24impl From<MODE_A> for u8 {
25 #[inline(always)]
26 fn from(variant: MODE_A) -> Self {
27 variant as _
28 }
29}
30#[doc = "Reader of field `MODE`"]
31pub type MODE_R = crate::R<u8, MODE_A>;
32impl MODE_R {
33 #[doc = r"Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> crate::Variant<u8, MODE_A> {
36 use crate::Variant::*;
37 match self.bits {
38 0 => Val(MODE_A::OFF),
39 1 => Val(MODE_A::INPUTCAPTURE),
40 2 => Val(MODE_A::OUTPUTCOMPARE),
41 i => Res(i),
42 }
43 }
44 #[doc = "Checks if the value of the field is `OFF`"]
45 #[inline(always)]
46 pub fn is_off(&self) -> bool {
47 *self == MODE_A::OFF
48 }
49 #[doc = "Checks if the value of the field is `INPUTCAPTURE`"]
50 #[inline(always)]
51 pub fn is_inputcapture(&self) -> bool {
52 *self == MODE_A::INPUTCAPTURE
53 }
54 #[doc = "Checks if the value of the field is `OUTPUTCOMPARE`"]
55 #[inline(always)]
56 pub fn is_outputcompare(&self) -> bool {
57 *self == MODE_A::OUTPUTCOMPARE
58 }
59}
60#[doc = "Write proxy for field `MODE`"]
61pub struct MODE_W<'a> {
62 w: &'a mut W,
63}
64impl<'a> MODE_W<'a> {
65 #[doc = r"Writes `variant` to the field"]
66 #[inline(always)]
67 pub fn variant(self, variant: MODE_A) -> &'a mut W {
68 unsafe { self.bits(variant.into()) }
69 }
70 #[doc = "Compare/Capture channel turned off"]
71 #[inline(always)]
72 pub fn off(self) -> &'a mut W {
73 self.variant(MODE_A::OFF)
74 }
75 #[doc = "Input capture"]
76 #[inline(always)]
77 pub fn inputcapture(self) -> &'a mut W {
78 self.variant(MODE_A::INPUTCAPTURE)
79 }
80 #[doc = "Output compare"]
81 #[inline(always)]
82 pub fn outputcompare(self) -> &'a mut W {
83 self.variant(MODE_A::OUTPUTCOMPARE)
84 }
85 #[doc = r"Writes raw bits to the field"]
86 #[inline(always)]
87 pub unsafe fn bits(self, value: u8) -> &'a mut W {
88 self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
89 self.w
90 }
91}
92#[doc = "Compare Match Output Action\n\nValue on reset: 0"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94#[repr(u8)]
95pub enum CMOA_A {
96 #[doc = "0: A single clock cycle pulse is generated on output"]
97 PULSE = 0,
98 #[doc = "1: Toggle output on compare match"]
99 TOGGLE = 1,
100 #[doc = "2: Clear output on compare match"]
101 CLEAR = 2,
102 #[doc = "3: Set output on compare match"]
103 SET = 3,
104}
105impl From<CMOA_A> for u8 {
106 #[inline(always)]
107 fn from(variant: CMOA_A) -> Self {
108 variant as _
109 }
110}
111#[doc = "Reader of field `CMOA`"]
112pub type CMOA_R = crate::R<u8, CMOA_A>;
113impl CMOA_R {
114 #[doc = r"Get enumerated values variant"]
115 #[inline(always)]
116 pub fn variant(&self) -> CMOA_A {
117 match self.bits {
118 0 => CMOA_A::PULSE,
119 1 => CMOA_A::TOGGLE,
120 2 => CMOA_A::CLEAR,
121 3 => CMOA_A::SET,
122 _ => unreachable!(),
123 }
124 }
125 #[doc = "Checks if the value of the field is `PULSE`"]
126 #[inline(always)]
127 pub fn is_pulse(&self) -> bool {
128 *self == CMOA_A::PULSE
129 }
130 #[doc = "Checks if the value of the field is `TOGGLE`"]
131 #[inline(always)]
132 pub fn is_toggle(&self) -> bool {
133 *self == CMOA_A::TOGGLE
134 }
135 #[doc = "Checks if the value of the field is `CLEAR`"]
136 #[inline(always)]
137 pub fn is_clear(&self) -> bool {
138 *self == CMOA_A::CLEAR
139 }
140 #[doc = "Checks if the value of the field is `SET`"]
141 #[inline(always)]
142 pub fn is_set(&self) -> bool {
143 *self == CMOA_A::SET
144 }
145}
146#[doc = "Write proxy for field `CMOA`"]
147pub struct CMOA_W<'a> {
148 w: &'a mut W,
149}
150impl<'a> CMOA_W<'a> {
151 #[doc = r"Writes `variant` to the field"]
152 #[inline(always)]
153 pub fn variant(self, variant: CMOA_A) -> &'a mut W {
154 {
155 self.bits(variant.into())
156 }
157 }
158 #[doc = "A single clock cycle pulse is generated on output"]
159 #[inline(always)]
160 pub fn pulse(self) -> &'a mut W {
161 self.variant(CMOA_A::PULSE)
162 }
163 #[doc = "Toggle output on compare match"]
164 #[inline(always)]
165 pub fn toggle(self) -> &'a mut W {
166 self.variant(CMOA_A::TOGGLE)
167 }
168 #[doc = "Clear output on compare match"]
169 #[inline(always)]
170 pub fn clear(self) -> &'a mut W {
171 self.variant(CMOA_A::CLEAR)
172 }
173 #[doc = "Set output on compare match"]
174 #[inline(always)]
175 pub fn set(self) -> &'a mut W {
176 self.variant(CMOA_A::SET)
177 }
178 #[doc = r"Writes raw bits to the field"]
179 #[inline(always)]
180 pub fn bits(self, value: u8) -> &'a mut W {
181 self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
182 self.w
183 }
184}
185#[doc = "Input Capture Edge Select\n\nValue on reset: 0"]
186#[derive(Clone, Copy, Debug, PartialEq)]
187#[repr(u8)]
188pub enum ICEDGE_A {
189 #[doc = "0: Rising edges detected"]
190 RISING = 0,
191 #[doc = "1: Falling edges detected"]
192 FALLING = 1,
193 #[doc = "2: Both edges detected"]
194 BOTH = 2,
195 #[doc = "3: No edge detection, signal is left as it is"]
196 NONE = 3,
197}
198impl From<ICEDGE_A> for u8 {
199 #[inline(always)]
200 fn from(variant: ICEDGE_A) -> Self {
201 variant as _
202 }
203}
204#[doc = "Reader of field `ICEDGE`"]
205pub type ICEDGE_R = crate::R<u8, ICEDGE_A>;
206impl ICEDGE_R {
207 #[doc = r"Get enumerated values variant"]
208 #[inline(always)]
209 pub fn variant(&self) -> ICEDGE_A {
210 match self.bits {
211 0 => ICEDGE_A::RISING,
212 1 => ICEDGE_A::FALLING,
213 2 => ICEDGE_A::BOTH,
214 3 => ICEDGE_A::NONE,
215 _ => unreachable!(),
216 }
217 }
218 #[doc = "Checks if the value of the field is `RISING`"]
219 #[inline(always)]
220 pub fn is_rising(&self) -> bool {
221 *self == ICEDGE_A::RISING
222 }
223 #[doc = "Checks if the value of the field is `FALLING`"]
224 #[inline(always)]
225 pub fn is_falling(&self) -> bool {
226 *self == ICEDGE_A::FALLING
227 }
228 #[doc = "Checks if the value of the field is `BOTH`"]
229 #[inline(always)]
230 pub fn is_both(&self) -> bool {
231 *self == ICEDGE_A::BOTH
232 }
233 #[doc = "Checks if the value of the field is `NONE`"]
234 #[inline(always)]
235 pub fn is_none(&self) -> bool {
236 *self == ICEDGE_A::NONE
237 }
238}
239#[doc = "Write proxy for field `ICEDGE`"]
240pub struct ICEDGE_W<'a> {
241 w: &'a mut W,
242}
243impl<'a> ICEDGE_W<'a> {
244 #[doc = r"Writes `variant` to the field"]
245 #[inline(always)]
246 pub fn variant(self, variant: ICEDGE_A) -> &'a mut W {
247 {
248 self.bits(variant.into())
249 }
250 }
251 #[doc = "Rising edges detected"]
252 #[inline(always)]
253 pub fn rising(self) -> &'a mut W {
254 self.variant(ICEDGE_A::RISING)
255 }
256 #[doc = "Falling edges detected"]
257 #[inline(always)]
258 pub fn falling(self) -> &'a mut W {
259 self.variant(ICEDGE_A::FALLING)
260 }
261 #[doc = "Both edges detected"]
262 #[inline(always)]
263 pub fn both(self) -> &'a mut W {
264 self.variant(ICEDGE_A::BOTH)
265 }
266 #[doc = "No edge detection, signal is left as it is"]
267 #[inline(always)]
268 pub fn none(self) -> &'a mut W {
269 self.variant(ICEDGE_A::NONE)
270 }
271 #[doc = r"Writes raw bits to the field"]
272 #[inline(always)]
273 pub fn bits(self, value: u8) -> &'a mut W {
274 self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
275 self.w
276 }
277}
278#[doc = "Compare/Capture Channel PRS Input Channel Selection\n\nValue on reset: 0"]
279#[derive(Clone, Copy, Debug, PartialEq)]
280#[repr(u8)]
281pub enum PRSSEL_A {
282 #[doc = "0: PRS Channel 0 selected as input"]
283 PRSCH0 = 0,
284 #[doc = "1: PRS Channel 1 selected as input"]
285 PRSCH1 = 1,
286 #[doc = "2: PRS Channel 2 selected as input"]
287 PRSCH2 = 2,
288 #[doc = "3: PRS Channel 3 selected as input"]
289 PRSCH3 = 3,
290 #[doc = "4: PRS Channel 4 selected as input"]
291 PRSCH4 = 4,
292 #[doc = "5: PRS Channel 5 selected as input"]
293 PRSCH5 = 5,
294 #[doc = "6: PRS Channel 6 selected as input"]
295 PRSCH6 = 6,
296 #[doc = "7: PRS Channel 7 selected as input"]
297 PRSCH7 = 7,
298 #[doc = "8: PRS Channel 8 selected as input"]
299 PRSCH8 = 8,
300 #[doc = "9: PRS Channel 9 selected as input"]
301 PRSCH9 = 9,
302 #[doc = "10: PRS Channel 10 selected as input"]
303 PRSCH10 = 10,
304 #[doc = "11: PRS Channel 11 selected as input"]
305 PRSCH11 = 11,
306}
307impl From<PRSSEL_A> for u8 {
308 #[inline(always)]
309 fn from(variant: PRSSEL_A) -> Self {
310 variant as _
311 }
312}
313#[doc = "Reader of field `PRSSEL`"]
314pub type PRSSEL_R = crate::R<u8, PRSSEL_A>;
315impl PRSSEL_R {
316 #[doc = r"Get enumerated values variant"]
317 #[inline(always)]
318 pub fn variant(&self) -> crate::Variant<u8, PRSSEL_A> {
319 use crate::Variant::*;
320 match self.bits {
321 0 => Val(PRSSEL_A::PRSCH0),
322 1 => Val(PRSSEL_A::PRSCH1),
323 2 => Val(PRSSEL_A::PRSCH2),
324 3 => Val(PRSSEL_A::PRSCH3),
325 4 => Val(PRSSEL_A::PRSCH4),
326 5 => Val(PRSSEL_A::PRSCH5),
327 6 => Val(PRSSEL_A::PRSCH6),
328 7 => Val(PRSSEL_A::PRSCH7),
329 8 => Val(PRSSEL_A::PRSCH8),
330 9 => Val(PRSSEL_A::PRSCH9),
331 10 => Val(PRSSEL_A::PRSCH10),
332 11 => Val(PRSSEL_A::PRSCH11),
333 i => Res(i),
334 }
335 }
336 #[doc = "Checks if the value of the field is `PRSCH0`"]
337 #[inline(always)]
338 pub fn is_prsch0(&self) -> bool {
339 *self == PRSSEL_A::PRSCH0
340 }
341 #[doc = "Checks if the value of the field is `PRSCH1`"]
342 #[inline(always)]
343 pub fn is_prsch1(&self) -> bool {
344 *self == PRSSEL_A::PRSCH1
345 }
346 #[doc = "Checks if the value of the field is `PRSCH2`"]
347 #[inline(always)]
348 pub fn is_prsch2(&self) -> bool {
349 *self == PRSSEL_A::PRSCH2
350 }
351 #[doc = "Checks if the value of the field is `PRSCH3`"]
352 #[inline(always)]
353 pub fn is_prsch3(&self) -> bool {
354 *self == PRSSEL_A::PRSCH3
355 }
356 #[doc = "Checks if the value of the field is `PRSCH4`"]
357 #[inline(always)]
358 pub fn is_prsch4(&self) -> bool {
359 *self == PRSSEL_A::PRSCH4
360 }
361 #[doc = "Checks if the value of the field is `PRSCH5`"]
362 #[inline(always)]
363 pub fn is_prsch5(&self) -> bool {
364 *self == PRSSEL_A::PRSCH5
365 }
366 #[doc = "Checks if the value of the field is `PRSCH6`"]
367 #[inline(always)]
368 pub fn is_prsch6(&self) -> bool {
369 *self == PRSSEL_A::PRSCH6
370 }
371 #[doc = "Checks if the value of the field is `PRSCH7`"]
372 #[inline(always)]
373 pub fn is_prsch7(&self) -> bool {
374 *self == PRSSEL_A::PRSCH7
375 }
376 #[doc = "Checks if the value of the field is `PRSCH8`"]
377 #[inline(always)]
378 pub fn is_prsch8(&self) -> bool {
379 *self == PRSSEL_A::PRSCH8
380 }
381 #[doc = "Checks if the value of the field is `PRSCH9`"]
382 #[inline(always)]
383 pub fn is_prsch9(&self) -> bool {
384 *self == PRSSEL_A::PRSCH9
385 }
386 #[doc = "Checks if the value of the field is `PRSCH10`"]
387 #[inline(always)]
388 pub fn is_prsch10(&self) -> bool {
389 *self == PRSSEL_A::PRSCH10
390 }
391 #[doc = "Checks if the value of the field is `PRSCH11`"]
392 #[inline(always)]
393 pub fn is_prsch11(&self) -> bool {
394 *self == PRSSEL_A::PRSCH11
395 }
396}
397#[doc = "Write proxy for field `PRSSEL`"]
398pub struct PRSSEL_W<'a> {
399 w: &'a mut W,
400}
401impl<'a> PRSSEL_W<'a> {
402 #[doc = r"Writes `variant` to the field"]
403 #[inline(always)]
404 pub fn variant(self, variant: PRSSEL_A) -> &'a mut W {
405 unsafe { self.bits(variant.into()) }
406 }
407 #[doc = "PRS Channel 0 selected as input"]
408 #[inline(always)]
409 pub fn prsch0(self) -> &'a mut W {
410 self.variant(PRSSEL_A::PRSCH0)
411 }
412 #[doc = "PRS Channel 1 selected as input"]
413 #[inline(always)]
414 pub fn prsch1(self) -> &'a mut W {
415 self.variant(PRSSEL_A::PRSCH1)
416 }
417 #[doc = "PRS Channel 2 selected as input"]
418 #[inline(always)]
419 pub fn prsch2(self) -> &'a mut W {
420 self.variant(PRSSEL_A::PRSCH2)
421 }
422 #[doc = "PRS Channel 3 selected as input"]
423 #[inline(always)]
424 pub fn prsch3(self) -> &'a mut W {
425 self.variant(PRSSEL_A::PRSCH3)
426 }
427 #[doc = "PRS Channel 4 selected as input"]
428 #[inline(always)]
429 pub fn prsch4(self) -> &'a mut W {
430 self.variant(PRSSEL_A::PRSCH4)
431 }
432 #[doc = "PRS Channel 5 selected as input"]
433 #[inline(always)]
434 pub fn prsch5(self) -> &'a mut W {
435 self.variant(PRSSEL_A::PRSCH5)
436 }
437 #[doc = "PRS Channel 6 selected as input"]
438 #[inline(always)]
439 pub fn prsch6(self) -> &'a mut W {
440 self.variant(PRSSEL_A::PRSCH6)
441 }
442 #[doc = "PRS Channel 7 selected as input"]
443 #[inline(always)]
444 pub fn prsch7(self) -> &'a mut W {
445 self.variant(PRSSEL_A::PRSCH7)
446 }
447 #[doc = "PRS Channel 8 selected as input"]
448 #[inline(always)]
449 pub fn prsch8(self) -> &'a mut W {
450 self.variant(PRSSEL_A::PRSCH8)
451 }
452 #[doc = "PRS Channel 9 selected as input"]
453 #[inline(always)]
454 pub fn prsch9(self) -> &'a mut W {
455 self.variant(PRSSEL_A::PRSCH9)
456 }
457 #[doc = "PRS Channel 10 selected as input"]
458 #[inline(always)]
459 pub fn prsch10(self) -> &'a mut W {
460 self.variant(PRSSEL_A::PRSCH10)
461 }
462 #[doc = "PRS Channel 11 selected as input"]
463 #[inline(always)]
464 pub fn prsch11(self) -> &'a mut W {
465 self.variant(PRSSEL_A::PRSCH11)
466 }
467 #[doc = r"Writes raw bits to the field"]
468 #[inline(always)]
469 pub unsafe fn bits(self, value: u8) -> &'a mut W {
470 self.w.bits = (self.w.bits & !(0x0f << 6)) | (((value as u32) & 0x0f) << 6);
471 self.w
472 }
473}
474#[doc = "Reader of field `COMPBASE`"]
475pub type COMPBASE_R = crate::R<bool, bool>;
476#[doc = "Write proxy for field `COMPBASE`"]
477pub struct COMPBASE_W<'a> {
478 w: &'a mut W,
479}
480impl<'a> COMPBASE_W<'a> {
481 #[doc = r"Sets the field bit"]
482 #[inline(always)]
483 pub fn set_bit(self) -> &'a mut W {
484 self.bit(true)
485 }
486 #[doc = r"Clears the field bit"]
487 #[inline(always)]
488 pub fn clear_bit(self) -> &'a mut W {
489 self.bit(false)
490 }
491 #[doc = r"Writes raw bits to the field"]
492 #[inline(always)]
493 pub fn bit(self, value: bool) -> &'a mut W {
494 self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
495 self.w
496 }
497}
498#[doc = "Reader of field `COMPMASK`"]
499pub type COMPMASK_R = crate::R<u8, u8>;
500#[doc = "Write proxy for field `COMPMASK`"]
501pub struct COMPMASK_W<'a> {
502 w: &'a mut W,
503}
504impl<'a> COMPMASK_W<'a> {
505 #[doc = r"Writes raw bits to the field"]
506 #[inline(always)]
507 pub unsafe fn bits(self, value: u8) -> &'a mut W {
508 self.w.bits = (self.w.bits & !(0x1f << 12)) | (((value as u32) & 0x1f) << 12);
509 self.w
510 }
511}
512#[doc = "Reader of field `DAYCC`"]
513pub type DAYCC_R = crate::R<bool, bool>;
514#[doc = "Write proxy for field `DAYCC`"]
515pub struct DAYCC_W<'a> {
516 w: &'a mut W,
517}
518impl<'a> DAYCC_W<'a> {
519 #[doc = r"Sets the field bit"]
520 #[inline(always)]
521 pub fn set_bit(self) -> &'a mut W {
522 self.bit(true)
523 }
524 #[doc = r"Clears the field bit"]
525 #[inline(always)]
526 pub fn clear_bit(self) -> &'a mut W {
527 self.bit(false)
528 }
529 #[doc = r"Writes raw bits to the field"]
530 #[inline(always)]
531 pub fn bit(self, value: bool) -> &'a mut W {
532 self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
533 self.w
534 }
535}
536impl R {
537 #[doc = "Bits 0:1 - CC Channel Mode"]
538 #[inline(always)]
539 pub fn mode(&self) -> MODE_R {
540 MODE_R::new((self.bits & 0x03) as u8)
541 }
542 #[doc = "Bits 2:3 - Compare Match Output Action"]
543 #[inline(always)]
544 pub fn cmoa(&self) -> CMOA_R {
545 CMOA_R::new(((self.bits >> 2) & 0x03) as u8)
546 }
547 #[doc = "Bits 4:5 - Input Capture Edge Select"]
548 #[inline(always)]
549 pub fn icedge(&self) -> ICEDGE_R {
550 ICEDGE_R::new(((self.bits >> 4) & 0x03) as u8)
551 }
552 #[doc = "Bits 6:9 - Compare/Capture Channel PRS Input Channel Selection"]
553 #[inline(always)]
554 pub fn prssel(&self) -> PRSSEL_R {
555 PRSSEL_R::new(((self.bits >> 6) & 0x0f) as u8)
556 }
557 #[doc = "Bit 11 - Capture Compare Channel Comparison Base"]
558 #[inline(always)]
559 pub fn compbase(&self) -> COMPBASE_R {
560 COMPBASE_R::new(((self.bits >> 11) & 0x01) != 0)
561 }
562 #[doc = "Bits 12:16 - Capture Compare Channel Comparison Mask"]
563 #[inline(always)]
564 pub fn compmask(&self) -> COMPMASK_R {
565 COMPMASK_R::new(((self.bits >> 12) & 0x1f) as u8)
566 }
567 #[doc = "Bit 17 - Day Capture/Compare Selection"]
568 #[inline(always)]
569 pub fn daycc(&self) -> DAYCC_R {
570 DAYCC_R::new(((self.bits >> 17) & 0x01) != 0)
571 }
572}
573impl W {
574 #[doc = "Bits 0:1 - CC Channel Mode"]
575 #[inline(always)]
576 pub fn mode(&mut self) -> MODE_W {
577 MODE_W { w: self }
578 }
579 #[doc = "Bits 2:3 - Compare Match Output Action"]
580 #[inline(always)]
581 pub fn cmoa(&mut self) -> CMOA_W {
582 CMOA_W { w: self }
583 }
584 #[doc = "Bits 4:5 - Input Capture Edge Select"]
585 #[inline(always)]
586 pub fn icedge(&mut self) -> ICEDGE_W {
587 ICEDGE_W { w: self }
588 }
589 #[doc = "Bits 6:9 - Compare/Capture Channel PRS Input Channel Selection"]
590 #[inline(always)]
591 pub fn prssel(&mut self) -> PRSSEL_W {
592 PRSSEL_W { w: self }
593 }
594 #[doc = "Bit 11 - Capture Compare Channel Comparison Base"]
595 #[inline(always)]
596 pub fn compbase(&mut self) -> COMPBASE_W {
597 COMPBASE_W { w: self }
598 }
599 #[doc = "Bits 12:16 - Capture Compare Channel Comparison Mask"]
600 #[inline(always)]
601 pub fn compmask(&mut self) -> COMPMASK_W {
602 COMPMASK_W { w: self }
603 }
604 #[doc = "Bit 17 - Day Capture/Compare Selection"]
605 #[inline(always)]
606 pub fn daycc(&mut self) -> DAYCC_W {
607 DAYCC_W { w: self }
608 }
609}