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