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
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
#[doc = "Register `PCR_ASCMode` reader"]
pub type R = crate::R<PCR_ASCMODE_SPEC>;
#[doc = "Register `PCR_ASCMode` writer"]
pub type W = crate::W<PCR_ASCMODE_SPEC>;
#[doc = "Sample Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SMD_A {
    #[doc = "0: Only one sample is taken per bit time. The current input value is sampled."]
    VALUE1 = 0,
    #[doc = "1: Three samples are taken per bit time and a majority decision is made."]
    VALUE2 = 1,
}
impl From<SMD_A> for bool {
    #[inline(always)]
    fn from(variant: SMD_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SMD` reader - Sample Mode"]
pub type SMD_R = crate::BitReader<SMD_A>;
impl SMD_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> SMD_A {
        match self.bits {
            false => SMD_A::VALUE1,
            true => SMD_A::VALUE2,
        }
    }
    #[doc = "Only one sample is taken per bit time. The current input value is sampled."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == SMD_A::VALUE1
    }
    #[doc = "Three samples are taken per bit time and a majority decision is made."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == SMD_A::VALUE2
    }
}
#[doc = "Field `SMD` writer - Sample Mode"]
pub type SMD_W<'a, REG> = crate::BitWriter<'a, REG, SMD_A>;
impl<'a, REG> SMD_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Only one sample is taken per bit time. The current input value is sampled."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(SMD_A::VALUE1)
    }
    #[doc = "Three samples are taken per bit time and a majority decision is made."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(SMD_A::VALUE2)
    }
}
#[doc = "Stop Bits\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STPB_A {
    #[doc = "0: The number of stop bits is 1."]
    VALUE1 = 0,
    #[doc = "1: The number of stop bits is 2."]
    VALUE2 = 1,
}
impl From<STPB_A> for bool {
    #[inline(always)]
    fn from(variant: STPB_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `STPB` reader - Stop Bits"]
pub type STPB_R = crate::BitReader<STPB_A>;
impl STPB_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> STPB_A {
        match self.bits {
            false => STPB_A::VALUE1,
            true => STPB_A::VALUE2,
        }
    }
    #[doc = "The number of stop bits is 1."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == STPB_A::VALUE1
    }
    #[doc = "The number of stop bits is 2."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == STPB_A::VALUE2
    }
}
#[doc = "Field `STPB` writer - Stop Bits"]
pub type STPB_W<'a, REG> = crate::BitWriter<'a, REG, STPB_A>;
impl<'a, REG> STPB_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The number of stop bits is 1."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(STPB_A::VALUE1)
    }
    #[doc = "The number of stop bits is 2."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(STPB_A::VALUE2)
    }
}
#[doc = "Idle Detection Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IDM_A {
    #[doc = "0: The bus idle detection is switched off and bits PSR.TXIDLE and PSR.RXIDLE are set automatically to enable data transfers without checking the inputs before."]
    VALUE1 = 0,
    #[doc = "1: The bus is considered as idle after a number of consecutive passive bit times defined by SCTR.FLE plus 2 (in the case without parity bit) or plus 3 (in the case with parity bit)."]
    VALUE2 = 1,
}
impl From<IDM_A> for bool {
    #[inline(always)]
    fn from(variant: IDM_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `IDM` reader - Idle Detection Mode"]
pub type IDM_R = crate::BitReader<IDM_A>;
impl IDM_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> IDM_A {
        match self.bits {
            false => IDM_A::VALUE1,
            true => IDM_A::VALUE2,
        }
    }
    #[doc = "The bus idle detection is switched off and bits PSR.TXIDLE and PSR.RXIDLE are set automatically to enable data transfers without checking the inputs before."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == IDM_A::VALUE1
    }
    #[doc = "The bus is considered as idle after a number of consecutive passive bit times defined by SCTR.FLE plus 2 (in the case without parity bit) or plus 3 (in the case with parity bit)."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == IDM_A::VALUE2
    }
}
#[doc = "Field `IDM` writer - Idle Detection Mode"]
pub type IDM_W<'a, REG> = crate::BitWriter<'a, REG, IDM_A>;
impl<'a, REG> IDM_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The bus idle detection is switched off and bits PSR.TXIDLE and PSR.RXIDLE are set automatically to enable data transfers without checking the inputs before."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(IDM_A::VALUE1)
    }
    #[doc = "The bus is considered as idle after a number of consecutive passive bit times defined by SCTR.FLE plus 2 (in the case without parity bit) or plus 3 (in the case with parity bit)."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(IDM_A::VALUE2)
    }
}
#[doc = "Synchronization Break Interrupt Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SBIEN_A {
    #[doc = "0: The interrupt generation is disabled."]
    VALUE1 = 0,
    #[doc = "1: The interrupt generation is enabled."]
    VALUE2 = 1,
}
impl From<SBIEN_A> for bool {
    #[inline(always)]
    fn from(variant: SBIEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SBIEN` reader - Synchronization Break Interrupt Enable"]
pub type SBIEN_R = crate::BitReader<SBIEN_A>;
impl SBIEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> SBIEN_A {
        match self.bits {
            false => SBIEN_A::VALUE1,
            true => SBIEN_A::VALUE2,
        }
    }
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == SBIEN_A::VALUE1
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == SBIEN_A::VALUE2
    }
}
#[doc = "Field `SBIEN` writer - Synchronization Break Interrupt Enable"]
pub type SBIEN_W<'a, REG> = crate::BitWriter<'a, REG, SBIEN_A>;
impl<'a, REG> SBIEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(SBIEN_A::VALUE1)
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(SBIEN_A::VALUE2)
    }
}
#[doc = "Collision Detection Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CDEN_A {
    #[doc = "0: The collision detection is disabled."]
    VALUE1 = 0,
    #[doc = "1: If a collision is detected, the transmitter stops its data transmission, outputs a 1, sets bit PSR.COL and generates a protocol interrupt. In order to allow data transmission again, PSR.COL has to be cleared by software."]
    VALUE2 = 1,
}
impl From<CDEN_A> for bool {
    #[inline(always)]
    fn from(variant: CDEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CDEN` reader - Collision Detection Enable"]
pub type CDEN_R = crate::BitReader<CDEN_A>;
impl CDEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> CDEN_A {
        match self.bits {
            false => CDEN_A::VALUE1,
            true => CDEN_A::VALUE2,
        }
    }
    #[doc = "The collision detection is disabled."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == CDEN_A::VALUE1
    }
    #[doc = "If a collision is detected, the transmitter stops its data transmission, outputs a 1, sets bit PSR.COL and generates a protocol interrupt. In order to allow data transmission again, PSR.COL has to be cleared by software."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == CDEN_A::VALUE2
    }
}
#[doc = "Field `CDEN` writer - Collision Detection Enable"]
pub type CDEN_W<'a, REG> = crate::BitWriter<'a, REG, CDEN_A>;
impl<'a, REG> CDEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The collision detection is disabled."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(CDEN_A::VALUE1)
    }
    #[doc = "If a collision is detected, the transmitter stops its data transmission, outputs a 1, sets bit PSR.COL and generates a protocol interrupt. In order to allow data transmission again, PSR.COL has to be cleared by software."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(CDEN_A::VALUE2)
    }
}
#[doc = "Receiver Noise Detection Interrupt Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RNIEN_A {
    #[doc = "0: The interrupt generation is disabled."]
    VALUE1 = 0,
    #[doc = "1: The interrupt generation is enabled."]
    VALUE2 = 1,
}
impl From<RNIEN_A> for bool {
    #[inline(always)]
    fn from(variant: RNIEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RNIEN` reader - Receiver Noise Detection Interrupt Enable"]
pub type RNIEN_R = crate::BitReader<RNIEN_A>;
impl RNIEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> RNIEN_A {
        match self.bits {
            false => RNIEN_A::VALUE1,
            true => RNIEN_A::VALUE2,
        }
    }
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == RNIEN_A::VALUE1
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == RNIEN_A::VALUE2
    }
}
#[doc = "Field `RNIEN` writer - Receiver Noise Detection Interrupt Enable"]
pub type RNIEN_W<'a, REG> = crate::BitWriter<'a, REG, RNIEN_A>;
impl<'a, REG> RNIEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(RNIEN_A::VALUE1)
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(RNIEN_A::VALUE2)
    }
}
#[doc = "Format Error Interrupt Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FEIEN_A {
    #[doc = "0: The interrupt generation is disabled."]
    VALUE1 = 0,
    #[doc = "1: The interrupt generation is enabled."]
    VALUE2 = 1,
}
impl From<FEIEN_A> for bool {
    #[inline(always)]
    fn from(variant: FEIEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `FEIEN` reader - Format Error Interrupt Enable"]
pub type FEIEN_R = crate::BitReader<FEIEN_A>;
impl FEIEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> FEIEN_A {
        match self.bits {
            false => FEIEN_A::VALUE1,
            true => FEIEN_A::VALUE2,
        }
    }
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == FEIEN_A::VALUE1
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == FEIEN_A::VALUE2
    }
}
#[doc = "Field `FEIEN` writer - Format Error Interrupt Enable"]
pub type FEIEN_W<'a, REG> = crate::BitWriter<'a, REG, FEIEN_A>;
impl<'a, REG> FEIEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(FEIEN_A::VALUE1)
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(FEIEN_A::VALUE2)
    }
}
#[doc = "Frame Finished Interrupt Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FFIEN_A {
    #[doc = "0: The interrupt generation is disabled."]
    VALUE1 = 0,
    #[doc = "1: The interrupt generation is enabled."]
    VALUE2 = 1,
}
impl From<FFIEN_A> for bool {
    #[inline(always)]
    fn from(variant: FFIEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `FFIEN` reader - Frame Finished Interrupt Enable"]
pub type FFIEN_R = crate::BitReader<FFIEN_A>;
impl FFIEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> FFIEN_A {
        match self.bits {
            false => FFIEN_A::VALUE1,
            true => FFIEN_A::VALUE2,
        }
    }
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == FFIEN_A::VALUE1
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == FFIEN_A::VALUE2
    }
}
#[doc = "Field `FFIEN` writer - Frame Finished Interrupt Enable"]
pub type FFIEN_W<'a, REG> = crate::BitWriter<'a, REG, FFIEN_A>;
impl<'a, REG> FFIEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The interrupt generation is disabled."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(FFIEN_A::VALUE1)
    }
    #[doc = "The interrupt generation is enabled."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(FFIEN_A::VALUE2)
    }
}
#[doc = "Field `SP` reader - Sample Point"]
pub type SP_R = crate::FieldReader;
#[doc = "Field `SP` writer - Sample Point"]
pub type SP_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
#[doc = "Pulse Length\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PL_A {
    #[doc = "0: The pulse length is equal to the bit length (no shortened 0)."]
    VALUE1 = 0,
    #[doc = "1: The pulse length of a 0 bit is 2 time quanta."]
    VALUE2 = 1,
    #[doc = "2: The pulse length of a 0 bit is 3 time quanta."]
    VALUE3 = 2,
    #[doc = "7: The pulse length of a 0 bit is 8 time quanta."]
    VALUE4 = 7,
}
impl From<PL_A> for u8 {
    #[inline(always)]
    fn from(variant: PL_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for PL_A {
    type Ux = u8;
}
impl crate::IsEnum for PL_A {}
#[doc = "Field `PL` reader - Pulse Length"]
pub type PL_R = crate::FieldReader<PL_A>;
impl PL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<PL_A> {
        match self.bits {
            0 => Some(PL_A::VALUE1),
            1 => Some(PL_A::VALUE2),
            2 => Some(PL_A::VALUE3),
            7 => Some(PL_A::VALUE4),
            _ => None,
        }
    }
    #[doc = "The pulse length is equal to the bit length (no shortened 0)."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == PL_A::VALUE1
    }
    #[doc = "The pulse length of a 0 bit is 2 time quanta."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == PL_A::VALUE2
    }
    #[doc = "The pulse length of a 0 bit is 3 time quanta."]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == PL_A::VALUE3
    }
    #[doc = "The pulse length of a 0 bit is 8 time quanta."]
    #[inline(always)]
    pub fn is_value4(&self) -> bool {
        *self == PL_A::VALUE4
    }
}
#[doc = "Field `PL` writer - Pulse Length"]
pub type PL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, PL_A>;
impl<'a, REG> PL_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "The pulse length is equal to the bit length (no shortened 0)."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(PL_A::VALUE1)
    }
    #[doc = "The pulse length of a 0 bit is 2 time quanta."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(PL_A::VALUE2)
    }
    #[doc = "The pulse length of a 0 bit is 3 time quanta."]
    #[inline(always)]
    pub fn value3(self) -> &'a mut crate::W<REG> {
        self.variant(PL_A::VALUE3)
    }
    #[doc = "The pulse length of a 0 bit is 8 time quanta."]
    #[inline(always)]
    pub fn value4(self) -> &'a mut crate::W<REG> {
        self.variant(PL_A::VALUE4)
    }
}
#[doc = "Receiver Status Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RSTEN_A {
    #[doc = "0: Flag PSR\\[9\\]
