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
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
#[doc = "Reader of register ESR1"]
pub type R = crate::R<u32, super::ESR1>;
#[doc = "Writer for register ESR1"]
pub type W = crate::W<u32, super::ESR1>;
#[doc = "Register ESR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::ESR1 {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "When FLEXCAN is Stop Mode and a recessive to dominant transition is detected on the CAN bus and if the WAK_MSK bit in the MCR Register is set, an interrupt is generated to the Arm\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WAKINT_A {
    #[doc = "0: No such occurrence"]
    WAKINT_0 = 0,
    #[doc = "1: Indicates a recessive to dominant transition received on the CAN bus when the FLEXCAN module is in Stop Mode"]
    WAKINT_1 = 1,
}
impl From<WAKINT_A> for bool {
    #[inline(always)]
    fn from(variant: WAKINT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `WAKINT`"]
pub type WAKINT_R = crate::R<bool, WAKINT_A>;
impl WAKINT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> WAKINT_A {
        match self.bits {
            false => WAKINT_A::WAKINT_0,
            true => WAKINT_A::WAKINT_1,
        }
    }
    #[doc = "Checks if the value of the field is `WAKINT_0`"]
    #[inline(always)]
    pub fn is_wakint_0(&self) -> bool {
        *self == WAKINT_A::WAKINT_0
    }
    #[doc = "Checks if the value of the field is `WAKINT_1`"]
    #[inline(always)]
    pub fn is_wakint_1(&self) -> bool {
        *self == WAKINT_A::WAKINT_1
    }
}
#[doc = "Write proxy for field `WAKINT`"]
pub struct WAKINT_W<'a> {
    w: &'a mut W,
}
impl<'a> WAKINT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: WAKINT_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "No such occurrence"]
    #[inline(always)]
    pub fn wakint_0(self) -> &'a mut W {
        self.variant(WAKINT_A::WAKINT_0)
    }
    #[doc = "Indicates a recessive to dominant transition received on the CAN bus when the FLEXCAN module is in Stop Mode"]
    #[inline(always)]
    pub fn wakint_1(self) -> &'a mut W {
        self.variant(WAKINT_A::WAKINT_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
        self.w
    }
}
#[doc = "This bit indicates that at least one of the Error Bits (bits 15-10) is set\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ERRINT_A {
    #[doc = "0: No such occurrence"]
    ERRINT_0 = 0,
    #[doc = "1: Indicates setting of any Error Bit in the Error and Status Register"]
    ERRINT_1 = 1,
}
impl From<ERRINT_A> for bool {
    #[inline(always)]
    fn from(variant: ERRINT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `ERRINT`"]
pub type ERRINT_R = crate::R<bool, ERRINT_A>;
impl ERRINT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ERRINT_A {
        match self.bits {
            false => ERRINT_A::ERRINT_0,
            true => ERRINT_A::ERRINT_1,
        }
    }
    #[doc = "Checks if the value of the field is `ERRINT_0`"]
    #[inline(always)]
    pub fn is_errint_0(&self) -> bool {
        *self == ERRINT_A::ERRINT_0
    }
    #[doc = "Checks if the value of the field is `ERRINT_1`"]
    #[inline(always)]
    pub fn is_errint_1(&self) -> bool {
        *self == ERRINT_A::ERRINT_1
    }
}
#[doc = "Write proxy for field `ERRINT`"]
pub struct ERRINT_W<'a> {
    w: &'a mut W,
}
impl<'a> ERRINT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ERRINT_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "No such occurrence"]
    #[inline(always)]
    pub fn errint_0(self) -> &'a mut W {
        self.variant(ERRINT_A::ERRINT_0)
    }
    #[doc = "Indicates setting of any Error Bit in the Error and Status Register"]
    #[inline(always)]
    pub fn errint_1(self) -> &'a mut W {
        self.variant(ERRINT_A::ERRINT_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
        self.w
    }
}
#[doc = "This bit is set when FLEXCAN enters 'Bus Off' state\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BOFFINT_A {
    #[doc = "0: No such occurrence"]
    BOFFINT_0 = 0,
    #[doc = "1: FLEXCAN module entered 'Bus Off' state"]
    BOFFINT_1 = 1,
}
impl From<BOFFINT_A> for bool {
    #[inline(always)]
    fn from(variant: BOFFINT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BOFFINT`"]
pub type BOFFINT_R = crate::R<bool, BOFFINT_A>;
impl BOFFINT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BOFFINT_A {
        match self.bits {
            false => BOFFINT_A::BOFFINT_0,
            true => BOFFINT_A::BOFFINT_1,
        }
    }
    #[doc = "Checks if the value of the field is `BOFFINT_0`"]
    #[inline(always)]
    pub fn is_boffint_0(&self) -> bool {
        *self == BOFFINT_A::BOFFINT_0
    }
    #[doc = "Checks if the value of the field is `BOFFINT_1`"]
    #[inline(always)]
    pub fn is_boffint_1(&self) -> bool {
        *self == BOFFINT_A::BOFFINT_1
    }
}
#[doc = "Write proxy for field `BOFFINT`"]
pub struct BOFFINT_W<'a> {
    w: &'a mut W,
}
impl<'a> BOFFINT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: BOFFINT_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "No such occurrence"]
    #[inline(always)]
    pub fn boffint_0(self) -> &'a mut W {
        self.variant(BOFFINT_A::BOFFINT_0)
    }
    #[doc = "FLEXCAN module entered 'Bus Off' state"]
    #[inline(always)]
    pub fn boffint_1(self) -> &'a mut W {
        self.variant(BOFFINT_A::BOFFINT_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
        self.w
    }
}
#[doc = "This bit indicates if FlexCAN is receiving a message. Refer to .\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RX_A {
    #[doc = "0: FLEXCAN is receiving a message"]
    RX_0 = 0,
    #[doc = "1: FLEXCAN is transmitting a message"]
    RX_1 = 1,
}
impl From<RX_A> for bool {
    #[inline(always)]
    fn from(variant: RX_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `RX`"]
pub type RX_R = crate::R<bool, RX_A>;
impl RX_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RX_A {
        match self.bits {
            false => RX_A::RX_0,
            true => RX_A::RX_1,
        }
    }
    #[doc = "Checks if the value of the field is `RX_0`"]
    #[inline(always)]
    pub fn is_rx_0(&self) -> bool {
        *self == RX_A::RX_0
    }
    #[doc = "Checks if the value of the field is `RX_1`"]
    #[inline(always)]
    pub fn is_rx_1(&self) -> bool {
        *self == RX_A::RX_1
    }
}
#[doc = "If the LOM bit in the Control Register is asserted, after some delay that depends on the CAN bit timing the FLT_CONF field will indicate \"Error Passive\"\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum FLTCONF_A {
    #[doc = "0: Error Active"]
    FLTCONF_0 = 0,
    #[doc = "1: Error Passive"]
    FLTCONF_1 = 1,
    #[doc = "2: Bus off"]
    FLTCONF_2 = 2,
}
impl From<FLTCONF_A> for u8 {
    #[inline(always)]
    fn from(variant: FLTCONF_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `FLTCONF`"]
pub type FLTCONF_R = crate::R<u8, FLTCONF_A>;
impl FLTCONF_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, FLTCONF_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(FLTCONF_A::FLTCONF_0),
            1 => Val(FLTCONF_A::FLTCONF_1),
            2 => Val(FLTCONF_A::FLTCONF_2),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `FLTCONF_0`"]
    #[inline(always)]
    pub fn is_fltconf_0(&self) -> bool {
        *self == FLTCONF_A::FLTCONF_0
    }
    #[doc = "Checks if the value of the field is `FLTCONF_1`"]
    #[inline(always)]
    pub fn is_fltconf_1(&self) -> bool {
        *self == FLTCONF_A::FLTCONF_1
    }
    #[doc = "Checks if the value of the field is `FLTCONF_2`"]
    #[inline(always)]
    pub fn is_fltconf_2(&self) -> bool {
        *self == FLTCONF_A::FLTCONF_2
    }
}
#[doc = "This bit indicates if FLEXCAN is transmitting a message.Refer to .\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TX_A {
    #[doc = "0: FLEXCAN is receiving a message"]
    TX_0 = 0,
    #[doc = "1: FLEXCAN is transmitting a message"]
    TX_1 = 1,
}
impl From<TX_A> for bool {
    #[inline(always)]
    fn from(variant: TX_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `TX`"]
pub type TX_R = crate::R<bool, TX_A>;
impl TX_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TX_A {
        match self.bits {
            false => TX_A::TX_0,
            true => TX_A::TX_1,
        }
    }
    #[doc = "Checks if the value of the field is `TX_0`"]
    #[inline(always)]
    pub fn is_tx_0(&self) -> bool {
        *self == TX_A::TX_0
    }
    #[doc = "Checks if the value of the field is `TX_1`"]
    #[inline(always)]
    pub fn is_tx_1(&self) -> bool {
        *self == TX_A::TX_1
    }
}
#[doc = "This bit indicates when CAN bus is in IDLE state.Refer to .\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum IDLE_A {
    #[doc = "0: No such occurrence"]
    IDLE_0 = 0,
    #[doc = "1: CAN bus is now IDLE"]
    IDLE_1 = 1,
}
impl From<IDLE_A> for bool {
    #[inline(always)]
    fn from(variant: IDLE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `IDLE`"]
pub type IDLE_R = crate::R<bool, IDLE_A>;
impl IDLE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> IDLE_A {
        match self.bits {
            false => IDLE_A::IDLE_0,
            true => IDLE_A::IDLE_1,
        }
    }
    #[doc = "Checks if the value of the field is `IDLE_0`"]
    #[inline(always)]
    pub fn is_idle_0(&self) -> bool {
        *self == IDLE_A::IDLE_0
    }
    #[doc = "Checks if the value of the field is `IDLE_1`"]
    #[inline(always)]
    pub fn is_idle_1(&self) -> bool {
        *self == IDLE_A::IDLE_1
    }
}
#[doc = "This bit indicates when repetitive errors are occurring during message reception.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXWRN_A {
    #[doc = "0: No such occurrence"]
    RXWRN_0 = 0,
    #[doc = "1: Rx_Err_Counter >= 96"]
    RXWRN_1 = 1,
}
impl From<RXWRN_A> for bool {
    #[inline(always)]
    fn from(variant: RXWRN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `RXWRN`"]
pub type RXWRN_R = crate::R<bool, RXWRN_A>;
impl RXWRN_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RXWRN_A {
        match self.bits {
            false => RXWRN_A::RXWRN_0,
            true => RXWRN_A::RXWRN_1,
        }
    }
    #[doc = "Checks if the value of the field is `RXWRN_0`"]
    #[inline(always)]
    pub fn is_rxwrn_0(&self) -> bool {
        *self == RXWRN_A::RXWRN_0
    }
    #[doc = "Checks if the value of the field is `RXWRN_1`"]
    #[inline(always)]
    pub fn is_rxwrn_1(&self) -> bool {
        *self == RXWRN_A::RXWRN_1
    }
}
#[doc = "This bit indicates when repetitive errors are occurring during message transmission.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXWRN_A {
    #[doc = "0: No such occurrence"]
    TXWRN_0 = 0,
    #[doc = "1: TX_Err_Counter >= 96"]
    TXWRN_1 = 1,
}
impl From<TXWRN_A> for bool {
    #[inline(always)]
    fn from(variant: TXWRN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `TXWRN`"]
pub type TXWRN_R = crate::R<bool, TXWRN_A>;
impl TXWRN_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TXWRN_A {
        match self.bits {
            false => TXWRN_A::TXWRN_0,
            true => TXWRN_A::TXWRN_1,
        }
    }
    #[doc = "Checks if the value of the field is `TXWRN_0`"]
    #[inline(always)]
    pub fn is_txwrn_0(&self) -> bool {
        *self == TXWRN_A::TXWRN_0
    }
    #[doc = "Checks if the value of the field is `TXWRN_1`"]
    #[inline(always)]
    pub fn is_txwrn_1(&self) -> bool {
        *self == TXWRN_A::TXWRN_1
    }
}
#[doc = "This bit indicates that a Stuffing Error has been detected.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STFERR_A {
    #[doc = "0: No such occurrence."]
    STFERR_0 = 0,
    #[doc = "1: A Stuffing Error occurred since last read of this register."]
    STFERR_1 = 1,
}
impl From<STFERR_A> for bool {
    #[inline(always)]
    fn from(variant: STFERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `STFERR`"]
pub type STFERR_R = crate::R<bool, STFERR_A>;
impl STFERR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> STFERR_A {
        match self.bits {
            false => STFERR_A::STFERR_0,
            true => STFERR_A::STFERR_1,
        }
    }
    #[doc = "Checks if the value of the field is `STFERR_0`"]
    #[inline(always)]
    pub fn is_stferr_0(&self) -> bool {
        *self == STFERR_A::STFERR_0
    }
    #[doc = "Checks if the value of the field is `STFERR_1`"]
    #[inline(always)]
    pub fn is_stferr_1(&self) -> bool {
        *self == STFERR_A::STFERR_1
    }
}
#[doc = "This bit indicates that a Form Error has been detected by the receiver node, i\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FRMERR_A {
    #[doc = "0: No such occurrence"]
    FRMERR_0 = 0,
    #[doc = "1: A Form Error occurred since last read of this register"]
    FRMERR_1 = 1,
}
impl From<FRMERR_A> for bool {
    #[inline(always)]
    fn from(variant: FRMERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `FRMERR`"]
pub type FRMERR_R = crate::R<bool, FRMERR_A>;
impl FRMERR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> FRMERR_A {
        match self.bits {
            false => FRMERR_A::FRMERR_0,
            true => FRMERR_A::FRMERR_1,
        }
    }
    #[doc = "Checks if the value of the field is `FRMERR_0`"]
    #[inline(always)]
    pub fn is_frmerr_0(&self) -> bool {
        *self == FRMERR_A::FRMERR_0
    }
    #[doc = "Checks if the value of the field is `FRMERR_1`"]
    #[inline(always)]
    pub fn is_frmerr_1(&self) -> bool {
        *self == FRMERR_A::FRMERR_1
    }
}
#[doc = "This bit indicates that a CRC Error has been detected by the receiver node, i\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CRCERR_A {
    #[doc = "0: No such occurrence"]
    CRCERR_0 = 0,
    #[doc = "1: A CRC error occurred since last read of this register."]
    CRCERR_1 = 1,
}
impl From<CRCERR_A> for bool {
    #[inline(always)]
    fn from(variant: CRCERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `CRCERR`"]
pub type CRCERR_R = crate::R<bool, CRCERR_A>;
impl CRCERR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CRCERR_A {
        match self.bits {
            false => CRCERR_A::CRCERR_0,
            true => CRCERR_A::CRCERR_1,
        }
    }
    #[doc = "Checks if the value of the field is `CRCERR_0`"]
    #[inline(always)]
    pub fn is_crcerr_0(&self) -> bool {
        *self == CRCERR_A::CRCERR_0
    }
    #[doc = "Checks if the value of the field is `CRCERR_1`"]
    #[inline(always)]
    pub fn is_crcerr_1(&self) -> bool {
        *self == CRCERR_A::CRCERR_1
    }
}
#[doc = "This bit indicates that an Acknowledge Error has been detected by the transmitter node, i\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ACKERR_A {
    #[doc = "0: No such occurrence"]
    ACKERR_0 = 0,
    #[doc = "1: An ACK error occurred since last read of this register"]
    ACKERR_1 = 1,
}
impl From<ACKERR_A> for bool {
    #[inline(always)]
    fn from(variant: ACKERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `ACKERR`"]
pub type ACKERR_R = crate::R<bool, ACKERR_A>;
impl ACKERR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ACKERR_A {
        match self.bits {
            false => ACKERR_A::ACKERR_0,
            true => ACKERR_A::ACKERR_1,
        }
    }
    #[doc = "Checks if the value of the field is `ACKERR_0`"]
    #[inline(always)]
    pub fn is_ackerr_0(&self) -> bool {
        *self == ACKERR_A::ACKERR_0
    }
    #[doc = "Checks if the value of the field is `ACKERR_1`"]
    #[inline(always)]
    pub fn is_ackerr_1(&self) -> bool {
        *self == ACKERR_A::ACKERR_1
    }
}
#[doc = "This bit indicates when an inconsistency occurs between the transmitted and the received bit in a message\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BIT0ERR_A {
    #[doc = "0: No such occurrence"]
    BIT0ERR_0 = 0,
    #[doc = "1: At least one bit sent as dominant is received as recessive"]
    BIT0ERR_1 = 1,
}
impl From<BIT0ERR_A> for bool {
    #[inline(always)]
    fn from(variant: BIT0ERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BIT0ERR`"]
pub type BIT0ERR_R = crate::R<bool, BIT0ERR_A>;
impl BIT0ERR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BIT0ERR_A {
        match self.bits {
            false => BIT0ERR_A::BIT0ERR_0,
            true => BIT0ERR_A::BIT0ERR_1,
        }
    }
    #[doc = "Checks if the value of the field is `BIT0ERR_0`"]
    #[inline(always)]
    pub fn is_bit0err_0(&self) -> bool {
        *self == BIT0ERR_A::BIT0ERR_0
    }
    #[doc = "Checks if the value of the field is `BIT0ERR_1`"]
    #[inline(always)]
    pub fn is_bit0err_1(&self) -> bool {
        *self == BIT0ERR_A::BIT0ERR_1
    }
}
#[doc = "This bit indicates when an inconsistency occurs between the transmitted and the received bit in a message\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BIT1ERR_A {
    #[doc = "0: No such occurrence"]
    BIT1ERR_0 = 0,
    #[doc = "1: At least one bit sent as recessive is received as dominant"]
    BIT1ERR_1 = 1,
}
impl From<BIT1ERR_A> for bool {
    #[inline(always)]
    fn from(variant: BIT1ERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BIT1ERR`"]
pub type BIT1ERR_R = crate::R<bool, BIT1ERR_A>;
impl BIT1ERR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BIT1ERR_A {
        match self.bits {
            false => BIT1ERR_A::BIT1ERR_0,
            true => BIT1ERR_A::BIT1ERR_1,
        }
    }
    #[doc = "Checks if the value of the field is `BIT1ERR_0`"]
    #[inline(always)]
    pub fn is_bit1err_0(&self) -> bool {
        *self == BIT1ERR_A::BIT1ERR_0
    }
    #[doc = "Checks if the value of the field is `BIT1ERR_1`"]
    #[inline(always)]
    pub fn is_bit1err_1(&self) -> bool {
        *self == BIT1ERR_A::BIT1ERR_1
    }
}
#[doc = "If the WRN_EN bit in MCR is asserted, the RWRN_INT bit is set when the RX_WRN flag transition from '0' to '1', meaning that the Rx error counters reached 96\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RWRNINT_A {
    #[doc = "0: No such occurrence"]
    RWRNINT_0 = 0,
    #[doc = "1: The Rx error counter transition from < 96 to >= 96"]
    RWRNINT_1 = 1,
}
impl From<RWRNINT_A> for bool {
    #[inline(always)]
    fn from(variant: RWRNINT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `RWRNINT`"]
pub type RWRNINT_R = crate::R<bool, RWRNINT_A>;
impl RWRNINT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RWRNINT_A {
        match self.bits {
            false => RWRNINT_A::RWRNINT_0,
            true => RWRNINT_A::RWRNINT_1,
        }
    }
    #[doc = "Checks if the value of the field is `RWRNINT_0`"]
    #[inline(always)]
    pub fn is_rwrnint_0(&self) -> bool {
        *self == RWRNINT_A::RWRNINT_0
    }
    #[doc = "Checks if the value of the field is `RWRNINT_1`"]
    #[inline(always)]
    pub fn is_rwrnint_1(&self) -> bool {
        *self == RWRNINT_A::RWRNINT_1
    }
}
#[doc = "Write proxy for field `RWRNINT`"]
pub struct RWRNINT_W<'a> {
    w: &'a mut W,
}
impl<'a> RWRNINT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RWRNINT_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "No such occurrence"]
    #[inline(always)]
    pub fn rwrnint_0(self) -> &'a mut W {
        self.variant(RWRNINT_A::RWRNINT_0)
    }
    #[doc = "The Rx error counter transition from < 96 to >= 96"]
    #[inline(always)]
    pub fn rwrnint_1(self) -> &'a mut W {
        self.variant(RWRNINT_A::RWRNINT_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
        self.w
    }
}
#[doc = "If the WRN_EN bit in MCR is asserted, the TWRN_INT bit is set when the TX_WRN flag transition from '0' to '1', meaning that the Tx error counter reached 96\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TWRNINT_A {
    #[doc = "0: No such occurrence"]
    TWRNINT_0 = 0,
    #[doc = "1: The Tx error counter transition from < 96 to >= 96"]
    TWRNINT_1 = 1,
}
impl From<TWRNINT_A> for bool {
    #[inline(always)]
    fn from(variant: TWRNINT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `TWRNINT`"]
pub type TWRNINT_R = crate::R<bool, TWRNINT_A>;
impl TWRNINT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TWRNINT_A {
        match self.bits {
            false => TWRNINT_A::TWRNINT_0,
            true => TWRNINT_A::TWRNINT_1,
        }
    }
    #[doc = "Checks if the value of the field is `TWRNINT_0`"]
    #[inline(always)]
    pub fn is_twrnint_0(&self) -> bool {
        *self == TWRNINT_A::TWRNINT_0
    }
    #[doc = "Checks if the value of the field is `TWRNINT_1`"]
    #[inline(always)]
    pub fn is_twrnint_1(&self) -> bool {
        *self == TWRNINT_A::TWRNINT_1
    }
}
#[doc = "Write proxy for field `TWRNINT`"]
pub struct TWRNINT_W<'a> {
    w: &'a mut W,
}
impl<'a> TWRNINT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: TWRNINT_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "No such occurrence"]
    #[inline(always)]
    pub fn twrnint_0(self) -> &'a mut W {
        self.variant(TWRNINT_A::TWRNINT_0)
    }
    #[doc = "The Tx error counter transition from < 96 to >= 96"]
    #[inline(always)]
    pub fn twrnint_1(self) -> &'a mut W {
        self.variant(TWRNINT_A::TWRNINT_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
        self.w
    }
}
#[doc = "This read-only flag indicates whether the FlexCAN is synchronized to the CAN bus and able to participate in the communication process\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SYNCH_A {
    #[doc = "0: FlexCAN is not synchronized to the CAN bus"]
    SYNCH_0 = 0,
    #[doc = "1: FlexCAN is synchronized to the CAN bus"]
    SYNCH_1 = 1,
}
impl From<SYNCH_A> for bool {
    #[inline(always)]
    fn from(variant: SYNCH_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `SYNCH`"]
pub type SYNCH_R = crate::R<bool, SYNCH_A>;
impl SYNCH_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SYNCH_A {
        match self.bits {
            false => SYNCH_A::SYNCH_0,
            true => SYNCH_A::SYNCH_1,
        }
    }
    #[doc = "Checks if the value of the field is `SYNCH_0`"]
    #[inline(always)]
    pub fn is_synch_0(&self) -> bool {
        *self == SYNCH_A::SYNCH_0
    }
    #[doc = "Checks if the value of the field is `SYNCH_1`"]
    #[inline(always)]
    pub fn is_synch_1(&self) -> bool {
        *self == SYNCH_A::SYNCH_1
    }
}
impl R {
    #[doc = "Bit 0 - When FLEXCAN is Stop Mode and a recessive to dominant transition is detected on the CAN bus and if the WAK_MSK bit in the MCR Register is set, an interrupt is generated to the Arm"]
    #[inline(always)]
    pub fn wakint(&self) -> WAKINT_R {
        WAKINT_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - This bit indicates that at least one of the Error Bits (bits 15-10) is set"]
    #[inline(always)]
    pub fn errint(&self) -> ERRINT_R {
        ERRINT_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - This bit is set when FLEXCAN enters 'Bus Off' state"]
    #[inline(always)]
    pub fn boffint(&self) -> BOFFINT_R {
        BOFFINT_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - This bit indicates if FlexCAN is receiving a message. Refer to ."]
    #[inline(always)]
    pub fn rx(&self) -> RX_R {
        RX_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bits 4:5 - If the LOM bit in the Control Register is asserted, after some delay that depends on the CAN bit timing the FLT_CONF field will indicate \"Error Passive\""]
    #[inline(always)]
    pub fn fltconf(&self) -> FLTCONF_R {
        FLTCONF_R::new(((self.bits >> 4) & 0x03) as u8)
    }
    #[doc = "Bit 6 - This bit indicates if FLEXCAN is transmitting a message.Refer to ."]
    #[inline(always)]
    pub fn tx(&self) -> TX_R {
        TX_R::new(((self.bits >> 6) & 0x01) != 0)
    }
    #[doc = "Bit 7 - This bit indicates when CAN bus is in IDLE state.Refer to ."]
    #[inline(always)]
    pub fn idle(&self) -> IDLE_R {
        IDLE_R::new(((self.bits >> 7) & 0x01) != 0)
    }
    #[doc = "Bit 8 - This bit indicates when repetitive errors are occurring during message reception."]
    #[inline(always)]
    pub fn rxwrn(&self) -> RXWRN_R {
        RXWRN_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bit 9 - This bit indicates when repetitive errors are occurring during message transmission."]
    #[inline(always)]
    pub fn txwrn(&self) -> TXWRN_R {
        TXWRN_R::new(((self.bits >> 9) & 0x01) != 0)
    }
    #[doc = "Bit 10 - This bit indicates that a Stuffing Error has been detected."]
    #[inline(always)]
    pub fn stferr(&self) -> STFERR_R {
        STFERR_R::new(((self.bits >> 10) & 0x01) != 0)
    }
    #[doc = "Bit 11 - This bit indicates that a Form Error has been detected by the receiver node, i"]
    #[inline(always)]
    pub fn frmerr(&self) -> FRMERR_R {
        FRMERR_R::new(((self.bits >> 11) & 0x01) != 0)
    }
    #[doc = "Bit 12 - This bit indicates that a CRC Error has been detected by the receiver node, i"]
    #[inline(always)]
    pub fn crcerr(&self) -> CRCERR_R {
        CRCERR_R::new(((self.bits >> 12) & 0x01) != 0)
    }
    #[doc = "Bit 13 - This bit indicates that an Acknowledge Error has been detected by the transmitter node, i"]
    #[inline(always)]
    pub fn ackerr(&self) -> ACKERR_R {
        ACKERR_R::new(((self.bits >> 13) & 0x01) != 0)
    }
    #[doc = "Bit 14 - This bit indicates when an inconsistency occurs between the transmitted and the received bit in a message"]
    #[inline(always)]
    pub fn bit0err(&self) -> BIT0ERR_R {
        BIT0ERR_R::new(((self.bits >> 14) & 0x01) != 0)
    }
    #[doc = "Bit 15 - This bit indicates when an inconsistency occurs between the transmitted and the received bit in a message"]
    #[inline(always)]
    pub fn bit1err(&self) -> BIT1ERR_R {
        BIT1ERR_R::new(((self.bits >> 15) & 0x01) != 0)
    }
    #[doc = "Bit 16 - If the WRN_EN bit in MCR is asserted, the RWRN_INT bit is set when the RX_WRN flag transition from '0' to '1', meaning that the Rx error counters reached 96"]
    #[inline(always)]
    pub fn rwrnint(&self) -> RWRNINT_R {
        RWRNINT_R::new(((self.bits >> 16) & 0x01) != 0)
    }
    #[doc = "Bit 17 - If the WRN_EN bit in MCR is asserted, the TWRN_INT bit is set when the TX_WRN flag transition from '0' to '1', meaning that the Tx error counter reached 96"]
    #[inline(always)]
    pub fn twrnint(&self) -> TWRNINT_R {
        TWRNINT_R::new(((self.bits >> 17) & 0x01) != 0)
    }
    #[doc = "Bit 18 - This read-only flag indicates whether the FlexCAN is synchronized to the CAN bus and able to participate in the communication process"]
    #[inline(always)]
    pub fn synch(&self) -> SYNCH_R {
        SYNCH_R::new(((self.bits >> 18) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - When FLEXCAN is Stop Mode and a recessive to dominant transition is detected on the CAN bus and if the WAK_MSK bit in the MCR Register is set, an interrupt is generated to the Arm"]
    #[inline(always)]
    pub fn wakint(&mut self) -> WAKINT_W {
        WAKINT_W { w: self }
    }
    #[doc = "Bit 1 - This bit indicates that at least one of the Error Bits (bits 15-10) is set"]
    #[inline(always)]
    pub fn errint(&mut self) -> ERRINT_W {
        ERRINT_W { w: self }
    }
    #[doc = "Bit 2 - This bit is set when FLEXCAN enters 'Bus Off' state"]
    #[inline(always)]
    pub fn boffint(&mut self) -> BOFFINT_W {
        BOFFINT_W { w: self }
    }
    #[doc = "Bit 16 - If the WRN_EN bit in MCR is asserted, the RWRN_INT bit is set when the RX_WRN flag transition from '0' to '1', meaning that the Rx error counters reached 96"]
    #[inline(always)]
    pub fn rwrnint(&mut self) -> RWRNINT_W {
        RWRNINT_W { w: self }
    }
    #[doc = "Bit 17 - If the WRN_EN bit in MCR is asserted, the TWRN_INT bit is set when the TX_WRN flag transition from '0' to '1', meaning that the Tx error counter reached 96"]
    #[inline(always)]
    pub fn twrnint(&mut self) -> TWRNINT_W {
        TWRNINT_W { w: self }
    }
}