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
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
#[doc = "Register `MCFGR1` reader"]
pub type R = crate::R<Mcfgr1Spec>;
#[doc = "Register `MCFGR1` writer"]
pub type W = crate::W<Mcfgr1Spec>;
#[doc = "Prescaler\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Prescale {
    #[doc = "0: Divide by 1"]
    DivideBy1 = 0,
    #[doc = "1: Divide by 2"]
    DivideBy2 = 1,
    #[doc = "2: Divide by 4"]
    DivideBy4 = 2,
    #[doc = "3: Divide by 8"]
    DivideBy8 = 3,
    #[doc = "4: Divide by 16"]
    DivideBy16 = 4,
    #[doc = "5: Divide by 32"]
    DivideBy32 = 5,
    #[doc = "6: Divide by 64"]
    DivideBy64 = 6,
    #[doc = "7: Divide by 128"]
    DivideBy128 = 7,
}
impl From<Prescale> for u8 {
    #[inline(always)]
    fn from(variant: Prescale) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Prescale {
    type Ux = u8;
}
impl crate::IsEnum for Prescale {}
#[doc = "Field `PRESCALE` reader - Prescaler"]
pub type PrescaleR = crate::FieldReader<Prescale>;
impl PrescaleR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Prescale {
        match self.bits {
            0 => Prescale::DivideBy1,
            1 => Prescale::DivideBy2,
            2 => Prescale::DivideBy4,
            3 => Prescale::DivideBy8,
            4 => Prescale::DivideBy16,
            5 => Prescale::DivideBy32,
            6 => Prescale::DivideBy64,
            7 => Prescale::DivideBy128,
            _ => unreachable!(),
        }
    }
    #[doc = "Divide by 1"]
    #[inline(always)]
    pub fn is_divide_by_1(&self) -> bool {
        *self == Prescale::DivideBy1
    }
    #[doc = "Divide by 2"]
    #[inline(always)]
    pub fn is_divide_by_2(&self) -> bool {
        *self == Prescale::DivideBy2
    }
    #[doc = "Divide by 4"]
    #[inline(always)]
    pub fn is_divide_by_4(&self) -> bool {
        *self == Prescale::DivideBy4
    }
    #[doc = "Divide by 8"]
    #[inline(always)]
    pub fn is_divide_by_8(&self) -> bool {
        *self == Prescale::DivideBy8
    }
    #[doc = "Divide by 16"]
    #[inline(always)]
    pub fn is_divide_by_16(&self) -> bool {
        *self == Prescale::DivideBy16
    }
    #[doc = "Divide by 32"]
    #[inline(always)]
    pub fn is_divide_by_32(&self) -> bool {
        *self == Prescale::DivideBy32
    }
    #[doc = "Divide by 64"]
    #[inline(always)]
    pub fn is_divide_by_64(&self) -> bool {
        *self == Prescale::DivideBy64
    }
    #[doc = "Divide by 128"]
    #[inline(always)]
    pub fn is_divide_by_128(&self) -> bool {
        *self == Prescale::DivideBy128
    }
}
#[doc = "Field `PRESCALE` writer - Prescaler"]
pub type PrescaleW<'a, REG> = crate::FieldWriter<'a, REG, 3, Prescale, crate::Safe>;
impl<'a, REG> PrescaleW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Divide by 1"]
    #[inline(always)]
    pub fn divide_by_1(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy1)
    }
    #[doc = "Divide by 2"]
    #[inline(always)]
    pub fn divide_by_2(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy2)
    }
    #[doc = "Divide by 4"]
    #[inline(always)]
    pub fn divide_by_4(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy4)
    }
    #[doc = "Divide by 8"]
    #[inline(always)]
    pub fn divide_by_8(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy8)
    }
    #[doc = "Divide by 16"]
    #[inline(always)]
    pub fn divide_by_16(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy16)
    }
    #[doc = "Divide by 32"]
    #[inline(always)]
    pub fn divide_by_32(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy32)
    }
    #[doc = "Divide by 64"]
    #[inline(always)]
    pub fn divide_by_64(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy64)
    }
    #[doc = "Divide by 128"]
    #[inline(always)]
    pub fn divide_by_128(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::DivideBy128)
    }
}
#[doc = "Automatic Stop Generation\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Autostop {
    #[doc = "0: No effect"]
    Disabled = 0,
    #[doc = "1: Stop automatically generated"]
    Enabled = 1,
}
impl From<Autostop> for bool {
    #[inline(always)]
    fn from(variant: Autostop) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `AUTOSTOP` reader - Automatic Stop Generation"]
pub type AutostopR = crate::BitReader<Autostop>;
impl AutostopR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Autostop {
        match self.bits {
            false => Autostop::Disabled,
            true => Autostop::Enabled,
        }
    }
    #[doc = "No effect"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Autostop::Disabled
    }
    #[doc = "Stop automatically generated"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Autostop::Enabled
    }
}
#[doc = "Field `AUTOSTOP` writer - Automatic Stop Generation"]
pub type AutostopW<'a, REG> = crate::BitWriter<'a, REG, Autostop>;
impl<'a, REG> AutostopW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No effect"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Autostop::Disabled)
    }
    #[doc = "Stop automatically generated"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Autostop::Enabled)
    }
}
#[doc = "Ignore NACK\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Ignack {
    #[doc = "0: No effect"]
    Disabled = 0,
    #[doc = "1: Treat a received NACK as an ACK"]
    Enabled = 1,
}
impl From<Ignack> for bool {
    #[inline(always)]
    fn from(variant: Ignack) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `IGNACK` reader - Ignore NACK"]
pub type IgnackR = crate::BitReader<Ignack>;
impl IgnackR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Ignack {
        match self.bits {
            false => Ignack::Disabled,
            true => Ignack::Enabled,
        }
    }
    #[doc = "No effect"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Ignack::Disabled
    }
    #[doc = "Treat a received NACK as an ACK"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Ignack::Enabled
    }
}
#[doc = "Field `IGNACK` writer - Ignore NACK"]
pub type IgnackW<'a, REG> = crate::BitWriter<'a, REG, Ignack>;
impl<'a, REG> IgnackW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No effect"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Ignack::Disabled)
    }
    #[doc = "Treat a received NACK as an ACK"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Ignack::Enabled)
    }
}
#[doc = "Timeout Configuration\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Timecfg {
    #[doc = "0: SCL"]
    IfSclLow = 0,
    #[doc = "1: SCL or SDA"]
    IfSclOrSdaLow = 1,
}
impl From<Timecfg> for bool {
    #[inline(always)]
    fn from(variant: Timecfg) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TIMECFG` reader - Timeout Configuration"]
pub type TimecfgR = crate::BitReader<Timecfg>;
impl TimecfgR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Timecfg {
        match self.bits {
            false => Timecfg::IfSclLow,
            true => Timecfg::IfSclOrSdaLow,
        }
    }
    #[doc = "SCL"]
    #[inline(always)]
    pub fn is_if_scl_low(&self) -> bool {
        *self == Timecfg::IfSclLow
    }
    #[doc = "SCL or SDA"]
    #[inline(always)]
    pub fn is_if_scl_or_sda_low(&self) -> bool {
        *self == Timecfg::IfSclOrSdaLow
    }
}
#[doc = "Field `TIMECFG` writer - Timeout Configuration"]
pub type TimecfgW<'a, REG> = crate::BitWriter<'a, REG, Timecfg>;
impl<'a, REG> TimecfgW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "SCL"]
    #[inline(always)]
    pub fn if_scl_low(self) -> &'a mut crate::W<REG> {
        self.variant(Timecfg::IfSclLow)
    }
    #[doc = "SCL or SDA"]
    #[inline(always)]
    pub fn if_scl_or_sda_low(self) -> &'a mut crate::W<REG> {
        self.variant(Timecfg::IfSclOrSdaLow)
    }
}
#[doc = "Stop Configuration\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Stopcfg {
    #[doc = "0: Any Stop condition"]
    AnyStop = 0,
    #[doc = "1: Last Stop condition"]
    LastStop = 1,
}
impl From<Stopcfg> for bool {
    #[inline(always)]
    fn from(variant: Stopcfg) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `STOPCFG` reader - Stop Configuration"]
pub type StopcfgR = crate::BitReader<Stopcfg>;
impl StopcfgR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Stopcfg {
        match self.bits {
            false => Stopcfg::AnyStop,
            true => Stopcfg::LastStop,
        }
    }
    #[doc = "Any Stop condition"]
    #[inline(always)]
    pub fn is_any_stop(&self) -> bool {
        *self == Stopcfg::AnyStop
    }
    #[doc = "Last Stop condition"]
    #[inline(always)]
    pub fn is_last_stop(&self) -> bool {
        *self == Stopcfg::LastStop
    }
}
#[doc = "Field `STOPCFG` writer - Stop Configuration"]
pub type StopcfgW<'a, REG> = crate::BitWriter<'a, REG, Stopcfg>;
impl<'a, REG> StopcfgW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Any Stop condition"]
    #[inline(always)]
    pub fn any_stop(self) -> &'a mut crate::W<REG> {
        self.variant(Stopcfg::AnyStop)
    }
    #[doc = "Last Stop condition"]
    #[inline(always)]
    pub fn last_stop(self) -> &'a mut crate::W<REG> {
        self.variant(Stopcfg::LastStop)
    }
}
#[doc = "Start Configuration\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Startcfg {
    #[doc = "0: Sets when both I2C bus and LPI2C controller are idle"]
    BothI2cAndLpi2cIdle = 0,
    #[doc = "1: Sets when I2C bus is idle"]
    I2cIdle = 1,
}
impl From<Startcfg> for bool {
    #[inline(always)]
    fn from(variant: Startcfg) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `STARTCFG` reader - Start Configuration"]
pub type StartcfgR = crate::BitReader<Startcfg>;
impl StartcfgR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Startcfg {
        match self.bits {
            false => Startcfg::BothI2cAndLpi2cIdle,
            true => Startcfg::I2cIdle,
        }
    }
    #[doc = "Sets when both I2C bus and LPI2C controller are idle"]
    #[inline(always)]
    pub fn is_both_i2c_and_lpi2c_idle(&self) -> bool {
        *self == Startcfg::BothI2cAndLpi2cIdle
    }
    #[doc = "Sets when I2C bus is idle"]
    #[inline(always)]
    pub fn is_i2c_idle(&self) -> bool {
        *self == Startcfg::I2cIdle
    }
}
#[doc = "Field `STARTCFG` writer - Start Configuration"]
pub type StartcfgW<'a, REG> = crate::BitWriter<'a, REG, Startcfg>;
impl<'a, REG> StartcfgW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Sets when both I2C bus and LPI2C controller are idle"]
    #[inline(always)]
    pub fn both_i2c_and_lpi2c_idle(self) -> &'a mut crate::W<REG> {
        self.variant(Startcfg::BothI2cAndLpi2cIdle)
    }
    #[doc = "Sets when I2C bus is idle"]
    #[inline(always)]
    pub fn i2c_idle(self) -> &'a mut crate::W<REG> {
        self.variant(Startcfg::I2cIdle)
    }
}
#[doc = "Match Configuration\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Matcfg {
    #[doc = "0: Match is disabled"]
    Disabled = 0,
    #[doc = "2: Match is enabled: first data word equals MDMR\\[MATCH0\\] OR MDMR\\[MATCH1\\]"]
    FirstDataWordEqualsMatch0OrMatch1 = 2,
    #[doc = "3: Match is enabled: any data word equals MDMR\\[MATCH0\\] OR MDMR\\[MATCH1\\]"]
    AnyDataWordEqualsMatch0OrMatch1 = 3,
    #[doc = "4: Match is enabled: (first data word equals MDMR\\[MATCH0\\]) AND (second data word equals MDMR\\[MATCH1)"]
    FirstDataWordMatch0AndSecondDataWordMatch1 = 4,
    #[doc = "5: Match is enabled: (any data word equals MDMR\\[MATCH0\\]) AND (next data word equals MDMR\\[MATCH1)"]
    AnyDataWordMatch0NextDataWordMatch1 = 5,
    #[doc = "6: Match is enabled: (first data word AND MDMR\\[MATCH1\\]) equals (MDMR\\[MATCH0\\] AND MDMR\\[MATCH1\\])"]
    FirstDataWordAndMatch1EqualsMatch0AndMatch1 = 6,
    #[doc = "7: Match is enabled: (any data word AND MDMR\\[MATCH1\\]) equals (MDMR\\[MATCH0\\] AND MDMR\\[MATCH1\\])"]
    AnyDataWordAndMatch1EqualsMatch0AndMatch1 = 7,
}
impl From<Matcfg> for u8 {
    #[inline(always)]
    fn from(variant: Matcfg) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Matcfg {
    type Ux = u8;
}
impl crate::IsEnum for Matcfg {}
#[doc = "Field `MATCFG` reader - Match Configuration"]
pub type MatcfgR = crate::FieldReader<Matcfg>;
impl MatcfgR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Matcfg> {
        match self.bits {
            0 => Some(Matcfg::Disabled),
            2 => Some(Matcfg::FirstDataWordEqualsMatch0OrMatch1),
            3 => Some(Matcfg::AnyDataWordEqualsMatch0OrMatch1),
            4 => Some(Matcfg::FirstDataWordMatch0AndSecondDataWordMatch1),
            5 => Some(Matcfg::AnyDataWordMatch0NextDataWordMatch1),
            6 => Some(Matcfg::FirstDataWordAndMatch1EqualsMatch0AndMatch1),
            7 => Some(Matcfg::AnyDataWordAndMatch1EqualsMatch0AndMatch1),
            _ => None,
        }
    }
    #[doc = "Match is disabled"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Matcfg::Disabled
    }
    #[doc = "Match is enabled: first data word equals MDMR\\[MATCH0\\] OR MDMR\\[MATCH1\\]"]
    #[inline(always)]
    pub fn is_first_data_word_equals_match0_or_match1(&self) -> bool {
        *self == Matcfg::FirstDataWordEqualsMatch0OrMatch1
    }
    #[doc = "Match is enabled: any data word equals MDMR\\[MATCH0\\] OR MDMR\\[MATCH1\\]"]
    #[inline(always)]
    pub fn is_any_data_word_equals_match0_or_match1(&self) -> bool {
        *self == Matcfg::AnyDataWordEqualsMatch0OrMatch1
    }
    #[doc = "Match is enabled: (first data word equals MDMR\\[MATCH0\\]) AND (second data word equals MDMR\\[MATCH1)"]
    #[inline(always)]
    pub fn is_first_data_word_match0_and_second_data_word_match1(&self) -> bool {
        *self == Matcfg::FirstDataWordMatch0AndSecondDataWordMatch1
    }
    #[doc = "Match is enabled: (any data word equals MDMR\\[MATCH0\\]) AND (next data word equals MDMR\\[MATCH1)"]
    #[inline(always)]
    pub fn is_any_data_word_match0_next_data_word_match1(&self) -> bool {
        *self == Matcfg::AnyDataWordMatch0NextDataWordMatch1
    }
    #[doc = "Match is enabled: (first data word AND MDMR\\[MATCH1\\]) equals (MDMR\\[MATCH0\\] AND MDMR\\[MATCH1\\])"]
    #[inline(always)]
    pub fn is_first_data_word_and_match1_equals_match0_and_match1(&self) -> bool {
        *self == Matcfg::FirstDataWordAndMatch1EqualsMatch0AndMatch1
    }
    #[doc = "Match is enabled: (any data word AND MDMR\\[MATCH1\\]) equals (MDMR\\[MATCH0\\] AND MDMR\\[MATCH1\\])"]
    #[inline(always)]
    pub fn is_any_data_word_and_match1_equals_match0_and_match1(&self) -> bool {
        *self == Matcfg::AnyDataWordAndMatch1EqualsMatch0AndMatch1
    }
}
#[doc = "Field `MATCFG` writer - Match Configuration"]
pub type MatcfgW<'a, REG> = crate::FieldWriter<'a, REG, 3, Matcfg>;
impl<'a, REG> MatcfgW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Match is disabled"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::Disabled)
    }
    #[doc = "Match is enabled: first data word equals MDMR\\[MATCH0\\] OR MDMR\\[MATCH1\\]"]
    #[inline(always)]
    pub fn first_data_word_equals_match0_or_match1(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::FirstDataWordEqualsMatch0OrMatch1)
    }
    #[doc = "Match is enabled: any data word equals MDMR\\[MATCH0\\] OR MDMR\\[MATCH1\\]"]
    #[inline(always)]
    pub fn any_data_word_equals_match0_or_match1(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::AnyDataWordEqualsMatch0OrMatch1)
    }
    #[doc = "Match is enabled: (first data word equals MDMR\\[MATCH0\\]) AND (second data word equals MDMR\\[MATCH1)"]
    #[inline(always)]
    pub fn first_data_word_match0_and_second_data_word_match1(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::FirstDataWordMatch0AndSecondDataWordMatch1)
    }
    #[doc = "Match is enabled: (any data word equals MDMR\\[MATCH0\\]) AND (next data word equals MDMR\\[MATCH1)"]
    #[inline(always)]
    pub fn any_data_word_match0_next_data_word_match1(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::AnyDataWordMatch0NextDataWordMatch1)
    }
    #[doc = "Match is enabled: (first data word AND MDMR\\[MATCH1\\]) equals (MDMR\\[MATCH0\\] AND MDMR\\[MATCH1\\])"]
    #[inline(always)]
    pub fn first_data_word_and_match1_equals_match0_and_match1(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::FirstDataWordAndMatch1EqualsMatch0AndMatch1)
    }
    #[doc = "Match is enabled: (any data word AND MDMR\\[MATCH1\\]) equals (MDMR\\[MATCH0\\] AND MDMR\\[MATCH1\\])"]
    #[inline(always)]
    pub fn any_data_word_and_match1_equals_match0_and_match1(self) -> &'a mut crate::W<REG> {
        self.variant(Matcfg::AnyDataWordAndMatch1EqualsMatch0AndMatch1)
    }
}
#[doc = "Pin Configuration\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Pincfg {
    #[doc = "0: Two-pin open drain mode"]
    OpenDrain2Pin = 0,
    #[doc = "1: Two-pin output only mode (Ultra-Fast mode)"]
    Output2PinOnly = 1,
    #[doc = "2: Two-pin push-pull mode"]
    PushPull2Pin = 2,
    #[doc = "3: Four-pin push-pull mode"]
    PushPull4Pin = 3,
    #[doc = "4: Two-pin open-drain mode with separate LPI2C target"]
    OpenDrain2PinWLpi2cSlave = 4,
    #[doc = "5: Two-pin output only mode (Ultra-Fast mode) with separate LPI2C target"]
    Output2PinOnlyWLpi2cSlave = 5,
    #[doc = "6: Two-pin push-pull mode with separate LPI2C target"]
    PushPull2PinWLpi2cSlave = 6,
    #[doc = "7: Four-pin push-pull mode (inverted outputs)"]
    PushPull4PinWLpi2cSlave = 7,
}
impl From<Pincfg> for u8 {
    #[inline(always)]
    fn from(variant: Pincfg) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Pincfg {
    type Ux = u8;
}
impl crate::IsEnum for Pincfg {}
#[doc = "Field `PINCFG` reader - Pin Configuration"]
pub type PincfgR = crate::FieldReader<Pincfg>;
impl PincfgR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pincfg {
        match self.bits {
            0 => Pincfg::OpenDrain2Pin,
            1 => Pincfg::Output2PinOnly,
            2 => Pincfg::PushPull2Pin,
            3 => Pincfg::PushPull4Pin,
            4 => Pincfg::OpenDrain2PinWLpi2cSlave,
            5 => Pincfg::Output2PinOnlyWLpi2cSlave,
            6 => Pincfg::PushPull2PinWLpi2cSlave,
            7 => Pincfg::PushPull4PinWLpi2cSlave,
            _ => unreachable!(),
        }
    }
    #[doc = "Two-pin open drain mode"]
    #[inline(always)]
    pub fn is_open_drain_2_pin(&self) -> bool {
        *self == Pincfg::OpenDrain2Pin
    }
    #[doc = "Two-pin output only mode (Ultra-Fast mode)"]
    #[inline(always)]
    pub fn is_output_2_pin_only(&self) -> bool {
        *self == Pincfg::Output2PinOnly
    }
    #[doc = "Two-pin push-pull mode"]
    #[inline(always)]
    pub fn is_push_pull_2_pin(&self) -> bool {
        *self == Pincfg::PushPull2Pin
    }
    #[doc = "Four-pin push-pull mode"]
    #[inline(always)]
    pub fn is_push_pull_4_pin(&self) -> bool {
        *self == Pincfg::PushPull4Pin
    }
    #[doc = "Two-pin open-drain mode with separate LPI2C target"]
    #[inline(always)]
    pub fn is_open_drain_2_pin_w_lpi2c_slave(&self) -> bool {
        *self == Pincfg::OpenDrain2PinWLpi2cSlave
    }
    #[doc = "Two-pin output only mode (Ultra-Fast mode) with separate LPI2C target"]
    #[inline(always)]
    pub fn is_output_2_pin_only_w_lpi2c_slave(&self) -> bool {
        *self == Pincfg::Output2PinOnlyWLpi2cSlave
    }
    #[doc = "Two-pin push-pull mode with separate LPI2C target"]
    #[inline(always)]
    pub fn is_push_pull_2_pin_w_lpi2c_slave(&self) -> bool {
        *self == Pincfg::PushPull2PinWLpi2cSlave
    }
    #[doc = "Four-pin push-pull mode (inverted outputs)"]
    #[inline(always)]
    pub fn is_push_pull_4_pin_w_lpi2c_slave(&self) -> bool {
        *self == Pincfg::PushPull4PinWLpi2cSlave
    }
}
#[doc = "Field `PINCFG` writer - Pin Configuration"]
pub type PincfgW<'a, REG> = crate::FieldWriter<'a, REG, 3, Pincfg, crate::Safe>;
impl<'a, REG> PincfgW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Two-pin open drain mode"]
    #[inline(always)]
    pub fn open_drain_2_pin(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::OpenDrain2Pin)
    }
    #[doc = "Two-pin output only mode (Ultra-Fast mode)"]
    #[inline(always)]
    pub fn output_2_pin_only(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::Output2PinOnly)
    }
    #[doc = "Two-pin push-pull mode"]
    #[inline(always)]
    pub fn push_pull_2_pin(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::PushPull2Pin)
    }
    #[doc = "Four-pin push-pull mode"]
    #[inline(always)]
    pub fn push_pull_4_pin(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::PushPull4Pin)
    }
    #[doc = "Two-pin open-drain mode with separate LPI2C target"]
    #[inline(always)]
    pub fn open_drain_2_pin_w_lpi2c_slave(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::OpenDrain2PinWLpi2cSlave)
    }
    #[doc = "Two-pin output only mode (Ultra-Fast mode) with separate LPI2C target"]
    #[inline(always)]
    pub fn output_2_pin_only_w_lpi2c_slave(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::Output2PinOnlyWLpi2cSlave)
    }
    #[doc = "Two-pin push-pull mode with separate LPI2C target"]
    #[inline(always)]
    pub fn push_pull_2_pin_w_lpi2c_slave(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::PushPull2PinWLpi2cSlave)
    }
    #[doc = "Four-pin push-pull mode (inverted outputs)"]
    #[inline(always)]
    pub fn push_pull_4_pin_w_lpi2c_slave(self) -> &'a mut crate::W<REG> {
        self.variant(Pincfg::PushPull4PinWLpi2cSlave)
    }
}
impl R {
    #[doc = "Bits 0:2 - Prescaler"]
    #[inline(always)]
    pub fn prescale(&self) -> PrescaleR {
        PrescaleR::new((self.bits & 7) as u8)
    }
    #[doc = "Bit 8 - Automatic Stop Generation"]
    #[inline(always)]
    pub fn autostop(&self) -> AutostopR {
        AutostopR::new(((self.bits >> 8) & 1) != 0)
    }
    #[doc = "Bit 9 - Ignore NACK"]
    #[inline(always)]
    pub fn ignack(&self) -> IgnackR {
        IgnackR::new(((self.bits >> 9) & 1) != 0)
    }
    #[doc = "Bit 10 - Timeout Configuration"]
    #[inline(always)]
    pub fn timecfg(&self) -> TimecfgR {
        TimecfgR::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - Stop Configuration"]
    #[inline(always)]
    pub fn stopcfg(&self) -> StopcfgR {
        StopcfgR::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - Start Configuration"]
    #[inline(always)]
    pub fn startcfg(&self) -> StartcfgR {
        StartcfgR::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bits 16:18 - Match Configuration"]
    #[inline(always)]
    pub fn matcfg(&self) -> MatcfgR {
        MatcfgR::new(((self.bits >> 16) & 7) as u8)
    }
    #[doc = "Bits 24:26 - Pin Configuration"]
    #[inline(always)]
    pub fn pincfg(&self) -> PincfgR {
        PincfgR::new(((self.bits >> 24) & 7) 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("MCFGR1")
            .field("prescale", &self.prescale())
            .field("autostop", &self.autostop())
            .field("ignack", &self.ignack())
            .field("timecfg", &self.timecfg())
            .field("stopcfg", &self.stopcfg())
            .field("startcfg", &self.startcfg())
            .field("matcfg", &self.matcfg())
            .field("pincfg", &self.pincfg())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:2 - Prescaler"]
    #[inline(always)]
    pub fn prescale(&mut self) -> PrescaleW<'_, Mcfgr1Spec> {
        PrescaleW::new(self, 0)
    }
    #[doc = "Bit 8 - Automatic Stop Generation"]
    #[inline(always)]
    pub fn autostop(&mut self) -> AutostopW<'_, Mcfgr1Spec> {
        AutostopW::new(self, 8)
    }
    #[doc = "Bit 9 - Ignore NACK"]
    #[inline(always)]
    pub fn ignack(&mut self) -> IgnackW<'_, Mcfgr1Spec> {
        IgnackW::new(self, 9)
    }
    #[doc = "Bit 10 - Timeout Configuration"]
    #[inline(always)]
    pub fn timecfg(&mut self) -> TimecfgW<'_, Mcfgr1Spec> {
        TimecfgW::new(self, 10)
    }
    #[doc = "Bit 11 - Stop Configuration"]
    #[inline(always)]
    pub fn stopcfg(&mut self) -> StopcfgW<'_, Mcfgr1Spec> {
        StopcfgW::new(self, 11)
    }
    #[doc = "Bit 12 - Start Configuration"]
    #[inline(always)]
    pub fn startcfg(&mut self) -> StartcfgW<'_, Mcfgr1Spec> {
        StartcfgW::new(self, 12)
    }
    #[doc = "Bits 16:18 - Match Configuration"]
    #[inline(always)]
    pub fn matcfg(&mut self) -> MatcfgW<'_, Mcfgr1Spec> {
        MatcfgW::new(self, 16)
    }
    #[doc = "Bits 24:26 - Pin Configuration"]
    #[inline(always)]
    pub fn pincfg(&mut self) -> PincfgW<'_, Mcfgr1Spec> {
        PincfgW::new(self, 24)
    }
}
#[doc = "Controller Configuration 1\n\nYou can [`read`](crate::Reg::read) this register and get [`mcfgr1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mcfgr1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Mcfgr1Spec;
impl crate::RegisterSpec for Mcfgr1Spec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`mcfgr1::R`](R) reader structure"]
impl crate::Readable for Mcfgr1Spec {}
#[doc = "`write(|w| ..)` method takes [`mcfgr1::W`](W) writer structure"]
impl crate::Writable for Mcfgr1Spec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets MCFGR1 to value 0"]
impl crate::Resettable for Mcfgr1Spec {}