lpc550x/adc0/
cmdh2.rs

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