mcxa-pac 0.1.1

Peripheral Access Crate for MCXA256 devices
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
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
#[doc = "Register `CTRL1` reader"]
pub type R = crate::R<Ctrl1Spec>;
#[doc = "Register `CTRL1` writer"]
pub type W = crate::W<Ctrl1Spec>;
#[doc = "Field `PROPSEG` reader - Propagation Segment"]
pub type PropsegR = crate::FieldReader;
#[doc = "Field `PROPSEG` writer - Propagation Segment"]
pub type PropsegW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[doc = "Listen-Only Mode\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Lom {
    #[doc = "0: Listen-Only mode is deactivated."]
    ListenOnlyModeDisabled = 0,
    #[doc = "1: FlexCAN module operates in Listen-Only mode."]
    ListenOnlyModeEnabled = 1,
}
impl From<Lom> for bool {
    #[inline(always)]
    fn from(variant: Lom) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LOM` reader - Listen-Only Mode"]
pub type LomR = crate::BitReader<Lom>;
impl LomR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Lom {
        match self.bits {
            false => Lom::ListenOnlyModeDisabled,
            true => Lom::ListenOnlyModeEnabled,
        }
    }
    #[doc = "Listen-Only mode is deactivated."]
    #[inline(always)]
    pub fn is_listen_only_mode_disabled(&self) -> bool {
        *self == Lom::ListenOnlyModeDisabled
    }
    #[doc = "FlexCAN module operates in Listen-Only mode."]
    #[inline(always)]
    pub fn is_listen_only_mode_enabled(&self) -> bool {
        *self == Lom::ListenOnlyModeEnabled
    }
}
#[doc = "Field `LOM` writer - Listen-Only Mode"]
pub type LomW<'a, REG> = crate::BitWriter<'a, REG, Lom>;
impl<'a, REG> LomW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Listen-Only mode is deactivated."]
    #[inline(always)]
    pub fn listen_only_mode_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Lom::ListenOnlyModeDisabled)
    }
    #[doc = "FlexCAN module operates in Listen-Only mode."]
    #[inline(always)]
    pub fn listen_only_mode_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Lom::ListenOnlyModeEnabled)
    }
}
#[doc = "Lowest Buffer Transmitted First\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Lbuf {
    #[doc = "0: Buffer with highest priority is transmitted first."]
    HighestBufferFirst = 0,
    #[doc = "1: Lowest number buffer is transmitted first."]
    LowestBufferFirst = 1,
}
impl From<Lbuf> for bool {
    #[inline(always)]
    fn from(variant: Lbuf) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LBUF` reader - Lowest Buffer Transmitted First"]
pub type LbufR = crate::BitReader<Lbuf>;
impl LbufR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Lbuf {
        match self.bits {
            false => Lbuf::HighestBufferFirst,
            true => Lbuf::LowestBufferFirst,
        }
    }
    #[doc = "Buffer with highest priority is transmitted first."]
    #[inline(always)]
    pub fn is_highest_buffer_first(&self) -> bool {
        *self == Lbuf::HighestBufferFirst
    }
    #[doc = "Lowest number buffer is transmitted first."]
    #[inline(always)]
    pub fn is_lowest_buffer_first(&self) -> bool {
        *self == Lbuf::LowestBufferFirst
    }
}
#[doc = "Field `LBUF` writer - Lowest Buffer Transmitted First"]
pub type LbufW<'a, REG> = crate::BitWriter<'a, REG, Lbuf>;
impl<'a, REG> LbufW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Buffer with highest priority is transmitted first."]
    #[inline(always)]
    pub fn highest_buffer_first(self) -> &'a mut crate::W<REG> {
        self.variant(Lbuf::HighestBufferFirst)
    }
    #[doc = "Lowest number buffer is transmitted first."]
    #[inline(always)]
    pub fn lowest_buffer_first(self) -> &'a mut crate::W<REG> {
        self.variant(Lbuf::LowestBufferFirst)
    }
}
#[doc = "Timer Sync\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tsyn {
    #[doc = "0: Disable"]
    TimerSyncDisabled = 0,
    #[doc = "1: Enable"]
    TimerSyncEnabled = 1,
}
impl From<Tsyn> for bool {
    #[inline(always)]
    fn from(variant: Tsyn) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TSYN` reader - Timer Sync"]
pub type TsynR = crate::BitReader<Tsyn>;
impl TsynR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tsyn {
        match self.bits {
            false => Tsyn::TimerSyncDisabled,
            true => Tsyn::TimerSyncEnabled,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_timer_sync_disabled(&self) -> bool {
        *self == Tsyn::TimerSyncDisabled
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_timer_sync_enabled(&self) -> bool {
        *self == Tsyn::TimerSyncEnabled
    }
}
#[doc = "Field `TSYN` writer - Timer Sync"]
pub type TsynW<'a, REG> = crate::BitWriter<'a, REG, Tsyn>;
impl<'a, REG> TsynW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn timer_sync_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Tsyn::TimerSyncDisabled)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn timer_sync_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Tsyn::TimerSyncEnabled)
    }
}
#[doc = "Bus Off Recovery\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Boffrec {
    #[doc = "0: Enabled"]
    AutoRecoverEnabled = 0,
    #[doc = "1: Disabled"]
    AutoRecoverDisabled = 1,
}
impl From<Boffrec> for bool {
    #[inline(always)]
    fn from(variant: Boffrec) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BOFFREC` reader - Bus Off Recovery"]
pub type BoffrecR = crate::BitReader<Boffrec>;
impl BoffrecR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Boffrec {
        match self.bits {
            false => Boffrec::AutoRecoverEnabled,
            true => Boffrec::AutoRecoverDisabled,
        }
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn is_auto_recover_enabled(&self) -> bool {
        *self == Boffrec::AutoRecoverEnabled
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_auto_recover_disabled(&self) -> bool {
        *self == Boffrec::AutoRecoverDisabled
    }
}
#[doc = "Field `BOFFREC` writer - Bus Off Recovery"]
pub type BoffrecW<'a, REG> = crate::BitWriter<'a, REG, Boffrec>;
impl<'a, REG> BoffrecW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn auto_recover_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Boffrec::AutoRecoverEnabled)
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn auto_recover_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Boffrec::AutoRecoverDisabled)
    }
}
#[doc = "CAN Bit Sampling\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Smp {
    #[doc = "0: One sample is used to determine the bit value."]
    OneSample = 0,
    #[doc = "1: Three samples are used to determine the value of the received bit: the regular one (sample point) and two preceding samples. A majority rule is used."]
    ThreeSample = 1,
}
impl From<Smp> for bool {
    #[inline(always)]
    fn from(variant: Smp) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SMP` reader - CAN Bit Sampling"]
pub type SmpR = crate::BitReader<Smp>;
impl SmpR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Smp {
        match self.bits {
            false => Smp::OneSample,
            true => Smp::ThreeSample,
        }
    }
    #[doc = "One sample is used to determine the bit value."]
    #[inline(always)]
    pub fn is_one_sample(&self) -> bool {
        *self == Smp::OneSample
    }
    #[doc = "Three samples are used to determine the value of the received bit: the regular one (sample point) and two preceding samples. A majority rule is used."]
    #[inline(always)]
    pub fn is_three_sample(&self) -> bool {
        *self == Smp::ThreeSample
    }
}
#[doc = "Field `SMP` writer - CAN Bit Sampling"]
pub type SmpW<'a, REG> = crate::BitWriter<'a, REG, Smp>;
impl<'a, REG> SmpW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "One sample is used to determine the bit value."]
    #[inline(always)]
    pub fn one_sample(self) -> &'a mut crate::W<REG> {
        self.variant(Smp::OneSample)
    }
    #[doc = "Three samples are used to determine the value of the received bit: the regular one (sample point) and two preceding samples. A majority rule is used."]
    #[inline(always)]
    pub fn three_sample(self) -> &'a mut crate::W<REG> {
        self.variant(Smp::ThreeSample)
    }
}
#[doc = "RX Warning Interrupt Mask\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Rwrnmsk {
    #[doc = "0: Disabled"]
    RxWarningIntDisabled = 0,
    #[doc = "1: Enabled"]
    RxWarningIntEnabled = 1,
}
impl From<Rwrnmsk> for bool {
    #[inline(always)]
    fn from(variant: Rwrnmsk) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RWRNMSK` reader - RX Warning Interrupt Mask"]
pub type RwrnmskR = crate::BitReader<Rwrnmsk>;
impl RwrnmskR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Rwrnmsk {
        match self.bits {
            false => Rwrnmsk::RxWarningIntDisabled,
            true => Rwrnmsk::RxWarningIntEnabled,
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_rx_warning_int_disabled(&self) -> bool {
        *self == Rwrnmsk::RxWarningIntDisabled
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn is_rx_warning_int_enabled(&self) -> bool {
        *self == Rwrnmsk::RxWarningIntEnabled
    }
}
#[doc = "Field `RWRNMSK` writer - RX Warning Interrupt Mask"]
pub type RwrnmskW<'a, REG> = crate::BitWriter<'a, REG, Rwrnmsk>;
impl<'a, REG> RwrnmskW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn rx_warning_int_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Rwrnmsk::RxWarningIntDisabled)
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn rx_warning_int_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Rwrnmsk::RxWarningIntEnabled)
    }
}
#[doc = "TX Warning Interrupt Mask\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Twrnmsk {
    #[doc = "0: Disabled"]
    TxWarningIntDisabled = 0,
    #[doc = "1: Enabled"]
    TxWarningIntEnabled = 1,
}
impl From<Twrnmsk> for bool {
    #[inline(always)]
    fn from(variant: Twrnmsk) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TWRNMSK` reader - TX Warning Interrupt Mask"]
pub type TwrnmskR = crate::BitReader<Twrnmsk>;
impl TwrnmskR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Twrnmsk {
        match self.bits {
            false => Twrnmsk::TxWarningIntDisabled,
            true => Twrnmsk::TxWarningIntEnabled,
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_tx_warning_int_disabled(&self) -> bool {
        *self == Twrnmsk::TxWarningIntDisabled
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn is_tx_warning_int_enabled(&self) -> bool {
        *self == Twrnmsk::TxWarningIntEnabled
    }
}
#[doc = "Field `TWRNMSK` writer - TX Warning Interrupt Mask"]
pub type TwrnmskW<'a, REG> = crate::BitWriter<'a, REG, Twrnmsk>;
impl<'a, REG> TwrnmskW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn tx_warning_int_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Twrnmsk::TxWarningIntDisabled)
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn tx_warning_int_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Twrnmsk::TxWarningIntEnabled)
    }
}
#[doc = "Loopback Mode\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Lpb {
    #[doc = "0: Disabled"]
    LoopbackDisabled = 0,
    #[doc = "1: Enabled"]
    LoopbackEnabled = 1,
}
impl From<Lpb> for bool {
    #[inline(always)]
    fn from(variant: Lpb) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LPB` reader - Loopback Mode"]
pub type LpbR = crate::BitReader<Lpb>;
impl LpbR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Lpb {
        match self.bits {
            false => Lpb::LoopbackDisabled,
            true => Lpb::LoopbackEnabled,
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_loopback_disabled(&self) -> bool {
        *self == Lpb::LoopbackDisabled
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn is_loopback_enabled(&self) -> bool {
        *self == Lpb::LoopbackEnabled
    }
}
#[doc = "Field `LPB` writer - Loopback Mode"]
pub type LpbW<'a, REG> = crate::BitWriter<'a, REG, Lpb>;
impl<'a, REG> LpbW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn loopback_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Lpb::LoopbackDisabled)
    }
    #[doc = "Enabled"]
    #[inline(always)]
    pub fn loopback_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Lpb::LoopbackEnabled)
    }
}
#[doc = "Error Interrupt Mask\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Errmsk {
    #[doc = "0: Interrupt disabled"]
    ErrorIntDisabled = 0,
    #[doc = "1: Interrupt enabled"]
    ErrorIntEnabled = 1,
}
impl From<Errmsk> for bool {
    #[inline(always)]
    fn from(variant: Errmsk) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ERRMSK` reader - Error Interrupt Mask"]
pub type ErrmskR = crate::BitReader<Errmsk>;
impl ErrmskR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Errmsk {
        match self.bits {
            false => Errmsk::ErrorIntDisabled,
            true => Errmsk::ErrorIntEnabled,
        }
    }
    #[doc = "Interrupt disabled"]
    #[inline(always)]
    pub fn is_error_int_disabled(&self) -> bool {
        *self == Errmsk::ErrorIntDisabled
    }
    #[doc = "Interrupt enabled"]
    #[inline(always)]
    pub fn is_error_int_enabled(&self) -> bool {
        *self == Errmsk::ErrorIntEnabled
    }
}
#[doc = "Field `ERRMSK` writer - Error Interrupt Mask"]
pub type ErrmskW<'a, REG> = crate::BitWriter<'a, REG, Errmsk>;
impl<'a, REG> ErrmskW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt disabled"]
    #[inline(always)]
    pub fn error_int_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Errmsk::ErrorIntDisabled)
    }
    #[doc = "Interrupt enabled"]
    #[inline(always)]
    pub fn error_int_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Errmsk::ErrorIntEnabled)
    }
}
#[doc = "Bus Off Interrupt Mask\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Boffmsk {
    #[doc = "0: Interrupt disabled"]
    BusOffIntDisabled = 0,
    #[doc = "1: Interrupt enabled"]
    BusOffIntEnabled = 1,
}
impl From<Boffmsk> for bool {
    #[inline(always)]
    fn from(variant: Boffmsk) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BOFFMSK` reader - Bus Off Interrupt Mask"]
pub type BoffmskR = crate::BitReader<Boffmsk>;
impl BoffmskR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Boffmsk {
        match self.bits {
            false => Boffmsk::BusOffIntDisabled,
            true => Boffmsk::BusOffIntEnabled,
        }
    }
    #[doc = "Interrupt disabled"]
    #[inline(always)]
    pub fn is_bus_off_int_disabled(&self) -> bool {
        *self == Boffmsk::BusOffIntDisabled
    }
    #[doc = "Interrupt enabled"]
    #[inline(always)]
    pub fn is_bus_off_int_enabled(&self) -> bool {
        *self == Boffmsk::BusOffIntEnabled
    }
}
#[doc = "Field `BOFFMSK` writer - Bus Off Interrupt Mask"]
pub type BoffmskW<'a, REG> = crate::BitWriter<'a, REG, Boffmsk>;
impl<'a, REG> BoffmskW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt disabled"]
    #[inline(always)]
    pub fn bus_off_int_disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Boffmsk::BusOffIntDisabled)
    }
    #[doc = "Interrupt enabled"]
    #[inline(always)]
    pub fn bus_off_int_enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Boffmsk::BusOffIntEnabled)
    }
}
#[doc = "Field `PSEG2` reader - Phase Segment 2"]
pub type Pseg2R = crate::FieldReader;
#[doc = "Field `PSEG2` writer - Phase Segment 2"]
pub type Pseg2W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[doc = "Field `PSEG1` reader - Phase Segment 1"]
pub type Pseg1R = crate::FieldReader;
#[doc = "Field `PSEG1` writer - Phase Segment 1"]
pub type Pseg1W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[doc = "Field `RJW` reader - Resync Jump Width"]
pub type RjwR = crate::FieldReader;
#[doc = "Field `RJW` writer - Resync Jump Width"]
pub type RjwW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[doc = "Field `PRESDIV` reader - Prescaler Division Factor"]
pub type PresdivR = crate::FieldReader;
#[doc = "Field `PRESDIV` writer - Prescaler Division Factor"]
pub type PresdivW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
impl R {
    #[doc = "Bits 0:2 - Propagation Segment"]
    #[inline(always)]
    pub fn propseg(&self) -> PropsegR {
        PropsegR::new((self.bits & 7) as u8)
    }
    #[doc = "Bit 3 - Listen-Only Mode"]
    #[inline(always)]
    pub fn lom(&self) -> LomR {
        LomR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Lowest Buffer Transmitted First"]
    #[inline(always)]
    pub fn lbuf(&self) -> LbufR {
        LbufR::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - Timer Sync"]
    #[inline(always)]
    pub fn tsyn(&self) -> TsynR {
        TsynR::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Bus Off Recovery"]
    #[inline(always)]
    pub fn boffrec(&self) -> BoffrecR {
        BoffrecR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - CAN Bit Sampling"]
    #[inline(always)]
    pub fn smp(&self) -> SmpR {
        SmpR::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bit 10 - RX Warning Interrupt Mask"]
    #[inline(always)]
    pub fn rwrnmsk(&self) -> RwrnmskR {
        RwrnmskR::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - TX Warning Interrupt Mask"]
    #[inline(always)]
    pub fn twrnmsk(&self) -> TwrnmskR {
        TwrnmskR::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - Loopback Mode"]
    #[inline(always)]
    pub fn lpb(&self) -> LpbR {
        LpbR::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 14 - Error Interrupt Mask"]
    #[inline(always)]
    pub fn errmsk(&self) -> ErrmskR {
        ErrmskR::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bit 15 - Bus Off Interrupt Mask"]
    #[inline(always)]
    pub fn boffmsk(&self) -> BoffmskR {
        BoffmskR::new(((self.bits >> 15) & 1) != 0)
    }
    #[doc = "Bits 16:18 - Phase Segment 2"]
    #[inline(always)]
    pub fn pseg2(&self) -> Pseg2R {
        Pseg2R::new(((self.bits >> 16) & 7) as u8)
    }
    #[doc = "Bits 19:21 - Phase Segment 1"]
    #[inline(always)]
    pub fn pseg1(&self) -> Pseg1R {
        Pseg1R::new(((self.bits >> 19) & 7) as u8)
    }
    #[doc = "Bits 22:23 - Resync Jump Width"]
    #[inline(always)]
    pub fn rjw(&self) -> RjwR {
        RjwR::new(((self.bits >> 22) & 3) as u8)
    }
    #[doc = "Bits 24:31 - Prescaler Division Factor"]
    #[inline(always)]
    pub fn presdiv(&self) -> PresdivR {
        PresdivR::new(((self.bits >> 24) & 0xff) as u8)
    }
}
#[cfg(feature = "debug")]
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("CTRL1")
            .field("propseg", &self.propseg())
            .field("lom", &self.lom())
            .field("lbuf", &self.lbuf())
            .field("tsyn", &self.tsyn())
            .field("boffrec", &self.boffrec())
            .field("smp", &self.smp())
            .field("rwrnmsk", &self.rwrnmsk())
            .field("twrnmsk", &self.twrnmsk())
            .field("lpb", &self.lpb())
            .field("errmsk", &self.errmsk())
            .field("boffmsk", &self.boffmsk())
            .field("pseg2", &self.pseg2())
            .field("pseg1", &self.pseg1())
            .field("rjw", &self.rjw())
            .field("presdiv", &self.presdiv())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:2 - Propagation Segment"]
    #[inline(always)]
    pub fn propseg(&mut self) -> PropsegW<'_, Ctrl1Spec> {
        PropsegW::new(self, 0)
    }
    #[doc = "Bit 3 - Listen-Only Mode"]
    #[inline(always)]
    pub fn lom(&mut self) -> LomW<'_, Ctrl1Spec> {
        LomW::new(self, 3)
    }
    #[doc = "Bit 4 - Lowest Buffer Transmitted First"]
    #[inline(always)]
    pub fn lbuf(&mut self) -> LbufW<'_, Ctrl1Spec> {
        LbufW::new(self, 4)
    }
    #[doc = "Bit 5 - Timer Sync"]
    #[inline(always)]
    pub fn tsyn(&mut self) -> TsynW<'_, Ctrl1Spec> {
        TsynW::new(self, 5)
    }
    #[doc = "Bit 6 - Bus Off Recovery"]
    #[inline(always)]
    pub fn boffrec(&mut self) -> BoffrecW<'_, Ctrl1Spec> {
        BoffrecW::new(self, 6)
    }
    #[doc = "Bit 7 - CAN Bit Sampling"]
    #[inline(always)]
    pub fn smp(&mut self) -> SmpW<'_, Ctrl1Spec> {
        SmpW::new(self, 7)
    }
    #[doc = "Bit 10 - RX Warning Interrupt Mask"]
    #[inline(always)]
    pub fn rwrnmsk(&mut self) -> RwrnmskW<'_, Ctrl1Spec> {
        RwrnmskW::new(self, 10)
    }
    #[doc = "Bit 11 - TX Warning Interrupt Mask"]
    #[inline(always)]
    pub fn twrnmsk(&mut self) -> TwrnmskW<'_, Ctrl1Spec> {
        TwrnmskW::new(self, 11)
    }
    #[doc = "Bit 12 - Loopback Mode"]
    #[inline(always)]
    pub fn lpb(&mut self) -> LpbW<'_, Ctrl1Spec> {
        LpbW::new(self, 12)
    }
    #[doc = "Bit 14 - Error Interrupt Mask"]
    #[inline(always)]
    pub fn errmsk(&mut self) -> ErrmskW<'_, Ctrl1Spec> {
        ErrmskW::new(self, 14)
    }
    #[doc = "Bit 15 - Bus Off Interrupt Mask"]
    #[inline(always)]
    pub fn boffmsk(&mut self) -> BoffmskW<'_, Ctrl1Spec> {
        BoffmskW::new(self, 15)
    }
    #[doc = "Bits 16:18 - Phase Segment 2"]
    #[inline(always)]
    pub fn pseg2(&mut self) -> Pseg2W<'_, Ctrl1Spec> {
        Pseg2W::new(self, 16)
    }
    #[doc = "Bits 19:21 - Phase Segment 1"]
    #[inline(always)]
    pub fn pseg1(&mut self) -> Pseg1W<'_, Ctrl1Spec> {
        Pseg1W::new(self, 19)
    }
    #[doc = "Bits 22:23 - Resync Jump Width"]
    #[inline(always)]
    pub fn rjw(&mut self) -> RjwW<'_, Ctrl1Spec> {
        RjwW::new(self, 22)
    }
    #[doc = "Bits 24:31 - Prescaler Division Factor"]
    #[inline(always)]
    pub fn presdiv(&mut self) -> PresdivW<'_, Ctrl1Spec> {
        PresdivW::new(self, 24)
    }
}
#[doc = "Control 1\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Ctrl1Spec;
impl crate::RegisterSpec for Ctrl1Spec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`ctrl1::R`](R) reader structure"]
impl crate::Readable for Ctrl1Spec {}
#[doc = "`write(|w| ..)` method takes [`ctrl1::W`](W) writer structure"]
impl crate::Writable for Ctrl1Spec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets CTRL1 to value 0"]
impl crate::Resettable for Ctrl1Spec {}