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