bl808-pac 0.0.0

Embedded Rust's Peripheral Access Crate for BL808 RISC-V microcontroller
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
#[doc = "Register `gpio_config[%s]` reader"]
pub struct R(crate::R<GPIO_CONFIG_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<GPIO_CONFIG_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<GPIO_CONFIG_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<GPIO_CONFIG_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `gpio_config[%s]` writer"]
pub struct W(crate::W<GPIO_CONFIG_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<GPIO_CONFIG_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<GPIO_CONFIG_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<GPIO_CONFIG_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `input_function` reader - Enable input signal"]
pub type INPUT_FUNCTION_R = crate::BitReader<bool>;
#[doc = "Field `input_function` writer - Enable input signal"]
pub type INPUT_FUNCTION_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `schmitt` reader - Enable schmitt trigger"]
pub type SCHMITT_R = crate::BitReader<bool>;
#[doc = "Field `schmitt` writer - Enable schmitt trigger"]
pub type SCHMITT_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `drive` reader - Drive strength"]
pub type DRIVE_R = crate::FieldReader<u8, u8>;
#[doc = "Field `drive` writer - Drive strength"]
pub type DRIVE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GPIO_CONFIG_SPEC, u8, u8, 2, O>;
#[doc = "Field `pull_up` reader - Enable internal pull-up"]
pub type PULL_UP_R = crate::BitReader<bool>;
#[doc = "Field `pull_up` writer - Enable internal pull-up"]
pub type PULL_UP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `pull_down` reader - Enable internal pull-down"]
pub type PULL_DOWN_R = crate::BitReader<bool>;
#[doc = "Field `pull_down` writer - Enable internal pull-down"]
pub type PULL_DOWN_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `output_function` reader - Enable output signal"]
pub type OUTPUT_FUNCTION_R = crate::BitReader<bool>;
#[doc = "Field `output_function` writer - Enable output signal"]
pub type OUTPUT_FUNCTION_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `alternate` reader - Pin alternate function switch"]
pub type ALTERNATE_R = crate::FieldReader<u8, ALTERNATE_A>;
#[doc = "Pin alternate function switch\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ALTERNATE_A {
    #[doc = "0: Secure Digital host"]
    SDH = 0,
    #[doc = "1: Serial Peripheral Interface 0"]
    SPI0 = 1,
    #[doc = "2: Flash control"]
    FLASH = 2,
    #[doc = "3: Inter-IC Sound"]
    I2S = 3,
    #[doc = "4: Pulse Density Modulation"]
    PDM = 4,
    #[doc = "5: Inter-Integrated Circuit bus 0"]
    I2C0 = 5,
    #[doc = "6: Inter-Integrated Circuit bus 1"]
    I2C1 = 6,
    #[doc = "7: Universal Asynchronous Receiver/Transmitter"]
    UART = 7,
    #[doc = "8: Ethernet Media Access Control"]
    EMAC = 8,
    #[doc = "9: ??"]
    CAM = 9,
    #[doc = "10: ??"]
    ANALOG = 10,
    #[doc = "11: Generic Purpose Input/Output"]
    GPIO = 11,
    #[doc = "16: Pulse-Width Modulation module 0"]
    PWM0 = 16,
    #[doc = "17: Pulse-Width Modulation module 1"]
    PWM1 = 17,
    #[doc = "18: Serial Peripheral Interface 1"]
    SPI1 = 18,
    #[doc = "19: Inter-Integrated Circuit bus 2"]
    I2C2 = 19,
    #[doc = "20: Inter-Integrated Circuit bus 3"]
    I2C3 = 20,
    #[doc = "21: Multimedia subsystem Universal Asynchronous Receiver/Transmitter"]
    MM_UART = 21,
    #[doc = "22: ??"]
    DBI_B = 22,
    #[doc = "23: ??"]
    DBI_C = 23,
    #[doc = "24: ??"]
    DPI = 24,
    #[doc = "25: Low power core JTAG interface"]
    JTAG_LP = 25,
    #[doc = "26: M0 core JTAG interface"]
    JTAG_M0 = 26,
    #[doc = "27: D0 core JTAG interface"]
    JTAG_D0 = 27,
    #[doc = "31: Clock output"]
    CLOCK_OUT = 31,
}
impl From<ALTERNATE_A> for u8 {
    #[inline(always)]
    fn from(variant: ALTERNATE_A) -> Self {
        variant as _
    }
}
impl ALTERNATE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<ALTERNATE_A> {
        match self.bits {
            0 => Some(ALTERNATE_A::SDH),
            1 => Some(ALTERNATE_A::SPI0),
            2 => Some(ALTERNATE_A::FLASH),
            3 => Some(ALTERNATE_A::I2S),
            4 => Some(ALTERNATE_A::PDM),
            5 => Some(ALTERNATE_A::I2C0),
            6 => Some(ALTERNATE_A::I2C1),
            7 => Some(ALTERNATE_A::UART),
            8 => Some(ALTERNATE_A::EMAC),
            9 => Some(ALTERNATE_A::CAM),
            10 => Some(ALTERNATE_A::ANALOG),
            11 => Some(ALTERNATE_A::GPIO),
            16 => Some(ALTERNATE_A::PWM0),
            17 => Some(ALTERNATE_A::PWM1),
            18 => Some(ALTERNATE_A::SPI1),
            19 => Some(ALTERNATE_A::I2C2),
            20 => Some(ALTERNATE_A::I2C3),
            21 => Some(ALTERNATE_A::MM_UART),
            22 => Some(ALTERNATE_A::DBI_B),
            23 => Some(ALTERNATE_A::DBI_C),
            24 => Some(ALTERNATE_A::DPI),
            25 => Some(ALTERNATE_A::JTAG_LP),
            26 => Some(ALTERNATE_A::JTAG_M0),
            27 => Some(ALTERNATE_A::JTAG_D0),
            31 => Some(ALTERNATE_A::CLOCK_OUT),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `SDH`"]
    #[inline(always)]
    pub fn is_sdh(&self) -> bool {
        *self == ALTERNATE_A::SDH
    }
    #[doc = "Checks if the value of the field is `SPI0`"]
    #[inline(always)]
    pub fn is_spi0(&self) -> bool {
        *self == ALTERNATE_A::SPI0
    }
    #[doc = "Checks if the value of the field is `FLASH`"]
    #[inline(always)]
    pub fn is_flash(&self) -> bool {
        *self == ALTERNATE_A::FLASH
    }
    #[doc = "Checks if the value of the field is `I2S`"]
    #[inline(always)]
    pub fn is_i2s(&self) -> bool {
        *self == ALTERNATE_A::I2S
    }
    #[doc = "Checks if the value of the field is `PDM`"]
    #[inline(always)]
    pub fn is_pdm(&self) -> bool {
        *self == ALTERNATE_A::PDM
    }
    #[doc = "Checks if the value of the field is `I2C0`"]
    #[inline(always)]
    pub fn is_i2c0(&self) -> bool {
        *self == ALTERNATE_A::I2C0
    }
    #[doc = "Checks if the value of the field is `I2C1`"]
    #[inline(always)]
    pub fn is_i2c1(&self) -> bool {
        *self == ALTERNATE_A::I2C1
    }
    #[doc = "Checks if the value of the field is `UART`"]
    #[inline(always)]
    pub fn is_uart(&self) -> bool {
        *self == ALTERNATE_A::UART
    }
    #[doc = "Checks if the value of the field is `EMAC`"]
    #[inline(always)]
    pub fn is_emac(&self) -> bool {
        *self == ALTERNATE_A::EMAC
    }
    #[doc = "Checks if the value of the field is `CAM`"]
    #[inline(always)]
    pub fn is_cam(&self) -> bool {
        *self == ALTERNATE_A::CAM
    }
    #[doc = "Checks if the value of the field is `ANALOG`"]
    #[inline(always)]
    pub fn is_analog(&self) -> bool {
        *self == ALTERNATE_A::ANALOG
    }
    #[doc = "Checks if the value of the field is `GPIO`"]
    #[inline(always)]
    pub fn is_gpio(&self) -> bool {
        *self == ALTERNATE_A::GPIO
    }
    #[doc = "Checks if the value of the field is `PWM0`"]
    #[inline(always)]
    pub fn is_pwm0(&self) -> bool {
        *self == ALTERNATE_A::PWM0
    }
    #[doc = "Checks if the value of the field is `PWM1`"]
    #[inline(always)]
    pub fn is_pwm1(&self) -> bool {
        *self == ALTERNATE_A::PWM1
    }
    #[doc = "Checks if the value of the field is `SPI1`"]
    #[inline(always)]
    pub fn is_spi1(&self) -> bool {
        *self == ALTERNATE_A::SPI1
    }
    #[doc = "Checks if the value of the field is `I2C2`"]
    #[inline(always)]
    pub fn is_i2c2(&self) -> bool {
        *self == ALTERNATE_A::I2C2
    }
    #[doc = "Checks if the value of the field is `I2C3`"]
    #[inline(always)]
    pub fn is_i2c3(&self) -> bool {
        *self == ALTERNATE_A::I2C3
    }
    #[doc = "Checks if the value of the field is `MM_UART`"]
    #[inline(always)]
    pub fn is_mm_uart(&self) -> bool {
        *self == ALTERNATE_A::MM_UART
    }
    #[doc = "Checks if the value of the field is `DBI_B`"]
    #[inline(always)]
    pub fn is_dbi_b(&self) -> bool {
        *self == ALTERNATE_A::DBI_B
    }
    #[doc = "Checks if the value of the field is `DBI_C`"]
    #[inline(always)]
    pub fn is_dbi_c(&self) -> bool {
        *self == ALTERNATE_A::DBI_C
    }
    #[doc = "Checks if the value of the field is `DPI`"]
    #[inline(always)]
    pub fn is_dpi(&self) -> bool {
        *self == ALTERNATE_A::DPI
    }
    #[doc = "Checks if the value of the field is `JTAG_LP`"]
    #[inline(always)]
    pub fn is_jtag_lp(&self) -> bool {
        *self == ALTERNATE_A::JTAG_LP
    }
    #[doc = "Checks if the value of the field is `JTAG_M0`"]
    #[inline(always)]
    pub fn is_jtag_m0(&self) -> bool {
        *self == ALTERNATE_A::JTAG_M0
    }
    #[doc = "Checks if the value of the field is `JTAG_D0`"]
    #[inline(always)]
    pub fn is_jtag_d0(&self) -> bool {
        *self == ALTERNATE_A::JTAG_D0
    }
    #[doc = "Checks if the value of the field is `CLOCK_OUT`"]
    #[inline(always)]
    pub fn is_clock_out(&self) -> bool {
        *self == ALTERNATE_A::CLOCK_OUT
    }
}
#[doc = "Field `alternate` writer - Pin alternate function switch"]
pub type ALTERNATE_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, GPIO_CONFIG_SPEC, u8, ALTERNATE_A, 5, O>;
impl<'a, const O: u8> ALTERNATE_W<'a, O> {
    #[doc = "Secure Digital host"]
    #[inline(always)]
    pub fn sdh(self) -> &'a mut W {
        self.variant(ALTERNATE_A::SDH)
    }
    #[doc = "Serial Peripheral Interface 0"]
    #[inline(always)]
    pub fn spi0(self) -> &'a mut W {
        self.variant(ALTERNATE_A::SPI0)
    }
    #[doc = "Flash control"]
    #[inline(always)]
    pub fn flash(self) -> &'a mut W {
        self.variant(ALTERNATE_A::FLASH)
    }
    #[doc = "Inter-IC Sound"]
    #[inline(always)]
    pub fn i2s(self) -> &'a mut W {
        self.variant(ALTERNATE_A::I2S)
    }
    #[doc = "Pulse Density Modulation"]
    #[inline(always)]
    pub fn pdm(self) -> &'a mut W {
        self.variant(ALTERNATE_A::PDM)
    }
    #[doc = "Inter-Integrated Circuit bus 0"]
    #[inline(always)]
    pub fn i2c0(self) -> &'a mut W {
        self.variant(ALTERNATE_A::I2C0)
    }
    #[doc = "Inter-Integrated Circuit bus 1"]
    #[inline(always)]
    pub fn i2c1(self) -> &'a mut W {
        self.variant(ALTERNATE_A::I2C1)
    }
    #[doc = "Universal Asynchronous Receiver/Transmitter"]
    #[inline(always)]
    pub fn uart(self) -> &'a mut W {
        self.variant(ALTERNATE_A::UART)
    }
    #[doc = "Ethernet Media Access Control"]
    #[inline(always)]
    pub fn emac(self) -> &'a mut W {
        self.variant(ALTERNATE_A::EMAC)
    }
    #[doc = "??"]
    #[inline(always)]
    pub fn cam(self) -> &'a mut W {
        self.variant(ALTERNATE_A::CAM)
    }
    #[doc = "??"]
    #[inline(always)]
    pub fn analog(self) -> &'a mut W {
        self.variant(ALTERNATE_A::ANALOG)
    }
    #[doc = "Generic Purpose Input/Output"]
    #[inline(always)]
    pub fn gpio(self) -> &'a mut W {
        self.variant(ALTERNATE_A::GPIO)
    }
    #[doc = "Pulse-Width Modulation module 0"]
    #[inline(always)]
    pub fn pwm0(self) -> &'a mut W {
        self.variant(ALTERNATE_A::PWM0)
    }
    #[doc = "Pulse-Width Modulation module 1"]
    #[inline(always)]
    pub fn pwm1(self) -> &'a mut W {
        self.variant(ALTERNATE_A::PWM1)
    }
    #[doc = "Serial Peripheral Interface 1"]
    #[inline(always)]
    pub fn spi1(self) -> &'a mut W {
        self.variant(ALTERNATE_A::SPI1)
    }
    #[doc = "Inter-Integrated Circuit bus 2"]
    #[inline(always)]
    pub fn i2c2(self) -> &'a mut W {
        self.variant(ALTERNATE_A::I2C2)
    }
    #[doc = "Inter-Integrated Circuit bus 3"]
    #[inline(always)]
    pub fn i2c3(self) -> &'a mut W {
        self.variant(ALTERNATE_A::I2C3)
    }
    #[doc = "Multimedia subsystem Universal Asynchronous Receiver/Transmitter"]
    #[inline(always)]
    pub fn mm_uart(self) -> &'a mut W {
        self.variant(ALTERNATE_A::MM_UART)
    }
    #[doc = "??"]
    #[inline(always)]
    pub fn dbi_b(self) -> &'a mut W {
        self.variant(ALTERNATE_A::DBI_B)
    }
    #[doc = "??"]
    #[inline(always)]
    pub fn dbi_c(self) -> &'a mut W {
        self.variant(ALTERNATE_A::DBI_C)
    }
    #[doc = "??"]
    #[inline(always)]
    pub fn dpi(self) -> &'a mut W {
        self.variant(ALTERNATE_A::DPI)
    }
    #[doc = "Low power core JTAG interface"]
    #[inline(always)]
    pub fn jtag_lp(self) -> &'a mut W {
        self.variant(ALTERNATE_A::JTAG_LP)
    }
    #[doc = "M0 core JTAG interface"]
    #[inline(always)]
    pub fn jtag_m0(self) -> &'a mut W {
        self.variant(ALTERNATE_A::JTAG_M0)
    }
    #[doc = "D0 core JTAG interface"]
    #[inline(always)]
    pub fn jtag_d0(self) -> &'a mut W {
        self.variant(ALTERNATE_A::JTAG_D0)
    }
    #[doc = "Clock output"]
    #[inline(always)]
    pub fn clock_out(self) -> &'a mut W {
        self.variant(ALTERNATE_A::CLOCK_OUT)
    }
}
#[doc = "Field `interrupt_mode` reader - Select pin interrupt mode"]
pub type INTERRUPT_MODE_R = crate::FieldReader<u8, u8>;
#[doc = "Field `interrupt_mode` writer - Select pin interrupt mode"]
pub type INTERRUPT_MODE_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, GPIO_CONFIG_SPEC, u8, u8, 4, O>;
#[doc = "Field `interrupt_clear` reader - Clear pin interrupt flag"]
pub type INTERRUPT_CLEAR_R = crate::BitReader<bool>;
#[doc = "Field `interrupt_clear` writer - Clear pin interrupt flag"]
pub type INTERRUPT_CLEAR_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `interrupt_state` reader - Pin interrupt state"]
pub type INTERRUPT_STATE_R = crate::BitReader<bool>;
#[doc = "Field `interrupt_state` writer - Pin interrupt state"]
pub type INTERRUPT_STATE_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `interrupt_mask` reader - Pin interrupt mask"]
pub type INTERRUPT_MASK_R = crate::BitReader<bool>;
#[doc = "Field `interrupt_mask` writer - Pin interrupt mask"]
pub type INTERRUPT_MASK_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `output_value` reader - Output value"]
pub type OUTPUT_VALUE_R = crate::BitReader<bool>;
#[doc = "Field `output_value` writer - Output value"]
pub type OUTPUT_VALUE_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `output_set` reader - Set output value to 1"]
pub type OUTPUT_SET_R = crate::BitReader<bool>;
#[doc = "Field `output_set` writer - Set output value to 1"]
pub type OUTPUT_SET_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `output_clear` reader - Clear output value to 0"]
pub type OUTPUT_CLEAR_R = crate::BitReader<bool>;
#[doc = "Field `output_clear` writer - Clear output value to 0"]
pub type OUTPUT_CLEAR_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `input_value` reader - Input value"]
pub type INPUT_VALUE_R = crate::BitReader<bool>;
#[doc = "Field `input_value` writer - Input value"]
pub type INPUT_VALUE_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPIO_CONFIG_SPEC, bool, O>;
#[doc = "Field `pin_mode` reader - Pin input/output mode switch"]
pub type PIN_MODE_R = crate::FieldReader<u8, PIN_MODE_A>;
#[doc = "Pin input/output mode switch\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PIN_MODE_A {
    #[doc = "0: Digital input mode"]
    INPUT = 0,
    #[doc = "1: Digital output mode"]
    OUTPUT = 1,
    #[doc = "2: Alternate function mode"]
    ALTERNATE = 2,
    #[doc = "3: Analog mode"]
    ANALOG = 3,
}
impl From<PIN_MODE_A> for u8 {
    #[inline(always)]
    fn from(variant: PIN_MODE_A) -> Self {
        variant as _
    }
}
impl PIN_MODE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PIN_MODE_A {
        match self.bits {
            0 => PIN_MODE_A::INPUT,
            1 => PIN_MODE_A::OUTPUT,
            2 => PIN_MODE_A::ALTERNATE,
            3 => PIN_MODE_A::ANALOG,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `INPUT`"]
    #[inline(always)]
    pub fn is_input(&self) -> bool {
        *self == PIN_MODE_A::INPUT
    }
    #[doc = "Checks if the value of the field is `OUTPUT`"]
    #[inline(always)]
    pub fn is_output(&self) -> bool {
        *self == PIN_MODE_A::OUTPUT
    }
    #[doc = "Checks if the value of the field is `ALTERNATE`"]
    #[inline(always)]
    pub fn is_alternate(&self) -> bool {
        *self == PIN_MODE_A::ALTERNATE
    }
    #[doc = "Checks if the value of the field is `ANALOG`"]
    #[inline(always)]
    pub fn is_analog(&self) -> bool {
        *self == PIN_MODE_A::ANALOG
    }
}
#[doc = "Field `pin_mode` writer - Pin input/output mode switch"]
pub type PIN_MODE_W<'a, const O: u8> =
    crate::FieldWriterSafe<'a, u32, GPIO_CONFIG_SPEC, u8, PIN_MODE_A, 2, O>;
impl<'a, const O: u8> PIN_MODE_W<'a, O> {
    #[doc = "Digital input mode"]
    #[inline(always)]
    pub fn input(self) -> &'a mut W {
        self.variant(PIN_MODE_A::INPUT)
    }
    #[doc = "Digital output mode"]
    #[inline(always)]
    pub fn output(self) -> &'a mut W {
        self.variant(PIN_MODE_A::OUTPUT)
    }
    #[doc = "Alternate function mode"]
    #[inline(always)]
    pub fn alternate(self) -> &'a mut W {
        self.variant(PIN_MODE_A::ALTERNATE)
    }
    #[doc = "Analog mode"]
    #[inline(always)]
    pub fn analog(self) -> &'a mut W {
        self.variant(PIN_MODE_A::ANALOG)
    }
}
impl R {
    #[doc = "Bit 0 - Enable input signal"]
    #[inline(always)]
    pub fn input_function(&self) -> INPUT_FUNCTION_R {
        INPUT_FUNCTION_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Enable schmitt trigger"]
    #[inline(always)]
    pub fn schmitt(&self) -> SCHMITT_R {
        SCHMITT_R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 2:3 - Drive strength"]
    #[inline(always)]
    pub fn drive(&self) -> DRIVE_R {
        DRIVE_R::new(((self.bits >> 2) & 3) as u8)
    }
    #[doc = "Bit 4 - Enable internal pull-up"]
    #[inline(always)]
    pub fn pull_up(&self) -> PULL_UP_R {
        PULL_UP_R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - Enable internal pull-down"]
    #[inline(always)]
    pub fn pull_down(&self) -> PULL_DOWN_R {
        PULL_DOWN_R::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Enable output signal"]
    #[inline(always)]
    pub fn output_function(&self) -> OUTPUT_FUNCTION_R {
        OUTPUT_FUNCTION_R::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bits 8:12 - Pin alternate function switch"]
    #[inline(always)]
    pub fn alternate(&self) -> ALTERNATE_R {
        ALTERNATE_R::new(((self.bits >> 8) & 0x1f) as u8)
    }
    #[doc = "Bits 16:19 - Select pin interrupt mode"]
    #[inline(always)]
    pub fn interrupt_mode(&self) -> INTERRUPT_MODE_R {
        INTERRUPT_MODE_R::new(((self.bits >> 16) & 0x0f) as u8)
    }
    #[doc = "Bit 20 - Clear pin interrupt flag"]
    #[inline(always)]
    pub fn interrupt_clear(&self) -> INTERRUPT_CLEAR_R {
        INTERRUPT_CLEAR_R::new(((self.bits >> 20) & 1) != 0)
    }
    #[doc = "Bit 21 - Pin interrupt state"]
    #[inline(always)]
    pub fn interrupt_state(&self) -> INTERRUPT_STATE_R {
        INTERRUPT_STATE_R::new(((self.bits >> 21) & 1) != 0)
    }
    #[doc = "Bit 22 - Pin interrupt mask"]
    #[inline(always)]
    pub fn interrupt_mask(&self) -> INTERRUPT_MASK_R {
        INTERRUPT_MASK_R::new(((self.bits >> 22) & 1) != 0)
    }
    #[doc = "Bit 24 - Output value"]
    #[inline(always)]
    pub fn output_value(&self) -> OUTPUT_VALUE_R {
        OUTPUT_VALUE_R::new(((self.bits >> 24) & 1) != 0)
    }
    #[doc = "Bit 25 - Set output value to 1"]
    #[inline(always)]
    pub fn output_set(&self) -> OUTPUT_SET_R {
        OUTPUT_SET_R::new(((self.bits >> 25) & 1) != 0)
    }
    #[doc = "Bit 26 - Clear output value to 0"]
    #[inline(always)]
    pub fn output_clear(&self) -> OUTPUT_CLEAR_R {
        OUTPUT_CLEAR_R::new(((self.bits >> 26) & 1) != 0)
    }
    #[doc = "Bit 28 - Input value"]
    #[inline(always)]
    pub fn input_value(&self) -> INPUT_VALUE_R {
        INPUT_VALUE_R::new(((self.bits >> 28) & 1) != 0)
    }
    #[doc = "Bits 30:31 - Pin input/output mode switch"]
    #[inline(always)]
    pub fn pin_mode(&self) -> PIN_MODE_R {
        PIN_MODE_R::new(((self.bits >> 30) & 3) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Enable input signal"]
    #[inline(always)]
    pub fn input_function(&mut self) -> INPUT_FUNCTION_W<0> {
        INPUT_FUNCTION_W::new(self)
    }
    #[doc = "Bit 1 - Enable schmitt trigger"]
    #[inline(always)]
    pub fn schmitt(&mut self) -> SCHMITT_W<1> {
        SCHMITT_W::new(self)
    }
    #[doc = "Bits 2:3 - Drive strength"]
    #[inline(always)]
    pub fn drive(&mut self) -> DRIVE_W<2> {
        DRIVE_W::new(self)
    }
    #[doc = "Bit 4 - Enable internal pull-up"]
    #[inline(always)]
    pub fn pull_up(&mut self) -> PULL_UP_W<4> {
        PULL_UP_W::new(self)
    }
    #[doc = "Bit 5 - Enable internal pull-down"]
    #[inline(always)]
    pub fn pull_down(&mut self) -> PULL_DOWN_W<5> {
        PULL_DOWN_W::new(self)
    }
    #[doc = "Bit 6 - Enable output signal"]
    #[inline(always)]
    pub fn output_function(&mut self) -> OUTPUT_FUNCTION_W<6> {
        OUTPUT_FUNCTION_W::new(self)
    }
    #[doc = "Bits 8:12 - Pin alternate function switch"]
    #[inline(always)]
    pub fn alternate(&mut self) -> ALTERNATE_W<8> {
        ALTERNATE_W::new(self)
    }
    #[doc = "Bits 16:19 - Select pin interrupt mode"]
    #[inline(always)]
    pub fn interrupt_mode(&mut self) -> INTERRUPT_MODE_W<16> {
        INTERRUPT_MODE_W::new(self)
    }
    #[doc = "Bit 20 - Clear pin interrupt flag"]
    #[inline(always)]
    pub fn interrupt_clear(&mut self) -> INTERRUPT_CLEAR_W<20> {
        INTERRUPT_CLEAR_W::new(self)
    }
    #[doc = "Bit 21 - Pin interrupt state"]
    #[inline(always)]
    pub fn interrupt_state(&mut self) -> INTERRUPT_STATE_W<21> {
        INTERRUPT_STATE_W::new(self)
    }
    #[doc = "Bit 22 - Pin interrupt mask"]
    #[inline(always)]
    pub fn interrupt_mask(&mut self) -> INTERRUPT_MASK_W<22> {
        INTERRUPT_MASK_W::new(self)
    }
    #[doc = "Bit 24 - Output value"]
    #[inline(always)]
    pub fn output_value(&mut self) -> OUTPUT_VALUE_W<24> {
        OUTPUT_VALUE_W::new(self)
    }
    #[doc = "Bit 25 - Set output value to 1"]
    #[inline(always)]
    pub fn output_set(&mut self) -> OUTPUT_SET_W<25> {
        OUTPUT_SET_W::new(self)
    }
    #[doc = "Bit 26 - Clear output value to 0"]
    #[inline(always)]
    pub fn output_clear(&mut self) -> OUTPUT_CLEAR_W<26> {
        OUTPUT_CLEAR_W::new(self)
    }
    #[doc = "Bit 28 - Input value"]
    #[inline(always)]
    pub fn input_value(&mut self) -> INPUT_VALUE_W<28> {
        INPUT_VALUE_W::new(self)
    }
    #[doc = "Bits 30:31 - Pin input/output mode switch"]
    #[inline(always)]
    pub fn pin_mode(&mut self) -> PIN_MODE_W<30> {
        PIN_MODE_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Generic Purpose Input/Output config\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 [gpio_config](index.html) module"]
pub struct GPIO_CONFIG_SPEC;
impl crate::RegisterSpec for GPIO_CONFIG_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [gpio_config::R](R) reader structure"]
impl crate::Readable for GPIO_CONFIG_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [gpio_config::W](W) writer structure"]
impl crate::Writable for GPIO_CONFIG_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets gpio_config[%s]
to value 0"]
impl crate::Resettable for GPIO_CONFIG_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}