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}
279impl From<PRSSEL_A> for u8 {
280 #[inline(always)]
281 fn from(variant: PRSSEL_A) -> Self {
282 variant as _
283 }
284}
285#[doc = "Field `PRSSEL` reader - Compare/Capture Channel PRS Input Channel Selection"]
286pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
287impl PRSSEL_R {
288 #[doc = "Get enumerated values variant"]
289 #[inline(always)]
290 pub fn variant(&self) -> PRSSEL_A {
291 match self.bits {
292 0 => PRSSEL_A::PRSCH0,
293 1 => PRSSEL_A::PRSCH1,
294 2 => PRSSEL_A::PRSCH2,
295 3 => PRSSEL_A::PRSCH3,
296 4 => PRSSEL_A::PRSCH4,
297 5 => PRSSEL_A::PRSCH5,
298 6 => PRSSEL_A::PRSCH6,
299 7 => PRSSEL_A::PRSCH7,
300 _ => unreachable!(),
301 }
302 }
303 #[doc = "Checks if the value of the field is `PRSCH0`"]
304 #[inline(always)]
305 pub fn is_prsch0(&self) -> bool {
306 *self == PRSSEL_A::PRSCH0
307 }
308 #[doc = "Checks if the value of the field is `PRSCH1`"]
309 #[inline(always)]
310 pub fn is_prsch1(&self) -> bool {
311 *self == PRSSEL_A::PRSCH1
312 }
313 #[doc = "Checks if the value of the field is `PRSCH2`"]
314 #[inline(always)]
315 pub fn is_prsch2(&self) -> bool {
316 *self == PRSSEL_A::PRSCH2
317 }
318 #[doc = "Checks if the value of the field is `PRSCH3`"]
319 #[inline(always)]
320 pub fn is_prsch3(&self) -> bool {
321 *self == PRSSEL_A::PRSCH3
322 }
323 #[doc = "Checks if the value of the field is `PRSCH4`"]
324 #[inline(always)]
325 pub fn is_prsch4(&self) -> bool {
326 *self == PRSSEL_A::PRSCH4
327 }
328 #[doc = "Checks if the value of the field is `PRSCH5`"]
329 #[inline(always)]
330 pub fn is_prsch5(&self) -> bool {
331 *self == PRSSEL_A::PRSCH5
332 }
333 #[doc = "Checks if the value of the field is `PRSCH6`"]
334 #[inline(always)]
335 pub fn is_prsch6(&self) -> bool {
336 *self == PRSSEL_A::PRSCH6
337 }
338 #[doc = "Checks if the value of the field is `PRSCH7`"]
339 #[inline(always)]
340 pub fn is_prsch7(&self) -> bool {
341 *self == PRSSEL_A::PRSCH7
342 }
343}
344#[doc = "Field `PRSSEL` writer - Compare/Capture Channel PRS Input Channel Selection"]
345pub type PRSSEL_W<'a> = crate::FieldWriterSafe<'a, u32, CC0_CTRL_SPEC, u8, PRSSEL_A, 3, 6>;
346impl<'a> PRSSEL_W<'a> {
347 #[doc = "PRS Channel 0 selected as input"]
348 #[inline(always)]
349 pub fn prsch0(self) -> &'a mut W {
350 self.variant(PRSSEL_A::PRSCH0)
351 }
352 #[doc = "PRS Channel 1 selected as input"]
353 #[inline(always)]
354 pub fn prsch1(self) -> &'a mut W {
355 self.variant(PRSSEL_A::PRSCH1)
356 }
357 #[doc = "PRS Channel 2 selected as input"]
358 #[inline(always)]
359 pub fn prsch2(self) -> &'a mut W {
360 self.variant(PRSSEL_A::PRSCH2)
361 }
362 #[doc = "PRS Channel 3 selected as input"]
363 #[inline(always)]
364 pub fn prsch3(self) -> &'a mut W {
365 self.variant(PRSSEL_A::PRSCH3)
366 }
367 #[doc = "PRS Channel 4 selected as input"]
368 #[inline(always)]
369 pub fn prsch4(self) -> &'a mut W {
370 self.variant(PRSSEL_A::PRSCH4)
371 }
372 #[doc = "PRS Channel 5 selected as input"]
373 #[inline(always)]
374 pub fn prsch5(self) -> &'a mut W {
375 self.variant(PRSSEL_A::PRSCH5)
376 }
377 #[doc = "PRS Channel 6 selected as input"]
378 #[inline(always)]
379 pub fn prsch6(self) -> &'a mut W {
380 self.variant(PRSSEL_A::PRSCH6)
381 }
382 #[doc = "PRS Channel 7 selected as input"]
383 #[inline(always)]
384 pub fn prsch7(self) -> &'a mut W {
385 self.variant(PRSSEL_A::PRSCH7)
386 }
387}
388#[doc = "Field `COMPBASE` reader - Capture Compare Channel Comparison Base"]
389pub type COMPBASE_R = crate::BitReader<bool>;
390#[doc = "Field `COMPBASE` writer - Capture Compare Channel Comparison Base"]
391pub type COMPBASE_W<'a> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, 11>;
392#[doc = "Field `COMPMASK` reader - Capture Compare Channel Comparison Mask"]
393pub type COMPMASK_R = crate::FieldReader<u8, u8>;
394#[doc = "Field `COMPMASK` writer - Capture Compare Channel Comparison Mask"]
395pub type COMPMASK_W<'a> = crate::FieldWriter<'a, u32, CC0_CTRL_SPEC, u8, u8, 5, 12>;
396#[doc = "Field `DAYCC` reader - Day Capture/Compare Selection"]
397pub type DAYCC_R = crate::BitReader<bool>;
398#[doc = "Field `DAYCC` writer - Day Capture/Compare Selection"]
399pub type DAYCC_W<'a> = crate::BitWriter<'a, u32, CC0_CTRL_SPEC, bool, 17>;
400impl R {
401 #[doc = "Bits 0:1 - CC Channel Mode"]
402 #[inline(always)]
403 pub fn mode(&self) -> MODE_R {
404 MODE_R::new((self.bits & 3) as u8)
405 }
406 #[doc = "Bits 2:3 - Compare Match Output Action"]
407 #[inline(always)]
408 pub fn cmoa(&self) -> CMOA_R {
409 CMOA_R::new(((self.bits >> 2) & 3) as u8)
410 }
411 #[doc = "Bits 4:5 - Input Capture Edge Select"]
412 #[inline(always)]
413 pub fn icedge(&self) -> ICEDGE_R {
414 ICEDGE_R::new(((self.bits >> 4) & 3) as u8)
415 }
416 #[doc = "Bits 6:8 - Compare/Capture Channel PRS Input Channel Selection"]
417 #[inline(always)]
418 pub fn prssel(&self) -> PRSSEL_R {
419 PRSSEL_R::new(((self.bits >> 6) & 7) as u8)
420 }
421 #[doc = "Bit 11 - Capture Compare Channel Comparison Base"]
422 #[inline(always)]
423 pub fn compbase(&self) -> COMPBASE_R {
424 COMPBASE_R::new(((self.bits >> 11) & 1) != 0)
425 }
426 #[doc = "Bits 12:16 - Capture Compare Channel Comparison Mask"]
427 #[inline(always)]
428 pub fn compmask(&self) -> COMPMASK_R {
429 COMPMASK_R::new(((self.bits >> 12) & 0x1f) as u8)
430 }
431 #[doc = "Bit 17 - Day Capture/Compare Selection"]
432 #[inline(always)]
433 pub fn daycc(&self) -> DAYCC_R {
434 DAYCC_R::new(((self.bits >> 17) & 1) != 0)
435 }
436}
437impl W {
438 #[doc = "Bits 0:1 - CC Channel Mode"]
439 #[inline(always)]
440 pub fn mode(&mut self) -> MODE_W {
441 MODE_W::new(self)
442 }
443 #[doc = "Bits 2:3 - Compare Match Output Action"]
444 #[inline(always)]
445 pub fn cmoa(&mut self) -> CMOA_W {
446 CMOA_W::new(self)
447 }
448 #[doc = "Bits 4:5 - Input Capture Edge Select"]
449 #[inline(always)]
450 pub fn icedge(&mut self) -> ICEDGE_W {
451 ICEDGE_W::new(self)
452 }
453 #[doc = "Bits 6:8 - Compare/Capture Channel PRS Input Channel Selection"]
454 #[inline(always)]
455 pub fn prssel(&mut self) -> PRSSEL_W {
456 PRSSEL_W::new(self)
457 }
458 #[doc = "Bit 11 - Capture Compare Channel Comparison Base"]
459 #[inline(always)]
460 pub fn compbase(&mut self) -> COMPBASE_W {
461 COMPBASE_W::new(self)
462 }
463 #[doc = "Bits 12:16 - Capture Compare Channel Comparison Mask"]
464 #[inline(always)]
465 pub fn compmask(&mut self) -> COMPMASK_W {
466 COMPMASK_W::new(self)
467 }
468 #[doc = "Bit 17 - Day Capture/Compare Selection"]
469 #[inline(always)]
470 pub fn daycc(&mut self) -> DAYCC_W {
471 DAYCC_W::new(self)
472 }
473 #[doc = "Writes raw bits to the register."]
474 #[inline(always)]
475 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
476 self.0.bits(bits);
477 self
478 }
479}
480#[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"]
481pub struct CC0_CTRL_SPEC;
482impl crate::RegisterSpec for CC0_CTRL_SPEC {
483 type Ux = u32;
484}
485#[doc = "`read()` method returns [cc0_ctrl::R](R) reader structure"]
486impl crate::Readable for CC0_CTRL_SPEC {
487 type Reader = R;
488}
489#[doc = "`write(|w| ..)` method takes [cc0_ctrl::W](W) writer structure"]
490impl crate::Writable for CC0_CTRL_SPEC {
491 type Writer = W;
492}
493#[doc = "`reset()` method sets CC0_CTRL to value 0"]
494impl crate::Resettable for CC0_CTRL_SPEC {
495 #[inline(always)]
496 fn reset_value() -> Self::Ux {
497 0
498 }
499}