is not modified depending on the receiver status."]
    VALUE1 = 0,
    #[doc = "1: Flag PSR\\[9\\]
is set during the complete reception of a frame."]
    VALUE2 = 1,
}
impl From<RSTEN_A> for bool {
    #[inline(always)]
    fn from(variant: RSTEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RSTEN` reader - Receiver Status Enable"]
pub type RSTEN_R = crate::BitReader<RSTEN_A>;
impl RSTEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> RSTEN_A {
        match self.bits {
            false => RSTEN_A::VALUE1,
            true => RSTEN_A::VALUE2,
        }
    }
    #[doc = "Flag PSR\\[9\\]
is not modified depending on the receiver status."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == RSTEN_A::VALUE1
    }
    #[doc = "Flag PSR\\[9\\]
is set during the complete reception of a frame."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == RSTEN_A::VALUE2
    }
}
#[doc = "Field `RSTEN` writer - Receiver Status Enable"]
pub type RSTEN_W<'a, REG> = crate::BitWriter<'a, REG, RSTEN_A>;
impl<'a, REG> RSTEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Flag PSR\\[9\\]
is not modified depending on the receiver status."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(RSTEN_A::VALUE1)
    }
    #[doc = "Flag PSR\\[9\\]
is set during the complete reception of a frame."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(RSTEN_A::VALUE2)
    }
}
#[doc = "Transmitter Status Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TSTEN_A {
    #[doc = "0: Flag PSR\\[9\\]
is not modified depending on the transmitter status."]
    VALUE1 = 0,
    #[doc = "1: Flag PSR\\[9\\]
is set during the complete transmission of a frame."]
    VALUE2 = 1,
}
impl From<TSTEN_A> for bool {
    #[inline(always)]
    fn from(variant: TSTEN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TSTEN` reader - Transmitter Status Enable"]
pub type TSTEN_R = crate::BitReader<TSTEN_A>;
impl TSTEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> TSTEN_A {
        match self.bits {
            false => TSTEN_A::VALUE1,
            true => TSTEN_A::VALUE2,
        }
    }
    #[doc = "Flag PSR\\[9\\]
is not modified depending on the transmitter status."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == TSTEN_A::VALUE1
    }
    #[doc = "Flag PSR\\[9\\]
is set during the complete transmission of a frame."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == TSTEN_A::VALUE2
    }
}
#[doc = "Field `TSTEN` writer - Transmitter Status Enable"]
pub type TSTEN_W<'a, REG> = crate::BitWriter<'a, REG, TSTEN_A>;
impl<'a, REG> TSTEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Flag PSR\\[9\\]
is not modified depending on the transmitter status."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(TSTEN_A::VALUE1)
    }
    #[doc = "Flag PSR\\[9\\]
