efm32pg23-pac 0.1.2

Peripheral access API for EFM32PG23 MCU (generated using svd2rust)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
#[doc = "Register `CFG0` reader"]
pub struct R(crate::R<CFG0_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CFG0_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<CFG0_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<CFG0_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CFG0` writer"]
pub struct W(crate::W<CFG0_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CFG0_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<CFG0_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<CFG0_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `ADCMODE` reader - ADC Mode"]
pub type ADCMODE_R = crate::FieldReader<u8, ADCMODE_A>;
#[doc = "ADC Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ADCMODE_A {
    #[doc = "0: High speed mode with a maximum CLK_ADC of 10 MHz."]
    NORMAL = 0,
}
impl From<ADCMODE_A> for u8 {
    #[inline(always)]
    fn from(variant: ADCMODE_A) -> Self {
        variant as _
    }
}
impl ADCMODE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<ADCMODE_A> {
        match self.bits {
            0 => Some(ADCMODE_A::NORMAL),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `NORMAL`"]
    #[inline(always)]
    pub fn is_normal(&self) -> bool {
        *self == ADCMODE_A::NORMAL
    }
}
#[doc = "Field `ADCMODE` writer - ADC Mode"]
pub type ADCMODE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, ADCMODE_A, 2, O>;
impl<'a, const O: u8> ADCMODE_W<'a, O> {
    #[doc = "High speed mode with a maximum CLK_ADC of 10 MHz."]
    #[inline(always)]
    pub fn normal(self) -> &'a mut W {
        self.variant(ADCMODE_A::NORMAL)
    }
}
#[doc = "Field `OSRHS` reader - High Speed OSR"]
pub type OSRHS_R = crate::FieldReader<u8, OSRHS_A>;
#[doc = "High Speed OSR\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum OSRHS_A {
    #[doc = "0: High speed over sampling of 2x."]
    HISPD2 = 0,
    #[doc = "1: High speed over sampling of 4x."]
    HISPD4 = 1,
    #[doc = "2: High speed over sampling of 8x."]
    HISPD8 = 2,
    #[doc = "3: High speed over sampling of 16x."]
    HISPD16 = 3,
    #[doc = "4: HIgh speed over sampling of 32x."]
    HISPD32 = 4,
    #[doc = "5: High speed over sampling of 64x."]
    HISPD64 = 5,
}
impl From<OSRHS_A> for u8 {
    #[inline(always)]
    fn from(variant: OSRHS_A) -> Self {
        variant as _
    }
}
impl OSRHS_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<OSRHS_A> {
        match self.bits {
            0 => Some(OSRHS_A::HISPD2),
            1 => Some(OSRHS_A::HISPD4),
            2 => Some(OSRHS_A::HISPD8),
            3 => Some(OSRHS_A::HISPD16),
            4 => Some(OSRHS_A::HISPD32),
            5 => Some(OSRHS_A::HISPD64),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `HISPD2`"]
    #[inline(always)]
    pub fn is_hispd2(&self) -> bool {
        *self == OSRHS_A::HISPD2
    }
    #[doc = "Checks if the value of the field is `HISPD4`"]
    #[inline(always)]
    pub fn is_hispd4(&self) -> bool {
        *self == OSRHS_A::HISPD4
    }
    #[doc = "Checks if the value of the field is `HISPD8`"]
    #[inline(always)]
    pub fn is_hispd8(&self) -> bool {
        *self == OSRHS_A::HISPD8
    }
    #[doc = "Checks if the value of the field is `HISPD16`"]
    #[inline(always)]
    pub fn is_hispd16(&self) -> bool {
        *self == OSRHS_A::HISPD16
    }
    #[doc = "Checks if the value of the field is `HISPD32`"]
    #[inline(always)]
    pub fn is_hispd32(&self) -> bool {
        *self == OSRHS_A::HISPD32
    }
    #[doc = "Checks if the value of the field is `HISPD64`"]
    #[inline(always)]
    pub fn is_hispd64(&self) -> bool {
        *self == OSRHS_A::HISPD64
    }
}
#[doc = "Field `OSRHS` writer - High Speed OSR"]
pub type OSRHS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, OSRHS_A, 3, O>;
impl<'a, const O: u8> OSRHS_W<'a, O> {
    #[doc = "High speed over sampling of 2x."]
    #[inline(always)]
    pub fn hispd2(self) -> &'a mut W {
        self.variant(OSRHS_A::HISPD2)
    }
    #[doc = "High speed over sampling of 4x."]
    #[inline(always)]
    pub fn hispd4(self) -> &'a mut W {
        self.variant(OSRHS_A::HISPD4)
    }
    #[doc = "High speed over sampling of 8x."]
    #[inline(always)]
    pub fn hispd8(self) -> &'a mut W {
        self.variant(OSRHS_A::HISPD8)
    }
    #[doc = "High speed over sampling of 16x."]
    #[inline(always)]
    pub fn hispd16(self) -> &'a mut W {
        self.variant(OSRHS_A::HISPD16)
    }
    #[doc = "HIgh speed over sampling of 32x."]
    #[inline(always)]
    pub fn hispd32(self) -> &'a mut W {
        self.variant(OSRHS_A::HISPD32)
    }
    #[doc = "High speed over sampling of 64x."]
    #[inline(always)]
    pub fn hispd64(self) -> &'a mut W {
        self.variant(OSRHS_A::HISPD64)
    }
}
#[doc = "Field `ANALOGGAIN` reader - Analog Gain"]
pub type ANALOGGAIN_R = crate::FieldReader<u8, ANALOGGAIN_A>;
#[doc = "Analog Gain\n\nValue on reset: 2"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ANALOGGAIN_A {
    #[doc = "1: Analog gain of 0.5x."]
    ANAGAIN0P5 = 1,
    #[doc = "2: Analog gain of 1x."]
    ANAGAIN1 = 2,
    #[doc = "3: Analog gain of 2x."]
    ANAGAIN2 = 3,
    #[doc = "4: Analog gain of 3x."]
    ANAGAIN3 = 4,
    #[doc = "5: Analog gain of 4x."]
    ANAGAIN4 = 5,
}
impl From<ANALOGGAIN_A> for u8 {
    #[inline(always)]
    fn from(variant: ANALOGGAIN_A) -> Self {
        variant as _
    }
}
impl ANALOGGAIN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<ANALOGGAIN_A> {
        match self.bits {
            1 => Some(ANALOGGAIN_A::ANAGAIN0P5),
            2 => Some(ANALOGGAIN_A::ANAGAIN1),
            3 => Some(ANALOGGAIN_A::ANAGAIN2),
            4 => Some(ANALOGGAIN_A::ANAGAIN3),
            5 => Some(ANALOGGAIN_A::ANAGAIN4),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `ANAGAIN0P5`"]
    #[inline(always)]
    pub fn is_anagain0p5(&self) -> bool {
        *self == ANALOGGAIN_A::ANAGAIN0P5
    }
    #[doc = "Checks if the value of the field is `ANAGAIN1`"]
    #[inline(always)]
    pub fn is_anagain1(&self) -> bool {
        *self == ANALOGGAIN_A::ANAGAIN1
    }
    #[doc = "Checks if the value of the field is `ANAGAIN2`"]
    #[inline(always)]
    pub fn is_anagain2(&self) -> bool {
        *self == ANALOGGAIN_A::ANAGAIN2
    }
    #[doc = "Checks if the value of the field is `ANAGAIN3`"]
    #[inline(always)]
    pub fn is_anagain3(&self) -> bool {
        *self == ANALOGGAIN_A::ANAGAIN3
    }
    #[doc = "Checks if the value of the field is `ANAGAIN4`"]
    #[inline(always)]
    pub fn is_anagain4(&self) -> bool {
        *self == ANALOGGAIN_A::ANAGAIN4
    }
}
#[doc = "Field `ANALOGGAIN` writer - Analog Gain"]
pub type ANALOGGAIN_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, CFG0_SPEC, u8, ANALOGGAIN_A, 3, O>;
impl<'a, const O: u8> ANALOGGAIN_W<'a, O> {
    #[doc = "Analog gain of 0.5x."]
    #[inline(always)]
    pub fn anagain0p5(self) -> &'a mut W {
        self.variant(ANALOGGAIN_A::ANAGAIN0P5)
    }
    #[doc = "Analog gain of 1x."]
    #[inline(always)]
    pub fn anagain1(self) -> &'a mut W {
        self.variant(ANALOGGAIN_A::ANAGAIN1)
    }
    #[doc = "Analog gain of 2x."]
    #[inline(always)]
    pub fn anagain2(self) -> &'a mut W {
        self.variant(ANALOGGAIN_A::ANAGAIN2)
    }
    #[doc = "Analog gain of 3x."]
    #[inline(always)]
    pub fn anagain3(self) -> &'a mut W {
        self.variant(ANALOGGAIN_A::ANAGAIN3)
    }
    #[doc = "Analog gain of 4x."]
    #[inline(always)]
    pub fn anagain4(self) -> &'a mut W {
        self.variant(ANALOGGAIN_A::ANAGAIN4)
    }
}
#[doc = "Field `REFSEL` reader - Reference Select"]
pub type REFSEL_R = crate::FieldReader<u8, REFSEL_A>;
#[doc = "Reference Select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum REFSEL_A {
    #[doc = "0: Internal 1.21 V reference."]
    VBGR = 0,
    #[doc = "1: External Reference. (Calibrated for 1.25V nominal.)"]
    VREF = 1,
    #[doc = "3: AVDD (unbuffered)"]
    VDDX = 3,
    #[doc = "4: AVDD (buffered) * 0.8"]
    VDDX0P8BUF = 4,
}
impl From<REFSEL_A> for u8 {
    #[inline(always)]
    fn from(variant: REFSEL_A) -> Self {
        variant as _
    }
}
impl REFSEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<REFSEL_A> {
        match self.bits {
            0 => Some(REFSEL_A::VBGR),
            1 => Some(REFSEL_A::VREF),
            3 => Some(REFSEL_A::VDDX),
            4 => Some(REFSEL_A::VDDX0P8BUF),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `VBGR`"]
    #[inline(always)]
    pub fn is_vbgr(&self) -> bool {
        *self == REFSEL_A::VBGR
    }
    #[doc = "Checks if the value of the field is `VREF`"]
    #[inline(always)]
    pub fn is_vref(&self) -> bool {
        *self == REFSEL_A::VREF
    }
    #[doc = "Checks if the value of the field is `VDDX`"]
    #[inline(always)]
    pub fn is_vddx(&self) -> bool {
        *self == REFSEL_A::VDDX
    }
    #[doc = "Checks if the value of the field is `VDDX0P8BUF`"]
    #[inline(always)]
    pub fn is_vddx0p8buf(&self) -> bool {
        *self == REFSEL_A::VDDX0P8BUF
    }
}
#[doc = "Field `REFSEL` writer - Reference Select"]
pub type REFSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, REFSEL_A, 3, O>;
impl<'a, const O: u8> REFSEL_W<'a, O> {
    #[doc = "Internal 1.21 V reference."]
    #[inline(always)]
    pub fn vbgr(self) -> &'a mut W {
        self.variant(REFSEL_A::VBGR)
    }
    #[doc = "External Reference. (Calibrated for 1.25V nominal.)"]
    #[inline(always)]
    pub fn vref(self) -> &'a mut W {
        self.variant(REFSEL_A::VREF)
    }
    #[doc = "AVDD (unbuffered)"]
    #[inline(always)]
    pub fn vddx(self) -> &'a mut W {
        self.variant(REFSEL_A::VDDX)
    }
    #[doc = "AVDD (buffered) * 0.8"]
    #[inline(always)]
    pub fn vddx0p8buf(self) -> &'a mut W {
        self.variant(REFSEL_A::VDDX0P8BUF)
    }
}
#[doc = "Field `DIGAVG` reader - Digital Averaging"]
pub type DIGAVG_R = crate::FieldReader<u8, DIGAVG_A>;
#[doc = "Digital Averaging\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DIGAVG_A {
    #[doc = "0: Collect one output word (no digital averaging)."]
    AVG1 = 0,
    #[doc = "1: Collect and average 2 digital output words."]
    AVG2 = 1,
    #[doc = "2: Collect and average 4 digital output words."]
    AVG4 = 2,
    #[doc = "3: Collect and average 8 digital output words."]
    AVG8 = 3,
    #[doc = "4: Collect and average 16 digital output words."]
    AVG16 = 4,
}
impl From<DIGAVG_A> for u8 {
    #[inline(always)]
    fn from(variant: DIGAVG_A) -> Self {
        variant as _
    }
}
impl DIGAVG_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<DIGAVG_A> {
        match self.bits {
            0 => Some(DIGAVG_A::AVG1),
            1 => Some(DIGAVG_A::AVG2),
            2 => Some(DIGAVG_A::AVG4),
            3 => Some(DIGAVG_A::AVG8),
            4 => Some(DIGAVG_A::AVG16),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `AVG1`"]
    #[inline(always)]
    pub fn is_avg1(&self) -> bool {
        *self == DIGAVG_A::AVG1
    }
    #[doc = "Checks if the value of the field is `AVG2`"]
    #[inline(always)]
    pub fn is_avg2(&self) -> bool {
        *self == DIGAVG_A::AVG2
    }
    #[doc = "Checks if the value of the field is `AVG4`"]
    #[inline(always)]
    pub fn is_avg4(&self) -> bool {
        *self == DIGAVG_A::AVG4
    }
    #[doc = "Checks if the value of the field is `AVG8`"]
    #[inline(always)]
    pub fn is_avg8(&self) -> bool {
        *self == DIGAVG_A::AVG8
    }
    #[doc = "Checks if the value of the field is `AVG16`"]
    #[inline(always)]
    pub fn is_avg16(&self) -> bool {
        *self == DIGAVG_A::AVG16
    }
}
#[doc = "Field `DIGAVG` writer - Digital Averaging"]
pub type DIGAVG_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, DIGAVG_A, 3, O>;
impl<'a, const O: u8> DIGAVG_W<'a, O> {
    #[doc = "Collect one output word (no digital averaging)."]
    #[inline(always)]
    pub fn avg1(self) -> &'a mut W {
        self.variant(DIGAVG_A::AVG1)
    }
    #[doc = "Collect and average 2 digital output words."]
    #[inline(always)]
    pub fn avg2(self) -> &'a mut W {
        self.variant(DIGAVG_A::AVG2)
    }
    #[doc = "Collect and average 4 digital output words."]
    #[inline(always)]
    pub fn avg4(self) -> &'a mut W {
        self.variant(DIGAVG_A::AVG4)
    }
    #[doc = "Collect and average 8 digital output words."]
    #[inline(always)]
    pub fn avg8(self) -> &'a mut W {
        self.variant(DIGAVG_A::AVG8)
    }
    #[doc = "Collect and average 16 digital output words."]
    #[inline(always)]
    pub fn avg16(self) -> &'a mut W {
        self.variant(DIGAVG_A::AVG16)
    }
}
#[doc = "Field `TWOSCOMPL` reader - Two's Complement"]
pub type TWOSCOMPL_R = crate::FieldReader<u8, TWOSCOMPL_A>;
#[doc = "Two's Complement\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TWOSCOMPL_A {
    #[doc = "0: Automatic: Single ended measurements are reported as unipolar and differential measurements are reported as bipolar."]
    AUTO = 0,
    #[doc = "1: Force all measurements to result in unipolar output. Negative differential numbers will saturate to 0."]
    FORCEUNIPOLAR = 1,
    #[doc = "2: Force all measurements to result in bipolar output. Single ended measurements are half the range, but allow for small negative measurements."]
    FORCEBIPOLAR = 2,
}
impl From<TWOSCOMPL_A> for u8 {
    #[inline(always)]
    fn from(variant: TWOSCOMPL_A) -> Self {
        variant as _
    }
}
impl TWOSCOMPL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<TWOSCOMPL_A> {
        match self.bits {
            0 => Some(TWOSCOMPL_A::AUTO),
            1 => Some(TWOSCOMPL_A::FORCEUNIPOLAR),
            2 => Some(TWOSCOMPL_A::FORCEBIPOLAR),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `AUTO`"]
    #[inline(always)]
    pub fn is_auto(&self) -> bool {
        *self == TWOSCOMPL_A::AUTO
    }
    #[doc = "Checks if the value of the field is `FORCEUNIPOLAR`"]
    #[inline(always)]
    pub fn is_forceunipolar(&self) -> bool {
        *self == TWOSCOMPL_A::FORCEUNIPOLAR
    }
    #[doc = "Checks if the value of the field is `FORCEBIPOLAR`"]
    #[inline(always)]
    pub fn is_forcebipolar(&self) -> bool {
        *self == TWOSCOMPL_A::FORCEBIPOLAR
    }
}
#[doc = "Field `TWOSCOMPL` writer - Two's Complement"]
pub type TWOSCOMPL_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, CFG0_SPEC, u8, TWOSCOMPL_A, 2, O>;
impl<'a, const O: u8> TWOSCOMPL_W<'a, O> {
    #[doc = "Automatic: Single ended measurements are reported as unipolar and differential measurements are reported as bipolar."]
    #[inline(always)]
    pub fn auto(self) -> &'a mut W {
        self.variant(TWOSCOMPL_A::AUTO)
    }
    #[doc = "Force all measurements to result in unipolar output. Negative differential numbers will saturate to 0."]
    #[inline(always)]
    pub fn forceunipolar(self) -> &'a mut W {
        self.variant(TWOSCOMPL_A::FORCEUNIPOLAR)
    }
    #[doc = "Force all measurements to result in bipolar output. Single ended measurements are half the range, but allow for small negative measurements."]
    #[inline(always)]
    pub fn forcebipolar(self) -> &'a mut W {
        self.variant(TWOSCOMPL_A::FORCEBIPOLAR)
    }
}
impl R {
    #[doc = "Bits 0:1 - ADC Mode"]
    #[inline(always)]
    pub fn adcmode(&self) -> ADCMODE_R {
        ADCMODE_R::new((self.bits & 3) as u8)
    }
    #[doc = "Bits 2:4 - High Speed OSR"]
    #[inline(always)]
    pub fn osrhs(&self) -> OSRHS_R {
        OSRHS_R::new(((self.bits >> 2) & 7) as u8)
    }
    #[doc = "Bits 12:14 - Analog Gain"]
    #[inline(always)]
    pub fn analoggain(&self) -> ANALOGGAIN_R {
        ANALOGGAIN_R::new(((self.bits >> 12) & 7) as u8)
    }
    #[doc = "Bits 16:18 - Reference Select"]
    #[inline(always)]
    pub fn refsel(&self) -> REFSEL_R {
        REFSEL_R::new(((self.bits >> 16) & 7) as u8)
    }
    #[doc = "Bits 21:23 - Digital Averaging"]
    #[inline(always)]
    pub fn digavg(&self) -> DIGAVG_R {
        DIGAVG_R::new(((self.bits >> 21) & 7) as u8)
    }
    #[doc = "Bits 28:29 - Two's Complement"]
    #[inline(always)]
    pub fn twoscompl(&self) -> TWOSCOMPL_R {
        TWOSCOMPL_R::new(((self.bits >> 28) & 3) as u8)
    }
}
impl W {
    #[doc = "Bits 0:1 - ADC Mode"]
    #[inline(always)]
    #[must_use]
    pub fn adcmode(&mut self) -> ADCMODE_W<0> {
        ADCMODE_W::new(self)
    }
    #[doc = "Bits 2:4 - High Speed OSR"]
    #[inline(always)]
    #[must_use]
    pub fn osrhs(&mut self) -> OSRHS_W<2> {
        OSRHS_W::new(self)
    }
    #[doc = "Bits 12:14 - Analog Gain"]
    #[inline(always)]
    #[must_use]
    pub fn analoggain(&mut self) -> ANALOGGAIN_W<12> {
        ANALOGGAIN_W::new(self)
    }
    #[doc = "Bits 16:18 - Reference Select"]
    #[inline(always)]
    #[must_use]
    pub fn refsel(&mut self) -> REFSEL_W<16> {
        REFSEL_W::new(self)
    }
    #[doc = "Bits 21:23 - Digital Averaging"]
    #[inline(always)]
    #[must_use]
    pub fn digavg(&mut self) -> DIGAVG_W<21> {
        DIGAVG_W::new(self)
    }
    #[doc = "Bits 28:29 - Two's Complement"]
    #[inline(always)]
    #[must_use]
    pub fn twoscompl(&mut self) -> TWOSCOMPL_W<28> {
        TWOSCOMPL_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Configration\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 [cfg0](index.html) module"]
pub struct CFG0_SPEC;
impl crate::RegisterSpec for CFG0_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [cfg0::R](R) reader structure"]
impl crate::Readable for CFG0_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cfg0::W](W) writer structure"]
impl crate::Writable for CFG0_SPEC {
    type Writer = W;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets CFG0 to value 0x2060"]
impl crate::Resettable for CFG0_SPEC {
    const RESET_VALUE: Self::Ux = 0x2060;
}