d1_pac/gpio/
pe_pull0.rs

1#[doc = "Register `pe_pull0` reader"]
2pub type R = crate::R<PE_PULL0_SPEC>;
3#[doc = "Register `pe_pull0` writer"]
4pub type W = crate::W<PE_PULL0_SPEC>;
5#[doc = "Field `pe_pull[0-15]` reader - PE Pull_up/down Select"]
6pub type PE_PULL_R = crate::FieldReader<PE_PULL_A>;
7#[doc = "PE Pull_up/down Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum PE_PULL_A {
11    #[doc = "0: `0`"]
12    PULL_DISABLE = 0,
13    #[doc = "1: `1`"]
14    PULL_UP = 1,
15    #[doc = "2: `10`"]
16    PULL_DOWN = 2,
17}
18impl From<PE_PULL_A> for u8 {
19    #[inline(always)]
20    fn from(variant: PE_PULL_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for PE_PULL_A {
25    type Ux = u8;
26}
27impl PE_PULL_R {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> PE_PULL_A {
31        match self.bits {
32            0 => PE_PULL_A::PULL_DISABLE,
33            1 => PE_PULL_A::PULL_UP,
34            2 => PE_PULL_A::PULL_DOWN,
35            _ => unreachable!(),
36        }
37    }
38    #[doc = "`0`"]
39    #[inline(always)]
40    pub fn is_pull_disable(&self) -> bool {
41        *self == PE_PULL_A::PULL_DISABLE
42    }
43    #[doc = "`1`"]
44    #[inline(always)]
45    pub fn is_pull_up(&self) -> bool {
46        *self == PE_PULL_A::PULL_UP
47    }
48    #[doc = "`10`"]
49    #[inline(always)]
50    pub fn is_pull_down(&self) -> bool {
51        *self == PE_PULL_A::PULL_DOWN
52    }
53}
54#[doc = "Field `pe_pull[0-15]` writer - PE Pull_up/down Select"]
55pub type PE_PULL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PE_PULL_A>;
56impl<'a, REG> PE_PULL_W<'a, REG>
57where
58    REG: crate::Writable + crate::RegisterSpec,
59    REG::Ux: From<u8>,
60{
61    #[doc = "`0`"]
62    #[inline(always)]
63    pub fn pull_disable(self) -> &'a mut crate::W<REG> {
64        self.variant(PE_PULL_A::PULL_DISABLE)
65    }
66    #[doc = "`1`"]
67    #[inline(always)]
68    pub fn pull_up(self) -> &'a mut crate::W<REG> {
69        self.variant(PE_PULL_A::PULL_UP)
70    }
71    #[doc = "`10`"]
72    #[inline(always)]
73    pub fn pull_down(self) -> &'a mut crate::W<REG> {
74        self.variant(PE_PULL_A::PULL_DOWN)
75    }
76}
77impl R {
78    #[doc = "PE Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pe0_pull` field"]
79    #[inline(always)]
80    pub fn pe_pull(&self, n: u8) -> PE_PULL_R {
81        #[allow(clippy::no_effect)]
82        [(); 16][n as usize];
83        PE_PULL_R::new(((self.bits >> (n * 2)) & 3) as u8)
84    }
85    #[doc = "Bits 0:1 - PE Pull_up/down Select"]
86    #[inline(always)]
87    pub fn pe0_pull(&self) -> PE_PULL_R {
88        PE_PULL_R::new((self.bits & 3) as u8)
89    }
90    #[doc = "Bits 2:3 - PE Pull_up/down Select"]
91    #[inline(always)]
92    pub fn pe1_pull(&self) -> PE_PULL_R {
93        PE_PULL_R::new(((self.bits >> 2) & 3) as u8)
94    }
95    #[doc = "Bits 4:5 - PE Pull_up/down Select"]
96    #[inline(always)]
97    pub fn pe2_pull(&self) -> PE_PULL_R {
98        PE_PULL_R::new(((self.bits >> 4) & 3) as u8)
99    }
100    #[doc = "Bits 6:7 - PE Pull_up/down Select"]
101    #[inline(always)]
102    pub fn pe3_pull(&self) -> PE_PULL_R {
103        PE_PULL_R::new(((self.bits >> 6) & 3) as u8)
104    }
105    #[doc = "Bits 8:9 - PE Pull_up/down Select"]
106    #[inline(always)]
107    pub fn pe4_pull(&self) -> PE_PULL_R {
108        PE_PULL_R::new(((self.bits >> 8) & 3) as u8)
109    }
110    #[doc = "Bits 10:11 - PE Pull_up/down Select"]
111    #[inline(always)]
112    pub fn pe5_pull(&self) -> PE_PULL_R {
113        PE_PULL_R::new(((self.bits >> 10) & 3) as u8)
114    }
115    #[doc = "Bits 12:13 - PE Pull_up/down Select"]
116    #[inline(always)]
117    pub fn pe6_pull(&self) -> PE_PULL_R {
118        PE_PULL_R::new(((self.bits >> 12) & 3) as u8)
119    }
120    #[doc = "Bits 14:15 - PE Pull_up/down Select"]
121    #[inline(always)]
122    pub fn pe7_pull(&self) -> PE_PULL_R {
123        PE_PULL_R::new(((self.bits >> 14) & 3) as u8)
124    }
125    #[doc = "Bits 16:17 - PE Pull_up/down Select"]
126    #[inline(always)]
127    pub fn pe8_pull(&self) -> PE_PULL_R {
128        PE_PULL_R::new(((self.bits >> 16) & 3) as u8)
129    }
130    #[doc = "Bits 18:19 - PE Pull_up/down Select"]
131    #[inline(always)]
132    pub fn pe9_pull(&self) -> PE_PULL_R {
133        PE_PULL_R::new(((self.bits >> 18) & 3) as u8)
134    }
135    #[doc = "Bits 20:21 - PE Pull_up/down Select"]
136    #[inline(always)]
137    pub fn pe10_pull(&self) -> PE_PULL_R {
138        PE_PULL_R::new(((self.bits >> 20) & 3) as u8)
139    }
140    #[doc = "Bits 22:23 - PE Pull_up/down Select"]
141    #[inline(always)]
142    pub fn pe11_pull(&self) -> PE_PULL_R {
143        PE_PULL_R::new(((self.bits >> 22) & 3) as u8)
144    }
145    #[doc = "Bits 24:25 - PE Pull_up/down Select"]
146    #[inline(always)]
147    pub fn pe12_pull(&self) -> PE_PULL_R {
148        PE_PULL_R::new(((self.bits >> 24) & 3) as u8)
149    }
150    #[doc = "Bits 26:27 - PE Pull_up/down Select"]
151    #[inline(always)]
152    pub fn pe13_pull(&self) -> PE_PULL_R {
153        PE_PULL_R::new(((self.bits >> 26) & 3) as u8)
154    }
155    #[doc = "Bits 28:29 - PE Pull_up/down Select"]
156    #[inline(always)]
157    pub fn pe14_pull(&self) -> PE_PULL_R {
158        PE_PULL_R::new(((self.bits >> 28) & 3) as u8)
159    }
160    #[doc = "Bits 30:31 - PE Pull_up/down Select"]
161    #[inline(always)]
162    pub fn pe15_pull(&self) -> PE_PULL_R {
163        PE_PULL_R::new(((self.bits >> 30) & 3) as u8)
164    }
165}
166impl W {
167    #[doc = "PE Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pe0_pull` field"]
168    #[inline(always)]
169    #[must_use]
170    pub fn pe_pull(&mut self, n: u8) -> PE_PULL_W<PE_PULL0_SPEC> {
171        #[allow(clippy::no_effect)]
172        [(); 16][n as usize];
173        PE_PULL_W::new(self, n * 2)
174    }
175    #[doc = "Bits 0:1 - PE Pull_up/down Select"]
176    #[inline(always)]
177    #[must_use]
178    pub fn pe0_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
179        PE_PULL_W::new(self, 0)
180    }
181    #[doc = "Bits 2:3 - PE Pull_up/down Select"]
182    #[inline(always)]
183    #[must_use]
184    pub fn pe1_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
185        PE_PULL_W::new(self, 2)
186    }
187    #[doc = "Bits 4:5 - PE Pull_up/down Select"]
188    #[inline(always)]
189    #[must_use]
190    pub fn pe2_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
191        PE_PULL_W::new(self, 4)
192    }
193    #[doc = "Bits 6:7 - PE Pull_up/down Select"]
194    #[inline(always)]
195    #[must_use]
196    pub fn pe3_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
197        PE_PULL_W::new(self, 6)
198    }
199    #[doc = "Bits 8:9 - PE Pull_up/down Select"]
200    #[inline(always)]
201    #[must_use]
202    pub fn pe4_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
203        PE_PULL_W::new(self, 8)
204    }
205    #[doc = "Bits 10:11 - PE Pull_up/down Select"]
206    #[inline(always)]
207    #[must_use]
208    pub fn pe5_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
209        PE_PULL_W::new(self, 10)
210    }
211    #[doc = "Bits 12:13 - PE Pull_up/down Select"]
212    #[inline(always)]
213    #[must_use]
214    pub fn pe6_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
215        PE_PULL_W::new(self, 12)
216    }
217    #[doc = "Bits 14:15 - PE Pull_up/down Select"]
218    #[inline(always)]
219    #[must_use]
220    pub fn pe7_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
221        PE_PULL_W::new(self, 14)
222    }
223    #[doc = "Bits 16:17 - PE Pull_up/down Select"]
224    #[inline(always)]
225    #[must_use]
226    pub fn pe8_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
227        PE_PULL_W::new(self, 16)
228    }
229    #[doc = "Bits 18:19 - PE Pull_up/down Select"]
230    #[inline(always)]
231    #[must_use]
232    pub fn pe9_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
233        PE_PULL_W::new(self, 18)
234    }
235    #[doc = "Bits 20:21 - PE Pull_up/down Select"]
236    #[inline(always)]
237    #[must_use]
238    pub fn pe10_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
239        PE_PULL_W::new(self, 20)
240    }
241    #[doc = "Bits 22:23 - PE Pull_up/down Select"]
242    #[inline(always)]
243    #[must_use]
244    pub fn pe11_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
245        PE_PULL_W::new(self, 22)
246    }
247    #[doc = "Bits 24:25 - PE Pull_up/down Select"]
248    #[inline(always)]
249    #[must_use]
250    pub fn pe12_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
251        PE_PULL_W::new(self, 24)
252    }
253    #[doc = "Bits 26:27 - PE Pull_up/down Select"]
254    #[inline(always)]
255    #[must_use]
256    pub fn pe13_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
257        PE_PULL_W::new(self, 26)
258    }
259    #[doc = "Bits 28:29 - PE Pull_up/down Select"]
260    #[inline(always)]
261    #[must_use]
262    pub fn pe14_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
263        PE_PULL_W::new(self, 28)
264    }
265    #[doc = "Bits 30:31 - PE Pull_up/down Select"]
266    #[inline(always)]
267    #[must_use]
268    pub fn pe15_pull(&mut self) -> PE_PULL_W<PE_PULL0_SPEC> {
269        PE_PULL_W::new(self, 30)
270    }
271    #[doc = r" Writes raw bits to the register."]
272    #[doc = r""]
273    #[doc = r" # Safety"]
274    #[doc = r""]
275    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
276    #[inline(always)]
277    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
278        self.bits = bits;
279        self
280    }
281}
282#[doc = "PE Pull Register 0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pe_pull0::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`pe_pull0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
283pub struct PE_PULL0_SPEC;
284impl crate::RegisterSpec for PE_PULL0_SPEC {
285    type Ux = u32;
286}
287#[doc = "`read()` method returns [`pe_pull0::R`](R) reader structure"]
288impl crate::Readable for PE_PULL0_SPEC {}
289#[doc = "`write(|w| ..)` method takes [`pe_pull0::W`](W) writer structure"]
290impl crate::Writable for PE_PULL0_SPEC {
291    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
292    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
293}
294#[doc = "`reset()` method sets pe_pull0 to value 0"]
295impl crate::Resettable for PE_PULL0_SPEC {
296    const RESET_VALUE: Self::Ux = 0;
297}