bl702_pac/aon/
gpadc_reg_config2.rs

1#[doc = "Register `gpadc_reg_config2` reader"]
2pub struct R(crate::R<GPADC_REG_CONFIG2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GPADC_REG_CONFIG2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GPADC_REG_CONFIG2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GPADC_REG_CONFIG2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `gpadc_reg_config2` writer"]
17pub struct W(crate::W<GPADC_REG_CONFIG2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GPADC_REG_CONFIG2_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<GPADC_REG_CONFIG2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GPADC_REG_CONFIG2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `gpadc_diff_mode` reader - "]
38pub type GPADC_DIFF_MODE_R = crate::BitReader<bool>;
39#[doc = "Field `gpadc_diff_mode` writer - "]
40pub type GPADC_DIFF_MODE_W<'a, const O: u8> =
41    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
42#[doc = "Field `gpadc_vref_sel` reader - "]
43pub type GPADC_VREF_SEL_R = crate::BitReader<bool>;
44#[doc = "Field `gpadc_vref_sel` writer - "]
45pub type GPADC_VREF_SEL_W<'a, const O: u8> =
46    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
47#[doc = "Field `gpadc_vbat_en` reader - "]
48pub type GPADC_VBAT_EN_R = crate::BitReader<bool>;
49#[doc = "Field `gpadc_vbat_en` writer - "]
50pub type GPADC_VBAT_EN_W<'a, const O: u8> =
51    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
52#[doc = "Field `gpadc_tsext_sel` reader - "]
53pub type GPADC_TSEXT_SEL_R = crate::BitReader<bool>;
54#[doc = "Field `gpadc_tsext_sel` writer - "]
55pub type GPADC_TSEXT_SEL_W<'a, const O: u8> =
56    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
57#[doc = "Field `gpadc_ts_en` reader - "]
58pub type GPADC_TS_EN_R = crate::BitReader<bool>;
59#[doc = "Field `gpadc_ts_en` writer - "]
60pub type GPADC_TS_EN_W<'a, const O: u8> =
61    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
62#[doc = "Field `gpadc_pga_vcm` reader - "]
63pub type GPADC_PGA_VCM_R = crate::FieldReader<u8, u8>;
64#[doc = "Field `gpadc_pga_vcm` writer - "]
65pub type GPADC_PGA_VCM_W<'a, const O: u8> =
66    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 2, O>;
67#[doc = "Field `gpadc_pga_os_cal` reader - "]
68pub type GPADC_PGA_OS_CAL_R = crate::FieldReader<u8, u8>;
69#[doc = "Field `gpadc_pga_os_cal` writer - "]
70pub type GPADC_PGA_OS_CAL_W<'a, const O: u8> =
71    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 4, O>;
72#[doc = "Field `gpadc_pga_en` reader - "]
73pub type GPADC_PGA_EN_R = crate::BitReader<bool>;
74#[doc = "Field `gpadc_pga_en` writer - "]
75pub type GPADC_PGA_EN_W<'a, const O: u8> =
76    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
77#[doc = "Field `gpadc_pga_vcmi_en` reader - "]
78pub type GPADC_PGA_VCMI_EN_R = crate::BitReader<bool>;
79#[doc = "Field `gpadc_pga_vcmi_en` writer - "]
80pub type GPADC_PGA_VCMI_EN_W<'a, const O: u8> =
81    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
82#[doc = "Field `gpadc_chop_mode` reader - "]
83pub type GPADC_CHOP_MODE_R = crate::FieldReader<u8, u8>;
84#[doc = "Field `gpadc_chop_mode` writer - "]
85pub type GPADC_CHOP_MODE_W<'a, const O: u8> =
86    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 2, O>;
87#[doc = "Field `gpadc_bias_sel` reader - "]
88pub type GPADC_BIAS_SEL_R = crate::BitReader<bool>;
89#[doc = "Field `gpadc_bias_sel` writer - "]
90pub type GPADC_BIAS_SEL_W<'a, const O: u8> =
91    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
92#[doc = "Field `gpadc_test_en` reader - "]
93pub type GPADC_TEST_EN_R = crate::BitReader<bool>;
94#[doc = "Field `gpadc_test_en` writer - "]
95pub type GPADC_TEST_EN_W<'a, const O: u8> =
96    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
97#[doc = "Field `gpadc_test_sel` reader - "]
98pub type GPADC_TEST_SEL_R = crate::FieldReader<u8, u8>;
99#[doc = "Field `gpadc_test_sel` writer - "]
100pub type GPADC_TEST_SEL_W<'a, const O: u8> =
101    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 3, O>;
102#[doc = "Field `gpadc_pga2_gain` reader - "]
103pub type GPADC_PGA2_GAIN_R = crate::FieldReader<u8, u8>;
104#[doc = "Field `gpadc_pga2_gain` writer - "]
105pub type GPADC_PGA2_GAIN_W<'a, const O: u8> =
106    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 3, O>;
107#[doc = "Field `gpadc_pga1_gain` reader - "]
108pub type GPADC_PGA1_GAIN_R = crate::FieldReader<u8, u8>;
109#[doc = "Field `gpadc_pga1_gain` writer - "]
110pub type GPADC_PGA1_GAIN_W<'a, const O: u8> =
111    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 3, O>;
112#[doc = "Field `gpadc_dly_sel` reader - "]
113pub type GPADC_DLY_SEL_R = crate::FieldReader<u8, u8>;
114#[doc = "Field `gpadc_dly_sel` writer - "]
115pub type GPADC_DLY_SEL_W<'a, const O: u8> =
116    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, u8, u8, 3, O>;
117#[doc = "Field `gpadc_tsvbe_low` reader - "]
118pub type GPADC_TSVBE_LOW_R = crate::BitReader<bool>;
119#[doc = "Field `gpadc_tsvbe_low` writer - "]
120pub type GPADC_TSVBE_LOW_W<'a, const O: u8> =
121    crate::BitWriter<'a, u32, GPADC_REG_CONFIG2_SPEC, bool, O>;
122impl R {
123    #[doc = "Bit 2"]
124    #[inline(always)]
125    pub fn gpadc_diff_mode(&self) -> GPADC_DIFF_MODE_R {
126        GPADC_DIFF_MODE_R::new(((self.bits >> 2) & 1) != 0)
127    }
128    #[doc = "Bit 3"]
129    #[inline(always)]
130    pub fn gpadc_vref_sel(&self) -> GPADC_VREF_SEL_R {
131        GPADC_VREF_SEL_R::new(((self.bits >> 3) & 1) != 0)
132    }
133    #[doc = "Bit 4"]
134    #[inline(always)]
135    pub fn gpadc_vbat_en(&self) -> GPADC_VBAT_EN_R {
136        GPADC_VBAT_EN_R::new(((self.bits >> 4) & 1) != 0)
137    }
138    #[doc = "Bit 5"]
139    #[inline(always)]
140    pub fn gpadc_tsext_sel(&self) -> GPADC_TSEXT_SEL_R {
141        GPADC_TSEXT_SEL_R::new(((self.bits >> 5) & 1) != 0)
142    }
143    #[doc = "Bit 6"]
144    #[inline(always)]
145    pub fn gpadc_ts_en(&self) -> GPADC_TS_EN_R {
146        GPADC_TS_EN_R::new(((self.bits >> 6) & 1) != 0)
147    }
148    #[doc = "Bits 7:8"]
149    #[inline(always)]
150    pub fn gpadc_pga_vcm(&self) -> GPADC_PGA_VCM_R {
151        GPADC_PGA_VCM_R::new(((self.bits >> 7) & 3) as u8)
152    }
153    #[doc = "Bits 9:12"]
154    #[inline(always)]
155    pub fn gpadc_pga_os_cal(&self) -> GPADC_PGA_OS_CAL_R {
156        GPADC_PGA_OS_CAL_R::new(((self.bits >> 9) & 0x0f) as u8)
157    }
158    #[doc = "Bit 13"]
159    #[inline(always)]
160    pub fn gpadc_pga_en(&self) -> GPADC_PGA_EN_R {
161        GPADC_PGA_EN_R::new(((self.bits >> 13) & 1) != 0)
162    }
163    #[doc = "Bit 14"]
164    #[inline(always)]
165    pub fn gpadc_pga_vcmi_en(&self) -> GPADC_PGA_VCMI_EN_R {
166        GPADC_PGA_VCMI_EN_R::new(((self.bits >> 14) & 1) != 0)
167    }
168    #[doc = "Bits 15:16"]
169    #[inline(always)]
170    pub fn gpadc_chop_mode(&self) -> GPADC_CHOP_MODE_R {
171        GPADC_CHOP_MODE_R::new(((self.bits >> 15) & 3) as u8)
172    }
173    #[doc = "Bit 17"]
174    #[inline(always)]
175    pub fn gpadc_bias_sel(&self) -> GPADC_BIAS_SEL_R {
176        GPADC_BIAS_SEL_R::new(((self.bits >> 17) & 1) != 0)
177    }
178    #[doc = "Bit 18"]
179    #[inline(always)]
180    pub fn gpadc_test_en(&self) -> GPADC_TEST_EN_R {
181        GPADC_TEST_EN_R::new(((self.bits >> 18) & 1) != 0)
182    }
183    #[doc = "Bits 19:21"]
184    #[inline(always)]
185    pub fn gpadc_test_sel(&self) -> GPADC_TEST_SEL_R {
186        GPADC_TEST_SEL_R::new(((self.bits >> 19) & 7) as u8)
187    }
188    #[doc = "Bits 22:24"]
189    #[inline(always)]
190    pub fn gpadc_pga2_gain(&self) -> GPADC_PGA2_GAIN_R {
191        GPADC_PGA2_GAIN_R::new(((self.bits >> 22) & 7) as u8)
192    }
193    #[doc = "Bits 25:27"]
194    #[inline(always)]
195    pub fn gpadc_pga1_gain(&self) -> GPADC_PGA1_GAIN_R {
196        GPADC_PGA1_GAIN_R::new(((self.bits >> 25) & 7) as u8)
197    }
198    #[doc = "Bits 28:30"]
199    #[inline(always)]
200    pub fn gpadc_dly_sel(&self) -> GPADC_DLY_SEL_R {
201        GPADC_DLY_SEL_R::new(((self.bits >> 28) & 7) as u8)
202    }
203    #[doc = "Bit 31"]
204    #[inline(always)]
205    pub fn gpadc_tsvbe_low(&self) -> GPADC_TSVBE_LOW_R {
206        GPADC_TSVBE_LOW_R::new(((self.bits >> 31) & 1) != 0)
207    }
208}
209impl W {
210    #[doc = "Bit 2"]
211    #[inline(always)]
212    #[must_use]
213    pub fn gpadc_diff_mode(&mut self) -> GPADC_DIFF_MODE_W<2> {
214        GPADC_DIFF_MODE_W::new(self)
215    }
216    #[doc = "Bit 3"]
217    #[inline(always)]
218    #[must_use]
219    pub fn gpadc_vref_sel(&mut self) -> GPADC_VREF_SEL_W<3> {
220        GPADC_VREF_SEL_W::new(self)
221    }
222    #[doc = "Bit 4"]
223    #[inline(always)]
224    #[must_use]
225    pub fn gpadc_vbat_en(&mut self) -> GPADC_VBAT_EN_W<4> {
226        GPADC_VBAT_EN_W::new(self)
227    }
228    #[doc = "Bit 5"]
229    #[inline(always)]
230    #[must_use]
231    pub fn gpadc_tsext_sel(&mut self) -> GPADC_TSEXT_SEL_W<5> {
232        GPADC_TSEXT_SEL_W::new(self)
233    }
234    #[doc = "Bit 6"]
235    #[inline(always)]
236    #[must_use]
237    pub fn gpadc_ts_en(&mut self) -> GPADC_TS_EN_W<6> {
238        GPADC_TS_EN_W::new(self)
239    }
240    #[doc = "Bits 7:8"]
241    #[inline(always)]
242    #[must_use]
243    pub fn gpadc_pga_vcm(&mut self) -> GPADC_PGA_VCM_W<7> {
244        GPADC_PGA_VCM_W::new(self)
245    }
246    #[doc = "Bits 9:12"]
247    #[inline(always)]
248    #[must_use]
249    pub fn gpadc_pga_os_cal(&mut self) -> GPADC_PGA_OS_CAL_W<9> {
250        GPADC_PGA_OS_CAL_W::new(self)
251    }
252    #[doc = "Bit 13"]
253    #[inline(always)]
254    #[must_use]
255    pub fn gpadc_pga_en(&mut self) -> GPADC_PGA_EN_W<13> {
256        GPADC_PGA_EN_W::new(self)
257    }
258    #[doc = "Bit 14"]
259    #[inline(always)]
260    #[must_use]
261    pub fn gpadc_pga_vcmi_en(&mut self) -> GPADC_PGA_VCMI_EN_W<14> {
262        GPADC_PGA_VCMI_EN_W::new(self)
263    }
264    #[doc = "Bits 15:16"]
265    #[inline(always)]
266    #[must_use]
267    pub fn gpadc_chop_mode(&mut self) -> GPADC_CHOP_MODE_W<15> {
268        GPADC_CHOP_MODE_W::new(self)
269    }
270    #[doc = "Bit 17"]
271    #[inline(always)]
272    #[must_use]
273    pub fn gpadc_bias_sel(&mut self) -> GPADC_BIAS_SEL_W<17> {
274        GPADC_BIAS_SEL_W::new(self)
275    }
276    #[doc = "Bit 18"]
277    #[inline(always)]
278    #[must_use]
279    pub fn gpadc_test_en(&mut self) -> GPADC_TEST_EN_W<18> {
280        GPADC_TEST_EN_W::new(self)
281    }
282    #[doc = "Bits 19:21"]
283    #[inline(always)]
284    #[must_use]
285    pub fn gpadc_test_sel(&mut self) -> GPADC_TEST_SEL_W<19> {
286        GPADC_TEST_SEL_W::new(self)
287    }
288    #[doc = "Bits 22:24"]
289    #[inline(always)]
290    #[must_use]
291    pub fn gpadc_pga2_gain(&mut self) -> GPADC_PGA2_GAIN_W<22> {
292        GPADC_PGA2_GAIN_W::new(self)
293    }
294    #[doc = "Bits 25:27"]
295    #[inline(always)]
296    #[must_use]
297    pub fn gpadc_pga1_gain(&mut self) -> GPADC_PGA1_GAIN_W<25> {
298        GPADC_PGA1_GAIN_W::new(self)
299    }
300    #[doc = "Bits 28:30"]
301    #[inline(always)]
302    #[must_use]
303    pub fn gpadc_dly_sel(&mut self) -> GPADC_DLY_SEL_W<28> {
304        GPADC_DLY_SEL_W::new(self)
305    }
306    #[doc = "Bit 31"]
307    #[inline(always)]
308    #[must_use]
309    pub fn gpadc_tsvbe_low(&mut self) -> GPADC_TSVBE_LOW_W<31> {
310        GPADC_TSVBE_LOW_W::new(self)
311    }
312    #[doc = "Writes raw bits to the register."]
313    #[inline(always)]
314    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
315        self.0.bits(bits);
316        self
317    }
318}
319#[doc = "gpadc_reg_config2.\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 [gpadc_reg_config2](index.html) module"]
320pub struct GPADC_REG_CONFIG2_SPEC;
321impl crate::RegisterSpec for GPADC_REG_CONFIG2_SPEC {
322    type Ux = u32;
323}
324#[doc = "`read()` method returns [gpadc_reg_config2::R](R) reader structure"]
325impl crate::Readable for GPADC_REG_CONFIG2_SPEC {
326    type Reader = R;
327}
328#[doc = "`write(|w| ..)` method takes [gpadc_reg_config2::W](W) writer structure"]
329impl crate::Writable for GPADC_REG_CONFIG2_SPEC {
330    type Writer = W;
331    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
332    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
333}
334#[doc = "`reset()` method sets gpadc_reg_config2 to value 0"]
335impl crate::Resettable for GPADC_REG_CONFIG2_SPEC {
336    const RESET_VALUE: Self::Ux = 0;
337}