stm32h7 0.16.0

Device support crates for STM32H7 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
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
///Register `CFGR1` reader
pub type R = crate::R<CFGR1rs>;
///Register `CFGR1` writer
pub type W = crate::W<CFGR1rs>;
/**SITP

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SITP {
    ///0: SPI with rising edge to strobe data
    SpirisingEdge = 0,
    ///1: SPI with falling edge to strobe data
    SpifallingEdge = 1,
    ///2: Manchester coded input on DATINy pin: rising edge = logic 0, falling edge = logic 1
    Manchester = 2,
    ///3: Manchester coded input on DATINy pin: rising edge = logic 1, falling edge = logic 0
    ManchesterInverted = 3,
}
impl From<SITP> for u8 {
    #[inline(always)]
    fn from(variant: SITP) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for SITP {
    type Ux = u8;
}
impl crate::IsEnum for SITP {}
///Field `SITP` reader - SITP
pub type SITP_R = crate::FieldReader<SITP>;
impl SITP_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> SITP {
        match self.bits {
            0 => SITP::SpirisingEdge,
            1 => SITP::SpifallingEdge,
            2 => SITP::Manchester,
            3 => SITP::ManchesterInverted,
            _ => unreachable!(),
        }
    }
    ///SPI with rising edge to strobe data
    #[inline(always)]
    pub fn is_spirising_edge(&self) -> bool {
        *self == SITP::SpirisingEdge
    }
    ///SPI with falling edge to strobe data
    #[inline(always)]
    pub fn is_spifalling_edge(&self) -> bool {
        *self == SITP::SpifallingEdge
    }
    ///Manchester coded input on DATINy pin: rising edge = logic 0, falling edge = logic 1
    #[inline(always)]
    pub fn is_manchester(&self) -> bool {
        *self == SITP::Manchester
    }
    ///Manchester coded input on DATINy pin: rising edge = logic 1, falling edge = logic 0
    #[inline(always)]
    pub fn is_manchester_inverted(&self) -> bool {
        *self == SITP::ManchesterInverted
    }
}
///Field `SITP` writer - SITP
pub type SITP_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SITP, crate::Safe>;
impl<'a, REG> SITP_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///SPI with rising edge to strobe data
    #[inline(always)]
    pub fn spirising_edge(self) -> &'a mut crate::W<REG> {
        self.variant(SITP::SpirisingEdge)
    }
    ///SPI with falling edge to strobe data
    #[inline(always)]
    pub fn spifalling_edge(self) -> &'a mut crate::W<REG> {
        self.variant(SITP::SpifallingEdge)
    }
    ///Manchester coded input on DATINy pin: rising edge = logic 0, falling edge = logic 1
    #[inline(always)]
    pub fn manchester(self) -> &'a mut crate::W<REG> {
        self.variant(SITP::Manchester)
    }
    ///Manchester coded input on DATINy pin: rising edge = logic 1, falling edge = logic 0
    #[inline(always)]
    pub fn manchester_inverted(self) -> &'a mut crate::W<REG> {
        self.variant(SITP::ManchesterInverted)
    }
}
/**SPICKSEL

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SPICKSEL {
    ///0: Clock coming from external CKINy input - sampling point according SITP\[1:0\]
    Ckin = 0,
    ///1: Clock coming from internal CKOUT output - sampling point according SITP\[1:0\]
    Ckout = 1,
    ///2: Clock coming from internal CKOUT - sampling point on each second CKOUT falling edge. For connection to external Σ∆ modulator which divides its clock input (from CKOUT) by 2 to generate its output serial communication clock (and this output clock change is active on each clock input rising edge)
    CkoutsecondFalling = 2,
    ///3: Clock coming from internal CKOUT output - sampling point on each second CKOUT rising edge. For connection to external Σ∆ modulator which divides its clock input (from CKOUT) by 2 to generate its output serial communication clock (and this output clock change is active on each clock input falling edge)
    CkoutsecondRising = 3,
}
impl From<SPICKSEL> for u8 {
    #[inline(always)]
    fn from(variant: SPICKSEL) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for SPICKSEL {
    type Ux = u8;
}
impl crate::IsEnum for SPICKSEL {}
///Field `SPICKSEL` reader - SPICKSEL
pub type SPICKSEL_R = crate::FieldReader<SPICKSEL>;
impl SPICKSEL_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> SPICKSEL {
        match self.bits {
            0 => SPICKSEL::Ckin,
            1 => SPICKSEL::Ckout,
            2 => SPICKSEL::CkoutsecondFalling,
            3 => SPICKSEL::CkoutsecondRising,
            _ => unreachable!(),
        }
    }
    ///Clock coming from external CKINy input - sampling point according SITP\[1:0\]
    #[inline(always)]
    pub fn is_ckin(&self) -> bool {
        *self == SPICKSEL::Ckin
    }
    ///Clock coming from internal CKOUT output - sampling point according SITP\[1:0\]
    #[inline(always)]
    pub fn is_ckout(&self) -> bool {
        *self == SPICKSEL::Ckout
    }
    ///Clock coming from internal CKOUT - sampling point on each second CKOUT falling edge. For connection to external Σ∆ modulator which divides its clock input (from CKOUT) by 2 to generate its output serial communication clock (and this output clock change is active on each clock input rising edge)
    #[inline(always)]
    pub fn is_ckoutsecond_falling(&self) -> bool {
        *self == SPICKSEL::CkoutsecondFalling
    }
    ///Clock coming from internal CKOUT output - sampling point on each second CKOUT rising edge. For connection to external Σ∆ modulator which divides its clock input (from CKOUT) by 2 to generate its output serial communication clock (and this output clock change is active on each clock input falling edge)
    #[inline(always)]
    pub fn is_ckoutsecond_rising(&self) -> bool {
        *self == SPICKSEL::CkoutsecondRising
    }
}
///Field `SPICKSEL` writer - SPICKSEL
pub type SPICKSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SPICKSEL, crate::Safe>;
impl<'a, REG> SPICKSEL_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Clock coming from external CKINy input - sampling point according SITP\[1:0\]
    #[inline(always)]
    pub fn ckin(self) -> &'a mut crate::W<REG> {
        self.variant(SPICKSEL::Ckin)
    }
    ///Clock coming from internal CKOUT output - sampling point according SITP\[1:0\]
    #[inline(always)]
    pub fn ckout(self) -> &'a mut crate::W<REG> {
        self.variant(SPICKSEL::Ckout)
    }
    ///Clock coming from internal CKOUT - sampling point on each second CKOUT falling edge. For connection to external Σ∆ modulator which divides its clock input (from CKOUT) by 2 to generate its output serial communication clock (and this output clock change is active on each clock input rising edge)
    #[inline(always)]
    pub fn ckoutsecond_falling(self) -> &'a mut crate::W<REG> {
        self.variant(SPICKSEL::CkoutsecondFalling)
    }
    ///Clock coming from internal CKOUT output - sampling point on each second CKOUT rising edge. For connection to external Σ∆ modulator which divides its clock input (from CKOUT) by 2 to generate its output serial communication clock (and this output clock change is active on each clock input falling edge)
    #[inline(always)]
    pub fn ckoutsecond_rising(self) -> &'a mut crate::W<REG> {
        self.variant(SPICKSEL::CkoutsecondRising)
    }
}
/**SCDEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SCDEN {
    ///0: Input channel y will not be guarded by the short-circuit detector
    Disabled = 0,
    ///1: Input channel y will be continuously guarded by the short-circuit detector
    Enabled = 1,
}
impl From<SCDEN> for bool {
    #[inline(always)]
    fn from(variant: SCDEN) -> Self {
        variant as u8 != 0
    }
}
///Field `SCDEN` reader - SCDEN
pub type SCDEN_R = crate::BitReader<SCDEN>;
impl SCDEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> SCDEN {
        match self.bits {
            false => SCDEN::Disabled,
            true => SCDEN::Enabled,
        }
    }
    ///Input channel y will not be guarded by the short-circuit detector
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == SCDEN::Disabled
    }
    ///Input channel y will be continuously guarded by the short-circuit detector
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == SCDEN::Enabled
    }
}
///Field `SCDEN` writer - SCDEN
pub type SCDEN_W<'a, REG> = crate::BitWriter<'a, REG, SCDEN>;
impl<'a, REG> SCDEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Input channel y will not be guarded by the short-circuit detector
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(SCDEN::Disabled)
    }
    ///Input channel y will be continuously guarded by the short-circuit detector
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(SCDEN::Enabled)
    }
}
/**CKABEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKABEN {
    ///0: Clock absence detector disabled on channel y
    Disabled = 0,
    ///1: Clock absence detector enabled on channel y
    Enabled = 1,
}
impl From<CKABEN> for bool {
    #[inline(always)]
    fn from(variant: CKABEN) -> Self {
        variant as u8 != 0
    }
}
///Field `CKABEN` reader - CKABEN
pub type CKABEN_R = crate::BitReader<CKABEN>;
impl CKABEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> CKABEN {
        match self.bits {
            false => CKABEN::Disabled,
            true => CKABEN::Enabled,
        }
    }
    ///Clock absence detector disabled on channel y
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == CKABEN::Disabled
    }
    ///Clock absence detector enabled on channel y
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == CKABEN::Enabled
    }
}
///Field `CKABEN` writer - CKABEN
pub type CKABEN_W<'a, REG> = crate::BitWriter<'a, REG, CKABEN>;
impl<'a, REG> CKABEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Clock absence detector disabled on channel y
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(CKABEN::Disabled)
    }
    ///Clock absence detector enabled on channel y
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(CKABEN::Enabled)
    }
}
/**CHEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CHEN {
    ///0: Channel y disabled
    Disabled = 0,
    ///1: Channel y enabled
    Enabled = 1,
}
impl From<CHEN> for bool {
    #[inline(always)]
    fn from(variant: CHEN) -> Self {
        variant as u8 != 0
    }
}
///Field `CHEN` reader - CHEN
pub type CHEN_R = crate::BitReader<CHEN>;
impl CHEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> CHEN {
        match self.bits {
            false => CHEN::Disabled,
            true => CHEN::Enabled,
        }
    }
    ///Channel y disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == CHEN::Disabled
    }
    ///Channel y enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == CHEN::Enabled
    }
}
///Field `CHEN` writer - CHEN
pub type CHEN_W<'a, REG> = crate::BitWriter<'a, REG, CHEN>;
impl<'a, REG> CHEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Channel y disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(CHEN::Disabled)
    }
    ///Channel y enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(CHEN::Enabled)
    }
}
/**CHINSEL

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CHINSEL {
    ///0: Channel inputs are taken from pins of the same channel y
    SameChannel = 0,
    ///1: Channel inputs are taken from pins of the following channel (channel (y+1) modulo 8)
    FollowingChannel = 1,
}
impl From<CHINSEL> for bool {
    #[inline(always)]
    fn from(variant: CHINSEL) -> Self {
        variant as u8 != 0
    }
}
///Field `CHINSEL` reader - CHINSEL
pub type CHINSEL_R = crate::BitReader<CHINSEL>;
impl CHINSEL_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> CHINSEL {
        match self.bits {
            false => CHINSEL::SameChannel,
            true => CHINSEL::FollowingChannel,
        }
    }
    ///Channel inputs are taken from pins of the same channel y
    #[inline(always)]
    pub fn is_same_channel(&self) -> bool {
        *self == CHINSEL::SameChannel
    }
    ///Channel inputs are taken from pins of the following channel (channel (y+1) modulo 8)
    #[inline(always)]
    pub fn is_following_channel(&self) -> bool {
        *self == CHINSEL::FollowingChannel
    }
}
///Field `CHINSEL` writer - CHINSEL
pub type CHINSEL_W<'a, REG> = crate::BitWriter<'a, REG, CHINSEL>;
impl<'a, REG> CHINSEL_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Channel inputs are taken from pins of the same channel y
    #[inline(always)]
    pub fn same_channel(self) -> &'a mut crate::W<REG> {
        self.variant(CHINSEL::SameChannel)
    }
    ///Channel inputs are taken from pins of the following channel (channel (y+1) modulo 8)
    #[inline(always)]
    pub fn following_channel(self) -> &'a mut crate::W<REG> {
        self.variant(CHINSEL::FollowingChannel)
    }
}
/**DATMPX

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATMPX {
    ///0: Data to channel y are taken from external serial inputs as 1-bit values. DFSDM_CHyDATINR register is write protected
    External = 0,
    ///1: Data to channel y are taken from internal analog to digital converter ADCy+1 output register update as 16-bit values (if ADCy+1 is available). Data from ADCs are written into INDAT0\[15:0\] part of DFSDM_CHyDATINR register
    Adc = 1,
    ///2: Data to channel y are taken from internal DFSDM_CHyDATINR register by direct CPU/DMA write. There can be written one or two 16-bit data samples according DATPACK\[1:0\] bit field setting
    Internal = 2,
}
impl From<DATMPX> for u8 {
    #[inline(always)]
    fn from(variant: DATMPX) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for DATMPX {
    type Ux = u8;
}
impl crate::IsEnum for DATMPX {}
///Field `DATMPX` reader - DATMPX
pub type DATMPX_R = crate::FieldReader<DATMPX>;
impl DATMPX_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<DATMPX> {
        match self.bits {
            0 => Some(DATMPX::External),
            1 => Some(DATMPX::Adc),
            2 => Some(DATMPX::Internal),
            _ => None,
        }
    }
    ///Data to channel y are taken from external serial inputs as 1-bit values. DFSDM_CHyDATINR register is write protected
    #[inline(always)]
    pub fn is_external(&self) -> bool {
        *self == DATMPX::External
    }
    ///Data to channel y are taken from internal analog to digital converter ADCy+1 output register update as 16-bit values (if ADCy+1 is available). Data from ADCs are written into INDAT0\[15:0\] part of DFSDM_CHyDATINR register
    #[inline(always)]
    pub fn is_adc(&self) -> bool {
        *self == DATMPX::Adc
    }
    ///Data to channel y are taken from internal DFSDM_CHyDATINR register by direct CPU/DMA write. There can be written one or two 16-bit data samples according DATPACK\[1:0\] bit field setting
    #[inline(always)]
    pub fn is_internal(&self) -> bool {
        *self == DATMPX::Internal
    }
}
///Field `DATMPX` writer - DATMPX
pub type DATMPX_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATMPX>;
impl<'a, REG> DATMPX_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Data to channel y are taken from external serial inputs as 1-bit values. DFSDM_CHyDATINR register is write protected
    #[inline(always)]
    pub fn external(self) -> &'a mut crate::W<REG> {
        self.variant(DATMPX::External)
    }
    ///Data to channel y are taken from internal analog to digital converter ADCy+1 output register update as 16-bit values (if ADCy+1 is available). Data from ADCs are written into INDAT0\[15:0\] part of DFSDM_CHyDATINR register
    #[inline(always)]
    pub fn adc(self) -> &'a mut crate::W<REG> {
        self.variant(DATMPX::Adc)
    }
    ///Data to channel y are taken from internal DFSDM_CHyDATINR register by direct CPU/DMA write. There can be written one or two 16-bit data samples according DATPACK\[1:0\] bit field setting
    #[inline(always)]
    pub fn internal(self) -> &'a mut crate::W<REG> {
        self.variant(DATMPX::Internal)
    }
}
/**DATPACK

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATPACK {
    ///0: Standard: input data in DFSDM_CHyDATINR register are stored only in INDAT0\[15:0\]. To empty DFSDM_CHyDATINR register one sample must be read by the DFSDM filter from channel y
    Standard = 0,
    ///1: : Interleaved: input data in DFSDM_CHyDATINR register are stored as two samples: –first sample in INDAT0\[15:0\] (assigned to channel y) –second sample INDAT1\[15:0\] (assigned to channel y)
    Interleaved = 1,
    ///2: Dual: input data in DFSDM_CHyDATINR register are stored as two samples: –first sample INDAT0\[15:0\] (assigned to channel y) –second sample INDAT1\[15:0\] (assigned to channel y+1)
    Dual = 2,
}
impl From<DATPACK> for u8 {
    #[inline(always)]
    fn from(variant: DATPACK) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for DATPACK {
    type Ux = u8;
}
impl crate::IsEnum for DATPACK {}
///Field `DATPACK` reader - DATPACK
pub type DATPACK_R = crate::FieldReader<DATPACK>;
impl DATPACK_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<DATPACK> {
        match self.bits {
            0 => Some(DATPACK::Standard),
            1 => Some(DATPACK::Interleaved),
            2 => Some(DATPACK::Dual),
            _ => None,
        }
    }
    ///Standard: input data in DFSDM_CHyDATINR register are stored only in INDAT0\[15:0\]. To empty DFSDM_CHyDATINR register one sample must be read by the DFSDM filter from channel y
    #[inline(always)]
    pub fn is_standard(&self) -> bool {
        *self == DATPACK::Standard
    }
    ///: Interleaved: input data in DFSDM_CHyDATINR register are stored as two samples: –first sample in INDAT0\[15:0\] (assigned to channel y) –second sample INDAT1\[15:0\] (assigned to channel y)
    #[inline(always)]
    pub fn is_interleaved(&self) -> bool {
        *self == DATPACK::Interleaved
    }
    ///Dual: input data in DFSDM_CHyDATINR register are stored as two samples: –first sample INDAT0\[15:0\] (assigned to channel y) –second sample INDAT1\[15:0\] (assigned to channel y+1)
    #[inline(always)]
    pub fn is_dual(&self) -> bool {
        *self == DATPACK::Dual
    }
}
///Field `DATPACK` writer - DATPACK
pub type DATPACK_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATPACK>;
impl<'a, REG> DATPACK_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Standard: input data in DFSDM_CHyDATINR register are stored only in INDAT0\[15:0\]. To empty DFSDM_CHyDATINR register one sample must be read by the DFSDM filter from channel y
    #[inline(always)]
    pub fn standard(self) -> &'a mut crate::W<REG> {
        self.variant(DATPACK::Standard)
    }
    ///: Interleaved: input data in DFSDM_CHyDATINR register are stored as two samples: –first sample in INDAT0\[15:0\] (assigned to channel y) –second sample INDAT1\[15:0\] (assigned to channel y)
    #[inline(always)]
    pub fn interleaved(self) -> &'a mut crate::W<REG> {
        self.variant(DATPACK::Interleaved)
    }
    ///Dual: input data in DFSDM_CHyDATINR register are stored as two samples: –first sample INDAT0\[15:0\] (assigned to channel y) –second sample INDAT1\[15:0\] (assigned to channel y+1)
    #[inline(always)]
    pub fn dual(self) -> &'a mut crate::W<REG> {
        self.variant(DATPACK::Dual)
    }
}
///Field `CKOUTDIV` reader - CKOUTDIV
pub type CKOUTDIV_R = crate::FieldReader;
///Field `CKOUTDIV` writer - CKOUTDIV
pub type CKOUTDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
/**CKOUTSRC

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKOUTSRC {
    ///0: Source for output clock is from system clock
    Sysclk = 0,
    ///1: Source for output clock is from audio clock
    Audclk = 1,
}
impl From<CKOUTSRC> for bool {
    #[inline(always)]
    fn from(variant: CKOUTSRC) -> Self {
        variant as u8 != 0
    }
}
///Field `CKOUTSRC` reader - CKOUTSRC
pub type CKOUTSRC_R = crate::BitReader<CKOUTSRC>;
impl CKOUTSRC_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> CKOUTSRC {
        match self.bits {
            false => CKOUTSRC::Sysclk,
            true => CKOUTSRC::Audclk,
        }
    }
    ///Source for output clock is from system clock
    #[inline(always)]
    pub fn is_sysclk(&self) -> bool {
        *self == CKOUTSRC::Sysclk
    }
    ///Source for output clock is from audio clock
    #[inline(always)]
    pub fn is_audclk(&self) -> bool {
        *self == CKOUTSRC::Audclk
    }
}
///Field `CKOUTSRC` writer - CKOUTSRC
pub type CKOUTSRC_W<'a, REG> = crate::BitWriter<'a, REG, CKOUTSRC>;
impl<'a, REG> CKOUTSRC_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Source for output clock is from system clock
    #[inline(always)]
    pub fn sysclk(self) -> &'a mut crate::W<REG> {
        self.variant(CKOUTSRC::Sysclk)
    }
    ///Source for output clock is from audio clock
    #[inline(always)]
    pub fn audclk(self) -> &'a mut crate::W<REG> {
        self.variant(CKOUTSRC::Audclk)
    }
}
/**DFSDMEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DFSDMEN {
    ///0: DFSDM interface disabled
    Disabled = 0,
    ///1: DFSDM interface enabled
    Enabled = 1,
}
impl From<DFSDMEN> for bool {
    #[inline(always)]
    fn from(variant: DFSDMEN) -> Self {
        variant as u8 != 0
    }
}
///Field `DFSDMEN` reader - DFSDMEN
pub type DFSDMEN_R = crate::BitReader<DFSDMEN>;
impl DFSDMEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DFSDMEN {
        match self.bits {
            false => DFSDMEN::Disabled,
            true => DFSDMEN::Enabled,
        }
    }
    ///DFSDM interface disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == DFSDMEN::Disabled
    }
    ///DFSDM interface enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == DFSDMEN::Enabled
    }
}
///Field `DFSDMEN` writer - DFSDMEN
pub type DFSDMEN_W<'a, REG> = crate::BitWriter<'a, REG, DFSDMEN>;
impl<'a, REG> DFSDMEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///DFSDM interface disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(DFSDMEN::Disabled)
    }
    ///DFSDM interface enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(DFSDMEN::Enabled)
    }
}
impl R {
    ///Bits 0:1 - SITP
    #[inline(always)]
    pub fn sitp(&self) -> SITP_R {
        SITP_R::new((self.bits & 3) as u8)
    }
    ///Bits 2:3 - SPICKSEL
    #[inline(always)]
    pub fn spicksel(&self) -> SPICKSEL_R {
        SPICKSEL_R::new(((self.bits >> 2) & 3) as u8)
    }
    ///Bit 5 - SCDEN
    #[inline(always)]
    pub fn scden(&self) -> SCDEN_R {
        SCDEN_R::new(((self.bits >> 5) & 1) != 0)
    }
    ///Bit 6 - CKABEN
    #[inline(always)]
    pub fn ckaben(&self) -> CKABEN_R {
        CKABEN_R::new(((self.bits >> 6) & 1) != 0)
    }
    ///Bit 7 - CHEN
    #[inline(always)]
    pub fn chen(&self) -> CHEN_R {
        CHEN_R::new(((self.bits >> 7) & 1) != 0)
    }
    ///Bit 8 - CHINSEL
    #[inline(always)]
    pub fn chinsel(&self) -> CHINSEL_R {
        CHINSEL_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bits 12:13 - DATMPX
    #[inline(always)]
    pub fn datmpx(&self) -> DATMPX_R {
        DATMPX_R::new(((self.bits >> 12) & 3) as u8)
    }
    ///Bits 14:15 - DATPACK
    #[inline(always)]
    pub fn datpack(&self) -> DATPACK_R {
        DATPACK_R::new(((self.bits >> 14) & 3) as u8)
    }
    ///Bits 16:23 - CKOUTDIV
    #[inline(always)]
    pub fn ckoutdiv(&self) -> CKOUTDIV_R {
        CKOUTDIV_R::new(((self.bits >> 16) & 0xff) as u8)
    }
    ///Bit 30 - CKOUTSRC
    #[inline(always)]
    pub fn ckoutsrc(&self) -> CKOUTSRC_R {
        CKOUTSRC_R::new(((self.bits >> 30) & 1) != 0)
    }
    ///Bit 31 - DFSDMEN
    #[inline(always)]
    pub fn dfsdmen(&self) -> DFSDMEN_R {
        DFSDMEN_R::new(((self.bits >> 31) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("CFGR1")
            .field("dfsdmen", &self.dfsdmen())
            .field("ckoutsrc", &self.ckoutsrc())
            .field("ckoutdiv", &self.ckoutdiv())
            .field("datpack", &self.datpack())
            .field("datmpx", &self.datmpx())
            .field("chinsel", &self.chinsel())
            .field("chen", &self.chen())
            .field("ckaben", &self.ckaben())
            .field("scden", &self.scden())
            .field("spicksel", &self.spicksel())
            .field("sitp", &self.sitp())
            .finish()
    }
}
impl W {
    ///Bits 0:1 - SITP
    #[inline(always)]
    pub fn sitp(&mut self) -> SITP_W<CFGR1rs> {
        SITP_W::new(self, 0)
    }
    ///Bits 2:3 - SPICKSEL
    #[inline(always)]
    pub fn spicksel(&mut self) -> SPICKSEL_W<CFGR1rs> {
        SPICKSEL_W::new(self, 2)
    }
    ///Bit 5 - SCDEN
    #[inline(always)]
    pub fn scden(&mut self) -> SCDEN_W<CFGR1rs> {
        SCDEN_W::new(self, 5)
    }
    ///Bit 6 - CKABEN
    #[inline(always)]
    pub fn ckaben(&mut self) -> CKABEN_W<CFGR1rs> {
        CKABEN_W::new(self, 6)
    }
    ///Bit 7 - CHEN
    #[inline(always)]
    pub fn chen(&mut self) -> CHEN_W<CFGR1rs> {
        CHEN_W::new(self, 7)
    }
    ///Bit 8 - CHINSEL
    #[inline(always)]
    pub fn chinsel(&mut self) -> CHINSEL_W<CFGR1rs> {
        CHINSEL_W::new(self, 8)
    }
    ///Bits 12:13 - DATMPX
    #[inline(always)]
    pub fn datmpx(&mut self) -> DATMPX_W<CFGR1rs> {
        DATMPX_W::new(self, 12)
    }
    ///Bits 14:15 - DATPACK
    #[inline(always)]
    pub fn datpack(&mut self) -> DATPACK_W<CFGR1rs> {
        DATPACK_W::new(self, 14)
    }
    ///Bits 16:23 - CKOUTDIV
    #[inline(always)]
    pub fn ckoutdiv(&mut self) -> CKOUTDIV_W<CFGR1rs> {
        CKOUTDIV_W::new(self, 16)
    }
    ///Bit 30 - CKOUTSRC
    #[inline(always)]
    pub fn ckoutsrc(&mut self) -> CKOUTSRC_W<CFGR1rs> {
        CKOUTSRC_W::new(self, 30)
    }
    ///Bit 31 - DFSDMEN
    #[inline(always)]
    pub fn dfsdmen(&mut self) -> DFSDMEN_W<CFGR1rs> {
        DFSDMEN_W::new(self, 31)
    }
}
/**channel configuration y register

You can [`read`](crate::Reg::read) this register and get [`cfgr1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cfgr1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
pub struct CFGR1rs;
impl crate::RegisterSpec for CFGR1rs {
    type Ux = u32;
}
///`read()` method returns [`cfgr1::R`](R) reader structure
impl crate::Readable for CFGR1rs {}
///`write(|w| ..)` method takes [`cfgr1::W`](W) writer structure
impl crate::Writable for CFGR1rs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets CFGR1 to value 0
impl crate::Resettable for CFGR1rs {}