efm32pg12_pac/vdac0/
opa2_cal.rs

1#[doc = "Reader of register OPA2_CAL"]
2pub type R = crate::R<u32, super::OPA2_CAL>;
3#[doc = "Writer for register OPA2_CAL"]
4pub type W = crate::W<u32, super::OPA2_CAL>;
5#[doc = "Register OPA2_CAL `reset()`'s with value 0x80e7"]
6impl crate::ResetValue for super::OPA2_CAL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x80e7
11    }
12}
13#[doc = "Reader of field `CM1`"]
14pub type CM1_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `CM1`"]
16pub struct CM1_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> CM1_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
24        self.w
25    }
26}
27#[doc = "Reader of field `CM2`"]
28pub type CM2_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `CM2`"]
30pub struct CM2_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> CM2_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x0f << 5)) | (((value as u32) & 0x0f) << 5);
38        self.w
39    }
40}
41#[doc = "Reader of field `CM3`"]
42pub type CM3_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `CM3`"]
44pub struct CM3_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> CM3_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
52        self.w
53    }
54}
55#[doc = "Reader of field `GM`"]
56pub type GM_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `GM`"]
58pub struct GM_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> GM_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !(0x07 << 13)) | (((value as u32) & 0x07) << 13);
66        self.w
67    }
68}
69#[doc = "Reader of field `GM3`"]
70pub type GM3_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `GM3`"]
72pub struct GM3_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> GM3_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !(0x03 << 17)) | (((value as u32) & 0x03) << 17);
80        self.w
81    }
82}
83#[doc = "Reader of field `OFFSETP`"]
84pub type OFFSETP_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `OFFSETP`"]
86pub struct OFFSETP_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> OFFSETP_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !(0x1f << 20)) | (((value as u32) & 0x1f) << 20);
94        self.w
95    }
96}
97#[doc = "Reader of field `OFFSETN`"]
98pub type OFFSETN_R = crate::R<u8, u8>;
99#[doc = "Write proxy for field `OFFSETN`"]
100pub struct OFFSETN_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> OFFSETN_W<'a> {
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub unsafe fn bits(self, value: u8) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x1f << 26)) | (((value as u32) & 0x1f) << 26);
108        self.w
109    }
110}
111impl R {
112    #[doc = "Bits 0:3 - Compensation Cap Cm1 Trim Value"]
113    #[inline(always)]
114    pub fn cm1(&self) -> CM1_R {
115        CM1_R::new((self.bits & 0x0f) as u8)
116    }
117    #[doc = "Bits 5:8 - Compensation Cap Cm2 Trim Value"]
118    #[inline(always)]
119    pub fn cm2(&self) -> CM2_R {
120        CM2_R::new(((self.bits >> 5) & 0x0f) as u8)
121    }
122    #[doc = "Bits 10:11 - Compensation Cap Cm3 Trim Value"]
123    #[inline(always)]
124    pub fn cm3(&self) -> CM3_R {
125        CM3_R::new(((self.bits >> 10) & 0x03) as u8)
126    }
127    #[doc = "Bits 13:15 - Gm Trim Value"]
128    #[inline(always)]
129    pub fn gm(&self) -> GM_R {
130        GM_R::new(((self.bits >> 13) & 0x07) as u8)
131    }
132    #[doc = "Bits 17:18 - Gm3 Trim Value"]
133    #[inline(always)]
134    pub fn gm3(&self) -> GM3_R {
135        GM3_R::new(((self.bits >> 17) & 0x03) as u8)
136    }
137    #[doc = "Bits 20:24 - OPAx Non-Inverting Input Offset Configuration Value"]
138    #[inline(always)]
139    pub fn offsetp(&self) -> OFFSETP_R {
140        OFFSETP_R::new(((self.bits >> 20) & 0x1f) as u8)
141    }
142    #[doc = "Bits 26:30 - OPAx Inverting Input Offset Configuration Value"]
143    #[inline(always)]
144    pub fn offsetn(&self) -> OFFSETN_R {
145        OFFSETN_R::new(((self.bits >> 26) & 0x1f) as u8)
146    }
147}
148impl W {
149    #[doc = "Bits 0:3 - Compensation Cap Cm1 Trim Value"]
150    #[inline(always)]
151    pub fn cm1(&mut self) -> CM1_W {
152        CM1_W { w: self }
153    }
154    #[doc = "Bits 5:8 - Compensation Cap Cm2 Trim Value"]
155    #[inline(always)]
156    pub fn cm2(&mut self) -> CM2_W {
157        CM2_W { w: self }
158    }
159    #[doc = "Bits 10:11 - Compensation Cap Cm3 Trim Value"]
160    #[inline(always)]
161    pub fn cm3(&mut self) -> CM3_W {
162        CM3_W { w: self }
163    }
164    #[doc = "Bits 13:15 - Gm Trim Value"]
165    #[inline(always)]
166    pub fn gm(&mut self) -> GM_W {
167        GM_W { w: self }
168    }
169    #[doc = "Bits 17:18 - Gm3 Trim Value"]
170    #[inline(always)]
171    pub fn gm3(&mut self) -> GM3_W {
172        GM3_W { w: self }
173    }
174    #[doc = "Bits 20:24 - OPAx Non-Inverting Input Offset Configuration Value"]
175    #[inline(always)]
176    pub fn offsetp(&mut self) -> OFFSETP_W {
177        OFFSETP_W { w: self }
178    }
179    #[doc = "Bits 26:30 - OPAx Inverting Input Offset Configuration Value"]
180    #[inline(always)]
181    pub fn offsetn(&mut self) -> OFFSETN_W {
182        OFFSETN_W { w: self }
183    }
184}