1#[doc = "Reader of register CC2_CTRL"]
2pub type R = crate::R<u32, super::CC2_CTRL>;
3#[doc = "Writer for register CC2_CTRL"]
4pub type W = crate::W<u32, super::CC2_CTRL>;
5#[doc = "Register CC2_CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CC2_CTRL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type { 0 }
10}
11#[doc = "CC Channel Mode\n\nValue on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq)]
13#[repr(u8)]
14pub enum MODE_A {
15 #[doc = "0: Compare/Capture channel turned off"]
16 OFF = 0,
17 #[doc = "1: Input capture"]
18 INPUTCAPTURE = 1,
19 #[doc = "2: Output compare"]
20 OUTPUTCOMPARE = 2,
21 #[doc = "3: Pulse-Width Modulation"]
22 PWM = 3,
23}
24impl From<MODE_A> for u8 {
25 #[inline(always)]
26 fn from(variant: MODE_A) -> Self { variant as _ }
27}
28#[doc = "Reader of field `MODE`"]
29pub type MODE_R = crate::R<u8, MODE_A>;
30impl MODE_R {
31 #[doc = r"Get enumerated values variant"]
32 #[inline(always)]
33 pub fn variant(&self) -> MODE_A {
34 match self.bits {
35 0 => MODE_A::OFF,
36 1 => MODE_A::INPUTCAPTURE,
37 2 => MODE_A::OUTPUTCOMPARE,
38 3 => MODE_A::PWM,
39 _ => unreachable!(),
40 }
41 }
42 #[doc = "Checks if the value of the field is `OFF`"]
43 #[inline(always)]
44 pub fn is_off(&self) -> bool { *self == MODE_A::OFF }
45 #[doc = "Checks if the value of the field is `INPUTCAPTURE`"]
46 #[inline(always)]
47 pub fn is_inputcapture(&self) -> bool { *self == MODE_A::INPUTCAPTURE }
48 #[doc = "Checks if the value of the field is `OUTPUTCOMPARE`"]
49 #[inline(always)]
50 pub fn is_outputcompare(&self) -> bool { *self == MODE_A::OUTPUTCOMPARE }
51 #[doc = "Checks if the value of the field is `PWM`"]
52 #[inline(always)]
53 pub fn is_pwm(&self) -> bool { *self == MODE_A::PWM }
54}
55#[doc = "Write proxy for field `MODE`"]
56pub struct MODE_W<'a> {
57 w: &'a mut W,
58}
59impl<'a> MODE_W<'a> {
60 #[doc = r"Writes `variant` to the field"]
61 #[inline(always)]
62 pub fn variant(self, variant: MODE_A) -> &'a mut W {
63 {
64 self.bits(variant.into())
65 }
66 }
67 #[doc = "Compare/Capture channel turned off"]
68 #[inline(always)]
69 pub fn off(self) -> &'a mut W { self.variant(MODE_A::OFF) }
70 #[doc = "Input capture"]
71 #[inline(always)]
72 pub fn inputcapture(self) -> &'a mut W { self.variant(MODE_A::INPUTCAPTURE) }
73 #[doc = "Output compare"]
74 #[inline(always)]
75 pub fn outputcompare(self) -> &'a mut W { self.variant(MODE_A::OUTPUTCOMPARE) }
76 #[doc = "Pulse-Width Modulation"]
77 #[inline(always)]
78 pub fn pwm(self) -> &'a mut W { self.variant(MODE_A::PWM) }
79 #[doc = r"Writes raw bits to the field"]
80 #[inline(always)]
81 pub fn bits(self, value: u8) -> &'a mut W {
82 self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
83 self.w
84 }
85}
86#[doc = "Reader of field `OUTINV`"]
87pub type OUTINV_R = crate::R<bool, bool>;
88#[doc = "Write proxy for field `OUTINV`"]
89pub struct OUTINV_W<'a> {
90 w: &'a mut W,
91}
92impl<'a> OUTINV_W<'a> {
93 #[doc = r"Sets the field bit"]
94 #[inline(always)]
95 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
96 #[doc = r"Clears the field bit"]
97 #[inline(always)]
98 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
99 #[doc = r"Writes raw bits to the field"]
100 #[inline(always)]
101 pub fn bit(self, value: bool) -> &'a mut W {
102 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
103 self.w
104 }
105}
106#[doc = "Reader of field `COIST`"]
107pub type COIST_R = crate::R<bool, bool>;
108#[doc = "Write proxy for field `COIST`"]
109pub struct COIST_W<'a> {
110 w: &'a mut W,
111}
112impl<'a> COIST_W<'a> {
113 #[doc = r"Sets the field bit"]
114 #[inline(always)]
115 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
116 #[doc = r"Clears the field bit"]
117 #[inline(always)]
118 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
119 #[doc = r"Writes raw bits to the field"]
120 #[inline(always)]
121 pub fn bit(self, value: bool) -> &'a mut W {
122 self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
123 self.w
124 }
125}
126#[doc = "Compare Match Output Action\n\nValue on reset: 0"]
127#[derive(Clone, Copy, Debug, PartialEq)]
128#[repr(u8)]
129pub enum CMOA_A {
130 #[doc = "0: No action on compare match"]
131 NONE = 0,
132 #[doc = "1: Toggle output on compare match"]
133 TOGGLE = 1,
134 #[doc = "2: Clear output on compare match"]
135 CLEAR = 2,
136 #[doc = "3: Set output on compare match"]
137 SET = 3,
138}
139impl From<CMOA_A> for u8 {
140 #[inline(always)]
141 fn from(variant: CMOA_A) -> Self { variant as _ }
142}
143#[doc = "Reader of field `CMOA`"]
144pub type CMOA_R = crate::R<u8, CMOA_A>;
145impl CMOA_R {
146 #[doc = r"Get enumerated values variant"]
147 #[inline(always)]
148 pub fn variant(&self) -> CMOA_A {
149 match self.bits {
150 0 => CMOA_A::NONE,
151 1 => CMOA_A::TOGGLE,
152 2 => CMOA_A::CLEAR,
153 3 => CMOA_A::SET,
154 _ => unreachable!(),
155 }
156 }
157 #[doc = "Checks if the value of the field is `NONE`"]
158 #[inline(always)]
159 pub fn is_none(&self) -> bool { *self == CMOA_A::NONE }
160 #[doc = "Checks if the value of the field is `TOGGLE`"]
161 #[inline(always)]
162 pub fn is_toggle(&self) -> bool { *self == CMOA_A::TOGGLE }
163 #[doc = "Checks if the value of the field is `CLEAR`"]
164 #[inline(always)]
165 pub fn is_clear(&self) -> bool { *self == CMOA_A::CLEAR }
166 #[doc = "Checks if the value of the field is `SET`"]
167 #[inline(always)]
168 pub fn is_set(&self) -> bool { *self == CMOA_A::SET }
169}
170#[doc = "Write proxy for field `CMOA`"]
171pub struct CMOA_W<'a> {
172 w: &'a mut W,
173}
174impl<'a> CMOA_W<'a> {
175 #[doc = r"Writes `variant` to the field"]
176 #[inline(always)]
177 pub fn variant(self, variant: CMOA_A) -> &'a mut W {
178 {
179 self.bits(variant.into())
180 }
181 }
182 #[doc = "No action on compare match"]
183 #[inline(always)]
184 pub fn none(self) -> &'a mut W { self.variant(CMOA_A::NONE) }
185 #[doc = "Toggle output on compare match"]
186 #[inline(always)]
187 pub fn toggle(self) -> &'a mut W { self.variant(CMOA_A::TOGGLE) }
188 #[doc = "Clear output on compare match"]
189 #[inline(always)]
190 pub fn clear(self) -> &'a mut W { self.variant(CMOA_A::CLEAR) }
191 #[doc = "Set output on compare match"]
192 #[inline(always)]
193 pub fn set(self) -> &'a mut W { self.variant(CMOA_A::SET) }
194 #[doc = r"Writes raw bits to the field"]
195 #[inline(always)]
196 pub fn bits(self, value: u8) -> &'a mut W {
197 self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
198 self.w
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 { variant as _ }
217}
218#[doc = "Reader of field `COFOA`"]
219pub type COFOA_R = crate::R<u8, COFOA_A>;
220impl COFOA_R {
221 #[doc = r"Get enumerated values variant"]
222 #[inline(always)]
223 pub fn variant(&self) -> COFOA_A {
224 match self.bits {
225 0 => COFOA_A::NONE,
226 1 => COFOA_A::TOGGLE,
227 2 => COFOA_A::CLEAR,
228 3 => COFOA_A::SET,
229 _ => unreachable!(),
230 }
231 }
232 #[doc = "Checks if the value of the field is `NONE`"]
233 #[inline(always)]
234 pub fn is_none(&self) -> bool { *self == COFOA_A::NONE }
235 #[doc = "Checks if the value of the field is `TOGGLE`"]
236 #[inline(always)]
237 pub fn is_toggle(&self) -> bool { *self == COFOA_A::TOGGLE }
238 #[doc = "Checks if the value of the field is `CLEAR`"]
239 #[inline(always)]
240 pub fn is_clear(&self) -> bool { *self == COFOA_A::CLEAR }
241 #[doc = "Checks if the value of the field is `SET`"]
242 #[inline(always)]
243 pub fn is_set(&self) -> bool { *self == COFOA_A::SET }
244}
245#[doc = "Write proxy for field `COFOA`"]
246pub struct COFOA_W<'a> {
247 w: &'a mut W,
248}
249impl<'a> COFOA_W<'a> {
250 #[doc = r"Writes `variant` to the field"]
251 #[inline(always)]
252 pub fn variant(self, variant: COFOA_A) -> &'a mut W {
253 {
254 self.bits(variant.into())
255 }
256 }
257 #[doc = "No action on counter overflow"]
258 #[inline(always)]
259 pub fn none(self) -> &'a mut W { self.variant(COFOA_A::NONE) }
260 #[doc = "Toggle output on counter overflow"]
261 #[inline(always)]
262 pub fn toggle(self) -> &'a mut W { self.variant(COFOA_A::TOGGLE) }
263 #[doc = "Clear output on counter overflow"]
264 #[inline(always)]
265 pub fn clear(self) -> &'a mut W { self.variant(COFOA_A::CLEAR) }
266 #[doc = "Set output on counter overflow"]
267 #[inline(always)]
268 pub fn set(self) -> &'a mut W { self.variant(COFOA_A::SET) }
269 #[doc = r"Writes raw bits to the field"]
270 #[inline(always)]
271 pub fn bits(self, value: u8) -> &'a mut W {
272 self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
273 self.w
274 }
275}
276#[doc = "Counter Underflow Output Action\n\nValue on reset: 0"]
277#[derive(Clone, Copy, Debug, PartialEq)]
278#[repr(u8)]
279pub enum CUFOA_A {
280 #[doc = "0: No action on counter underflow"]
281 NONE = 0,
282 #[doc = "1: Toggle output on counter underflow"]
283 TOGGLE = 1,
284 #[doc = "2: Clear output on counter underflow"]
285 CLEAR = 2,
286 #[doc = "3: Set output on counter underflow"]
287 SET = 3,
288}
289impl From<CUFOA_A> for u8 {
290 #[inline(always)]
291 fn from(variant: CUFOA_A) -> Self { variant as _ }
292}
293#[doc = "Reader of field `CUFOA`"]
294pub type CUFOA_R = crate::R<u8, CUFOA_A>;
295impl CUFOA_R {
296 #[doc = r"Get enumerated values variant"]
297 #[inline(always)]
298 pub fn variant(&self) -> CUFOA_A {
299 match self.bits {
300 0 => CUFOA_A::NONE,
301 1 => CUFOA_A::TOGGLE,
302 2 => CUFOA_A::CLEAR,
303 3 => CUFOA_A::SET,
304 _ => unreachable!(),
305 }
306 }
307 #[doc = "Checks if the value of the field is `NONE`"]
308 #[inline(always)]
309 pub fn is_none(&self) -> bool { *self == CUFOA_A::NONE }
310 #[doc = "Checks if the value of the field is `TOGGLE`"]
311 #[inline(always)]
312 pub fn is_toggle(&self) -> bool { *self == CUFOA_A::TOGGLE }
313 #[doc = "Checks if the value of the field is `CLEAR`"]
314 #[inline(always)]
315 pub fn is_clear(&self) -> bool { *self == CUFOA_A::CLEAR }
316 #[doc = "Checks if the value of the field is `SET`"]
317 #[inline(always)]
318 pub fn is_set(&self) -> bool { *self == CUFOA_A::SET }
319}
320#[doc = "Write proxy for field `CUFOA`"]
321pub struct CUFOA_W<'a> {
322 w: &'a mut W,
323}
324impl<'a> CUFOA_W<'a> {
325 #[doc = r"Writes `variant` to the field"]
326 #[inline(always)]
327 pub fn variant(self, variant: CUFOA_A) -> &'a mut W {
328 {
329 self.bits(variant.into())
330 }
331 }
332 #[doc = "No action on counter underflow"]
333 #[inline(always)]
334 pub fn none(self) -> &'a mut W { self.variant(CUFOA_A::NONE) }
335 #[doc = "Toggle output on counter underflow"]
336 #[inline(always)]
337 pub fn toggle(self) -> &'a mut W { self.variant(CUFOA_A::TOGGLE) }
338 #[doc = "Clear output on counter underflow"]
339 #[inline(always)]
340 pub fn clear(self) -> &'a mut W { self.variant(CUFOA_A::CLEAR) }
341 #[doc = "Set output on counter underflow"]
342 #[inline(always)]
343 pub fn set(self) -> &'a mut W { self.variant(CUFOA_A::SET) }
344 #[doc = r"Writes raw bits to the field"]
345 #[inline(always)]
346 pub fn bits(self, value: u8) -> &'a mut W {
347 self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
348 self.w
349 }
350}
351#[doc = "Compare/Capture Channel PRS Input Channel Selection\n\nValue on reset: 0"]
352#[derive(Clone, Copy, Debug, PartialEq)]
353#[repr(u8)]
354pub enum PRSSEL_A {
355 #[doc = "0: PRS Channel 0 selected as input"]
356 PRSCH0 = 0,
357 #[doc = "1: PRS Channel 1 selected as input"]
358 PRSCH1 = 1,
359 #[doc = "2: PRS Channel 2 selected as input"]
360 PRSCH2 = 2,
361 #[doc = "3: PRS Channel 3 selected as input"]
362 PRSCH3 = 3,
363 #[doc = "4: PRS Channel 4 selected as input"]
364 PRSCH4 = 4,
365 #[doc = "5: PRS Channel 5 selected as input"]
366 PRSCH5 = 5,
367 #[doc = "6: PRS Channel 6 selected as input"]
368 PRSCH6 = 6,
369 #[doc = "7: PRS Channel 7 selected as input"]
370 PRSCH7 = 7,
371 #[doc = "8: PRS Channel 8 selected as input"]
372 PRSCH8 = 8,
373 #[doc = "9: PRS Channel 9 selected as input"]
374 PRSCH9 = 9,
375 #[doc = "10: PRS Channel 10 selected as input"]
376 PRSCH10 = 10,
377 #[doc = "11: PRS Channel 11 selected as input"]
378 PRSCH11 = 11,
379 #[doc = "12: PRS Channel 12 selected as input"]
380 PRSCH12 = 12,
381 #[doc = "13: PRS Channel 13 selected as input"]
382 PRSCH13 = 13,
383 #[doc = "14: PRS Channel 14 selected as input"]
384 PRSCH14 = 14,
385 #[doc = "15: PRS Channel 15 selected as input"]
386 PRSCH15 = 15,
387 #[doc = "16: PRS Channel 16 selected as input"]
388 PRSCH16 = 16,
389 #[doc = "17: PRS Channel 17 selected as input"]
390 PRSCH17 = 17,
391 #[doc = "18: PRS Channel 18 selected as input"]
392 PRSCH18 = 18,
393 #[doc = "19: PRS Channel 19 selected as input"]
394 PRSCH19 = 19,
395 #[doc = "20: PRS Channel 20 selected as input"]
396 PRSCH20 = 20,
397 #[doc = "21: PRS Channel 21 selected as input"]
398 PRSCH21 = 21,
399 #[doc = "22: PRS Channel 22 selected as input"]
400 PRSCH22 = 22,
401 #[doc = "23: PRS Channel 23 selected as input"]
402 PRSCH23 = 23,
403}
404impl From<PRSSEL_A> for u8 {
405 #[inline(always)]
406 fn from(variant: PRSSEL_A) -> Self { variant as _ }
407}
408#[doc = "Reader of field `PRSSEL`"]
409pub type PRSSEL_R = crate::R<u8, PRSSEL_A>;
410impl PRSSEL_R {
411 #[doc = r"Get enumerated values variant"]
412 #[inline(always)]
413 pub fn variant(&self) -> crate::Variant<u8, PRSSEL_A> {
414 use crate::Variant::*;
415 match self.bits {
416 0 => Val(PRSSEL_A::PRSCH0),
417 1 => Val(PRSSEL_A::PRSCH1),
418 2 => Val(PRSSEL_A::PRSCH2),
419 3 => Val(PRSSEL_A::PRSCH3),
420 4 => Val(PRSSEL_A::PRSCH4),
421 5 => Val(PRSSEL_A::PRSCH5),
422 6 => Val(PRSSEL_A::PRSCH6),
423 7 => Val(PRSSEL_A::PRSCH7),
424 8 => Val(PRSSEL_A::PRSCH8),
425 9 => Val(PRSSEL_A::PRSCH9),
426 10 => Val(PRSSEL_A::PRSCH10),
427 11 => Val(PRSSEL_A::PRSCH11),
428 12 => Val(PRSSEL_A::PRSCH12),
429 13 => Val(PRSSEL_A::PRSCH13),
430 14 => Val(PRSSEL_A::PRSCH14),
431 15 => Val(PRSSEL_A::PRSCH15),
432 16 => Val(PRSSEL_A::PRSCH16),
433 17 => Val(PRSSEL_A::PRSCH17),
434 18 => Val(PRSSEL_A::PRSCH18),
435 19 => Val(PRSSEL_A::PRSCH19),
436 20 => Val(PRSSEL_A::PRSCH20),
437 21 => Val(PRSSEL_A::PRSCH21),
438 22 => Val(PRSSEL_A::PRSCH22),
439 23 => Val(PRSSEL_A::PRSCH23),
440 i => Res(i),
441 }
442 }
443 #[doc = "Checks if the value of the field is `PRSCH0`"]
444 #[inline(always)]
445 pub fn is_prsch0(&self) -> bool { *self == PRSSEL_A::PRSCH0 }
446 #[doc = "Checks if the value of the field is `PRSCH1`"]
447 #[inline(always)]
448 pub fn is_prsch1(&self) -> bool { *self == PRSSEL_A::PRSCH1 }
449 #[doc = "Checks if the value of the field is `PRSCH2`"]
450 #[inline(always)]
451 pub fn is_prsch2(&self) -> bool { *self == PRSSEL_A::PRSCH2 }
452 #[doc = "Checks if the value of the field is `PRSCH3`"]
453 #[inline(always)]
454 pub fn is_prsch3(&self) -> bool { *self == PRSSEL_A::PRSCH3 }
455 #[doc = "Checks if the value of the field is `PRSCH4`"]
456 #[inline(always)]
457 pub fn is_prsch4(&self) -> bool { *self == PRSSEL_A::PRSCH4 }
458 #[doc = "Checks if the value of the field is `PRSCH5`"]
459 #[inline(always)]
460 pub fn is_prsch5(&self) -> bool { *self == PRSSEL_A::PRSCH5 }
461 #[doc = "Checks if the value of the field is `PRSCH6`"]
462 #[inline(always)]
463 pub fn is_prsch6(&self) -> bool { *self == PRSSEL_A::PRSCH6 }
464 #[doc = "Checks if the value of the field is `PRSCH7`"]
465 #[inline(always)]
466 pub fn is_prsch7(&self) -> bool { *self == PRSSEL_A::PRSCH7 }
467 #[doc = "Checks if the value of the field is `PRSCH8`"]
468 #[inline(always)]
469 pub fn is_prsch8(&self) -> bool { *self == PRSSEL_A::PRSCH8 }
470 #[doc = "Checks if the value of the field is `PRSCH9`"]
471 #[inline(always)]
472 pub fn is_prsch9(&self) -> bool { *self == PRSSEL_A::PRSCH9 }
473 #[doc = "Checks if the value of the field is `PRSCH10`"]
474 #[inline(always)]
475 pub fn is_prsch10(&self) -> bool { *self == PRSSEL_A::PRSCH10 }
476 #[doc = "Checks if the value of the field is `PRSCH11`"]
477 #[inline(always)]
478 pub fn is_prsch11(&self) -> bool { *self == PRSSEL_A::PRSCH11 }
479 #[doc = "Checks if the value of the field is `PRSCH12`"]
480 #[inline(always)]
481 pub fn is_prsch12(&self) -> bool { *self == PRSSEL_A::PRSCH12 }
482 #[doc = "Checks if the value of the field is `PRSCH13`"]
483 #[inline(always)]
484 pub fn is_prsch13(&self) -> bool { *self == PRSSEL_A::PRSCH13 }
485 #[doc = "Checks if the value of the field is `PRSCH14`"]
486 #[inline(always)]
487 pub fn is_prsch14(&self) -> bool { *self == PRSSEL_A::PRSCH14 }
488 #[doc = "Checks if the value of the field is `PRSCH15`"]
489 #[inline(always)]
490 pub fn is_prsch15(&self) -> bool { *self == PRSSEL_A::PRSCH15 }
491 #[doc = "Checks if the value of the field is `PRSCH16`"]
492 #[inline(always)]
493 pub fn is_prsch16(&self) -> bool { *self == PRSSEL_A::PRSCH16 }
494 #[doc = "Checks if the value of the field is `PRSCH17`"]
495 #[inline(always)]
496 pub fn is_prsch17(&self) -> bool { *self == PRSSEL_A::PRSCH17 }
497 #[doc = "Checks if the value of the field is `PRSCH18`"]
498 #[inline(always)]
499 pub fn is_prsch18(&self) -> bool { *self == PRSSEL_A::PRSCH18 }
500 #[doc = "Checks if the value of the field is `PRSCH19`"]
501 #[inline(always)]
502 pub fn is_prsch19(&self) -> bool { *self == PRSSEL_A::PRSCH19 }
503 #[doc = "Checks if the value of the field is `PRSCH20`"]
504 #[inline(always)]
505 pub fn is_prsch20(&self) -> bool { *self == PRSSEL_A::PRSCH20 }
506 #[doc = "Checks if the value of the field is `PRSCH21`"]
507 #[inline(always)]
508 pub fn is_prsch21(&self) -> bool { *self == PRSSEL_A::PRSCH21 }
509 #[doc = "Checks if the value of the field is `PRSCH22`"]
510 #[inline(always)]
511 pub fn is_prsch22(&self) -> bool { *self == PRSSEL_A::PRSCH22 }
512 #[doc = "Checks if the value of the field is `PRSCH23`"]
513 #[inline(always)]
514 pub fn is_prsch23(&self) -> bool { *self == PRSSEL_A::PRSCH23 }
515}
516#[doc = "Write proxy for field `PRSSEL`"]
517pub struct PRSSEL_W<'a> {
518 w: &'a mut W,
519}
520impl<'a> PRSSEL_W<'a> {
521 #[doc = r"Writes `variant` to the field"]
522 #[inline(always)]
523 pub fn variant(self, variant: PRSSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } }
524 #[doc = "PRS Channel 0 selected as input"]
525 #[inline(always)]
526 pub fn prsch0(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH0) }
527 #[doc = "PRS Channel 1 selected as input"]
528 #[inline(always)]
529 pub fn prsch1(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH1) }
530 #[doc = "PRS Channel 2 selected as input"]
531 #[inline(always)]
532 pub fn prsch2(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH2) }
533 #[doc = "PRS Channel 3 selected as input"]
534 #[inline(always)]
535 pub fn prsch3(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH3) }
536 #[doc = "PRS Channel 4 selected as input"]
537 #[inline(always)]
538 pub fn prsch4(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH4) }
539 #[doc = "PRS Channel 5 selected as input"]
540 #[inline(always)]
541 pub fn prsch5(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH5) }
542 #[doc = "PRS Channel 6 selected as input"]
543 #[inline(always)]
544 pub fn prsch6(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH6) }
545 #[doc = "PRS Channel 7 selected as input"]
546 #[inline(always)]
547 pub fn prsch7(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH7) }
548 #[doc = "PRS Channel 8 selected as input"]
549 #[inline(always)]
550 pub fn prsch8(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH8) }
551 #[doc = "PRS Channel 9 selected as input"]
552 #[inline(always)]
553 pub fn prsch9(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH9) }
554 #[doc = "PRS Channel 10 selected as input"]
555 #[inline(always)]
556 pub fn prsch10(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH10) }
557 #[doc = "PRS Channel 11 selected as input"]
558 #[inline(always)]
559 pub fn prsch11(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH11) }
560 #[doc = "PRS Channel 12 selected as input"]
561 #[inline(always)]
562 pub fn prsch12(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH12) }
563 #[doc = "PRS Channel 13 selected as input"]
564 #[inline(always)]
565 pub fn prsch13(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH13) }
566 #[doc = "PRS Channel 14 selected as input"]
567 #[inline(always)]
568 pub fn prsch14(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH14) }
569 #[doc = "PRS Channel 15 selected as input"]
570 #[inline(always)]
571 pub fn prsch15(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH15) }
572 #[doc = "PRS Channel 16 selected as input"]
573 #[inline(always)]
574 pub fn prsch16(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH16) }
575 #[doc = "PRS Channel 17 selected as input"]
576 #[inline(always)]
577 pub fn prsch17(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH17) }
578 #[doc = "PRS Channel 18 selected as input"]
579 #[inline(always)]
580 pub fn prsch18(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH18) }
581 #[doc = "PRS Channel 19 selected as input"]
582 #[inline(always)]
583 pub fn prsch19(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH19) }
584 #[doc = "PRS Channel 20 selected as input"]
585 #[inline(always)]
586 pub fn prsch20(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH20) }
587 #[doc = "PRS Channel 21 selected as input"]
588 #[inline(always)]
589 pub fn prsch21(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH21) }
590 #[doc = "PRS Channel 22 selected as input"]
591 #[inline(always)]
592 pub fn prsch22(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH22) }
593 #[doc = "PRS Channel 23 selected as input"]
594 #[inline(always)]
595 pub fn prsch23(self) -> &'a mut W { self.variant(PRSSEL_A::PRSCH23) }
596 #[doc = r"Writes raw bits to the field"]
597 #[inline(always)]
598 pub unsafe fn bits(self, value: u8) -> &'a mut W {
599 self.w.bits = (self.w.bits & !(0x1f << 16)) | (((value as u32) & 0x1f) << 16);
600 self.w
601 }
602}
603#[doc = "Input Capture Edge Select\n\nValue on reset: 0"]
604#[derive(Clone, Copy, Debug, PartialEq)]
605#[repr(u8)]
606pub enum ICEDGE_A {
607 #[doc = "0: Rising edges detected"]
608 RISING = 0,
609 #[doc = "1: Falling edges detected"]
610 FALLING = 1,
611 #[doc = "2: Both edges detected"]
612 BOTH = 2,
613 #[doc = "3: No edge detection, signal is left as it is"]
614 NONE = 3,
615}
616impl From<ICEDGE_A> for u8 {
617 #[inline(always)]
618 fn from(variant: ICEDGE_A) -> Self { variant as _ }
619}
620#[doc = "Reader of field `ICEDGE`"]
621pub type ICEDGE_R = crate::R<u8, ICEDGE_A>;
622impl ICEDGE_R {
623 #[doc = r"Get enumerated values variant"]
624 #[inline(always)]
625 pub fn variant(&self) -> ICEDGE_A {
626 match self.bits {
627 0 => ICEDGE_A::RISING,
628 1 => ICEDGE_A::FALLING,
629 2 => ICEDGE_A::BOTH,
630 3 => ICEDGE_A::NONE,
631 _ => unreachable!(),
632 }
633 }
634 #[doc = "Checks if the value of the field is `RISING`"]
635 #[inline(always)]
636 pub fn is_rising(&self) -> bool { *self == ICEDGE_A::RISING }
637 #[doc = "Checks if the value of the field is `FALLING`"]
638 #[inline(always)]
639 pub fn is_falling(&self) -> bool { *self == ICEDGE_A::FALLING }
640 #[doc = "Checks if the value of the field is `BOTH`"]
641 #[inline(always)]
642 pub fn is_both(&self) -> bool { *self == ICEDGE_A::BOTH }
643 #[doc = "Checks if the value of the field is `NONE`"]
644 #[inline(always)]
645 pub fn is_none(&self) -> bool { *self == ICEDGE_A::NONE }
646}
647#[doc = "Write proxy for field `ICEDGE`"]
648pub struct ICEDGE_W<'a> {
649 w: &'a mut W,
650}
651impl<'a> ICEDGE_W<'a> {
652 #[doc = r"Writes `variant` to the field"]
653 #[inline(always)]
654 pub fn variant(self, variant: ICEDGE_A) -> &'a mut W {
655 {
656 self.bits(variant.into())
657 }
658 }
659 #[doc = "Rising edges detected"]
660 #[inline(always)]
661 pub fn rising(self) -> &'a mut W { self.variant(ICEDGE_A::RISING) }
662 #[doc = "Falling edges detected"]
663 #[inline(always)]
664 pub fn falling(self) -> &'a mut W { self.variant(ICEDGE_A::FALLING) }
665 #[doc = "Both edges detected"]
666 #[inline(always)]
667 pub fn both(self) -> &'a mut W { self.variant(ICEDGE_A::BOTH) }
668 #[doc = "No edge detection, signal is left as it is"]
669 #[inline(always)]
670 pub fn none(self) -> &'a mut W { self.variant(ICEDGE_A::NONE) }
671 #[doc = r"Writes raw bits to the field"]
672 #[inline(always)]
673 pub fn bits(self, value: u8) -> &'a mut W {
674 self.w.bits = (self.w.bits & !(0x03 << 24)) | (((value as u32) & 0x03) << 24);
675 self.w
676 }
677}
678#[doc = "Input Capture Event Control\n\nValue on reset: 0"]
679#[derive(Clone, Copy, Debug, PartialEq)]
680#[repr(u8)]
681pub enum ICEVCTRL_A {
682 #[doc = "0: PRS output pulse and interrupt flag set on every capture"]
683 EVERYEDGE = 0,
684 #[doc = "1: PRS output pulse and interrupt flag set on every second capture"]
685 EVERYSECONDEDGE = 1,
686 #[doc = "2: PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
687 RISING = 2,
688 #[doc = "3: PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
689 FALLING = 3,
690}
691impl From<ICEVCTRL_A> for u8 {
692 #[inline(always)]
693 fn from(variant: ICEVCTRL_A) -> Self { variant as _ }
694}
695#[doc = "Reader of field `ICEVCTRL`"]
696pub type ICEVCTRL_R = crate::R<u8, ICEVCTRL_A>;
697impl ICEVCTRL_R {
698 #[doc = r"Get enumerated values variant"]
699 #[inline(always)]
700 pub fn variant(&self) -> ICEVCTRL_A {
701 match self.bits {
702 0 => ICEVCTRL_A::EVERYEDGE,
703 1 => ICEVCTRL_A::EVERYSECONDEDGE,
704 2 => ICEVCTRL_A::RISING,
705 3 => ICEVCTRL_A::FALLING,
706 _ => unreachable!(),
707 }
708 }
709 #[doc = "Checks if the value of the field is `EVERYEDGE`"]
710 #[inline(always)]
711 pub fn is_everyedge(&self) -> bool { *self == ICEVCTRL_A::EVERYEDGE }
712 #[doc = "Checks if the value of the field is `EVERYSECONDEDGE`"]
713 #[inline(always)]
714 pub fn is_everysecondedge(&self) -> bool { *self == ICEVCTRL_A::EVERYSECONDEDGE }
715 #[doc = "Checks if the value of the field is `RISING`"]
716 #[inline(always)]
717 pub fn is_rising(&self) -> bool { *self == ICEVCTRL_A::RISING }
718 #[doc = "Checks if the value of the field is `FALLING`"]
719 #[inline(always)]
720 pub fn is_falling(&self) -> bool { *self == ICEVCTRL_A::FALLING }
721}
722#[doc = "Write proxy for field `ICEVCTRL`"]
723pub struct ICEVCTRL_W<'a> {
724 w: &'a mut W,
725}
726impl<'a> ICEVCTRL_W<'a> {
727 #[doc = r"Writes `variant` to the field"]
728 #[inline(always)]
729 pub fn variant(self, variant: ICEVCTRL_A) -> &'a mut W {
730 {
731 self.bits(variant.into())
732 }
733 }
734 #[doc = "PRS output pulse and interrupt flag set on every capture"]
735 #[inline(always)]
736 pub fn everyedge(self) -> &'a mut W { self.variant(ICEVCTRL_A::EVERYEDGE) }
737 #[doc = "PRS output pulse and interrupt flag set on every second capture"]
738 #[inline(always)]
739 pub fn everysecondedge(self) -> &'a mut W { self.variant(ICEVCTRL_A::EVERYSECONDEDGE) }
740 #[doc = "PRS output pulse and interrupt flag set on rising edge only (if ICEDGE = BOTH)"]
741 #[inline(always)]
742 pub fn rising(self) -> &'a mut W { self.variant(ICEVCTRL_A::RISING) }
743 #[doc = "PRS output pulse and interrupt flag set on falling edge only (if ICEDGE = BOTH)"]
744 #[inline(always)]
745 pub fn falling(self) -> &'a mut W { self.variant(ICEVCTRL_A::FALLING) }
746 #[doc = r"Writes raw bits to the field"]
747 #[inline(always)]
748 pub fn bits(self, value: u8) -> &'a mut W {
749 self.w.bits = (self.w.bits & !(0x03 << 26)) | (((value as u32) & 0x03) << 26);
750 self.w
751 }
752}
753#[doc = "Reader of field `PRSCONF`"]
754pub type PRSCONF_R = crate::R<bool, bool>;
755#[doc = "Write proxy for field `PRSCONF`"]
756pub struct PRSCONF_W<'a> {
757 w: &'a mut W,
758}
759impl<'a> PRSCONF_W<'a> {
760 #[doc = r"Sets the field bit"]
761 #[inline(always)]
762 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
763 #[doc = r"Clears the field bit"]
764 #[inline(always)]
765 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
766 #[doc = r"Writes raw bits to the field"]
767 #[inline(always)]
768 pub fn bit(self, value: bool) -> &'a mut W {
769 self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
770 self.w
771 }
772}
773#[doc = "Reader of field `INSEL`"]
774pub type INSEL_R = crate::R<bool, bool>;
775#[doc = "Write proxy for field `INSEL`"]
776pub struct INSEL_W<'a> {
777 w: &'a mut W,
778}
779impl<'a> INSEL_W<'a> {
780 #[doc = r"Sets the field bit"]
781 #[inline(always)]
782 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
783 #[doc = r"Clears the field bit"]
784 #[inline(always)]
785 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
786 #[doc = r"Writes raw bits to the field"]
787 #[inline(always)]
788 pub fn bit(self, value: bool) -> &'a mut W {
789 self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
790 self.w
791 }
792}
793#[doc = "Reader of field `FILT`"]
794pub type FILT_R = crate::R<bool, bool>;
795#[doc = "Write proxy for field `FILT`"]
796pub struct FILT_W<'a> {
797 w: &'a mut W,
798}
799impl<'a> FILT_W<'a> {
800 #[doc = r"Sets the field bit"]
801 #[inline(always)]
802 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
803 #[doc = r"Clears the field bit"]
804 #[inline(always)]
805 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
806 #[doc = r"Writes raw bits to the field"]
807 #[inline(always)]
808 pub fn bit(self, value: bool) -> &'a mut W {
809 self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
810 self.w
811 }
812}
813impl R {
814 #[doc = "Bits 0:1 - CC Channel Mode"]
815 #[inline(always)]
816 pub fn mode(&self) -> MODE_R { MODE_R::new((self.bits & 0x03) as u8) }
817 #[doc = "Bit 2 - Output Invert"]
818 #[inline(always)]
819 pub fn outinv(&self) -> OUTINV_R { OUTINV_R::new(((self.bits >> 2) & 0x01) != 0) }
820 #[doc = "Bit 4 - Compare Output Initial State"]
821 #[inline(always)]
822 pub fn coist(&self) -> COIST_R { COIST_R::new(((self.bits >> 4) & 0x01) != 0) }
823 #[doc = "Bits 8:9 - Compare Match Output Action"]
824 #[inline(always)]
825 pub fn cmoa(&self) -> CMOA_R { CMOA_R::new(((self.bits >> 8) & 0x03) as u8) }
826 #[doc = "Bits 10:11 - Counter Overflow Output Action"]
827 #[inline(always)]
828 pub fn cofoa(&self) -> COFOA_R { COFOA_R::new(((self.bits >> 10) & 0x03) as u8) }
829 #[doc = "Bits 12:13 - Counter Underflow Output Action"]
830 #[inline(always)]
831 pub fn cufoa(&self) -> CUFOA_R { CUFOA_R::new(((self.bits >> 12) & 0x03) as u8) }
832 #[doc = "Bits 16:20 - Compare/Capture Channel PRS Input Channel Selection"]
833 #[inline(always)]
834 pub fn prssel(&self) -> PRSSEL_R { PRSSEL_R::new(((self.bits >> 16) & 0x1f) as u8) }
835 #[doc = "Bits 24:25 - Input Capture Edge Select"]
836 #[inline(always)]
837 pub fn icedge(&self) -> ICEDGE_R { ICEDGE_R::new(((self.bits >> 24) & 0x03) as u8) }
838 #[doc = "Bits 26:27 - Input Capture Event Control"]
839 #[inline(always)]
840 pub fn icevctrl(&self) -> ICEVCTRL_R { ICEVCTRL_R::new(((self.bits >> 26) & 0x03) as u8) }
841 #[doc = "Bit 28 - PRS Configuration"]
842 #[inline(always)]
843 pub fn prsconf(&self) -> PRSCONF_R { PRSCONF_R::new(((self.bits >> 28) & 0x01) != 0) }
844 #[doc = "Bit 29 - Input Selection"]
845 #[inline(always)]
846 pub fn insel(&self) -> INSEL_R { INSEL_R::new(((self.bits >> 29) & 0x01) != 0) }
847 #[doc = "Bit 30 - Digital Filter"]
848 #[inline(always)]
849 pub fn filt(&self) -> FILT_R { FILT_R::new(((self.bits >> 30) & 0x01) != 0) }
850}
851impl W {
852 #[doc = "Bits 0:1 - CC Channel Mode"]
853 #[inline(always)]
854 pub fn mode(&mut self) -> MODE_W { MODE_W { w: self } }
855 #[doc = "Bit 2 - Output Invert"]
856 #[inline(always)]
857 pub fn outinv(&mut self) -> OUTINV_W { OUTINV_W { w: self } }
858 #[doc = "Bit 4 - Compare Output Initial State"]
859 #[inline(always)]
860 pub fn coist(&mut self) -> COIST_W { COIST_W { w: self } }
861 #[doc = "Bits 8:9 - Compare Match Output Action"]
862 #[inline(always)]
863 pub fn cmoa(&mut self) -> CMOA_W { CMOA_W { w: self } }
864 #[doc = "Bits 10:11 - Counter Overflow Output Action"]
865 #[inline(always)]
866 pub fn cofoa(&mut self) -> COFOA_W { COFOA_W { w: self } }
867 #[doc = "Bits 12:13 - Counter Underflow Output Action"]
868 #[inline(always)]
869 pub fn cufoa(&mut self) -> CUFOA_W { CUFOA_W { w: self } }
870 #[doc = "Bits 16:20 - Compare/Capture Channel PRS Input Channel Selection"]
871 #[inline(always)]
872 pub fn prssel(&mut self) -> PRSSEL_W { PRSSEL_W { w: self } }
873 #[doc = "Bits 24:25 - Input Capture Edge Select"]
874 #[inline(always)]
875 pub fn icedge(&mut self) -> ICEDGE_W { ICEDGE_W { w: self } }
876 #[doc = "Bits 26:27 - Input Capture Event Control"]
877 #[inline(always)]
878 pub fn icevctrl(&mut self) -> ICEVCTRL_W { ICEVCTRL_W { w: self } }
879 #[doc = "Bit 28 - PRS Configuration"]
880 #[inline(always)]
881 pub fn prsconf(&mut self) -> PRSCONF_W { PRSCONF_W { w: self } }
882 #[doc = "Bit 29 - Input Selection"]
883 #[inline(always)]
884 pub fn insel(&mut self) -> INSEL_W { INSEL_W { w: self } }
885 #[doc = "Bit 30 - Digital Filter"]
886 #[inline(always)]
887 pub fn filt(&mut self) -> FILT_W { FILT_W { w: self } }
888}