efm32gg11b510_pac/vdac0/
opa2_cal.rs

1#[doc = "Register `OPA2_CAL` reader"]
2pub struct R(crate::R<OPA2_CAL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OPA2_CAL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OPA2_CAL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OPA2_CAL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OPA2_CAL` writer"]
17pub struct W(crate::W<OPA2_CAL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OPA2_CAL_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<OPA2_CAL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OPA2_CAL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CM1` reader - Compensation Cap Cm1 Trim Value"]
38pub type CM1_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `CM1` writer - Compensation Cap Cm1 Trim Value"]
40pub type CM1_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 4, 0>;
41#[doc = "Field `CM2` reader - Compensation Cap Cm2 Trim Value"]
42pub type CM2_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `CM2` writer - Compensation Cap Cm2 Trim Value"]
44pub type CM2_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 4, 5>;
45#[doc = "Field `CM3` reader - Compensation Cap Cm3 Trim Value"]
46pub type CM3_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `CM3` writer - Compensation Cap Cm3 Trim Value"]
48pub type CM3_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 2, 10>;
49#[doc = "Field `GM` reader - Gm Trim Value"]
50pub type GM_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `GM` writer - Gm Trim Value"]
52pub type GM_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 3, 13>;
53#[doc = "Field `GM3` reader - Gm3 Trim Value"]
54pub type GM3_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `GM3` writer - Gm3 Trim Value"]
56pub type GM3_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 2, 17>;
57#[doc = "Field `OFFSETP` reader - OPAx Non-Inverting Input Offset Configuration Value"]
58pub type OFFSETP_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `OFFSETP` writer - OPAx Non-Inverting Input Offset Configuration Value"]
60pub type OFFSETP_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 5, 20>;
61#[doc = "Field `OFFSETN` reader - OPAx Inverting Input Offset Configuration Value"]
62pub type OFFSETN_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `OFFSETN` writer - OPAx Inverting Input Offset Configuration Value"]
64pub type OFFSETN_W<'a> = crate::FieldWriter<'a, u32, OPA2_CAL_SPEC, u8, u8, 5, 26>;
65impl R {
66    #[doc = "Bits 0:3 - Compensation Cap Cm1 Trim Value"]
67    #[inline(always)]
68    pub fn cm1(&self) -> CM1_R {
69        CM1_R::new((self.bits & 0x0f) as u8)
70    }
71    #[doc = "Bits 5:8 - Compensation Cap Cm2 Trim Value"]
72    #[inline(always)]
73    pub fn cm2(&self) -> CM2_R {
74        CM2_R::new(((self.bits >> 5) & 0x0f) as u8)
75    }
76    #[doc = "Bits 10:11 - Compensation Cap Cm3 Trim Value"]
77    #[inline(always)]
78    pub fn cm3(&self) -> CM3_R {
79        CM3_R::new(((self.bits >> 10) & 3) as u8)
80    }
81    #[doc = "Bits 13:15 - Gm Trim Value"]
82    #[inline(always)]
83    pub fn gm(&self) -> GM_R {
84        GM_R::new(((self.bits >> 13) & 7) as u8)
85    }
86    #[doc = "Bits 17:18 - Gm3 Trim Value"]
87    #[inline(always)]
88    pub fn gm3(&self) -> GM3_R {
89        GM3_R::new(((self.bits >> 17) & 3) as u8)
90    }
91    #[doc = "Bits 20:24 - OPAx Non-Inverting Input Offset Configuration Value"]
92    #[inline(always)]
93    pub fn offsetp(&self) -> OFFSETP_R {
94        OFFSETP_R::new(((self.bits >> 20) & 0x1f) as u8)
95    }
96    #[doc = "Bits 26:30 - OPAx Inverting Input Offset Configuration Value"]
97    #[inline(always)]
98    pub fn offsetn(&self) -> OFFSETN_R {
99        OFFSETN_R::new(((self.bits >> 26) & 0x1f) as u8)
100    }
101}
102impl W {
103    #[doc = "Bits 0:3 - Compensation Cap Cm1 Trim Value"]
104    #[inline(always)]
105    pub fn cm1(&mut self) -> CM1_W {
106        CM1_W::new(self)
107    }
108    #[doc = "Bits 5:8 - Compensation Cap Cm2 Trim Value"]
109    #[inline(always)]
110    pub fn cm2(&mut self) -> CM2_W {
111        CM2_W::new(self)
112    }
113    #[doc = "Bits 10:11 - Compensation Cap Cm3 Trim Value"]
114    #[inline(always)]
115    pub fn cm3(&mut self) -> CM3_W {
116        CM3_W::new(self)
117    }
118    #[doc = "Bits 13:15 - Gm Trim Value"]
119    #[inline(always)]
120    pub fn gm(&mut self) -> GM_W {
121        GM_W::new(self)
122    }
123    #[doc = "Bits 17:18 - Gm3 Trim Value"]
124    #[inline(always)]
125    pub fn gm3(&mut self) -> GM3_W {
126        GM3_W::new(self)
127    }
128    #[doc = "Bits 20:24 - OPAx Non-Inverting Input Offset Configuration Value"]
129    #[inline(always)]
130    pub fn offsetp(&mut self) -> OFFSETP_W {
131        OFFSETP_W::new(self)
132    }
133    #[doc = "Bits 26:30 - OPAx Inverting Input Offset Configuration Value"]
134    #[inline(always)]
135    pub fn offsetn(&mut self) -> OFFSETN_W {
136        OFFSETN_W::new(self)
137    }
138    #[doc = "Writes raw bits to the register."]
139    #[inline(always)]
140    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141        self.0.bits(bits);
142        self
143    }
144}
145#[doc = "Operational Amplifier Calibration 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 [opa2_cal](index.html) module"]
146pub struct OPA2_CAL_SPEC;
147impl crate::RegisterSpec for OPA2_CAL_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [opa2_cal::R](R) reader structure"]
151impl crate::Readable for OPA2_CAL_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [opa2_cal::W](W) writer structure"]
155impl crate::Writable for OPA2_CAL_SPEC {
156    type Writer = W;
157}
158#[doc = "`reset()` method sets OPA2_CAL to value 0x80e7"]
159impl crate::Resettable for OPA2_CAL_SPEC {
160    #[inline(always)]
161    fn reset_value() -> Self::Ux {
162        0x80e7
163    }
164}