mcxa-pac 0.2.0

Peripheral Access Crate for MCXA256 devices
Documentation
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
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
#[doc = "Register `CTRL` reader"]
pub type R = crate::R<CtrlSpec>;
#[doc = "Register `CTRL` writer"]
pub type W = crate::W<CtrlSpec>;
#[doc = "ADC Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Adcen {
    #[doc = "0: ADC is disabled."]
    Disabled = 0,
    #[doc = "1: ADC is enabled."]
    Enabled = 1,
}
impl From<Adcen> for bool {
    #[inline(always)]
    fn from(variant: Adcen) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ADCEN` reader - ADC Enable"]
pub type AdcenR = crate::BitReader<Adcen>;
impl AdcenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Adcen {
        match self.bits {
            false => Adcen::Disabled,
            true => Adcen::Enabled,
        }
    }
    #[doc = "ADC is disabled."]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Adcen::Disabled
    }
    #[doc = "ADC is enabled."]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Adcen::Enabled
    }
}
#[doc = "Field `ADCEN` writer - ADC Enable"]
pub type AdcenW<'a, REG> = crate::BitWriter<'a, REG, Adcen>;
impl<'a, REG> AdcenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "ADC is disabled."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Adcen::Disabled)
    }
    #[doc = "ADC is enabled."]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Adcen::Enabled)
    }
}
#[doc = "Software Reset\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Rst {
    #[doc = "0: ADC logic is not reset."]
    ReleasedFromReset = 0,
    #[doc = "1: ADC logic is reset."]
    HeldInReset = 1,
}
impl From<Rst> for bool {
    #[inline(always)]
    fn from(variant: Rst) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RST` reader - Software Reset"]
pub type RstR = crate::BitReader<Rst>;
impl RstR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Rst {
        match self.bits {
            false => Rst::ReleasedFromReset,
            true => Rst::HeldInReset,
        }
    }
    #[doc = "ADC logic is not reset."]
    #[inline(always)]
    pub fn is_released_from_reset(&self) -> bool {
        *self == Rst::ReleasedFromReset
    }
    #[doc = "ADC logic is reset."]
    #[inline(always)]
    pub fn is_held_in_reset(&self) -> bool {
        *self == Rst::HeldInReset
    }
}
#[doc = "Field `RST` writer - Software Reset"]
pub type RstW<'a, REG> = crate::BitWriter<'a, REG, Rst>;
impl<'a, REG> RstW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "ADC logic is not reset."]
    #[inline(always)]
    pub fn released_from_reset(self) -> &'a mut crate::W<REG> {
        self.variant(Rst::ReleasedFromReset)
    }
    #[doc = "ADC logic is reset."]
    #[inline(always)]
    pub fn held_in_reset(self) -> &'a mut crate::W<REG> {
        self.variant(Rst::HeldInReset)
    }
}
#[doc = "Doze Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Dozen {
    #[doc = "0: ADC is enabled in low power mode."]
    Enabled = 0,
    #[doc = "1: ADC is disabled in low power mode."]
    Disabled = 1,
}
impl From<Dozen> for bool {
    #[inline(always)]
    fn from(variant: Dozen) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `DOZEN` reader - Doze Enable"]
pub type DozenR = crate::BitReader<Dozen>;
impl DozenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Dozen {
        match self.bits {
            false => Dozen::Enabled,
            true => Dozen::Disabled,
        }
    }
    #[doc = "ADC is enabled in low power mode."]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Dozen::Enabled
    }
    #[doc = "ADC is disabled in low power mode."]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Dozen::Disabled
    }
}
#[doc = "Field `DOZEN` writer - Doze Enable"]
pub type DozenW<'a, REG> = crate::BitWriter<'a, REG, Dozen>;
impl<'a, REG> DozenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "ADC is enabled in low power mode."]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Dozen::Enabled)
    }
    #[doc = "ADC is disabled in low power mode."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Dozen::Disabled)
    }
}
#[doc = "Auto-Calibration Request\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CalReq {
    #[doc = "0: No request for hardware calibration has been made"]
    NoCalibrationRequest = 0,
    #[doc = "1: A request for hardware calibration has been made"]
    CalibrationRequestPending = 1,
}
impl From<CalReq> for bool {
    #[inline(always)]
    fn from(variant: CalReq) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CAL_REQ` reader - Auto-Calibration Request"]
pub type CalReqR = crate::BitReader<CalReq>;
impl CalReqR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> CalReq {
        match self.bits {
            false => CalReq::NoCalibrationRequest,
            true => CalReq::CalibrationRequestPending,
        }
    }
    #[doc = "No request for hardware calibration has been made"]
    #[inline(always)]
    pub fn is_no_calibration_request(&self) -> bool {
        *self == CalReq::NoCalibrationRequest
    }
    #[doc = "A request for hardware calibration has been made"]
    #[inline(always)]
    pub fn is_calibration_request_pending(&self) -> bool {
        *self == CalReq::CalibrationRequestPending
    }
}
#[doc = "Field `CAL_REQ` writer - Auto-Calibration Request"]
pub type CalReqW<'a, REG> = crate::BitWriter<'a, REG, CalReq>;
impl<'a, REG> CalReqW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No request for hardware calibration has been made"]
    #[inline(always)]
    pub fn no_calibration_request(self) -> &'a mut crate::W<REG> {
        self.variant(CalReq::NoCalibrationRequest)
    }
    #[doc = "A request for hardware calibration has been made"]
    #[inline(always)]
    pub fn calibration_request_pending(self) -> &'a mut crate::W<REG> {
        self.variant(CalReq::CalibrationRequestPending)
    }
}
#[doc = "Offset Calibration Request\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Calofs {
    #[doc = "0: No request for offset calibration has been made"]
    NoActiveOffsetCalibrationRequest = 0,
    #[doc = "1: Request for offset calibration function"]
    OffsetCalibrationRequestPending = 1,
}
impl From<Calofs> for bool {
    #[inline(always)]
    fn from(variant: Calofs) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CALOFS` reader - Offset Calibration Request"]
pub type CalofsR = crate::BitReader<Calofs>;
impl CalofsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Calofs {
        match self.bits {
            false => Calofs::NoActiveOffsetCalibrationRequest,
            true => Calofs::OffsetCalibrationRequestPending,
        }
    }
    #[doc = "No request for offset calibration has been made"]
    #[inline(always)]
    pub fn is_no_active_offset_calibration_request(&self) -> bool {
        *self == Calofs::NoActiveOffsetCalibrationRequest
    }
    #[doc = "Request for offset calibration function"]
    #[inline(always)]
    pub fn is_offset_calibration_request_pending(&self) -> bool {
        *self == Calofs::OffsetCalibrationRequestPending
    }
}
#[doc = "Field `CALOFS` writer - Offset Calibration Request"]
pub type CalofsW<'a, REG> = crate::BitWriter<'a, REG, Calofs>;
impl<'a, REG> CalofsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No request for offset calibration has been made"]
    #[inline(always)]
    pub fn no_active_offset_calibration_request(self) -> &'a mut crate::W<REG> {
        self.variant(Calofs::NoActiveOffsetCalibrationRequest)
    }
    #[doc = "Request for offset calibration function"]
    #[inline(always)]
    pub fn offset_calibration_request_pending(self) -> &'a mut crate::W<REG> {
        self.variant(Calofs::OffsetCalibrationRequestPending)
    }
}
#[doc = "High Speed Mode Trim Request\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Calhs {
    #[doc = "0: No request for high speed mode trim has been made"]
    NoActiveHsTrimRequest = 0,
    #[doc = "1: Request for high speed mode trim has been made"]
    HsTrimRequestPending = 1,
}
impl From<Calhs> for bool {
    #[inline(always)]
    fn from(variant: Calhs) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CALHS` reader - High Speed Mode Trim Request"]
pub type CalhsR = crate::BitReader<Calhs>;
impl CalhsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Calhs {
        match self.bits {
            false => Calhs::NoActiveHsTrimRequest,
            true => Calhs::HsTrimRequestPending,
        }
    }
    #[doc = "No request for high speed mode trim has been made"]
    #[inline(always)]
    pub fn is_no_active_hs_trim_request(&self) -> bool {
        *self == Calhs::NoActiveHsTrimRequest
    }
    #[doc = "Request for high speed mode trim has been made"]
    #[inline(always)]
    pub fn is_hs_trim_request_pending(&self) -> bool {
        *self == Calhs::HsTrimRequestPending
    }
}
#[doc = "Field `CALHS` writer - High Speed Mode Trim Request"]
pub type CalhsW<'a, REG> = crate::BitWriter<'a, REG, Calhs>;
impl<'a, REG> CalhsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No request for high speed mode trim has been made"]
    #[inline(always)]
    pub fn no_active_hs_trim_request(self) -> &'a mut crate::W<REG> {
        self.variant(Calhs::NoActiveHsTrimRequest)
    }
    #[doc = "Request for high speed mode trim has been made"]
    #[inline(always)]
    pub fn hs_trim_request_pending(self) -> &'a mut crate::W<REG> {
        self.variant(Calhs::HsTrimRequestPending)
    }
}
#[doc = "Reset FIFO 0\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Rstfifo0 {
    #[doc = "0: No effect."]
    NoAction = 0,
    #[doc = "1: FIFO 0 is reset."]
    TriggerReset = 1,
}
impl From<Rstfifo0> for bool {
    #[inline(always)]
    fn from(variant: Rstfifo0) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RSTFIFO0` reader - Reset FIFO 0"]
pub type Rstfifo0R = crate::BitReader<Rstfifo0>;
impl Rstfifo0R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Rstfifo0 {
        match self.bits {
            false => Rstfifo0::NoAction,
            true => Rstfifo0::TriggerReset,
        }
    }
    #[doc = "No effect."]
    #[inline(always)]
    pub fn is_no_action(&self) -> bool {
        *self == Rstfifo0::NoAction
    }
    #[doc = "FIFO 0 is reset."]
    #[inline(always)]
    pub fn is_trigger_reset(&self) -> bool {
        *self == Rstfifo0::TriggerReset
    }
}
#[doc = "Field `RSTFIFO0` writer - Reset FIFO 0"]
pub type Rstfifo0W<'a, REG> = crate::BitWriter<'a, REG, Rstfifo0>;
impl<'a, REG> Rstfifo0W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No effect."]
    #[inline(always)]
    pub fn no_action(self) -> &'a mut crate::W<REG> {
        self.variant(Rstfifo0::NoAction)
    }
    #[doc = "FIFO 0 is reset."]
    #[inline(always)]
    pub fn trigger_reset(self) -> &'a mut crate::W<REG> {
        self.variant(Rstfifo0::TriggerReset)
    }
}
#[doc = "Auto-Calibration Averages\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CalAvgs {
    #[doc = "0: Single conversion."]
    NoAverage = 0,
    #[doc = "1: 2 conversions averaged."]
    Average2 = 1,
    #[doc = "2: 4 conversions averaged."]
    Average4 = 2,
    #[doc = "3: 8 conversions averaged."]
    Average8 = 3,
    #[doc = "4: 16 conversions averaged."]
    Average16 = 4,
    #[doc = "5: 32 conversions averaged."]
    Average32 = 5,
    #[doc = "6: 64 conversions averaged."]
    Average64 = 6,
    #[doc = "7: 128 conversions averaged."]
    Average128 = 7,
    #[doc = "8: 256 conversions averaged."]
    Average256 = 8,
    #[doc = "9: 512 conversions averaged."]
    Average512 = 9,
    #[doc = "10: 1024 conversions averaged."]
    Average1024 = 10,
}
impl From<CalAvgs> for u8 {
    #[inline(always)]
    fn from(variant: CalAvgs) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for CalAvgs {
    type Ux = u8;
}
impl crate::IsEnum for CalAvgs {}
#[doc = "Field `CAL_AVGS` reader - Auto-Calibration Averages"]
pub type CalAvgsR = crate::FieldReader<CalAvgs>;
impl CalAvgsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<CalAvgs> {
        match self.bits {
            0 => Some(CalAvgs::NoAverage),
            1 => Some(CalAvgs::Average2),
            2 => Some(CalAvgs::Average4),
            3 => Some(CalAvgs::Average8),
            4 => Some(CalAvgs::Average16),
            5 => Some(CalAvgs::Average32),
            6 => Some(CalAvgs::Average64),
            7 => Some(CalAvgs::Average128),
            8 => Some(CalAvgs::Average256),
            9 => Some(CalAvgs::Average512),
            10 => Some(CalAvgs::Average1024),
            _ => None,
        }
    }
    #[doc = "Single conversion."]
    #[inline(always)]
    pub fn is_no_average(&self) -> bool {
        *self == CalAvgs::NoAverage
    }
    #[doc = "2 conversions averaged."]
    #[inline(always)]
    pub fn is_average_2(&self) -> bool {
        *self == CalAvgs::Average2
    }
    #[doc = "4 conversions averaged."]
    #[inline(always)]
    pub fn is_average_4(&self) -> bool {
        *self == CalAvgs::Average4
    }
    #[doc = "8 conversions averaged."]
    #[inline(always)]
    pub fn is_average_8(&self) -> bool {
        *self == CalAvgs::Average8
    }
    #[doc = "16 conversions averaged."]
    #[inline(always)]
    pub fn is_average_16(&self) -> bool {
        *self == CalAvgs::Average16
    }
    #[doc = "32 conversions averaged."]
    #[inline(always)]
    pub fn is_average_32(&self) -> bool {
        *self == CalAvgs::Average32
    }
    #[doc = "64 conversions averaged."]
    #[inline(always)]
    pub fn is_average_64(&self) -> bool {
        *self == CalAvgs::Average64
    }
    #[doc = "128 conversions averaged."]
    #[inline(always)]
    pub fn is_average_128(&self) -> bool {
        *self == CalAvgs::Average128
    }
    #[doc = "256 conversions averaged."]
    #[inline(always)]
    pub fn is_average_256(&self) -> bool {
        *self == CalAvgs::Average256
    }
    #[doc = "512 conversions averaged."]
    #[inline(always)]
    pub fn is_average_512(&self) -> bool {
        *self == CalAvgs::Average512
    }
    #[doc = "1024 conversions averaged."]
    #[inline(always)]
    pub fn is_average_1024(&self) -> bool {
        *self == CalAvgs::Average1024
    }
}
#[doc = "Field `CAL_AVGS` writer - Auto-Calibration Averages"]
pub type CalAvgsW<'a, REG> = crate::FieldWriter<'a, REG, 4, CalAvgs>;
impl<'a, REG> CalAvgsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Single conversion."]
    #[inline(always)]
    pub fn no_average(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::NoAverage)
    }
    #[doc = "2 conversions averaged."]
    #[inline(always)]
    pub fn average_2(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average2)
    }
    #[doc = "4 conversions averaged."]
    #[inline(always)]
    pub fn average_4(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average4)
    }
    #[doc = "8 conversions averaged."]
    #[inline(always)]
    pub fn average_8(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average8)
    }
    #[doc = "16 conversions averaged."]
    #[inline(always)]
    pub fn average_16(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average16)
    }
    #[doc = "32 conversions averaged."]
    #[inline(always)]
    pub fn average_32(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average32)
    }
    #[doc = "64 conversions averaged."]
    #[inline(always)]
    pub fn average_64(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average64)
    }
    #[doc = "128 conversions averaged."]
    #[inline(always)]
    pub fn average_128(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average128)
    }
    #[doc = "256 conversions averaged."]
    #[inline(always)]
    pub fn average_256(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average256)
    }
    #[doc = "512 conversions averaged."]
    #[inline(always)]
    pub fn average_512(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average512)
    }
    #[doc = "1024 conversions averaged."]
    #[inline(always)]
    pub fn average_1024(self) -> &'a mut crate::W<REG> {
        self.variant(CalAvgs::Average1024)
    }
}
impl R {
    #[doc = "Bit 0 - ADC Enable"]
    #[inline(always)]
    pub fn adcen(&self) -> AdcenR {
        AdcenR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Software Reset"]
    #[inline(always)]
    pub fn rst(&self) -> RstR {
        RstR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Doze Enable"]
    #[inline(always)]
    pub fn dozen(&self) -> DozenR {
        DozenR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Auto-Calibration Request"]
    #[inline(always)]
    pub fn cal_req(&self) -> CalReqR {
        CalReqR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Offset Calibration Request"]
    #[inline(always)]
    pub fn calofs(&self) -> CalofsR {
        CalofsR::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 6 - High Speed Mode Trim Request"]
    #[inline(always)]
    pub fn calhs(&self) -> CalhsR {
        CalhsR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 8 - Reset FIFO 0"]
    #[inline(always)]
    pub fn rstfifo0(&self) -> Rstfifo0R {
        Rstfifo0R::new(((self.bits >> 8) & 1) != 0)
    }
    #[doc = "Bits 16:19 - Auto-Calibration Averages"]
    #[inline(always)]
    pub fn cal_avgs(&self) -> CalAvgsR {
        CalAvgsR::new(((self.bits >> 16) & 0x0f) as u8)
    }
}
#[cfg(feature = "debug")]
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("CTRL")
            .field("adcen", &self.adcen())
            .field("rst", &self.rst())
            .field("dozen", &self.dozen())
            .field("cal_req", &self.cal_req())
            .field("calofs", &self.calofs())
            .field("calhs", &self.calhs())
            .field("rstfifo0", &self.rstfifo0())
            .field("cal_avgs", &self.cal_avgs())
            .finish()
    }
}
impl W {
    #[doc = "Bit 0 - ADC Enable"]
    #[inline(always)]
    pub fn adcen(&mut self) -> AdcenW<'_, CtrlSpec> {
        AdcenW::new(self, 0)
    }
    #[doc = "Bit 1 - Software Reset"]
    #[inline(always)]
    pub fn rst(&mut self) -> RstW<'_, CtrlSpec> {
        RstW::new(self, 1)
    }
    #[doc = "Bit 2 - Doze Enable"]
    #[inline(always)]
    pub fn dozen(&mut self) -> DozenW<'_, CtrlSpec> {
        DozenW::new(self, 2)
    }
    #[doc = "Bit 3 - Auto-Calibration Request"]
    #[inline(always)]
    pub fn cal_req(&mut self) -> CalReqW<'_, CtrlSpec> {
        CalReqW::new(self, 3)
    }
    #[doc = "Bit 4 - Offset Calibration Request"]
    #[inline(always)]
    pub fn calofs(&mut self) -> CalofsW<'_, CtrlSpec> {
        CalofsW::new(self, 4)
    }
    #[doc = "Bit 6 - High Speed Mode Trim Request"]
    #[inline(always)]
    pub fn calhs(&mut self) -> CalhsW<'_, CtrlSpec> {
        CalhsW::new(self, 6)
    }
    #[doc = "Bit 8 - Reset FIFO 0"]
    #[inline(always)]
    pub fn rstfifo0(&mut self) -> Rstfifo0W<'_, CtrlSpec> {
        Rstfifo0W::new(self, 8)
    }
    #[doc = "Bits 16:19 - Auto-Calibration Averages"]
    #[inline(always)]
    pub fn cal_avgs(&mut self) -> CalAvgsW<'_, CtrlSpec> {
        CalAvgsW::new(self, 16)
    }
}
#[doc = "Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CtrlSpec;
impl crate::RegisterSpec for CtrlSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
impl crate::Readable for CtrlSpec {}
#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
impl crate::Writable for CtrlSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets CTRL to value 0"]
impl crate::Resettable for CtrlSpec {}