lpc13xx_pac/lpc1313/iocon/
pio1_5.rs1#[doc = "Register `PIO1_5` reader"]
2pub struct R(crate::R<PIO1_5_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PIO1_5_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PIO1_5_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PIO1_5_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PIO1_5` writer"]
17pub struct W(crate::W<PIO1_5_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PIO1_5_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<PIO1_5_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PIO1_5_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FUNC` reader - Selects pin function. All other values are reserved."]
38pub type FUNC_R = crate::FieldReader<u8, FUNC_A>;
39#[doc = "Selects pin function. All other values are reserved.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum FUNC_A {
43 #[doc = "0: Selects function PIO1_5."]
44 PIO = 0,
45 #[doc = "1: Selects function RTS."]
46 RTS = 1,
47 #[doc = "2: Selects function CT32B0_CAP0."]
48 CT3 = 2,
49}
50impl From<FUNC_A> for u8 {
51 #[inline(always)]
52 fn from(variant: FUNC_A) -> Self {
53 variant as _
54 }
55}
56impl FUNC_R {
57 #[doc = "Get enumerated values variant"]
58 #[inline(always)]
59 pub fn variant(&self) -> Option<FUNC_A> {
60 match self.bits {
61 0 => Some(FUNC_A::PIO),
62 1 => Some(FUNC_A::RTS),
63 2 => Some(FUNC_A::CT3),
64 _ => None,
65 }
66 }
67 #[doc = "Checks if the value of the field is `PIO`"]
68 #[inline(always)]
69 pub fn is_pio(&self) -> bool {
70 *self == FUNC_A::PIO
71 }
72 #[doc = "Checks if the value of the field is `RTS`"]
73 #[inline(always)]
74 pub fn is_rts(&self) -> bool {
75 *self == FUNC_A::RTS
76 }
77 #[doc = "Checks if the value of the field is `CT3`"]
78 #[inline(always)]
79 pub fn is_ct3(&self) -> bool {
80 *self == FUNC_A::CT3
81 }
82}
83#[doc = "Field `FUNC` writer - Selects pin function. All other values are reserved."]
84pub type FUNC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PIO1_5_SPEC, u8, FUNC_A, 3, O>;
85impl<'a, const O: u8> FUNC_W<'a, O> {
86 #[doc = "Selects function PIO1_5."]
87 #[inline(always)]
88 pub fn pio(self) -> &'a mut W {
89 self.variant(FUNC_A::PIO)
90 }
91 #[doc = "Selects function RTS."]
92 #[inline(always)]
93 pub fn rts(self) -> &'a mut W {
94 self.variant(FUNC_A::RTS)
95 }
96 #[doc = "Selects function CT32B0_CAP0."]
97 #[inline(always)]
98 pub fn ct3(self) -> &'a mut W {
99 self.variant(FUNC_A::CT3)
100 }
101}
102#[doc = "Field `MODE` reader - Selects function mode (on-chip pull-up/pull-down resistor control)"]
103pub type MODE_R = crate::FieldReader<u8, MODE_A>;
104#[doc = "Selects function mode (on-chip pull-up/pull-down resistor control)\n\nValue on reset: 2"]
105#[derive(Clone, Copy, Debug, PartialEq)]
106#[repr(u8)]
107pub enum MODE_A {
108 #[doc = "0: Inactive (no pull-down/pull-up resistor enabled)"]
109 INACTIVE_NO_PULL_DO = 0,
110 #[doc = "1: Pull-down resistor enabled"]
111 PULL_DOWN_RESISTOR_E = 1,
112 #[doc = "2: Pull-up resistor enabled"]
113 PULL_UP_RESISTOR_ENA = 2,
114 #[doc = "3: Repeater mode"]
115 REPEATER_MODE = 3,
116}
117impl From<MODE_A> for u8 {
118 #[inline(always)]
119 fn from(variant: MODE_A) -> Self {
120 variant as _
121 }
122}
123impl MODE_R {
124 #[doc = "Get enumerated values variant"]
125 #[inline(always)]
126 pub fn variant(&self) -> MODE_A {
127 match self.bits {
128 0 => MODE_A::INACTIVE_NO_PULL_DO,
129 1 => MODE_A::PULL_DOWN_RESISTOR_E,
130 2 => MODE_A::PULL_UP_RESISTOR_ENA,
131 3 => MODE_A::REPEATER_MODE,
132 _ => unreachable!(),
133 }
134 }
135 #[doc = "Checks if the value of the field is `INACTIVE_NO_PULL_DO`"]
136 #[inline(always)]
137 pub fn is_inactive_no_pull_do(&self) -> bool {
138 *self == MODE_A::INACTIVE_NO_PULL_DO
139 }
140 #[doc = "Checks if the value of the field is `PULL_DOWN_RESISTOR_E`"]
141 #[inline(always)]
142 pub fn is_pull_down_resistor_e(&self) -> bool {
143 *self == MODE_A::PULL_DOWN_RESISTOR_E
144 }
145 #[doc = "Checks if the value of the field is `PULL_UP_RESISTOR_ENA`"]
146 #[inline(always)]
147 pub fn is_pull_up_resistor_ena(&self) -> bool {
148 *self == MODE_A::PULL_UP_RESISTOR_ENA
149 }
150 #[doc = "Checks if the value of the field is `REPEATER_MODE`"]
151 #[inline(always)]
152 pub fn is_repeater_mode(&self) -> bool {
153 *self == MODE_A::REPEATER_MODE
154 }
155}
156#[doc = "Field `MODE` writer - Selects function mode (on-chip pull-up/pull-down resistor control)"]
157pub type MODE_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, PIO1_5_SPEC, u8, MODE_A, 2, O>;
158impl<'a, const O: u8> MODE_W<'a, O> {
159 #[doc = "Inactive (no pull-down/pull-up resistor enabled)"]
160 #[inline(always)]
161 pub fn inactive_no_pull_do(self) -> &'a mut W {
162 self.variant(MODE_A::INACTIVE_NO_PULL_DO)
163 }
164 #[doc = "Pull-down resistor enabled"]
165 #[inline(always)]
166 pub fn pull_down_resistor_e(self) -> &'a mut W {
167 self.variant(MODE_A::PULL_DOWN_RESISTOR_E)
168 }
169 #[doc = "Pull-up resistor enabled"]
170 #[inline(always)]
171 pub fn pull_up_resistor_ena(self) -> &'a mut W {
172 self.variant(MODE_A::PULL_UP_RESISTOR_ENA)
173 }
174 #[doc = "Repeater mode"]
175 #[inline(always)]
176 pub fn repeater_mode(self) -> &'a mut W {
177 self.variant(MODE_A::REPEATER_MODE)
178 }
179}
180#[doc = "Field `HYS` reader - Hysteresis"]
181pub type HYS_R = crate::BitReader<HYS_A>;
182#[doc = "Hysteresis\n\nValue on reset: 0"]
183#[derive(Clone, Copy, Debug, PartialEq)]
184pub enum HYS_A {
185 #[doc = "0: Disable"]
186 DISABLE = 0,
187 #[doc = "1: Enable"]
188 ENABLE = 1,
189}
190impl From<HYS_A> for bool {
191 #[inline(always)]
192 fn from(variant: HYS_A) -> Self {
193 variant as u8 != 0
194 }
195}
196impl HYS_R {
197 #[doc = "Get enumerated values variant"]
198 #[inline(always)]
199 pub fn variant(&self) -> HYS_A {
200 match self.bits {
201 false => HYS_A::DISABLE,
202 true => HYS_A::ENABLE,
203 }
204 }
205 #[doc = "Checks if the value of the field is `DISABLE`"]
206 #[inline(always)]
207 pub fn is_disable(&self) -> bool {
208 *self == HYS_A::DISABLE
209 }
210 #[doc = "Checks if the value of the field is `ENABLE`"]
211 #[inline(always)]
212 pub fn is_enable(&self) -> bool {
213 *self == HYS_A::ENABLE
214 }
215}
216#[doc = "Field `HYS` writer - Hysteresis"]
217pub type HYS_W<'a, const O: u8> = crate::BitWriter<'a, u32, PIO1_5_SPEC, HYS_A, O>;
218impl<'a, const O: u8> HYS_W<'a, O> {
219 #[doc = "Disable"]
220 #[inline(always)]
221 pub fn disable(self) -> &'a mut W {
222 self.variant(HYS_A::DISABLE)
223 }
224 #[doc = "Enable"]
225 #[inline(always)]
226 pub fn enable(self) -> &'a mut W {
227 self.variant(HYS_A::ENABLE)
228 }
229}
230#[doc = "Field `OD` reader - Selects pseudo open-drain mode."]
231pub type OD_R = crate::BitReader<OD_A>;
232#[doc = "Selects pseudo open-drain mode.\n\nValue on reset: 0"]
233#[derive(Clone, Copy, Debug, PartialEq)]
234pub enum OD_A {
235 #[doc = "0: Standard GPIO output"]
236 STANDARD_GPIO_OUTPUT = 0,
237 #[doc = "1: Open-drain output"]
238 OPEN_DRAIN_OUTPUT = 1,
239}
240impl From<OD_A> for bool {
241 #[inline(always)]
242 fn from(variant: OD_A) -> Self {
243 variant as u8 != 0
244 }
245}
246impl OD_R {
247 #[doc = "Get enumerated values variant"]
248 #[inline(always)]
249 pub fn variant(&self) -> OD_A {
250 match self.bits {
251 false => OD_A::STANDARD_GPIO_OUTPUT,
252 true => OD_A::OPEN_DRAIN_OUTPUT,
253 }
254 }
255 #[doc = "Checks if the value of the field is `STANDARD_GPIO_OUTPUT`"]
256 #[inline(always)]
257 pub fn is_standard_gpio_output(&self) -> bool {
258 *self == OD_A::STANDARD_GPIO_OUTPUT
259 }
260 #[doc = "Checks if the value of the field is `OPEN_DRAIN_OUTPUT`"]
261 #[inline(always)]
262 pub fn is_open_drain_output(&self) -> bool {
263 *self == OD_A::OPEN_DRAIN_OUTPUT
264 }
265}
266#[doc = "Field `OD` writer - Selects pseudo open-drain mode."]
267pub type OD_W<'a, const O: u8> = crate::BitWriter<'a, u32, PIO1_5_SPEC, OD_A, O>;
268impl<'a, const O: u8> OD_W<'a, O> {
269 #[doc = "Standard GPIO output"]
270 #[inline(always)]
271 pub fn standard_gpio_output(self) -> &'a mut W {
272 self.variant(OD_A::STANDARD_GPIO_OUTPUT)
273 }
274 #[doc = "Open-drain output"]
275 #[inline(always)]
276 pub fn open_drain_output(self) -> &'a mut W {
277 self.variant(OD_A::OPEN_DRAIN_OUTPUT)
278 }
279}
280impl R {
281 #[doc = "Bits 0:2 - Selects pin function. All other values are reserved."]
282 #[inline(always)]
283 pub fn func(&self) -> FUNC_R {
284 FUNC_R::new((self.bits & 7) as u8)
285 }
286 #[doc = "Bits 3:4 - Selects function mode (on-chip pull-up/pull-down resistor control)"]
287 #[inline(always)]
288 pub fn mode(&self) -> MODE_R {
289 MODE_R::new(((self.bits >> 3) & 3) as u8)
290 }
291 #[doc = "Bit 5 - Hysteresis"]
292 #[inline(always)]
293 pub fn hys(&self) -> HYS_R {
294 HYS_R::new(((self.bits >> 5) & 1) != 0)
295 }
296 #[doc = "Bit 10 - Selects pseudo open-drain mode."]
297 #[inline(always)]
298 pub fn od(&self) -> OD_R {
299 OD_R::new(((self.bits >> 10) & 1) != 0)
300 }
301}
302impl W {
303 #[doc = "Bits 0:2 - Selects pin function. All other values are reserved."]
304 #[inline(always)]
305 pub fn func(&mut self) -> FUNC_W<0> {
306 FUNC_W::new(self)
307 }
308 #[doc = "Bits 3:4 - Selects function mode (on-chip pull-up/pull-down resistor control)"]
309 #[inline(always)]
310 pub fn mode(&mut self) -> MODE_W<3> {
311 MODE_W::new(self)
312 }
313 #[doc = "Bit 5 - Hysteresis"]
314 #[inline(always)]
315 pub fn hys(&mut self) -> HYS_W<5> {
316 HYS_W::new(self)
317 }
318 #[doc = "Bit 10 - Selects pseudo open-drain mode."]
319 #[inline(always)]
320 pub fn od(&mut self) -> OD_W<10> {
321 OD_W::new(self)
322 }
323 #[doc = "Writes raw bits to the register."]
324 #[inline(always)]
325 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
326 self.0.bits(bits);
327 self
328 }
329}
330#[doc = "I/O configuration for pin PIO1_5/RTS/CT32B0_CAP0\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 [pio1_5](index.html) module"]
331pub struct PIO1_5_SPEC;
332impl crate::RegisterSpec for PIO1_5_SPEC {
333 type Ux = u32;
334}
335#[doc = "`read()` method returns [pio1_5::R](R) reader structure"]
336impl crate::Readable for PIO1_5_SPEC {
337 type Reader = R;
338}
339#[doc = "`write(|w| ..)` method takes [pio1_5::W](W) writer structure"]
340impl crate::Writable for PIO1_5_SPEC {
341 type Writer = W;
342}
343#[doc = "`reset()` method sets PIO1_5 to value 0xd0"]
344impl crate::Resettable for PIO1_5_SPEC {
345 #[inline(always)]
346 fn reset_value() -> Self::Ux {
347 0xd0
348 }
349}