bl702_pac/aon/
gpadc_reg_config1.rs

1#[doc = "Register `gpadc_reg_config1` reader"]
2pub struct R(crate::R<GPADC_REG_CONFIG1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GPADC_REG_CONFIG1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GPADC_REG_CONFIG1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GPADC_REG_CONFIG1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `gpadc_reg_config1` writer"]
17pub struct W(crate::W<GPADC_REG_CONFIG1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GPADC_REG_CONFIG1_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_CONFIG1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GPADC_REG_CONFIG1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `gpadc_cal_os_en` reader - "]
38pub type GPADC_CAL_OS_EN_R = crate::BitReader<bool>;
39#[doc = "Field `gpadc_cal_os_en` writer - "]
40pub type GPADC_CAL_OS_EN_W<'a, const O: u8> =
41    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
42#[doc = "Field `gpadc_cont_conv_en` reader - "]
43pub type GPADC_CONT_CONV_EN_R = crate::BitReader<bool>;
44#[doc = "Field `gpadc_cont_conv_en` writer - "]
45pub type GPADC_CONT_CONV_EN_W<'a, const O: u8> =
46    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
47#[doc = "Field `gpadc_res_sel` reader - "]
48pub type GPADC_RES_SEL_R = crate::FieldReader<u8, u8>;
49#[doc = "Field `gpadc_res_sel` writer - "]
50pub type GPADC_RES_SEL_W<'a, const O: u8> =
51    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 3, O>;
52#[doc = "Field `gpadc_vcm_sel_en` reader - "]
53pub type GPADC_VCM_SEL_EN_R = crate::BitReader<bool>;
54#[doc = "Field `gpadc_vcm_sel_en` writer - "]
55pub type GPADC_VCM_SEL_EN_W<'a, const O: u8> =
56    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
57#[doc = "Field `gpadc_vcm_hyst_sel` reader - "]
58pub type GPADC_VCM_HYST_SEL_R = crate::BitReader<bool>;
59#[doc = "Field `gpadc_vcm_hyst_sel` writer - "]
60pub type GPADC_VCM_HYST_SEL_W<'a, const O: u8> =
61    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
62#[doc = "Field `gpadc_lowv_det_en` reader - "]
63pub type GPADC_LOWV_DET_EN_R = crate::BitReader<bool>;
64#[doc = "Field `gpadc_lowv_det_en` writer - "]
65pub type GPADC_LOWV_DET_EN_W<'a, const O: u8> =
66    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
67#[doc = "Field `gpadc_clk_ana_inv` reader - "]
68pub type GPADC_CLK_ANA_INV_R = crate::BitReader<bool>;
69#[doc = "Field `gpadc_clk_ana_inv` writer - "]
70pub type GPADC_CLK_ANA_INV_W<'a, const O: u8> =
71    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
72#[doc = "Field `gpadc_clk_div_ratio` reader - "]
73pub type GPADC_CLK_DIV_RATIO_R = crate::FieldReader<u8, u8>;
74#[doc = "Field `gpadc_clk_div_ratio` writer - "]
75pub type GPADC_CLK_DIV_RATIO_W<'a, const O: u8> =
76    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 3, O>;
77#[doc = "Field `gpadc_scan_length` reader - "]
78pub type GPADC_SCAN_LENGTH_R = crate::FieldReader<u8, u8>;
79#[doc = "Field `gpadc_scan_length` writer - "]
80pub type GPADC_SCAN_LENGTH_W<'a, const O: u8> =
81    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 4, O>;
82#[doc = "Field `gpadc_scan_en` reader - "]
83pub type GPADC_SCAN_EN_R = crate::BitReader<bool>;
84#[doc = "Field `gpadc_scan_en` writer - "]
85pub type GPADC_SCAN_EN_W<'a, const O: u8> =
86    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
87#[doc = "Field `gpadc_dither_en` reader - "]
88pub type GPADC_DITHER_EN_R = crate::BitReader<bool>;
89#[doc = "Field `gpadc_dither_en` writer - "]
90pub type GPADC_DITHER_EN_W<'a, const O: u8> =
91    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
92#[doc = "Field `gpadc_v11_sel` reader - "]
93pub type GPADC_V11_SEL_R = crate::FieldReader<u8, u8>;
94#[doc = "Field `gpadc_v11_sel` writer - "]
95pub type GPADC_V11_SEL_W<'a, const O: u8> =
96    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 2, O>;
97#[doc = "Field `gpadc_v18_sel` reader - "]
98pub type GPADC_V18_SEL_R = crate::FieldReader<u8, u8>;
99#[doc = "Field `gpadc_v18_sel` writer - "]
100pub type GPADC_V18_SEL_W<'a, const O: u8> =
101    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 2, O>;
102impl R {
103    #[doc = "Bit 0"]
104    #[inline(always)]
105    pub fn gpadc_cal_os_en(&self) -> GPADC_CAL_OS_EN_R {
106        GPADC_CAL_OS_EN_R::new((self.bits & 1) != 0)
107    }
108    #[doc = "Bit 1"]
109    #[inline(always)]
110    pub fn gpadc_cont_conv_en(&self) -> GPADC_CONT_CONV_EN_R {
111        GPADC_CONT_CONV_EN_R::new(((self.bits >> 1) & 1) != 0)
112    }
113    #[doc = "Bits 2:4"]
114    #[inline(always)]
115    pub fn gpadc_res_sel(&self) -> GPADC_RES_SEL_R {
116        GPADC_RES_SEL_R::new(((self.bits >> 2) & 7) as u8)
117    }
118    #[doc = "Bit 8"]
119    #[inline(always)]
120    pub fn gpadc_vcm_sel_en(&self) -> GPADC_VCM_SEL_EN_R {
121        GPADC_VCM_SEL_EN_R::new(((self.bits >> 8) & 1) != 0)
122    }
123    #[doc = "Bit 9"]
124    #[inline(always)]
125    pub fn gpadc_vcm_hyst_sel(&self) -> GPADC_VCM_HYST_SEL_R {
126        GPADC_VCM_HYST_SEL_R::new(((self.bits >> 9) & 1) != 0)
127    }
128    #[doc = "Bit 10"]
129    #[inline(always)]
130    pub fn gpadc_lowv_det_en(&self) -> GPADC_LOWV_DET_EN_R {
131        GPADC_LOWV_DET_EN_R::new(((self.bits >> 10) & 1) != 0)
132    }
133    #[doc = "Bit 17"]
134    #[inline(always)]
135    pub fn gpadc_clk_ana_inv(&self) -> GPADC_CLK_ANA_INV_R {
136        GPADC_CLK_ANA_INV_R::new(((self.bits >> 17) & 1) != 0)
137    }
138    #[doc = "Bits 18:20"]
139    #[inline(always)]
140    pub fn gpadc_clk_div_ratio(&self) -> GPADC_CLK_DIV_RATIO_R {
141        GPADC_CLK_DIV_RATIO_R::new(((self.bits >> 18) & 7) as u8)
142    }
143    #[doc = "Bits 21:24"]
144    #[inline(always)]
145    pub fn gpadc_scan_length(&self) -> GPADC_SCAN_LENGTH_R {
146        GPADC_SCAN_LENGTH_R::new(((self.bits >> 21) & 0x0f) as u8)
147    }
148    #[doc = "Bit 25"]
149    #[inline(always)]
150    pub fn gpadc_scan_en(&self) -> GPADC_SCAN_EN_R {
151        GPADC_SCAN_EN_R::new(((self.bits >> 25) & 1) != 0)
152    }
153    #[doc = "Bit 26"]
154    #[inline(always)]
155    pub fn gpadc_dither_en(&self) -> GPADC_DITHER_EN_R {
156        GPADC_DITHER_EN_R::new(((self.bits >> 26) & 1) != 0)
157    }
158    #[doc = "Bits 27:28"]
159    #[inline(always)]
160    pub fn gpadc_v11_sel(&self) -> GPADC_V11_SEL_R {
161        GPADC_V11_SEL_R::new(((self.bits >> 27) & 3) as u8)
162    }
163    #[doc = "Bits 29:30"]
164    #[inline(always)]
165    pub fn gpadc_v18_sel(&self) -> GPADC_V18_SEL_R {
166        GPADC_V18_SEL_R::new(((self.bits >> 29) & 3) as u8)
167    }
168}
169impl W {
170    #[doc = "Bit 0"]
171    #[inline(always)]
172    #[must_use]
173    pub fn gpadc_cal_os_en(&mut self) -> GPADC_CAL_OS_EN_W<0> {
174        GPADC_CAL_OS_EN_W::new(self)
175    }
176    #[doc = "Bit 1"]
177    #[inline(always)]
178    #[must_use]
179    pub fn gpadc_cont_conv_en(&mut self) -> GPADC_CONT_CONV_EN_W<1> {
180        GPADC_CONT_CONV_EN_W::new(self)
181    }
182    #[doc = "Bits 2:4"]
183    #[inline(always)]
184    #[must_use]
185    pub fn gpadc_res_sel(&mut self) -> GPADC_RES_SEL_W<2> {
186        GPADC_RES_SEL_W::new(self)
187    }
188    #[doc = "Bit 8"]
189    #[inline(always)]
190    #[must_use]
191    pub fn gpadc_vcm_sel_en(&mut self) -> GPADC_VCM_SEL_EN_W<8> {
192        GPADC_VCM_SEL_EN_W::new(self)
193    }
194    #[doc = "Bit 9"]
195    #[inline(always)]
196    #[must_use]
197    pub fn gpadc_vcm_hyst_sel(&mut self) -> GPADC_VCM_HYST_SEL_W<9> {
198        GPADC_VCM_HYST_SEL_W::new(self)
199    }
200    #[doc = "Bit 10"]
201    #[inline(always)]
202    #[must_use]
203    pub fn gpadc_lowv_det_en(&mut self) -> GPADC_LOWV_DET_EN_W<10> {
204        GPADC_LOWV_DET_EN_W::new(self)
205    }
206    #[doc = "Bit 17"]
207    #[inline(always)]
208    #[must_use]
209    pub fn gpadc_clk_ana_inv(&mut self) -> GPADC_CLK_ANA_INV_W<17> {
210        GPADC_CLK_ANA_INV_W::new(self)
211    }
212    #[doc = "Bits 18:20"]
213    #[inline(always)]
214    #[must_use]
215    pub fn gpadc_clk_div_ratio(&mut self) -> GPADC_CLK_DIV_RATIO_W<18> {
216        GPADC_CLK_DIV_RATIO_W::new(self)
217    }
218    #[doc = "Bits 21:24"]
219    #[inline(always)]
220    #[must_use]
221    pub fn gpadc_scan_length(&mut self) -> GPADC_SCAN_LENGTH_W<21> {
222        GPADC_SCAN_LENGTH_W::new(self)
223    }
224    #[doc = "Bit 25"]
225    #[inline(always)]
226    #[must_use]
227    pub fn gpadc_scan_en(&mut self) -> GPADC_SCAN_EN_W<25> {
228        GPADC_SCAN_EN_W::new(self)
229    }
230    #[doc = "Bit 26"]
231    #[inline(always)]
232    #[must_use]
233    pub fn gpadc_dither_en(&mut self) -> GPADC_DITHER_EN_W<26> {
234        GPADC_DITHER_EN_W::new(self)
235    }
236    #[doc = "Bits 27:28"]
237    #[inline(always)]
238    #[must_use]
239    pub fn gpadc_v11_sel(&mut self) -> GPADC_V11_SEL_W<27> {
240        GPADC_V11_SEL_W::new(self)
241    }
242    #[doc = "Bits 29:30"]
243    #[inline(always)]
244    #[must_use]
245    pub fn gpadc_v18_sel(&mut self) -> GPADC_V18_SEL_W<29> {
246        GPADC_V18_SEL_W::new(self)
247    }
248    #[doc = "Writes raw bits to the register."]
249    #[inline(always)]
250    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
251        self.0.bits(bits);
252        self
253    }
254}
255#[doc = "gpadc_reg_config1.\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_config1](index.html) module"]
256pub struct GPADC_REG_CONFIG1_SPEC;
257impl crate::RegisterSpec for GPADC_REG_CONFIG1_SPEC {
258    type Ux = u32;
259}
260#[doc = "`read()` method returns [gpadc_reg_config1::R](R) reader structure"]
261impl crate::Readable for GPADC_REG_CONFIG1_SPEC {
262    type Reader = R;
263}
264#[doc = "`write(|w| ..)` method takes [gpadc_reg_config1::W](W) writer structure"]
265impl crate::Writable for GPADC_REG_CONFIG1_SPEC {
266    type Writer = W;
267    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
268    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
269}
270#[doc = "`reset()` method sets gpadc_reg_config1 to value 0"]
271impl crate::Resettable for GPADC_REG_CONFIG1_SPEC {
272    const RESET_VALUE: Self::Ux = 0;
273}