xmc4400/vadc_g0/
chctr.rs

1#[doc = "Register `CHCTR[%s]` reader"]
2pub type R = crate::R<CHCTR_SPEC>;
3#[doc = "Register `CHCTR[%s]` writer"]
4pub type W = crate::W<CHCTR_SPEC>;
5#[doc = "Input Class Select\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum ICLSEL_A {
9    #[doc = "0: Use group-specific class 0"]
10    VALUE1 = 0,
11    #[doc = "1: Use group-specific class 1"]
12    VALUE2 = 1,
13    #[doc = "2: Use global class 0"]
14    VALUE3 = 2,
15    #[doc = "3: Use global class 1"]
16    VALUE4 = 3,
17}
18impl From<ICLSEL_A> for u8 {
19    #[inline(always)]
20    fn from(variant: ICLSEL_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for ICLSEL_A {
25    type Ux = u8;
26}
27impl crate::IsEnum for ICLSEL_A {}
28#[doc = "Field `ICLSEL` reader - Input Class Select"]
29pub type ICLSEL_R = crate::FieldReader<ICLSEL_A>;
30impl ICLSEL_R {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> ICLSEL_A {
34        match self.bits {
35            0 => ICLSEL_A::VALUE1,
36            1 => ICLSEL_A::VALUE2,
37            2 => ICLSEL_A::VALUE3,
38            3 => ICLSEL_A::VALUE4,
39            _ => unreachable!(),
40        }
41    }
42    #[doc = "Use group-specific class 0"]
43    #[inline(always)]
44    pub fn is_value1(&self) -> bool {
45        *self == ICLSEL_A::VALUE1
46    }
47    #[doc = "Use group-specific class 1"]
48    #[inline(always)]
49    pub fn is_value2(&self) -> bool {
50        *self == ICLSEL_A::VALUE2
51    }
52    #[doc = "Use global class 0"]
53    #[inline(always)]
54    pub fn is_value3(&self) -> bool {
55        *self == ICLSEL_A::VALUE3
56    }
57    #[doc = "Use global class 1"]
58    #[inline(always)]
59    pub fn is_value4(&self) -> bool {
60        *self == ICLSEL_A::VALUE4
61    }
62}
63#[doc = "Field `ICLSEL` writer - Input Class Select"]
64pub type ICLSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, ICLSEL_A, crate::Safe>;
65impl<'a, REG> ICLSEL_W<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "Use group-specific class 0"]
71    #[inline(always)]
72    pub fn value1(self) -> &'a mut crate::W<REG> {
73        self.variant(ICLSEL_A::VALUE1)
74    }
75    #[doc = "Use group-specific class 1"]
76    #[inline(always)]
77    pub fn value2(self) -> &'a mut crate::W<REG> {
78        self.variant(ICLSEL_A::VALUE2)
79    }
80    #[doc = "Use global class 0"]
81    #[inline(always)]
82    pub fn value3(self) -> &'a mut crate::W<REG> {
83        self.variant(ICLSEL_A::VALUE3)
84    }
85    #[doc = "Use global class 1"]
86    #[inline(always)]
87    pub fn value4(self) -> &'a mut crate::W<REG> {
88        self.variant(ICLSEL_A::VALUE4)
89    }
90}
91#[doc = "Lower Boundary Select\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u8)]
94pub enum BNDSELL_A {
95    #[doc = "0: Use group-specific boundary 0"]
96    VALUE1 = 0,
97    #[doc = "1: Use group-specific boundary 1"]
98    VALUE2 = 1,
99    #[doc = "2: Use global boundary 0"]
100    VALUE3 = 2,
101    #[doc = "3: Use global boundary 1"]
102    VALUE4 = 3,
103}
104impl From<BNDSELL_A> for u8 {
105    #[inline(always)]
106    fn from(variant: BNDSELL_A) -> Self {
107        variant as _
108    }
109}
110impl crate::FieldSpec for BNDSELL_A {
111    type Ux = u8;
112}
113impl crate::IsEnum for BNDSELL_A {}
114#[doc = "Field `BNDSELL` reader - Lower Boundary Select"]
115pub type BNDSELL_R = crate::FieldReader<BNDSELL_A>;
116impl BNDSELL_R {
117    #[doc = "Get enumerated values variant"]
118    #[inline(always)]
119    pub const fn variant(&self) -> BNDSELL_A {
120        match self.bits {
121            0 => BNDSELL_A::VALUE1,
122            1 => BNDSELL_A::VALUE2,
123            2 => BNDSELL_A::VALUE3,
124            3 => BNDSELL_A::VALUE4,
125            _ => unreachable!(),
126        }
127    }
128    #[doc = "Use group-specific boundary 0"]
129    #[inline(always)]
130    pub fn is_value1(&self) -> bool {
131        *self == BNDSELL_A::VALUE1
132    }
133    #[doc = "Use group-specific boundary 1"]
134    #[inline(always)]
135    pub fn is_value2(&self) -> bool {
136        *self == BNDSELL_A::VALUE2
137    }
138    #[doc = "Use global boundary 0"]
139    #[inline(always)]
140    pub fn is_value3(&self) -> bool {
141        *self == BNDSELL_A::VALUE3
142    }
143    #[doc = "Use global boundary 1"]
144    #[inline(always)]
145    pub fn is_value4(&self) -> bool {
146        *self == BNDSELL_A::VALUE4
147    }
148}
149#[doc = "Field `BNDSELL` writer - Lower Boundary Select"]
150pub type BNDSELL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, BNDSELL_A, crate::Safe>;
151impl<'a, REG> BNDSELL_W<'a, REG>
152where
153    REG: crate::Writable + crate::RegisterSpec,
154    REG::Ux: From<u8>,
155{
156    #[doc = "Use group-specific boundary 0"]
157    #[inline(always)]
158    pub fn value1(self) -> &'a mut crate::W<REG> {
159        self.variant(BNDSELL_A::VALUE1)
160    }
161    #[doc = "Use group-specific boundary 1"]
162    #[inline(always)]
163    pub fn value2(self) -> &'a mut crate::W<REG> {
164        self.variant(BNDSELL_A::VALUE2)
165    }
166    #[doc = "Use global boundary 0"]
167    #[inline(always)]
168    pub fn value3(self) -> &'a mut crate::W<REG> {
169        self.variant(BNDSELL_A::VALUE3)
170    }
171    #[doc = "Use global boundary 1"]
172    #[inline(always)]
173    pub fn value4(self) -> &'a mut crate::W<REG> {
174        self.variant(BNDSELL_A::VALUE4)
175    }
176}
177#[doc = "Upper Boundary Select\n\nValue on reset: 0"]
178#[derive(Clone, Copy, Debug, PartialEq, Eq)]
179#[repr(u8)]
180pub enum BNDSELU_A {
181    #[doc = "0: Use group-specific boundary 0"]
182    VALUE1 = 0,
183    #[doc = "1: Use group-specific boundary 1"]
184    VALUE2 = 1,
185    #[doc = "2: Use global boundary 0"]
186    VALUE3 = 2,
187    #[doc = "3: Use global boundary 1"]
188    VALUE4 = 3,
189}
190impl From<BNDSELU_A> for u8 {
191    #[inline(always)]
192    fn from(variant: BNDSELU_A) -> Self {
193        variant as _
194    }
195}
196impl crate::FieldSpec for BNDSELU_A {
197    type Ux = u8;
198}
199impl crate::IsEnum for BNDSELU_A {}
200#[doc = "Field `BNDSELU` reader - Upper Boundary Select"]
201pub type BNDSELU_R = crate::FieldReader<BNDSELU_A>;
202impl BNDSELU_R {
203    #[doc = "Get enumerated values variant"]
204    #[inline(always)]
205    pub const fn variant(&self) -> BNDSELU_A {
206        match self.bits {
207            0 => BNDSELU_A::VALUE1,
208            1 => BNDSELU_A::VALUE2,
209            2 => BNDSELU_A::VALUE3,
210            3 => BNDSELU_A::VALUE4,
211            _ => unreachable!(),
212        }
213    }
214    #[doc = "Use group-specific boundary 0"]
215    #[inline(always)]
216    pub fn is_value1(&self) -> bool {
217        *self == BNDSELU_A::VALUE1
218    }
219    #[doc = "Use group-specific boundary 1"]
220    #[inline(always)]
221    pub fn is_value2(&self) -> bool {
222        *self == BNDSELU_A::VALUE2
223    }
224    #[doc = "Use global boundary 0"]
225    #[inline(always)]
226    pub fn is_value3(&self) -> bool {
227        *self == BNDSELU_A::VALUE3
228    }
229    #[doc = "Use global boundary 1"]
230    #[inline(always)]
231    pub fn is_value4(&self) -> bool {
232        *self == BNDSELU_A::VALUE4
233    }
234}
235#[doc = "Field `BNDSELU` writer - Upper Boundary Select"]
236pub type BNDSELU_W<'a, REG> = crate::FieldWriter<'a, REG, 2, BNDSELU_A, crate::Safe>;
237impl<'a, REG> BNDSELU_W<'a, REG>
238where
239    REG: crate::Writable + crate::RegisterSpec,
240    REG::Ux: From<u8>,
241{
242    #[doc = "Use group-specific boundary 0"]
243    #[inline(always)]
244    pub fn value1(self) -> &'a mut crate::W<REG> {
245        self.variant(BNDSELU_A::VALUE1)
246    }
247    #[doc = "Use group-specific boundary 1"]
248    #[inline(always)]
249    pub fn value2(self) -> &'a mut crate::W<REG> {
250        self.variant(BNDSELU_A::VALUE2)
251    }
252    #[doc = "Use global boundary 0"]
253    #[inline(always)]
254    pub fn value3(self) -> &'a mut crate::W<REG> {
255        self.variant(BNDSELU_A::VALUE3)
256    }
257    #[doc = "Use global boundary 1"]
258    #[inline(always)]
259    pub fn value4(self) -> &'a mut crate::W<REG> {
260        self.variant(BNDSELU_A::VALUE4)
261    }
262}
263#[doc = "Channel Event Mode\n\nValue on reset: 0"]
264#[derive(Clone, Copy, Debug, PartialEq, Eq)]
265#[repr(u8)]
266pub enum CHEVMODE_A {
267    #[doc = "0: Never"]
268    VALUE1 = 0,
269    #[doc = "1: NCM: If result is inside the boundary band FCM: If result becomes high (above cmp. val.)"]
270    VALUE2 = 1,
271    #[doc = "2: NCM: If result is outside the boundary band FCM: If result becomes low (below cmp. val.)"]
272    VALUE3 = 2,
273    #[doc = "3: NCM: Always (ignore band) FCM: If result switches to either level"]
274    VALUE4 = 3,
275}
276impl From<CHEVMODE_A> for u8 {
277    #[inline(always)]
278    fn from(variant: CHEVMODE_A) -> Self {
279        variant as _
280    }
281}
282impl crate::FieldSpec for CHEVMODE_A {
283    type Ux = u8;
284}
285impl crate::IsEnum for CHEVMODE_A {}
286#[doc = "Field `CHEVMODE` reader - Channel Event Mode"]
287pub type CHEVMODE_R = crate::FieldReader<CHEVMODE_A>;
288impl CHEVMODE_R {
289    #[doc = "Get enumerated values variant"]
290    #[inline(always)]
291    pub const fn variant(&self) -> CHEVMODE_A {
292        match self.bits {
293            0 => CHEVMODE_A::VALUE1,
294            1 => CHEVMODE_A::VALUE2,
295            2 => CHEVMODE_A::VALUE3,
296            3 => CHEVMODE_A::VALUE4,
297            _ => unreachable!(),
298        }
299    }
300    #[doc = "Never"]
301    #[inline(always)]
302    pub fn is_value1(&self) -> bool {
303        *self == CHEVMODE_A::VALUE1
304    }
305    #[doc = "NCM: If result is inside the boundary band FCM: If result becomes high (above cmp. val.)"]
306    #[inline(always)]
307    pub fn is_value2(&self) -> bool {
308        *self == CHEVMODE_A::VALUE2
309    }
310    #[doc = "NCM: If result is outside the boundary band FCM: If result becomes low (below cmp. val.)"]
311    #[inline(always)]
312    pub fn is_value3(&self) -> bool {
313        *self == CHEVMODE_A::VALUE3
314    }
315    #[doc = "NCM: Always (ignore band) FCM: If result switches to either level"]
316    #[inline(always)]
317    pub fn is_value4(&self) -> bool {
318        *self == CHEVMODE_A::VALUE4
319    }
320}
321#[doc = "Field `CHEVMODE` writer - Channel Event Mode"]
322pub type CHEVMODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CHEVMODE_A, crate::Safe>;
323impl<'a, REG> CHEVMODE_W<'a, REG>
324where
325    REG: crate::Writable + crate::RegisterSpec,
326    REG::Ux: From<u8>,
327{
328    #[doc = "Never"]
329    #[inline(always)]
330    pub fn value1(self) -> &'a mut crate::W<REG> {
331        self.variant(CHEVMODE_A::VALUE1)
332    }
333    #[doc = "NCM: If result is inside the boundary band FCM: If result becomes high (above cmp. val.)"]
334    #[inline(always)]
335    pub fn value2(self) -> &'a mut crate::W<REG> {
336        self.variant(CHEVMODE_A::VALUE2)
337    }
338    #[doc = "NCM: If result is outside the boundary band FCM: If result becomes low (below cmp. val.)"]
339    #[inline(always)]
340    pub fn value3(self) -> &'a mut crate::W<REG> {
341        self.variant(CHEVMODE_A::VALUE3)
342    }
343    #[doc = "NCM: Always (ignore band) FCM: If result switches to either level"]
344    #[inline(always)]
345    pub fn value4(self) -> &'a mut crate::W<REG> {
346        self.variant(CHEVMODE_A::VALUE4)
347    }
348}
349#[doc = "Synchronization Request\n\nValue on reset: 0"]
350#[derive(Clone, Copy, Debug, PartialEq, Eq)]
351pub enum SYNC_A {
352    #[doc = "0: No synchroniz. request, standalone operation"]
353    VALUE1 = 0,
354    #[doc = "1: Request a synchronized conversion of this channel (only taken into account for a master)"]
355    VALUE2 = 1,
356}
357impl From<SYNC_A> for bool {
358    #[inline(always)]
359    fn from(variant: SYNC_A) -> Self {
360        variant as u8 != 0
361    }
362}
363#[doc = "Field `SYNC` reader - Synchronization Request"]
364pub type SYNC_R = crate::BitReader<SYNC_A>;
365impl SYNC_R {
366    #[doc = "Get enumerated values variant"]
367    #[inline(always)]
368    pub const fn variant(&self) -> SYNC_A {
369        match self.bits {
370            false => SYNC_A::VALUE1,
371            true => SYNC_A::VALUE2,
372        }
373    }
374    #[doc = "No synchroniz. request, standalone operation"]
375    #[inline(always)]
376    pub fn is_value1(&self) -> bool {
377        *self == SYNC_A::VALUE1
378    }
379    #[doc = "Request a synchronized conversion of this channel (only taken into account for a master)"]
380    #[inline(always)]
381    pub fn is_value2(&self) -> bool {
382        *self == SYNC_A::VALUE2
383    }
384}
385#[doc = "Field `SYNC` writer - Synchronization Request"]
386pub type SYNC_W<'a, REG> = crate::BitWriter<'a, REG, SYNC_A>;
387impl<'a, REG> SYNC_W<'a, REG>
388where
389    REG: crate::Writable + crate::RegisterSpec,
390{
391    #[doc = "No synchroniz. request, standalone operation"]
392    #[inline(always)]
393    pub fn value1(self) -> &'a mut crate::W<REG> {
394        self.variant(SYNC_A::VALUE1)
395    }
396    #[doc = "Request a synchronized conversion of this channel (only taken into account for a master)"]
397    #[inline(always)]
398    pub fn value2(self) -> &'a mut crate::W<REG> {
399        self.variant(SYNC_A::VALUE2)
400    }
401}
402#[doc = "Reference Input Selection\n\nValue on reset: 0"]
403#[derive(Clone, Copy, Debug, PartialEq, Eq)]
404pub enum REFSEL_A {
405    #[doc = "0: Standard reference input VAREF"]
406    VALUE1 = 0,
407    #[doc = "1: Alternate reference input from CH0"]
408    VALUE2 = 1,
409}
410impl From<REFSEL_A> for bool {
411    #[inline(always)]
412    fn from(variant: REFSEL_A) -> Self {
413        variant as u8 != 0
414    }
415}
416#[doc = "Field `REFSEL` reader - Reference Input Selection"]
417pub type REFSEL_R = crate::BitReader<REFSEL_A>;
418impl REFSEL_R {
419    #[doc = "Get enumerated values variant"]
420    #[inline(always)]
421    pub const fn variant(&self) -> REFSEL_A {
422        match self.bits {
423            false => REFSEL_A::VALUE1,
424            true => REFSEL_A::VALUE2,
425        }
426    }
427    #[doc = "Standard reference input VAREF"]
428    #[inline(always)]
429    pub fn is_value1(&self) -> bool {
430        *self == REFSEL_A::VALUE1
431    }
432    #[doc = "Alternate reference input from CH0"]
433    #[inline(always)]
434    pub fn is_value2(&self) -> bool {
435        *self == REFSEL_A::VALUE2
436    }
437}
438#[doc = "Field `REFSEL` writer - Reference Input Selection"]
439pub type REFSEL_W<'a, REG> = crate::BitWriter<'a, REG, REFSEL_A>;
440impl<'a, REG> REFSEL_W<'a, REG>
441where
442    REG: crate::Writable + crate::RegisterSpec,
443{
444    #[doc = "Standard reference input VAREF"]
445    #[inline(always)]
446    pub fn value1(self) -> &'a mut crate::W<REG> {
447        self.variant(REFSEL_A::VALUE1)
448    }
449    #[doc = "Alternate reference input from CH0"]
450    #[inline(always)]
451    pub fn value2(self) -> &'a mut crate::W<REG> {
452        self.variant(REFSEL_A::VALUE2)
453    }
454}
455#[doc = "Result Register\n\nValue on reset: 0"]
456#[derive(Clone, Copy, Debug, PartialEq, Eq)]
457#[repr(u8)]
458pub enum RESREG_A {
459    #[doc = "0: Store result in group result register GxRES0"]
460    VALUE1 = 0,
461    #[doc = "15: Store result in group result register GxRES15"]
462    VALUE2 = 15,
463}
464impl From<RESREG_A> for u8 {
465    #[inline(always)]
466    fn from(variant: RESREG_A) -> Self {
467        variant as _
468    }
469}
470impl crate::FieldSpec for RESREG_A {
471    type Ux = u8;
472}
473impl crate::IsEnum for RESREG_A {}
474#[doc = "Field `RESREG` reader - Result Register"]
475pub type RESREG_R = crate::FieldReader<RESREG_A>;
476impl RESREG_R {
477    #[doc = "Get enumerated values variant"]
478    #[inline(always)]
479    pub const fn variant(&self) -> Option<RESREG_A> {
480        match self.bits {
481            0 => Some(RESREG_A::VALUE1),
482            15 => Some(RESREG_A::VALUE2),
483            _ => None,
484        }
485    }
486    #[doc = "Store result in group result register GxRES0"]
487    #[inline(always)]
488    pub fn is_value1(&self) -> bool {
489        *self == RESREG_A::VALUE1
490    }
491    #[doc = "Store result in group result register GxRES15"]
492    #[inline(always)]
493    pub fn is_value2(&self) -> bool {
494        *self == RESREG_A::VALUE2
495    }
496}
497#[doc = "Field `RESREG` writer - Result Register"]
498pub type RESREG_W<'a, REG> = crate::FieldWriter<'a, REG, 4, RESREG_A>;
499impl<'a, REG> RESREG_W<'a, REG>
500where
501    REG: crate::Writable + crate::RegisterSpec,
502    REG::Ux: From<u8>,
503{
504    #[doc = "Store result in group result register GxRES0"]
505    #[inline(always)]
506    pub fn value1(self) -> &'a mut crate::W<REG> {
507        self.variant(RESREG_A::VALUE1)
508    }
509    #[doc = "Store result in group result register GxRES15"]
510    #[inline(always)]
511    pub fn value2(self) -> &'a mut crate::W<REG> {
512        self.variant(RESREG_A::VALUE2)
513    }
514}
515#[doc = "Result Target for Background Source\n\nValue on reset: 0"]
516#[derive(Clone, Copy, Debug, PartialEq, Eq)]
517pub enum RESTBS_A {
518    #[doc = "0: Store results in the selected group result register"]
519    VALUE1 = 0,
520    #[doc = "1: Store results in the global result register"]
521    VALUE2 = 1,
522}
523impl From<RESTBS_A> for bool {
524    #[inline(always)]
525    fn from(variant: RESTBS_A) -> Self {
526        variant as u8 != 0
527    }
528}
529#[doc = "Field `RESTBS` reader - Result Target for Background Source"]
530pub type RESTBS_R = crate::BitReader<RESTBS_A>;
531impl RESTBS_R {
532    #[doc = "Get enumerated values variant"]
533    #[inline(always)]
534    pub const fn variant(&self) -> RESTBS_A {
535        match self.bits {
536            false => RESTBS_A::VALUE1,
537            true => RESTBS_A::VALUE2,
538        }
539    }
540    #[doc = "Store results in the selected group result register"]
541    #[inline(always)]
542    pub fn is_value1(&self) -> bool {
543        *self == RESTBS_A::VALUE1
544    }
545    #[doc = "Store results in the global result register"]
546    #[inline(always)]
547    pub fn is_value2(&self) -> bool {
548        *self == RESTBS_A::VALUE2
549    }
550}
551#[doc = "Field `RESTBS` writer - Result Target for Background Source"]
552pub type RESTBS_W<'a, REG> = crate::BitWriter<'a, REG, RESTBS_A>;
553impl<'a, REG> RESTBS_W<'a, REG>
554where
555    REG: crate::Writable + crate::RegisterSpec,
556{
557    #[doc = "Store results in the selected group result register"]
558    #[inline(always)]
559    pub fn value1(self) -> &'a mut crate::W<REG> {
560        self.variant(RESTBS_A::VALUE1)
561    }
562    #[doc = "Store results in the global result register"]
563    #[inline(always)]
564    pub fn value2(self) -> &'a mut crate::W<REG> {
565        self.variant(RESTBS_A::VALUE2)
566    }
567}
568#[doc = "Result Position\n\nValue on reset: 0"]
569#[derive(Clone, Copy, Debug, PartialEq, Eq)]
570pub enum RESPOS_A {
571    #[doc = "0: Store results left-aligned"]
572    VALUE1 = 0,
573    #[doc = "1: Store results right-aligned"]
574    VALUE2 = 1,
575}
576impl From<RESPOS_A> for bool {
577    #[inline(always)]
578    fn from(variant: RESPOS_A) -> Self {
579        variant as u8 != 0
580    }
581}
582#[doc = "Field `RESPOS` reader - Result Position"]
583pub type RESPOS_R = crate::BitReader<RESPOS_A>;
584impl RESPOS_R {
585    #[doc = "Get enumerated values variant"]
586    #[inline(always)]
587    pub const fn variant(&self) -> RESPOS_A {
588        match self.bits {
589            false => RESPOS_A::VALUE1,
590            true => RESPOS_A::VALUE2,
591        }
592    }
593    #[doc = "Store results left-aligned"]
594    #[inline(always)]
595    pub fn is_value1(&self) -> bool {
596        *self == RESPOS_A::VALUE1
597    }
598    #[doc = "Store results right-aligned"]
599    #[inline(always)]
600    pub fn is_value2(&self) -> bool {
601        *self == RESPOS_A::VALUE2
602    }
603}
604#[doc = "Field `RESPOS` writer - Result Position"]
605pub type RESPOS_W<'a, REG> = crate::BitWriter<'a, REG, RESPOS_A>;
606impl<'a, REG> RESPOS_W<'a, REG>
607where
608    REG: crate::Writable + crate::RegisterSpec,
609{
610    #[doc = "Store results left-aligned"]
611    #[inline(always)]
612    pub fn value1(self) -> &'a mut crate::W<REG> {
613        self.variant(RESPOS_A::VALUE1)
614    }
615    #[doc = "Store results right-aligned"]
616    #[inline(always)]
617    pub fn value2(self) -> &'a mut crate::W<REG> {
618        self.variant(RESPOS_A::VALUE2)
619    }
620}
621#[doc = "Broken Wire Detection Channel\n\nValue on reset: 0"]
622#[derive(Clone, Copy, Debug, PartialEq, Eq)]
623#[repr(u8)]
624pub enum BWDCH_A {
625    #[doc = "0: Select VAGND"]
626    VALUE1 = 0,
627    #[doc = "1: Select VAREF"]
628    VALUE2 = 1,
629}
630impl From<BWDCH_A> for u8 {
631    #[inline(always)]
632    fn from(variant: BWDCH_A) -> Self {
633        variant as _
634    }
635}
636impl crate::FieldSpec for BWDCH_A {
637    type Ux = u8;
638}
639impl crate::IsEnum for BWDCH_A {}
640#[doc = "Field `BWDCH` reader - Broken Wire Detection Channel"]
641pub type BWDCH_R = crate::FieldReader<BWDCH_A>;
642impl BWDCH_R {
643    #[doc = "Get enumerated values variant"]
644    #[inline(always)]
645    pub const fn variant(&self) -> Option<BWDCH_A> {
646        match self.bits {
647            0 => Some(BWDCH_A::VALUE1),
648            1 => Some(BWDCH_A::VALUE2),
649            _ => None,
650        }
651    }
652    #[doc = "Select VAGND"]
653    #[inline(always)]
654    pub fn is_value1(&self) -> bool {
655        *self == BWDCH_A::VALUE1
656    }
657    #[doc = "Select VAREF"]
658    #[inline(always)]
659    pub fn is_value2(&self) -> bool {
660        *self == BWDCH_A::VALUE2
661    }
662}
663#[doc = "Field `BWDCH` writer - Broken Wire Detection Channel"]
664pub type BWDCH_W<'a, REG> = crate::FieldWriter<'a, REG, 2, BWDCH_A>;
665impl<'a, REG> BWDCH_W<'a, REG>
666where
667    REG: crate::Writable + crate::RegisterSpec,
668    REG::Ux: From<u8>,
669{
670    #[doc = "Select VAGND"]
671    #[inline(always)]
672    pub fn value1(self) -> &'a mut crate::W<REG> {
673        self.variant(BWDCH_A::VALUE1)
674    }
675    #[doc = "Select VAREF"]
676    #[inline(always)]
677    pub fn value2(self) -> &'a mut crate::W<REG> {
678        self.variant(BWDCH_A::VALUE2)
679    }
680}
681#[doc = "Broken Wire Detection Enable\n\nValue on reset: 0"]
682#[derive(Clone, Copy, Debug, PartialEq, Eq)]
683pub enum BWDEN_A {
684    #[doc = "0: Normal operation"]
685    VALUE1 = 0,
686    #[doc = "1: Additional preparation phase is enabled"]
687    VALUE2 = 1,
688}
689impl From<BWDEN_A> for bool {
690    #[inline(always)]
691    fn from(variant: BWDEN_A) -> Self {
692        variant as u8 != 0
693    }
694}
695#[doc = "Field `BWDEN` reader - Broken Wire Detection Enable"]
696pub type BWDEN_R = crate::BitReader<BWDEN_A>;
697impl BWDEN_R {
698    #[doc = "Get enumerated values variant"]
699    #[inline(always)]
700    pub const fn variant(&self) -> BWDEN_A {
701        match self.bits {
702            false => BWDEN_A::VALUE1,
703            true => BWDEN_A::VALUE2,
704        }
705    }
706    #[doc = "Normal operation"]
707    #[inline(always)]
708    pub fn is_value1(&self) -> bool {
709        *self == BWDEN_A::VALUE1
710    }
711    #[doc = "Additional preparation phase is enabled"]
712    #[inline(always)]
713    pub fn is_value2(&self) -> bool {
714        *self == BWDEN_A::VALUE2
715    }
716}
717#[doc = "Field `BWDEN` writer - Broken Wire Detection Enable"]
718pub type BWDEN_W<'a, REG> = crate::BitWriter<'a, REG, BWDEN_A>;
719impl<'a, REG> BWDEN_W<'a, REG>
720where
721    REG: crate::Writable + crate::RegisterSpec,
722{
723    #[doc = "Normal operation"]
724    #[inline(always)]
725    pub fn value1(self) -> &'a mut crate::W<REG> {
726        self.variant(BWDEN_A::VALUE1)
727    }
728    #[doc = "Additional preparation phase is enabled"]
729    #[inline(always)]
730    pub fn value2(self) -> &'a mut crate::W<REG> {
731        self.variant(BWDEN_A::VALUE2)
732    }
733}
734impl R {
735    #[doc = "Bits 0:1 - Input Class Select"]
736    #[inline(always)]
737    pub fn iclsel(&self) -> ICLSEL_R {
738        ICLSEL_R::new((self.bits & 3) as u8)
739    }
740    #[doc = "Bits 4:5 - Lower Boundary Select"]
741    #[inline(always)]
742    pub fn bndsell(&self) -> BNDSELL_R {
743        BNDSELL_R::new(((self.bits >> 4) & 3) as u8)
744    }
745    #[doc = "Bits 6:7 - Upper Boundary Select"]
746    #[inline(always)]
747    pub fn bndselu(&self) -> BNDSELU_R {
748        BNDSELU_R::new(((self.bits >> 6) & 3) as u8)
749    }
750    #[doc = "Bits 8:9 - Channel Event Mode"]
751    #[inline(always)]
752    pub fn chevmode(&self) -> CHEVMODE_R {
753        CHEVMODE_R::new(((self.bits >> 8) & 3) as u8)
754    }
755    #[doc = "Bit 10 - Synchronization Request"]
756    #[inline(always)]
757    pub fn sync(&self) -> SYNC_R {
758        SYNC_R::new(((self.bits >> 10) & 1) != 0)
759    }
760    #[doc = "Bit 11 - Reference Input Selection"]
761    #[inline(always)]
762    pub fn refsel(&self) -> REFSEL_R {
763        REFSEL_R::new(((self.bits >> 11) & 1) != 0)
764    }
765    #[doc = "Bits 16:19 - Result Register"]
766    #[inline(always)]
767    pub fn resreg(&self) -> RESREG_R {
768        RESREG_R::new(((self.bits >> 16) & 0x0f) as u8)
769    }
770    #[doc = "Bit 20 - Result Target for Background Source"]
771    #[inline(always)]
772    pub fn restbs(&self) -> RESTBS_R {
773        RESTBS_R::new(((self.bits >> 20) & 1) != 0)
774    }
775    #[doc = "Bit 21 - Result Position"]
776    #[inline(always)]
777    pub fn respos(&self) -> RESPOS_R {
778        RESPOS_R::new(((self.bits >> 21) & 1) != 0)
779    }
780    #[doc = "Bits 28:29 - Broken Wire Detection Channel"]
781    #[inline(always)]
782    pub fn bwdch(&self) -> BWDCH_R {
783        BWDCH_R::new(((self.bits >> 28) & 3) as u8)
784    }
785    #[doc = "Bit 30 - Broken Wire Detection Enable"]
786    #[inline(always)]
787    pub fn bwden(&self) -> BWDEN_R {
788        BWDEN_R::new(((self.bits >> 30) & 1) != 0)
789    }
790}
791impl W {
792    #[doc = "Bits 0:1 - Input Class Select"]
793    #[inline(always)]
794    pub fn iclsel(&mut self) -> ICLSEL_W<CHCTR_SPEC> {
795        ICLSEL_W::new(self, 0)
796    }
797    #[doc = "Bits 4:5 - Lower Boundary Select"]
798    #[inline(always)]
799    pub fn bndsell(&mut self) -> BNDSELL_W<CHCTR_SPEC> {
800        BNDSELL_W::new(self, 4)
801    }
802    #[doc = "Bits 6:7 - Upper Boundary Select"]
803    #[inline(always)]
804    pub fn bndselu(&mut self) -> BNDSELU_W<CHCTR_SPEC> {
805        BNDSELU_W::new(self, 6)
806    }
807    #[doc = "Bits 8:9 - Channel Event Mode"]
808    #[inline(always)]
809    pub fn chevmode(&mut self) -> CHEVMODE_W<CHCTR_SPEC> {
810        CHEVMODE_W::new(self, 8)
811    }
812    #[doc = "Bit 10 - Synchronization Request"]
813    #[inline(always)]
814    pub fn sync(&mut self) -> SYNC_W<CHCTR_SPEC> {
815        SYNC_W::new(self, 10)
816    }
817    #[doc = "Bit 11 - Reference Input Selection"]
818    #[inline(always)]
819    pub fn refsel(&mut self) -> REFSEL_W<CHCTR_SPEC> {
820        REFSEL_W::new(self, 11)
821    }
822    #[doc = "Bits 16:19 - Result Register"]
823    #[inline(always)]
824    pub fn resreg(&mut self) -> RESREG_W<CHCTR_SPEC> {
825        RESREG_W::new(self, 16)
826    }
827    #[doc = "Bit 20 - Result Target for Background Source"]
828    #[inline(always)]
829    pub fn restbs(&mut self) -> RESTBS_W<CHCTR_SPEC> {
830        RESTBS_W::new(self, 20)
831    }
832    #[doc = "Bit 21 - Result Position"]
833    #[inline(always)]
834    pub fn respos(&mut self) -> RESPOS_W<CHCTR_SPEC> {
835        RESPOS_W::new(self, 21)
836    }
837    #[doc = "Bits 28:29 - Broken Wire Detection Channel"]
838    #[inline(always)]
839    pub fn bwdch(&mut self) -> BWDCH_W<CHCTR_SPEC> {
840        BWDCH_W::new(self, 28)
841    }
842    #[doc = "Bit 30 - Broken Wire Detection Enable"]
843    #[inline(always)]
844    pub fn bwden(&mut self) -> BWDEN_W<CHCTR_SPEC> {
845        BWDEN_W::new(self, 30)
846    }
847}
848#[doc = "Channel Ctrl. Reg.\n\nYou can [`read`](crate::Reg::read) this register and get [`chctr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`chctr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
849pub struct CHCTR_SPEC;
850impl crate::RegisterSpec for CHCTR_SPEC {
851    type Ux = u32;
852}
853#[doc = "`read()` method returns [`chctr::R`](R) reader structure"]
854impl crate::Readable for CHCTR_SPEC {}
855#[doc = "`write(|w| ..)` method takes [`chctr::W`](W) writer structure"]
856impl crate::Writable for CHCTR_SPEC {
857    type Safety = crate::Unsafe;
858    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
859    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
860}
861#[doc = "`reset()` method sets CHCTR[%s]
862to value 0"]
863impl crate::Resettable for CHCTR_SPEC {
864    const RESET_VALUE: u32 = 0;
865}