1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u8,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u8,
8}
9impl super::SCR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct COUTR {
47 bits: bool,
48}
49impl COUTR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = "Possible values of the field `CFF`"]
67#[derive(Clone, Copy, Debug, PartialEq)]
68pub enum CFFR {
69 #[doc = "Falling-edge on COUT has not been detected."]
70 _0,
71 #[doc = "Falling-edge on COUT has occurred."]
72 _1,
73}
74impl CFFR {
75 #[doc = r" Returns `true` if the bit is clear (0)"]
76 #[inline]
77 pub fn bit_is_clear(&self) -> bool {
78 !self.bit()
79 }
80 #[doc = r" Returns `true` if the bit is set (1)"]
81 #[inline]
82 pub fn bit_is_set(&self) -> bool {
83 self.bit()
84 }
85 #[doc = r" Value of the field as raw bits"]
86 #[inline]
87 pub fn bit(&self) -> bool {
88 match *self {
89 CFFR::_0 => false,
90 CFFR::_1 => true,
91 }
92 }
93 #[allow(missing_docs)]
94 #[doc(hidden)]
95 #[inline]
96 pub fn _from(value: bool) -> CFFR {
97 match value {
98 false => CFFR::_0,
99 true => CFFR::_1,
100 }
101 }
102 #[doc = "Checks if the value of the field is `_0`"]
103 #[inline]
104 pub fn is_0(&self) -> bool {
105 *self == CFFR::_0
106 }
107 #[doc = "Checks if the value of the field is `_1`"]
108 #[inline]
109 pub fn is_1(&self) -> bool {
110 *self == CFFR::_1
111 }
112}
113#[doc = "Possible values of the field `CFR`"]
114#[derive(Clone, Copy, Debug, PartialEq)]
115pub enum CFRR {
116 #[doc = "Rising-edge on COUT has not been detected."]
117 _0,
118 #[doc = "Rising-edge on COUT has occurred."]
119 _1,
120}
121impl CFRR {
122 #[doc = r" Returns `true` if the bit is clear (0)"]
123 #[inline]
124 pub fn bit_is_clear(&self) -> bool {
125 !self.bit()
126 }
127 #[doc = r" Returns `true` if the bit is set (1)"]
128 #[inline]
129 pub fn bit_is_set(&self) -> bool {
130 self.bit()
131 }
132 #[doc = r" Value of the field as raw bits"]
133 #[inline]
134 pub fn bit(&self) -> bool {
135 match *self {
136 CFRR::_0 => false,
137 CFRR::_1 => true,
138 }
139 }
140 #[allow(missing_docs)]
141 #[doc(hidden)]
142 #[inline]
143 pub fn _from(value: bool) -> CFRR {
144 match value {
145 false => CFRR::_0,
146 true => CFRR::_1,
147 }
148 }
149 #[doc = "Checks if the value of the field is `_0`"]
150 #[inline]
151 pub fn is_0(&self) -> bool {
152 *self == CFRR::_0
153 }
154 #[doc = "Checks if the value of the field is `_1`"]
155 #[inline]
156 pub fn is_1(&self) -> bool {
157 *self == CFRR::_1
158 }
159}
160#[doc = "Possible values of the field `IEF`"]
161#[derive(Clone, Copy, Debug, PartialEq)]
162pub enum IEFR {
163 #[doc = "Interrupt is disabled."]
164 _0,
165 #[doc = "Interrupt is enabled."]
166 _1,
167}
168impl IEFR {
169 #[doc = r" Returns `true` if the bit is clear (0)"]
170 #[inline]
171 pub fn bit_is_clear(&self) -> bool {
172 !self.bit()
173 }
174 #[doc = r" Returns `true` if the bit is set (1)"]
175 #[inline]
176 pub fn bit_is_set(&self) -> bool {
177 self.bit()
178 }
179 #[doc = r" Value of the field as raw bits"]
180 #[inline]
181 pub fn bit(&self) -> bool {
182 match *self {
183 IEFR::_0 => false,
184 IEFR::_1 => true,
185 }
186 }
187 #[allow(missing_docs)]
188 #[doc(hidden)]
189 #[inline]
190 pub fn _from(value: bool) -> IEFR {
191 match value {
192 false => IEFR::_0,
193 true => IEFR::_1,
194 }
195 }
196 #[doc = "Checks if the value of the field is `_0`"]
197 #[inline]
198 pub fn is_0(&self) -> bool {
199 *self == IEFR::_0
200 }
201 #[doc = "Checks if the value of the field is `_1`"]
202 #[inline]
203 pub fn is_1(&self) -> bool {
204 *self == IEFR::_1
205 }
206}
207#[doc = "Possible values of the field `IER`"]
208#[derive(Clone, Copy, Debug, PartialEq)]
209pub enum IERR {
210 #[doc = "Interrupt is disabled."]
211 _0,
212 #[doc = "Interrupt is enabled."]
213 _1,
214}
215impl IERR {
216 #[doc = r" Returns `true` if the bit is clear (0)"]
217 #[inline]
218 pub fn bit_is_clear(&self) -> bool {
219 !self.bit()
220 }
221 #[doc = r" Returns `true` if the bit is set (1)"]
222 #[inline]
223 pub fn bit_is_set(&self) -> bool {
224 self.bit()
225 }
226 #[doc = r" Value of the field as raw bits"]
227 #[inline]
228 pub fn bit(&self) -> bool {
229 match *self {
230 IERR::_0 => false,
231 IERR::_1 => true,
232 }
233 }
234 #[allow(missing_docs)]
235 #[doc(hidden)]
236 #[inline]
237 pub fn _from(value: bool) -> IERR {
238 match value {
239 false => IERR::_0,
240 true => IERR::_1,
241 }
242 }
243 #[doc = "Checks if the value of the field is `_0`"]
244 #[inline]
245 pub fn is_0(&self) -> bool {
246 *self == IERR::_0
247 }
248 #[doc = "Checks if the value of the field is `_1`"]
249 #[inline]
250 pub fn is_1(&self) -> bool {
251 *self == IERR::_1
252 }
253}
254#[doc = "Possible values of the field `DMAEN`"]
255#[derive(Clone, Copy, Debug, PartialEq)]
256pub enum DMAENR {
257 #[doc = "DMA is disabled."]
258 _0,
259 #[doc = "DMA is enabled."]
260 _1,
261}
262impl DMAENR {
263 #[doc = r" Returns `true` if the bit is clear (0)"]
264 #[inline]
265 pub fn bit_is_clear(&self) -> bool {
266 !self.bit()
267 }
268 #[doc = r" Returns `true` if the bit is set (1)"]
269 #[inline]
270 pub fn bit_is_set(&self) -> bool {
271 self.bit()
272 }
273 #[doc = r" Value of the field as raw bits"]
274 #[inline]
275 pub fn bit(&self) -> bool {
276 match *self {
277 DMAENR::_0 => false,
278 DMAENR::_1 => true,
279 }
280 }
281 #[allow(missing_docs)]
282 #[doc(hidden)]
283 #[inline]
284 pub fn _from(value: bool) -> DMAENR {
285 match value {
286 false => DMAENR::_0,
287 true => DMAENR::_1,
288 }
289 }
290 #[doc = "Checks if the value of the field is `_0`"]
291 #[inline]
292 pub fn is_0(&self) -> bool {
293 *self == DMAENR::_0
294 }
295 #[doc = "Checks if the value of the field is `_1`"]
296 #[inline]
297 pub fn is_1(&self) -> bool {
298 *self == DMAENR::_1
299 }
300}
301#[doc = "Values that can be written to the field `CFF`"]
302pub enum CFFW {
303 #[doc = "Falling-edge on COUT has not been detected."]
304 _0,
305 #[doc = "Falling-edge on COUT has occurred."]
306 _1,
307}
308impl CFFW {
309 #[allow(missing_docs)]
310 #[doc(hidden)]
311 #[inline]
312 pub fn _bits(&self) -> bool {
313 match *self {
314 CFFW::_0 => false,
315 CFFW::_1 => true,
316 }
317 }
318}
319#[doc = r" Proxy"]
320pub struct _CFFW<'a> {
321 w: &'a mut W,
322}
323impl<'a> _CFFW<'a> {
324 #[doc = r" Writes `variant` to the field"]
325 #[inline]
326 pub fn variant(self, variant: CFFW) -> &'a mut W {
327 {
328 self.bit(variant._bits())
329 }
330 }
331 #[doc = "Falling-edge on COUT has not been detected."]
332 #[inline]
333 pub fn _0(self) -> &'a mut W {
334 self.variant(CFFW::_0)
335 }
336 #[doc = "Falling-edge on COUT has occurred."]
337 #[inline]
338 pub fn _1(self) -> &'a mut W {
339 self.variant(CFFW::_1)
340 }
341 #[doc = r" Sets the field bit"]
342 pub fn set_bit(self) -> &'a mut W {
343 self.bit(true)
344 }
345 #[doc = r" Clears the field bit"]
346 pub fn clear_bit(self) -> &'a mut W {
347 self.bit(false)
348 }
349 #[doc = r" Writes raw bits to the field"]
350 #[inline]
351 pub fn bit(self, value: bool) -> &'a mut W {
352 const MASK: bool = true;
353 const OFFSET: u8 = 1;
354 self.w.bits &= !((MASK as u8) << OFFSET);
355 self.w.bits |= ((value & MASK) as u8) << OFFSET;
356 self.w
357 }
358}
359#[doc = "Values that can be written to the field `CFR`"]
360pub enum CFRW {
361 #[doc = "Rising-edge on COUT has not been detected."]
362 _0,
363 #[doc = "Rising-edge on COUT has occurred."]
364 _1,
365}
366impl CFRW {
367 #[allow(missing_docs)]
368 #[doc(hidden)]
369 #[inline]
370 pub fn _bits(&self) -> bool {
371 match *self {
372 CFRW::_0 => false,
373 CFRW::_1 => true,
374 }
375 }
376}
377#[doc = r" Proxy"]
378pub struct _CFRW<'a> {
379 w: &'a mut W,
380}
381impl<'a> _CFRW<'a> {
382 #[doc = r" Writes `variant` to the field"]
383 #[inline]
384 pub fn variant(self, variant: CFRW) -> &'a mut W {
385 {
386 self.bit(variant._bits())
387 }
388 }
389 #[doc = "Rising-edge on COUT has not been detected."]
390 #[inline]
391 pub fn _0(self) -> &'a mut W {
392 self.variant(CFRW::_0)
393 }
394 #[doc = "Rising-edge on COUT has occurred."]
395 #[inline]
396 pub fn _1(self) -> &'a mut W {
397 self.variant(CFRW::_1)
398 }
399 #[doc = r" Sets the field bit"]
400 pub fn set_bit(self) -> &'a mut W {
401 self.bit(true)
402 }
403 #[doc = r" Clears the field bit"]
404 pub fn clear_bit(self) -> &'a mut W {
405 self.bit(false)
406 }
407 #[doc = r" Writes raw bits to the field"]
408 #[inline]
409 pub fn bit(self, value: bool) -> &'a mut W {
410 const MASK: bool = true;
411 const OFFSET: u8 = 2;
412 self.w.bits &= !((MASK as u8) << OFFSET);
413 self.w.bits |= ((value & MASK) as u8) << OFFSET;
414 self.w
415 }
416}
417#[doc = "Values that can be written to the field `IEF`"]
418pub enum IEFW {
419 #[doc = "Interrupt is disabled."]
420 _0,
421 #[doc = "Interrupt is enabled."]
422 _1,
423}
424impl IEFW {
425 #[allow(missing_docs)]
426 #[doc(hidden)]
427 #[inline]
428 pub fn _bits(&self) -> bool {
429 match *self {
430 IEFW::_0 => false,
431 IEFW::_1 => true,
432 }
433 }
434}
435#[doc = r" Proxy"]
436pub struct _IEFW<'a> {
437 w: &'a mut W,
438}
439impl<'a> _IEFW<'a> {
440 #[doc = r" Writes `variant` to the field"]
441 #[inline]
442 pub fn variant(self, variant: IEFW) -> &'a mut W {
443 {
444 self.bit(variant._bits())
445 }
446 }
447 #[doc = "Interrupt is disabled."]
448 #[inline]
449 pub fn _0(self) -> &'a mut W {
450 self.variant(IEFW::_0)
451 }
452 #[doc = "Interrupt is enabled."]
453 #[inline]
454 pub fn _1(self) -> &'a mut W {
455 self.variant(IEFW::_1)
456 }
457 #[doc = r" Sets the field bit"]
458 pub fn set_bit(self) -> &'a mut W {
459 self.bit(true)
460 }
461 #[doc = r" Clears the field bit"]
462 pub fn clear_bit(self) -> &'a mut W {
463 self.bit(false)
464 }
465 #[doc = r" Writes raw bits to the field"]
466 #[inline]
467 pub fn bit(self, value: bool) -> &'a mut W {
468 const MASK: bool = true;
469 const OFFSET: u8 = 3;
470 self.w.bits &= !((MASK as u8) << OFFSET);
471 self.w.bits |= ((value & MASK) as u8) << OFFSET;
472 self.w
473 }
474}
475#[doc = "Values that can be written to the field `IER`"]
476pub enum IERW {
477 #[doc = "Interrupt is disabled."]
478 _0,
479 #[doc = "Interrupt is enabled."]
480 _1,
481}
482impl IERW {
483 #[allow(missing_docs)]
484 #[doc(hidden)]
485 #[inline]
486 pub fn _bits(&self) -> bool {
487 match *self {
488 IERW::_0 => false,
489 IERW::_1 => true,
490 }
491 }
492}
493#[doc = r" Proxy"]
494pub struct _IERW<'a> {
495 w: &'a mut W,
496}
497impl<'a> _IERW<'a> {
498 #[doc = r" Writes `variant` to the field"]
499 #[inline]
500 pub fn variant(self, variant: IERW) -> &'a mut W {
501 {
502 self.bit(variant._bits())
503 }
504 }
505 #[doc = "Interrupt is disabled."]
506 #[inline]
507 pub fn _0(self) -> &'a mut W {
508 self.variant(IERW::_0)
509 }
510 #[doc = "Interrupt is enabled."]
511 #[inline]
512 pub fn _1(self) -> &'a mut W {
513 self.variant(IERW::_1)
514 }
515 #[doc = r" Sets the field bit"]
516 pub fn set_bit(self) -> &'a mut W {
517 self.bit(true)
518 }
519 #[doc = r" Clears the field bit"]
520 pub fn clear_bit(self) -> &'a mut W {
521 self.bit(false)
522 }
523 #[doc = r" Writes raw bits to the field"]
524 #[inline]
525 pub fn bit(self, value: bool) -> &'a mut W {
526 const MASK: bool = true;
527 const OFFSET: u8 = 4;
528 self.w.bits &= !((MASK as u8) << OFFSET);
529 self.w.bits |= ((value & MASK) as u8) << OFFSET;
530 self.w
531 }
532}
533#[doc = "Values that can be written to the field `DMAEN`"]
534pub enum DMAENW {
535 #[doc = "DMA is disabled."]
536 _0,
537 #[doc = "DMA is enabled."]
538 _1,
539}
540impl DMAENW {
541 #[allow(missing_docs)]
542 #[doc(hidden)]
543 #[inline]
544 pub fn _bits(&self) -> bool {
545 match *self {
546 DMAENW::_0 => false,
547 DMAENW::_1 => true,
548 }
549 }
550}
551#[doc = r" Proxy"]
552pub struct _DMAENW<'a> {
553 w: &'a mut W,
554}
555impl<'a> _DMAENW<'a> {
556 #[doc = r" Writes `variant` to the field"]
557 #[inline]
558 pub fn variant(self, variant: DMAENW) -> &'a mut W {
559 {
560 self.bit(variant._bits())
561 }
562 }
563 #[doc = "DMA is disabled."]
564 #[inline]
565 pub fn _0(self) -> &'a mut W {
566 self.variant(DMAENW::_0)
567 }
568 #[doc = "DMA is enabled."]
569 #[inline]
570 pub fn _1(self) -> &'a mut W {
571 self.variant(DMAENW::_1)
572 }
573 #[doc = r" Sets the field bit"]
574 pub fn set_bit(self) -> &'a mut W {
575 self.bit(true)
576 }
577 #[doc = r" Clears the field bit"]
578 pub fn clear_bit(self) -> &'a mut W {
579 self.bit(false)
580 }
581 #[doc = r" Writes raw bits to the field"]
582 #[inline]
583 pub fn bit(self, value: bool) -> &'a mut W {
584 const MASK: bool = true;
585 const OFFSET: u8 = 6;
586 self.w.bits &= !((MASK as u8) << OFFSET);
587 self.w.bits |= ((value & MASK) as u8) << OFFSET;
588 self.w
589 }
590}
591impl R {
592 #[doc = r" Value of the register as raw bits"]
593 #[inline]
594 pub fn bits(&self) -> u8 {
595 self.bits
596 }
597 #[doc = "Bit 0 - Analog Comparator Output"]
598 #[inline]
599 pub fn cout(&self) -> COUTR {
600 let bits = {
601 const MASK: bool = true;
602 const OFFSET: u8 = 0;
603 ((self.bits >> OFFSET) & MASK as u8) != 0
604 };
605 COUTR { bits }
606 }
607 #[doc = "Bit 1 - Analog Comparator Flag Falling"]
608 #[inline]
609 pub fn cff(&self) -> CFFR {
610 CFFR::_from({
611 const MASK: bool = true;
612 const OFFSET: u8 = 1;
613 ((self.bits >> OFFSET) & MASK as u8) != 0
614 })
615 }
616 #[doc = "Bit 2 - Analog Comparator Flag Rising"]
617 #[inline]
618 pub fn cfr(&self) -> CFRR {
619 CFRR::_from({
620 const MASK: bool = true;
621 const OFFSET: u8 = 2;
622 ((self.bits >> OFFSET) & MASK as u8) != 0
623 })
624 }
625 #[doc = "Bit 3 - Comparator Interrupt Enable Falling"]
626 #[inline]
627 pub fn ief(&self) -> IEFR {
628 IEFR::_from({
629 const MASK: bool = true;
630 const OFFSET: u8 = 3;
631 ((self.bits >> OFFSET) & MASK as u8) != 0
632 })
633 }
634 #[doc = "Bit 4 - Comparator Interrupt Enable Rising"]
635 #[inline]
636 pub fn ier(&self) -> IERR {
637 IERR::_from({
638 const MASK: bool = true;
639 const OFFSET: u8 = 4;
640 ((self.bits >> OFFSET) & MASK as u8) != 0
641 })
642 }
643 #[doc = "Bit 6 - DMA Enable Control"]
644 #[inline]
645 pub fn dmaen(&self) -> DMAENR {
646 DMAENR::_from({
647 const MASK: bool = true;
648 const OFFSET: u8 = 6;
649 ((self.bits >> OFFSET) & MASK as u8) != 0
650 })
651 }
652}
653impl W {
654 #[doc = r" Reset value of the register"]
655 #[inline]
656 pub fn reset_value() -> W {
657 W { bits: 0 }
658 }
659 #[doc = r" Writes raw bits to the register"]
660 #[inline]
661 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
662 self.bits = bits;
663 self
664 }
665 #[doc = "Bit 1 - Analog Comparator Flag Falling"]
666 #[inline]
667 pub fn cff(&mut self) -> _CFFW {
668 _CFFW { w: self }
669 }
670 #[doc = "Bit 2 - Analog Comparator Flag Rising"]
671 #[inline]
672 pub fn cfr(&mut self) -> _CFRW {
673 _CFRW { w: self }
674 }
675 #[doc = "Bit 3 - Comparator Interrupt Enable Falling"]
676 #[inline]
677 pub fn ief(&mut self) -> _IEFW {
678 _IEFW { w: self }
679 }
680 #[doc = "Bit 4 - Comparator Interrupt Enable Rising"]
681 #[inline]
682 pub fn ier(&mut self) -> _IERW {
683 _IERW { w: self }
684 }
685 #[doc = "Bit 6 - DMA Enable Control"]
686 #[inline]
687 pub fn dmaen(&mut self) -> _DMAENW {
688 _DMAENW { w: self }
689 }
690}