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