1#[doc = "Register `PIO0_5` reader"]
2pub struct R(crate::R<PIO0_5_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PIO0_5_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PIO0_5_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PIO0_5_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PIO0_5` writer"]
17pub struct W(crate::W<PIO0_5_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PIO0_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<PIO0_5_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PIO0_5_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FUNC` reader - Selects pin function."]
38pub type FUNC_R = crate::FieldReader<u8, FUNC_A>;
39#[doc = "Selects pin function.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum FUNC_A {
43 #[doc = "0: General-purpose digital input/output pin."]
44 PIO0_5 = 0,
45 #[doc = "1: Transmitter output for CAN0."]
46 CAN0_TD = 1,
47 #[doc = "2: Flexcomm 4 USART receiver, I2C data I/O, SPI master-out/slave-in data, I2S data I/O."]
48 FC4_RXD_SDA_MOSI_DATA = 2,
49 #[doc = "3: CTimer3 match output 0."]
50 CTIMER3_MAT0 = 3,
51 #[doc = "4: Pin input 5 to SCTimer/PWM."]
52 SCT0_GPI5 = 4,
53 #[doc = "8: Flexcomm 3 USART request-to-send, I2C clock, SPI slave select 1."]
54 FC3_RTS_SCL_SSEL1 = 8,
55 #[doc = "9: MCLK input or output for I2S."]
56 MCLK = 9,
57 #[doc = "10: Secure GPIO pin."]
58 SEC_PIO0_5 = 10,
59}
60impl From<FUNC_A> for u8 {
61 #[inline(always)]
62 fn from(variant: FUNC_A) -> Self {
63 variant as _
64 }
65}
66impl FUNC_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> Option<FUNC_A> {
70 match self.bits {
71 0 => Some(FUNC_A::PIO0_5),
72 1 => Some(FUNC_A::CAN0_TD),
73 2 => Some(FUNC_A::FC4_RXD_SDA_MOSI_DATA),
74 3 => Some(FUNC_A::CTIMER3_MAT0),
75 4 => Some(FUNC_A::SCT0_GPI5),
76 8 => Some(FUNC_A::FC3_RTS_SCL_SSEL1),
77 9 => Some(FUNC_A::MCLK),
78 10 => Some(FUNC_A::SEC_PIO0_5),
79 _ => None,
80 }
81 }
82 #[doc = "Checks if the value of the field is `PIO0_5`"]
83 #[inline(always)]
84 pub fn is_pio0_5(&self) -> bool {
85 *self == FUNC_A::PIO0_5
86 }
87 #[doc = "Checks if the value of the field is `CAN0_TD`"]
88 #[inline(always)]
89 pub fn is_can0_td(&self) -> bool {
90 *self == FUNC_A::CAN0_TD
91 }
92 #[doc = "Checks if the value of the field is `FC4_RXD_SDA_MOSI_DATA`"]
93 #[inline(always)]
94 pub fn is_fc4_rxd_sda_mosi_data(&self) -> bool {
95 *self == FUNC_A::FC4_RXD_SDA_MOSI_DATA
96 }
97 #[doc = "Checks if the value of the field is `CTIMER3_MAT0`"]
98 #[inline(always)]
99 pub fn is_ctimer3_mat0(&self) -> bool {
100 *self == FUNC_A::CTIMER3_MAT0
101 }
102 #[doc = "Checks if the value of the field is `SCT0_GPI5`"]
103 #[inline(always)]
104 pub fn is_sct0_gpi5(&self) -> bool {
105 *self == FUNC_A::SCT0_GPI5
106 }
107 #[doc = "Checks if the value of the field is `FC3_RTS_SCL_SSEL1`"]
108 #[inline(always)]
109 pub fn is_fc3_rts_scl_ssel1(&self) -> bool {
110 *self == FUNC_A::FC3_RTS_SCL_SSEL1
111 }
112 #[doc = "Checks if the value of the field is `MCLK`"]
113 #[inline(always)]
114 pub fn is_mclk(&self) -> bool {
115 *self == FUNC_A::MCLK
116 }
117 #[doc = "Checks if the value of the field is `SEC_PIO0_5`"]
118 #[inline(always)]
119 pub fn is_sec_pio0_5(&self) -> bool {
120 *self == FUNC_A::SEC_PIO0_5
121 }
122}
123#[doc = "Field `FUNC` writer - Selects pin function."]
124pub type FUNC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PIO0_5_SPEC, u8, FUNC_A, 4, O>;
125impl<'a, const O: u8> FUNC_W<'a, O> {
126 #[doc = "General-purpose digital input/output pin."]
127 #[inline(always)]
128 pub fn pio0_5(self) -> &'a mut W {
129 self.variant(FUNC_A::PIO0_5)
130 }
131 #[doc = "Transmitter output for CAN0."]
132 #[inline(always)]
133 pub fn can0_td(self) -> &'a mut W {
134 self.variant(FUNC_A::CAN0_TD)
135 }
136 #[doc = "Flexcomm 4 USART receiver, I2C data I/O, SPI master-out/slave-in data, I2S data I/O."]
137 #[inline(always)]
138 pub fn fc4_rxd_sda_mosi_data(self) -> &'a mut W {
139 self.variant(FUNC_A::FC4_RXD_SDA_MOSI_DATA)
140 }
141 #[doc = "CTimer3 match output 0."]
142 #[inline(always)]
143 pub fn ctimer3_mat0(self) -> &'a mut W {
144 self.variant(FUNC_A::CTIMER3_MAT0)
145 }
146 #[doc = "Pin input 5 to SCTimer/PWM."]
147 #[inline(always)]
148 pub fn sct0_gpi5(self) -> &'a mut W {
149 self.variant(FUNC_A::SCT0_GPI5)
150 }
151 #[doc = "Flexcomm 3 USART request-to-send, I2C clock, SPI slave select 1."]
152 #[inline(always)]
153 pub fn fc3_rts_scl_ssel1(self) -> &'a mut W {
154 self.variant(FUNC_A::FC3_RTS_SCL_SSEL1)
155 }
156 #[doc = "MCLK input or output for I2S."]
157 #[inline(always)]
158 pub fn mclk(self) -> &'a mut W {
159 self.variant(FUNC_A::MCLK)
160 }
161 #[doc = "Secure GPIO pin."]
162 #[inline(always)]
163 pub fn sec_pio0_5(self) -> &'a mut W {
164 self.variant(FUNC_A::SEC_PIO0_5)
165 }
166}
167#[doc = "Field `MODE` reader - Selects function mode (on-chip pull-up/pull-down resistor control)."]
168pub type MODE_R = crate::FieldReader<u8, MODE_A>;
169#[doc = "Selects function mode (on-chip pull-up/pull-down resistor control).\n\nValue on reset: 2"]
170#[derive(Clone, Copy, Debug, PartialEq, Eq)]
171#[repr(u8)]
172pub enum MODE_A {
173 #[doc = "0: Inactive. Inactive (no pull-down/pull-up resistor enabled)."]
174 INACTIVE = 0,
175 #[doc = "1: Pull-down. Pull-down resistor enabled."]
176 PULL_DOWN = 1,
177 #[doc = "2: Pull-up. Pull-up resistor enabled."]
178 PULL_UP = 2,
179 #[doc = "3: Repeater. Repeater mode."]
180 REPEATER = 3,
181}
182impl From<MODE_A> for u8 {
183 #[inline(always)]
184 fn from(variant: MODE_A) -> Self {
185 variant as _
186 }
187}
188impl MODE_R {
189 #[doc = "Get enumerated values variant"]
190 #[inline(always)]
191 pub fn variant(&self) -> MODE_A {
192 match self.bits {
193 0 => MODE_A::INACTIVE,
194 1 => MODE_A::PULL_DOWN,
195 2 => MODE_A::PULL_UP,
196 3 => MODE_A::REPEATER,
197 _ => unreachable!(),
198 }
199 }
200 #[doc = "Checks if the value of the field is `INACTIVE`"]
201 #[inline(always)]
202 pub fn is_inactive(&self) -> bool {
203 *self == MODE_A::INACTIVE
204 }
205 #[doc = "Checks if the value of the field is `PULL_DOWN`"]
206 #[inline(always)]
207 pub fn is_pull_down(&self) -> bool {
208 *self == MODE_A::PULL_DOWN
209 }
210 #[doc = "Checks if the value of the field is `PULL_UP`"]
211 #[inline(always)]
212 pub fn is_pull_up(&self) -> bool {
213 *self == MODE_A::PULL_UP
214 }
215 #[doc = "Checks if the value of the field is `REPEATER`"]
216 #[inline(always)]
217 pub fn is_repeater(&self) -> bool {
218 *self == MODE_A::REPEATER
219 }
220}
221#[doc = "Field `MODE` writer - Selects function mode (on-chip pull-up/pull-down resistor control)."]
222pub type MODE_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, PIO0_5_SPEC, u8, MODE_A, 2, O>;
223impl<'a, const O: u8> MODE_W<'a, O> {
224 #[doc = "Inactive. Inactive (no pull-down/pull-up resistor enabled)."]
225 #[inline(always)]
226 pub fn inactive(self) -> &'a mut W {
227 self.variant(MODE_A::INACTIVE)
228 }
229 #[doc = "Pull-down. Pull-down resistor enabled."]
230 #[inline(always)]
231 pub fn pull_down(self) -> &'a mut W {
232 self.variant(MODE_A::PULL_DOWN)
233 }
234 #[doc = "Pull-up. Pull-up resistor enabled."]
235 #[inline(always)]
236 pub fn pull_up(self) -> &'a mut W {
237 self.variant(MODE_A::PULL_UP)
238 }
239 #[doc = "Repeater. Repeater mode."]
240 #[inline(always)]
241 pub fn repeater(self) -> &'a mut W {
242 self.variant(MODE_A::REPEATER)
243 }
244}
245#[doc = "Field `SLEW` reader - Driver slew rate."]
246pub type SLEW_R = crate::BitReader<SLEW_A>;
247#[doc = "Driver slew rate.\n\nValue on reset: 0"]
248#[derive(Clone, Copy, Debug, PartialEq, Eq)]
249pub enum SLEW_A {
250 #[doc = "0: Standard-mode, output slew rate is slower. More outputs can be switched simultaneously."]
251 STANDARD = 0,
252 #[doc = "1: Fast-mode, output slew rate is faster. Refer to the appropriate specific device data sheet for details."]
253 FAST = 1,
254}
255impl From<SLEW_A> for bool {
256 #[inline(always)]
257 fn from(variant: SLEW_A) -> Self {
258 variant as u8 != 0
259 }
260}
261impl SLEW_R {
262 #[doc = "Get enumerated values variant"]
263 #[inline(always)]
264 pub fn variant(&self) -> SLEW_A {
265 match self.bits {
266 false => SLEW_A::STANDARD,
267 true => SLEW_A::FAST,
268 }
269 }
270 #[doc = "Checks if the value of the field is `STANDARD`"]
271 #[inline(always)]
272 pub fn is_standard(&self) -> bool {
273 *self == SLEW_A::STANDARD
274 }
275 #[doc = "Checks if the value of the field is `FAST`"]
276 #[inline(always)]
277 pub fn is_fast(&self) -> bool {
278 *self == SLEW_A::FAST
279 }
280}
281#[doc = "Field `SLEW` writer - Driver slew rate."]
282pub type SLEW_W<'a, const O: u8> = crate::BitWriter<'a, u32, PIO0_5_SPEC, SLEW_A, O>;
283impl<'a, const O: u8> SLEW_W<'a, O> {
284 #[doc = "Standard-mode, output slew rate is slower. More outputs can be switched simultaneously."]
285 #[inline(always)]
286 pub fn standard(self) -> &'a mut W {
287 self.variant(SLEW_A::STANDARD)
288 }
289 #[doc = "Fast-mode, output slew rate is faster. Refer to the appropriate specific device data sheet for details."]
290 #[inline(always)]
291 pub fn fast(self) -> &'a mut W {
292 self.variant(SLEW_A::FAST)
293 }
294}
295#[doc = "Field `INVERT` reader - Input polarity."]
296pub type INVERT_R = crate::BitReader<INVERT_A>;
297#[doc = "Input polarity.\n\nValue on reset: 0"]
298#[derive(Clone, Copy, Debug, PartialEq, Eq)]
299pub enum INVERT_A {
300 #[doc = "0: Disabled. Input function is not inverted."]
301 DISABLED = 0,
302 #[doc = "1: Enabled. Input is function inverted."]
303 ENABLED = 1,
304}
305impl From<INVERT_A> for bool {
306 #[inline(always)]
307 fn from(variant: INVERT_A) -> Self {
308 variant as u8 != 0
309 }
310}
311impl INVERT_R {
312 #[doc = "Get enumerated values variant"]
313 #[inline(always)]
314 pub fn variant(&self) -> INVERT_A {
315 match self.bits {
316 false => INVERT_A::DISABLED,
317 true => INVERT_A::ENABLED,
318 }
319 }
320 #[doc = "Checks if the value of the field is `DISABLED`"]
321 #[inline(always)]
322 pub fn is_disabled(&self) -> bool {
323 *self == INVERT_A::DISABLED
324 }
325 #[doc = "Checks if the value of the field is `ENABLED`"]
326 #[inline(always)]
327 pub fn is_enabled(&self) -> bool {
328 *self == INVERT_A::ENABLED
329 }
330}
331#[doc = "Field `INVERT` writer - Input polarity."]
332pub type INVERT_W<'a, const O: u8> = crate::BitWriter<'a, u32, PIO0_5_SPEC, INVERT_A, O>;
333impl<'a, const O: u8> INVERT_W<'a, O> {
334 #[doc = "Disabled. Input function is not inverted."]
335 #[inline(always)]
336 pub fn disabled(self) -> &'a mut W {
337 self.variant(INVERT_A::DISABLED)
338 }
339 #[doc = "Enabled. Input is function inverted."]
340 #[inline(always)]
341 pub fn enabled(self) -> &'a mut W {
342 self.variant(INVERT_A::ENABLED)
343 }
344}
345#[doc = "Field `DIGIMODE` reader - Select Digital mode."]
346pub type DIGIMODE_R = crate::BitReader<DIGIMODE_A>;
347#[doc = "Select Digital mode.\n\nValue on reset: 1"]
348#[derive(Clone, Copy, Debug, PartialEq, Eq)]
349pub enum DIGIMODE_A {
350 #[doc = "0: Disable digital mode. Digital input set to 0."]
351 ANALOG = 0,
352 #[doc = "1: Enable Digital mode. Digital input is enabled."]
353 DIGITAL = 1,
354}
355impl From<DIGIMODE_A> for bool {
356 #[inline(always)]
357 fn from(variant: DIGIMODE_A) -> Self {
358 variant as u8 != 0
359 }
360}
361impl DIGIMODE_R {
362 #[doc = "Get enumerated values variant"]
363 #[inline(always)]
364 pub fn variant(&self) -> DIGIMODE_A {
365 match self.bits {
366 false => DIGIMODE_A::ANALOG,
367 true => DIGIMODE_A::DIGITAL,
368 }
369 }
370 #[doc = "Checks if the value of the field is `ANALOG`"]
371 #[inline(always)]
372 pub fn is_analog(&self) -> bool {
373 *self == DIGIMODE_A::ANALOG
374 }
375 #[doc = "Checks if the value of the field is `DIGITAL`"]
376 #[inline(always)]
377 pub fn is_digital(&self) -> bool {
378 *self == DIGIMODE_A::DIGITAL
379 }
380}
381#[doc = "Field `DIGIMODE` writer - Select Digital mode."]
382pub type DIGIMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PIO0_5_SPEC, DIGIMODE_A, O>;
383impl<'a, const O: u8> DIGIMODE_W<'a, O> {
384 #[doc = "Disable digital mode. Digital input set to 0."]
385 #[inline(always)]
386 pub fn analog(self) -> &'a mut W {
387 self.variant(DIGIMODE_A::ANALOG)
388 }
389 #[doc = "Enable Digital mode. Digital input is enabled."]
390 #[inline(always)]
391 pub fn digital(self) -> &'a mut W {
392 self.variant(DIGIMODE_A::DIGITAL)
393 }
394}
395#[doc = "Field `OD` reader - Controls open-drain mode."]
396pub type OD_R = crate::BitReader<OD_A>;
397#[doc = "Controls open-drain mode.\n\nValue on reset: 0"]
398#[derive(Clone, Copy, Debug, PartialEq, Eq)]
399pub enum OD_A {
400 #[doc = "0: Normal. Normal push-pull output."]
401 NORMAL = 0,
402 #[doc = "1: Open-drain. Simulated open-drain output (high drive disabled)."]
403 OPEN_DRAIN = 1,
404}
405impl From<OD_A> for bool {
406 #[inline(always)]
407 fn from(variant: OD_A) -> Self {
408 variant as u8 != 0
409 }
410}
411impl OD_R {
412 #[doc = "Get enumerated values variant"]
413 #[inline(always)]
414 pub fn variant(&self) -> OD_A {
415 match self.bits {
416 false => OD_A::NORMAL,
417 true => OD_A::OPEN_DRAIN,
418 }
419 }
420 #[doc = "Checks if the value of the field is `NORMAL`"]
421 #[inline(always)]
422 pub fn is_normal(&self) -> bool {
423 *self == OD_A::NORMAL
424 }
425 #[doc = "Checks if the value of the field is `OPEN_DRAIN`"]
426 #[inline(always)]
427 pub fn is_open_drain(&self) -> bool {
428 *self == OD_A::OPEN_DRAIN
429 }
430}
431#[doc = "Field `OD` writer - Controls open-drain mode."]
432pub type OD_W<'a, const O: u8> = crate::BitWriter<'a, u32, PIO0_5_SPEC, OD_A, O>;
433impl<'a, const O: u8> OD_W<'a, O> {
434 #[doc = "Normal. Normal push-pull output."]
435 #[inline(always)]
436 pub fn normal(self) -> &'a mut W {
437 self.variant(OD_A::NORMAL)
438 }
439 #[doc = "Open-drain. Simulated open-drain output (high drive disabled)."]
440 #[inline(always)]
441 pub fn open_drain(self) -> &'a mut W {
442 self.variant(OD_A::OPEN_DRAIN)
443 }
444}
445impl R {
446 #[doc = "Bits 0:3 - Selects pin function."]
447 #[inline(always)]
448 pub fn func(&self) -> FUNC_R {
449 FUNC_R::new((self.bits & 0x0f) as u8)
450 }
451 #[doc = "Bits 4:5 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
452 #[inline(always)]
453 pub fn mode(&self) -> MODE_R {
454 MODE_R::new(((self.bits >> 4) & 3) as u8)
455 }
456 #[doc = "Bit 6 - Driver slew rate."]
457 #[inline(always)]
458 pub fn slew(&self) -> SLEW_R {
459 SLEW_R::new(((self.bits >> 6) & 1) != 0)
460 }
461 #[doc = "Bit 7 - Input polarity."]
462 #[inline(always)]
463 pub fn invert(&self) -> INVERT_R {
464 INVERT_R::new(((self.bits >> 7) & 1) != 0)
465 }
466 #[doc = "Bit 8 - Select Digital mode."]
467 #[inline(always)]
468 pub fn digimode(&self) -> DIGIMODE_R {
469 DIGIMODE_R::new(((self.bits >> 8) & 1) != 0)
470 }
471 #[doc = "Bit 9 - Controls open-drain mode."]
472 #[inline(always)]
473 pub fn od(&self) -> OD_R {
474 OD_R::new(((self.bits >> 9) & 1) != 0)
475 }
476}
477impl W {
478 #[doc = "Bits 0:3 - Selects pin function."]
479 #[inline(always)]
480 pub fn func(&mut self) -> FUNC_W<0> {
481 FUNC_W::new(self)
482 }
483 #[doc = "Bits 4:5 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
484 #[inline(always)]
485 pub fn mode(&mut self) -> MODE_W<4> {
486 MODE_W::new(self)
487 }
488 #[doc = "Bit 6 - Driver slew rate."]
489 #[inline(always)]
490 pub fn slew(&mut self) -> SLEW_W<6> {
491 SLEW_W::new(self)
492 }
493 #[doc = "Bit 7 - Input polarity."]
494 #[inline(always)]
495 pub fn invert(&mut self) -> INVERT_W<7> {
496 INVERT_W::new(self)
497 }
498 #[doc = "Bit 8 - Select Digital mode."]
499 #[inline(always)]
500 pub fn digimode(&mut self) -> DIGIMODE_W<8> {
501 DIGIMODE_W::new(self)
502 }
503 #[doc = "Bit 9 - Controls open-drain mode."]
504 #[inline(always)]
505 pub fn od(&mut self) -> OD_W<9> {
506 OD_W::new(self)
507 }
508 #[doc = "Writes raw bits to the register."]
509 #[inline(always)]
510 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
511 self.0.bits(bits);
512 self
513 }
514}
515#[doc = "Digital I/O control for port 0 pins PIO0_5.\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 [pio0_5](index.html) module"]
516pub struct PIO0_5_SPEC;
517impl crate::RegisterSpec for PIO0_5_SPEC {
518 type Ux = u32;
519}
520#[doc = "`read()` method returns [pio0_5::R](R) reader structure"]
521impl crate::Readable for PIO0_5_SPEC {
522 type Reader = R;
523}
524#[doc = "`write(|w| ..)` method takes [pio0_5::W](W) writer structure"]
525impl crate::Writable for PIO0_5_SPEC {
526 type Writer = W;
527}
528#[doc = "`reset()` method sets PIO0_5 to value 0x0120"]
529impl crate::Resettable for PIO0_5_SPEC {
530 #[inline(always)]
531 fn reset_value() -> Self::Ux {
532 0x0120
533 }
534}