1#[doc = "Register `CFG` reader"]
2pub type R = crate::R<CfgSpec>;
3#[doc = "Register `CFG` writer"]
4pub type W = crate::W<CfgSpec>;
5#[doc = "Enable Capture 0\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Capen0 {
9 #[doc = "0: Disable"]
10 Capen0isdisabled = 0,
11 #[doc = "1: Enable"]
12 Capen0isenabled = 1,
13}
14impl From<Capen0> for bool {
15 #[inline(always)]
16 fn from(variant: Capen0) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `CAPEN0` reader - Enable Capture 0"]
21pub type Capen0R = crate::BitReader<Capen0>;
22impl Capen0R {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Capen0 {
26 match self.bits {
27 false => Capen0::Capen0isdisabled,
28 true => Capen0::Capen0isenabled,
29 }
30 }
31 #[doc = "Disable"]
32 #[inline(always)]
33 pub fn is_capen0isdisabled(&self) -> bool {
34 *self == Capen0::Capen0isdisabled
35 }
36 #[doc = "Enable"]
37 #[inline(always)]
38 pub fn is_capen0isenabled(&self) -> bool {
39 *self == Capen0::Capen0isenabled
40 }
41}
42#[doc = "Field `CAPEN0` writer - Enable Capture 0"]
43pub type Capen0W<'a, REG> = crate::BitWriter<'a, REG, Capen0>;
44impl<'a, REG> Capen0W<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Disable"]
49 #[inline(always)]
50 pub fn capen0isdisabled(self) -> &'a mut crate::W<REG> {
51 self.variant(Capen0::Capen0isdisabled)
52 }
53 #[doc = "Enable"]
54 #[inline(always)]
55 pub fn capen0isenabled(self) -> &'a mut crate::W<REG> {
56 self.variant(Capen0::Capen0isenabled)
57 }
58}
59#[doc = "Enable Capture 1\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Capen1 {
63 #[doc = "0: Disable"]
64 Capen1isdisabled = 0,
65 #[doc = "1: Enable"]
66 Capen1isenabled = 1,
67}
68impl From<Capen1> for bool {
69 #[inline(always)]
70 fn from(variant: Capen1) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `CAPEN1` reader - Enable Capture 1"]
75pub type Capen1R = crate::BitReader<Capen1>;
76impl Capen1R {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Capen1 {
80 match self.bits {
81 false => Capen1::Capen1isdisabled,
82 true => Capen1::Capen1isenabled,
83 }
84 }
85 #[doc = "Disable"]
86 #[inline(always)]
87 pub fn is_capen1isdisabled(&self) -> bool {
88 *self == Capen1::Capen1isdisabled
89 }
90 #[doc = "Enable"]
91 #[inline(always)]
92 pub fn is_capen1isenabled(&self) -> bool {
93 *self == Capen1::Capen1isenabled
94 }
95}
96#[doc = "Field `CAPEN1` writer - Enable Capture 1"]
97pub type Capen1W<'a, REG> = crate::BitWriter<'a, REG, Capen1>;
98impl<'a, REG> Capen1W<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Disable"]
103 #[inline(always)]
104 pub fn capen1isdisabled(self) -> &'a mut crate::W<REG> {
105 self.variant(Capen1::Capen1isdisabled)
106 }
107 #[doc = "Enable"]
108 #[inline(always)]
109 pub fn capen1isenabled(self) -> &'a mut crate::W<REG> {
110 self.variant(Capen1::Capen1isenabled)
111 }
112}
113#[doc = "Enable Capture 2\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Capen2 {
117 #[doc = "0: Disable"]
118 Capen2isdisabled = 0,
119 #[doc = "1: Enable"]
120 Capen2isenabled = 1,
121}
122impl From<Capen2> for bool {
123 #[inline(always)]
124 fn from(variant: Capen2) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `CAPEN2` reader - Enable Capture 2"]
129pub type Capen2R = crate::BitReader<Capen2>;
130impl Capen2R {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Capen2 {
134 match self.bits {
135 false => Capen2::Capen2isdisabled,
136 true => Capen2::Capen2isenabled,
137 }
138 }
139 #[doc = "Disable"]
140 #[inline(always)]
141 pub fn is_capen2isdisabled(&self) -> bool {
142 *self == Capen2::Capen2isdisabled
143 }
144 #[doc = "Enable"]
145 #[inline(always)]
146 pub fn is_capen2isenabled(&self) -> bool {
147 *self == Capen2::Capen2isenabled
148 }
149}
150#[doc = "Field `CAPEN2` writer - Enable Capture 2"]
151pub type Capen2W<'a, REG> = crate::BitWriter<'a, REG, Capen2>;
152impl<'a, REG> Capen2W<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Disable"]
157 #[inline(always)]
158 pub fn capen2isdisabled(self) -> &'a mut crate::W<REG> {
159 self.variant(Capen2::Capen2isdisabled)
160 }
161 #[doc = "Enable"]
162 #[inline(always)]
163 pub fn capen2isenabled(self) -> &'a mut crate::W<REG> {
164 self.variant(Capen2::Capen2isenabled)
165 }
166}
167#[doc = "Enable Capture 3\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Capen3 {
171 #[doc = "0: Disable"]
172 Capen3isdisabled = 0,
173 #[doc = "1: Enable"]
174 Capen3isenabled = 1,
175}
176impl From<Capen3> for bool {
177 #[inline(always)]
178 fn from(variant: Capen3) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `CAPEN3` reader - Enable Capture 3"]
183pub type Capen3R = crate::BitReader<Capen3>;
184impl Capen3R {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> Capen3 {
188 match self.bits {
189 false => Capen3::Capen3isdisabled,
190 true => Capen3::Capen3isenabled,
191 }
192 }
193 #[doc = "Disable"]
194 #[inline(always)]
195 pub fn is_capen3isdisabled(&self) -> bool {
196 *self == Capen3::Capen3isdisabled
197 }
198 #[doc = "Enable"]
199 #[inline(always)]
200 pub fn is_capen3isenabled(&self) -> bool {
201 *self == Capen3::Capen3isenabled
202 }
203}
204#[doc = "Field `CAPEN3` writer - Enable Capture 3"]
205pub type Capen3W<'a, REG> = crate::BitWriter<'a, REG, Capen3>;
206impl<'a, REG> Capen3W<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "Disable"]
211 #[inline(always)]
212 pub fn capen3isdisabled(self) -> &'a mut crate::W<REG> {
213 self.variant(Capen3::Capen3isdisabled)
214 }
215 #[doc = "Enable"]
216 #[inline(always)]
217 pub fn capen3isenabled(self) -> &'a mut crate::W<REG> {
218 self.variant(Capen3::Capen3isenabled)
219 }
220}
221#[doc = "Capture Polarity 0\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Cappol0 {
225 #[doc = "0: Positive"]
226 Cappol0posedgecapture = 0,
227 #[doc = "1: Negative"]
228 Cappol0negedgecapture = 1,
229}
230impl From<Cappol0> for bool {
231 #[inline(always)]
232 fn from(variant: Cappol0) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `CAPPOL0` reader - Capture Polarity 0"]
237pub type Cappol0R = crate::BitReader<Cappol0>;
238impl Cappol0R {
239 #[doc = "Get enumerated values variant"]
240 #[inline(always)]
241 pub const fn variant(&self) -> Cappol0 {
242 match self.bits {
243 false => Cappol0::Cappol0posedgecapture,
244 true => Cappol0::Cappol0negedgecapture,
245 }
246 }
247 #[doc = "Positive"]
248 #[inline(always)]
249 pub fn is_cappol0posedgecapture(&self) -> bool {
250 *self == Cappol0::Cappol0posedgecapture
251 }
252 #[doc = "Negative"]
253 #[inline(always)]
254 pub fn is_cappol0negedgecapture(&self) -> bool {
255 *self == Cappol0::Cappol0negedgecapture
256 }
257}
258#[doc = "Field `CAPPOL0` writer - Capture Polarity 0"]
259pub type Cappol0W<'a, REG> = crate::BitWriter<'a, REG, Cappol0>;
260impl<'a, REG> Cappol0W<'a, REG>
261where
262 REG: crate::Writable + crate::RegisterSpec,
263{
264 #[doc = "Positive"]
265 #[inline(always)]
266 pub fn cappol0posedgecapture(self) -> &'a mut crate::W<REG> {
267 self.variant(Cappol0::Cappol0posedgecapture)
268 }
269 #[doc = "Negative"]
270 #[inline(always)]
271 pub fn cappol0negedgecapture(self) -> &'a mut crate::W<REG> {
272 self.variant(Cappol0::Cappol0negedgecapture)
273 }
274}
275#[doc = "Capture-Polarity 1\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Cappol1 {
279 #[doc = "0: Positive"]
280 Cappol1posedgecapture = 0,
281 #[doc = "1: Negative"]
282 Cappol1negedgecapture = 1,
283}
284impl From<Cappol1> for bool {
285 #[inline(always)]
286 fn from(variant: Cappol1) -> Self {
287 variant as u8 != 0
288 }
289}
290#[doc = "Field `CAPPOL1` reader - Capture-Polarity 1"]
291pub type Cappol1R = crate::BitReader<Cappol1>;
292impl Cappol1R {
293 #[doc = "Get enumerated values variant"]
294 #[inline(always)]
295 pub const fn variant(&self) -> Cappol1 {
296 match self.bits {
297 false => Cappol1::Cappol1posedgecapture,
298 true => Cappol1::Cappol1negedgecapture,
299 }
300 }
301 #[doc = "Positive"]
302 #[inline(always)]
303 pub fn is_cappol1posedgecapture(&self) -> bool {
304 *self == Cappol1::Cappol1posedgecapture
305 }
306 #[doc = "Negative"]
307 #[inline(always)]
308 pub fn is_cappol1negedgecapture(&self) -> bool {
309 *self == Cappol1::Cappol1negedgecapture
310 }
311}
312#[doc = "Field `CAPPOL1` writer - Capture-Polarity 1"]
313pub type Cappol1W<'a, REG> = crate::BitWriter<'a, REG, Cappol1>;
314impl<'a, REG> Cappol1W<'a, REG>
315where
316 REG: crate::Writable + crate::RegisterSpec,
317{
318 #[doc = "Positive"]
319 #[inline(always)]
320 pub fn cappol1posedgecapture(self) -> &'a mut crate::W<REG> {
321 self.variant(Cappol1::Cappol1posedgecapture)
322 }
323 #[doc = "Negative"]
324 #[inline(always)]
325 pub fn cappol1negedgecapture(self) -> &'a mut crate::W<REG> {
326 self.variant(Cappol1::Cappol1negedgecapture)
327 }
328}
329#[doc = "Capture Polarity 2\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum Cappol2 {
333 #[doc = "0: Positive"]
334 Cappol2posedgecapture = 0,
335 #[doc = "1: Negative"]
336 Cappol2negedgecapture = 1,
337}
338impl From<Cappol2> for bool {
339 #[inline(always)]
340 fn from(variant: Cappol2) -> Self {
341 variant as u8 != 0
342 }
343}
344#[doc = "Field `CAPPOL2` reader - Capture Polarity 2"]
345pub type Cappol2R = crate::BitReader<Cappol2>;
346impl Cappol2R {
347 #[doc = "Get enumerated values variant"]
348 #[inline(always)]
349 pub const fn variant(&self) -> Cappol2 {
350 match self.bits {
351 false => Cappol2::Cappol2posedgecapture,
352 true => Cappol2::Cappol2negedgecapture,
353 }
354 }
355 #[doc = "Positive"]
356 #[inline(always)]
357 pub fn is_cappol2posedgecapture(&self) -> bool {
358 *self == Cappol2::Cappol2posedgecapture
359 }
360 #[doc = "Negative"]
361 #[inline(always)]
362 pub fn is_cappol2negedgecapture(&self) -> bool {
363 *self == Cappol2::Cappol2negedgecapture
364 }
365}
366#[doc = "Field `CAPPOL2` writer - Capture Polarity 2"]
367pub type Cappol2W<'a, REG> = crate::BitWriter<'a, REG, Cappol2>;
368impl<'a, REG> Cappol2W<'a, REG>
369where
370 REG: crate::Writable + crate::RegisterSpec,
371{
372 #[doc = "Positive"]
373 #[inline(always)]
374 pub fn cappol2posedgecapture(self) -> &'a mut crate::W<REG> {
375 self.variant(Cappol2::Cappol2posedgecapture)
376 }
377 #[doc = "Negative"]
378 #[inline(always)]
379 pub fn cappol2negedgecapture(self) -> &'a mut crate::W<REG> {
380 self.variant(Cappol2::Cappol2negedgecapture)
381 }
382}
383#[doc = "Capture Polarity 3\n\nValue on reset: 0"]
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
385#[derive(Clone, Copy, Debug, PartialEq, Eq)]
386pub enum Cappol3 {
387 #[doc = "0: Positive"]
388 Cappol3posedgecapture = 0,
389 #[doc = "1: Negative"]
390 Cappol3negedgecapture = 1,
391}
392impl From<Cappol3> for bool {
393 #[inline(always)]
394 fn from(variant: Cappol3) -> Self {
395 variant as u8 != 0
396 }
397}
398#[doc = "Field `CAPPOL3` reader - Capture Polarity 3"]
399pub type Cappol3R = crate::BitReader<Cappol3>;
400impl Cappol3R {
401 #[doc = "Get enumerated values variant"]
402 #[inline(always)]
403 pub const fn variant(&self) -> Cappol3 {
404 match self.bits {
405 false => Cappol3::Cappol3posedgecapture,
406 true => Cappol3::Cappol3negedgecapture,
407 }
408 }
409 #[doc = "Positive"]
410 #[inline(always)]
411 pub fn is_cappol3posedgecapture(&self) -> bool {
412 *self == Cappol3::Cappol3posedgecapture
413 }
414 #[doc = "Negative"]
415 #[inline(always)]
416 pub fn is_cappol3negedgecapture(&self) -> bool {
417 *self == Cappol3::Cappol3negedgecapture
418 }
419}
420#[doc = "Field `CAPPOL3` writer - Capture Polarity 3"]
421pub type Cappol3W<'a, REG> = crate::BitWriter<'a, REG, Cappol3>;
422impl<'a, REG> Cappol3W<'a, REG>
423where
424 REG: crate::Writable + crate::RegisterSpec,
425{
426 #[doc = "Positive"]
427 #[inline(always)]
428 pub fn cappol3posedgecapture(self) -> &'a mut crate::W<REG> {
429 self.variant(Cappol3::Cappol3posedgecapture)
430 }
431 #[doc = "Negative"]
432 #[inline(always)]
433 pub fn cappol3negedgecapture(self) -> &'a mut crate::W<REG> {
434 self.variant(Cappol3::Cappol3negedgecapture)
435 }
436}
437impl R {
438 #[doc = "Bit 0 - Enable Capture 0"]
439 #[inline(always)]
440 pub fn capen0(&self) -> Capen0R {
441 Capen0R::new((self.bits & 1) != 0)
442 }
443 #[doc = "Bit 1 - Enable Capture 1"]
444 #[inline(always)]
445 pub fn capen1(&self) -> Capen1R {
446 Capen1R::new(((self.bits >> 1) & 1) != 0)
447 }
448 #[doc = "Bit 2 - Enable Capture 2"]
449 #[inline(always)]
450 pub fn capen2(&self) -> Capen2R {
451 Capen2R::new(((self.bits >> 2) & 1) != 0)
452 }
453 #[doc = "Bit 3 - Enable Capture 3"]
454 #[inline(always)]
455 pub fn capen3(&self) -> Capen3R {
456 Capen3R::new(((self.bits >> 3) & 1) != 0)
457 }
458 #[doc = "Bit 8 - Capture Polarity 0"]
459 #[inline(always)]
460 pub fn cappol0(&self) -> Cappol0R {
461 Cappol0R::new(((self.bits >> 8) & 1) != 0)
462 }
463 #[doc = "Bit 9 - Capture-Polarity 1"]
464 #[inline(always)]
465 pub fn cappol1(&self) -> Cappol1R {
466 Cappol1R::new(((self.bits >> 9) & 1) != 0)
467 }
468 #[doc = "Bit 10 - Capture Polarity 2"]
469 #[inline(always)]
470 pub fn cappol2(&self) -> Cappol2R {
471 Cappol2R::new(((self.bits >> 10) & 1) != 0)
472 }
473 #[doc = "Bit 11 - Capture Polarity 3"]
474 #[inline(always)]
475 pub fn cappol3(&self) -> Cappol3R {
476 Cappol3R::new(((self.bits >> 11) & 1) != 0)
477 }
478}
479#[cfg(feature = "debug")]
480impl core::fmt::Debug for R {
481 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
482 f.debug_struct("CFG")
483 .field("capen0", &self.capen0())
484 .field("capen1", &self.capen1())
485 .field("capen2", &self.capen2())
486 .field("capen3", &self.capen3())
487 .field("cappol0", &self.cappol0())
488 .field("cappol1", &self.cappol1())
489 .field("cappol2", &self.cappol2())
490 .field("cappol3", &self.cappol3())
491 .finish()
492 }
493}
494impl W {
495 #[doc = "Bit 0 - Enable Capture 0"]
496 #[inline(always)]
497 pub fn capen0(&mut self) -> Capen0W<'_, CfgSpec> {
498 Capen0W::new(self, 0)
499 }
500 #[doc = "Bit 1 - Enable Capture 1"]
501 #[inline(always)]
502 pub fn capen1(&mut self) -> Capen1W<'_, CfgSpec> {
503 Capen1W::new(self, 1)
504 }
505 #[doc = "Bit 2 - Enable Capture 2"]
506 #[inline(always)]
507 pub fn capen2(&mut self) -> Capen2W<'_, CfgSpec> {
508 Capen2W::new(self, 2)
509 }
510 #[doc = "Bit 3 - Enable Capture 3"]
511 #[inline(always)]
512 pub fn capen3(&mut self) -> Capen3W<'_, CfgSpec> {
513 Capen3W::new(self, 3)
514 }
515 #[doc = "Bit 8 - Capture Polarity 0"]
516 #[inline(always)]
517 pub fn cappol0(&mut self) -> Cappol0W<'_, CfgSpec> {
518 Cappol0W::new(self, 8)
519 }
520 #[doc = "Bit 9 - Capture-Polarity 1"]
521 #[inline(always)]
522 pub fn cappol1(&mut self) -> Cappol1W<'_, CfgSpec> {
523 Cappol1W::new(self, 9)
524 }
525 #[doc = "Bit 10 - Capture Polarity 2"]
526 #[inline(always)]
527 pub fn cappol2(&mut self) -> Cappol2W<'_, CfgSpec> {
528 Cappol2W::new(self, 10)
529 }
530 #[doc = "Bit 11 - Capture Polarity 3"]
531 #[inline(always)]
532 pub fn cappol3(&mut self) -> Cappol3W<'_, CfgSpec> {
533 Cappol3W::new(self, 11)
534 }
535}
536#[doc = "Capture Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`cfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
537pub struct CfgSpec;
538impl crate::RegisterSpec for CfgSpec {
539 type Ux = u32;
540}
541#[doc = "`read()` method returns [`cfg::R`](R) reader structure"]
542impl crate::Readable for CfgSpec {}
543#[doc = "`write(|w| ..)` method takes [`cfg::W`](W) writer structure"]
544impl crate::Writable for CfgSpec {
545 type Safety = crate::Unsafe;
546}
547#[doc = "`reset()` method sets CFG to value 0"]
548impl crate::Resettable for CfgSpec {}