mimxrt685s_pac/adc0/
cmdh.rs

1#[doc = "Register `CMDH%s` reader"]
2pub type R = crate::R<CmdhSpec>;
3#[doc = "Register `CMDH%s` writer"]
4pub type W = crate::W<CmdhSpec>;
5#[doc = "Compare Function Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Cmpen {
10    #[doc = "0: Compare disabled."]
11    Cmpen0 = 0,
12    #[doc = "2: Compare enabled. Store on true."]
13    Cmpen2 = 2,
14    #[doc = "3: Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
15    Cmpen3 = 3,
16}
17impl From<Cmpen> for u8 {
18    #[inline(always)]
19    fn from(variant: Cmpen) -> Self {
20        variant as _
21    }
22}
23impl crate::FieldSpec for Cmpen {
24    type Ux = u8;
25}
26impl crate::IsEnum for Cmpen {}
27#[doc = "Field `CMPEN` reader - Compare Function Enable"]
28pub type CmpenR = crate::FieldReader<Cmpen>;
29impl CmpenR {
30    #[doc = "Get enumerated values variant"]
31    #[inline(always)]
32    pub const fn variant(&self) -> Option<Cmpen> {
33        match self.bits {
34            0 => Some(Cmpen::Cmpen0),
35            2 => Some(Cmpen::Cmpen2),
36            3 => Some(Cmpen::Cmpen3),
37            _ => None,
38        }
39    }
40    #[doc = "Compare disabled."]
41    #[inline(always)]
42    pub fn is_cmpen_0(&self) -> bool {
43        *self == Cmpen::Cmpen0
44    }
45    #[doc = "Compare enabled. Store on true."]
46    #[inline(always)]
47    pub fn is_cmpen_2(&self) -> bool {
48        *self == Cmpen::Cmpen2
49    }
50    #[doc = "Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
51    #[inline(always)]
52    pub fn is_cmpen_3(&self) -> bool {
53        *self == Cmpen::Cmpen3
54    }
55}
56#[doc = "Field `CMPEN` writer - Compare Function Enable"]
57pub type CmpenW<'a, REG> = crate::FieldWriter<'a, REG, 2, Cmpen>;
58impl<'a, REG> CmpenW<'a, REG>
59where
60    REG: crate::Writable + crate::RegisterSpec,
61    REG::Ux: From<u8>,
62{
63    #[doc = "Compare disabled."]
64    #[inline(always)]
65    pub fn cmpen_0(self) -> &'a mut crate::W<REG> {
66        self.variant(Cmpen::Cmpen0)
67    }
68    #[doc = "Compare enabled. Store on true."]
69    #[inline(always)]
70    pub fn cmpen_2(self) -> &'a mut crate::W<REG> {
71        self.variant(Cmpen::Cmpen2)
72    }
73    #[doc = "Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
74    #[inline(always)]
75    pub fn cmpen_3(self) -> &'a mut crate::W<REG> {
76        self.variant(Cmpen::Cmpen3)
77    }
78}
79#[doc = "Loop with Increment\n\nValue on reset: 0"]
80#[cfg_attr(feature = "defmt", derive(defmt::Format))]
81#[derive(Clone, Copy, Debug, PartialEq, Eq)]
82pub enum Lwi {
83    #[doc = "0: Auto channel increment disabled"]
84    Lwi0 = 0,
85    #[doc = "1: Auto channel increment enabled"]
86    Lwi1 = 1,
87}
88impl From<Lwi> for bool {
89    #[inline(always)]
90    fn from(variant: Lwi) -> Self {
91        variant as u8 != 0
92    }
93}
94#[doc = "Field `LWI` reader - Loop with Increment"]
95pub type LwiR = crate::BitReader<Lwi>;
96impl LwiR {
97    #[doc = "Get enumerated values variant"]
98    #[inline(always)]
99    pub const fn variant(&self) -> Lwi {
100        match self.bits {
101            false => Lwi::Lwi0,
102            true => Lwi::Lwi1,
103        }
104    }
105    #[doc = "Auto channel increment disabled"]
106    #[inline(always)]
107    pub fn is_lwi_0(&self) -> bool {
108        *self == Lwi::Lwi0
109    }
110    #[doc = "Auto channel increment enabled"]
111    #[inline(always)]
112    pub fn is_lwi_1(&self) -> bool {
113        *self == Lwi::Lwi1
114    }
115}
116#[doc = "Field `LWI` writer - Loop with Increment"]
117pub type LwiW<'a, REG> = crate::BitWriter<'a, REG, Lwi>;
118impl<'a, REG> LwiW<'a, REG>
119where
120    REG: crate::Writable + crate::RegisterSpec,
121{
122    #[doc = "Auto channel increment disabled"]
123    #[inline(always)]
124    pub fn lwi_0(self) -> &'a mut crate::W<REG> {
125        self.variant(Lwi::Lwi0)
126    }
127    #[doc = "Auto channel increment enabled"]
128    #[inline(always)]
129    pub fn lwi_1(self) -> &'a mut crate::W<REG> {
130        self.variant(Lwi::Lwi1)
131    }
132}
133#[doc = "Sample Time Select\n\nValue on reset: 0"]
134#[cfg_attr(feature = "defmt", derive(defmt::Format))]
135#[derive(Clone, Copy, Debug, PartialEq, Eq)]
136#[repr(u8)]
137pub enum Sts {
138    #[doc = "0: Minimum sample time of 3 ADCK cycles."]
139    Sts0 = 0,
140    #[doc = "1: 3 + 2^1 ADCK cycles; 5 ADCK cycles total sample time."]
141    Sts1 = 1,
142    #[doc = "2: 3 + 2^2 ADCK cycles; 7 ADCK cycles total sample time."]
143    Sts2 = 2,
144    #[doc = "3: 3 + 2^3 ADCK cycles; 11 ADCK cycles total sample time."]
145    Sts3 = 3,
146    #[doc = "4: 3 + 2^4 ADCK cycles; 19 ADCK cycles total sample time."]
147    Sts4 = 4,
148    #[doc = "5: 3 + 2^5 ADCK cycles; 35 ADCK cycles total sample time."]
149    Sts5 = 5,
150    #[doc = "6: 3 + 2^6 ADCK cycles; 67 ADCK cycles total sample time."]
151    Sts6 = 6,
152    #[doc = "7: 3 + 2^7 ADCK cycles; 131 ADCK cycles total sample time."]
153    Sts7 = 7,
154}
155impl From<Sts> for u8 {
156    #[inline(always)]
157    fn from(variant: Sts) -> Self {
158        variant as _
159    }
160}
161impl crate::FieldSpec for Sts {
162    type Ux = u8;
163}
164impl crate::IsEnum for Sts {}
165#[doc = "Field `STS` reader - Sample Time Select"]
166pub type StsR = crate::FieldReader<Sts>;
167impl StsR {
168    #[doc = "Get enumerated values variant"]
169    #[inline(always)]
170    pub const fn variant(&self) -> Sts {
171        match self.bits {
172            0 => Sts::Sts0,
173            1 => Sts::Sts1,
174            2 => Sts::Sts2,
175            3 => Sts::Sts3,
176            4 => Sts::Sts4,
177            5 => Sts::Sts5,
178            6 => Sts::Sts6,
179            7 => Sts::Sts7,
180            _ => unreachable!(),
181        }
182    }
183    #[doc = "Minimum sample time of 3 ADCK cycles."]
184    #[inline(always)]
185    pub fn is_sts_0(&self) -> bool {
186        *self == Sts::Sts0
187    }
188    #[doc = "3 + 2^1 ADCK cycles; 5 ADCK cycles total sample time."]
189    #[inline(always)]
190    pub fn is_sts_1(&self) -> bool {
191        *self == Sts::Sts1
192    }
193    #[doc = "3 + 2^2 ADCK cycles; 7 ADCK cycles total sample time."]
194    #[inline(always)]
195    pub fn is_sts_2(&self) -> bool {
196        *self == Sts::Sts2
197    }
198    #[doc = "3 + 2^3 ADCK cycles; 11 ADCK cycles total sample time."]
199    #[inline(always)]
200    pub fn is_sts_3(&self) -> bool {
201        *self == Sts::Sts3
202    }
203    #[doc = "3 + 2^4 ADCK cycles; 19 ADCK cycles total sample time."]
204    #[inline(always)]
205    pub fn is_sts_4(&self) -> bool {
206        *self == Sts::Sts4
207    }
208    #[doc = "3 + 2^5 ADCK cycles; 35 ADCK cycles total sample time."]
209    #[inline(always)]
210    pub fn is_sts_5(&self) -> bool {
211        *self == Sts::Sts5
212    }
213    #[doc = "3 + 2^6 ADCK cycles; 67 ADCK cycles total sample time."]
214    #[inline(always)]
215    pub fn is_sts_6(&self) -> bool {
216        *self == Sts::Sts6
217    }
218    #[doc = "3 + 2^7 ADCK cycles; 131 ADCK cycles total sample time."]
219    #[inline(always)]
220    pub fn is_sts_7(&self) -> bool {
221        *self == Sts::Sts7
222    }
223}
224#[doc = "Field `STS` writer - Sample Time Select"]
225pub type StsW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sts, crate::Safe>;
226impl<'a, REG> StsW<'a, REG>
227where
228    REG: crate::Writable + crate::RegisterSpec,
229    REG::Ux: From<u8>,
230{
231    #[doc = "Minimum sample time of 3 ADCK cycles."]
232    #[inline(always)]
233    pub fn sts_0(self) -> &'a mut crate::W<REG> {
234        self.variant(Sts::Sts0)
235    }
236    #[doc = "3 + 2^1 ADCK cycles; 5 ADCK cycles total sample time."]
237    #[inline(always)]
238    pub fn sts_1(self) -> &'a mut crate::W<REG> {
239        self.variant(Sts::Sts1)
240    }
241    #[doc = "3 + 2^2 ADCK cycles; 7 ADCK cycles total sample time."]
242    #[inline(always)]
243    pub fn sts_2(self) -> &'a mut crate::W<REG> {
244        self.variant(Sts::Sts2)
245    }
246    #[doc = "3 + 2^3 ADCK cycles; 11 ADCK cycles total sample time."]
247    #[inline(always)]
248    pub fn sts_3(self) -> &'a mut crate::W<REG> {
249        self.variant(Sts::Sts3)
250    }
251    #[doc = "3 + 2^4 ADCK cycles; 19 ADCK cycles total sample time."]
252    #[inline(always)]
253    pub fn sts_4(self) -> &'a mut crate::W<REG> {
254        self.variant(Sts::Sts4)
255    }
256    #[doc = "3 + 2^5 ADCK cycles; 35 ADCK cycles total sample time."]
257    #[inline(always)]
258    pub fn sts_5(self) -> &'a mut crate::W<REG> {
259        self.variant(Sts::Sts5)
260    }
261    #[doc = "3 + 2^6 ADCK cycles; 67 ADCK cycles total sample time."]
262    #[inline(always)]
263    pub fn sts_6(self) -> &'a mut crate::W<REG> {
264        self.variant(Sts::Sts6)
265    }
266    #[doc = "3 + 2^7 ADCK cycles; 131 ADCK cycles total sample time."]
267    #[inline(always)]
268    pub fn sts_7(self) -> &'a mut crate::W<REG> {
269        self.variant(Sts::Sts7)
270    }
271}
272#[doc = "Hardware Average Select\n\nValue on reset: 0"]
273#[cfg_attr(feature = "defmt", derive(defmt::Format))]
274#[derive(Clone, Copy, Debug, PartialEq, Eq)]
275#[repr(u8)]
276pub enum Avgs {
277    #[doc = "0: Single conversion."]
278    Avgs0 = 0,
279    #[doc = "1: 2 conversions averaged."]
280    Avgs1 = 1,
281    #[doc = "2: 4 conversions averaged."]
282    Avgs2 = 2,
283    #[doc = "3: 8 conversions averaged."]
284    Avgs3 = 3,
285    #[doc = "4: 16 conversions averaged."]
286    Avgs4 = 4,
287    #[doc = "5: 32 conversions averaged."]
288    Avgs5 = 5,
289    #[doc = "6: 64 conversions averaged."]
290    Avgs6 = 6,
291    #[doc = "7: 128 conversions averaged."]
292    Avgs7 = 7,
293}
294impl From<Avgs> for u8 {
295    #[inline(always)]
296    fn from(variant: Avgs) -> Self {
297        variant as _
298    }
299}
300impl crate::FieldSpec for Avgs {
301    type Ux = u8;
302}
303impl crate::IsEnum for Avgs {}
304#[doc = "Field `AVGS` reader - Hardware Average Select"]
305pub type AvgsR = crate::FieldReader<Avgs>;
306impl AvgsR {
307    #[doc = "Get enumerated values variant"]
308    #[inline(always)]
309    pub const fn variant(&self) -> Avgs {
310        match self.bits {
311            0 => Avgs::Avgs0,
312            1 => Avgs::Avgs1,
313            2 => Avgs::Avgs2,
314            3 => Avgs::Avgs3,
315            4 => Avgs::Avgs4,
316            5 => Avgs::Avgs5,
317            6 => Avgs::Avgs6,
318            7 => Avgs::Avgs7,
319            _ => unreachable!(),
320        }
321    }
322    #[doc = "Single conversion."]
323    #[inline(always)]
324    pub fn is_avgs_0(&self) -> bool {
325        *self == Avgs::Avgs0
326    }
327    #[doc = "2 conversions averaged."]
328    #[inline(always)]
329    pub fn is_avgs_1(&self) -> bool {
330        *self == Avgs::Avgs1
331    }
332    #[doc = "4 conversions averaged."]
333    #[inline(always)]
334    pub fn is_avgs_2(&self) -> bool {
335        *self == Avgs::Avgs2
336    }
337    #[doc = "8 conversions averaged."]
338    #[inline(always)]
339    pub fn is_avgs_3(&self) -> bool {
340        *self == Avgs::Avgs3
341    }
342    #[doc = "16 conversions averaged."]
343    #[inline(always)]
344    pub fn is_avgs_4(&self) -> bool {
345        *self == Avgs::Avgs4
346    }
347    #[doc = "32 conversions averaged."]
348    #[inline(always)]
349    pub fn is_avgs_5(&self) -> bool {
350        *self == Avgs::Avgs5
351    }
352    #[doc = "64 conversions averaged."]
353    #[inline(always)]
354    pub fn is_avgs_6(&self) -> bool {
355        *self == Avgs::Avgs6
356    }
357    #[doc = "128 conversions averaged."]
358    #[inline(always)]
359    pub fn is_avgs_7(&self) -> bool {
360        *self == Avgs::Avgs7
361    }
362}
363#[doc = "Field `AVGS` writer - Hardware Average Select"]
364pub type AvgsW<'a, REG> = crate::FieldWriter<'a, REG, 3, Avgs, crate::Safe>;
365impl<'a, REG> AvgsW<'a, REG>
366where
367    REG: crate::Writable + crate::RegisterSpec,
368    REG::Ux: From<u8>,
369{
370    #[doc = "Single conversion."]
371    #[inline(always)]
372    pub fn avgs_0(self) -> &'a mut crate::W<REG> {
373        self.variant(Avgs::Avgs0)
374    }
375    #[doc = "2 conversions averaged."]
376    #[inline(always)]
377    pub fn avgs_1(self) -> &'a mut crate::W<REG> {
378        self.variant(Avgs::Avgs1)
379    }
380    #[doc = "4 conversions averaged."]
381    #[inline(always)]
382    pub fn avgs_2(self) -> &'a mut crate::W<REG> {
383        self.variant(Avgs::Avgs2)
384    }
385    #[doc = "8 conversions averaged."]
386    #[inline(always)]
387    pub fn avgs_3(self) -> &'a mut crate::W<REG> {
388        self.variant(Avgs::Avgs3)
389    }
390    #[doc = "16 conversions averaged."]
391    #[inline(always)]
392    pub fn avgs_4(self) -> &'a mut crate::W<REG> {
393        self.variant(Avgs::Avgs4)
394    }
395    #[doc = "32 conversions averaged."]
396    #[inline(always)]
397    pub fn avgs_5(self) -> &'a mut crate::W<REG> {
398        self.variant(Avgs::Avgs5)
399    }
400    #[doc = "64 conversions averaged."]
401    #[inline(always)]
402    pub fn avgs_6(self) -> &'a mut crate::W<REG> {
403        self.variant(Avgs::Avgs6)
404    }
405    #[doc = "128 conversions averaged."]
406    #[inline(always)]
407    pub fn avgs_7(self) -> &'a mut crate::W<REG> {
408        self.variant(Avgs::Avgs7)
409    }
410}
411#[doc = "Loop Count Select\n\nValue on reset: 0"]
412#[cfg_attr(feature = "defmt", derive(defmt::Format))]
413#[derive(Clone, Copy, Debug, PartialEq, Eq)]
414#[repr(u8)]
415pub enum Loop {
416    #[doc = "0: Looping not enabled. Command executes 1 time."]
417    Loop0 = 0,
418    #[doc = "1: Loop 1 time. Command executes 2 times."]
419    Loop1 = 1,
420    #[doc = "2: Loop 2 times. Command executes 3 times."]
421    Loop2 = 2,
422    #[doc = "3: Loop corresponding number of times. Command executes LOOP+1 times."]
423    Loop3 = 3,
424    #[doc = "4: Loop corresponding number of times. Command executes LOOP+1 times."]
425    Loop4 = 4,
426    #[doc = "5: Loop corresponding number of times. Command executes LOOP+1 times."]
427    Loop5 = 5,
428    #[doc = "6: Loop corresponding number of times. Command executes LOOP+1 times."]
429    Loop6 = 6,
430    #[doc = "7: Loop corresponding number of times. Command executes LOOP+1 times."]
431    Loop7 = 7,
432    #[doc = "8: Loop corresponding number of times. Command executes LOOP+1 times."]
433    Loop8 = 8,
434    #[doc = "9: Loop corresponding number of times. Command executes LOOP+1 times."]
435    Loop9 = 9,
436    #[doc = "15: Loop 15 times. Command executes 16 times."]
437    Loop15 = 15,
438}
439impl From<Loop> for u8 {
440    #[inline(always)]
441    fn from(variant: Loop) -> Self {
442        variant as _
443    }
444}
445impl crate::FieldSpec for Loop {
446    type Ux = u8;
447}
448impl crate::IsEnum for Loop {}
449#[doc = "Field `LOOP` reader - Loop Count Select"]
450pub type LoopR = crate::FieldReader<Loop>;
451impl LoopR {
452    #[doc = "Get enumerated values variant"]
453    #[inline(always)]
454    pub const fn variant(&self) -> Option<Loop> {
455        match self.bits {
456            0 => Some(Loop::Loop0),
457            1 => Some(Loop::Loop1),
458            2 => Some(Loop::Loop2),
459            3 => Some(Loop::Loop3),
460            4 => Some(Loop::Loop4),
461            5 => Some(Loop::Loop5),
462            6 => Some(Loop::Loop6),
463            7 => Some(Loop::Loop7),
464            8 => Some(Loop::Loop8),
465            9 => Some(Loop::Loop9),
466            15 => Some(Loop::Loop15),
467            _ => None,
468        }
469    }
470    #[doc = "Looping not enabled. Command executes 1 time."]
471    #[inline(always)]
472    pub fn is_loop_0(&self) -> bool {
473        *self == Loop::Loop0
474    }
475    #[doc = "Loop 1 time. Command executes 2 times."]
476    #[inline(always)]
477    pub fn is_loop_1(&self) -> bool {
478        *self == Loop::Loop1
479    }
480    #[doc = "Loop 2 times. Command executes 3 times."]
481    #[inline(always)]
482    pub fn is_loop_2(&self) -> bool {
483        *self == Loop::Loop2
484    }
485    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
486    #[inline(always)]
487    pub fn is_loop_3(&self) -> bool {
488        *self == Loop::Loop3
489    }
490    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
491    #[inline(always)]
492    pub fn is_loop_4(&self) -> bool {
493        *self == Loop::Loop4
494    }
495    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
496    #[inline(always)]
497    pub fn is_loop_5(&self) -> bool {
498        *self == Loop::Loop5
499    }
500    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
501    #[inline(always)]
502    pub fn is_loop_6(&self) -> bool {
503        *self == Loop::Loop6
504    }
505    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
506    #[inline(always)]
507    pub fn is_loop_7(&self) -> bool {
508        *self == Loop::Loop7
509    }
510    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
511    #[inline(always)]
512    pub fn is_loop_8(&self) -> bool {
513        *self == Loop::Loop8
514    }
515    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
516    #[inline(always)]
517    pub fn is_loop_9(&self) -> bool {
518        *self == Loop::Loop9
519    }
520    #[doc = "Loop 15 times. Command executes 16 times."]
521    #[inline(always)]
522    pub fn is_loop_15(&self) -> bool {
523        *self == Loop::Loop15
524    }
525}
526#[doc = "Field `LOOP` writer - Loop Count Select"]
527pub type LoopW<'a, REG> = crate::FieldWriter<'a, REG, 4, Loop>;
528impl<'a, REG> LoopW<'a, REG>
529where
530    REG: crate::Writable + crate::RegisterSpec,
531    REG::Ux: From<u8>,
532{
533    #[doc = "Looping not enabled. Command executes 1 time."]
534    #[inline(always)]
535    pub fn loop_0(self) -> &'a mut crate::W<REG> {
536        self.variant(Loop::Loop0)
537    }
538    #[doc = "Loop 1 time. Command executes 2 times."]
539    #[inline(always)]
540    pub fn loop_1(self) -> &'a mut crate::W<REG> {
541        self.variant(Loop::Loop1)
542    }
543    #[doc = "Loop 2 times. Command executes 3 times."]
544    #[inline(always)]
545    pub fn loop_2(self) -> &'a mut crate::W<REG> {
546        self.variant(Loop::Loop2)
547    }
548    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
549    #[inline(always)]
550    pub fn loop_3(self) -> &'a mut crate::W<REG> {
551        self.variant(Loop::Loop3)
552    }
553    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
554    #[inline(always)]
555    pub fn loop_4(self) -> &'a mut crate::W<REG> {
556        self.variant(Loop::Loop4)
557    }
558    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
559    #[inline(always)]
560    pub fn loop_5(self) -> &'a mut crate::W<REG> {
561        self.variant(Loop::Loop5)
562    }
563    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
564    #[inline(always)]
565    pub fn loop_6(self) -> &'a mut crate::W<REG> {
566        self.variant(Loop::Loop6)
567    }
568    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
569    #[inline(always)]
570    pub fn loop_7(self) -> &'a mut crate::W<REG> {
571        self.variant(Loop::Loop7)
572    }
573    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
574    #[inline(always)]
575    pub fn loop_8(self) -> &'a mut crate::W<REG> {
576        self.variant(Loop::Loop8)
577    }
578    #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
579    #[inline(always)]
580    pub fn loop_9(self) -> &'a mut crate::W<REG> {
581        self.variant(Loop::Loop9)
582    }
583    #[doc = "Loop 15 times. Command executes 16 times."]
584    #[inline(always)]
585    pub fn loop_15(self) -> &'a mut crate::W<REG> {
586        self.variant(Loop::Loop15)
587    }
588}
589#[doc = "Next Command Select\n\nValue on reset: 0"]
590#[cfg_attr(feature = "defmt", derive(defmt::Format))]
591#[derive(Clone, Copy, Debug, PartialEq, Eq)]
592#[repr(u8)]
593pub enum Next {
594    #[doc = "0: No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
595    Next0 = 0,
596    #[doc = "1: Select CMD1 command buffer register as next command."]
597    Next1 = 1,
598    #[doc = "2: Select corresponding CMD command buffer register as next command"]
599    Next2 = 2,
600    #[doc = "3: Select corresponding CMD command buffer register as next command"]
601    Next3 = 3,
602    #[doc = "4: Select corresponding CMD command buffer register as next command"]
603    Next4 = 4,
604    #[doc = "5: Select corresponding CMD command buffer register as next command"]
605    Next5 = 5,
606    #[doc = "6: Select corresponding CMD command buffer register as next command"]
607    Next6 = 6,
608    #[doc = "7: Select corresponding CMD command buffer register as next command"]
609    Next7 = 7,
610    #[doc = "8: Select corresponding CMD command buffer register as next command"]
611    Next8 = 8,
612    #[doc = "9: Select corresponding CMD command buffer register as next command"]
613    Next9 = 9,
614    #[doc = "15: Select CMD15 command buffer register as next command."]
615    Next15 = 15,
616}
617impl From<Next> for u8 {
618    #[inline(always)]
619    fn from(variant: Next) -> Self {
620        variant as _
621    }
622}
623impl crate::FieldSpec for Next {
624    type Ux = u8;
625}
626impl crate::IsEnum for Next {}
627#[doc = "Field `NEXT` reader - Next Command Select"]
628pub type NextR = crate::FieldReader<Next>;
629impl NextR {
630    #[doc = "Get enumerated values variant"]
631    #[inline(always)]
632    pub const fn variant(&self) -> Option<Next> {
633        match self.bits {
634            0 => Some(Next::Next0),
635            1 => Some(Next::Next1),
636            2 => Some(Next::Next2),
637            3 => Some(Next::Next3),
638            4 => Some(Next::Next4),
639            5 => Some(Next::Next5),
640            6 => Some(Next::Next6),
641            7 => Some(Next::Next7),
642            8 => Some(Next::Next8),
643            9 => Some(Next::Next9),
644            15 => Some(Next::Next15),
645            _ => None,
646        }
647    }
648    #[doc = "No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
649    #[inline(always)]
650    pub fn is_next_0(&self) -> bool {
651        *self == Next::Next0
652    }
653    #[doc = "Select CMD1 command buffer register as next command."]
654    #[inline(always)]
655    pub fn is_next_1(&self) -> bool {
656        *self == Next::Next1
657    }
658    #[doc = "Select corresponding CMD command buffer register as next command"]
659    #[inline(always)]
660    pub fn is_next_2(&self) -> bool {
661        *self == Next::Next2
662    }
663    #[doc = "Select corresponding CMD command buffer register as next command"]
664    #[inline(always)]
665    pub fn is_next_3(&self) -> bool {
666        *self == Next::Next3
667    }
668    #[doc = "Select corresponding CMD command buffer register as next command"]
669    #[inline(always)]
670    pub fn is_next_4(&self) -> bool {
671        *self == Next::Next4
672    }
673    #[doc = "Select corresponding CMD command buffer register as next command"]
674    #[inline(always)]
675    pub fn is_next_5(&self) -> bool {
676        *self == Next::Next5
677    }
678    #[doc = "Select corresponding CMD command buffer register as next command"]
679    #[inline(always)]
680    pub fn is_next_6(&self) -> bool {
681        *self == Next::Next6
682    }
683    #[doc = "Select corresponding CMD command buffer register as next command"]
684    #[inline(always)]
685    pub fn is_next_7(&self) -> bool {
686        *self == Next::Next7
687    }
688    #[doc = "Select corresponding CMD command buffer register as next command"]
689    #[inline(always)]
690    pub fn is_next_8(&self) -> bool {
691        *self == Next::Next8
692    }
693    #[doc = "Select corresponding CMD command buffer register as next command"]
694    #[inline(always)]
695    pub fn is_next_9(&self) -> bool {
696        *self == Next::Next9
697    }
698    #[doc = "Select CMD15 command buffer register as next command."]
699    #[inline(always)]
700    pub fn is_next_15(&self) -> bool {
701        *self == Next::Next15
702    }
703}
704#[doc = "Field `NEXT` writer - Next Command Select"]
705pub type NextW<'a, REG> = crate::FieldWriter<'a, REG, 4, Next>;
706impl<'a, REG> NextW<'a, REG>
707where
708    REG: crate::Writable + crate::RegisterSpec,
709    REG::Ux: From<u8>,
710{
711    #[doc = "No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
712    #[inline(always)]
713    pub fn next_0(self) -> &'a mut crate::W<REG> {
714        self.variant(Next::Next0)
715    }
716    #[doc = "Select CMD1 command buffer register as next command."]
717    #[inline(always)]
718    pub fn next_1(self) -> &'a mut crate::W<REG> {
719        self.variant(Next::Next1)
720    }
721    #[doc = "Select corresponding CMD command buffer register as next command"]
722    #[inline(always)]
723    pub fn next_2(self) -> &'a mut crate::W<REG> {
724        self.variant(Next::Next2)
725    }
726    #[doc = "Select corresponding CMD command buffer register as next command"]
727    #[inline(always)]
728    pub fn next_3(self) -> &'a mut crate::W<REG> {
729        self.variant(Next::Next3)
730    }
731    #[doc = "Select corresponding CMD command buffer register as next command"]
732    #[inline(always)]
733    pub fn next_4(self) -> &'a mut crate::W<REG> {
734        self.variant(Next::Next4)
735    }
736    #[doc = "Select corresponding CMD command buffer register as next command"]
737    #[inline(always)]
738    pub fn next_5(self) -> &'a mut crate::W<REG> {
739        self.variant(Next::Next5)
740    }
741    #[doc = "Select corresponding CMD command buffer register as next command"]
742    #[inline(always)]
743    pub fn next_6(self) -> &'a mut crate::W<REG> {
744        self.variant(Next::Next6)
745    }
746    #[doc = "Select corresponding CMD command buffer register as next command"]
747    #[inline(always)]
748    pub fn next_7(self) -> &'a mut crate::W<REG> {
749        self.variant(Next::Next7)
750    }
751    #[doc = "Select corresponding CMD command buffer register as next command"]
752    #[inline(always)]
753    pub fn next_8(self) -> &'a mut crate::W<REG> {
754        self.variant(Next::Next8)
755    }
756    #[doc = "Select corresponding CMD command buffer register as next command"]
757    #[inline(always)]
758    pub fn next_9(self) -> &'a mut crate::W<REG> {
759        self.variant(Next::Next9)
760    }
761    #[doc = "Select CMD15 command buffer register as next command."]
762    #[inline(always)]
763    pub fn next_15(self) -> &'a mut crate::W<REG> {
764        self.variant(Next::Next15)
765    }
766}
767impl R {
768    #[doc = "Bits 0:1 - Compare Function Enable"]
769    #[inline(always)]
770    pub fn cmpen(&self) -> CmpenR {
771        CmpenR::new((self.bits & 3) as u8)
772    }
773    #[doc = "Bit 7 - Loop with Increment"]
774    #[inline(always)]
775    pub fn lwi(&self) -> LwiR {
776        LwiR::new(((self.bits >> 7) & 1) != 0)
777    }
778    #[doc = "Bits 8:10 - Sample Time Select"]
779    #[inline(always)]
780    pub fn sts(&self) -> StsR {
781        StsR::new(((self.bits >> 8) & 7) as u8)
782    }
783    #[doc = "Bits 12:14 - Hardware Average Select"]
784    #[inline(always)]
785    pub fn avgs(&self) -> AvgsR {
786        AvgsR::new(((self.bits >> 12) & 7) as u8)
787    }
788    #[doc = "Bits 16:19 - Loop Count Select"]
789    #[inline(always)]
790    pub fn loop_(&self) -> LoopR {
791        LoopR::new(((self.bits >> 16) & 0x0f) as u8)
792    }
793    #[doc = "Bits 24:27 - Next Command Select"]
794    #[inline(always)]
795    pub fn next(&self) -> NextR {
796        NextR::new(((self.bits >> 24) & 0x0f) as u8)
797    }
798}
799#[cfg(feature = "debug")]
800impl core::fmt::Debug for R {
801    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
802        f.debug_struct("CMDH")
803            .field("cmpen", &self.cmpen())
804            .field("lwi", &self.lwi())
805            .field("sts", &self.sts())
806            .field("avgs", &self.avgs())
807            .field("loop_", &self.loop_())
808            .field("next", &self.next())
809            .finish()
810    }
811}
812impl W {
813    #[doc = "Bits 0:1 - Compare Function Enable"]
814    #[inline(always)]
815    pub fn cmpen(&mut self) -> CmpenW<CmdhSpec> {
816        CmpenW::new(self, 0)
817    }
818    #[doc = "Bit 7 - Loop with Increment"]
819    #[inline(always)]
820    pub fn lwi(&mut self) -> LwiW<CmdhSpec> {
821        LwiW::new(self, 7)
822    }
823    #[doc = "Bits 8:10 - Sample Time Select"]
824    #[inline(always)]
825    pub fn sts(&mut self) -> StsW<CmdhSpec> {
826        StsW::new(self, 8)
827    }
828    #[doc = "Bits 12:14 - Hardware Average Select"]
829    #[inline(always)]
830    pub fn avgs(&mut self) -> AvgsW<CmdhSpec> {
831        AvgsW::new(self, 12)
832    }
833    #[doc = "Bits 16:19 - Loop Count Select"]
834    #[inline(always)]
835    pub fn loop_(&mut self) -> LoopW<CmdhSpec> {
836        LoopW::new(self, 16)
837    }
838    #[doc = "Bits 24:27 - Next Command Select"]
839    #[inline(always)]
840    pub fn next(&mut self) -> NextW<CmdhSpec> {
841        NextW::new(self, 24)
842    }
843}
844#[doc = "ADC Command High Buffer Register\n\nYou can [`read`](crate::Reg::read) this register and get [`cmdh::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cmdh::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
845pub struct CmdhSpec;
846impl crate::RegisterSpec for CmdhSpec {
847    type Ux = u32;
848}
849#[doc = "`read()` method returns [`cmdh::R`](R) reader structure"]
850impl crate::Readable for CmdhSpec {}
851#[doc = "`write(|w| ..)` method takes [`cmdh::W`](W) writer structure"]
852impl crate::Writable for CmdhSpec {
853    type Safety = crate::Unsafe;
854    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
855    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
856}
857#[doc = "`reset()` method sets CMDH%s to value 0"]
858impl crate::Resettable for CmdhSpec {
859    const RESET_VALUE: u32 = 0;
860}