efm32tg11b_pac/efm32tg11b540/vdac0/
opa1_cal.rs

1#[doc = "Register `OPA1_CAL` reader"]
2pub struct R(crate::R<OPA1_CAL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OPA1_CAL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OPA1_CAL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OPA1_CAL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OPA1_CAL` writer"]
17pub struct W(crate::W<OPA1_CAL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OPA1_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<OPA1_CAL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OPA1_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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 4, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 4, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 2, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 3, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 2, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 5, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, OPA1_CAL_SPEC, u8, u8, 5, O>;
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    #[must_use]
106    pub fn cm1(&mut self) -> CM1_W<0> {
107        CM1_W::new(self)
108    }
109    #[doc = "Bits 5:8 - Compensation Cap Cm2 Trim Value"]
110    #[inline(always)]
111    #[must_use]
112    pub fn cm2(&mut self) -> CM2_W<5> {
113        CM2_W::new(self)
114    }
115    #[doc = "Bits 10:11 - Compensation Cap Cm3 Trim Value"]
116    #[inline(always)]
117    #[must_use]
118    pub fn cm3(&mut self) -> CM3_W<10> {
119        CM3_W::new(self)
120    }
121    #[doc = "Bits 13:15 - Gm Trim Value"]
122    #[inline(always)]
123    #[must_use]
124    pub fn gm(&mut self) -> GM_W<13> {
125        GM_W::new(self)
126    }
127    #[doc = "Bits 17:18 - Gm3 Trim Value"]
128    #[inline(always)]
129    #[must_use]
130    pub fn gm3(&mut self) -> GM3_W<17> {
131        GM3_W::new(self)
132    }
133    #[doc = "Bits 20:24 - OPAx Non-Inverting Input Offset Configuration Value"]
134    #[inline(always)]
135    #[must_use]
136    pub fn offsetp(&mut self) -> OFFSETP_W<20> {
137        OFFSETP_W::new(self)
138    }
139    #[doc = "Bits 26:30 - OPAx Inverting Input Offset Configuration Value"]
140    #[inline(always)]
141    #[must_use]
142    pub fn offsetn(&mut self) -> OFFSETN_W<26> {
143        OFFSETN_W::new(self)
144    }
145    #[doc = "Writes raw bits to the register."]
146    #[inline(always)]
147    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
148        self.0.bits(bits);
149        self
150    }
151}
152#[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 [opa1_cal](index.html) module"]
153pub struct OPA1_CAL_SPEC;
154impl crate::RegisterSpec for OPA1_CAL_SPEC {
155    type Ux = u32;
156}
157#[doc = "`read()` method returns [opa1_cal::R](R) reader structure"]
158impl crate::Readable for OPA1_CAL_SPEC {
159    type Reader = R;
160}
161#[doc = "`write(|w| ..)` method takes [opa1_cal::W](W) writer structure"]
162impl crate::Writable for OPA1_CAL_SPEC {
163    type Writer = W;
164    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
165    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
166}
167#[doc = "`reset()` method sets OPA1_CAL to value 0x80e7"]
168impl crate::Resettable for OPA1_CAL_SPEC {
169    const RESET_VALUE: Self::Ux = 0x80e7;
170}