1#[doc = "Register `pe_pull1` reader"]
2pub type R = crate::R<PE_PULL1_SPEC>;
3#[doc = "Register `pe_pull1` writer"]
4pub type W = crate::W<PE_PULL1_SPEC>;
5#[doc = "Field `pe_pull[16-17]` reader - PE Pull_up/down Select"]
6pub type PE_PULL_R = crate::FieldReader<PE_PULL_A>;
7#[doc = "PE Pull_up/down Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum PE_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<PE_PULL_A> for u8 {
19 #[inline(always)]
20 fn from(variant: PE_PULL_A) -> Self {
21 variant as _
22 }
23}
24impl crate::FieldSpec for PE_PULL_A {
25 type Ux = u8;
26}
27impl PE_PULL_R {
28 #[doc = "Get enumerated values variant"]
29 #[inline(always)]
30 pub const fn variant(&self) -> PE_PULL_A {
31 match self.bits {
32 0 => PE_PULL_A::PULL_DISABLE,
33 1 => PE_PULL_A::PULL_UP,
34 2 => PE_PULL_A::PULL_DOWN,
35 _ => unreachable!(),
36 }
37 }
38 #[doc = "`0`"]
39 #[inline(always)]
40 pub fn is_pull_disable(&self) -> bool {
41 *self == PE_PULL_A::PULL_DISABLE
42 }
43 #[doc = "`1`"]
44 #[inline(always)]
45 pub fn is_pull_up(&self) -> bool {
46 *self == PE_PULL_A::PULL_UP
47 }
48 #[doc = "`10`"]
49 #[inline(always)]
50 pub fn is_pull_down(&self) -> bool {
51 *self == PE_PULL_A::PULL_DOWN
52 }
53}
54#[doc = "Field `pe_pull[16-17]` writer - PE Pull_up/down Select"]
55pub type PE_PULL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PE_PULL_A>;
56impl<'a, REG> PE_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(PE_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(PE_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(PE_PULL_A::PULL_DOWN)
75 }
76}
77impl R {
78 #[doc = "PE Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pe16_pull` field"]
79 #[inline(always)]
80 pub fn pe_pull(&self, n: u8) -> PE_PULL_R {
81 #[allow(clippy::no_effect)]
82 [(); 2][n as usize];
83 PE_PULL_R::new(((self.bits >> (n * 2)) & 3) as u8)
84 }
85 #[doc = "Bits 0:1 - PE Pull_up/down Select"]
86 #[inline(always)]
87 pub fn pe16_pull(&self) -> PE_PULL_R {
88 PE_PULL_R::new((self.bits & 3) as u8)
89 }
90 #[doc = "Bits 2:3 - PE Pull_up/down Select"]
91 #[inline(always)]
92 pub fn pe17_pull(&self) -> PE_PULL_R {
93 PE_PULL_R::new(((self.bits >> 2) & 3) as u8)
94 }
95}
96impl W {
97 #[doc = "PE Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pe16_pull` field"]
98 #[inline(always)]
99 #[must_use]
100 pub fn pe_pull(&mut self, n: u8) -> PE_PULL_W<PE_PULL1_SPEC> {
101 #[allow(clippy::no_effect)]
102 [(); 2][n as usize];
103 PE_PULL_W::new(self, n * 2)
104 }
105 #[doc = "Bits 0:1 - PE Pull_up/down Select"]
106 #[inline(always)]
107 #[must_use]
108 pub fn pe16_pull(&mut self) -> PE_PULL_W<PE_PULL1_SPEC> {
109 PE_PULL_W::new(self, 0)
110 }
111 #[doc = "Bits 2:3 - PE Pull_up/down Select"]
112 #[inline(always)]
113 #[must_use]
114 pub fn pe17_pull(&mut self) -> PE_PULL_W<PE_PULL1_SPEC> {
115 PE_PULL_W::new(self, 2)
116 }
117 #[doc = r" Writes raw bits to the register."]
118 #[doc = r""]
119 #[doc = r" # Safety"]
120 #[doc = r""]
121 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
122 #[inline(always)]
123 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
124 self.bits = bits;
125 self
126 }
127}
128#[doc = "PE Pull Register 1\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pe_pull1::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 [`pe_pull1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
129pub struct PE_PULL1_SPEC;
130impl crate::RegisterSpec for PE_PULL1_SPEC {
131 type Ux = u32;
132}
133#[doc = "`read()` method returns [`pe_pull1::R`](R) reader structure"]
134impl crate::Readable for PE_PULL1_SPEC {}
135#[doc = "`write(|w| ..)` method takes [`pe_pull1::W`](W) writer structure"]
136impl crate::Writable for PE_PULL1_SPEC {
137 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
138 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
139}
140#[doc = "`reset()` method sets pe_pull1 to value 0"]
141impl crate::Resettable for PE_PULL1_SPEC {
142 const RESET_VALUE: Self::Ux = 0;
143}