r528_pac/gpio/
pd_pull1.rs1#[doc = "Register `pd_pull1` reader"]
2pub struct R(crate::R<PD_PULL1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PD_PULL1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PD_PULL1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PD_PULL1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `pd_pull1` writer"]
17pub struct W(crate::W<PD_PULL1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PD_PULL1_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<PD_PULL1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PD_PULL1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "PD Pull_up/down Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum PD_PULL_A {
41 #[doc = "0: `0`"]
42 PULL_DISABLE = 0,
43 #[doc = "1: `1`"]
44 PULL_UP = 1,
45 #[doc = "2: `10`"]
46 PULL_DOWN = 2,
47}
48impl From<PD_PULL_A> for u8 {
49 #[inline(always)]
50 fn from(variant: PD_PULL_A) -> Self {
51 variant as _
52 }
53}
54#[doc = "Fields `PD(16-22)_PULL` reader - PD Pull_up/down Select"]
55pub type PD_PULL_R = crate::FieldReader<u8, PD_PULL_A>;
56impl PD_PULL_R {
57 #[doc = "Get enumerated values variant"]
58 #[inline(always)]
59 pub fn variant(&self) -> PD_PULL_A {
60 match self.bits {
61 0 => PD_PULL_A::PULL_DISABLE,
62 1 => PD_PULL_A::PULL_UP,
63 2 => PD_PULL_A::PULL_DOWN,
64 _ => unreachable!(),
65 }
66 }
67 #[doc = "Checks if the value of the field is `PULL_DISABLE`"]
68 #[inline(always)]
69 pub fn is_pull_disable(&self) -> bool {
70 *self == PD_PULL_A::PULL_DISABLE
71 }
72 #[doc = "Checks if the value of the field is `PULL_UP`"]
73 #[inline(always)]
74 pub fn is_pull_up(&self) -> bool {
75 *self == PD_PULL_A::PULL_UP
76 }
77 #[doc = "Checks if the value of the field is `PULL_DOWN`"]
78 #[inline(always)]
79 pub fn is_pull_down(&self) -> bool {
80 *self == PD_PULL_A::PULL_DOWN
81 }
82}
83#[doc = "Fields `PD(16-22)_PULL` writer - PD Pull_up/down Select"]
84pub type PD_PULL_W<'a, const O: u8> =
85 crate::FieldWriter<'a, u32, PD_PULL1_SPEC, u8, PD_PULL_A, 2, O>;
86impl<'a, const O: u8> PD_PULL_W<'a, O> {
87 #[doc = "`0`"]
88 #[inline(always)]
89 pub fn pull_disable(self) -> &'a mut W {
90 self.variant(PD_PULL_A::PULL_DISABLE)
91 }
92 #[doc = "`1`"]
93 #[inline(always)]
94 pub fn pull_up(self) -> &'a mut W {
95 self.variant(PD_PULL_A::PULL_UP)
96 }
97 #[doc = "`10`"]
98 #[inline(always)]
99 pub fn pull_down(self) -> &'a mut W {
100 self.variant(PD_PULL_A::PULL_DOWN)
101 }
102}
103impl R {
104 #[doc = "PD Pull_up/down Select"]
105 #[inline(always)]
106 pub unsafe fn pd_pull(&self, n: u8) -> PD_PULL_R {
107 PD_PULL_R::new(((self.bits >> ((n - 16) * 2)) & 3) as u8)
108 }
109 #[doc = "Bits 0:1 - PD Pull_up/down Select"]
110 #[inline(always)]
111 pub fn pd16_pull(&self) -> PD_PULL_R {
112 PD_PULL_R::new((self.bits & 3) as u8)
113 }
114 #[doc = "Bits 2:3 - PD Pull_up/down Select"]
115 #[inline(always)]
116 pub fn pd17_pull(&self) -> PD_PULL_R {
117 PD_PULL_R::new(((self.bits >> 2) & 3) as u8)
118 }
119 #[doc = "Bits 4:5 - PD Pull_up/down Select"]
120 #[inline(always)]
121 pub fn pd18_pull(&self) -> PD_PULL_R {
122 PD_PULL_R::new(((self.bits >> 4) & 3) as u8)
123 }
124 #[doc = "Bits 6:7 - PD Pull_up/down Select"]
125 #[inline(always)]
126 pub fn pd19_pull(&self) -> PD_PULL_R {
127 PD_PULL_R::new(((self.bits >> 6) & 3) as u8)
128 }
129 #[doc = "Bits 8:9 - PD Pull_up/down Select"]
130 #[inline(always)]
131 pub fn pd20_pull(&self) -> PD_PULL_R {
132 PD_PULL_R::new(((self.bits >> 8) & 3) as u8)
133 }
134 #[doc = "Bits 10:11 - PD Pull_up/down Select"]
135 #[inline(always)]
136 pub fn pd21_pull(&self) -> PD_PULL_R {
137 PD_PULL_R::new(((self.bits >> 10) & 3) as u8)
138 }
139 #[doc = "Bits 12:13 - PD Pull_up/down Select"]
140 #[inline(always)]
141 pub fn pd22_pull(&self) -> PD_PULL_R {
142 PD_PULL_R::new(((self.bits >> 12) & 3) as u8)
143 }
144}
145impl W {
146 #[doc = "PD Pull_up/down Select"]
147 #[inline(always)]
148 pub unsafe fn pd_pull<const O: u8>(&mut self) -> PD_PULL_W<O> {
149 PD_PULL_W::new(self)
150 }
151 #[doc = "Bits 0:1 - PD Pull_up/down Select"]
152 #[inline(always)]
153 pub fn pd16_pull(&mut self) -> PD_PULL_W<0> {
154 PD_PULL_W::new(self)
155 }
156 #[doc = "Bits 2:3 - PD Pull_up/down Select"]
157 #[inline(always)]
158 pub fn pd17_pull(&mut self) -> PD_PULL_W<2> {
159 PD_PULL_W::new(self)
160 }
161 #[doc = "Bits 4:5 - PD Pull_up/down Select"]
162 #[inline(always)]
163 pub fn pd18_pull(&mut self) -> PD_PULL_W<4> {
164 PD_PULL_W::new(self)
165 }
166 #[doc = "Bits 6:7 - PD Pull_up/down Select"]
167 #[inline(always)]
168 pub fn pd19_pull(&mut self) -> PD_PULL_W<6> {
169 PD_PULL_W::new(self)
170 }
171 #[doc = "Bits 8:9 - PD Pull_up/down Select"]
172 #[inline(always)]
173 pub fn pd20_pull(&mut self) -> PD_PULL_W<8> {
174 PD_PULL_W::new(self)
175 }
176 #[doc = "Bits 10:11 - PD Pull_up/down Select"]
177 #[inline(always)]
178 pub fn pd21_pull(&mut self) -> PD_PULL_W<10> {
179 PD_PULL_W::new(self)
180 }
181 #[doc = "Bits 12:13 - PD Pull_up/down Select"]
182 #[inline(always)]
183 pub fn pd22_pull(&mut self) -> PD_PULL_W<12> {
184 PD_PULL_W::new(self)
185 }
186 #[doc = "Writes raw bits to the register."]
187 #[inline(always)]
188 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
189 self.0.bits(bits);
190 self
191 }
192}
193#[doc = "PD Pull Register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pd_pull1](index.html) module"]
194pub struct PD_PULL1_SPEC;
195impl crate::RegisterSpec for PD_PULL1_SPEC {
196 type Ux = u32;
197}
198#[doc = "`read()` method returns [pd_pull1::R](R) reader structure"]
199impl crate::Readable for PD_PULL1_SPEC {
200 type Reader = R;
201}
202#[doc = "`write(|w| ..)` method takes [pd_pull1::W](W) writer structure"]
203impl crate::Writable for PD_PULL1_SPEC {
204 type Writer = W;
205}
206#[doc = "`reset()` method sets pd_pull1 to value 0"]
207impl crate::Resettable for PD_PULL1_SPEC {
208 #[inline(always)]
209 fn reset_value() -> Self::Ux {
210 0
211 }
212}