bl602_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_clk_ana_inv` reader - "]
53pub type GPADC_CLK_ANA_INV_R = crate::BitReader<bool>;
54#[doc = "Field `gpadc_clk_ana_inv` writer - "]
55pub type GPADC_CLK_ANA_INV_W<'a, const O: u8> =
56    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
57#[doc = "Field `gpadc_clk_div_ratio` reader - "]
58pub type GPADC_CLK_DIV_RATIO_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `gpadc_clk_div_ratio` writer - "]
60pub type GPADC_CLK_DIV_RATIO_W<'a, const O: u8> =
61    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 3, O>;
62#[doc = "Field `gpadc_scan_length` reader - "]
63pub type GPADC_SCAN_LENGTH_R = crate::FieldReader<u8, u8>;
64#[doc = "Field `gpadc_scan_length` writer - "]
65pub type GPADC_SCAN_LENGTH_W<'a, const O: u8> =
66    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 4, O>;
67#[doc = "Field `gpadc_scan_en` reader - "]
68pub type GPADC_SCAN_EN_R = crate::BitReader<bool>;
69#[doc = "Field `gpadc_scan_en` writer - "]
70pub type GPADC_SCAN_EN_W<'a, const O: u8> =
71    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
72#[doc = "Field `gpadc_dither_en` reader - "]
73pub type GPADC_DITHER_EN_R = crate::BitReader<bool>;
74#[doc = "Field `gpadc_dither_en` writer - "]
75pub type GPADC_DITHER_EN_W<'a, const O: u8> =
76    crate::BitWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, bool, O>;
77#[doc = "Field `gpadc_v11_sel` reader - "]
78pub type GPADC_V11_SEL_R = crate::FieldReader<u8, u8>;
79#[doc = "Field `gpadc_v11_sel` writer - "]
80pub type GPADC_V11_SEL_W<'a, const O: u8> =
81    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 2, O>;
82#[doc = "Field `gpadc_v18_sel` reader - "]
83pub type GPADC_V18_SEL_R = crate::FieldReader<u8, u8>;
84#[doc = "Field `gpadc_v18_sel` writer - "]
85pub type GPADC_V18_SEL_W<'a, const O: u8> =
86    crate::FieldWriter<'a, u32, GPADC_REG_CONFIG1_SPEC, u8, u8, 2, O>;
87impl R {
88    #[doc = "Bit 0"]
89    #[inline(always)]
90    pub fn gpadc_cal_os_en(&self) -> GPADC_CAL_OS_EN_R {
91        GPADC_CAL_OS_EN_R::new((self.bits & 1) != 0)
92    }
93    #[doc = "Bit 1"]
94    #[inline(always)]
95    pub fn gpadc_cont_conv_en(&self) -> GPADC_CONT_CONV_EN_R {
96        GPADC_CONT_CONV_EN_R::new(((self.bits >> 1) & 1) != 0)
97    }
98    #[doc = "Bits 2:4"]
99    #[inline(always)]
100    pub fn gpadc_res_sel(&self) -> GPADC_RES_SEL_R {
101        GPADC_RES_SEL_R::new(((self.bits >> 2) & 7) as u8)
102    }
103    #[doc = "Bit 17"]
104    #[inline(always)]
105    pub fn gpadc_clk_ana_inv(&self) -> GPADC_CLK_ANA_INV_R {
106        GPADC_CLK_ANA_INV_R::new(((self.bits >> 17) & 1) != 0)
107    }
108    #[doc = "Bits 18:20"]
109    #[inline(always)]
110    pub fn gpadc_clk_div_ratio(&self) -> GPADC_CLK_DIV_RATIO_R {
111        GPADC_CLK_DIV_RATIO_R::new(((self.bits >> 18) & 7) as u8)
112    }
113    #[doc = "Bits 21:24"]
114    #[inline(always)]
115    pub fn gpadc_scan_length(&self) -> GPADC_SCAN_LENGTH_R {
116        GPADC_SCAN_LENGTH_R::new(((self.bits >> 21) & 0x0f) as u8)
117    }
118    #[doc = "Bit 25"]
119    #[inline(always)]
120    pub fn gpadc_scan_en(&self) -> GPADC_SCAN_EN_R {
121        GPADC_SCAN_EN_R::new(((self.bits >> 25) & 1) != 0)
122    }
123    #[doc = "Bit 26"]
124    #[inline(always)]
125    pub fn gpadc_dither_en(&self) -> GPADC_DITHER_EN_R {
126        GPADC_DITHER_EN_R::new(((self.bits >> 26) & 1) != 0)
127    }
128    #[doc = "Bits 27:28"]
129    #[inline(always)]
130    pub fn gpadc_v11_sel(&self) -> GPADC_V11_SEL_R {
131        GPADC_V11_SEL_R::new(((self.bits >> 27) & 3) as u8)
132    }
133    #[doc = "Bits 29:30"]
134    #[inline(always)]
135    pub fn gpadc_v18_sel(&self) -> GPADC_V18_SEL_R {
136        GPADC_V18_SEL_R::new(((self.bits >> 29) & 3) as u8)
137    }
138}
139impl W {
140    #[doc = "Bit 0"]
141    #[inline(always)]
142    #[must_use]
143    pub fn gpadc_cal_os_en(&mut self) -> GPADC_CAL_OS_EN_W<0> {
144        GPADC_CAL_OS_EN_W::new(self)
145    }
146    #[doc = "Bit 1"]
147    #[inline(always)]
148    #[must_use]
149    pub fn gpadc_cont_conv_en(&mut self) -> GPADC_CONT_CONV_EN_W<1> {
150        GPADC_CONT_CONV_EN_W::new(self)
151    }
152    #[doc = "Bits 2:4"]
153    #[inline(always)]
154    #[must_use]
155    pub fn gpadc_res_sel(&mut self) -> GPADC_RES_SEL_W<2> {
156        GPADC_RES_SEL_W::new(self)
157    }
158    #[doc = "Bit 17"]
159    #[inline(always)]
160    #[must_use]
161    pub fn gpadc_clk_ana_inv(&mut self) -> GPADC_CLK_ANA_INV_W<17> {
162        GPADC_CLK_ANA_INV_W::new(self)
163    }
164    #[doc = "Bits 18:20"]
165    #[inline(always)]
166    #[must_use]
167    pub fn gpadc_clk_div_ratio(&mut self) -> GPADC_CLK_DIV_RATIO_W<18> {
168        GPADC_CLK_DIV_RATIO_W::new(self)
169    }
170    #[doc = "Bits 21:24"]
171    #[inline(always)]
172    #[must_use]
173    pub fn gpadc_scan_length(&mut self) -> GPADC_SCAN_LENGTH_W<21> {
174        GPADC_SCAN_LENGTH_W::new(self)
175    }
176    #[doc = "Bit 25"]
177    #[inline(always)]
178    #[must_use]
179    pub fn gpadc_scan_en(&mut self) -> GPADC_SCAN_EN_W<25> {
180        GPADC_SCAN_EN_W::new(self)
181    }
182    #[doc = "Bit 26"]
183    #[inline(always)]
184    #[must_use]
185    pub fn gpadc_dither_en(&mut self) -> GPADC_DITHER_EN_W<26> {
186        GPADC_DITHER_EN_W::new(self)
187    }
188    #[doc = "Bits 27:28"]
189    #[inline(always)]
190    #[must_use]
191    pub fn gpadc_v11_sel(&mut self) -> GPADC_V11_SEL_W<27> {
192        GPADC_V11_SEL_W::new(self)
193    }
194    #[doc = "Bits 29:30"]
195    #[inline(always)]
196    #[must_use]
197    pub fn gpadc_v18_sel(&mut self) -> GPADC_V18_SEL_W<29> {
198        GPADC_V18_SEL_W::new(self)
199    }
200    #[doc = "Writes raw bits to the register."]
201    #[inline(always)]
202    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
203        self.0.bits(bits);
204        self
205    }
206}
207#[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"]
208pub struct GPADC_REG_CONFIG1_SPEC;
209impl crate::RegisterSpec for GPADC_REG_CONFIG1_SPEC {
210    type Ux = u32;
211}
212#[doc = "`read()` method returns [gpadc_reg_config1::R](R) reader structure"]
213impl crate::Readable for GPADC_REG_CONFIG1_SPEC {
214    type Reader = R;
215}
216#[doc = "`write(|w| ..)` method takes [gpadc_reg_config1::W](W) writer structure"]
217impl crate::Writable for GPADC_REG_CONFIG1_SPEC {
218    type Writer = W;
219    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
220    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
221}
222#[doc = "`reset()` method sets gpadc_reg_config1 to value 0x000c_0002"]
223impl crate::Resettable for GPADC_REG_CONFIG1_SPEC {
224    const RESET_VALUE: Self::Ux = 0x000c_0002;
225}