ra2a1/sdadc24/
pgac.rs

1#[doc = "Register `PGAC%s` reader"]
2pub struct R(crate::R<PGAC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PGAC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PGAC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PGAC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PGAC%s` writer"]
17pub struct W(crate::W<PGAC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PGAC_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<PGAC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PGAC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PGAGC` reader - Gain selection of a programmable gain instrumentation amplifier ( Gset1, Gset2, Gtotal )"]
38pub type PGAGC_R = crate::FieldReader<u8, PGAGC_A>;
39#[doc = "Gain selection of a programmable gain instrumentation amplifier ( Gset1, Gset2, Gtotal )\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PGAGC_A {
43    #[doc = "0: (1, 1, 1)"]
44    _00000 = 0,
45    #[doc = "4: (2, 1, 2)"]
46    _00100 = 4,
47    #[doc = "8: (3, 1, 3)"]
48    _01000 = 8,
49    #[doc = "12: (4, 1, 4)"]
50    _01100 = 12,
51    #[doc = "16: (8, 1, 8)"]
52    _10000 = 16,
53    #[doc = "1: (1, 2, 2)"]
54    _00001 = 1,
55    #[doc = "5: (2, 2, 4)"]
56    _00101 = 5,
57    #[doc = "9: (3, 2, 6)"]
58    _01001 = 9,
59    #[doc = "13: (4, 2, 8)"]
60    _01101 = 13,
61    #[doc = "17: (8, 2, 16)"]
62    _10001 = 17,
63    #[doc = "2: (1, 4, 4)"]
64    _00010 = 2,
65    #[doc = "6: (2, 4, 8)"]
66    _00110 = 6,
67    #[doc = "10: (3, 4, 12)"]
68    _01010 = 10,
69    #[doc = "14: (4, 4, 16)"]
70    _01110 = 14,
71    #[doc = "18: (8, 4, 32)"]
72    _10010 = 18,
73    #[doc = "3: (1, 8, 8)"]
74    _00011 = 3,
75    #[doc = "7: (2, 8, 16)"]
76    _00111 = 7,
77    #[doc = "11: (3, 8, 24)"]
78    _01011 = 11,
79    #[doc = "15: (4, 8, 32)."]
80    _01111 = 15,
81}
82impl From<PGAGC_A> for u8 {
83    #[inline(always)]
84    fn from(variant: PGAGC_A) -> Self {
85        variant as _
86    }
87}
88impl PGAGC_R {
89    #[doc = "Get enumerated values variant"]
90    #[inline(always)]
91    pub fn variant(&self) -> Option<PGAGC_A> {
92        match self.bits {
93            0 => Some(PGAGC_A::_00000),
94            4 => Some(PGAGC_A::_00100),
95            8 => Some(PGAGC_A::_01000),
96            12 => Some(PGAGC_A::_01100),
97            16 => Some(PGAGC_A::_10000),
98            1 => Some(PGAGC_A::_00001),
99            5 => Some(PGAGC_A::_00101),
100            9 => Some(PGAGC_A::_01001),
101            13 => Some(PGAGC_A::_01101),
102            17 => Some(PGAGC_A::_10001),
103            2 => Some(PGAGC_A::_00010),
104            6 => Some(PGAGC_A::_00110),
105            10 => Some(PGAGC_A::_01010),
106            14 => Some(PGAGC_A::_01110),
107            18 => Some(PGAGC_A::_10010),
108            3 => Some(PGAGC_A::_00011),
109            7 => Some(PGAGC_A::_00111),
110            11 => Some(PGAGC_A::_01011),
111            15 => Some(PGAGC_A::_01111),
112            _ => None,
113        }
114    }
115    #[doc = "Checks if the value of the field is `_00000`"]
116    #[inline(always)]
117    pub fn is_00000(&self) -> bool {
118        *self == PGAGC_A::_00000
119    }
120    #[doc = "Checks if the value of the field is `_00100`"]
121    #[inline(always)]
122    pub fn is_00100(&self) -> bool {
123        *self == PGAGC_A::_00100
124    }
125    #[doc = "Checks if the value of the field is `_01000`"]
126    #[inline(always)]
127    pub fn is_01000(&self) -> bool {
128        *self == PGAGC_A::_01000
129    }
130    #[doc = "Checks if the value of the field is `_01100`"]
131    #[inline(always)]
132    pub fn is_01100(&self) -> bool {
133        *self == PGAGC_A::_01100
134    }
135    #[doc = "Checks if the value of the field is `_10000`"]
136    #[inline(always)]
137    pub fn is_10000(&self) -> bool {
138        *self == PGAGC_A::_10000
139    }
140    #[doc = "Checks if the value of the field is `_00001`"]
141    #[inline(always)]
142    pub fn is_00001(&self) -> bool {
143        *self == PGAGC_A::_00001
144    }
145    #[doc = "Checks if the value of the field is `_00101`"]
146    #[inline(always)]
147    pub fn is_00101(&self) -> bool {
148        *self == PGAGC_A::_00101
149    }
150    #[doc = "Checks if the value of the field is `_01001`"]
151    #[inline(always)]
152    pub fn is_01001(&self) -> bool {
153        *self == PGAGC_A::_01001
154    }
155    #[doc = "Checks if the value of the field is `_01101`"]
156    #[inline(always)]
157    pub fn is_01101(&self) -> bool {
158        *self == PGAGC_A::_01101
159    }
160    #[doc = "Checks if the value of the field is `_10001`"]
161    #[inline(always)]
162    pub fn is_10001(&self) -> bool {
163        *self == PGAGC_A::_10001
164    }
165    #[doc = "Checks if the value of the field is `_00010`"]
166    #[inline(always)]
167    pub fn is_00010(&self) -> bool {
168        *self == PGAGC_A::_00010
169    }
170    #[doc = "Checks if the value of the field is `_00110`"]
171    #[inline(always)]
172    pub fn is_00110(&self) -> bool {
173        *self == PGAGC_A::_00110
174    }
175    #[doc = "Checks if the value of the field is `_01010`"]
176    #[inline(always)]
177    pub fn is_01010(&self) -> bool {
178        *self == PGAGC_A::_01010
179    }
180    #[doc = "Checks if the value of the field is `_01110`"]
181    #[inline(always)]
182    pub fn is_01110(&self) -> bool {
183        *self == PGAGC_A::_01110
184    }
185    #[doc = "Checks if the value of the field is `_10010`"]
186    #[inline(always)]
187    pub fn is_10010(&self) -> bool {
188        *self == PGAGC_A::_10010
189    }
190    #[doc = "Checks if the value of the field is `_00011`"]
191    #[inline(always)]
192    pub fn is_00011(&self) -> bool {
193        *self == PGAGC_A::_00011
194    }
195    #[doc = "Checks if the value of the field is `_00111`"]
196    #[inline(always)]
197    pub fn is_00111(&self) -> bool {
198        *self == PGAGC_A::_00111
199    }
200    #[doc = "Checks if the value of the field is `_01011`"]
201    #[inline(always)]
202    pub fn is_01011(&self) -> bool {
203        *self == PGAGC_A::_01011
204    }
205    #[doc = "Checks if the value of the field is `_01111`"]
206    #[inline(always)]
207    pub fn is_01111(&self) -> bool {
208        *self == PGAGC_A::_01111
209    }
210}
211#[doc = "Field `PGAGC` writer - Gain selection of a programmable gain instrumentation amplifier ( Gset1, Gset2, Gtotal )"]
212pub type PGAGC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PGAC_SPEC, u8, PGAGC_A, 5, O>;
213impl<'a, const O: u8> PGAGC_W<'a, O> {
214    #[doc = "(1, 1, 1)"]
215    #[inline(always)]
216    pub fn _00000(self) -> &'a mut W {
217        self.variant(PGAGC_A::_00000)
218    }
219    #[doc = "(2, 1, 2)"]
220    #[inline(always)]
221    pub fn _00100(self) -> &'a mut W {
222        self.variant(PGAGC_A::_00100)
223    }
224    #[doc = "(3, 1, 3)"]
225    #[inline(always)]
226    pub fn _01000(self) -> &'a mut W {
227        self.variant(PGAGC_A::_01000)
228    }
229    #[doc = "(4, 1, 4)"]
230    #[inline(always)]
231    pub fn _01100(self) -> &'a mut W {
232        self.variant(PGAGC_A::_01100)
233    }
234    #[doc = "(8, 1, 8)"]
235    #[inline(always)]
236    pub fn _10000(self) -> &'a mut W {
237        self.variant(PGAGC_A::_10000)
238    }
239    #[doc = "(1, 2, 2)"]
240    #[inline(always)]
241    pub fn _00001(self) -> &'a mut W {
242        self.variant(PGAGC_A::_00001)
243    }
244    #[doc = "(2, 2, 4)"]
245    #[inline(always)]
246    pub fn _00101(self) -> &'a mut W {
247        self.variant(PGAGC_A::_00101)
248    }
249    #[doc = "(3, 2, 6)"]
250    #[inline(always)]
251    pub fn _01001(self) -> &'a mut W {
252        self.variant(PGAGC_A::_01001)
253    }
254    #[doc = "(4, 2, 8)"]
255    #[inline(always)]
256    pub fn _01101(self) -> &'a mut W {
257        self.variant(PGAGC_A::_01101)
258    }
259    #[doc = "(8, 2, 16)"]
260    #[inline(always)]
261    pub fn _10001(self) -> &'a mut W {
262        self.variant(PGAGC_A::_10001)
263    }
264    #[doc = "(1, 4, 4)"]
265    #[inline(always)]
266    pub fn _00010(self) -> &'a mut W {
267        self.variant(PGAGC_A::_00010)
268    }
269    #[doc = "(2, 4, 8)"]
270    #[inline(always)]
271    pub fn _00110(self) -> &'a mut W {
272        self.variant(PGAGC_A::_00110)
273    }
274    #[doc = "(3, 4, 12)"]
275    #[inline(always)]
276    pub fn _01010(self) -> &'a mut W {
277        self.variant(PGAGC_A::_01010)
278    }
279    #[doc = "(4, 4, 16)"]
280    #[inline(always)]
281    pub fn _01110(self) -> &'a mut W {
282        self.variant(PGAGC_A::_01110)
283    }
284    #[doc = "(8, 4, 32)"]
285    #[inline(always)]
286    pub fn _10010(self) -> &'a mut W {
287        self.variant(PGAGC_A::_10010)
288    }
289    #[doc = "(1, 8, 8)"]
290    #[inline(always)]
291    pub fn _00011(self) -> &'a mut W {
292        self.variant(PGAGC_A::_00011)
293    }
294    #[doc = "(2, 8, 16)"]
295    #[inline(always)]
296    pub fn _00111(self) -> &'a mut W {
297        self.variant(PGAGC_A::_00111)
298    }
299    #[doc = "(3, 8, 24)"]
300    #[inline(always)]
301    pub fn _01011(self) -> &'a mut W {
302        self.variant(PGAGC_A::_01011)
303    }
304    #[doc = "(4, 8, 32)."]
305    #[inline(always)]
306    pub fn _01111(self) -> &'a mut W {
307        self.variant(PGAGC_A::_01111)
308    }
309}
310#[doc = "Field `PGAOSR` reader - Oversampling ratio select"]
311pub type PGAOSR_R = crate::FieldReader<u8, PGAOSR_A>;
312#[doc = "Oversampling ratio select\n\nValue on reset: 2"]
313#[derive(Clone, Copy, Debug, PartialEq, Eq)]
314#[repr(u8)]
315pub enum PGAOSR_A {
316    #[doc = "0: 64"]
317    _000 = 0,
318    #[doc = "1: 128"]
319    _001 = 1,
320    #[doc = "2: 256"]
321    _010 = 2,
322    #[doc = "3: 512"]
323    _011 = 3,
324    #[doc = "4: 1024"]
325    _100 = 4,
326    #[doc = "5: 2048"]
327    _101 = 5,
328}
329impl From<PGAOSR_A> for u8 {
330    #[inline(always)]
331    fn from(variant: PGAOSR_A) -> Self {
332        variant as _
333    }
334}
335impl PGAOSR_R {
336    #[doc = "Get enumerated values variant"]
337    #[inline(always)]
338    pub fn variant(&self) -> Option<PGAOSR_A> {
339        match self.bits {
340            0 => Some(PGAOSR_A::_000),
341            1 => Some(PGAOSR_A::_001),
342            2 => Some(PGAOSR_A::_010),
343            3 => Some(PGAOSR_A::_011),
344            4 => Some(PGAOSR_A::_100),
345            5 => Some(PGAOSR_A::_101),
346            _ => None,
347        }
348    }
349    #[doc = "Checks if the value of the field is `_000`"]
350    #[inline(always)]
351    pub fn is_000(&self) -> bool {
352        *self == PGAOSR_A::_000
353    }
354    #[doc = "Checks if the value of the field is `_001`"]
355    #[inline(always)]
356    pub fn is_001(&self) -> bool {
357        *self == PGAOSR_A::_001
358    }
359    #[doc = "Checks if the value of the field is `_010`"]
360    #[inline(always)]
361    pub fn is_010(&self) -> bool {
362        *self == PGAOSR_A::_010
363    }
364    #[doc = "Checks if the value of the field is `_011`"]
365    #[inline(always)]
366    pub fn is_011(&self) -> bool {
367        *self == PGAOSR_A::_011
368    }
369    #[doc = "Checks if the value of the field is `_100`"]
370    #[inline(always)]
371    pub fn is_100(&self) -> bool {
372        *self == PGAOSR_A::_100
373    }
374    #[doc = "Checks if the value of the field is `_101`"]
375    #[inline(always)]
376    pub fn is_101(&self) -> bool {
377        *self == PGAOSR_A::_101
378    }
379}
380#[doc = "Field `PGAOSR` writer - Oversampling ratio select"]
381pub type PGAOSR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PGAC_SPEC, u8, PGAOSR_A, 3, O>;
382impl<'a, const O: u8> PGAOSR_W<'a, O> {
383    #[doc = "64"]
384    #[inline(always)]
385    pub fn _000(self) -> &'a mut W {
386        self.variant(PGAOSR_A::_000)
387    }
388    #[doc = "128"]
389    #[inline(always)]
390    pub fn _001(self) -> &'a mut W {
391        self.variant(PGAOSR_A::_001)
392    }
393    #[doc = "256"]
394    #[inline(always)]
395    pub fn _010(self) -> &'a mut W {
396        self.variant(PGAOSR_A::_010)
397    }
398    #[doc = "512"]
399    #[inline(always)]
400    pub fn _011(self) -> &'a mut W {
401        self.variant(PGAOSR_A::_011)
402    }
403    #[doc = "1024"]
404    #[inline(always)]
405    pub fn _100(self) -> &'a mut W {
406        self.variant(PGAOSR_A::_100)
407    }
408    #[doc = "2048"]
409    #[inline(always)]
410    pub fn _101(self) -> &'a mut W {
411        self.variant(PGAOSR_A::_101)
412    }
413}
414#[doc = "Field `PGAOFS` reader - Offset voltage select"]
415pub type PGAOFS_R = crate::FieldReader<u8, u8>;
416#[doc = "Field `PGAOFS` writer - Offset voltage select"]
417pub type PGAOFS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PGAC_SPEC, u8, u8, 5, O>;
418#[doc = "Field `PGAPOL` reader - Polarity select"]
419pub type PGAPOL_R = crate::BitReader<PGAPOL_A>;
420#[doc = "Polarity select\n\nValue on reset: 0"]
421#[derive(Clone, Copy, Debug, PartialEq, Eq)]
422pub enum PGAPOL_A {
423    #[doc = "0: Positive-side single-end input"]
424    _0 = 0,
425    #[doc = "1: Negative-side single-end input"]
426    _1 = 1,
427}
428impl From<PGAPOL_A> for bool {
429    #[inline(always)]
430    fn from(variant: PGAPOL_A) -> Self {
431        variant as u8 != 0
432    }
433}
434impl PGAPOL_R {
435    #[doc = "Get enumerated values variant"]
436    #[inline(always)]
437    pub fn variant(&self) -> PGAPOL_A {
438        match self.bits {
439            false => PGAPOL_A::_0,
440            true => PGAPOL_A::_1,
441        }
442    }
443    #[doc = "Checks if the value of the field is `_0`"]
444    #[inline(always)]
445    pub fn is_0(&self) -> bool {
446        *self == PGAPOL_A::_0
447    }
448    #[doc = "Checks if the value of the field is `_1`"]
449    #[inline(always)]
450    pub fn is_1(&self) -> bool {
451        *self == PGAPOL_A::_1
452    }
453}
454#[doc = "Field `PGAPOL` writer - Polarity select"]
455pub type PGAPOL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PGAC_SPEC, PGAPOL_A, O>;
456impl<'a, const O: u8> PGAPOL_W<'a, O> {
457    #[doc = "Positive-side single-end input"]
458    #[inline(always)]
459    pub fn _0(self) -> &'a mut W {
460        self.variant(PGAPOL_A::_0)
461    }
462    #[doc = "Negative-side single-end input"]
463    #[inline(always)]
464    pub fn _1(self) -> &'a mut W {
465        self.variant(PGAPOL_A::_1)
466    }
467}
468#[doc = "Field `PGASEL` reader - Analog Channel Input Mode Select"]
469pub type PGASEL_R = crate::BitReader<PGASEL_A>;
470#[doc = "Analog Channel Input Mode Select\n\nValue on reset: 0"]
471#[derive(Clone, Copy, Debug, PartialEq, Eq)]
472pub enum PGASEL_A {
473    #[doc = "0: Differential input mode"]
474    _0 = 0,
475    #[doc = "1: Single-end input mode"]
476    _1 = 1,
477}
478impl From<PGASEL_A> for bool {
479    #[inline(always)]
480    fn from(variant: PGASEL_A) -> Self {
481        variant as u8 != 0
482    }
483}
484impl PGASEL_R {
485    #[doc = "Get enumerated values variant"]
486    #[inline(always)]
487    pub fn variant(&self) -> PGASEL_A {
488        match self.bits {
489            false => PGASEL_A::_0,
490            true => PGASEL_A::_1,
491        }
492    }
493    #[doc = "Checks if the value of the field is `_0`"]
494    #[inline(always)]
495    pub fn is_0(&self) -> bool {
496        *self == PGASEL_A::_0
497    }
498    #[doc = "Checks if the value of the field is `_1`"]
499    #[inline(always)]
500    pub fn is_1(&self) -> bool {
501        *self == PGASEL_A::_1
502    }
503}
504#[doc = "Field `PGASEL` writer - Analog Channel Input Mode Select"]
505pub type PGASEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PGAC_SPEC, PGASEL_A, O>;
506impl<'a, const O: u8> PGASEL_W<'a, O> {
507    #[doc = "Differential input mode"]
508    #[inline(always)]
509    pub fn _0(self) -> &'a mut W {
510        self.variant(PGASEL_A::_0)
511    }
512    #[doc = "Single-end input mode"]
513    #[inline(always)]
514    pub fn _1(self) -> &'a mut W {
515        self.variant(PGASEL_A::_1)
516    }
517}
518#[doc = "Field `PGACTM` reader - Coefficient (m) selection of the A/D conversion count (N) in AUTOSCAN"]
519pub type PGACTM_R = crate::FieldReader<u8, u8>;
520#[doc = "Field `PGACTM` writer - Coefficient (m) selection of the A/D conversion count (N) in AUTOSCAN"]
521pub type PGACTM_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PGAC_SPEC, u8, u8, 5, O>;
522#[doc = "Field `PGACTN` reader - Coefficient (n) selection of the A/D conversion count (N) in AUTOSCAN"]
523pub type PGACTN_R = crate::FieldReader<u8, PGACTN_A>;
524#[doc = "Coefficient (n) selection of the A/D conversion count (N) in AUTOSCAN\n\nValue on reset: 0"]
525#[derive(Clone, Copy, Debug, PartialEq, Eq)]
526#[repr(u8)]
527pub enum PGACTN_A {
528    #[doc = "0: 0"]
529    _000 = 0,
530    #[doc = "1: 1"]
531    _001 = 1,
532    #[doc = "2: 2"]
533    _010 = 2,
534    #[doc = "3: 3"]
535    _011 = 3,
536    #[doc = "4: 4"]
537    _100 = 4,
538    #[doc = "5: 5"]
539    _101 = 5,
540    #[doc = "6: 6"]
541    _110 = 6,
542    #[doc = "7: 7"]
543    _111 = 7,
544}
545impl From<PGACTN_A> for u8 {
546    #[inline(always)]
547    fn from(variant: PGACTN_A) -> Self {
548        variant as _
549    }
550}
551impl PGACTN_R {
552    #[doc = "Get enumerated values variant"]
553    #[inline(always)]
554    pub fn variant(&self) -> PGACTN_A {
555        match self.bits {
556            0 => PGACTN_A::_000,
557            1 => PGACTN_A::_001,
558            2 => PGACTN_A::_010,
559            3 => PGACTN_A::_011,
560            4 => PGACTN_A::_100,
561            5 => PGACTN_A::_101,
562            6 => PGACTN_A::_110,
563            7 => PGACTN_A::_111,
564            _ => unreachable!(),
565        }
566    }
567    #[doc = "Checks if the value of the field is `_000`"]
568    #[inline(always)]
569    pub fn is_000(&self) -> bool {
570        *self == PGACTN_A::_000
571    }
572    #[doc = "Checks if the value of the field is `_001`"]
573    #[inline(always)]
574    pub fn is_001(&self) -> bool {
575        *self == PGACTN_A::_001
576    }
577    #[doc = "Checks if the value of the field is `_010`"]
578    #[inline(always)]
579    pub fn is_010(&self) -> bool {
580        *self == PGACTN_A::_010
581    }
582    #[doc = "Checks if the value of the field is `_011`"]
583    #[inline(always)]
584    pub fn is_011(&self) -> bool {
585        *self == PGACTN_A::_011
586    }
587    #[doc = "Checks if the value of the field is `_100`"]
588    #[inline(always)]
589    pub fn is_100(&self) -> bool {
590        *self == PGACTN_A::_100
591    }
592    #[doc = "Checks if the value of the field is `_101`"]
593    #[inline(always)]
594    pub fn is_101(&self) -> bool {
595        *self == PGACTN_A::_101
596    }
597    #[doc = "Checks if the value of the field is `_110`"]
598    #[inline(always)]
599    pub fn is_110(&self) -> bool {
600        *self == PGACTN_A::_110
601    }
602    #[doc = "Checks if the value of the field is `_111`"]
603    #[inline(always)]
604    pub fn is_111(&self) -> bool {
605        *self == PGACTN_A::_111
606    }
607}
608#[doc = "Field `PGACTN` writer - Coefficient (n) selection of the A/D conversion count (N) in AUTOSCAN"]
609pub type PGACTN_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, PGAC_SPEC, u8, PGACTN_A, 3, O>;
610impl<'a, const O: u8> PGACTN_W<'a, O> {
611    #[doc = "0"]
612    #[inline(always)]
613    pub fn _000(self) -> &'a mut W {
614        self.variant(PGACTN_A::_000)
615    }
616    #[doc = "1"]
617    #[inline(always)]
618    pub fn _001(self) -> &'a mut W {
619        self.variant(PGACTN_A::_001)
620    }
621    #[doc = "2"]
622    #[inline(always)]
623    pub fn _010(self) -> &'a mut W {
624        self.variant(PGACTN_A::_010)
625    }
626    #[doc = "3"]
627    #[inline(always)]
628    pub fn _011(self) -> &'a mut W {
629        self.variant(PGACTN_A::_011)
630    }
631    #[doc = "4"]
632    #[inline(always)]
633    pub fn _100(self) -> &'a mut W {
634        self.variant(PGACTN_A::_100)
635    }
636    #[doc = "5"]
637    #[inline(always)]
638    pub fn _101(self) -> &'a mut W {
639        self.variant(PGACTN_A::_101)
640    }
641    #[doc = "6"]
642    #[inline(always)]
643    pub fn _110(self) -> &'a mut W {
644        self.variant(PGACTN_A::_110)
645    }
646    #[doc = "7"]
647    #[inline(always)]
648    pub fn _111(self) -> &'a mut W {
649        self.variant(PGACTN_A::_111)
650    }
651}
652#[doc = "Field `PGAAVN` reader - Selection of the number of data to be averaged"]
653pub type PGAAVN_R = crate::FieldReader<u8, PGAAVN_A>;
654#[doc = "Selection of the number of data to be averaged\n\nValue on reset: 0"]
655#[derive(Clone, Copy, Debug, PartialEq, Eq)]
656#[repr(u8)]
657pub enum PGAAVN_A {
658    #[doc = "0: 8"]
659    _00 = 0,
660    #[doc = "1: 16"]
661    _01 = 1,
662    #[doc = "2: 32"]
663    _10 = 2,
664    #[doc = "3: 64"]
665    _11 = 3,
666}
667impl From<PGAAVN_A> for u8 {
668    #[inline(always)]
669    fn from(variant: PGAAVN_A) -> Self {
670        variant as _
671    }
672}
673impl PGAAVN_R {
674    #[doc = "Get enumerated values variant"]
675    #[inline(always)]
676    pub fn variant(&self) -> PGAAVN_A {
677        match self.bits {
678            0 => PGAAVN_A::_00,
679            1 => PGAAVN_A::_01,
680            2 => PGAAVN_A::_10,
681            3 => PGAAVN_A::_11,
682            _ => unreachable!(),
683        }
684    }
685    #[doc = "Checks if the value of the field is `_00`"]
686    #[inline(always)]
687    pub fn is_00(&self) -> bool {
688        *self == PGAAVN_A::_00
689    }
690    #[doc = "Checks if the value of the field is `_01`"]
691    #[inline(always)]
692    pub fn is_01(&self) -> bool {
693        *self == PGAAVN_A::_01
694    }
695    #[doc = "Checks if the value of the field is `_10`"]
696    #[inline(always)]
697    pub fn is_10(&self) -> bool {
698        *self == PGAAVN_A::_10
699    }
700    #[doc = "Checks if the value of the field is `_11`"]
701    #[inline(always)]
702    pub fn is_11(&self) -> bool {
703        *self == PGAAVN_A::_11
704    }
705}
706#[doc = "Field `PGAAVN` writer - Selection of the number of data to be averaged"]
707pub type PGAAVN_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, PGAC_SPEC, u8, PGAAVN_A, 2, O>;
708impl<'a, const O: u8> PGAAVN_W<'a, O> {
709    #[doc = "8"]
710    #[inline(always)]
711    pub fn _00(self) -> &'a mut W {
712        self.variant(PGAAVN_A::_00)
713    }
714    #[doc = "16"]
715    #[inline(always)]
716    pub fn _01(self) -> &'a mut W {
717        self.variant(PGAAVN_A::_01)
718    }
719    #[doc = "32"]
720    #[inline(always)]
721    pub fn _10(self) -> &'a mut W {
722        self.variant(PGAAVN_A::_10)
723    }
724    #[doc = "64"]
725    #[inline(always)]
726    pub fn _11(self) -> &'a mut W {
727        self.variant(PGAAVN_A::_11)
728    }
729}
730#[doc = "Field `PGAAVE` reader - Selection of averaging processing"]
731pub type PGAAVE_R = crate::FieldReader<u8, PGAAVE_A>;
732#[doc = "Selection of averaging processing\n\nValue on reset: 0"]
733#[derive(Clone, Copy, Debug, PartialEq, Eq)]
734#[repr(u8)]
735pub enum PGAAVE_A {
736    #[doc = "0: Do not average the A/D conversion results"]
737    _00 = 0,
738    #[doc = "1: Do not average the A/D conversion results"]
739    _01 = 1,
740    #[doc = "2: Average the A/D conversion results and generates SDADC_ADI each time an A/D conversion occurs"]
741    _10 = 2,
742    #[doc = "3: Perform averaging, and generate SDADC_ADI at each time of average value output (A/D conversion is performed N times)."]
743    _11 = 3,
744}
745impl From<PGAAVE_A> for u8 {
746    #[inline(always)]
747    fn from(variant: PGAAVE_A) -> Self {
748        variant as _
749    }
750}
751impl PGAAVE_R {
752    #[doc = "Get enumerated values variant"]
753    #[inline(always)]
754    pub fn variant(&self) -> PGAAVE_A {
755        match self.bits {
756            0 => PGAAVE_A::_00,
757            1 => PGAAVE_A::_01,
758            2 => PGAAVE_A::_10,
759            3 => PGAAVE_A::_11,
760            _ => unreachable!(),
761        }
762    }
763    #[doc = "Checks if the value of the field is `_00`"]
764    #[inline(always)]
765    pub fn is_00(&self) -> bool {
766        *self == PGAAVE_A::_00
767    }
768    #[doc = "Checks if the value of the field is `_01`"]
769    #[inline(always)]
770    pub fn is_01(&self) -> bool {
771        *self == PGAAVE_A::_01
772    }
773    #[doc = "Checks if the value of the field is `_10`"]
774    #[inline(always)]
775    pub fn is_10(&self) -> bool {
776        *self == PGAAVE_A::_10
777    }
778    #[doc = "Checks if the value of the field is `_11`"]
779    #[inline(always)]
780    pub fn is_11(&self) -> bool {
781        *self == PGAAVE_A::_11
782    }
783}
784#[doc = "Field `PGAAVE` writer - Selection of averaging processing"]
785pub type PGAAVE_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, PGAC_SPEC, u8, PGAAVE_A, 2, O>;
786impl<'a, const O: u8> PGAAVE_W<'a, O> {
787    #[doc = "Do not average the A/D conversion results"]
788    #[inline(always)]
789    pub fn _00(self) -> &'a mut W {
790        self.variant(PGAAVE_A::_00)
791    }
792    #[doc = "Do not average the A/D conversion results"]
793    #[inline(always)]
794    pub fn _01(self) -> &'a mut W {
795        self.variant(PGAAVE_A::_01)
796    }
797    #[doc = "Average the A/D conversion results and generates SDADC_ADI each time an A/D conversion occurs"]
798    #[inline(always)]
799    pub fn _10(self) -> &'a mut W {
800        self.variant(PGAAVE_A::_10)
801    }
802    #[doc = "Perform averaging, and generate SDADC_ADI at each time of average value output (A/D conversion is performed N times)."]
803    #[inline(always)]
804    pub fn _11(self) -> &'a mut W {
805        self.variant(PGAAVE_A::_11)
806    }
807}
808#[doc = "Field `PGAREV` reader - Single-End Input A/D Converted Data Inversion Select"]
809pub type PGAREV_R = crate::BitReader<PGAREV_A>;
810#[doc = "Single-End Input A/D Converted Data Inversion Select\n\nValue on reset: 0"]
811#[derive(Clone, Copy, Debug, PartialEq, Eq)]
812pub enum PGAREV_A {
813    #[doc = "0: Do not invert the conversion result data"]
814    _0 = 0,
815    #[doc = "1: Invert the conversion result data"]
816    _1 = 1,
817}
818impl From<PGAREV_A> for bool {
819    #[inline(always)]
820    fn from(variant: PGAREV_A) -> Self {
821        variant as u8 != 0
822    }
823}
824impl PGAREV_R {
825    #[doc = "Get enumerated values variant"]
826    #[inline(always)]
827    pub fn variant(&self) -> PGAREV_A {
828        match self.bits {
829            false => PGAREV_A::_0,
830            true => PGAREV_A::_1,
831        }
832    }
833    #[doc = "Checks if the value of the field is `_0`"]
834    #[inline(always)]
835    pub fn is_0(&self) -> bool {
836        *self == PGAREV_A::_0
837    }
838    #[doc = "Checks if the value of the field is `_1`"]
839    #[inline(always)]
840    pub fn is_1(&self) -> bool {
841        *self == PGAREV_A::_1
842    }
843}
844#[doc = "Field `PGAREV` writer - Single-End Input A/D Converted Data Inversion Select"]
845pub type PGAREV_W<'a, const O: u8> = crate::BitWriter<'a, u32, PGAC_SPEC, PGAREV_A, O>;
846impl<'a, const O: u8> PGAREV_W<'a, O> {
847    #[doc = "Do not invert the conversion result data"]
848    #[inline(always)]
849    pub fn _0(self) -> &'a mut W {
850        self.variant(PGAREV_A::_0)
851    }
852    #[doc = "Invert the conversion result data"]
853    #[inline(always)]
854    pub fn _1(self) -> &'a mut W {
855        self.variant(PGAREV_A::_1)
856    }
857}
858#[doc = "Field `PGACVE` reader - Calibration enable"]
859pub type PGACVE_R = crate::BitReader<PGACVE_A>;
860#[doc = "Calibration enable\n\nValue on reset: 0"]
861#[derive(Clone, Copy, Debug, PartialEq, Eq)]
862pub enum PGACVE_A {
863    #[doc = "0: Do not calculate the calibration correction factor"]
864    _0 = 0,
865    #[doc = "1: Calculate the calibration correction factor"]
866    _1 = 1,
867}
868impl From<PGACVE_A> for bool {
869    #[inline(always)]
870    fn from(variant: PGACVE_A) -> Self {
871        variant as u8 != 0
872    }
873}
874impl PGACVE_R {
875    #[doc = "Get enumerated values variant"]
876    #[inline(always)]
877    pub fn variant(&self) -> PGACVE_A {
878        match self.bits {
879            false => PGACVE_A::_0,
880            true => PGACVE_A::_1,
881        }
882    }
883    #[doc = "Checks if the value of the field is `_0`"]
884    #[inline(always)]
885    pub fn is_0(&self) -> bool {
886        *self == PGACVE_A::_0
887    }
888    #[doc = "Checks if the value of the field is `_1`"]
889    #[inline(always)]
890    pub fn is_1(&self) -> bool {
891        *self == PGACVE_A::_1
892    }
893}
894#[doc = "Field `PGACVE` writer - Calibration enable"]
895pub type PGACVE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PGAC_SPEC, PGACVE_A, O>;
896impl<'a, const O: u8> PGACVE_W<'a, O> {
897    #[doc = "Do not calculate the calibration correction factor"]
898    #[inline(always)]
899    pub fn _0(self) -> &'a mut W {
900        self.variant(PGACVE_A::_0)
901    }
902    #[doc = "Calculate the calibration correction factor"]
903    #[inline(always)]
904    pub fn _1(self) -> &'a mut W {
905        self.variant(PGACVE_A::_1)
906    }
907}
908#[doc = "Field `PGAASN` reader - Selection of the mode for specifying the number of A/D conversions in ADSCAN"]
909pub type PGAASN_R = crate::BitReader<PGAASN_A>;
910#[doc = "Selection of the mode for specifying the number of A/D conversions in ADSCAN\n\nValue on reset: 0"]
911#[derive(Clone, Copy, Debug, PartialEq, Eq)]
912pub enum PGAASN_A {
913    #[doc = "0: Specify 1 to 8,032 times by using the value set in the PGACTN\\[2:0\\]
914and PGACTM\\[4:0\\]
915bits"]
916    _0 = 0,
917    #[doc = "1: Specify 1 to 255 times linearly by using the value set in the PGACTN\\[2:0\\]
918and PGACTM\\[4:0\\]
919bits"]
920    _1 = 1,
921}
922impl From<PGAASN_A> for bool {
923    #[inline(always)]
924    fn from(variant: PGAASN_A) -> Self {
925        variant as u8 != 0
926    }
927}
928impl PGAASN_R {
929    #[doc = "Get enumerated values variant"]
930    #[inline(always)]
931    pub fn variant(&self) -> PGAASN_A {
932        match self.bits {
933            false => PGAASN_A::_0,
934            true => PGAASN_A::_1,
935        }
936    }
937    #[doc = "Checks if the value of the field is `_0`"]
938    #[inline(always)]
939    pub fn is_0(&self) -> bool {
940        *self == PGAASN_A::_0
941    }
942    #[doc = "Checks if the value of the field is `_1`"]
943    #[inline(always)]
944    pub fn is_1(&self) -> bool {
945        *self == PGAASN_A::_1
946    }
947}
948#[doc = "Field `PGAASN` writer - Selection of the mode for specifying the number of A/D conversions in ADSCAN"]
949pub type PGAASN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PGAC_SPEC, PGAASN_A, O>;
950impl<'a, const O: u8> PGAASN_W<'a, O> {
951    #[doc = "Specify 1 to 8,032 times by using the value set in the PGACTN\\[2:0\\]
952and PGACTM\\[4:0\\]
953bits"]
954    #[inline(always)]
955    pub fn _0(self) -> &'a mut W {
956        self.variant(PGAASN_A::_0)
957    }
958    #[doc = "Specify 1 to 255 times linearly by using the value set in the PGACTN\\[2:0\\]
959and PGACTM\\[4:0\\]
960bits"]
961    #[inline(always)]
962    pub fn _1(self) -> &'a mut W {
963        self.variant(PGAASN_A::_1)
964    }
965}
966impl R {
967    #[doc = "Bits 0:4 - Gain selection of a programmable gain instrumentation amplifier ( Gset1, Gset2, Gtotal )"]
968    #[inline(always)]
969    pub fn pgagc(&self) -> PGAGC_R {
970        PGAGC_R::new((self.bits & 0x1f) as u8)
971    }
972    #[doc = "Bits 5:7 - Oversampling ratio select"]
973    #[inline(always)]
974    pub fn pgaosr(&self) -> PGAOSR_R {
975        PGAOSR_R::new(((self.bits >> 5) & 7) as u8)
976    }
977    #[doc = "Bits 8:12 - Offset voltage select"]
978    #[inline(always)]
979    pub fn pgaofs(&self) -> PGAOFS_R {
980        PGAOFS_R::new(((self.bits >> 8) & 0x1f) as u8)
981    }
982    #[doc = "Bit 14 - Polarity select"]
983    #[inline(always)]
984    pub fn pgapol(&self) -> PGAPOL_R {
985        PGAPOL_R::new(((self.bits >> 14) & 1) != 0)
986    }
987    #[doc = "Bit 15 - Analog Channel Input Mode Select"]
988    #[inline(always)]
989    pub fn pgasel(&self) -> PGASEL_R {
990        PGASEL_R::new(((self.bits >> 15) & 1) != 0)
991    }
992    #[doc = "Bits 16:20 - Coefficient (m) selection of the A/D conversion count (N) in AUTOSCAN"]
993    #[inline(always)]
994    pub fn pgactm(&self) -> PGACTM_R {
995        PGACTM_R::new(((self.bits >> 16) & 0x1f) as u8)
996    }
997    #[doc = "Bits 21:23 - Coefficient (n) selection of the A/D conversion count (N) in AUTOSCAN"]
998    #[inline(always)]
999    pub fn pgactn(&self) -> PGACTN_R {
1000        PGACTN_R::new(((self.bits >> 21) & 7) as u8)
1001    }
1002    #[doc = "Bits 24:25 - Selection of the number of data to be averaged"]
1003    #[inline(always)]
1004    pub fn pgaavn(&self) -> PGAAVN_R {
1005        PGAAVN_R::new(((self.bits >> 24) & 3) as u8)
1006    }
1007    #[doc = "Bits 26:27 - Selection of averaging processing"]
1008    #[inline(always)]
1009    pub fn pgaave(&self) -> PGAAVE_R {
1010        PGAAVE_R::new(((self.bits >> 26) & 3) as u8)
1011    }
1012    #[doc = "Bit 28 - Single-End Input A/D Converted Data Inversion Select"]
1013    #[inline(always)]
1014    pub fn pgarev(&self) -> PGAREV_R {
1015        PGAREV_R::new(((self.bits >> 28) & 1) != 0)
1016    }
1017    #[doc = "Bit 30 - Calibration enable"]
1018    #[inline(always)]
1019    pub fn pgacve(&self) -> PGACVE_R {
1020        PGACVE_R::new(((self.bits >> 30) & 1) != 0)
1021    }
1022    #[doc = "Bit 31 - Selection of the mode for specifying the number of A/D conversions in ADSCAN"]
1023    #[inline(always)]
1024    pub fn pgaasn(&self) -> PGAASN_R {
1025        PGAASN_R::new(((self.bits >> 31) & 1) != 0)
1026    }
1027}
1028impl W {
1029    #[doc = "Bits 0:4 - Gain selection of a programmable gain instrumentation amplifier ( Gset1, Gset2, Gtotal )"]
1030    #[inline(always)]
1031    #[must_use]
1032    pub fn pgagc(&mut self) -> PGAGC_W<0> {
1033        PGAGC_W::new(self)
1034    }
1035    #[doc = "Bits 5:7 - Oversampling ratio select"]
1036    #[inline(always)]
1037    #[must_use]
1038    pub fn pgaosr(&mut self) -> PGAOSR_W<5> {
1039        PGAOSR_W::new(self)
1040    }
1041    #[doc = "Bits 8:12 - Offset voltage select"]
1042    #[inline(always)]
1043    #[must_use]
1044    pub fn pgaofs(&mut self) -> PGAOFS_W<8> {
1045        PGAOFS_W::new(self)
1046    }
1047    #[doc = "Bit 14 - Polarity select"]
1048    #[inline(always)]
1049    #[must_use]
1050    pub fn pgapol(&mut self) -> PGAPOL_W<14> {
1051        PGAPOL_W::new(self)
1052    }
1053    #[doc = "Bit 15 - Analog Channel Input Mode Select"]
1054    #[inline(always)]
1055    #[must_use]
1056    pub fn pgasel(&mut self) -> PGASEL_W<15> {
1057        PGASEL_W::new(self)
1058    }
1059    #[doc = "Bits 16:20 - Coefficient (m) selection of the A/D conversion count (N) in AUTOSCAN"]
1060    #[inline(always)]
1061    #[must_use]
1062    pub fn pgactm(&mut self) -> PGACTM_W<16> {
1063        PGACTM_W::new(self)
1064    }
1065    #[doc = "Bits 21:23 - Coefficient (n) selection of the A/D conversion count (N) in AUTOSCAN"]
1066    #[inline(always)]
1067    #[must_use]
1068    pub fn pgactn(&mut self) -> PGACTN_W<21> {
1069        PGACTN_W::new(self)
1070    }
1071    #[doc = "Bits 24:25 - Selection of the number of data to be averaged"]
1072    #[inline(always)]
1073    #[must_use]
1074    pub fn pgaavn(&mut self) -> PGAAVN_W<24> {
1075        PGAAVN_W::new(self)
1076    }
1077    #[doc = "Bits 26:27 - Selection of averaging processing"]
1078    #[inline(always)]
1079    #[must_use]
1080    pub fn pgaave(&mut self) -> PGAAVE_W<26> {
1081        PGAAVE_W::new(self)
1082    }
1083    #[doc = "Bit 28 - Single-End Input A/D Converted Data Inversion Select"]
1084    #[inline(always)]
1085    #[must_use]
1086    pub fn pgarev(&mut self) -> PGAREV_W<28> {
1087        PGAREV_W::new(self)
1088    }
1089    #[doc = "Bit 30 - Calibration enable"]
1090    #[inline(always)]
1091    #[must_use]
1092    pub fn pgacve(&mut self) -> PGACVE_W<30> {
1093        PGACVE_W::new(self)
1094    }
1095    #[doc = "Bit 31 - Selection of the mode for specifying the number of A/D conversions in ADSCAN"]
1096    #[inline(always)]
1097    #[must_use]
1098    pub fn pgaasn(&mut self) -> PGAASN_W<31> {
1099        PGAASN_W::new(self)
1100    }
1101    #[doc = "Writes raw bits to the register."]
1102    #[inline(always)]
1103    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1104        self.0.bits(bits);
1105        self
1106    }
1107}
1108#[doc = "Input Multiplexer %s Setting 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 [pgac](index.html) module"]
1109pub struct PGAC_SPEC;
1110impl crate::RegisterSpec for PGAC_SPEC {
1111    type Ux = u32;
1112}
1113#[doc = "`read()` method returns [pgac::R](R) reader structure"]
1114impl crate::Readable for PGAC_SPEC {
1115    type Reader = R;
1116}
1117#[doc = "`write(|w| ..)` method takes [pgac::W](W) writer structure"]
1118impl crate::Writable for PGAC_SPEC {
1119    type Writer = W;
1120    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
1121    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
1122}
1123#[doc = "`reset()` method sets PGAC%s to value 0x0001_0040"]
1124impl crate::Resettable for PGAC_SPEC {
1125    const RESET_VALUE: Self::Ux = 0x0001_0040;
1126}