r528_pac/gpio/
pd_pull0.rs1#[doc = "Register `pd_pull0` reader"]
2pub struct R(crate::R<PD_PULL0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PD_PULL0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PD_PULL0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PD_PULL0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `pd_pull0` writer"]
17pub struct W(crate::W<PD_PULL0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PD_PULL0_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<PD_PULL0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PD_PULL0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "PD Pull_up/down Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum PD_PULL_A {
41 #[doc = "0: `0`"]
42 PULL_DISABLE = 0,
43 #[doc = "1: `1`"]
44 PULL_UP = 1,
45 #[doc = "2: `10`"]
46 PULL_DOWN = 2,
47}
48impl From<PD_PULL_A> for u8 {
49 #[inline(always)]
50 fn from(variant: PD_PULL_A) -> Self {
51 variant as _
52 }
53}
54#[doc = "Fields `PD(0-15)_PULL` reader - PD Pull_up/down Select"]
55pub type PD_PULL_R = crate::FieldReader<u8, PD_PULL_A>;
56impl PD_PULL_R {
57 #[doc = "Get enumerated values variant"]
58 #[inline(always)]
59 pub fn variant(&self) -> PD_PULL_A {
60 match self.bits {
61 0 => PD_PULL_A::PULL_DISABLE,
62 1 => PD_PULL_A::PULL_UP,
63 2 => PD_PULL_A::PULL_DOWN,
64 _ => unreachable!(),
65 }
66 }
67 #[doc = "Checks if the value of the field is `PULL_DISABLE`"]
68 #[inline(always)]
69 pub fn is_pull_disable(&self) -> bool {
70 *self == PD_PULL_A::PULL_DISABLE
71 }
72 #[doc = "Checks if the value of the field is `PULL_UP`"]
73 #[inline(always)]
74 pub fn is_pull_up(&self) -> bool {
75 *self == PD_PULL_A::PULL_UP
76 }
77 #[doc = "Checks if the value of the field is `PULL_DOWN`"]
78 #[inline(always)]
79 pub fn is_pull_down(&self) -> bool {
80 *self == PD_PULL_A::PULL_DOWN
81 }
82}
83#[doc = "Fields `PD(0-15)_PULL` writer - PD Pull_up/down Select"]
84pub type PD_PULL_W<'a, const O: u8> =
85 crate::FieldWriter<'a, u32, PD_PULL0_SPEC, u8, PD_PULL_A, 2, O>;
86impl<'a, const O: u8> PD_PULL_W<'a, O> {
87 #[doc = "`0`"]
88 #[inline(always)]
89 pub fn pull_disable(self) -> &'a mut W {
90 self.variant(PD_PULL_A::PULL_DISABLE)
91 }
92 #[doc = "`1`"]
93 #[inline(always)]
94 pub fn pull_up(self) -> &'a mut W {
95 self.variant(PD_PULL_A::PULL_UP)
96 }
97 #[doc = "`10`"]
98 #[inline(always)]
99 pub fn pull_down(self) -> &'a mut W {
100 self.variant(PD_PULL_A::PULL_DOWN)
101 }
102}
103impl R {
104 #[doc = "PD Pull_up/down Select"]
105 #[inline(always)]
106 pub unsafe fn pd_pull(&self, n: u8) -> PD_PULL_R {
107 PD_PULL_R::new(((self.bits >> (n * 2)) & 3) as u8)
108 }
109 #[doc = "Bits 0:1 - PD Pull_up/down Select"]
110 #[inline(always)]
111 pub fn pd0_pull(&self) -> PD_PULL_R {
112 PD_PULL_R::new((self.bits & 3) as u8)
113 }
114 #[doc = "Bits 2:3 - PD Pull_up/down Select"]
115 #[inline(always)]
116 pub fn pd1_pull(&self) -> PD_PULL_R {
117 PD_PULL_R::new(((self.bits >> 2) & 3) as u8)
118 }
119 #[doc = "Bits 4:5 - PD Pull_up/down Select"]
120 #[inline(always)]
121 pub fn pd2_pull(&self) -> PD_PULL_R {
122 PD_PULL_R::new(((self.bits >> 4) & 3) as u8)
123 }
124 #[doc = "Bits 6:7 - PD Pull_up/down Select"]
125 #[inline(always)]
126 pub fn pd3_pull(&self) -> PD_PULL_R {
127 PD_PULL_R::new(((self.bits >> 6) & 3) as u8)
128 }
129 #[doc = "Bits 8:9 - PD Pull_up/down Select"]
130 #[inline(always)]
131 pub fn pd4_pull(&self) -> PD_PULL_R {
132 PD_PULL_R::new(((self.bits >> 8) & 3) as u8)
133 }
134 #[doc = "Bits 10:11 - PD Pull_up/down Select"]
135 #[inline(always)]
136 pub fn pd5_pull(&self) -> PD_PULL_R {
137 PD_PULL_R::new(((self.bits >> 10) & 3) as u8)
138 }
139 #[doc = "Bits 12:13 - PD Pull_up/down Select"]
140 #[inline(always)]
141 pub fn pd6_pull(&self) -> PD_PULL_R {
142 PD_PULL_R::new(((self.bits >> 12) & 3) as u8)
143 }
144 #[doc = "Bits 14:15 - PD Pull_up/down Select"]
145 #[inline(always)]
146 pub fn pd7_pull(&self) -> PD_PULL_R {
147 PD_PULL_R::new(((self.bits >> 14) & 3) as u8)
148 }
149 #[doc = "Bits 16:17 - PD Pull_up/down Select"]
150 #[inline(always)]
151 pub fn pd8_pull(&self) -> PD_PULL_R {
152 PD_PULL_R::new(((self.bits >> 16) & 3) as u8)
153 }
154 #[doc = "Bits 18:19 - PD Pull_up/down Select"]
155 #[inline(always)]
156 pub fn pd9_pull(&self) -> PD_PULL_R {
157 PD_PULL_R::new(((self.bits >> 18) & 3) as u8)
158 }
159 #[doc = "Bits 20:21 - PD Pull_up/down Select"]
160 #[inline(always)]
161 pub fn pd10_pull(&self) -> PD_PULL_R {
162 PD_PULL_R::new(((self.bits >> 20) & 3) as u8)
163 }
164 #[doc = "Bits 22:23 - PD Pull_up/down Select"]
165 #[inline(always)]
166 pub fn pd11_pull(&self) -> PD_PULL_R {
167 PD_PULL_R::new(((self.bits >> 22) & 3) as u8)
168 }
169 #[doc = "Bits 24:25 - PD Pull_up/down Select"]
170 #[inline(always)]
171 pub fn pd12_pull(&self) -> PD_PULL_R {
172 PD_PULL_R::new(((self.bits >> 24) & 3) as u8)
173 }
174 #[doc = "Bits 26:27 - PD Pull_up/down Select"]
175 #[inline(always)]
176 pub fn pd13_pull(&self) -> PD_PULL_R {
177 PD_PULL_R::new(((self.bits >> 26) & 3) as u8)
178 }
179 #[doc = "Bits 28:29 - PD Pull_up/down Select"]
180 #[inline(always)]
181 pub fn pd14_pull(&self) -> PD_PULL_R {
182 PD_PULL_R::new(((self.bits >> 28) & 3) as u8)
183 }
184 #[doc = "Bits 30:31 - PD Pull_up/down Select"]
185 #[inline(always)]
186 pub fn pd15_pull(&self) -> PD_PULL_R {
187 PD_PULL_R::new(((self.bits >> 30) & 3) as u8)
188 }
189}
190impl W {
191 #[doc = "PD Pull_up/down Select"]
192 #[inline(always)]
193 pub unsafe fn pd_pull<const O: u8>(&mut self) -> PD_PULL_W<O> {
194 PD_PULL_W::new(self)
195 }
196 #[doc = "Bits 0:1 - PD Pull_up/down Select"]
197 #[inline(always)]
198 pub fn pd0_pull(&mut self) -> PD_PULL_W<0> {
199 PD_PULL_W::new(self)
200 }
201 #[doc = "Bits 2:3 - PD Pull_up/down Select"]
202 #[inline(always)]
203 pub fn pd1_pull(&mut self) -> PD_PULL_W<2> {
204 PD_PULL_W::new(self)
205 }
206 #[doc = "Bits 4:5 - PD Pull_up/down Select"]
207 #[inline(always)]
208 pub fn pd2_pull(&mut self) -> PD_PULL_W<4> {
209 PD_PULL_W::new(self)
210 }
211 #[doc = "Bits 6:7 - PD Pull_up/down Select"]
212 #[inline(always)]
213 pub fn pd3_pull(&mut self) -> PD_PULL_W<6> {
214 PD_PULL_W::new(self)
215 }
216 #[doc = "Bits 8:9 - PD Pull_up/down Select"]
217 #[inline(always)]
218 pub fn pd4_pull(&mut self) -> PD_PULL_W<8> {
219 PD_PULL_W::new(self)
220 }
221 #[doc = "Bits 10:11 - PD Pull_up/down Select"]
222 #[inline(always)]
223 pub fn pd5_pull(&mut self) -> PD_PULL_W<10> {
224 PD_PULL_W::new(self)
225 }
226 #[doc = "Bits 12:13 - PD Pull_up/down Select"]
227 #[inline(always)]
228 pub fn pd6_pull(&mut self) -> PD_PULL_W<12> {
229 PD_PULL_W::new(self)
230 }
231 #[doc = "Bits 14:15 - PD Pull_up/down Select"]
232 #[inline(always)]
233 pub fn pd7_pull(&mut self) -> PD_PULL_W<14> {
234 PD_PULL_W::new(self)
235 }
236 #[doc = "Bits 16:17 - PD Pull_up/down Select"]
237 #[inline(always)]
238 pub fn pd8_pull(&mut self) -> PD_PULL_W<16> {
239 PD_PULL_W::new(self)
240 }
241 #[doc = "Bits 18:19 - PD Pull_up/down Select"]
242 #[inline(always)]
243 pub fn pd9_pull(&mut self) -> PD_PULL_W<18> {
244 PD_PULL_W::new(self)
245 }
246 #[doc = "Bits 20:21 - PD Pull_up/down Select"]
247 #[inline(always)]
248 pub fn pd10_pull(&mut self) -> PD_PULL_W<20> {
249 PD_PULL_W::new(self)
250 }
251 #[doc = "Bits 22:23 - PD Pull_up/down Select"]
252 #[inline(always)]
253 pub fn pd11_pull(&mut self) -> PD_PULL_W<22> {
254 PD_PULL_W::new(self)
255 }
256 #[doc = "Bits 24:25 - PD Pull_up/down Select"]
257 #[inline(always)]
258 pub fn pd12_pull(&mut self) -> PD_PULL_W<24> {
259 PD_PULL_W::new(self)
260 }
261 #[doc = "Bits 26:27 - PD Pull_up/down Select"]
262 #[inline(always)]
263 pub fn pd13_pull(&mut self) -> PD_PULL_W<26> {
264 PD_PULL_W::new(self)
265 }
266 #[doc = "Bits 28:29 - PD Pull_up/down Select"]
267 #[inline(always)]
268 pub fn pd14_pull(&mut self) -> PD_PULL_W<28> {
269 PD_PULL_W::new(self)
270 }
271 #[doc = "Bits 30:31 - PD Pull_up/down Select"]
272 #[inline(always)]
273 pub fn pd15_pull(&mut self) -> PD_PULL_W<30> {
274 PD_PULL_W::new(self)
275 }
276 #[doc = "Writes raw bits to the register."]
277 #[inline(always)]
278 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
279 self.0.bits(bits);
280 self
281 }
282}
283#[doc = "PD Pull Register 0\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 [pd_pull0](index.html) module"]
284pub struct PD_PULL0_SPEC;
285impl crate::RegisterSpec for PD_PULL0_SPEC {
286 type Ux = u32;
287}
288#[doc = "`read()` method returns [pd_pull0::R](R) reader structure"]
289impl crate::Readable for PD_PULL0_SPEC {
290 type Reader = R;
291}
292#[doc = "`write(|w| ..)` method takes [pd_pull0::W](W) writer structure"]
293impl crate::Writable for PD_PULL0_SPEC {
294 type Writer = W;
295}
296#[doc = "`reset()` method sets pd_pull0 to value 0"]
297impl crate::Resettable for PD_PULL0_SPEC {
298 #[inline(always)]
299 fn reset_value() -> Self::Ux {
300 0
301 }
302}