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
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
#[doc = "Register `OPAMP1_CSR` reader"]
pub struct R(crate::R<OPAMP1_CSR_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<OPAMP1_CSR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<OPAMP1_CSR_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<OPAMP1_CSR_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `OPAMP1_CSR` writer"]
pub struct W(crate::W<OPAMP1_CSR_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<OPAMP1_CSR_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<OPAMP1_CSR_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<OPAMP1_CSR_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Operational amplifier Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OPAEN_A {
    #[doc = "0: OpAmp disabled"]
    Disabled = 0,
    #[doc = "1: OpAmp enabled"]
    Enabled = 1,
}
impl From<OPAEN_A> for bool {
    #[inline(always)]
    fn from(variant: OPAEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `OPAEN` reader - Operational amplifier Enable"]
pub type OPAEN_R = crate::BitReader<OPAEN_A>;
impl OPAEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> OPAEN_A {
        match self.bits {
            false => OPAEN_A::Disabled,
            true => OPAEN_A::Enabled,
        }
    }
    #[doc = "Checks if the value of the field is `Disabled`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == OPAEN_A::Disabled
    }
    #[doc = "Checks if the value of the field is `Enabled`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == OPAEN_A::Enabled
    }
}
#[doc = "Field `OPAEN` writer - Operational amplifier Enable"]
pub type OPAEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, OPAEN_A, O>;
impl<'a, const O: u8> OPAEN_W<'a, O> {
    #[doc = "OpAmp disabled"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut W {
        self.variant(OPAEN_A::Disabled)
    }
    #[doc = "OpAmp enabled"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut W {
        self.variant(OPAEN_A::Enabled)
    }
}
#[doc = "Operational amplifier Low Power Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OPALPM_A {
    #[doc = "0: OpAmp in normal mode"]
    Normal = 0,
    #[doc = "1: OpAmp in low power mode"]
    Low = 1,
}
impl From<OPALPM_A> for bool {
    #[inline(always)]
    fn from(variant: OPALPM_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `OPALPM` reader - Operational amplifier Low Power Mode"]
pub type OPALPM_R = crate::BitReader<OPALPM_A>;
impl OPALPM_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> OPALPM_A {
        match self.bits {
            false => OPALPM_A::Normal,
            true => OPALPM_A::Low,
        }
    }
    #[doc = "Checks if the value of the field is `Normal`"]
    #[inline(always)]
    pub fn is_normal(&self) -> bool {
        *self == OPALPM_A::Normal
    }
    #[doc = "Checks if the value of the field is `Low`"]
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == OPALPM_A::Low
    }
}
#[doc = "Field `OPALPM` writer - Operational amplifier Low Power Mode"]
pub type OPALPM_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, OPALPM_A, O>;
impl<'a, const O: u8> OPALPM_W<'a, O> {
    #[doc = "OpAmp in normal mode"]
    #[inline(always)]
    pub fn normal(self) -> &'a mut W {
        self.variant(OPALPM_A::Normal)
    }
    #[doc = "OpAmp in low power mode"]
    #[inline(always)]
    pub fn low(self) -> &'a mut W {
        self.variant(OPALPM_A::Low)
    }
}
#[doc = "Operational amplifier PGA mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum OPAMODE_A {
    #[doc = "0: internal PGA diabled"]
    PgaDisabled = 0,
    #[doc = "2: internal PGA enabled, gain programmed in PGA_GAIN"]
    PgaEnabled = 2,
    #[doc = "3: internal follower"]
    Follower = 3,
}
impl From<OPAMODE_A> for u8 {
    #[inline(always)]
    fn from(variant: OPAMODE_A) -> Self {
        variant as _
    }
}
#[doc = "Field `OPAMODE` reader - Operational amplifier PGA mode"]
pub type OPAMODE_R = crate::FieldReader<u8, OPAMODE_A>;
impl OPAMODE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<OPAMODE_A> {
        match self.bits {
            0 => Some(OPAMODE_A::PgaDisabled),
            2 => Some(OPAMODE_A::PgaEnabled),
            3 => Some(OPAMODE_A::Follower),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `PgaDisabled`"]
    #[inline(always)]
    pub fn is_pga_disabled(&self) -> bool {
        *self == OPAMODE_A::PgaDisabled
    }
    #[doc = "Checks if the value of the field is `PgaEnabled`"]
    #[inline(always)]
    pub fn is_pga_enabled(&self) -> bool {
        *self == OPAMODE_A::PgaEnabled
    }
    #[doc = "Checks if the value of the field is `Follower`"]
    #[inline(always)]
    pub fn is_follower(&self) -> bool {
        *self == OPAMODE_A::Follower
    }
}
#[doc = "Field `OPAMODE` writer - Operational amplifier PGA mode"]
pub type OPAMODE_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, OPAMP1_CSR_SPEC, u8, OPAMODE_A, 2, O>;
impl<'a, const O: u8> OPAMODE_W<'a, O> {
    #[doc = "internal PGA diabled"]
    #[inline(always)]
    pub fn pga_disabled(self) -> &'a mut W {
        self.variant(OPAMODE_A::PgaDisabled)
    }
    #[doc = "internal PGA enabled, gain programmed in PGA_GAIN"]
    #[inline(always)]
    pub fn pga_enabled(self) -> &'a mut W {
        self.variant(OPAMODE_A::PgaEnabled)
    }
    #[doc = "internal follower"]
    #[inline(always)]
    pub fn follower(self) -> &'a mut W {
        self.variant(OPAMODE_A::Follower)
    }
}
#[doc = "Operational amplifier Programmable amplifier gain value\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum PGA_GAIN_A {
    #[doc = "0: Gain 2"]
    Gain2 = 0,
    #[doc = "1: Gain 4"]
    Gain4 = 1,
    #[doc = "2: Gain 8"]
    Gain8 = 2,
    #[doc = "3: Gain 16"]
    Gain16 = 3,
}
impl From<PGA_GAIN_A> for u8 {
    #[inline(always)]
    fn from(variant: PGA_GAIN_A) -> Self {
        variant as _
    }
}
#[doc = "Field `PGA_GAIN` reader - Operational amplifier Programmable amplifier gain value"]
pub type PGA_GAIN_R = crate::FieldReader<u8, PGA_GAIN_A>;
impl PGA_GAIN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PGA_GAIN_A {
        match self.bits {
            0 => PGA_GAIN_A::Gain2,
            1 => PGA_GAIN_A::Gain4,
            2 => PGA_GAIN_A::Gain8,
            3 => PGA_GAIN_A::Gain16,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `Gain2`"]
    #[inline(always)]
    pub fn is_gain2(&self) -> bool {
        *self == PGA_GAIN_A::Gain2
    }
    #[doc = "Checks if the value of the field is `Gain4`"]
    #[inline(always)]
    pub fn is_gain4(&self) -> bool {
        *self == PGA_GAIN_A::Gain4
    }
    #[doc = "Checks if the value of the field is `Gain8`"]
    #[inline(always)]
    pub fn is_gain8(&self) -> bool {
        *self == PGA_GAIN_A::Gain8
    }
    #[doc = "Checks if the value of the field is `Gain16`"]
    #[inline(always)]
    pub fn is_gain16(&self) -> bool {
        *self == PGA_GAIN_A::Gain16
    }
}
#[doc = "Field `PGA_GAIN` writer - Operational amplifier Programmable amplifier gain value"]
pub type PGA_GAIN_W<'a, const O: u8> =
    crate::FieldWriterSafe<'a, u32, OPAMP1_CSR_SPEC, u8, PGA_GAIN_A, 2, O>;
impl<'a, const O: u8> PGA_GAIN_W<'a, O> {
    #[doc = "Gain 2"]
    #[inline(always)]
    pub fn gain2(self) -> &'a mut W {
        self.variant(PGA_GAIN_A::Gain2)
    }
    #[doc = "Gain 4"]
    #[inline(always)]
    pub fn gain4(self) -> &'a mut W {
        self.variant(PGA_GAIN_A::Gain4)
    }
    #[doc = "Gain 8"]
    #[inline(always)]
    pub fn gain8(self) -> &'a mut W {
        self.variant(PGA_GAIN_A::Gain8)
    }
    #[doc = "Gain 16"]
    #[inline(always)]
    pub fn gain16(self) -> &'a mut W {
        self.variant(PGA_GAIN_A::Gain16)
    }
}
#[doc = "Inverting input selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum VM_SEL_A {
    #[doc = "0: GPIO connectet to VINM"]
    Gpio = 0,
    #[doc = "1: Low leakage inputs connecte (only available in certen BGA cases"]
    LowLeakage = 1,
    #[doc = "2: OPAMP in PGA mode"]
    PgaMode = 2,
}
impl From<VM_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: VM_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `VM_SEL` reader - Inverting input selection"]
pub type VM_SEL_R = crate::FieldReader<u8, VM_SEL_A>;
impl VM_SEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<VM_SEL_A> {
        match self.bits {
            0 => Some(VM_SEL_A::Gpio),
            1 => Some(VM_SEL_A::LowLeakage),
            2 => Some(VM_SEL_A::PgaMode),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `Gpio`"]
    #[inline(always)]
    pub fn is_gpio(&self) -> bool {
        *self == VM_SEL_A::Gpio
    }
    #[doc = "Checks if the value of the field is `LowLeakage`"]
    #[inline(always)]
    pub fn is_low_leakage(&self) -> bool {
        *self == VM_SEL_A::LowLeakage
    }
    #[doc = "Checks if the value of the field is `PgaMode`"]
    #[inline(always)]
    pub fn is_pga_mode(&self) -> bool {
        *self == VM_SEL_A::PgaMode
    }
}
#[doc = "Field `VM_SEL` writer - Inverting input selection"]
pub type VM_SEL_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, OPAMP1_CSR_SPEC, u8, VM_SEL_A, 2, O>;
impl<'a, const O: u8> VM_SEL_W<'a, O> {
    #[doc = "GPIO connectet to VINM"]
    #[inline(always)]
    pub fn gpio(self) -> &'a mut W {
        self.variant(VM_SEL_A::Gpio)
    }
    #[doc = "Low leakage inputs connecte (only available in certen BGA cases"]
    #[inline(always)]
    pub fn low_leakage(self) -> &'a mut W {
        self.variant(VM_SEL_A::LowLeakage)
    }
    #[doc = "OPAMP in PGA mode"]
    #[inline(always)]
    pub fn pga_mode(self) -> &'a mut W {
        self.variant(VM_SEL_A::PgaMode)
    }
}
#[doc = "Non inverted input selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VP_SEL_A {
    #[doc = "0: GPIO connectet to VINP"]
    Gpio = 0,
    #[doc = "1: DAC connected to VPINP"]
    Dac = 1,
}
impl From<VP_SEL_A> for bool {
    #[inline(always)]
    fn from(variant: VP_SEL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `VP_SEL` reader - Non inverted input selection"]
pub type VP_SEL_R = crate::BitReader<VP_SEL_A>;
impl VP_SEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> VP_SEL_A {
        match self.bits {
            false => VP_SEL_A::Gpio,
            true => VP_SEL_A::Dac,
        }
    }
    #[doc = "Checks if the value of the field is `Gpio`"]
    #[inline(always)]
    pub fn is_gpio(&self) -> bool {
        *self == VP_SEL_A::Gpio
    }
    #[doc = "Checks if the value of the field is `Dac`"]
    #[inline(always)]
    pub fn is_dac(&self) -> bool {
        *self == VP_SEL_A::Dac
    }
}
#[doc = "Field `VP_SEL` writer - Non inverted input selection"]
pub type VP_SEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, VP_SEL_A, O>;
impl<'a, const O: u8> VP_SEL_W<'a, O> {
    #[doc = "GPIO connectet to VINP"]
    #[inline(always)]
    pub fn gpio(self) -> &'a mut W {
        self.variant(VP_SEL_A::Gpio)
    }
    #[doc = "DAC connected to VPINP"]
    #[inline(always)]
    pub fn dac(self) -> &'a mut W {
        self.variant(VP_SEL_A::Dac)
    }
}
#[doc = "Calibration mode enabled\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CALON_A {
    #[doc = "0: Normal mode"]
    Disabled = 0,
    #[doc = "1: Calibration mode"]
    Enabled = 1,
}
impl From<CALON_A> for bool {
    #[inline(always)]
    fn from(variant: CALON_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CALON` reader - Calibration mode enabled"]
pub type CALON_R = crate::BitReader<CALON_A>;
impl CALON_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CALON_A {
        match self.bits {
            false => CALON_A::Disabled,
            true => CALON_A::Enabled,
        }
    }
    #[doc = "Checks if the value of the field is `Disabled`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == CALON_A::Disabled
    }
    #[doc = "Checks if the value of the field is `Enabled`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == CALON_A::Enabled
    }
}
#[doc = "Field `CALON` writer - Calibration mode enabled"]
pub type CALON_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, CALON_A, O>;
impl<'a, const O: u8> CALON_W<'a, O> {
    #[doc = "Normal mode"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut W {
        self.variant(CALON_A::Disabled)
    }
    #[doc = "Calibration mode"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut W {
        self.variant(CALON_A::Enabled)
    }
}
#[doc = "Calibration selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CALSEL_A {
    #[doc = "0: 0.2V applied to OPAMP inputs during calibration"]
    Nmos = 0,
    #[doc = "1: VDDA-0.2V applied to OPAMP inputs during calibration\""]
    Pmos = 1,
}
impl From<CALSEL_A> for bool {
    #[inline(always)]
    fn from(variant: CALSEL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CALSEL` reader - Calibration selection"]
pub type CALSEL_R = crate::BitReader<CALSEL_A>;
impl CALSEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CALSEL_A {
        match self.bits {
            false => CALSEL_A::Nmos,
            true => CALSEL_A::Pmos,
        }
    }
    #[doc = "Checks if the value of the field is `Nmos`"]
    #[inline(always)]
    pub fn is_nmos(&self) -> bool {
        *self == CALSEL_A::Nmos
    }
    #[doc = "Checks if the value of the field is `Pmos`"]
    #[inline(always)]
    pub fn is_pmos(&self) -> bool {
        *self == CALSEL_A::Pmos
    }
}
#[doc = "Field `CALSEL` writer - Calibration selection"]
pub type CALSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, CALSEL_A, O>;
impl<'a, const O: u8> CALSEL_W<'a, O> {
    #[doc = "0.2V applied to OPAMP inputs during calibration"]
    #[inline(always)]
    pub fn nmos(self) -> &'a mut W {
        self.variant(CALSEL_A::Nmos)
    }
    #[doc = "VDDA-0.2V applied to OPAMP inputs during calibration\""]
    #[inline(always)]
    pub fn pmos(self) -> &'a mut W {
        self.variant(CALSEL_A::Pmos)
    }
}
#[doc = "allows to switch from AOP offset trimmed values to AOP offset\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum USERTRIM_A {
    #[doc = "0: Factory trim used"]
    Factory = 0,
    #[doc = "1: User trim used"]
    User = 1,
}
impl From<USERTRIM_A> for bool {
    #[inline(always)]
    fn from(variant: USERTRIM_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `USERTRIM` reader - allows to switch from AOP offset trimmed values to AOP offset"]
pub type USERTRIM_R = crate::BitReader<USERTRIM_A>;
impl USERTRIM_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> USERTRIM_A {
        match self.bits {
            false => USERTRIM_A::Factory,
            true => USERTRIM_A::User,
        }
    }
    #[doc = "Checks if the value of the field is `Factory`"]
    #[inline(always)]
    pub fn is_factory(&self) -> bool {
        *self == USERTRIM_A::Factory
    }
    #[doc = "Checks if the value of the field is `User`"]
    #[inline(always)]
    pub fn is_user(&self) -> bool {
        *self == USERTRIM_A::User
    }
}
#[doc = "Field `USERTRIM` writer - allows to switch from AOP offset trimmed values to AOP offset"]
pub type USERTRIM_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, USERTRIM_A, O>;
impl<'a, const O: u8> USERTRIM_W<'a, O> {
    #[doc = "Factory trim used"]
    #[inline(always)]
    pub fn factory(self) -> &'a mut W {
        self.variant(USERTRIM_A::Factory)
    }
    #[doc = "User trim used"]
    #[inline(always)]
    pub fn user(self) -> &'a mut W {
        self.variant(USERTRIM_A::User)
    }
}
#[doc = "Field `CALOUT` reader - Operational amplifier calibration output"]
pub type CALOUT_R = crate::BitReader<bool>;
#[doc = "Field `CALOUT` writer - Operational amplifier calibration output"]
pub type CALOUT_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, bool, O>;
#[doc = "Operational amplifier power supply range for stability\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OPA_RANGE_A {
    #[doc = "0: low range (VDDA < 2.4V"]
    Low = 0,
    #[doc = "1: low range (VDDA >2.4V"]
    High = 1,
}
impl From<OPA_RANGE_A> for bool {
    #[inline(always)]
    fn from(variant: OPA_RANGE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `OPA_RANGE` reader - Operational amplifier power supply range for stability"]
pub type OPA_RANGE_R = crate::BitReader<OPA_RANGE_A>;
impl OPA_RANGE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> OPA_RANGE_A {
        match self.bits {
            false => OPA_RANGE_A::Low,
            true => OPA_RANGE_A::High,
        }
    }
    #[doc = "Checks if the value of the field is `Low`"]
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == OPA_RANGE_A::Low
    }
    #[doc = "Checks if the value of the field is `High`"]
    #[inline(always)]
    pub fn is_high(&self) -> bool {
        *self == OPA_RANGE_A::High
    }
}
#[doc = "Field `OPA_RANGE` writer - Operational amplifier power supply range for stability"]
pub type OPA_RANGE_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPAMP1_CSR_SPEC, OPA_RANGE_A, O>;
impl<'a, const O: u8> OPA_RANGE_W<'a, O> {
    #[doc = "low range (VDDA < 2.4V"]
    #[inline(always)]
    pub fn low(self) -> &'a mut W {
        self.variant(OPA_RANGE_A::Low)
    }
    #[doc = "low range (VDDA >2.4V"]
    #[inline(always)]
    pub fn high(self) -> &'a mut W {
        self.variant(OPA_RANGE_A::High)
    }
}
impl R {
    #[doc = "Bit 0 - Operational amplifier Enable"]
    #[inline(always)]
    pub fn opaen(&self) -> OPAEN_R {
        OPAEN_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Operational amplifier Low Power Mode"]
    #[inline(always)]
    pub fn opalpm(&self) -> OPALPM_R {
        OPALPM_R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 2:3 - Operational amplifier PGA mode"]
    #[inline(always)]
    pub fn opamode(&self) -> OPAMODE_R {
        OPAMODE_R::new(((self.bits >> 2) & 3) as u8)
    }
    #[doc = "Bits 4:5 - Operational amplifier Programmable amplifier gain value"]
    #[inline(always)]
    pub fn pga_gain(&self) -> PGA_GAIN_R {
        PGA_GAIN_R::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bits 8:9 - Inverting input selection"]
    #[inline(always)]
    pub fn vm_sel(&self) -> VM_SEL_R {
        VM_SEL_R::new(((self.bits >> 8) & 3) as u8)
    }
    #[doc = "Bit 10 - Non inverted input selection"]
    #[inline(always)]
    pub fn vp_sel(&self) -> VP_SEL_R {
        VP_SEL_R::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 12 - Calibration mode enabled"]
    #[inline(always)]
    pub fn calon(&self) -> CALON_R {
        CALON_R::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - Calibration selection"]
    #[inline(always)]
    pub fn calsel(&self) -> CALSEL_R {
        CALSEL_R::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bit 14 - allows to switch from AOP offset trimmed values to AOP offset"]
    #[inline(always)]
    pub fn usertrim(&self) -> USERTRIM_R {
        USERTRIM_R::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bit 15 - Operational amplifier calibration output"]
    #[inline(always)]
    pub fn calout(&self) -> CALOUT_R {
        CALOUT_R::new(((self.bits >> 15) & 1) != 0)
    }
    #[doc = "Bit 31 - Operational amplifier power supply range for stability"]
    #[inline(always)]
    pub fn opa_range(&self) -> OPA_RANGE_R {
        OPA_RANGE_R::new(((self.bits >> 31) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Operational amplifier Enable"]
    #[inline(always)]
    pub fn opaen(&mut self) -> OPAEN_W<0> {
        OPAEN_W::new(self)
    }
    #[doc = "Bit 1 - Operational amplifier Low Power Mode"]
    #[inline(always)]
    pub fn opalpm(&mut self) -> OPALPM_W<1> {
        OPALPM_W::new(self)
    }
    #[doc = "Bits 2:3 - Operational amplifier PGA mode"]
    #[inline(always)]
    pub fn opamode(&mut self) -> OPAMODE_W<2> {
        OPAMODE_W::new(self)
    }
    #[doc = "Bits 4:5 - Operational amplifier Programmable amplifier gain value"]
    #[inline(always)]
    pub fn pga_gain(&mut self) -> PGA_GAIN_W<4> {
        PGA_GAIN_W::new(self)
    }
    #[doc = "Bits 8:9 - Inverting input selection"]
    #[inline(always)]
    pub fn vm_sel(&mut self) -> VM_SEL_W<8> {
        VM_SEL_W::new(self)
    }
    #[doc = "Bit 10 - Non inverted input selection"]
    #[inline(always)]
    pub fn vp_sel(&mut self) -> VP_SEL_W<10> {
        VP_SEL_W::new(self)
    }
    #[doc = "Bit 12 - Calibration mode enabled"]
    #[inline(always)]
    pub fn calon(&mut self) -> CALON_W<12> {
        CALON_W::new(self)
    }
    #[doc = "Bit 13 - Calibration selection"]
    #[inline(always)]
    pub fn calsel(&mut self) -> CALSEL_W<13> {
        CALSEL_W::new(self)
    }
    #[doc = "Bit 14 - allows to switch from AOP offset trimmed values to AOP offset"]
    #[inline(always)]
    pub fn usertrim(&mut self) -> USERTRIM_W<14> {
        USERTRIM_W::new(self)
    }
    #[doc = "Bit 15 - Operational amplifier calibration output"]
    #[inline(always)]
    pub fn calout(&mut self) -> CALOUT_W<15> {
        CALOUT_W::new(self)
    }
    #[doc = "Bit 31 - Operational amplifier power supply range for stability"]
    #[inline(always)]
    pub fn opa_range(&mut self) -> OPA_RANGE_W<31> {
        OPA_RANGE_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 = "OPAMP1 control/status 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 [opamp1_csr](index.html) module"]
pub struct OPAMP1_CSR_SPEC;
impl crate::RegisterSpec for OPAMP1_CSR_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [opamp1_csr::R](R) reader structure"]
impl crate::Readable for OPAMP1_CSR_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [opamp1_csr::W](W) writer structure"]
impl crate::Writable for OPAMP1_CSR_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets OPAMP1_CSR to value 0"]
impl crate::Resettable for OPAMP1_CSR_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}