s32k144_pac/cmp0/
c2.rs

1#[doc = "Register `C2` reader"]
2pub struct R(crate::R<C2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<C2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<C2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<C2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `C2` writer"]
17pub struct W(crate::W<C2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<C2_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<C2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<C2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ACOn` reader - The result of the input comparison for channel n"]
38pub struct ACON_R(crate::FieldReader<u8, u8>);
39impl ACON_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        ACON_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for ACON_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `ACOn` writer - The result of the input comparison for channel n"]
53pub struct ACON_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> ACON_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0xff) | (value as u32 & 0xff);
61        self.w
62    }
63}
64#[doc = "Comparator and DAC initialization delay modulus.\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq)]
66#[repr(u8)]
67pub enum INITMOD_A {
68    #[doc = "0: The modulus is set to 64 (same with 111111)."]
69    _000000 = 0,
70}
71impl From<INITMOD_A> for u8 {
72    #[inline(always)]
73    fn from(variant: INITMOD_A) -> Self {
74        variant as _
75    }
76}
77#[doc = "Field `INITMOD` reader - Comparator and DAC initialization delay modulus."]
78pub struct INITMOD_R(crate::FieldReader<u8, INITMOD_A>);
79impl INITMOD_R {
80    #[inline(always)]
81    pub(crate) fn new(bits: u8) -> Self {
82        INITMOD_R(crate::FieldReader::new(bits))
83    }
84    #[doc = r"Get enumerated values variant"]
85    #[inline(always)]
86    pub fn variant(&self) -> Option<INITMOD_A> {
87        match self.bits {
88            0 => Some(INITMOD_A::_000000),
89            _ => None,
90        }
91    }
92    #[doc = "Checks if the value of the field is `_000000`"]
93    #[inline(always)]
94    pub fn is_000000(&self) -> bool {
95        **self == INITMOD_A::_000000
96    }
97}
98impl core::ops::Deref for INITMOD_R {
99    type Target = crate::FieldReader<u8, INITMOD_A>;
100    #[inline(always)]
101    fn deref(&self) -> &Self::Target {
102        &self.0
103    }
104}
105#[doc = "Field `INITMOD` writer - Comparator and DAC initialization delay modulus."]
106pub struct INITMOD_W<'a> {
107    w: &'a mut W,
108}
109impl<'a> INITMOD_W<'a> {
110    #[doc = r"Writes `variant` to the field"]
111    #[inline(always)]
112    pub fn variant(self, variant: INITMOD_A) -> &'a mut W {
113        unsafe { self.bits(variant.into()) }
114    }
115    #[doc = "The modulus is set to 64 (same with 111111)."]
116    #[inline(always)]
117    pub fn _000000(self) -> &'a mut W {
118        self.variant(INITMOD_A::_000000)
119    }
120    #[doc = r"Writes raw bits to the field"]
121    #[inline(always)]
122    pub unsafe fn bits(self, value: u8) -> &'a mut W {
123        self.w.bits = (self.w.bits & !(0x3f << 8)) | ((value as u32 & 0x3f) << 8);
124        self.w
125    }
126}
127#[doc = "Number of sample clocks\n\nValue on reset: 0"]
128#[derive(Clone, Copy, Debug, PartialEq)]
129#[repr(u8)]
130pub enum NSAM_A {
131    #[doc = "0: The comparison result is sampled as soon as the active channel is scanned in one round-robin clock."]
132    _00 = 0,
133    #[doc = "1: The sampling takes place 1 round-robin clock cycle after the next cycle of the round-robin clock."]
134    _01 = 1,
135    #[doc = "2: The sampling takes place 2 round-robin clock cycles after the next cycle of the round-robin clock."]
136    _10 = 2,
137    #[doc = "3: The sampling takes place 3 round-robin clock cycles after the next cycle of the round-robin clock."]
138    _11 = 3,
139}
140impl From<NSAM_A> for u8 {
141    #[inline(always)]
142    fn from(variant: NSAM_A) -> Self {
143        variant as _
144    }
145}
146#[doc = "Field `NSAM` reader - Number of sample clocks"]
147pub struct NSAM_R(crate::FieldReader<u8, NSAM_A>);
148impl NSAM_R {
149    #[inline(always)]
150    pub(crate) fn new(bits: u8) -> Self {
151        NSAM_R(crate::FieldReader::new(bits))
152    }
153    #[doc = r"Get enumerated values variant"]
154    #[inline(always)]
155    pub fn variant(&self) -> NSAM_A {
156        match self.bits {
157            0 => NSAM_A::_00,
158            1 => NSAM_A::_01,
159            2 => NSAM_A::_10,
160            3 => NSAM_A::_11,
161            _ => unreachable!(),
162        }
163    }
164    #[doc = "Checks if the value of the field is `_00`"]
165    #[inline(always)]
166    pub fn is_00(&self) -> bool {
167        **self == NSAM_A::_00
168    }
169    #[doc = "Checks if the value of the field is `_01`"]
170    #[inline(always)]
171    pub fn is_01(&self) -> bool {
172        **self == NSAM_A::_01
173    }
174    #[doc = "Checks if the value of the field is `_10`"]
175    #[inline(always)]
176    pub fn is_10(&self) -> bool {
177        **self == NSAM_A::_10
178    }
179    #[doc = "Checks if the value of the field is `_11`"]
180    #[inline(always)]
181    pub fn is_11(&self) -> bool {
182        **self == NSAM_A::_11
183    }
184}
185impl core::ops::Deref for NSAM_R {
186    type Target = crate::FieldReader<u8, NSAM_A>;
187    #[inline(always)]
188    fn deref(&self) -> &Self::Target {
189        &self.0
190    }
191}
192#[doc = "Field `NSAM` writer - Number of sample clocks"]
193pub struct NSAM_W<'a> {
194    w: &'a mut W,
195}
196impl<'a> NSAM_W<'a> {
197    #[doc = r"Writes `variant` to the field"]
198    #[inline(always)]
199    pub fn variant(self, variant: NSAM_A) -> &'a mut W {
200        self.bits(variant.into())
201    }
202    #[doc = "The comparison result is sampled as soon as the active channel is scanned in one round-robin clock."]
203    #[inline(always)]
204    pub fn _00(self) -> &'a mut W {
205        self.variant(NSAM_A::_00)
206    }
207    #[doc = "The sampling takes place 1 round-robin clock cycle after the next cycle of the round-robin clock."]
208    #[inline(always)]
209    pub fn _01(self) -> &'a mut W {
210        self.variant(NSAM_A::_01)
211    }
212    #[doc = "The sampling takes place 2 round-robin clock cycles after the next cycle of the round-robin clock."]
213    #[inline(always)]
214    pub fn _10(self) -> &'a mut W {
215        self.variant(NSAM_A::_10)
216    }
217    #[doc = "The sampling takes place 3 round-robin clock cycles after the next cycle of the round-robin clock."]
218    #[inline(always)]
219    pub fn _11(self) -> &'a mut W {
220        self.variant(NSAM_A::_11)
221    }
222    #[doc = r"Writes raw bits to the field"]
223    #[inline(always)]
224    pub fn bits(self, value: u8) -> &'a mut W {
225        self.w.bits = (self.w.bits & !(0x03 << 14)) | ((value as u32 & 0x03) << 14);
226        self.w
227    }
228}
229#[doc = "Field `CH0F` reader - Channel 0 input changed flag"]
230pub struct CH0F_R(crate::FieldReader<bool, bool>);
231impl CH0F_R {
232    #[inline(always)]
233    pub(crate) fn new(bits: bool) -> Self {
234        CH0F_R(crate::FieldReader::new(bits))
235    }
236}
237impl core::ops::Deref for CH0F_R {
238    type Target = crate::FieldReader<bool, bool>;
239    #[inline(always)]
240    fn deref(&self) -> &Self::Target {
241        &self.0
242    }
243}
244#[doc = "Field `CH0F` writer - Channel 0 input changed flag"]
245pub struct CH0F_W<'a> {
246    w: &'a mut W,
247}
248impl<'a> CH0F_W<'a> {
249    #[doc = r"Sets the field bit"]
250    #[inline(always)]
251    pub fn set_bit(self) -> &'a mut W {
252        self.bit(true)
253    }
254    #[doc = r"Clears the field bit"]
255    #[inline(always)]
256    pub fn clear_bit(self) -> &'a mut W {
257        self.bit(false)
258    }
259    #[doc = r"Writes raw bits to the field"]
260    #[inline(always)]
261    pub fn bit(self, value: bool) -> &'a mut W {
262        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
263        self.w
264    }
265}
266#[doc = "Field `CH1F` reader - Channel 1 input changed flag"]
267pub struct CH1F_R(crate::FieldReader<bool, bool>);
268impl CH1F_R {
269    #[inline(always)]
270    pub(crate) fn new(bits: bool) -> Self {
271        CH1F_R(crate::FieldReader::new(bits))
272    }
273}
274impl core::ops::Deref for CH1F_R {
275    type Target = crate::FieldReader<bool, bool>;
276    #[inline(always)]
277    fn deref(&self) -> &Self::Target {
278        &self.0
279    }
280}
281#[doc = "Field `CH1F` writer - Channel 1 input changed flag"]
282pub struct CH1F_W<'a> {
283    w: &'a mut W,
284}
285impl<'a> CH1F_W<'a> {
286    #[doc = r"Sets the field bit"]
287    #[inline(always)]
288    pub fn set_bit(self) -> &'a mut W {
289        self.bit(true)
290    }
291    #[doc = r"Clears the field bit"]
292    #[inline(always)]
293    pub fn clear_bit(self) -> &'a mut W {
294        self.bit(false)
295    }
296    #[doc = r"Writes raw bits to the field"]
297    #[inline(always)]
298    pub fn bit(self, value: bool) -> &'a mut W {
299        self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
300        self.w
301    }
302}
303#[doc = "Field `CH2F` reader - Channel 2 input changed flag"]
304pub struct CH2F_R(crate::FieldReader<bool, bool>);
305impl CH2F_R {
306    #[inline(always)]
307    pub(crate) fn new(bits: bool) -> Self {
308        CH2F_R(crate::FieldReader::new(bits))
309    }
310}
311impl core::ops::Deref for CH2F_R {
312    type Target = crate::FieldReader<bool, bool>;
313    #[inline(always)]
314    fn deref(&self) -> &Self::Target {
315        &self.0
316    }
317}
318#[doc = "Field `CH2F` writer - Channel 2 input changed flag"]
319pub struct CH2F_W<'a> {
320    w: &'a mut W,
321}
322impl<'a> CH2F_W<'a> {
323    #[doc = r"Sets the field bit"]
324    #[inline(always)]
325    pub fn set_bit(self) -> &'a mut W {
326        self.bit(true)
327    }
328    #[doc = r"Clears the field bit"]
329    #[inline(always)]
330    pub fn clear_bit(self) -> &'a mut W {
331        self.bit(false)
332    }
333    #[doc = r"Writes raw bits to the field"]
334    #[inline(always)]
335    pub fn bit(self, value: bool) -> &'a mut W {
336        self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
337        self.w
338    }
339}
340#[doc = "Field `CH3F` reader - Channel 3 input changed flag"]
341pub struct CH3F_R(crate::FieldReader<bool, bool>);
342impl CH3F_R {
343    #[inline(always)]
344    pub(crate) fn new(bits: bool) -> Self {
345        CH3F_R(crate::FieldReader::new(bits))
346    }
347}
348impl core::ops::Deref for CH3F_R {
349    type Target = crate::FieldReader<bool, bool>;
350    #[inline(always)]
351    fn deref(&self) -> &Self::Target {
352        &self.0
353    }
354}
355#[doc = "Field `CH3F` writer - Channel 3 input changed flag"]
356pub struct CH3F_W<'a> {
357    w: &'a mut W,
358}
359impl<'a> CH3F_W<'a> {
360    #[doc = r"Sets the field bit"]
361    #[inline(always)]
362    pub fn set_bit(self) -> &'a mut W {
363        self.bit(true)
364    }
365    #[doc = r"Clears the field bit"]
366    #[inline(always)]
367    pub fn clear_bit(self) -> &'a mut W {
368        self.bit(false)
369    }
370    #[doc = r"Writes raw bits to the field"]
371    #[inline(always)]
372    pub fn bit(self, value: bool) -> &'a mut W {
373        self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
374        self.w
375    }
376}
377#[doc = "Field `CH4F` reader - Channel 4 input changed flag"]
378pub struct CH4F_R(crate::FieldReader<bool, bool>);
379impl CH4F_R {
380    #[inline(always)]
381    pub(crate) fn new(bits: bool) -> Self {
382        CH4F_R(crate::FieldReader::new(bits))
383    }
384}
385impl core::ops::Deref for CH4F_R {
386    type Target = crate::FieldReader<bool, bool>;
387    #[inline(always)]
388    fn deref(&self) -> &Self::Target {
389        &self.0
390    }
391}
392#[doc = "Field `CH4F` writer - Channel 4 input changed flag"]
393pub struct CH4F_W<'a> {
394    w: &'a mut W,
395}
396impl<'a> CH4F_W<'a> {
397    #[doc = r"Sets the field bit"]
398    #[inline(always)]
399    pub fn set_bit(self) -> &'a mut W {
400        self.bit(true)
401    }
402    #[doc = r"Clears the field bit"]
403    #[inline(always)]
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(always)]
409    pub fn bit(self, value: bool) -> &'a mut W {
410        self.w.bits = (self.w.bits & !(0x01 << 20)) | ((value as u32 & 0x01) << 20);
411        self.w
412    }
413}
414#[doc = "Field `CH5F` reader - Channel 5 input changed flag"]
415pub struct CH5F_R(crate::FieldReader<bool, bool>);
416impl CH5F_R {
417    #[inline(always)]
418    pub(crate) fn new(bits: bool) -> Self {
419        CH5F_R(crate::FieldReader::new(bits))
420    }
421}
422impl core::ops::Deref for CH5F_R {
423    type Target = crate::FieldReader<bool, bool>;
424    #[inline(always)]
425    fn deref(&self) -> &Self::Target {
426        &self.0
427    }
428}
429#[doc = "Field `CH5F` writer - Channel 5 input changed flag"]
430pub struct CH5F_W<'a> {
431    w: &'a mut W,
432}
433impl<'a> CH5F_W<'a> {
434    #[doc = r"Sets the field bit"]
435    #[inline(always)]
436    pub fn set_bit(self) -> &'a mut W {
437        self.bit(true)
438    }
439    #[doc = r"Clears the field bit"]
440    #[inline(always)]
441    pub fn clear_bit(self) -> &'a mut W {
442        self.bit(false)
443    }
444    #[doc = r"Writes raw bits to the field"]
445    #[inline(always)]
446    pub fn bit(self, value: bool) -> &'a mut W {
447        self.w.bits = (self.w.bits & !(0x01 << 21)) | ((value as u32 & 0x01) << 21);
448        self.w
449    }
450}
451#[doc = "Field `CH6F` reader - Channel 6 input changed flag"]
452pub struct CH6F_R(crate::FieldReader<bool, bool>);
453impl CH6F_R {
454    #[inline(always)]
455    pub(crate) fn new(bits: bool) -> Self {
456        CH6F_R(crate::FieldReader::new(bits))
457    }
458}
459impl core::ops::Deref for CH6F_R {
460    type Target = crate::FieldReader<bool, bool>;
461    #[inline(always)]
462    fn deref(&self) -> &Self::Target {
463        &self.0
464    }
465}
466#[doc = "Field `CH6F` writer - Channel 6 input changed flag"]
467pub struct CH6F_W<'a> {
468    w: &'a mut W,
469}
470impl<'a> CH6F_W<'a> {
471    #[doc = r"Sets the field bit"]
472    #[inline(always)]
473    pub fn set_bit(self) -> &'a mut W {
474        self.bit(true)
475    }
476    #[doc = r"Clears the field bit"]
477    #[inline(always)]
478    pub fn clear_bit(self) -> &'a mut W {
479        self.bit(false)
480    }
481    #[doc = r"Writes raw bits to the field"]
482    #[inline(always)]
483    pub fn bit(self, value: bool) -> &'a mut W {
484        self.w.bits = (self.w.bits & !(0x01 << 22)) | ((value as u32 & 0x01) << 22);
485        self.w
486    }
487}
488#[doc = "Field `CH7F` reader - Channel 7 input changed flag"]
489pub struct CH7F_R(crate::FieldReader<bool, bool>);
490impl CH7F_R {
491    #[inline(always)]
492    pub(crate) fn new(bits: bool) -> Self {
493        CH7F_R(crate::FieldReader::new(bits))
494    }
495}
496impl core::ops::Deref for CH7F_R {
497    type Target = crate::FieldReader<bool, bool>;
498    #[inline(always)]
499    fn deref(&self) -> &Self::Target {
500        &self.0
501    }
502}
503#[doc = "Field `CH7F` writer - Channel 7 input changed flag"]
504pub struct CH7F_W<'a> {
505    w: &'a mut W,
506}
507impl<'a> CH7F_W<'a> {
508    #[doc = r"Sets the field bit"]
509    #[inline(always)]
510    pub fn set_bit(self) -> &'a mut W {
511        self.bit(true)
512    }
513    #[doc = r"Clears the field bit"]
514    #[inline(always)]
515    pub fn clear_bit(self) -> &'a mut W {
516        self.bit(false)
517    }
518    #[doc = r"Writes raw bits to the field"]
519    #[inline(always)]
520    pub fn bit(self, value: bool) -> &'a mut W {
521        self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
522        self.w
523    }
524}
525#[doc = "Fixed channel selection\n\nValue on reset: 0"]
526#[derive(Clone, Copy, Debug, PartialEq)]
527#[repr(u8)]
528pub enum FXMXCH_A {
529    #[doc = "0: Channel 0 is selected as the fixed reference input for the fixed mux port."]
530    _000 = 0,
531    #[doc = "1: Channel 1 is selected as the fixed reference input for the fixed mux port."]
532    _001 = 1,
533    #[doc = "2: Channel 2 is selected as the fixed reference input for the fixed mux port."]
534    _010 = 2,
535    #[doc = "3: Channel 3 is selected as the fixed reference input for the fixed mux port."]
536    _011 = 3,
537    #[doc = "4: Channel 4 is selected as the fixed reference input for the fixed mux port."]
538    _100 = 4,
539    #[doc = "5: Channel 5 is selected as the fixed reference input for the fixed mux port."]
540    _101 = 5,
541    #[doc = "6: Channel 6 is selected as the fixed reference input for the fixed mux port."]
542    _110 = 6,
543    #[doc = "7: Channel 7 is selected as the fixed reference input for the fixed mux port."]
544    _111 = 7,
545}
546impl From<FXMXCH_A> for u8 {
547    #[inline(always)]
548    fn from(variant: FXMXCH_A) -> Self {
549        variant as _
550    }
551}
552#[doc = "Field `FXMXCH` reader - Fixed channel selection"]
553pub struct FXMXCH_R(crate::FieldReader<u8, FXMXCH_A>);
554impl FXMXCH_R {
555    #[inline(always)]
556    pub(crate) fn new(bits: u8) -> Self {
557        FXMXCH_R(crate::FieldReader::new(bits))
558    }
559    #[doc = r"Get enumerated values variant"]
560    #[inline(always)]
561    pub fn variant(&self) -> FXMXCH_A {
562        match self.bits {
563            0 => FXMXCH_A::_000,
564            1 => FXMXCH_A::_001,
565            2 => FXMXCH_A::_010,
566            3 => FXMXCH_A::_011,
567            4 => FXMXCH_A::_100,
568            5 => FXMXCH_A::_101,
569            6 => FXMXCH_A::_110,
570            7 => FXMXCH_A::_111,
571            _ => unreachable!(),
572        }
573    }
574    #[doc = "Checks if the value of the field is `_000`"]
575    #[inline(always)]
576    pub fn is_000(&self) -> bool {
577        **self == FXMXCH_A::_000
578    }
579    #[doc = "Checks if the value of the field is `_001`"]
580    #[inline(always)]
581    pub fn is_001(&self) -> bool {
582        **self == FXMXCH_A::_001
583    }
584    #[doc = "Checks if the value of the field is `_010`"]
585    #[inline(always)]
586    pub fn is_010(&self) -> bool {
587        **self == FXMXCH_A::_010
588    }
589    #[doc = "Checks if the value of the field is `_011`"]
590    #[inline(always)]
591    pub fn is_011(&self) -> bool {
592        **self == FXMXCH_A::_011
593    }
594    #[doc = "Checks if the value of the field is `_100`"]
595    #[inline(always)]
596    pub fn is_100(&self) -> bool {
597        **self == FXMXCH_A::_100
598    }
599    #[doc = "Checks if the value of the field is `_101`"]
600    #[inline(always)]
601    pub fn is_101(&self) -> bool {
602        **self == FXMXCH_A::_101
603    }
604    #[doc = "Checks if the value of the field is `_110`"]
605    #[inline(always)]
606    pub fn is_110(&self) -> bool {
607        **self == FXMXCH_A::_110
608    }
609    #[doc = "Checks if the value of the field is `_111`"]
610    #[inline(always)]
611    pub fn is_111(&self) -> bool {
612        **self == FXMXCH_A::_111
613    }
614}
615impl core::ops::Deref for FXMXCH_R {
616    type Target = crate::FieldReader<u8, FXMXCH_A>;
617    #[inline(always)]
618    fn deref(&self) -> &Self::Target {
619        &self.0
620    }
621}
622#[doc = "Field `FXMXCH` writer - Fixed channel selection"]
623pub struct FXMXCH_W<'a> {
624    w: &'a mut W,
625}
626impl<'a> FXMXCH_W<'a> {
627    #[doc = r"Writes `variant` to the field"]
628    #[inline(always)]
629    pub fn variant(self, variant: FXMXCH_A) -> &'a mut W {
630        self.bits(variant.into())
631    }
632    #[doc = "Channel 0 is selected as the fixed reference input for the fixed mux port."]
633    #[inline(always)]
634    pub fn _000(self) -> &'a mut W {
635        self.variant(FXMXCH_A::_000)
636    }
637    #[doc = "Channel 1 is selected as the fixed reference input for the fixed mux port."]
638    #[inline(always)]
639    pub fn _001(self) -> &'a mut W {
640        self.variant(FXMXCH_A::_001)
641    }
642    #[doc = "Channel 2 is selected as the fixed reference input for the fixed mux port."]
643    #[inline(always)]
644    pub fn _010(self) -> &'a mut W {
645        self.variant(FXMXCH_A::_010)
646    }
647    #[doc = "Channel 3 is selected as the fixed reference input for the fixed mux port."]
648    #[inline(always)]
649    pub fn _011(self) -> &'a mut W {
650        self.variant(FXMXCH_A::_011)
651    }
652    #[doc = "Channel 4 is selected as the fixed reference input for the fixed mux port."]
653    #[inline(always)]
654    pub fn _100(self) -> &'a mut W {
655        self.variant(FXMXCH_A::_100)
656    }
657    #[doc = "Channel 5 is selected as the fixed reference input for the fixed mux port."]
658    #[inline(always)]
659    pub fn _101(self) -> &'a mut W {
660        self.variant(FXMXCH_A::_101)
661    }
662    #[doc = "Channel 6 is selected as the fixed reference input for the fixed mux port."]
663    #[inline(always)]
664    pub fn _110(self) -> &'a mut W {
665        self.variant(FXMXCH_A::_110)
666    }
667    #[doc = "Channel 7 is selected as the fixed reference input for the fixed mux port."]
668    #[inline(always)]
669    pub fn _111(self) -> &'a mut W {
670        self.variant(FXMXCH_A::_111)
671    }
672    #[doc = r"Writes raw bits to the field"]
673    #[inline(always)]
674    pub fn bits(self, value: u8) -> &'a mut W {
675        self.w.bits = (self.w.bits & !(0x07 << 25)) | ((value as u32 & 0x07) << 25);
676        self.w
677    }
678}
679#[doc = "Fixed MUX Port\n\nValue on reset: 0"]
680#[derive(Clone, Copy, Debug, PartialEq)]
681pub enum FXMP_A {
682    #[doc = "0: The Plus port is fixed. Only the inputs to the Minus port are swept in each round."]
683    _0 = 0,
684    #[doc = "1: The Minus port is fixed. Only the inputs to the Plus port are swept in each round."]
685    _1 = 1,
686}
687impl From<FXMP_A> for bool {
688    #[inline(always)]
689    fn from(variant: FXMP_A) -> Self {
690        variant as u8 != 0
691    }
692}
693#[doc = "Field `FXMP` reader - Fixed MUX Port"]
694pub struct FXMP_R(crate::FieldReader<bool, FXMP_A>);
695impl FXMP_R {
696    #[inline(always)]
697    pub(crate) fn new(bits: bool) -> Self {
698        FXMP_R(crate::FieldReader::new(bits))
699    }
700    #[doc = r"Get enumerated values variant"]
701    #[inline(always)]
702    pub fn variant(&self) -> FXMP_A {
703        match self.bits {
704            false => FXMP_A::_0,
705            true => FXMP_A::_1,
706        }
707    }
708    #[doc = "Checks if the value of the field is `_0`"]
709    #[inline(always)]
710    pub fn is_0(&self) -> bool {
711        **self == FXMP_A::_0
712    }
713    #[doc = "Checks if the value of the field is `_1`"]
714    #[inline(always)]
715    pub fn is_1(&self) -> bool {
716        **self == FXMP_A::_1
717    }
718}
719impl core::ops::Deref for FXMP_R {
720    type Target = crate::FieldReader<bool, FXMP_A>;
721    #[inline(always)]
722    fn deref(&self) -> &Self::Target {
723        &self.0
724    }
725}
726#[doc = "Field `FXMP` writer - Fixed MUX Port"]
727pub struct FXMP_W<'a> {
728    w: &'a mut W,
729}
730impl<'a> FXMP_W<'a> {
731    #[doc = r"Writes `variant` to the field"]
732    #[inline(always)]
733    pub fn variant(self, variant: FXMP_A) -> &'a mut W {
734        self.bit(variant.into())
735    }
736    #[doc = "The Plus port is fixed. Only the inputs to the Minus port are swept in each round."]
737    #[inline(always)]
738    pub fn _0(self) -> &'a mut W {
739        self.variant(FXMP_A::_0)
740    }
741    #[doc = "The Minus port is fixed. Only the inputs to the Plus port are swept in each round."]
742    #[inline(always)]
743    pub fn _1(self) -> &'a mut W {
744        self.variant(FXMP_A::_1)
745    }
746    #[doc = r"Sets the field bit"]
747    #[inline(always)]
748    pub fn set_bit(self) -> &'a mut W {
749        self.bit(true)
750    }
751    #[doc = r"Clears the field bit"]
752    #[inline(always)]
753    pub fn clear_bit(self) -> &'a mut W {
754        self.bit(false)
755    }
756    #[doc = r"Writes raw bits to the field"]
757    #[inline(always)]
758    pub fn bit(self, value: bool) -> &'a mut W {
759        self.w.bits = (self.w.bits & !(0x01 << 29)) | ((value as u32 & 0x01) << 29);
760        self.w
761    }
762}
763#[doc = "Round-Robin interrupt enable\n\nValue on reset: 0"]
764#[derive(Clone, Copy, Debug, PartialEq)]
765pub enum RRIE_A {
766    #[doc = "0: The round-robin interrupt is disabled."]
767    _0 = 0,
768    #[doc = "1: The round-robin interrupt is enabled when a comparison result changes from the last sample."]
769    _1 = 1,
770}
771impl From<RRIE_A> for bool {
772    #[inline(always)]
773    fn from(variant: RRIE_A) -> Self {
774        variant as u8 != 0
775    }
776}
777#[doc = "Field `RRIE` reader - Round-Robin interrupt enable"]
778pub struct RRIE_R(crate::FieldReader<bool, RRIE_A>);
779impl RRIE_R {
780    #[inline(always)]
781    pub(crate) fn new(bits: bool) -> Self {
782        RRIE_R(crate::FieldReader::new(bits))
783    }
784    #[doc = r"Get enumerated values variant"]
785    #[inline(always)]
786    pub fn variant(&self) -> RRIE_A {
787        match self.bits {
788            false => RRIE_A::_0,
789            true => RRIE_A::_1,
790        }
791    }
792    #[doc = "Checks if the value of the field is `_0`"]
793    #[inline(always)]
794    pub fn is_0(&self) -> bool {
795        **self == RRIE_A::_0
796    }
797    #[doc = "Checks if the value of the field is `_1`"]
798    #[inline(always)]
799    pub fn is_1(&self) -> bool {
800        **self == RRIE_A::_1
801    }
802}
803impl core::ops::Deref for RRIE_R {
804    type Target = crate::FieldReader<bool, RRIE_A>;
805    #[inline(always)]
806    fn deref(&self) -> &Self::Target {
807        &self.0
808    }
809}
810#[doc = "Field `RRIE` writer - Round-Robin interrupt enable"]
811pub struct RRIE_W<'a> {
812    w: &'a mut W,
813}
814impl<'a> RRIE_W<'a> {
815    #[doc = r"Writes `variant` to the field"]
816    #[inline(always)]
817    pub fn variant(self, variant: RRIE_A) -> &'a mut W {
818        self.bit(variant.into())
819    }
820    #[doc = "The round-robin interrupt is disabled."]
821    #[inline(always)]
822    pub fn _0(self) -> &'a mut W {
823        self.variant(RRIE_A::_0)
824    }
825    #[doc = "The round-robin interrupt is enabled when a comparison result changes from the last sample."]
826    #[inline(always)]
827    pub fn _1(self) -> &'a mut W {
828        self.variant(RRIE_A::_1)
829    }
830    #[doc = r"Sets the field bit"]
831    #[inline(always)]
832    pub fn set_bit(self) -> &'a mut W {
833        self.bit(true)
834    }
835    #[doc = r"Clears the field bit"]
836    #[inline(always)]
837    pub fn clear_bit(self) -> &'a mut W {
838        self.bit(false)
839    }
840    #[doc = r"Writes raw bits to the field"]
841    #[inline(always)]
842    pub fn bit(self, value: bool) -> &'a mut W {
843        self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
844        self.w
845    }
846}
847#[doc = "Round-Robin Enable\n\nValue on reset: 0"]
848#[derive(Clone, Copy, Debug, PartialEq)]
849pub enum RRE_A {
850    #[doc = "0: Round-robin operation is disabled."]
851    _0 = 0,
852    #[doc = "1: Round-robin operation is enabled."]
853    _1 = 1,
854}
855impl From<RRE_A> for bool {
856    #[inline(always)]
857    fn from(variant: RRE_A) -> Self {
858        variant as u8 != 0
859    }
860}
861#[doc = "Field `RRE` reader - Round-Robin Enable"]
862pub struct RRE_R(crate::FieldReader<bool, RRE_A>);
863impl RRE_R {
864    #[inline(always)]
865    pub(crate) fn new(bits: bool) -> Self {
866        RRE_R(crate::FieldReader::new(bits))
867    }
868    #[doc = r"Get enumerated values variant"]
869    #[inline(always)]
870    pub fn variant(&self) -> RRE_A {
871        match self.bits {
872            false => RRE_A::_0,
873            true => RRE_A::_1,
874        }
875    }
876    #[doc = "Checks if the value of the field is `_0`"]
877    #[inline(always)]
878    pub fn is_0(&self) -> bool {
879        **self == RRE_A::_0
880    }
881    #[doc = "Checks if the value of the field is `_1`"]
882    #[inline(always)]
883    pub fn is_1(&self) -> bool {
884        **self == RRE_A::_1
885    }
886}
887impl core::ops::Deref for RRE_R {
888    type Target = crate::FieldReader<bool, RRE_A>;
889    #[inline(always)]
890    fn deref(&self) -> &Self::Target {
891        &self.0
892    }
893}
894#[doc = "Field `RRE` writer - Round-Robin Enable"]
895pub struct RRE_W<'a> {
896    w: &'a mut W,
897}
898impl<'a> RRE_W<'a> {
899    #[doc = r"Writes `variant` to the field"]
900    #[inline(always)]
901    pub fn variant(self, variant: RRE_A) -> &'a mut W {
902        self.bit(variant.into())
903    }
904    #[doc = "Round-robin operation is disabled."]
905    #[inline(always)]
906    pub fn _0(self) -> &'a mut W {
907        self.variant(RRE_A::_0)
908    }
909    #[doc = "Round-robin operation is enabled."]
910    #[inline(always)]
911    pub fn _1(self) -> &'a mut W {
912        self.variant(RRE_A::_1)
913    }
914    #[doc = r"Sets the field bit"]
915    #[inline(always)]
916    pub fn set_bit(self) -> &'a mut W {
917        self.bit(true)
918    }
919    #[doc = r"Clears the field bit"]
920    #[inline(always)]
921    pub fn clear_bit(self) -> &'a mut W {
922        self.bit(false)
923    }
924    #[doc = r"Writes raw bits to the field"]
925    #[inline(always)]
926    pub fn bit(self, value: bool) -> &'a mut W {
927        self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
928        self.w
929    }
930}
931impl R {
932    #[doc = "Bits 0:7 - The result of the input comparison for channel n"]
933    #[inline(always)]
934    pub fn acon(&self) -> ACON_R {
935        ACON_R::new((self.bits & 0xff) as u8)
936    }
937    #[doc = "Bits 8:13 - Comparator and DAC initialization delay modulus."]
938    #[inline(always)]
939    pub fn initmod(&self) -> INITMOD_R {
940        INITMOD_R::new(((self.bits >> 8) & 0x3f) as u8)
941    }
942    #[doc = "Bits 14:15 - Number of sample clocks"]
943    #[inline(always)]
944    pub fn nsam(&self) -> NSAM_R {
945        NSAM_R::new(((self.bits >> 14) & 0x03) as u8)
946    }
947    #[doc = "Bit 16 - Channel 0 input changed flag"]
948    #[inline(always)]
949    pub fn ch0f(&self) -> CH0F_R {
950        CH0F_R::new(((self.bits >> 16) & 0x01) != 0)
951    }
952    #[doc = "Bit 17 - Channel 1 input changed flag"]
953    #[inline(always)]
954    pub fn ch1f(&self) -> CH1F_R {
955        CH1F_R::new(((self.bits >> 17) & 0x01) != 0)
956    }
957    #[doc = "Bit 18 - Channel 2 input changed flag"]
958    #[inline(always)]
959    pub fn ch2f(&self) -> CH2F_R {
960        CH2F_R::new(((self.bits >> 18) & 0x01) != 0)
961    }
962    #[doc = "Bit 19 - Channel 3 input changed flag"]
963    #[inline(always)]
964    pub fn ch3f(&self) -> CH3F_R {
965        CH3F_R::new(((self.bits >> 19) & 0x01) != 0)
966    }
967    #[doc = "Bit 20 - Channel 4 input changed flag"]
968    #[inline(always)]
969    pub fn ch4f(&self) -> CH4F_R {
970        CH4F_R::new(((self.bits >> 20) & 0x01) != 0)
971    }
972    #[doc = "Bit 21 - Channel 5 input changed flag"]
973    #[inline(always)]
974    pub fn ch5f(&self) -> CH5F_R {
975        CH5F_R::new(((self.bits >> 21) & 0x01) != 0)
976    }
977    #[doc = "Bit 22 - Channel 6 input changed flag"]
978    #[inline(always)]
979    pub fn ch6f(&self) -> CH6F_R {
980        CH6F_R::new(((self.bits >> 22) & 0x01) != 0)
981    }
982    #[doc = "Bit 23 - Channel 7 input changed flag"]
983    #[inline(always)]
984    pub fn ch7f(&self) -> CH7F_R {
985        CH7F_R::new(((self.bits >> 23) & 0x01) != 0)
986    }
987    #[doc = "Bits 25:27 - Fixed channel selection"]
988    #[inline(always)]
989    pub fn fxmxch(&self) -> FXMXCH_R {
990        FXMXCH_R::new(((self.bits >> 25) & 0x07) as u8)
991    }
992    #[doc = "Bit 29 - Fixed MUX Port"]
993    #[inline(always)]
994    pub fn fxmp(&self) -> FXMP_R {
995        FXMP_R::new(((self.bits >> 29) & 0x01) != 0)
996    }
997    #[doc = "Bit 30 - Round-Robin interrupt enable"]
998    #[inline(always)]
999    pub fn rrie(&self) -> RRIE_R {
1000        RRIE_R::new(((self.bits >> 30) & 0x01) != 0)
1001    }
1002    #[doc = "Bit 31 - Round-Robin Enable"]
1003    #[inline(always)]
1004    pub fn rre(&self) -> RRE_R {
1005        RRE_R::new(((self.bits >> 31) & 0x01) != 0)
1006    }
1007}
1008impl W {
1009    #[doc = "Bits 0:7 - The result of the input comparison for channel n"]
1010    #[inline(always)]
1011    pub fn acon(&mut self) -> ACON_W {
1012        ACON_W { w: self }
1013    }
1014    #[doc = "Bits 8:13 - Comparator and DAC initialization delay modulus."]
1015    #[inline(always)]
1016    pub fn initmod(&mut self) -> INITMOD_W {
1017        INITMOD_W { w: self }
1018    }
1019    #[doc = "Bits 14:15 - Number of sample clocks"]
1020    #[inline(always)]
1021    pub fn nsam(&mut self) -> NSAM_W {
1022        NSAM_W { w: self }
1023    }
1024    #[doc = "Bit 16 - Channel 0 input changed flag"]
1025    #[inline(always)]
1026    pub fn ch0f(&mut self) -> CH0F_W {
1027        CH0F_W { w: self }
1028    }
1029    #[doc = "Bit 17 - Channel 1 input changed flag"]
1030    #[inline(always)]
1031    pub fn ch1f(&mut self) -> CH1F_W {
1032        CH1F_W { w: self }
1033    }
1034    #[doc = "Bit 18 - Channel 2 input changed flag"]
1035    #[inline(always)]
1036    pub fn ch2f(&mut self) -> CH2F_W {
1037        CH2F_W { w: self }
1038    }
1039    #[doc = "Bit 19 - Channel 3 input changed flag"]
1040    #[inline(always)]
1041    pub fn ch3f(&mut self) -> CH3F_W {
1042        CH3F_W { w: self }
1043    }
1044    #[doc = "Bit 20 - Channel 4 input changed flag"]
1045    #[inline(always)]
1046    pub fn ch4f(&mut self) -> CH4F_W {
1047        CH4F_W { w: self }
1048    }
1049    #[doc = "Bit 21 - Channel 5 input changed flag"]
1050    #[inline(always)]
1051    pub fn ch5f(&mut self) -> CH5F_W {
1052        CH5F_W { w: self }
1053    }
1054    #[doc = "Bit 22 - Channel 6 input changed flag"]
1055    #[inline(always)]
1056    pub fn ch6f(&mut self) -> CH6F_W {
1057        CH6F_W { w: self }
1058    }
1059    #[doc = "Bit 23 - Channel 7 input changed flag"]
1060    #[inline(always)]
1061    pub fn ch7f(&mut self) -> CH7F_W {
1062        CH7F_W { w: self }
1063    }
1064    #[doc = "Bits 25:27 - Fixed channel selection"]
1065    #[inline(always)]
1066    pub fn fxmxch(&mut self) -> FXMXCH_W {
1067        FXMXCH_W { w: self }
1068    }
1069    #[doc = "Bit 29 - Fixed MUX Port"]
1070    #[inline(always)]
1071    pub fn fxmp(&mut self) -> FXMP_W {
1072        FXMP_W { w: self }
1073    }
1074    #[doc = "Bit 30 - Round-Robin interrupt enable"]
1075    #[inline(always)]
1076    pub fn rrie(&mut self) -> RRIE_W {
1077        RRIE_W { w: self }
1078    }
1079    #[doc = "Bit 31 - Round-Robin Enable"]
1080    #[inline(always)]
1081    pub fn rre(&mut self) -> RRE_W {
1082        RRE_W { w: self }
1083    }
1084    #[doc = "Writes raw bits to the register."]
1085    #[inline(always)]
1086    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1087        self.0.bits(bits);
1088        self
1089    }
1090}
1091#[doc = "CMP Control Register 2\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 [c2](index.html) module"]
1092pub struct C2_SPEC;
1093impl crate::RegisterSpec for C2_SPEC {
1094    type Ux = u32;
1095}
1096#[doc = "`read()` method returns [c2::R](R) reader structure"]
1097impl crate::Readable for C2_SPEC {
1098    type Reader = R;
1099}
1100#[doc = "`write(|w| ..)` method takes [c2::W](W) writer structure"]
1101impl crate::Writable for C2_SPEC {
1102    type Writer = W;
1103}
1104#[doc = "`reset()` method sets C2 to value 0"]
1105impl crate::Resettable for C2_SPEC {
1106    #[inline(always)]
1107    fn reset_value() -> Self::Ux {
1108        0
1109    }
1110}