1pub type R = crate::R<OPAMP1_CSRrs>;
3pub type W = crate::W<OPAMP1_CSRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum OPAEN {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<OPAEN> for bool {
17 #[inline(always)]
18 fn from(variant: OPAEN) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type OPAEN_R = crate::BitReader<OPAEN>;
24impl OPAEN_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> OPAEN {
28 match self.bits {
29 false => OPAEN::Disabled,
30 true => OPAEN::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == OPAEN::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == OPAEN::Enabled
42 }
43}
44pub type OPAEN_W<'a, REG> = crate::BitWriter<'a, REG, OPAEN>;
46impl<'a, REG> OPAEN_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn disabled(self) -> &'a mut crate::W<REG> {
53 self.variant(OPAEN::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(OPAEN::Enabled)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum OPALPM {
67 Normal = 0,
69 Low = 1,
71}
72impl From<OPALPM> for bool {
73 #[inline(always)]
74 fn from(variant: OPALPM) -> Self {
75 variant as u8 != 0
76 }
77}
78pub type OPALPM_R = crate::BitReader<OPALPM>;
80impl OPALPM_R {
81 #[inline(always)]
83 pub const fn variant(&self) -> OPALPM {
84 match self.bits {
85 false => OPALPM::Normal,
86 true => OPALPM::Low,
87 }
88 }
89 #[inline(always)]
91 pub fn is_normal(&self) -> bool {
92 *self == OPALPM::Normal
93 }
94 #[inline(always)]
96 pub fn is_low(&self) -> bool {
97 *self == OPALPM::Low
98 }
99}
100pub type OPALPM_W<'a, REG> = crate::BitWriter<'a, REG, OPALPM>;
102impl<'a, REG> OPALPM_W<'a, REG>
103where
104 REG: crate::Writable + crate::RegisterSpec,
105{
106 #[inline(always)]
108 pub fn normal(self) -> &'a mut crate::W<REG> {
109 self.variant(OPALPM::Normal)
110 }
111 #[inline(always)]
113 pub fn low(self) -> &'a mut crate::W<REG> {
114 self.variant(OPALPM::Low)
115 }
116}
117#[cfg_attr(feature = "defmt", derive(defmt::Format))]
121#[derive(Clone, Copy, Debug, PartialEq, Eq)]
122#[repr(u8)]
123pub enum OPAMODE {
124 PgaDisabled = 0,
126 PgaEnabled = 2,
128 Follower = 3,
130}
131impl From<OPAMODE> for u8 {
132 #[inline(always)]
133 fn from(variant: OPAMODE) -> Self {
134 variant as _
135 }
136}
137impl crate::FieldSpec for OPAMODE {
138 type Ux = u8;
139}
140impl crate::IsEnum for OPAMODE {}
141pub type OPAMODE_R = crate::FieldReader<OPAMODE>;
143impl OPAMODE_R {
144 #[inline(always)]
146 pub const fn variant(&self) -> Option<OPAMODE> {
147 match self.bits {
148 0 => Some(OPAMODE::PgaDisabled),
149 2 => Some(OPAMODE::PgaEnabled),
150 3 => Some(OPAMODE::Follower),
151 _ => None,
152 }
153 }
154 #[inline(always)]
156 pub fn is_pga_disabled(&self) -> bool {
157 *self == OPAMODE::PgaDisabled
158 }
159 #[inline(always)]
161 pub fn is_pga_enabled(&self) -> bool {
162 *self == OPAMODE::PgaEnabled
163 }
164 #[inline(always)]
166 pub fn is_follower(&self) -> bool {
167 *self == OPAMODE::Follower
168 }
169}
170pub type OPAMODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, OPAMODE>;
172impl<'a, REG> OPAMODE_W<'a, REG>
173where
174 REG: crate::Writable + crate::RegisterSpec,
175 REG::Ux: From<u8>,
176{
177 #[inline(always)]
179 pub fn pga_disabled(self) -> &'a mut crate::W<REG> {
180 self.variant(OPAMODE::PgaDisabled)
181 }
182 #[inline(always)]
184 pub fn pga_enabled(self) -> &'a mut crate::W<REG> {
185 self.variant(OPAMODE::PgaEnabled)
186 }
187 #[inline(always)]
189 pub fn follower(self) -> &'a mut crate::W<REG> {
190 self.variant(OPAMODE::Follower)
191 }
192}
193#[cfg_attr(feature = "defmt", derive(defmt::Format))]
197#[derive(Clone, Copy, Debug, PartialEq, Eq)]
198#[repr(u8)]
199pub enum PGA_GAIN {
200 Gain2 = 0,
202 Gain4 = 1,
204 Gain8 = 2,
206 Gain16 = 3,
208}
209impl From<PGA_GAIN> for u8 {
210 #[inline(always)]
211 fn from(variant: PGA_GAIN) -> Self {
212 variant as _
213 }
214}
215impl crate::FieldSpec for PGA_GAIN {
216 type Ux = u8;
217}
218impl crate::IsEnum for PGA_GAIN {}
219pub type PGA_GAIN_R = crate::FieldReader<PGA_GAIN>;
221impl PGA_GAIN_R {
222 #[inline(always)]
224 pub const fn variant(&self) -> PGA_GAIN {
225 match self.bits {
226 0 => PGA_GAIN::Gain2,
227 1 => PGA_GAIN::Gain4,
228 2 => PGA_GAIN::Gain8,
229 3 => PGA_GAIN::Gain16,
230 _ => unreachable!(),
231 }
232 }
233 #[inline(always)]
235 pub fn is_gain2(&self) -> bool {
236 *self == PGA_GAIN::Gain2
237 }
238 #[inline(always)]
240 pub fn is_gain4(&self) -> bool {
241 *self == PGA_GAIN::Gain4
242 }
243 #[inline(always)]
245 pub fn is_gain8(&self) -> bool {
246 *self == PGA_GAIN::Gain8
247 }
248 #[inline(always)]
250 pub fn is_gain16(&self) -> bool {
251 *self == PGA_GAIN::Gain16
252 }
253}
254pub type PGA_GAIN_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PGA_GAIN, crate::Safe>;
256impl<'a, REG> PGA_GAIN_W<'a, REG>
257where
258 REG: crate::Writable + crate::RegisterSpec,
259 REG::Ux: From<u8>,
260{
261 #[inline(always)]
263 pub fn gain2(self) -> &'a mut crate::W<REG> {
264 self.variant(PGA_GAIN::Gain2)
265 }
266 #[inline(always)]
268 pub fn gain4(self) -> &'a mut crate::W<REG> {
269 self.variant(PGA_GAIN::Gain4)
270 }
271 #[inline(always)]
273 pub fn gain8(self) -> &'a mut crate::W<REG> {
274 self.variant(PGA_GAIN::Gain8)
275 }
276 #[inline(always)]
278 pub fn gain16(self) -> &'a mut crate::W<REG> {
279 self.variant(PGA_GAIN::Gain16)
280 }
281}
282#[cfg_attr(feature = "defmt", derive(defmt::Format))]
286#[derive(Clone, Copy, Debug, PartialEq, Eq)]
287#[repr(u8)]
288pub enum VM_SEL {
289 Gpio = 0,
291 LowLeakage = 1,
293 PgaMode = 2,
295}
296impl From<VM_SEL> for u8 {
297 #[inline(always)]
298 fn from(variant: VM_SEL) -> Self {
299 variant as _
300 }
301}
302impl crate::FieldSpec for VM_SEL {
303 type Ux = u8;
304}
305impl crate::IsEnum for VM_SEL {}
306pub type VM_SEL_R = crate::FieldReader<VM_SEL>;
308impl VM_SEL_R {
309 #[inline(always)]
311 pub const fn variant(&self) -> Option<VM_SEL> {
312 match self.bits {
313 0 => Some(VM_SEL::Gpio),
314 1 => Some(VM_SEL::LowLeakage),
315 2 => Some(VM_SEL::PgaMode),
316 _ => None,
317 }
318 }
319 #[inline(always)]
321 pub fn is_gpio(&self) -> bool {
322 *self == VM_SEL::Gpio
323 }
324 #[inline(always)]
326 pub fn is_low_leakage(&self) -> bool {
327 *self == VM_SEL::LowLeakage
328 }
329 #[inline(always)]
331 pub fn is_pga_mode(&self) -> bool {
332 *self == VM_SEL::PgaMode
333 }
334}
335pub type VM_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, VM_SEL>;
337impl<'a, REG> VM_SEL_W<'a, REG>
338where
339 REG: crate::Writable + crate::RegisterSpec,
340 REG::Ux: From<u8>,
341{
342 #[inline(always)]
344 pub fn gpio(self) -> &'a mut crate::W<REG> {
345 self.variant(VM_SEL::Gpio)
346 }
347 #[inline(always)]
349 pub fn low_leakage(self) -> &'a mut crate::W<REG> {
350 self.variant(VM_SEL::LowLeakage)
351 }
352 #[inline(always)]
354 pub fn pga_mode(self) -> &'a mut crate::W<REG> {
355 self.variant(VM_SEL::PgaMode)
356 }
357}
358#[cfg_attr(feature = "defmt", derive(defmt::Format))]
362#[derive(Clone, Copy, Debug, PartialEq, Eq)]
363pub enum VP_SEL {
364 Gpio = 0,
366 Dac = 1,
368}
369impl From<VP_SEL> for bool {
370 #[inline(always)]
371 fn from(variant: VP_SEL) -> Self {
372 variant as u8 != 0
373 }
374}
375pub type VP_SEL_R = crate::BitReader<VP_SEL>;
377impl VP_SEL_R {
378 #[inline(always)]
380 pub const fn variant(&self) -> VP_SEL {
381 match self.bits {
382 false => VP_SEL::Gpio,
383 true => VP_SEL::Dac,
384 }
385 }
386 #[inline(always)]
388 pub fn is_gpio(&self) -> bool {
389 *self == VP_SEL::Gpio
390 }
391 #[inline(always)]
393 pub fn is_dac(&self) -> bool {
394 *self == VP_SEL::Dac
395 }
396}
397pub type VP_SEL_W<'a, REG> = crate::BitWriter<'a, REG, VP_SEL>;
399impl<'a, REG> VP_SEL_W<'a, REG>
400where
401 REG: crate::Writable + crate::RegisterSpec,
402{
403 #[inline(always)]
405 pub fn gpio(self) -> &'a mut crate::W<REG> {
406 self.variant(VP_SEL::Gpio)
407 }
408 #[inline(always)]
410 pub fn dac(self) -> &'a mut crate::W<REG> {
411 self.variant(VP_SEL::Dac)
412 }
413}
414#[cfg_attr(feature = "defmt", derive(defmt::Format))]
418#[derive(Clone, Copy, Debug, PartialEq, Eq)]
419pub enum CALON {
420 Disabled = 0,
422 Enabled = 1,
424}
425impl From<CALON> for bool {
426 #[inline(always)]
427 fn from(variant: CALON) -> Self {
428 variant as u8 != 0
429 }
430}
431pub type CALON_R = crate::BitReader<CALON>;
433impl CALON_R {
434 #[inline(always)]
436 pub const fn variant(&self) -> CALON {
437 match self.bits {
438 false => CALON::Disabled,
439 true => CALON::Enabled,
440 }
441 }
442 #[inline(always)]
444 pub fn is_disabled(&self) -> bool {
445 *self == CALON::Disabled
446 }
447 #[inline(always)]
449 pub fn is_enabled(&self) -> bool {
450 *self == CALON::Enabled
451 }
452}
453pub type CALON_W<'a, REG> = crate::BitWriter<'a, REG, CALON>;
455impl<'a, REG> CALON_W<'a, REG>
456where
457 REG: crate::Writable + crate::RegisterSpec,
458{
459 #[inline(always)]
461 pub fn disabled(self) -> &'a mut crate::W<REG> {
462 self.variant(CALON::Disabled)
463 }
464 #[inline(always)]
466 pub fn enabled(self) -> &'a mut crate::W<REG> {
467 self.variant(CALON::Enabled)
468 }
469}
470#[cfg_attr(feature = "defmt", derive(defmt::Format))]
474#[derive(Clone, Copy, Debug, PartialEq, Eq)]
475pub enum CALSEL {
476 Nmos = 0,
478 Pmos = 1,
480}
481impl From<CALSEL> for bool {
482 #[inline(always)]
483 fn from(variant: CALSEL) -> Self {
484 variant as u8 != 0
485 }
486}
487pub type CALSEL_R = crate::BitReader<CALSEL>;
489impl CALSEL_R {
490 #[inline(always)]
492 pub const fn variant(&self) -> CALSEL {
493 match self.bits {
494 false => CALSEL::Nmos,
495 true => CALSEL::Pmos,
496 }
497 }
498 #[inline(always)]
500 pub fn is_nmos(&self) -> bool {
501 *self == CALSEL::Nmos
502 }
503 #[inline(always)]
505 pub fn is_pmos(&self) -> bool {
506 *self == CALSEL::Pmos
507 }
508}
509pub type CALSEL_W<'a, REG> = crate::BitWriter<'a, REG, CALSEL>;
511impl<'a, REG> CALSEL_W<'a, REG>
512where
513 REG: crate::Writable + crate::RegisterSpec,
514{
515 #[inline(always)]
517 pub fn nmos(self) -> &'a mut crate::W<REG> {
518 self.variant(CALSEL::Nmos)
519 }
520 #[inline(always)]
522 pub fn pmos(self) -> &'a mut crate::W<REG> {
523 self.variant(CALSEL::Pmos)
524 }
525}
526#[cfg_attr(feature = "defmt", derive(defmt::Format))]
530#[derive(Clone, Copy, Debug, PartialEq, Eq)]
531pub enum USERTRIM {
532 Factory = 0,
534 User = 1,
536}
537impl From<USERTRIM> for bool {
538 #[inline(always)]
539 fn from(variant: USERTRIM) -> Self {
540 variant as u8 != 0
541 }
542}
543pub type USERTRIM_R = crate::BitReader<USERTRIM>;
545impl USERTRIM_R {
546 #[inline(always)]
548 pub const fn variant(&self) -> USERTRIM {
549 match self.bits {
550 false => USERTRIM::Factory,
551 true => USERTRIM::User,
552 }
553 }
554 #[inline(always)]
556 pub fn is_factory(&self) -> bool {
557 *self == USERTRIM::Factory
558 }
559 #[inline(always)]
561 pub fn is_user(&self) -> bool {
562 *self == USERTRIM::User
563 }
564}
565pub type USERTRIM_W<'a, REG> = crate::BitWriter<'a, REG, USERTRIM>;
567impl<'a, REG> USERTRIM_W<'a, REG>
568where
569 REG: crate::Writable + crate::RegisterSpec,
570{
571 #[inline(always)]
573 pub fn factory(self) -> &'a mut crate::W<REG> {
574 self.variant(USERTRIM::Factory)
575 }
576 #[inline(always)]
578 pub fn user(self) -> &'a mut crate::W<REG> {
579 self.variant(USERTRIM::User)
580 }
581}
582pub type CALOUT_R = crate::BitReader;
584pub type CALOUT_W<'a, REG> = crate::BitWriter<'a, REG>;
586#[cfg_attr(feature = "defmt", derive(defmt::Format))]
590#[derive(Clone, Copy, Debug, PartialEq, Eq)]
591pub enum OPA_RANGE {
592 Low = 0,
594 High = 1,
596}
597impl From<OPA_RANGE> for bool {
598 #[inline(always)]
599 fn from(variant: OPA_RANGE) -> Self {
600 variant as u8 != 0
601 }
602}
603pub type OPA_RANGE_R = crate::BitReader<OPA_RANGE>;
605impl OPA_RANGE_R {
606 #[inline(always)]
608 pub const fn variant(&self) -> OPA_RANGE {
609 match self.bits {
610 false => OPA_RANGE::Low,
611 true => OPA_RANGE::High,
612 }
613 }
614 #[inline(always)]
616 pub fn is_low(&self) -> bool {
617 *self == OPA_RANGE::Low
618 }
619 #[inline(always)]
621 pub fn is_high(&self) -> bool {
622 *self == OPA_RANGE::High
623 }
624}
625pub type OPA_RANGE_W<'a, REG> = crate::BitWriter<'a, REG, OPA_RANGE>;
627impl<'a, REG> OPA_RANGE_W<'a, REG>
628where
629 REG: crate::Writable + crate::RegisterSpec,
630{
631 #[inline(always)]
633 pub fn low(self) -> &'a mut crate::W<REG> {
634 self.variant(OPA_RANGE::Low)
635 }
636 #[inline(always)]
638 pub fn high(self) -> &'a mut crate::W<REG> {
639 self.variant(OPA_RANGE::High)
640 }
641}
642impl R {
643 #[inline(always)]
645 pub fn opaen(&self) -> OPAEN_R {
646 OPAEN_R::new((self.bits & 1) != 0)
647 }
648 #[inline(always)]
650 pub fn opalpm(&self) -> OPALPM_R {
651 OPALPM_R::new(((self.bits >> 1) & 1) != 0)
652 }
653 #[inline(always)]
655 pub fn opamode(&self) -> OPAMODE_R {
656 OPAMODE_R::new(((self.bits >> 2) & 3) as u8)
657 }
658 #[inline(always)]
660 pub fn pga_gain(&self) -> PGA_GAIN_R {
661 PGA_GAIN_R::new(((self.bits >> 4) & 3) as u8)
662 }
663 #[inline(always)]
665 pub fn vm_sel(&self) -> VM_SEL_R {
666 VM_SEL_R::new(((self.bits >> 8) & 3) as u8)
667 }
668 #[inline(always)]
670 pub fn vp_sel(&self) -> VP_SEL_R {
671 VP_SEL_R::new(((self.bits >> 10) & 1) != 0)
672 }
673 #[inline(always)]
675 pub fn calon(&self) -> CALON_R {
676 CALON_R::new(((self.bits >> 12) & 1) != 0)
677 }
678 #[inline(always)]
680 pub fn calsel(&self) -> CALSEL_R {
681 CALSEL_R::new(((self.bits >> 13) & 1) != 0)
682 }
683 #[inline(always)]
685 pub fn usertrim(&self) -> USERTRIM_R {
686 USERTRIM_R::new(((self.bits >> 14) & 1) != 0)
687 }
688 #[inline(always)]
690 pub fn calout(&self) -> CALOUT_R {
691 CALOUT_R::new(((self.bits >> 15) & 1) != 0)
692 }
693 #[inline(always)]
695 pub fn opa_range(&self) -> OPA_RANGE_R {
696 OPA_RANGE_R::new(((self.bits >> 31) & 1) != 0)
697 }
698}
699impl core::fmt::Debug for R {
700 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
701 f.debug_struct("OPAMP1_CSR")
702 .field("opaen", &self.opaen())
703 .field("opalpm", &self.opalpm())
704 .field("opamode", &self.opamode())
705 .field("pga_gain", &self.pga_gain())
706 .field("vm_sel", &self.vm_sel())
707 .field("vp_sel", &self.vp_sel())
708 .field("calon", &self.calon())
709 .field("calsel", &self.calsel())
710 .field("usertrim", &self.usertrim())
711 .field("calout", &self.calout())
712 .field("opa_range", &self.opa_range())
713 .finish()
714 }
715}
716impl W {
717 #[inline(always)]
719 pub fn opaen(&mut self) -> OPAEN_W<OPAMP1_CSRrs> {
720 OPAEN_W::new(self, 0)
721 }
722 #[inline(always)]
724 pub fn opalpm(&mut self) -> OPALPM_W<OPAMP1_CSRrs> {
725 OPALPM_W::new(self, 1)
726 }
727 #[inline(always)]
729 pub fn opamode(&mut self) -> OPAMODE_W<OPAMP1_CSRrs> {
730 OPAMODE_W::new(self, 2)
731 }
732 #[inline(always)]
734 pub fn pga_gain(&mut self) -> PGA_GAIN_W<OPAMP1_CSRrs> {
735 PGA_GAIN_W::new(self, 4)
736 }
737 #[inline(always)]
739 pub fn vm_sel(&mut self) -> VM_SEL_W<OPAMP1_CSRrs> {
740 VM_SEL_W::new(self, 8)
741 }
742 #[inline(always)]
744 pub fn vp_sel(&mut self) -> VP_SEL_W<OPAMP1_CSRrs> {
745 VP_SEL_W::new(self, 10)
746 }
747 #[inline(always)]
749 pub fn calon(&mut self) -> CALON_W<OPAMP1_CSRrs> {
750 CALON_W::new(self, 12)
751 }
752 #[inline(always)]
754 pub fn calsel(&mut self) -> CALSEL_W<OPAMP1_CSRrs> {
755 CALSEL_W::new(self, 13)
756 }
757 #[inline(always)]
759 pub fn usertrim(&mut self) -> USERTRIM_W<OPAMP1_CSRrs> {
760 USERTRIM_W::new(self, 14)
761 }
762 #[inline(always)]
764 pub fn calout(&mut self) -> CALOUT_W<OPAMP1_CSRrs> {
765 CALOUT_W::new(self, 15)
766 }
767 #[inline(always)]
769 pub fn opa_range(&mut self) -> OPA_RANGE_W<OPAMP1_CSRrs> {
770 OPA_RANGE_W::new(self, 31)
771 }
772}
773pub struct OPAMP1_CSRrs;
779impl crate::RegisterSpec for OPAMP1_CSRrs {
780 type Ux = u32;
781}
782impl crate::Readable for OPAMP1_CSRrs {}
784impl crate::Writable for OPAMP1_CSRrs {
786 type Safety = crate::Unsafe;
787}
788impl crate::Resettable for OPAMP1_CSRrs {}