1#[doc = "Reader of register PIO1_1"]
2pub type R = crate::R<u32, super::PIO1_1>;
3#[doc = "Writer for register PIO1_1"]
4pub type W = crate::W<u32, super::PIO1_1>;
5#[doc = "Register PIO1_1 `reset()`'s with value 0"]
6impl crate::ResetValue for super::PIO1_1 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Selects pin function.\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum FUNC_A {
17 #[doc = "0: Alternative connection 0."]
18 ALT0 = 0,
19 #[doc = "1: Alternative connection 1."]
20 ALT1 = 1,
21 #[doc = "2: Alternative connection 2."]
22 ALT2 = 2,
23 #[doc = "3: Alternative connection 3."]
24 ALT3 = 3,
25 #[doc = "4: Alternative connection 4."]
26 ALT4 = 4,
27 #[doc = "5: Alternative connection 5."]
28 ALT5 = 5,
29 #[doc = "6: Alternative connection 6."]
30 ALT6 = 6,
31 #[doc = "7: Alternative connection 7."]
32 ALT7 = 7,
33}
34impl From<FUNC_A> for u8 {
35 #[inline(always)]
36 fn from(variant: FUNC_A) -> Self {
37 variant as _
38 }
39}
40#[doc = "Reader of field `FUNC`"]
41pub type FUNC_R = crate::R<u8, FUNC_A>;
42impl FUNC_R {
43 #[doc = r"Get enumerated values variant"]
44 #[inline(always)]
45 pub fn variant(&self) -> crate::Variant<u8, FUNC_A> {
46 use crate::Variant::*;
47 match self.bits {
48 0 => Val(FUNC_A::ALT0),
49 1 => Val(FUNC_A::ALT1),
50 2 => Val(FUNC_A::ALT2),
51 3 => Val(FUNC_A::ALT3),
52 4 => Val(FUNC_A::ALT4),
53 5 => Val(FUNC_A::ALT5),
54 6 => Val(FUNC_A::ALT6),
55 7 => Val(FUNC_A::ALT7),
56 i => Res(i),
57 }
58 }
59 #[doc = "Checks if the value of the field is `ALT0`"]
60 #[inline(always)]
61 pub fn is_alt0(&self) -> bool {
62 *self == FUNC_A::ALT0
63 }
64 #[doc = "Checks if the value of the field is `ALT1`"]
65 #[inline(always)]
66 pub fn is_alt1(&self) -> bool {
67 *self == FUNC_A::ALT1
68 }
69 #[doc = "Checks if the value of the field is `ALT2`"]
70 #[inline(always)]
71 pub fn is_alt2(&self) -> bool {
72 *self == FUNC_A::ALT2
73 }
74 #[doc = "Checks if the value of the field is `ALT3`"]
75 #[inline(always)]
76 pub fn is_alt3(&self) -> bool {
77 *self == FUNC_A::ALT3
78 }
79 #[doc = "Checks if the value of the field is `ALT4`"]
80 #[inline(always)]
81 pub fn is_alt4(&self) -> bool {
82 *self == FUNC_A::ALT4
83 }
84 #[doc = "Checks if the value of the field is `ALT5`"]
85 #[inline(always)]
86 pub fn is_alt5(&self) -> bool {
87 *self == FUNC_A::ALT5
88 }
89 #[doc = "Checks if the value of the field is `ALT6`"]
90 #[inline(always)]
91 pub fn is_alt6(&self) -> bool {
92 *self == FUNC_A::ALT6
93 }
94 #[doc = "Checks if the value of the field is `ALT7`"]
95 #[inline(always)]
96 pub fn is_alt7(&self) -> bool {
97 *self == FUNC_A::ALT7
98 }
99}
100#[doc = "Write proxy for field `FUNC`"]
101pub struct FUNC_W<'a> {
102 w: &'a mut W,
103}
104impl<'a> FUNC_W<'a> {
105 #[doc = r"Writes `variant` to the field"]
106 #[inline(always)]
107 pub fn variant(self, variant: FUNC_A) -> &'a mut W {
108 unsafe { self.bits(variant.into()) }
109 }
110 #[doc = "Alternative connection 0."]
111 #[inline(always)]
112 pub fn alt0(self) -> &'a mut W {
113 self.variant(FUNC_A::ALT0)
114 }
115 #[doc = "Alternative connection 1."]
116 #[inline(always)]
117 pub fn alt1(self) -> &'a mut W {
118 self.variant(FUNC_A::ALT1)
119 }
120 #[doc = "Alternative connection 2."]
121 #[inline(always)]
122 pub fn alt2(self) -> &'a mut W {
123 self.variant(FUNC_A::ALT2)
124 }
125 #[doc = "Alternative connection 3."]
126 #[inline(always)]
127 pub fn alt3(self) -> &'a mut W {
128 self.variant(FUNC_A::ALT3)
129 }
130 #[doc = "Alternative connection 4."]
131 #[inline(always)]
132 pub fn alt4(self) -> &'a mut W {
133 self.variant(FUNC_A::ALT4)
134 }
135 #[doc = "Alternative connection 5."]
136 #[inline(always)]
137 pub fn alt5(self) -> &'a mut W {
138 self.variant(FUNC_A::ALT5)
139 }
140 #[doc = "Alternative connection 6."]
141 #[inline(always)]
142 pub fn alt6(self) -> &'a mut W {
143 self.variant(FUNC_A::ALT6)
144 }
145 #[doc = "Alternative connection 7."]
146 #[inline(always)]
147 pub fn alt7(self) -> &'a mut W {
148 self.variant(FUNC_A::ALT7)
149 }
150 #[doc = r"Writes raw bits to the field"]
151 #[inline(always)]
152 pub unsafe fn bits(self, value: u8) -> &'a mut W {
153 self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
154 self.w
155 }
156}
157#[doc = "Selects function mode (on-chip pull-up/pull-down resistor control).\n\nValue on reset: 0"]
158#[derive(Clone, Copy, Debug, PartialEq)]
159#[repr(u8)]
160pub enum MODE_A {
161 #[doc = "0: Inactive. Inactive (no pull-down/pull-up resistor enabled)."]
162 INACTIVE = 0,
163 #[doc = "1: Pull-down. Pull-down resistor enabled."]
164 PULL_DOWN = 1,
165 #[doc = "2: Pull-up. Pull-up resistor enabled."]
166 PULL_UP = 2,
167 #[doc = "3: Repeater. Repeater mode."]
168 REPEATER = 3,
169}
170impl From<MODE_A> for u8 {
171 #[inline(always)]
172 fn from(variant: MODE_A) -> Self {
173 variant as _
174 }
175}
176#[doc = "Reader of field `MODE`"]
177pub type MODE_R = crate::R<u8, MODE_A>;
178impl MODE_R {
179 #[doc = r"Get enumerated values variant"]
180 #[inline(always)]
181 pub fn variant(&self) -> MODE_A {
182 match self.bits {
183 0 => MODE_A::INACTIVE,
184 1 => MODE_A::PULL_DOWN,
185 2 => MODE_A::PULL_UP,
186 3 => MODE_A::REPEATER,
187 _ => unreachable!(),
188 }
189 }
190 #[doc = "Checks if the value of the field is `INACTIVE`"]
191 #[inline(always)]
192 pub fn is_inactive(&self) -> bool {
193 *self == MODE_A::INACTIVE
194 }
195 #[doc = "Checks if the value of the field is `PULL_DOWN`"]
196 #[inline(always)]
197 pub fn is_pull_down(&self) -> bool {
198 *self == MODE_A::PULL_DOWN
199 }
200 #[doc = "Checks if the value of the field is `PULL_UP`"]
201 #[inline(always)]
202 pub fn is_pull_up(&self) -> bool {
203 *self == MODE_A::PULL_UP
204 }
205 #[doc = "Checks if the value of the field is `REPEATER`"]
206 #[inline(always)]
207 pub fn is_repeater(&self) -> bool {
208 *self == MODE_A::REPEATER
209 }
210}
211#[doc = "Write proxy for field `MODE`"]
212pub struct MODE_W<'a> {
213 w: &'a mut W,
214}
215impl<'a> MODE_W<'a> {
216 #[doc = r"Writes `variant` to the field"]
217 #[inline(always)]
218 pub fn variant(self, variant: MODE_A) -> &'a mut W {
219 {
220 self.bits(variant.into())
221 }
222 }
223 #[doc = "Inactive. Inactive (no pull-down/pull-up resistor enabled)."]
224 #[inline(always)]
225 pub fn inactive(self) -> &'a mut W {
226 self.variant(MODE_A::INACTIVE)
227 }
228 #[doc = "Pull-down. Pull-down resistor enabled."]
229 #[inline(always)]
230 pub fn pull_down(self) -> &'a mut W {
231 self.variant(MODE_A::PULL_DOWN)
232 }
233 #[doc = "Pull-up. Pull-up resistor enabled."]
234 #[inline(always)]
235 pub fn pull_up(self) -> &'a mut W {
236 self.variant(MODE_A::PULL_UP)
237 }
238 #[doc = "Repeater. Repeater mode."]
239 #[inline(always)]
240 pub fn repeater(self) -> &'a mut W {
241 self.variant(MODE_A::REPEATER)
242 }
243 #[doc = r"Writes raw bits to the field"]
244 #[inline(always)]
245 pub fn bits(self, value: u8) -> &'a mut W {
246 self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
247 self.w
248 }
249}
250#[doc = "Driver slew rate.\n\nValue on reset: 0"]
251#[derive(Clone, Copy, Debug, PartialEq)]
252pub enum SLEW_A {
253 #[doc = "0: Standard-mode, output slew rate is slower. More outputs can be switched simultaneously."]
254 STANDARD = 0,
255 #[doc = "1: Fast-mode, output slew rate is faster. Refer to the appropriate specific device data sheet for details."]
256 FAST = 1,
257}
258impl From<SLEW_A> for bool {
259 #[inline(always)]
260 fn from(variant: SLEW_A) -> Self {
261 variant as u8 != 0
262 }
263}
264#[doc = "Reader of field `SLEW`"]
265pub type SLEW_R = crate::R<bool, SLEW_A>;
266impl SLEW_R {
267 #[doc = r"Get enumerated values variant"]
268 #[inline(always)]
269 pub fn variant(&self) -> SLEW_A {
270 match self.bits {
271 false => SLEW_A::STANDARD,
272 true => SLEW_A::FAST,
273 }
274 }
275 #[doc = "Checks if the value of the field is `STANDARD`"]
276 #[inline(always)]
277 pub fn is_standard(&self) -> bool {
278 *self == SLEW_A::STANDARD
279 }
280 #[doc = "Checks if the value of the field is `FAST`"]
281 #[inline(always)]
282 pub fn is_fast(&self) -> bool {
283 *self == SLEW_A::FAST
284 }
285}
286#[doc = "Write proxy for field `SLEW`"]
287pub struct SLEW_W<'a> {
288 w: &'a mut W,
289}
290impl<'a> SLEW_W<'a> {
291 #[doc = r"Writes `variant` to the field"]
292 #[inline(always)]
293 pub fn variant(self, variant: SLEW_A) -> &'a mut W {
294 {
295 self.bit(variant.into())
296 }
297 }
298 #[doc = "Standard-mode, output slew rate is slower. More outputs can be switched simultaneously."]
299 #[inline(always)]
300 pub fn standard(self) -> &'a mut W {
301 self.variant(SLEW_A::STANDARD)
302 }
303 #[doc = "Fast-mode, output slew rate is faster. Refer to the appropriate specific device data sheet for details."]
304 #[inline(always)]
305 pub fn fast(self) -> &'a mut W {
306 self.variant(SLEW_A::FAST)
307 }
308 #[doc = r"Sets the field bit"]
309 #[inline(always)]
310 pub fn set_bit(self) -> &'a mut W {
311 self.bit(true)
312 }
313 #[doc = r"Clears the field bit"]
314 #[inline(always)]
315 pub fn clear_bit(self) -> &'a mut W {
316 self.bit(false)
317 }
318 #[doc = r"Writes raw bits to the field"]
319 #[inline(always)]
320 pub fn bit(self, value: bool) -> &'a mut W {
321 self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
322 self.w
323 }
324}
325#[doc = "Input polarity.\n\nValue on reset: 0"]
326#[derive(Clone, Copy, Debug, PartialEq)]
327pub enum INVERT_A {
328 #[doc = "0: Disabled. Input function is not inverted."]
329 DISABLED = 0,
330 #[doc = "1: Enabled. Input is function inverted."]
331 ENABLED = 1,
332}
333impl From<INVERT_A> for bool {
334 #[inline(always)]
335 fn from(variant: INVERT_A) -> Self {
336 variant as u8 != 0
337 }
338}
339#[doc = "Reader of field `INVERT`"]
340pub type INVERT_R = crate::R<bool, INVERT_A>;
341impl INVERT_R {
342 #[doc = r"Get enumerated values variant"]
343 #[inline(always)]
344 pub fn variant(&self) -> INVERT_A {
345 match self.bits {
346 false => INVERT_A::DISABLED,
347 true => INVERT_A::ENABLED,
348 }
349 }
350 #[doc = "Checks if the value of the field is `DISABLED`"]
351 #[inline(always)]
352 pub fn is_disabled(&self) -> bool {
353 *self == INVERT_A::DISABLED
354 }
355 #[doc = "Checks if the value of the field is `ENABLED`"]
356 #[inline(always)]
357 pub fn is_enabled(&self) -> bool {
358 *self == INVERT_A::ENABLED
359 }
360}
361#[doc = "Write proxy for field `INVERT`"]
362pub struct INVERT_W<'a> {
363 w: &'a mut W,
364}
365impl<'a> INVERT_W<'a> {
366 #[doc = r"Writes `variant` to the field"]
367 #[inline(always)]
368 pub fn variant(self, variant: INVERT_A) -> &'a mut W {
369 {
370 self.bit(variant.into())
371 }
372 }
373 #[doc = "Disabled. Input function is not inverted."]
374 #[inline(always)]
375 pub fn disabled(self) -> &'a mut W {
376 self.variant(INVERT_A::DISABLED)
377 }
378 #[doc = "Enabled. Input is function inverted."]
379 #[inline(always)]
380 pub fn enabled(self) -> &'a mut W {
381 self.variant(INVERT_A::ENABLED)
382 }
383 #[doc = r"Sets the field bit"]
384 #[inline(always)]
385 pub fn set_bit(self) -> &'a mut W {
386 self.bit(true)
387 }
388 #[doc = r"Clears the field bit"]
389 #[inline(always)]
390 pub fn clear_bit(self) -> &'a mut W {
391 self.bit(false)
392 }
393 #[doc = r"Writes raw bits to the field"]
394 #[inline(always)]
395 pub fn bit(self, value: bool) -> &'a mut W {
396 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
397 self.w
398 }
399}
400#[doc = "Select Digital mode.\n\nValue on reset: 0"]
401#[derive(Clone, Copy, Debug, PartialEq)]
402pub enum DIGIMODE_A {
403 #[doc = "0: Disable digital mode. Digital input set to 0."]
404 ANALOG = 0,
405 #[doc = "1: Enable Digital mode. Digital input is enabled."]
406 DIGITAL = 1,
407}
408impl From<DIGIMODE_A> for bool {
409 #[inline(always)]
410 fn from(variant: DIGIMODE_A) -> Self {
411 variant as u8 != 0
412 }
413}
414#[doc = "Reader of field `DIGIMODE`"]
415pub type DIGIMODE_R = crate::R<bool, DIGIMODE_A>;
416impl DIGIMODE_R {
417 #[doc = r"Get enumerated values variant"]
418 #[inline(always)]
419 pub fn variant(&self) -> DIGIMODE_A {
420 match self.bits {
421 false => DIGIMODE_A::ANALOG,
422 true => DIGIMODE_A::DIGITAL,
423 }
424 }
425 #[doc = "Checks if the value of the field is `ANALOG`"]
426 #[inline(always)]
427 pub fn is_analog(&self) -> bool {
428 *self == DIGIMODE_A::ANALOG
429 }
430 #[doc = "Checks if the value of the field is `DIGITAL`"]
431 #[inline(always)]
432 pub fn is_digital(&self) -> bool {
433 *self == DIGIMODE_A::DIGITAL
434 }
435}
436#[doc = "Write proxy for field `DIGIMODE`"]
437pub struct DIGIMODE_W<'a> {
438 w: &'a mut W,
439}
440impl<'a> DIGIMODE_W<'a> {
441 #[doc = r"Writes `variant` to the field"]
442 #[inline(always)]
443 pub fn variant(self, variant: DIGIMODE_A) -> &'a mut W {
444 {
445 self.bit(variant.into())
446 }
447 }
448 #[doc = "Disable digital mode. Digital input set to 0."]
449 #[inline(always)]
450 pub fn analog(self) -> &'a mut W {
451 self.variant(DIGIMODE_A::ANALOG)
452 }
453 #[doc = "Enable Digital mode. Digital input is enabled."]
454 #[inline(always)]
455 pub fn digital(self) -> &'a mut W {
456 self.variant(DIGIMODE_A::DIGITAL)
457 }
458 #[doc = r"Sets the field bit"]
459 #[inline(always)]
460 pub fn set_bit(self) -> &'a mut W {
461 self.bit(true)
462 }
463 #[doc = r"Clears the field bit"]
464 #[inline(always)]
465 pub fn clear_bit(self) -> &'a mut W {
466 self.bit(false)
467 }
468 #[doc = r"Writes raw bits to the field"]
469 #[inline(always)]
470 pub fn bit(self, value: bool) -> &'a mut W {
471 self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
472 self.w
473 }
474}
475#[doc = "Controls open-drain mode.\n\nValue on reset: 0"]
476#[derive(Clone, Copy, Debug, PartialEq)]
477pub enum OD_A {
478 #[doc = "0: Normal. Normal push-pull output"]
479 NORMAL = 0,
480 #[doc = "1: Open-drain. Simulated open-drain output (high drive disabled)."]
481 OPEN_DRAIN = 1,
482}
483impl From<OD_A> for bool {
484 #[inline(always)]
485 fn from(variant: OD_A) -> Self {
486 variant as u8 != 0
487 }
488}
489#[doc = "Reader of field `OD`"]
490pub type OD_R = crate::R<bool, OD_A>;
491impl OD_R {
492 #[doc = r"Get enumerated values variant"]
493 #[inline(always)]
494 pub fn variant(&self) -> OD_A {
495 match self.bits {
496 false => OD_A::NORMAL,
497 true => OD_A::OPEN_DRAIN,
498 }
499 }
500 #[doc = "Checks if the value of the field is `NORMAL`"]
501 #[inline(always)]
502 pub fn is_normal(&self) -> bool {
503 *self == OD_A::NORMAL
504 }
505 #[doc = "Checks if the value of the field is `OPEN_DRAIN`"]
506 #[inline(always)]
507 pub fn is_open_drain(&self) -> bool {
508 *self == OD_A::OPEN_DRAIN
509 }
510}
511#[doc = "Write proxy for field `OD`"]
512pub struct OD_W<'a> {
513 w: &'a mut W,
514}
515impl<'a> OD_W<'a> {
516 #[doc = r"Writes `variant` to the field"]
517 #[inline(always)]
518 pub fn variant(self, variant: OD_A) -> &'a mut W {
519 {
520 self.bit(variant.into())
521 }
522 }
523 #[doc = "Normal. Normal push-pull output"]
524 #[inline(always)]
525 pub fn normal(self) -> &'a mut W {
526 self.variant(OD_A::NORMAL)
527 }
528 #[doc = "Open-drain. Simulated open-drain output (high drive disabled)."]
529 #[inline(always)]
530 pub fn open_drain(self) -> &'a mut W {
531 self.variant(OD_A::OPEN_DRAIN)
532 }
533 #[doc = r"Sets the field bit"]
534 #[inline(always)]
535 pub fn set_bit(self) -> &'a mut W {
536 self.bit(true)
537 }
538 #[doc = r"Clears the field bit"]
539 #[inline(always)]
540 pub fn clear_bit(self) -> &'a mut W {
541 self.bit(false)
542 }
543 #[doc = r"Writes raw bits to the field"]
544 #[inline(always)]
545 pub fn bit(self, value: bool) -> &'a mut W {
546 self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
547 self.w
548 }
549}
550impl R {
551 #[doc = "Bits 0:3 - Selects pin function."]
552 #[inline(always)]
553 pub fn func(&self) -> FUNC_R {
554 FUNC_R::new((self.bits & 0x0f) as u8)
555 }
556 #[doc = "Bits 4:5 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
557 #[inline(always)]
558 pub fn mode(&self) -> MODE_R {
559 MODE_R::new(((self.bits >> 4) & 0x03) as u8)
560 }
561 #[doc = "Bit 6 - Driver slew rate."]
562 #[inline(always)]
563 pub fn slew(&self) -> SLEW_R {
564 SLEW_R::new(((self.bits >> 6) & 0x01) != 0)
565 }
566 #[doc = "Bit 7 - Input polarity."]
567 #[inline(always)]
568 pub fn invert(&self) -> INVERT_R {
569 INVERT_R::new(((self.bits >> 7) & 0x01) != 0)
570 }
571 #[doc = "Bit 8 - Select Digital mode."]
572 #[inline(always)]
573 pub fn digimode(&self) -> DIGIMODE_R {
574 DIGIMODE_R::new(((self.bits >> 8) & 0x01) != 0)
575 }
576 #[doc = "Bit 9 - Controls open-drain mode."]
577 #[inline(always)]
578 pub fn od(&self) -> OD_R {
579 OD_R::new(((self.bits >> 9) & 0x01) != 0)
580 }
581}
582impl W {
583 #[doc = "Bits 0:3 - Selects pin function."]
584 #[inline(always)]
585 pub fn func(&mut self) -> FUNC_W {
586 FUNC_W { w: self }
587 }
588 #[doc = "Bits 4:5 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
589 #[inline(always)]
590 pub fn mode(&mut self) -> MODE_W {
591 MODE_W { w: self }
592 }
593 #[doc = "Bit 6 - Driver slew rate."]
594 #[inline(always)]
595 pub fn slew(&mut self) -> SLEW_W {
596 SLEW_W { w: self }
597 }
598 #[doc = "Bit 7 - Input polarity."]
599 #[inline(always)]
600 pub fn invert(&mut self) -> INVERT_W {
601 INVERT_W { w: self }
602 }
603 #[doc = "Bit 8 - Select Digital mode."]
604 #[inline(always)]
605 pub fn digimode(&mut self) -> DIGIMODE_W {
606 DIGIMODE_W { w: self }
607 }
608 #[doc = "Bit 9 - Controls open-drain mode."]
609 #[inline(always)]
610 pub fn od(&mut self) -> OD_W {
611 OD_W { w: self }
612 }
613}