nrf51_pac/adc/
config.rs

1#[doc = "Register `CONFIG` reader"]
2pub struct R(crate::R<CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CONFIG` writer"]
17pub struct W(crate::W<CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CONFIG_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<CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RES` reader - ADC resolution."]
38pub type RES_R = crate::FieldReader<u8, RES_A>;
39#[doc = "ADC resolution.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum RES_A {
43    #[doc = "0: 8bit ADC resolution."]
44    _8BIT = 0,
45    #[doc = "1: 9bit ADC resolution."]
46    _9BIT = 1,
47    #[doc = "2: 10bit ADC resolution."]
48    _10BIT = 2,
49}
50impl From<RES_A> for u8 {
51    #[inline(always)]
52    fn from(variant: RES_A) -> Self {
53        variant as _
54    }
55}
56impl RES_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<RES_A> {
60        match self.bits {
61            0 => Some(RES_A::_8BIT),
62            1 => Some(RES_A::_9BIT),
63            2 => Some(RES_A::_10BIT),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `_8BIT`"]
68    #[inline(always)]
69    pub fn is_8bit(&self) -> bool {
70        *self == RES_A::_8BIT
71    }
72    #[doc = "Checks if the value of the field is `_9BIT`"]
73    #[inline(always)]
74    pub fn is_9bit(&self) -> bool {
75        *self == RES_A::_9BIT
76    }
77    #[doc = "Checks if the value of the field is `_10BIT`"]
78    #[inline(always)]
79    pub fn is_10bit(&self) -> bool {
80        *self == RES_A::_10BIT
81    }
82}
83#[doc = "Field `RES` writer - ADC resolution."]
84pub type RES_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, RES_A, 2, O>;
85impl<'a, const O: u8> RES_W<'a, O> {
86    #[doc = "8bit ADC resolution."]
87    #[inline(always)]
88    pub fn _8bit(self) -> &'a mut W {
89        self.variant(RES_A::_8BIT)
90    }
91    #[doc = "9bit ADC resolution."]
92    #[inline(always)]
93    pub fn _9bit(self) -> &'a mut W {
94        self.variant(RES_A::_9BIT)
95    }
96    #[doc = "10bit ADC resolution."]
97    #[inline(always)]
98    pub fn _10bit(self) -> &'a mut W {
99        self.variant(RES_A::_10BIT)
100    }
101}
102#[doc = "Field `INPSEL` reader - ADC input selection."]
103pub type INPSEL_R = crate::FieldReader<u8, INPSEL_A>;
104#[doc = "ADC input selection.\n\nValue on reset: 6"]
105#[derive(Clone, Copy, Debug, PartialEq)]
106#[repr(u8)]
107pub enum INPSEL_A {
108    #[doc = "0: Analog input specified by PSEL with no prescaling used as input for the conversion."]
109    ANALOG_INPUT_NO_PRESCALING = 0,
110    #[doc = "1: Analog input specified by PSEL with 2/3 prescaling used as input for the conversion."]
111    ANALOG_INPUT_TWO_THIRDS_PRESCALING = 1,
112    #[doc = "2: Analog input specified by PSEL with 1/3 prescaling used as input for the conversion."]
113    ANALOG_INPUT_ONE_THIRD_PRESCALING = 2,
114    #[doc = "5: Supply voltage with 2/3 prescaling used as input for the conversion."]
115    SUPPLY_TWO_THIRDS_PRESCALING = 5,
116    #[doc = "6: Supply voltage with 1/3 prescaling used as input for the conversion."]
117    SUPPLY_ONE_THIRD_PRESCALING = 6,
118}
119impl From<INPSEL_A> for u8 {
120    #[inline(always)]
121    fn from(variant: INPSEL_A) -> Self {
122        variant as _
123    }
124}
125impl INPSEL_R {
126    #[doc = "Get enumerated values variant"]
127    #[inline(always)]
128    pub fn variant(&self) -> Option<INPSEL_A> {
129        match self.bits {
130            0 => Some(INPSEL_A::ANALOG_INPUT_NO_PRESCALING),
131            1 => Some(INPSEL_A::ANALOG_INPUT_TWO_THIRDS_PRESCALING),
132            2 => Some(INPSEL_A::ANALOG_INPUT_ONE_THIRD_PRESCALING),
133            5 => Some(INPSEL_A::SUPPLY_TWO_THIRDS_PRESCALING),
134            6 => Some(INPSEL_A::SUPPLY_ONE_THIRD_PRESCALING),
135            _ => None,
136        }
137    }
138    #[doc = "Checks if the value of the field is `ANALOG_INPUT_NO_PRESCALING`"]
139    #[inline(always)]
140    pub fn is_analog_input_no_prescaling(&self) -> bool {
141        *self == INPSEL_A::ANALOG_INPUT_NO_PRESCALING
142    }
143    #[doc = "Checks if the value of the field is `ANALOG_INPUT_TWO_THIRDS_PRESCALING`"]
144    #[inline(always)]
145    pub fn is_analog_input_two_thirds_prescaling(&self) -> bool {
146        *self == INPSEL_A::ANALOG_INPUT_TWO_THIRDS_PRESCALING
147    }
148    #[doc = "Checks if the value of the field is `ANALOG_INPUT_ONE_THIRD_PRESCALING`"]
149    #[inline(always)]
150    pub fn is_analog_input_one_third_prescaling(&self) -> bool {
151        *self == INPSEL_A::ANALOG_INPUT_ONE_THIRD_PRESCALING
152    }
153    #[doc = "Checks if the value of the field is `SUPPLY_TWO_THIRDS_PRESCALING`"]
154    #[inline(always)]
155    pub fn is_supply_two_thirds_prescaling(&self) -> bool {
156        *self == INPSEL_A::SUPPLY_TWO_THIRDS_PRESCALING
157    }
158    #[doc = "Checks if the value of the field is `SUPPLY_ONE_THIRD_PRESCALING`"]
159    #[inline(always)]
160    pub fn is_supply_one_third_prescaling(&self) -> bool {
161        *self == INPSEL_A::SUPPLY_ONE_THIRD_PRESCALING
162    }
163}
164#[doc = "Field `INPSEL` writer - ADC input selection."]
165pub type INPSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, INPSEL_A, 3, O>;
166impl<'a, const O: u8> INPSEL_W<'a, O> {
167    #[doc = "Analog input specified by PSEL with no prescaling used as input for the conversion."]
168    #[inline(always)]
169    pub fn analog_input_no_prescaling(self) -> &'a mut W {
170        self.variant(INPSEL_A::ANALOG_INPUT_NO_PRESCALING)
171    }
172    #[doc = "Analog input specified by PSEL with 2/3 prescaling used as input for the conversion."]
173    #[inline(always)]
174    pub fn analog_input_two_thirds_prescaling(self) -> &'a mut W {
175        self.variant(INPSEL_A::ANALOG_INPUT_TWO_THIRDS_PRESCALING)
176    }
177    #[doc = "Analog input specified by PSEL with 1/3 prescaling used as input for the conversion."]
178    #[inline(always)]
179    pub fn analog_input_one_third_prescaling(self) -> &'a mut W {
180        self.variant(INPSEL_A::ANALOG_INPUT_ONE_THIRD_PRESCALING)
181    }
182    #[doc = "Supply voltage with 2/3 prescaling used as input for the conversion."]
183    #[inline(always)]
184    pub fn supply_two_thirds_prescaling(self) -> &'a mut W {
185        self.variant(INPSEL_A::SUPPLY_TWO_THIRDS_PRESCALING)
186    }
187    #[doc = "Supply voltage with 1/3 prescaling used as input for the conversion."]
188    #[inline(always)]
189    pub fn supply_one_third_prescaling(self) -> &'a mut W {
190        self.variant(INPSEL_A::SUPPLY_ONE_THIRD_PRESCALING)
191    }
192}
193#[doc = "Field `REFSEL` reader - ADC reference selection."]
194pub type REFSEL_R = crate::FieldReader<u8, REFSEL_A>;
195#[doc = "ADC reference selection.\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq)]
197#[repr(u8)]
198pub enum REFSEL_A {
199    #[doc = "0: Use internal 1.2V bandgap voltage as reference for conversion."]
200    VBG = 0,
201    #[doc = "1: Use external source configured by EXTREFSEL as reference for conversion."]
202    EXTERNAL = 1,
203    #[doc = "2: Use supply voltage with 1/2 prescaling as reference for conversion. Only usable when supply voltage is between 1.7V and 2.6V."]
204    SUPPLY_ONE_HALF_PRESCALING = 2,
205    #[doc = "3: Use supply voltage with 1/3 prescaling as reference for conversion. Only usable when supply voltage is between 2.5V and 3.6V."]
206    SUPPLY_ONE_THIRD_PRESCALING = 3,
207}
208impl From<REFSEL_A> for u8 {
209    #[inline(always)]
210    fn from(variant: REFSEL_A) -> Self {
211        variant as _
212    }
213}
214impl REFSEL_R {
215    #[doc = "Get enumerated values variant"]
216    #[inline(always)]
217    pub fn variant(&self) -> REFSEL_A {
218        match self.bits {
219            0 => REFSEL_A::VBG,
220            1 => REFSEL_A::EXTERNAL,
221            2 => REFSEL_A::SUPPLY_ONE_HALF_PRESCALING,
222            3 => REFSEL_A::SUPPLY_ONE_THIRD_PRESCALING,
223            _ => unreachable!(),
224        }
225    }
226    #[doc = "Checks if the value of the field is `VBG`"]
227    #[inline(always)]
228    pub fn is_vbg(&self) -> bool {
229        *self == REFSEL_A::VBG
230    }
231    #[doc = "Checks if the value of the field is `EXTERNAL`"]
232    #[inline(always)]
233    pub fn is_external(&self) -> bool {
234        *self == REFSEL_A::EXTERNAL
235    }
236    #[doc = "Checks if the value of the field is `SUPPLY_ONE_HALF_PRESCALING`"]
237    #[inline(always)]
238    pub fn is_supply_one_half_prescaling(&self) -> bool {
239        *self == REFSEL_A::SUPPLY_ONE_HALF_PRESCALING
240    }
241    #[doc = "Checks if the value of the field is `SUPPLY_ONE_THIRD_PRESCALING`"]
242    #[inline(always)]
243    pub fn is_supply_one_third_prescaling(&self) -> bool {
244        *self == REFSEL_A::SUPPLY_ONE_THIRD_PRESCALING
245    }
246}
247#[doc = "Field `REFSEL` writer - ADC reference selection."]
248pub type REFSEL_W<'a, const O: u8> =
249    crate::FieldWriterSafe<'a, u32, CONFIG_SPEC, u8, REFSEL_A, 2, O>;
250impl<'a, const O: u8> REFSEL_W<'a, O> {
251    #[doc = "Use internal 1.2V bandgap voltage as reference for conversion."]
252    #[inline(always)]
253    pub fn vbg(self) -> &'a mut W {
254        self.variant(REFSEL_A::VBG)
255    }
256    #[doc = "Use external source configured by EXTREFSEL as reference for conversion."]
257    #[inline(always)]
258    pub fn external(self) -> &'a mut W {
259        self.variant(REFSEL_A::EXTERNAL)
260    }
261    #[doc = "Use supply voltage with 1/2 prescaling as reference for conversion. Only usable when supply voltage is between 1.7V and 2.6V."]
262    #[inline(always)]
263    pub fn supply_one_half_prescaling(self) -> &'a mut W {
264        self.variant(REFSEL_A::SUPPLY_ONE_HALF_PRESCALING)
265    }
266    #[doc = "Use supply voltage with 1/3 prescaling as reference for conversion. Only usable when supply voltage is between 2.5V and 3.6V."]
267    #[inline(always)]
268    pub fn supply_one_third_prescaling(self) -> &'a mut W {
269        self.variant(REFSEL_A::SUPPLY_ONE_THIRD_PRESCALING)
270    }
271}
272#[doc = "Field `PSEL` reader - ADC analog pin selection."]
273pub type PSEL_R = crate::FieldReader<u8, PSEL_A>;
274#[doc = "ADC analog pin selection.\n\nValue on reset: 0"]
275#[derive(Clone, Copy, Debug, PartialEq)]
276#[repr(u8)]
277pub enum PSEL_A {
278    #[doc = "0: Analog input pins disabled."]
279    DISABLED = 0,
280    #[doc = "1: Use analog input 0 as analog input."]
281    ANALOG_INPUT0 = 1,
282    #[doc = "2: Use analog input 1 as analog input."]
283    ANALOG_INPUT1 = 2,
284    #[doc = "4: Use analog input 2 as analog input."]
285    ANALOG_INPUT2 = 4,
286    #[doc = "8: Use analog input 3 as analog input."]
287    ANALOG_INPUT3 = 8,
288    #[doc = "16: Use analog input 4 as analog input."]
289    ANALOG_INPUT4 = 16,
290    #[doc = "32: Use analog input 5 as analog input."]
291    ANALOG_INPUT5 = 32,
292    #[doc = "64: Use analog input 6 as analog input."]
293    ANALOG_INPUT6 = 64,
294    #[doc = "128: Use analog input 7 as analog input."]
295    ANALOG_INPUT7 = 128,
296}
297impl From<PSEL_A> for u8 {
298    #[inline(always)]
299    fn from(variant: PSEL_A) -> Self {
300        variant as _
301    }
302}
303impl PSEL_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> Option<PSEL_A> {
307        match self.bits {
308            0 => Some(PSEL_A::DISABLED),
309            1 => Some(PSEL_A::ANALOG_INPUT0),
310            2 => Some(PSEL_A::ANALOG_INPUT1),
311            4 => Some(PSEL_A::ANALOG_INPUT2),
312            8 => Some(PSEL_A::ANALOG_INPUT3),
313            16 => Some(PSEL_A::ANALOG_INPUT4),
314            32 => Some(PSEL_A::ANALOG_INPUT5),
315            64 => Some(PSEL_A::ANALOG_INPUT6),
316            128 => Some(PSEL_A::ANALOG_INPUT7),
317            _ => None,
318        }
319    }
320    #[doc = "Checks if the value of the field is `DISABLED`"]
321    #[inline(always)]
322    pub fn is_disabled(&self) -> bool {
323        *self == PSEL_A::DISABLED
324    }
325    #[doc = "Checks if the value of the field is `ANALOG_INPUT0`"]
326    #[inline(always)]
327    pub fn is_analog_input0(&self) -> bool {
328        *self == PSEL_A::ANALOG_INPUT0
329    }
330    #[doc = "Checks if the value of the field is `ANALOG_INPUT1`"]
331    #[inline(always)]
332    pub fn is_analog_input1(&self) -> bool {
333        *self == PSEL_A::ANALOG_INPUT1
334    }
335    #[doc = "Checks if the value of the field is `ANALOG_INPUT2`"]
336    #[inline(always)]
337    pub fn is_analog_input2(&self) -> bool {
338        *self == PSEL_A::ANALOG_INPUT2
339    }
340    #[doc = "Checks if the value of the field is `ANALOG_INPUT3`"]
341    #[inline(always)]
342    pub fn is_analog_input3(&self) -> bool {
343        *self == PSEL_A::ANALOG_INPUT3
344    }
345    #[doc = "Checks if the value of the field is `ANALOG_INPUT4`"]
346    #[inline(always)]
347    pub fn is_analog_input4(&self) -> bool {
348        *self == PSEL_A::ANALOG_INPUT4
349    }
350    #[doc = "Checks if the value of the field is `ANALOG_INPUT5`"]
351    #[inline(always)]
352    pub fn is_analog_input5(&self) -> bool {
353        *self == PSEL_A::ANALOG_INPUT5
354    }
355    #[doc = "Checks if the value of the field is `ANALOG_INPUT6`"]
356    #[inline(always)]
357    pub fn is_analog_input6(&self) -> bool {
358        *self == PSEL_A::ANALOG_INPUT6
359    }
360    #[doc = "Checks if the value of the field is `ANALOG_INPUT7`"]
361    #[inline(always)]
362    pub fn is_analog_input7(&self) -> bool {
363        *self == PSEL_A::ANALOG_INPUT7
364    }
365}
366#[doc = "Field `PSEL` writer - ADC analog pin selection."]
367pub type PSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, PSEL_A, 8, O>;
368impl<'a, const O: u8> PSEL_W<'a, O> {
369    #[doc = "Analog input pins disabled."]
370    #[inline(always)]
371    pub fn disabled(self) -> &'a mut W {
372        self.variant(PSEL_A::DISABLED)
373    }
374    #[doc = "Use analog input 0 as analog input."]
375    #[inline(always)]
376    pub fn analog_input0(self) -> &'a mut W {
377        self.variant(PSEL_A::ANALOG_INPUT0)
378    }
379    #[doc = "Use analog input 1 as analog input."]
380    #[inline(always)]
381    pub fn analog_input1(self) -> &'a mut W {
382        self.variant(PSEL_A::ANALOG_INPUT1)
383    }
384    #[doc = "Use analog input 2 as analog input."]
385    #[inline(always)]
386    pub fn analog_input2(self) -> &'a mut W {
387        self.variant(PSEL_A::ANALOG_INPUT2)
388    }
389    #[doc = "Use analog input 3 as analog input."]
390    #[inline(always)]
391    pub fn analog_input3(self) -> &'a mut W {
392        self.variant(PSEL_A::ANALOG_INPUT3)
393    }
394    #[doc = "Use analog input 4 as analog input."]
395    #[inline(always)]
396    pub fn analog_input4(self) -> &'a mut W {
397        self.variant(PSEL_A::ANALOG_INPUT4)
398    }
399    #[doc = "Use analog input 5 as analog input."]
400    #[inline(always)]
401    pub fn analog_input5(self) -> &'a mut W {
402        self.variant(PSEL_A::ANALOG_INPUT5)
403    }
404    #[doc = "Use analog input 6 as analog input."]
405    #[inline(always)]
406    pub fn analog_input6(self) -> &'a mut W {
407        self.variant(PSEL_A::ANALOG_INPUT6)
408    }
409    #[doc = "Use analog input 7 as analog input."]
410    #[inline(always)]
411    pub fn analog_input7(self) -> &'a mut W {
412        self.variant(PSEL_A::ANALOG_INPUT7)
413    }
414}
415#[doc = "Field `EXTREFSEL` reader - ADC external reference pin selection."]
416pub type EXTREFSEL_R = crate::FieldReader<u8, EXTREFSEL_A>;
417#[doc = "ADC external reference pin selection.\n\nValue on reset: 0"]
418#[derive(Clone, Copy, Debug, PartialEq)]
419#[repr(u8)]
420pub enum EXTREFSEL_A {
421    #[doc = "0: Analog external reference inputs disabled."]
422    NONE = 0,
423    #[doc = "1: Use analog reference 0 as reference."]
424    ANALOG_REFERENCE0 = 1,
425    #[doc = "2: Use analog reference 1 as reference."]
426    ANALOG_REFERENCE1 = 2,
427}
428impl From<EXTREFSEL_A> for u8 {
429    #[inline(always)]
430    fn from(variant: EXTREFSEL_A) -> Self {
431        variant as _
432    }
433}
434impl EXTREFSEL_R {
435    #[doc = "Get enumerated values variant"]
436    #[inline(always)]
437    pub fn variant(&self) -> Option<EXTREFSEL_A> {
438        match self.bits {
439            0 => Some(EXTREFSEL_A::NONE),
440            1 => Some(EXTREFSEL_A::ANALOG_REFERENCE0),
441            2 => Some(EXTREFSEL_A::ANALOG_REFERENCE1),
442            _ => None,
443        }
444    }
445    #[doc = "Checks if the value of the field is `NONE`"]
446    #[inline(always)]
447    pub fn is_none(&self) -> bool {
448        *self == EXTREFSEL_A::NONE
449    }
450    #[doc = "Checks if the value of the field is `ANALOG_REFERENCE0`"]
451    #[inline(always)]
452    pub fn is_analog_reference0(&self) -> bool {
453        *self == EXTREFSEL_A::ANALOG_REFERENCE0
454    }
455    #[doc = "Checks if the value of the field is `ANALOG_REFERENCE1`"]
456    #[inline(always)]
457    pub fn is_analog_reference1(&self) -> bool {
458        *self == EXTREFSEL_A::ANALOG_REFERENCE1
459    }
460}
461#[doc = "Field `EXTREFSEL` writer - ADC external reference pin selection."]
462pub type EXTREFSEL_W<'a, const O: u8> =
463    crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, EXTREFSEL_A, 2, O>;
464impl<'a, const O: u8> EXTREFSEL_W<'a, O> {
465    #[doc = "Analog external reference inputs disabled."]
466    #[inline(always)]
467    pub fn none(self) -> &'a mut W {
468        self.variant(EXTREFSEL_A::NONE)
469    }
470    #[doc = "Use analog reference 0 as reference."]
471    #[inline(always)]
472    pub fn analog_reference0(self) -> &'a mut W {
473        self.variant(EXTREFSEL_A::ANALOG_REFERENCE0)
474    }
475    #[doc = "Use analog reference 1 as reference."]
476    #[inline(always)]
477    pub fn analog_reference1(self) -> &'a mut W {
478        self.variant(EXTREFSEL_A::ANALOG_REFERENCE1)
479    }
480}
481impl R {
482    #[doc = "Bits 0:1 - ADC resolution."]
483    #[inline(always)]
484    pub fn res(&self) -> RES_R {
485        RES_R::new((self.bits & 3) as u8)
486    }
487    #[doc = "Bits 2:4 - ADC input selection."]
488    #[inline(always)]
489    pub fn inpsel(&self) -> INPSEL_R {
490        INPSEL_R::new(((self.bits >> 2) & 7) as u8)
491    }
492    #[doc = "Bits 5:6 - ADC reference selection."]
493    #[inline(always)]
494    pub fn refsel(&self) -> REFSEL_R {
495        REFSEL_R::new(((self.bits >> 5) & 3) as u8)
496    }
497    #[doc = "Bits 8:15 - ADC analog pin selection."]
498    #[inline(always)]
499    pub fn psel(&self) -> PSEL_R {
500        PSEL_R::new(((self.bits >> 8) & 0xff) as u8)
501    }
502    #[doc = "Bits 16:17 - ADC external reference pin selection."]
503    #[inline(always)]
504    pub fn extrefsel(&self) -> EXTREFSEL_R {
505        EXTREFSEL_R::new(((self.bits >> 16) & 3) as u8)
506    }
507}
508impl W {
509    #[doc = "Bits 0:1 - ADC resolution."]
510    #[inline(always)]
511    pub fn res(&mut self) -> RES_W<0> {
512        RES_W::new(self)
513    }
514    #[doc = "Bits 2:4 - ADC input selection."]
515    #[inline(always)]
516    pub fn inpsel(&mut self) -> INPSEL_W<2> {
517        INPSEL_W::new(self)
518    }
519    #[doc = "Bits 5:6 - ADC reference selection."]
520    #[inline(always)]
521    pub fn refsel(&mut self) -> REFSEL_W<5> {
522        REFSEL_W::new(self)
523    }
524    #[doc = "Bits 8:15 - ADC analog pin selection."]
525    #[inline(always)]
526    pub fn psel(&mut self) -> PSEL_W<8> {
527        PSEL_W::new(self)
528    }
529    #[doc = "Bits 16:17 - ADC external reference pin selection."]
530    #[inline(always)]
531    pub fn extrefsel(&mut self) -> EXTREFSEL_W<16> {
532        EXTREFSEL_W::new(self)
533    }
534    #[doc = "Writes raw bits to the register."]
535    #[inline(always)]
536    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
537        self.0.bits(bits);
538        self
539    }
540}
541#[doc = "ADC configuration 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 [config](index.html) module"]
542pub struct CONFIG_SPEC;
543impl crate::RegisterSpec for CONFIG_SPEC {
544    type Ux = u32;
545}
546#[doc = "`read()` method returns [config::R](R) reader structure"]
547impl crate::Readable for CONFIG_SPEC {
548    type Reader = R;
549}
550#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
551impl crate::Writable for CONFIG_SPEC {
552    type Writer = W;
553}
554#[doc = "`reset()` method sets CONFIG to value 0x18"]
555impl crate::Resettable for CONFIG_SPEC {
556    #[inline(always)]
557    fn reset_value() -> Self::Ux {
558        0x18
559    }
560}