bl602_pac/gpip/
gpadc_config.rs

1#[doc = "Register `gpadc_config` reader"]
2pub struct R(crate::R<GPADC_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GPADC_CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GPADC_CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GPADC_CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `gpadc_config` writer"]
17pub struct W(crate::W<GPADC_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GPADC_CONFIG_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_CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GPADC_CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `gpadc_dma_en` reader - "]
38pub type GPADC_DMA_EN_R = crate::BitReader<bool>;
39#[doc = "Field `gpadc_dma_en` writer - "]
40pub type GPADC_DMA_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
41#[doc = "Field `gpadc_fifo_clr` reader - "]
42pub type GPADC_FIFO_CLR_R = crate::BitReader<bool>;
43#[doc = "Field `gpadc_fifo_clr` writer - "]
44pub type GPADC_FIFO_CLR_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
45#[doc = "Field `gpadc_fifo_ne` reader - "]
46pub type GPADC_FIFO_NE_R = crate::BitReader<bool>;
47#[doc = "Field `gpadc_fifo_full` reader - "]
48pub type GPADC_FIFO_FULL_R = crate::BitReader<bool>;
49#[doc = "Field `gpadc_rdy` reader - "]
50pub type GPADC_RDY_R = crate::BitReader<bool>;
51#[doc = "Field `gpadc_fifo_overrun` reader - "]
52pub type GPADC_FIFO_OVERRUN_R = crate::BitReader<bool>;
53#[doc = "Field `gpadc_fifo_underrun` reader - "]
54pub type GPADC_FIFO_UNDERRUN_R = crate::BitReader<bool>;
55#[doc = "Field `gpadc_rdy_clr` reader - "]
56pub type GPADC_RDY_CLR_R = crate::BitReader<bool>;
57#[doc = "Field `gpadc_rdy_clr` writer - "]
58pub type GPADC_RDY_CLR_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
59#[doc = "Field `gpadc_fifo_overrun_clr` reader - "]
60pub type GPADC_FIFO_OVERRUN_CLR_R = crate::BitReader<bool>;
61#[doc = "Field `gpadc_fifo_overrun_clr` writer - "]
62pub type GPADC_FIFO_OVERRUN_CLR_W<'a, const O: u8> =
63    crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
64#[doc = "Field `gpadc_fifo_underrun_clr` reader - "]
65pub type GPADC_FIFO_UNDERRUN_CLR_R = crate::BitReader<bool>;
66#[doc = "Field `gpadc_fifo_underrun_clr` writer - "]
67pub type GPADC_FIFO_UNDERRUN_CLR_W<'a, const O: u8> =
68    crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
69#[doc = "Field `gpadc_rdy_mask` reader - "]
70pub type GPADC_RDY_MASK_R = crate::BitReader<bool>;
71#[doc = "Field `gpadc_rdy_mask` writer - "]
72pub type GPADC_RDY_MASK_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
73#[doc = "Field `gpadc_fifo_overrun_mask` reader - "]
74pub type GPADC_FIFO_OVERRUN_MASK_R = crate::BitReader<bool>;
75#[doc = "Field `gpadc_fifo_overrun_mask` writer - "]
76pub type GPADC_FIFO_OVERRUN_MASK_W<'a, const O: u8> =
77    crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
78#[doc = "Field `gpadc_fifo_underrun_mask` reader - "]
79pub type GPADC_FIFO_UNDERRUN_MASK_R = crate::BitReader<bool>;
80#[doc = "Field `gpadc_fifo_underrun_mask` writer - "]
81pub type GPADC_FIFO_UNDERRUN_MASK_W<'a, const O: u8> =
82    crate::BitWriter<'a, u32, GPADC_CONFIG_SPEC, bool, O>;
83#[doc = "Field `gpadc_fifo_data_count` reader - "]
84pub type GPADC_FIFO_DATA_COUNT_R = crate::FieldReader<u8, u8>;
85#[doc = "Field `gpadc_fifo_thl` reader - "]
86pub type GPADC_FIFO_THL_R = crate::FieldReader<u8, u8>;
87#[doc = "Field `gpadc_fifo_thl` writer - "]
88pub type GPADC_FIFO_THL_W<'a, const O: u8> =
89    crate::FieldWriter<'a, u32, GPADC_CONFIG_SPEC, u8, u8, 2, O>;
90#[doc = "Field `rsvd_31_24` reader - "]
91pub type RSVD_31_24_R = crate::FieldReader<u8, u8>;
92#[doc = "Field `rsvd_31_24` writer - "]
93pub type RSVD_31_24_W<'a, const O: u8> =
94    crate::FieldWriter<'a, u32, GPADC_CONFIG_SPEC, u8, u8, 8, O>;
95impl R {
96    #[doc = "Bit 0"]
97    #[inline(always)]
98    pub fn gpadc_dma_en(&self) -> GPADC_DMA_EN_R {
99        GPADC_DMA_EN_R::new((self.bits & 1) != 0)
100    }
101    #[doc = "Bit 1"]
102    #[inline(always)]
103    pub fn gpadc_fifo_clr(&self) -> GPADC_FIFO_CLR_R {
104        GPADC_FIFO_CLR_R::new(((self.bits >> 1) & 1) != 0)
105    }
106    #[doc = "Bit 2"]
107    #[inline(always)]
108    pub fn gpadc_fifo_ne(&self) -> GPADC_FIFO_NE_R {
109        GPADC_FIFO_NE_R::new(((self.bits >> 2) & 1) != 0)
110    }
111    #[doc = "Bit 3"]
112    #[inline(always)]
113    pub fn gpadc_fifo_full(&self) -> GPADC_FIFO_FULL_R {
114        GPADC_FIFO_FULL_R::new(((self.bits >> 3) & 1) != 0)
115    }
116    #[doc = "Bit 4"]
117    #[inline(always)]
118    pub fn gpadc_rdy(&self) -> GPADC_RDY_R {
119        GPADC_RDY_R::new(((self.bits >> 4) & 1) != 0)
120    }
121    #[doc = "Bit 5"]
122    #[inline(always)]
123    pub fn gpadc_fifo_overrun(&self) -> GPADC_FIFO_OVERRUN_R {
124        GPADC_FIFO_OVERRUN_R::new(((self.bits >> 5) & 1) != 0)
125    }
126    #[doc = "Bit 6"]
127    #[inline(always)]
128    pub fn gpadc_fifo_underrun(&self) -> GPADC_FIFO_UNDERRUN_R {
129        GPADC_FIFO_UNDERRUN_R::new(((self.bits >> 6) & 1) != 0)
130    }
131    #[doc = "Bit 8"]
132    #[inline(always)]
133    pub fn gpadc_rdy_clr(&self) -> GPADC_RDY_CLR_R {
134        GPADC_RDY_CLR_R::new(((self.bits >> 8) & 1) != 0)
135    }
136    #[doc = "Bit 9"]
137    #[inline(always)]
138    pub fn gpadc_fifo_overrun_clr(&self) -> GPADC_FIFO_OVERRUN_CLR_R {
139        GPADC_FIFO_OVERRUN_CLR_R::new(((self.bits >> 9) & 1) != 0)
140    }
141    #[doc = "Bit 10"]
142    #[inline(always)]
143    pub fn gpadc_fifo_underrun_clr(&self) -> GPADC_FIFO_UNDERRUN_CLR_R {
144        GPADC_FIFO_UNDERRUN_CLR_R::new(((self.bits >> 10) & 1) != 0)
145    }
146    #[doc = "Bit 12"]
147    #[inline(always)]
148    pub fn gpadc_rdy_mask(&self) -> GPADC_RDY_MASK_R {
149        GPADC_RDY_MASK_R::new(((self.bits >> 12) & 1) != 0)
150    }
151    #[doc = "Bit 13"]
152    #[inline(always)]
153    pub fn gpadc_fifo_overrun_mask(&self) -> GPADC_FIFO_OVERRUN_MASK_R {
154        GPADC_FIFO_OVERRUN_MASK_R::new(((self.bits >> 13) & 1) != 0)
155    }
156    #[doc = "Bit 14"]
157    #[inline(always)]
158    pub fn gpadc_fifo_underrun_mask(&self) -> GPADC_FIFO_UNDERRUN_MASK_R {
159        GPADC_FIFO_UNDERRUN_MASK_R::new(((self.bits >> 14) & 1) != 0)
160    }
161    #[doc = "Bits 16:21"]
162    #[inline(always)]
163    pub fn gpadc_fifo_data_count(&self) -> GPADC_FIFO_DATA_COUNT_R {
164        GPADC_FIFO_DATA_COUNT_R::new(((self.bits >> 16) & 0x3f) as u8)
165    }
166    #[doc = "Bits 22:23"]
167    #[inline(always)]
168    pub fn gpadc_fifo_thl(&self) -> GPADC_FIFO_THL_R {
169        GPADC_FIFO_THL_R::new(((self.bits >> 22) & 3) as u8)
170    }
171    #[doc = "Bits 24:31"]
172    #[inline(always)]
173    pub fn rsvd_31_24(&self) -> RSVD_31_24_R {
174        RSVD_31_24_R::new(((self.bits >> 24) & 0xff) as u8)
175    }
176}
177impl W {
178    #[doc = "Bit 0"]
179    #[inline(always)]
180    #[must_use]
181    pub fn gpadc_dma_en(&mut self) -> GPADC_DMA_EN_W<0> {
182        GPADC_DMA_EN_W::new(self)
183    }
184    #[doc = "Bit 1"]
185    #[inline(always)]
186    #[must_use]
187    pub fn gpadc_fifo_clr(&mut self) -> GPADC_FIFO_CLR_W<1> {
188        GPADC_FIFO_CLR_W::new(self)
189    }
190    #[doc = "Bit 8"]
191    #[inline(always)]
192    #[must_use]
193    pub fn gpadc_rdy_clr(&mut self) -> GPADC_RDY_CLR_W<8> {
194        GPADC_RDY_CLR_W::new(self)
195    }
196    #[doc = "Bit 9"]
197    #[inline(always)]
198    #[must_use]
199    pub fn gpadc_fifo_overrun_clr(&mut self) -> GPADC_FIFO_OVERRUN_CLR_W<9> {
200        GPADC_FIFO_OVERRUN_CLR_W::new(self)
201    }
202    #[doc = "Bit 10"]
203    #[inline(always)]
204    #[must_use]
205    pub fn gpadc_fifo_underrun_clr(&mut self) -> GPADC_FIFO_UNDERRUN_CLR_W<10> {
206        GPADC_FIFO_UNDERRUN_CLR_W::new(self)
207    }
208    #[doc = "Bit 12"]
209    #[inline(always)]
210    #[must_use]
211    pub fn gpadc_rdy_mask(&mut self) -> GPADC_RDY_MASK_W<12> {
212        GPADC_RDY_MASK_W::new(self)
213    }
214    #[doc = "Bit 13"]
215    #[inline(always)]
216    #[must_use]
217    pub fn gpadc_fifo_overrun_mask(&mut self) -> GPADC_FIFO_OVERRUN_MASK_W<13> {
218        GPADC_FIFO_OVERRUN_MASK_W::new(self)
219    }
220    #[doc = "Bit 14"]
221    #[inline(always)]
222    #[must_use]
223    pub fn gpadc_fifo_underrun_mask(&mut self) -> GPADC_FIFO_UNDERRUN_MASK_W<14> {
224        GPADC_FIFO_UNDERRUN_MASK_W::new(self)
225    }
226    #[doc = "Bits 22:23"]
227    #[inline(always)]
228    #[must_use]
229    pub fn gpadc_fifo_thl(&mut self) -> GPADC_FIFO_THL_W<22> {
230        GPADC_FIFO_THL_W::new(self)
231    }
232    #[doc = "Bits 24:31"]
233    #[inline(always)]
234    #[must_use]
235    pub fn rsvd_31_24(&mut self) -> RSVD_31_24_W<24> {
236        RSVD_31_24_W::new(self)
237    }
238    #[doc = "Writes raw bits to the register."]
239    #[inline(always)]
240    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
241        self.0.bits(bits);
242        self
243    }
244}
245#[doc = "gpadc_config.\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_config](index.html) module"]
246pub struct GPADC_CONFIG_SPEC;
247impl crate::RegisterSpec for GPADC_CONFIG_SPEC {
248    type Ux = u32;
249}
250#[doc = "`read()` method returns [gpadc_config::R](R) reader structure"]
251impl crate::Readable for GPADC_CONFIG_SPEC {
252    type Reader = R;
253}
254#[doc = "`write(|w| ..)` method takes [gpadc_config::W](W) writer structure"]
255impl crate::Writable for GPADC_CONFIG_SPEC {
256    type Writer = W;
257    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
258    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
259}
260#[doc = "`reset()` method sets gpadc_config to value 0"]
261impl crate::Resettable for GPADC_CONFIG_SPEC {
262    const RESET_VALUE: Self::Ux = 0;
263}