stm32l4x2_pac/gpioa/
moder.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::MODER {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = "Possible values of the field `MODER15`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum MODER15R {
48 #[doc = "Input mode (reset state)"]
49 INPUT,
50 #[doc = "General purpose output mode"]
51 OUTPUT,
52 #[doc = "Alternate function mode"]
53 ALTERNATE,
54 #[doc = "Analog mode"]
55 ANALOG,
56}
57impl MODER15R {
58 #[doc = r" Value of the field as raw bits"]
59 #[inline]
60 pub fn bits(&self) -> u8 {
61 match *self {
62 MODER15R::INPUT => 0,
63 MODER15R::OUTPUT => 1,
64 MODER15R::ALTERNATE => 2,
65 MODER15R::ANALOG => 3,
66 }
67 }
68 #[allow(missing_docs)]
69 #[doc(hidden)]
70 #[inline]
71 pub fn _from(value: u8) -> MODER15R {
72 match value {
73 0 => MODER15R::INPUT,
74 1 => MODER15R::OUTPUT,
75 2 => MODER15R::ALTERNATE,
76 3 => MODER15R::ANALOG,
77 _ => unreachable!(),
78 }
79 }
80 #[doc = "Checks if the value of the field is `INPUT`"]
81 #[inline]
82 pub fn is_input(&self) -> bool {
83 *self == MODER15R::INPUT
84 }
85 #[doc = "Checks if the value of the field is `OUTPUT`"]
86 #[inline]
87 pub fn is_output(&self) -> bool {
88 *self == MODER15R::OUTPUT
89 }
90 #[doc = "Checks if the value of the field is `ALTERNATE`"]
91 #[inline]
92 pub fn is_alternate(&self) -> bool {
93 *self == MODER15R::ALTERNATE
94 }
95 #[doc = "Checks if the value of the field is `ANALOG`"]
96 #[inline]
97 pub fn is_analog(&self) -> bool {
98 *self == MODER15R::ANALOG
99 }
100}
101#[doc = "Possible values of the field `MODER14`"]
102pub type MODER14R = MODER15R;
103#[doc = "Possible values of the field `MODER13`"]
104pub type MODER13R = MODER15R;
105#[doc = "Possible values of the field `MODER12`"]
106pub type MODER12R = MODER15R;
107#[doc = "Possible values of the field `MODER11`"]
108pub type MODER11R = MODER15R;
109#[doc = "Possible values of the field `MODER10`"]
110pub type MODER10R = MODER15R;
111#[doc = "Possible values of the field `MODER9`"]
112pub type MODER9R = MODER15R;
113#[doc = "Possible values of the field `MODER8`"]
114pub type MODER8R = MODER15R;
115#[doc = "Possible values of the field `MODER7`"]
116pub type MODER7R = MODER15R;
117#[doc = "Possible values of the field `MODER6`"]
118pub type MODER6R = MODER15R;
119#[doc = "Possible values of the field `MODER5`"]
120pub type MODER5R = MODER15R;
121#[doc = "Possible values of the field `MODER4`"]
122pub type MODER4R = MODER15R;
123#[doc = "Possible values of the field `MODER3`"]
124pub type MODER3R = MODER15R;
125#[doc = "Possible values of the field `MODER2`"]
126pub type MODER2R = MODER15R;
127#[doc = "Possible values of the field `MODER1`"]
128pub type MODER1R = MODER15R;
129#[doc = "Possible values of the field `MODER0`"]
130pub type MODER0R = MODER15R;
131#[doc = "Values that can be written to the field `MODER15`"]
132pub enum MODER15W {
133 #[doc = "Input mode (reset state)"]
134 INPUT,
135 #[doc = "General purpose output mode"]
136 OUTPUT,
137 #[doc = "Alternate function mode"]
138 ALTERNATE,
139 #[doc = "Analog mode"]
140 ANALOG,
141}
142impl MODER15W {
143 #[allow(missing_docs)]
144 #[doc(hidden)]
145 #[inline]
146 pub fn _bits(&self) -> u8 {
147 match *self {
148 MODER15W::INPUT => 0,
149 MODER15W::OUTPUT => 1,
150 MODER15W::ALTERNATE => 2,
151 MODER15W::ANALOG => 3,
152 }
153 }
154}
155#[doc = r" Proxy"]
156pub struct _MODER15W<'a> {
157 w: &'a mut W,
158}
159impl<'a> _MODER15W<'a> {
160 #[doc = r" Writes `variant` to the field"]
161 #[inline]
162 pub fn variant(self, variant: MODER15W) -> &'a mut W {
163 {
164 self.bits(variant._bits())
165 }
166 }
167 #[doc = "Input mode (reset state)"]
168 #[inline]
169 pub fn input(self) -> &'a mut W {
170 self.variant(MODER15W::INPUT)
171 }
172 #[doc = "General purpose output mode"]
173 #[inline]
174 pub fn output(self) -> &'a mut W {
175 self.variant(MODER15W::OUTPUT)
176 }
177 #[doc = "Alternate function mode"]
178 #[inline]
179 pub fn alternate(self) -> &'a mut W {
180 self.variant(MODER15W::ALTERNATE)
181 }
182 #[doc = "Analog mode"]
183 #[inline]
184 pub fn analog(self) -> &'a mut W {
185 self.variant(MODER15W::ANALOG)
186 }
187 #[doc = r" Writes raw bits to the field"]
188 #[inline]
189 pub fn bits(self, value: u8) -> &'a mut W {
190 const MASK: u8 = 3;
191 const OFFSET: u8 = 30;
192 self.w.bits &= !((MASK as u32) << OFFSET);
193 self.w.bits |= ((value & MASK) as u32) << OFFSET;
194 self.w
195 }
196}
197#[doc = "Values that can be written to the field `MODER14`"]
198pub type MODER14W = MODER15W;
199#[doc = r" Proxy"]
200pub struct _MODER14W<'a> {
201 w: &'a mut W,
202}
203impl<'a> _MODER14W<'a> {
204 #[doc = r" Writes `variant` to the field"]
205 #[inline]
206 pub fn variant(self, variant: MODER14W) -> &'a mut W {
207 {
208 self.bits(variant._bits())
209 }
210 }
211 #[doc = "Input mode (reset state)"]
212 #[inline]
213 pub fn input(self) -> &'a mut W {
214 self.variant(MODER15W::INPUT)
215 }
216 #[doc = "General purpose output mode"]
217 #[inline]
218 pub fn output(self) -> &'a mut W {
219 self.variant(MODER15W::OUTPUT)
220 }
221 #[doc = "Alternate function mode"]
222 #[inline]
223 pub fn alternate(self) -> &'a mut W {
224 self.variant(MODER15W::ALTERNATE)
225 }
226 #[doc = "Analog mode"]
227 #[inline]
228 pub fn analog(self) -> &'a mut W {
229 self.variant(MODER15W::ANALOG)
230 }
231 #[doc = r" Writes raw bits to the field"]
232 #[inline]
233 pub fn bits(self, value: u8) -> &'a mut W {
234 const MASK: u8 = 3;
235 const OFFSET: u8 = 28;
236 self.w.bits &= !((MASK as u32) << OFFSET);
237 self.w.bits |= ((value & MASK) as u32) << OFFSET;
238 self.w
239 }
240}
241#[doc = "Values that can be written to the field `MODER13`"]
242pub type MODER13W = MODER15W;
243#[doc = r" Proxy"]
244pub struct _MODER13W<'a> {
245 w: &'a mut W,
246}
247impl<'a> _MODER13W<'a> {
248 #[doc = r" Writes `variant` to the field"]
249 #[inline]
250 pub fn variant(self, variant: MODER13W) -> &'a mut W {
251 {
252 self.bits(variant._bits())
253 }
254 }
255 #[doc = "Input mode (reset state)"]
256 #[inline]
257 pub fn input(self) -> &'a mut W {
258 self.variant(MODER15W::INPUT)
259 }
260 #[doc = "General purpose output mode"]
261 #[inline]
262 pub fn output(self) -> &'a mut W {
263 self.variant(MODER15W::OUTPUT)
264 }
265 #[doc = "Alternate function mode"]
266 #[inline]
267 pub fn alternate(self) -> &'a mut W {
268 self.variant(MODER15W::ALTERNATE)
269 }
270 #[doc = "Analog mode"]
271 #[inline]
272 pub fn analog(self) -> &'a mut W {
273 self.variant(MODER15W::ANALOG)
274 }
275 #[doc = r" Writes raw bits to the field"]
276 #[inline]
277 pub fn bits(self, value: u8) -> &'a mut W {
278 const MASK: u8 = 3;
279 const OFFSET: u8 = 26;
280 self.w.bits &= !((MASK as u32) << OFFSET);
281 self.w.bits |= ((value & MASK) as u32) << OFFSET;
282 self.w
283 }
284}
285#[doc = "Values that can be written to the field `MODER12`"]
286pub type MODER12W = MODER15W;
287#[doc = r" Proxy"]
288pub struct _MODER12W<'a> {
289 w: &'a mut W,
290}
291impl<'a> _MODER12W<'a> {
292 #[doc = r" Writes `variant` to the field"]
293 #[inline]
294 pub fn variant(self, variant: MODER12W) -> &'a mut W {
295 {
296 self.bits(variant._bits())
297 }
298 }
299 #[doc = "Input mode (reset state)"]
300 #[inline]
301 pub fn input(self) -> &'a mut W {
302 self.variant(MODER15W::INPUT)
303 }
304 #[doc = "General purpose output mode"]
305 #[inline]
306 pub fn output(self) -> &'a mut W {
307 self.variant(MODER15W::OUTPUT)
308 }
309 #[doc = "Alternate function mode"]
310 #[inline]
311 pub fn alternate(self) -> &'a mut W {
312 self.variant(MODER15W::ALTERNATE)
313 }
314 #[doc = "Analog mode"]
315 #[inline]
316 pub fn analog(self) -> &'a mut W {
317 self.variant(MODER15W::ANALOG)
318 }
319 #[doc = r" Writes raw bits to the field"]
320 #[inline]
321 pub fn bits(self, value: u8) -> &'a mut W {
322 const MASK: u8 = 3;
323 const OFFSET: u8 = 24;
324 self.w.bits &= !((MASK as u32) << OFFSET);
325 self.w.bits |= ((value & MASK) as u32) << OFFSET;
326 self.w
327 }
328}
329#[doc = "Values that can be written to the field `MODER11`"]
330pub type MODER11W = MODER15W;
331#[doc = r" Proxy"]
332pub struct _MODER11W<'a> {
333 w: &'a mut W,
334}
335impl<'a> _MODER11W<'a> {
336 #[doc = r" Writes `variant` to the field"]
337 #[inline]
338 pub fn variant(self, variant: MODER11W) -> &'a mut W {
339 {
340 self.bits(variant._bits())
341 }
342 }
343 #[doc = "Input mode (reset state)"]
344 #[inline]
345 pub fn input(self) -> &'a mut W {
346 self.variant(MODER15W::INPUT)
347 }
348 #[doc = "General purpose output mode"]
349 #[inline]
350 pub fn output(self) -> &'a mut W {
351 self.variant(MODER15W::OUTPUT)
352 }
353 #[doc = "Alternate function mode"]
354 #[inline]
355 pub fn alternate(self) -> &'a mut W {
356 self.variant(MODER15W::ALTERNATE)
357 }
358 #[doc = "Analog mode"]
359 #[inline]
360 pub fn analog(self) -> &'a mut W {
361 self.variant(MODER15W::ANALOG)
362 }
363 #[doc = r" Writes raw bits to the field"]
364 #[inline]
365 pub fn bits(self, value: u8) -> &'a mut W {
366 const MASK: u8 = 3;
367 const OFFSET: u8 = 22;
368 self.w.bits &= !((MASK as u32) << OFFSET);
369 self.w.bits |= ((value & MASK) as u32) << OFFSET;
370 self.w
371 }
372}
373#[doc = "Values that can be written to the field `MODER10`"]
374pub type MODER10W = MODER15W;
375#[doc = r" Proxy"]
376pub struct _MODER10W<'a> {
377 w: &'a mut W,
378}
379impl<'a> _MODER10W<'a> {
380 #[doc = r" Writes `variant` to the field"]
381 #[inline]
382 pub fn variant(self, variant: MODER10W) -> &'a mut W {
383 {
384 self.bits(variant._bits())
385 }
386 }
387 #[doc = "Input mode (reset state)"]
388 #[inline]
389 pub fn input(self) -> &'a mut W {
390 self.variant(MODER15W::INPUT)
391 }
392 #[doc = "General purpose output mode"]
393 #[inline]
394 pub fn output(self) -> &'a mut W {
395 self.variant(MODER15W::OUTPUT)
396 }
397 #[doc = "Alternate function mode"]
398 #[inline]
399 pub fn alternate(self) -> &'a mut W {
400 self.variant(MODER15W::ALTERNATE)
401 }
402 #[doc = "Analog mode"]
403 #[inline]
404 pub fn analog(self) -> &'a mut W {
405 self.variant(MODER15W::ANALOG)
406 }
407 #[doc = r" Writes raw bits to the field"]
408 #[inline]
409 pub fn bits(self, value: u8) -> &'a mut W {
410 const MASK: u8 = 3;
411 const OFFSET: u8 = 20;
412 self.w.bits &= !((MASK as u32) << OFFSET);
413 self.w.bits |= ((value & MASK) as u32) << OFFSET;
414 self.w
415 }
416}
417#[doc = "Values that can be written to the field `MODER9`"]
418pub type MODER9W = MODER15W;
419#[doc = r" Proxy"]
420pub struct _MODER9W<'a> {
421 w: &'a mut W,
422}
423impl<'a> _MODER9W<'a> {
424 #[doc = r" Writes `variant` to the field"]
425 #[inline]
426 pub fn variant(self, variant: MODER9W) -> &'a mut W {
427 {
428 self.bits(variant._bits())
429 }
430 }
431 #[doc = "Input mode (reset state)"]
432 #[inline]
433 pub fn input(self) -> &'a mut W {
434 self.variant(MODER15W::INPUT)
435 }
436 #[doc = "General purpose output mode"]
437 #[inline]
438 pub fn output(self) -> &'a mut W {
439 self.variant(MODER15W::OUTPUT)
440 }
441 #[doc = "Alternate function mode"]
442 #[inline]
443 pub fn alternate(self) -> &'a mut W {
444 self.variant(MODER15W::ALTERNATE)
445 }
446 #[doc = "Analog mode"]
447 #[inline]
448 pub fn analog(self) -> &'a mut W {
449 self.variant(MODER15W::ANALOG)
450 }
451 #[doc = r" Writes raw bits to the field"]
452 #[inline]
453 pub fn bits(self, value: u8) -> &'a mut W {
454 const MASK: u8 = 3;
455 const OFFSET: u8 = 18;
456 self.w.bits &= !((MASK as u32) << OFFSET);
457 self.w.bits |= ((value & MASK) as u32) << OFFSET;
458 self.w
459 }
460}
461#[doc = "Values that can be written to the field `MODER8`"]
462pub type MODER8W = MODER15W;
463#[doc = r" Proxy"]
464pub struct _MODER8W<'a> {
465 w: &'a mut W,
466}
467impl<'a> _MODER8W<'a> {
468 #[doc = r" Writes `variant` to the field"]
469 #[inline]
470 pub fn variant(self, variant: MODER8W) -> &'a mut W {
471 {
472 self.bits(variant._bits())
473 }
474 }
475 #[doc = "Input mode (reset state)"]
476 #[inline]
477 pub fn input(self) -> &'a mut W {
478 self.variant(MODER15W::INPUT)
479 }
480 #[doc = "General purpose output mode"]
481 #[inline]
482 pub fn output(self) -> &'a mut W {
483 self.variant(MODER15W::OUTPUT)
484 }
485 #[doc = "Alternate function mode"]
486 #[inline]
487 pub fn alternate(self) -> &'a mut W {
488 self.variant(MODER15W::ALTERNATE)
489 }
490 #[doc = "Analog mode"]
491 #[inline]
492 pub fn analog(self) -> &'a mut W {
493 self.variant(MODER15W::ANALOG)
494 }
495 #[doc = r" Writes raw bits to the field"]
496 #[inline]
497 pub fn bits(self, value: u8) -> &'a mut W {
498 const MASK: u8 = 3;
499 const OFFSET: u8 = 16;
500 self.w.bits &= !((MASK as u32) << OFFSET);
501 self.w.bits |= ((value & MASK) as u32) << OFFSET;
502 self.w
503 }
504}
505#[doc = "Values that can be written to the field `MODER7`"]
506pub type MODER7W = MODER15W;
507#[doc = r" Proxy"]
508pub struct _MODER7W<'a> {
509 w: &'a mut W,
510}
511impl<'a> _MODER7W<'a> {
512 #[doc = r" Writes `variant` to the field"]
513 #[inline]
514 pub fn variant(self, variant: MODER7W) -> &'a mut W {
515 {
516 self.bits(variant._bits())
517 }
518 }
519 #[doc = "Input mode (reset state)"]
520 #[inline]
521 pub fn input(self) -> &'a mut W {
522 self.variant(MODER15W::INPUT)
523 }
524 #[doc = "General purpose output mode"]
525 #[inline]
526 pub fn output(self) -> &'a mut W {
527 self.variant(MODER15W::OUTPUT)
528 }
529 #[doc = "Alternate function mode"]
530 #[inline]
531 pub fn alternate(self) -> &'a mut W {
532 self.variant(MODER15W::ALTERNATE)
533 }
534 #[doc = "Analog mode"]
535 #[inline]
536 pub fn analog(self) -> &'a mut W {
537 self.variant(MODER15W::ANALOG)
538 }
539 #[doc = r" Writes raw bits to the field"]
540 #[inline]
541 pub fn bits(self, value: u8) -> &'a mut W {
542 const MASK: u8 = 3;
543 const OFFSET: u8 = 14;
544 self.w.bits &= !((MASK as u32) << OFFSET);
545 self.w.bits |= ((value & MASK) as u32) << OFFSET;
546 self.w
547 }
548}
549#[doc = "Values that can be written to the field `MODER6`"]
550pub type MODER6W = MODER15W;
551#[doc = r" Proxy"]
552pub struct _MODER6W<'a> {
553 w: &'a mut W,
554}
555impl<'a> _MODER6W<'a> {
556 #[doc = r" Writes `variant` to the field"]
557 #[inline]
558 pub fn variant(self, variant: MODER6W) -> &'a mut W {
559 {
560 self.bits(variant._bits())
561 }
562 }
563 #[doc = "Input mode (reset state)"]
564 #[inline]
565 pub fn input(self) -> &'a mut W {
566 self.variant(MODER15W::INPUT)
567 }
568 #[doc = "General purpose output mode"]
569 #[inline]
570 pub fn output(self) -> &'a mut W {
571 self.variant(MODER15W::OUTPUT)
572 }
573 #[doc = "Alternate function mode"]
574 #[inline]
575 pub fn alternate(self) -> &'a mut W {
576 self.variant(MODER15W::ALTERNATE)
577 }
578 #[doc = "Analog mode"]
579 #[inline]
580 pub fn analog(self) -> &'a mut W {
581 self.variant(MODER15W::ANALOG)
582 }
583 #[doc = r" Writes raw bits to the field"]
584 #[inline]
585 pub fn bits(self, value: u8) -> &'a mut W {
586 const MASK: u8 = 3;
587 const OFFSET: u8 = 12;
588 self.w.bits &= !((MASK as u32) << OFFSET);
589 self.w.bits |= ((value & MASK) as u32) << OFFSET;
590 self.w
591 }
592}
593#[doc = "Values that can be written to the field `MODER5`"]
594pub type MODER5W = MODER15W;
595#[doc = r" Proxy"]
596pub struct _MODER5W<'a> {
597 w: &'a mut W,
598}
599impl<'a> _MODER5W<'a> {
600 #[doc = r" Writes `variant` to the field"]
601 #[inline]
602 pub fn variant(self, variant: MODER5W) -> &'a mut W {
603 {
604 self.bits(variant._bits())
605 }
606 }
607 #[doc = "Input mode (reset state)"]
608 #[inline]
609 pub fn input(self) -> &'a mut W {
610 self.variant(MODER15W::INPUT)
611 }
612 #[doc = "General purpose output mode"]
613 #[inline]
614 pub fn output(self) -> &'a mut W {
615 self.variant(MODER15W::OUTPUT)
616 }
617 #[doc = "Alternate function mode"]
618 #[inline]
619 pub fn alternate(self) -> &'a mut W {
620 self.variant(MODER15W::ALTERNATE)
621 }
622 #[doc = "Analog mode"]
623 #[inline]
624 pub fn analog(self) -> &'a mut W {
625 self.variant(MODER15W::ANALOG)
626 }
627 #[doc = r" Writes raw bits to the field"]
628 #[inline]
629 pub fn bits(self, value: u8) -> &'a mut W {
630 const MASK: u8 = 3;
631 const OFFSET: u8 = 10;
632 self.w.bits &= !((MASK as u32) << OFFSET);
633 self.w.bits |= ((value & MASK) as u32) << OFFSET;
634 self.w
635 }
636}
637#[doc = "Values that can be written to the field `MODER4`"]
638pub type MODER4W = MODER15W;
639#[doc = r" Proxy"]
640pub struct _MODER4W<'a> {
641 w: &'a mut W,
642}
643impl<'a> _MODER4W<'a> {
644 #[doc = r" Writes `variant` to the field"]
645 #[inline]
646 pub fn variant(self, variant: MODER4W) -> &'a mut W {
647 {
648 self.bits(variant._bits())
649 }
650 }
651 #[doc = "Input mode (reset state)"]
652 #[inline]
653 pub fn input(self) -> &'a mut W {
654 self.variant(MODER15W::INPUT)
655 }
656 #[doc = "General purpose output mode"]
657 #[inline]
658 pub fn output(self) -> &'a mut W {
659 self.variant(MODER15W::OUTPUT)
660 }
661 #[doc = "Alternate function mode"]
662 #[inline]
663 pub fn alternate(self) -> &'a mut W {
664 self.variant(MODER15W::ALTERNATE)
665 }
666 #[doc = "Analog mode"]
667 #[inline]
668 pub fn analog(self) -> &'a mut W {
669 self.variant(MODER15W::ANALOG)
670 }
671 #[doc = r" Writes raw bits to the field"]
672 #[inline]
673 pub fn bits(self, value: u8) -> &'a mut W {
674 const MASK: u8 = 3;
675 const OFFSET: u8 = 8;
676 self.w.bits &= !((MASK as u32) << OFFSET);
677 self.w.bits |= ((value & MASK) as u32) << OFFSET;
678 self.w
679 }
680}
681#[doc = "Values that can be written to the field `MODER3`"]
682pub type MODER3W = MODER15W;
683#[doc = r" Proxy"]
684pub struct _MODER3W<'a> {
685 w: &'a mut W,
686}
687impl<'a> _MODER3W<'a> {
688 #[doc = r" Writes `variant` to the field"]
689 #[inline]
690 pub fn variant(self, variant: MODER3W) -> &'a mut W {
691 {
692 self.bits(variant._bits())
693 }
694 }
695 #[doc = "Input mode (reset state)"]
696 #[inline]
697 pub fn input(self) -> &'a mut W {
698 self.variant(MODER15W::INPUT)
699 }
700 #[doc = "General purpose output mode"]
701 #[inline]
702 pub fn output(self) -> &'a mut W {
703 self.variant(MODER15W::OUTPUT)
704 }
705 #[doc = "Alternate function mode"]
706 #[inline]
707 pub fn alternate(self) -> &'a mut W {
708 self.variant(MODER15W::ALTERNATE)
709 }
710 #[doc = "Analog mode"]
711 #[inline]
712 pub fn analog(self) -> &'a mut W {
713 self.variant(MODER15W::ANALOG)
714 }
715 #[doc = r" Writes raw bits to the field"]
716 #[inline]
717 pub fn bits(self, value: u8) -> &'a mut W {
718 const MASK: u8 = 3;
719 const OFFSET: u8 = 6;
720 self.w.bits &= !((MASK as u32) << OFFSET);
721 self.w.bits |= ((value & MASK) as u32) << OFFSET;
722 self.w
723 }
724}
725#[doc = "Values that can be written to the field `MODER2`"]
726pub type MODER2W = MODER15W;
727#[doc = r" Proxy"]
728pub struct _MODER2W<'a> {
729 w: &'a mut W,
730}
731impl<'a> _MODER2W<'a> {
732 #[doc = r" Writes `variant` to the field"]
733 #[inline]
734 pub fn variant(self, variant: MODER2W) -> &'a mut W {
735 {
736 self.bits(variant._bits())
737 }
738 }
739 #[doc = "Input mode (reset state)"]
740 #[inline]
741 pub fn input(self) -> &'a mut W {
742 self.variant(MODER15W::INPUT)
743 }
744 #[doc = "General purpose output mode"]
745 #[inline]
746 pub fn output(self) -> &'a mut W {
747 self.variant(MODER15W::OUTPUT)
748 }
749 #[doc = "Alternate function mode"]
750 #[inline]
751 pub fn alternate(self) -> &'a mut W {
752 self.variant(MODER15W::ALTERNATE)
753 }
754 #[doc = "Analog mode"]
755 #[inline]
756 pub fn analog(self) -> &'a mut W {
757 self.variant(MODER15W::ANALOG)
758 }
759 #[doc = r" Writes raw bits to the field"]
760 #[inline]
761 pub fn bits(self, value: u8) -> &'a mut W {
762 const MASK: u8 = 3;
763 const OFFSET: u8 = 4;
764 self.w.bits &= !((MASK as u32) << OFFSET);
765 self.w.bits |= ((value & MASK) as u32) << OFFSET;
766 self.w
767 }
768}
769#[doc = "Values that can be written to the field `MODER1`"]
770pub type MODER1W = MODER15W;
771#[doc = r" Proxy"]
772pub struct _MODER1W<'a> {
773 w: &'a mut W,
774}
775impl<'a> _MODER1W<'a> {
776 #[doc = r" Writes `variant` to the field"]
777 #[inline]
778 pub fn variant(self, variant: MODER1W) -> &'a mut W {
779 {
780 self.bits(variant._bits())
781 }
782 }
783 #[doc = "Input mode (reset state)"]
784 #[inline]
785 pub fn input(self) -> &'a mut W {
786 self.variant(MODER15W::INPUT)
787 }
788 #[doc = "General purpose output mode"]
789 #[inline]
790 pub fn output(self) -> &'a mut W {
791 self.variant(MODER15W::OUTPUT)
792 }
793 #[doc = "Alternate function mode"]
794 #[inline]
795 pub fn alternate(self) -> &'a mut W {
796 self.variant(MODER15W::ALTERNATE)
797 }
798 #[doc = "Analog mode"]
799 #[inline]
800 pub fn analog(self) -> &'a mut W {
801 self.variant(MODER15W::ANALOG)
802 }
803 #[doc = r" Writes raw bits to the field"]
804 #[inline]
805 pub fn bits(self, value: u8) -> &'a mut W {
806 const MASK: u8 = 3;
807 const OFFSET: u8 = 2;
808 self.w.bits &= !((MASK as u32) << OFFSET);
809 self.w.bits |= ((value & MASK) as u32) << OFFSET;
810 self.w
811 }
812}
813#[doc = "Values that can be written to the field `MODER0`"]
814pub type MODER0W = MODER15W;
815#[doc = r" Proxy"]
816pub struct _MODER0W<'a> {
817 w: &'a mut W,
818}
819impl<'a> _MODER0W<'a> {
820 #[doc = r" Writes `variant` to the field"]
821 #[inline]
822 pub fn variant(self, variant: MODER0W) -> &'a mut W {
823 {
824 self.bits(variant._bits())
825 }
826 }
827 #[doc = "Input mode (reset state)"]
828 #[inline]
829 pub fn input(self) -> &'a mut W {
830 self.variant(MODER15W::INPUT)
831 }
832 #[doc = "General purpose output mode"]
833 #[inline]
834 pub fn output(self) -> &'a mut W {
835 self.variant(MODER15W::OUTPUT)
836 }
837 #[doc = "Alternate function mode"]
838 #[inline]
839 pub fn alternate(self) -> &'a mut W {
840 self.variant(MODER15W::ALTERNATE)
841 }
842 #[doc = "Analog mode"]
843 #[inline]
844 pub fn analog(self) -> &'a mut W {
845 self.variant(MODER15W::ANALOG)
846 }
847 #[doc = r" Writes raw bits to the field"]
848 #[inline]
849 pub fn bits(self, value: u8) -> &'a mut W {
850 const MASK: u8 = 3;
851 const OFFSET: u8 = 0;
852 self.w.bits &= !((MASK as u32) << OFFSET);
853 self.w.bits |= ((value & MASK) as u32) << OFFSET;
854 self.w
855 }
856}
857impl R {
858 #[doc = r" Value of the register as raw bits"]
859 #[inline]
860 pub fn bits(&self) -> u32 {
861 self.bits
862 }
863 #[doc = "Bits 30:31 - Port x configuration bits (y = 0..15)"]
864 #[inline]
865 pub fn moder15(&self) -> MODER15R {
866 MODER15R::_from({
867 const MASK: u8 = 3;
868 const OFFSET: u8 = 30;
869 ((self.bits >> OFFSET) & MASK as u32) as u8
870 })
871 }
872 #[doc = "Bits 28:29 - Port x configuration bits (y = 0..15)"]
873 #[inline]
874 pub fn moder14(&self) -> MODER14R {
875 MODER14R::_from({
876 const MASK: u8 = 3;
877 const OFFSET: u8 = 28;
878 ((self.bits >> OFFSET) & MASK as u32) as u8
879 })
880 }
881 #[doc = "Bits 26:27 - Port x configuration bits (y = 0..15)"]
882 #[inline]
883 pub fn moder13(&self) -> MODER13R {
884 MODER13R::_from({
885 const MASK: u8 = 3;
886 const OFFSET: u8 = 26;
887 ((self.bits >> OFFSET) & MASK as u32) as u8
888 })
889 }
890 #[doc = "Bits 24:25 - Port x configuration bits (y = 0..15)"]
891 #[inline]
892 pub fn moder12(&self) -> MODER12R {
893 MODER12R::_from({
894 const MASK: u8 = 3;
895 const OFFSET: u8 = 24;
896 ((self.bits >> OFFSET) & MASK as u32) as u8
897 })
898 }
899 #[doc = "Bits 22:23 - Port x configuration bits (y = 0..15)"]
900 #[inline]
901 pub fn moder11(&self) -> MODER11R {
902 MODER11R::_from({
903 const MASK: u8 = 3;
904 const OFFSET: u8 = 22;
905 ((self.bits >> OFFSET) & MASK as u32) as u8
906 })
907 }
908 #[doc = "Bits 20:21 - Port x configuration bits (y = 0..15)"]
909 #[inline]
910 pub fn moder10(&self) -> MODER10R {
911 MODER10R::_from({
912 const MASK: u8 = 3;
913 const OFFSET: u8 = 20;
914 ((self.bits >> OFFSET) & MASK as u32) as u8
915 })
916 }
917 #[doc = "Bits 18:19 - Port x configuration bits (y = 0..15)"]
918 #[inline]
919 pub fn moder9(&self) -> MODER9R {
920 MODER9R::_from({
921 const MASK: u8 = 3;
922 const OFFSET: u8 = 18;
923 ((self.bits >> OFFSET) & MASK as u32) as u8
924 })
925 }
926 #[doc = "Bits 16:17 - Port x configuration bits (y = 0..15)"]
927 #[inline]
928 pub fn moder8(&self) -> MODER8R {
929 MODER8R::_from({
930 const MASK: u8 = 3;
931 const OFFSET: u8 = 16;
932 ((self.bits >> OFFSET) & MASK as u32) as u8
933 })
934 }
935 #[doc = "Bits 14:15 - Port x configuration bits (y = 0..15)"]
936 #[inline]
937 pub fn moder7(&self) -> MODER7R {
938 MODER7R::_from({
939 const MASK: u8 = 3;
940 const OFFSET: u8 = 14;
941 ((self.bits >> OFFSET) & MASK as u32) as u8
942 })
943 }
944 #[doc = "Bits 12:13 - Port x configuration bits (y = 0..15)"]
945 #[inline]
946 pub fn moder6(&self) -> MODER6R {
947 MODER6R::_from({
948 const MASK: u8 = 3;
949 const OFFSET: u8 = 12;
950 ((self.bits >> OFFSET) & MASK as u32) as u8
951 })
952 }
953 #[doc = "Bits 10:11 - Port x configuration bits (y = 0..15)"]
954 #[inline]
955 pub fn moder5(&self) -> MODER5R {
956 MODER5R::_from({
957 const MASK: u8 = 3;
958 const OFFSET: u8 = 10;
959 ((self.bits >> OFFSET) & MASK as u32) as u8
960 })
961 }
962 #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
963 #[inline]
964 pub fn moder4(&self) -> MODER4R {
965 MODER4R::_from({
966 const MASK: u8 = 3;
967 const OFFSET: u8 = 8;
968 ((self.bits >> OFFSET) & MASK as u32) as u8
969 })
970 }
971 #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
972 #[inline]
973 pub fn moder3(&self) -> MODER3R {
974 MODER3R::_from({
975 const MASK: u8 = 3;
976 const OFFSET: u8 = 6;
977 ((self.bits >> OFFSET) & MASK as u32) as u8
978 })
979 }
980 #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
981 #[inline]
982 pub fn moder2(&self) -> MODER2R {
983 MODER2R::_from({
984 const MASK: u8 = 3;
985 const OFFSET: u8 = 4;
986 ((self.bits >> OFFSET) & MASK as u32) as u8
987 })
988 }
989 #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
990 #[inline]
991 pub fn moder1(&self) -> MODER1R {
992 MODER1R::_from({
993 const MASK: u8 = 3;
994 const OFFSET: u8 = 2;
995 ((self.bits >> OFFSET) & MASK as u32) as u8
996 })
997 }
998 #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
999 #[inline]
1000 pub fn moder0(&self) -> MODER0R {
1001 MODER0R::_from({
1002 const MASK: u8 = 3;
1003 const OFFSET: u8 = 0;
1004 ((self.bits >> OFFSET) & MASK as u32) as u8
1005 })
1006 }
1007}
1008impl W {
1009 #[doc = r" Reset value of the register"]
1010 #[inline]
1011 pub fn reset_value() -> W {
1012 W { bits: 2818572288 }
1013 }
1014 #[doc = r" Writes raw bits to the register"]
1015 #[inline]
1016 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1017 self.bits = bits;
1018 self
1019 }
1020 #[doc = "Bits 30:31 - Port x configuration bits (y = 0..15)"]
1021 #[inline]
1022 pub fn moder15(&mut self) -> _MODER15W {
1023 _MODER15W { w: self }
1024 }
1025 #[doc = "Bits 28:29 - Port x configuration bits (y = 0..15)"]
1026 #[inline]
1027 pub fn moder14(&mut self) -> _MODER14W {
1028 _MODER14W { w: self }
1029 }
1030 #[doc = "Bits 26:27 - Port x configuration bits (y = 0..15)"]
1031 #[inline]
1032 pub fn moder13(&mut self) -> _MODER13W {
1033 _MODER13W { w: self }
1034 }
1035 #[doc = "Bits 24:25 - Port x configuration bits (y = 0..15)"]
1036 #[inline]
1037 pub fn moder12(&mut self) -> _MODER12W {
1038 _MODER12W { w: self }
1039 }
1040 #[doc = "Bits 22:23 - Port x configuration bits (y = 0..15)"]
1041 #[inline]
1042 pub fn moder11(&mut self) -> _MODER11W {
1043 _MODER11W { w: self }
1044 }
1045 #[doc = "Bits 20:21 - Port x configuration bits (y = 0..15)"]
1046 #[inline]
1047 pub fn moder10(&mut self) -> _MODER10W {
1048 _MODER10W { w: self }
1049 }
1050 #[doc = "Bits 18:19 - Port x configuration bits (y = 0..15)"]
1051 #[inline]
1052 pub fn moder9(&mut self) -> _MODER9W {
1053 _MODER9W { w: self }
1054 }
1055 #[doc = "Bits 16:17 - Port x configuration bits (y = 0..15)"]
1056 #[inline]
1057 pub fn moder8(&mut self) -> _MODER8W {
1058 _MODER8W { w: self }
1059 }
1060 #[doc = "Bits 14:15 - Port x configuration bits (y = 0..15)"]
1061 #[inline]
1062 pub fn moder7(&mut self) -> _MODER7W {
1063 _MODER7W { w: self }
1064 }
1065 #[doc = "Bits 12:13 - Port x configuration bits (y = 0..15)"]
1066 #[inline]
1067 pub fn moder6(&mut self) -> _MODER6W {
1068 _MODER6W { w: self }
1069 }
1070 #[doc = "Bits 10:11 - Port x configuration bits (y = 0..15)"]
1071 #[inline]
1072 pub fn moder5(&mut self) -> _MODER5W {
1073 _MODER5W { w: self }
1074 }
1075 #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
1076 #[inline]
1077 pub fn moder4(&mut self) -> _MODER4W {
1078 _MODER4W { w: self }
1079 }
1080 #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
1081 #[inline]
1082 pub fn moder3(&mut self) -> _MODER3W {
1083 _MODER3W { w: self }
1084 }
1085 #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
1086 #[inline]
1087 pub fn moder2(&mut self) -> _MODER2W {
1088 _MODER2W { w: self }
1089 }
1090 #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
1091 #[inline]
1092 pub fn moder1(&mut self) -> _MODER1W {
1093 _MODER1W { w: self }
1094 }
1095 #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
1096 #[inline]
1097 pub fn moder0(&mut self) -> _MODER0W {
1098 _MODER0W { w: self }
1099 }
1100}