is set during the complete transmission of a frame."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(TSTEN_A::VALUE2)
    }
}
#[doc = "Master Clock Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MCLK_A {
    #[doc = "0: The MCLK generation is disabled and the MCLK signal is 0."]
    VALUE1 = 0,
    #[doc = "1: The MCLK generation is enabled."]
    VALUE2 = 1,
}
impl From<MCLK_A> for bool {
    #[inline(always)]
    fn from(variant: MCLK_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `MCLK` reader - Master Clock Enable"]
pub type MCLK_R = crate::BitReader<MCLK_A>;
impl MCLK_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> MCLK_A {
        match self.bits {
            false => MCLK_A::VALUE1,
            true => MCLK_A::VALUE2,
        }
    }
    #[doc = "The MCLK generation is disabled and the MCLK signal is 0."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == MCLK_A::VALUE1
    }
    #[doc = "The MCLK generation is enabled."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == MCLK_A::VALUE2
    }
}
#[doc = "Field `MCLK` writer - Master Clock Enable"]
pub type MCLK_W<'a, REG> = crate::BitWriter<'a, REG, MCLK_A>;
impl<'a, REG> MCLK_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The MCLK generation is disabled and the MCLK signal is 0."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(MCLK_A::VALUE1)
    }
    #[doc = "The MCLK generation is enabled."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(MCLK_A::VALUE2)
    }
}
impl R {
    #[doc = "Bit 0 - Sample Mode"]
    #[inline(always)]
    pub fn smd(&self) -> SMD_R {
        SMD_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Stop Bits"]
    #[inline(always)]
    pub fn stpb(&self) -> STPB_R {
        STPB_R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Idle Detection Mode"]
    #[inline(always)]
    pub fn idm(&self) -> IDM_R {
        IDM_R::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Synchronization Break Interrupt Enable"]
    #[inline(always)]
    pub fn sbien(&self) -> SBIEN_R {
        SBIEN_R::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Collision Detection Enable"]
    #[inline(always)]
    pub fn cden(&self) -> CDEN_R {
        CDEN_R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - Receiver Noise Detection Interrupt Enable"]
    #[inline(always)]
    pub fn rnien(&self) -> RNIEN_R {
        RNIEN_R::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Format Error Interrupt Enable"]
    #[inline(always)]
    pub fn feien(&self) -> FEIEN_R {
        FEIEN_R::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Frame Finished Interrupt Enable"]
    #[inline(always)]
    pub fn ffien(&self) -> FFIEN_R {
        FFIEN_R::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bits 8:12 - Sample Point"]
    #[inline(always)]
    pub fn sp(&self) -> SP_R {
        SP_R::new(((self.bits >> 8) & 0x1f) as u8)
    }
    #[doc = "Bits 13:15 - Pulse Length"]
    #[inline(always)]
    pub fn pl(&self) -> PL_R {
        PL_R::new(((self.bits >> 13) & 7) as u8)
    }
    #[doc = "Bit 16 - Receiver Status Enable"]
    #[inline(always)]
    pub fn rsten(&self) -> RSTEN_R {
        RSTEN_R::new(((self.bits >> 16) & 1) != 0)
    }
    #[doc = "Bit 17 - Transmitter Status Enable"]
    #[inline(always)]
    pub fn tsten(&self) -> TSTEN_R {
        TSTEN_R::new(((self.bits >> 17) & 1) != 0)
    }
    #[doc = "Bit 31 - Master Clock Enable"]
    #[inline(always)]
    pub fn mclk(&self) -> MCLK_R {
        MCLK_R::new(((self.bits >> 31) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Sample Mode"]
    #[inline(always)]
    #[must_use]
    pub fn smd(&mut self) -> SMD_W<PCR_ASCMODE_SPEC> {
        SMD_W::new(self, 0)
    }
    #[doc = "Bit 1 - Stop Bits"]
    #[inline(always)]
    #[must_use]
    pub fn stpb(&mut self) -> STPB_W<PCR_ASCMODE_SPEC> {
        STPB_W::new(self, 1)
    }
    #[doc = "Bit 2 - Idle Detection Mode"]
    #[inline(always)]
    #[must_use]
    pub fn idm(&mut self) -> IDM_W<PCR_ASCMODE_SPEC> {
        IDM_W::new(self, 2)
    }
    #[doc = "Bit 3 - Synchronization Break Interrupt Enable"]
    #[inline(always)]
    #[must_use]
    pub fn sbien(&mut self) -> SBIEN_W<PCR_ASCMODE_SPEC> {
        SBIEN_W::new(self, 3)
    }
    #[doc = "Bit 4 - Collision Detection Enable"]
    #[inline(always)]
    #[must_use]
    pub fn cden(&mut self) -> CDEN_W<PCR_ASCMODE_SPEC> {
        CDEN_W::new(self, 4)
    }
    #[doc = "Bit 5 - Receiver Noise Detection Interrupt Enable"]
    #[inline(always)]
    #[must_use]
    pub fn rnien(&mut self) -> RNIEN_W<PCR_ASCMODE_SPEC> {
        RNIEN_W::new(self, 5)
    }
    #[doc = "Bit 6 - Format Error Interrupt Enable"]
    #[inline(always)]
    #[must_use]
    pub fn feien(&mut self) -> FEIEN_W<PCR_ASCMODE_SPEC> {
        FEIEN_W::new(self, 6)
    }
    #[doc = "Bit 7 - Frame Finished Interrupt Enable"]
    #[inline(always)]
    #[must_use]
    pub fn ffien(&mut self) -> FFIEN_W<PCR_ASCMODE_SPEC> {
        FFIEN_W::new(self, 7)
    }
    #[doc = "Bits 8:12 - Sample Point"]
    #[inline(always)]
    #[must_use]
    pub fn sp(&mut self) -> SP_W<PCR_ASCMODE_SPEC> {
        SP_W::new(self, 8)
    }
    #[doc = "Bits 13:15 - Pulse Length"]
    #[inline(always)]
    #[must_use]
    pub fn pl(&mut self) -> PL_W<PCR_ASCMODE_SPEC> {
        PL_W::new(self, 13)
    }
    #[doc = "Bit 16 - Receiver Status Enable"]
    #[inline(always)]
    #[must_use]
    pub fn rsten(&mut self) -> RSTEN_W<PCR_ASCMODE_SPEC> {
        RSTEN_W::new(self, 16)
    }
    #[doc = "Bit 17 - Transmitter Status Enable"]
    #[inline(always)]
    #[must_use]
    pub fn tsten(&mut self) -> TSTEN_W<PCR_ASCMODE_SPEC> {
        TSTEN_W::new(self, 17)
    }
    #[doc = "Bit 31 - Master Clock Enable"]
    #[inline(always)]
    #[must_use]
    pub fn mclk(&mut self) -> MCLK_W<PCR_ASCMODE_SPEC> {
        MCLK_W::new(self, 31)
    }
}
#[doc = "Protocol Control Register \\[ASC Mode\\]\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pcr_ascmode::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 [`pcr_ascmode::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct PCR_ASCMODE_SPEC;
impl crate::RegisterSpec for PCR_ASCMODE_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [`pcr_ascmode::R`](R) reader structure"]
impl crate::Readable for PCR_ASCMODE_SPEC {}
#[doc = "`write(|w| ..)` method takes [`pcr_ascmode::W`](W) writer structure"]
impl crate::Writable for PCR_ASCMODE_SPEC {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets PCR_ASCMode to value 0"]
impl crate::Resettable for PCR_ASCMODE_SPEC {
    const RESET_VALUE: u32 = 0;
}