1#[doc = "Reader of register CAL"]
2pub type R = crate::R<u32, super::CAL>;
3#[doc = "Writer for register CAL"]
4pub type W = crate::W<u32, super::CAL>;
5#[doc = "Register CAL `reset()`'s with value 0x4078_4078"]
6impl crate::ResetValue for super::CAL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type { 0x4078_4078 }
10}
11#[doc = "Reader of field `SINGLEOFFSET`"]
12pub type SINGLEOFFSET_R = crate::R<u8, u8>;
13#[doc = "Write proxy for field `SINGLEOFFSET`"]
14pub struct SINGLEOFFSET_W<'a> {
15 w: &'a mut W,
16}
17impl<'a> SINGLEOFFSET_W<'a> {
18 #[doc = r"Writes raw bits to the field"]
19 #[inline(always)]
20 pub unsafe fn bits(self, value: u8) -> &'a mut W {
21 self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
22 self.w
23 }
24}
25#[doc = "Reader of field `SINGLEOFFSETINV`"]
26pub type SINGLEOFFSETINV_R = crate::R<u8, u8>;
27#[doc = "Write proxy for field `SINGLEOFFSETINV`"]
28pub struct SINGLEOFFSETINV_W<'a> {
29 w: &'a mut W,
30}
31impl<'a> SINGLEOFFSETINV_W<'a> {
32 #[doc = r"Writes raw bits to the field"]
33 #[inline(always)]
34 pub unsafe fn bits(self, value: u8) -> &'a mut W {
35 self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4);
36 self.w
37 }
38}
39#[doc = "Reader of field `SINGLEGAIN`"]
40pub type SINGLEGAIN_R = crate::R<u8, u8>;
41#[doc = "Write proxy for field `SINGLEGAIN`"]
42pub struct SINGLEGAIN_W<'a> {
43 w: &'a mut W,
44}
45impl<'a> SINGLEGAIN_W<'a> {
46 #[doc = r"Writes raw bits to the field"]
47 #[inline(always)]
48 pub unsafe fn bits(self, value: u8) -> &'a mut W {
49 self.w.bits = (self.w.bits & !(0x7f << 8)) | (((value as u32) & 0x7f) << 8);
50 self.w
51 }
52}
53#[doc = "Reader of field `OFFSETINVMODE`"]
54pub type OFFSETINVMODE_R = crate::R<bool, bool>;
55#[doc = "Write proxy for field `OFFSETINVMODE`"]
56pub struct OFFSETINVMODE_W<'a> {
57 w: &'a mut W,
58}
59impl<'a> OFFSETINVMODE_W<'a> {
60 #[doc = r"Sets the field bit"]
61 #[inline(always)]
62 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
63 #[doc = r"Clears the field bit"]
64 #[inline(always)]
65 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
66 #[doc = r"Writes raw bits to the field"]
67 #[inline(always)]
68 pub fn bit(self, value: bool) -> &'a mut W {
69 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
70 self.w
71 }
72}
73#[doc = "Reader of field `SCANOFFSET`"]
74pub type SCANOFFSET_R = crate::R<u8, u8>;
75#[doc = "Write proxy for field `SCANOFFSET`"]
76pub struct SCANOFFSET_W<'a> {
77 w: &'a mut W,
78}
79impl<'a> SCANOFFSET_W<'a> {
80 #[doc = r"Writes raw bits to the field"]
81 #[inline(always)]
82 pub unsafe fn bits(self, value: u8) -> &'a mut W {
83 self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
84 self.w
85 }
86}
87#[doc = "Reader of field `SCANOFFSETINV`"]
88pub type SCANOFFSETINV_R = crate::R<u8, u8>;
89#[doc = "Write proxy for field `SCANOFFSETINV`"]
90pub struct SCANOFFSETINV_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> SCANOFFSETINV_W<'a> {
94 #[doc = r"Writes raw bits to the field"]
95 #[inline(always)]
96 pub unsafe fn bits(self, value: u8) -> &'a mut W {
97 self.w.bits = (self.w.bits & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
98 self.w
99 }
100}
101#[doc = "Reader of field `SCANGAIN`"]
102pub type SCANGAIN_R = crate::R<u8, u8>;
103#[doc = "Write proxy for field `SCANGAIN`"]
104pub struct SCANGAIN_W<'a> {
105 w: &'a mut W,
106}
107impl<'a> SCANGAIN_W<'a> {
108 #[doc = r"Writes raw bits to the field"]
109 #[inline(always)]
110 pub unsafe fn bits(self, value: u8) -> &'a mut W {
111 self.w.bits = (self.w.bits & !(0x7f << 24)) | (((value as u32) & 0x7f) << 24);
112 self.w
113 }
114}
115#[doc = "Reader of field `CALEN`"]
116pub type CALEN_R = crate::R<bool, bool>;
117#[doc = "Write proxy for field `CALEN`"]
118pub struct CALEN_W<'a> {
119 w: &'a mut W,
120}
121impl<'a> CALEN_W<'a> {
122 #[doc = r"Sets the field bit"]
123 #[inline(always)]
124 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
125 #[doc = r"Clears the field bit"]
126 #[inline(always)]
127 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
128 #[doc = r"Writes raw bits to the field"]
129 #[inline(always)]
130 pub fn bit(self, value: bool) -> &'a mut W {
131 self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
132 self.w
133 }
134}
135impl R {
136 #[doc = "Bits 0:3 - Single Mode Offset Calibration Value for Differential or Positive Single-ended Mode"]
137 #[inline(always)]
138 pub fn singleoffset(&self) -> SINGLEOFFSET_R { SINGLEOFFSET_R::new((self.bits & 0x0f) as u8) }
139 #[doc = "Bits 4:7 - Single Mode Offset Calibration Value for Negative Single-ended Mode"]
140 #[inline(always)]
141 pub fn singleoffsetinv(&self) -> SINGLEOFFSETINV_R {
142 SINGLEOFFSETINV_R::new(((self.bits >> 4) & 0x0f) as u8)
143 }
144 #[doc = "Bits 8:14 - Single Mode Gain Calibration Value"]
145 #[inline(always)]
146 pub fn singlegain(&self) -> SINGLEGAIN_R { SINGLEGAIN_R::new(((self.bits >> 8) & 0x7f) as u8) }
147 #[doc = "Bit 15 - Negative Single-ended Offset Calibration is Enabled"]
148 #[inline(always)]
149 pub fn offsetinvmode(&self) -> OFFSETINVMODE_R {
150 OFFSETINVMODE_R::new(((self.bits >> 15) & 0x01) != 0)
151 }
152 #[doc = "Bits 16:19 - Scan Mode Offset Calibration Value for Differential or Positive Single-ended Mode"]
153 #[inline(always)]
154 pub fn scanoffset(&self) -> SCANOFFSET_R { SCANOFFSET_R::new(((self.bits >> 16) & 0x0f) as u8) }
155 #[doc = "Bits 20:23 - Scan Mode Offset Calibration Value for Negative Single-ended Mode"]
156 #[inline(always)]
157 pub fn scanoffsetinv(&self) -> SCANOFFSETINV_R {
158 SCANOFFSETINV_R::new(((self.bits >> 20) & 0x0f) as u8)
159 }
160 #[doc = "Bits 24:30 - Scan Mode Gain Calibration Value"]
161 #[inline(always)]
162 pub fn scangain(&self) -> SCANGAIN_R { SCANGAIN_R::new(((self.bits >> 24) & 0x7f) as u8) }
163 #[doc = "Bit 31 - Calibration Mode is Enabled"]
164 #[inline(always)]
165 pub fn calen(&self) -> CALEN_R { CALEN_R::new(((self.bits >> 31) & 0x01) != 0) }
166}
167impl W {
168 #[doc = "Bits 0:3 - Single Mode Offset Calibration Value for Differential or Positive Single-ended Mode"]
169 #[inline(always)]
170 pub fn singleoffset(&mut self) -> SINGLEOFFSET_W { SINGLEOFFSET_W { w: self } }
171 #[doc = "Bits 4:7 - Single Mode Offset Calibration Value for Negative Single-ended Mode"]
172 #[inline(always)]
173 pub fn singleoffsetinv(&mut self) -> SINGLEOFFSETINV_W { SINGLEOFFSETINV_W { w: self } }
174 #[doc = "Bits 8:14 - Single Mode Gain Calibration Value"]
175 #[inline(always)]
176 pub fn singlegain(&mut self) -> SINGLEGAIN_W { SINGLEGAIN_W { w: self } }
177 #[doc = "Bit 15 - Negative Single-ended Offset Calibration is Enabled"]
178 #[inline(always)]
179 pub fn offsetinvmode(&mut self) -> OFFSETINVMODE_W { OFFSETINVMODE_W { w: self } }
180 #[doc = "Bits 16:19 - Scan Mode Offset Calibration Value for Differential or Positive Single-ended Mode"]
181 #[inline(always)]
182 pub fn scanoffset(&mut self) -> SCANOFFSET_W { SCANOFFSET_W { w: self } }
183 #[doc = "Bits 20:23 - Scan Mode Offset Calibration Value for Negative Single-ended Mode"]
184 #[inline(always)]
185 pub fn scanoffsetinv(&mut self) -> SCANOFFSETINV_W { SCANOFFSETINV_W { w: self } }
186 #[doc = "Bits 24:30 - Scan Mode Gain Calibration Value"]
187 #[inline(always)]
188 pub fn scangain(&mut self) -> SCANGAIN_W { SCANGAIN_W { w: self } }
189 #[doc = "Bit 31 - Calibration Mode is Enabled"]
190 #[inline(always)]
191 pub fn calen(&mut self) -> CALEN_W { CALEN_W { w: self } }
192}