stm32l1 0.16.0

Device support crates for STM32L1 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
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
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
///Register `CR` reader
pub type R = crate::R<CRrs>;
///Register `CR` writer
pub type W = crate::W<CRrs>;
/**DAC channel%s enable

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

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BOFF1 {
    ///0: DAC channel X output buffer enabled
    Enabled = 0,
    ///1: DAC channel X output buffer disabled
    Disabled = 1,
}
impl From<BOFF1> for bool {
    #[inline(always)]
    fn from(variant: BOFF1) -> Self {
        variant as u8 != 0
    }
}
///Field `BOFF(1-2)` reader - DAC channel%s output buffer disable
pub type BOFF_R = crate::BitReader<BOFF1>;
impl BOFF_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> BOFF1 {
        match self.bits {
            false => BOFF1::Enabled,
            true => BOFF1::Disabled,
        }
    }
    ///DAC channel X output buffer enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == BOFF1::Enabled
    }
    ///DAC channel X output buffer disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == BOFF1::Disabled
    }
}
///Field `BOFF(1-2)` writer - DAC channel%s output buffer disable
pub type BOFF_W<'a, REG> = crate::BitWriter<'a, REG, BOFF1>;
impl<'a, REG> BOFF_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///DAC channel X output buffer enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(BOFF1::Enabled)
    }
    ///DAC channel X output buffer disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(BOFF1::Disabled)
    }
}
/**DAC channel%s trigger enable

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

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TSEL1 {
    ///0: Timer 6 TRGO event
    Tim6trgo = 0,
    ///2: Timer 7 TRGO event
    Tim7trgo = 2,
    ///3: Timer 9 TRGO event
    Tim9trgo = 3,
    ///4: Timer 2 TRGO event
    Tim2trgo = 4,
    ///5: Timer 4 TRGO event
    Tim4trgo = 5,
    ///6: EXTI line 9
    Exti9 = 6,
    ///7: Software trigger
    Swtrig = 7,
}
impl From<TSEL1> for u8 {
    #[inline(always)]
    fn from(variant: TSEL1) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for TSEL1 {
    type Ux = u8;
}
impl crate::IsEnum for TSEL1 {}
///Field `TSEL1` reader - DAC channel1 trigger selection
pub type TSEL1_R = crate::FieldReader<TSEL1>;
impl TSEL1_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<TSEL1> {
        match self.bits {
            0 => Some(TSEL1::Tim6trgo),
            2 => Some(TSEL1::Tim7trgo),
            3 => Some(TSEL1::Tim9trgo),
            4 => Some(TSEL1::Tim2trgo),
            5 => Some(TSEL1::Tim4trgo),
            6 => Some(TSEL1::Exti9),
            7 => Some(TSEL1::Swtrig),
            _ => None,
        }
    }
    ///Timer 6 TRGO event
    #[inline(always)]
    pub fn is_tim6trgo(&self) -> bool {
        *self == TSEL1::Tim6trgo
    }
    ///Timer 7 TRGO event
    #[inline(always)]
    pub fn is_tim7trgo(&self) -> bool {
        *self == TSEL1::Tim7trgo
    }
    ///Timer 9 TRGO event
    #[inline(always)]
    pub fn is_tim9trgo(&self) -> bool {
        *self == TSEL1::Tim9trgo
    }
    ///Timer 2 TRGO event
    #[inline(always)]
    pub fn is_tim2trgo(&self) -> bool {
        *self == TSEL1::Tim2trgo
    }
    ///Timer 4 TRGO event
    #[inline(always)]
    pub fn is_tim4trgo(&self) -> bool {
        *self == TSEL1::Tim4trgo
    }
    ///EXTI line 9
    #[inline(always)]
    pub fn is_exti9(&self) -> bool {
        *self == TSEL1::Exti9
    }
    ///Software trigger
    #[inline(always)]
    pub fn is_swtrig(&self) -> bool {
        *self == TSEL1::Swtrig
    }
}
///Field `TSEL1` writer - DAC channel1 trigger selection
pub type TSEL1_W<'a, REG> = crate::FieldWriter<'a, REG, 3, TSEL1>;
impl<'a, REG> TSEL1_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Timer 6 TRGO event
    #[inline(always)]
    pub fn tim6trgo(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Tim6trgo)
    }
    ///Timer 7 TRGO event
    #[inline(always)]
    pub fn tim7trgo(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Tim7trgo)
    }
    ///Timer 9 TRGO event
    #[inline(always)]
    pub fn tim9trgo(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Tim9trgo)
    }
    ///Timer 2 TRGO event
    #[inline(always)]
    pub fn tim2trgo(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Tim2trgo)
    }
    ///Timer 4 TRGO event
    #[inline(always)]
    pub fn tim4trgo(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Tim4trgo)
    }
    ///EXTI line 9
    #[inline(always)]
    pub fn exti9(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Exti9)
    }
    ///Software trigger
    #[inline(always)]
    pub fn swtrig(self) -> &'a mut crate::W<REG> {
        self.variant(TSEL1::Swtrig)
    }
}
/**DAC channel%s noise/triangle wave generation enable

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum WAVE1 {
    ///0: Wave generation disabled
    Disabled = 0,
    ///1: Noise wave generation enabled
    Noise = 1,
    ///2: Triangle wave generation enabled
    Triangle = 2,
}
impl From<WAVE1> for u8 {
    #[inline(always)]
    fn from(variant: WAVE1) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for WAVE1 {
    type Ux = u8;
}
impl crate::IsEnum for WAVE1 {}
///Field `WAVE(1-2)` reader - DAC channel%s noise/triangle wave generation enable
pub type WAVE_R = crate::FieldReader<WAVE1>;
impl WAVE_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> WAVE1 {
        match self.bits {
            0 => WAVE1::Disabled,
            1 => WAVE1::Noise,
            _ => WAVE1::Triangle,
        }
    }
    ///Wave generation disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == WAVE1::Disabled
    }
    ///Noise wave generation enabled
    #[inline(always)]
    pub fn is_noise(&self) -> bool {
        *self == WAVE1::Noise
    }
    ///Triangle wave generation enabled
    #[inline(always)]
    pub fn is_triangle(&self) -> bool {
        matches!(self.variant(), WAVE1::Triangle)
    }
}
///Field `WAVE(1-2)` writer - DAC channel%s noise/triangle wave generation enable
pub type WAVE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, WAVE1, crate::Safe>;
impl<'a, REG> WAVE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Wave generation disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(WAVE1::Disabled)
    }
    ///Noise wave generation enabled
    #[inline(always)]
    pub fn noise(self) -> &'a mut crate::W<REG> {
        self.variant(WAVE1::Noise)
    }
    ///Triangle wave generation enabled
    #[inline(always)]
    pub fn triangle(self) -> &'a mut crate::W<REG> {
        self.variant(WAVE1::Triangle)
    }
}
/**DAC channel%s mask/amplitude selector

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MAMP1 {
    ///0: Unmask bit0 of LFSR/ triangle amplitude equal to 1
    Amp1 = 0,
    ///1: Unmask bits\[1:0\] of LFSR/ triangle amplitude equal to 3
    Amp3 = 1,
    ///2: Unmask bits\[2:0\] of LFSR/ triangle amplitude equal to 7
    Amp7 = 2,
    ///3: Unmask bits\[3:0\] of LFSR/ triangle amplitude equal to 15
    Amp15 = 3,
    ///4: Unmask bits\[4:0\] of LFSR/ triangle amplitude equal to 31
    Amp31 = 4,
    ///5: Unmask bits\[5:0\] of LFSR/ triangle amplitude equal 63
    Amp63 = 5,
    ///6: Unmask bits\[6:0\] of LFSR/ triangle amplitude equal to 127
    Amp127 = 6,
    ///7: Unmask bits\[7:0\] of LFSR/ triangle amplitude equal to 255
    Amp255 = 7,
    ///8: Unmask bits\[8:0\] of LFSR/ triangle amplitude equal to 511
    Amp511 = 8,
    ///9: Unmask bits\[9:0\] of LFSR/ triangle amplitude equal to 1023
    Amp1023 = 9,
    ///10: Unmask bits\[10:0\] of LFSR/ triangle amplitude equal to 2047
    Amp2047 = 10,
    ///11: Unmask bits\[11:0\] of LFSR/ triangle amplitude equal to 4095
    Amp4095 = 11,
}
impl From<MAMP1> for u8 {
    #[inline(always)]
    fn from(variant: MAMP1) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for MAMP1 {
    type Ux = u8;
}
impl crate::IsEnum for MAMP1 {}
///Field `MAMP(1-2)` reader - DAC channel%s mask/amplitude selector
pub type MAMP_R = crate::FieldReader<MAMP1>;
impl MAMP_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> MAMP1 {
        match self.bits {
            0 => MAMP1::Amp1,
            1 => MAMP1::Amp3,
            2 => MAMP1::Amp7,
            3 => MAMP1::Amp15,
            4 => MAMP1::Amp31,
            5 => MAMP1::Amp63,
            6 => MAMP1::Amp127,
            7 => MAMP1::Amp255,
            8 => MAMP1::Amp511,
            9 => MAMP1::Amp1023,
            10 => MAMP1::Amp2047,
            _ => MAMP1::Amp4095,
        }
    }
    ///Unmask bit0 of LFSR/ triangle amplitude equal to 1
    #[inline(always)]
    pub fn is_amp1(&self) -> bool {
        *self == MAMP1::Amp1
    }
    ///Unmask bits\[1:0\] of LFSR/ triangle amplitude equal to 3
    #[inline(always)]
    pub fn is_amp3(&self) -> bool {
        *self == MAMP1::Amp3
    }
    ///Unmask bits\[2:0\] of LFSR/ triangle amplitude equal to 7
    #[inline(always)]
    pub fn is_amp7(&self) -> bool {
        *self == MAMP1::Amp7
    }
    ///Unmask bits\[3:0\] of LFSR/ triangle amplitude equal to 15
    #[inline(always)]
    pub fn is_amp15(&self) -> bool {
        *self == MAMP1::Amp15
    }
    ///Unmask bits\[4:0\] of LFSR/ triangle amplitude equal to 31
    #[inline(always)]
    pub fn is_amp31(&self) -> bool {
        *self == MAMP1::Amp31
    }
    ///Unmask bits\[5:0\] of LFSR/ triangle amplitude equal 63
    #[inline(always)]
    pub fn is_amp63(&self) -> bool {
        *self == MAMP1::Amp63
    }
    ///Unmask bits\[6:0\] of LFSR/ triangle amplitude equal to 127
    #[inline(always)]
    pub fn is_amp127(&self) -> bool {
        *self == MAMP1::Amp127
    }
    ///Unmask bits\[7:0\] of LFSR/ triangle amplitude equal to 255
    #[inline(always)]
    pub fn is_amp255(&self) -> bool {
        *self == MAMP1::Amp255
    }
    ///Unmask bits\[8:0\] of LFSR/ triangle amplitude equal to 511
    #[inline(always)]
    pub fn is_amp511(&self) -> bool {
        *self == MAMP1::Amp511
    }
    ///Unmask bits\[9:0\] of LFSR/ triangle amplitude equal to 1023
    #[inline(always)]
    pub fn is_amp1023(&self) -> bool {
        *self == MAMP1::Amp1023
    }
    ///Unmask bits\[10:0\] of LFSR/ triangle amplitude equal to 2047
    #[inline(always)]
    pub fn is_amp2047(&self) -> bool {
        *self == MAMP1::Amp2047
    }
    ///Unmask bits\[11:0\] of LFSR/ triangle amplitude equal to 4095
    #[inline(always)]
    pub fn is_amp4095(&self) -> bool {
        matches!(self.variant(), MAMP1::Amp4095)
    }
}
///Field `MAMP(1-2)` writer - DAC channel%s mask/amplitude selector
pub type MAMP_W<'a, REG> = crate::FieldWriter<'a, REG, 4, MAMP1, crate::Safe>;
impl<'a, REG> MAMP_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Unmask bit0 of LFSR/ triangle amplitude equal to 1
    #[inline(always)]
    pub fn amp1(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp1)
    }
    ///Unmask bits\[1:0\] of LFSR/ triangle amplitude equal to 3
    #[inline(always)]
    pub fn amp3(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp3)
    }
    ///Unmask bits\[2:0\] of LFSR/ triangle amplitude equal to 7
    #[inline(always)]
    pub fn amp7(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp7)
    }
    ///Unmask bits\[3:0\] of LFSR/ triangle amplitude equal to 15
    #[inline(always)]
    pub fn amp15(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp15)
    }
    ///Unmask bits\[4:0\] of LFSR/ triangle amplitude equal to 31
    #[inline(always)]
    pub fn amp31(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp31)
    }
    ///Unmask bits\[5:0\] of LFSR/ triangle amplitude equal 63
    #[inline(always)]
    pub fn amp63(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp63)
    }
    ///Unmask bits\[6:0\] of LFSR/ triangle amplitude equal to 127
    #[inline(always)]
    pub fn amp127(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp127)
    }
    ///Unmask bits\[7:0\] of LFSR/ triangle amplitude equal to 255
    #[inline(always)]
    pub fn amp255(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp255)
    }
    ///Unmask bits\[8:0\] of LFSR/ triangle amplitude equal to 511
    #[inline(always)]
    pub fn amp511(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp511)
    }
    ///Unmask bits\[9:0\] of LFSR/ triangle amplitude equal to 1023
    #[inline(always)]
    pub fn amp1023(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp1023)
    }
    ///Unmask bits\[10:0\] of LFSR/ triangle amplitude equal to 2047
    #[inline(always)]
    pub fn amp2047(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp2047)
    }
    ///Unmask bits\[11:0\] of LFSR/ triangle amplitude equal to 4095
    #[inline(always)]
    pub fn amp4095(self) -> &'a mut crate::W<REG> {
        self.variant(MAMP1::Amp4095)
    }
}
/**DAC channel%s DMA enable

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAEN1 {
    ///0: DAC channel X DMA mode disabled
    Disabled = 0,
    ///1: DAC channel X DMA mode enabled
    Enabled = 1,
}
impl From<DMAEN1> for bool {
    #[inline(always)]
    fn from(variant: DMAEN1) -> Self {
        variant as u8 != 0
    }
}
///Field `DMAEN(1-2)` reader - DAC channel%s DMA enable
pub type DMAEN_R = crate::BitReader<DMAEN1>;
impl DMAEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DMAEN1 {
        match self.bits {
            false => DMAEN1::Disabled,
            true => DMAEN1::Enabled,
        }
    }
    ///DAC channel X DMA mode disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == DMAEN1::Disabled
    }
    ///DAC channel X DMA mode enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == DMAEN1::Enabled
    }
}
///Field `DMAEN(1-2)` writer - DAC channel%s DMA enable
pub type DMAEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAEN1>;
impl<'a, REG> DMAEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///DAC channel X DMA mode disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(DMAEN1::Disabled)
    }
    ///DAC channel X DMA mode enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(DMAEN1::Enabled)
    }
}
/**DAC channel%s DMA Underrun Interrupt enable

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAUDRIE1 {
    ///0: DAC channel X DMA Underrun Interrupt disabled
    Disabled = 0,
    ///1: DAC channel X DMA Underrun Interrupt enabled
    Enabled = 1,
}
impl From<DMAUDRIE1> for bool {
    #[inline(always)]
    fn from(variant: DMAUDRIE1) -> Self {
        variant as u8 != 0
    }
}
///Field `DMAUDRIE(1-2)` reader - DAC channel%s DMA Underrun Interrupt enable
pub type DMAUDRIE_R = crate::BitReader<DMAUDRIE1>;
impl DMAUDRIE_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DMAUDRIE1 {
        match self.bits {
            false => DMAUDRIE1::Disabled,
            true => DMAUDRIE1::Enabled,
        }
    }
    ///DAC channel X DMA Underrun Interrupt disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == DMAUDRIE1::Disabled
    }
    ///DAC channel X DMA Underrun Interrupt enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == DMAUDRIE1::Enabled
    }
}
///Field `DMAUDRIE(1-2)` writer - DAC channel%s DMA Underrun Interrupt enable
pub type DMAUDRIE_W<'a, REG> = crate::BitWriter<'a, REG, DMAUDRIE1>;
impl<'a, REG> DMAUDRIE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///DAC channel X DMA Underrun Interrupt disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(DMAUDRIE1::Disabled)
    }
    ///DAC channel X DMA Underrun Interrupt enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(DMAUDRIE1::Enabled)
    }
}
///Field `TSEL2` reader - DAC channel2 trigger selection
pub use TSEL1_R as TSEL2_R;
///Field `TSEL2` writer - DAC channel2 trigger selection
pub use TSEL1_W as TSEL2_W;
impl R {
    ///DAC channel(1-2) enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EN1` field.</div>
    #[inline(always)]
    pub fn en(&self, n: u8) -> EN_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        EN_R::new(((self.bits >> (n * 16)) & 1) != 0)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) enable
    #[inline(always)]
    pub fn en_iter(&self) -> impl Iterator<Item = EN_R> + '_ {
        (0..2).map(move |n| EN_R::new(((self.bits >> (n * 16)) & 1) != 0))
    }
    ///Bit 0 - DAC channel1 enable
    #[inline(always)]
    pub fn en1(&self) -> EN_R {
        EN_R::new((self.bits & 1) != 0)
    }
    ///Bit 16 - DAC channel2 enable
    #[inline(always)]
    pub fn en2(&self) -> EN_R {
        EN_R::new(((self.bits >> 16) & 1) != 0)
    }
    ///DAC channel(1-2) output buffer disable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `BOFF1` field.</div>
    #[inline(always)]
    pub fn boff(&self, n: u8) -> BOFF_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        BOFF_R::new(((self.bits >> (n * 16 + 1)) & 1) != 0)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) output buffer disable
    #[inline(always)]
    pub fn boff_iter(&self) -> impl Iterator<Item = BOFF_R> + '_ {
        (0..2).map(move |n| BOFF_R::new(((self.bits >> (n * 16 + 1)) & 1) != 0))
    }
    ///Bit 1 - DAC channel1 output buffer disable
    #[inline(always)]
    pub fn boff1(&self) -> BOFF_R {
        BOFF_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 17 - DAC channel2 output buffer disable
    #[inline(always)]
    pub fn boff2(&self) -> BOFF_R {
        BOFF_R::new(((self.bits >> 17) & 1) != 0)
    }
    ///DAC channel(1-2) trigger enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TEN1` field.</div>
    #[inline(always)]
    pub fn ten(&self, n: u8) -> TEN_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        TEN_R::new(((self.bits >> (n * 16 + 2)) & 1) != 0)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) trigger enable
    #[inline(always)]
    pub fn ten_iter(&self) -> impl Iterator<Item = TEN_R> + '_ {
        (0..2).map(move |n| TEN_R::new(((self.bits >> (n * 16 + 2)) & 1) != 0))
    }
    ///Bit 2 - DAC channel1 trigger enable
    #[inline(always)]
    pub fn ten1(&self) -> TEN_R {
        TEN_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 18 - DAC channel2 trigger enable
    #[inline(always)]
    pub fn ten2(&self) -> TEN_R {
        TEN_R::new(((self.bits >> 18) & 1) != 0)
    }
    ///Bits 3:5 - DAC channel1 trigger selection
    #[inline(always)]
    pub fn tsel1(&self) -> TSEL1_R {
        TSEL1_R::new(((self.bits >> 3) & 7) as u8)
    }
    ///DAC channel(1-2) noise/triangle wave generation enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `WAVE1` field.</div>
    #[inline(always)]
    pub fn wave(&self, n: u8) -> WAVE_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        WAVE_R::new(((self.bits >> (n * 16 + 6)) & 3) as u8)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) noise/triangle wave generation enable
    #[inline(always)]
    pub fn wave_iter(&self) -> impl Iterator<Item = WAVE_R> + '_ {
        (0..2).map(move |n| WAVE_R::new(((self.bits >> (n * 16 + 6)) & 3) as u8))
    }
    ///Bits 6:7 - DAC channel1 noise/triangle wave generation enable
    #[inline(always)]
    pub fn wave1(&self) -> WAVE_R {
        WAVE_R::new(((self.bits >> 6) & 3) as u8)
    }
    ///Bits 22:23 - DAC channel2 noise/triangle wave generation enable
    #[inline(always)]
    pub fn wave2(&self) -> WAVE_R {
        WAVE_R::new(((self.bits >> 22) & 3) as u8)
    }
    ///DAC channel(1-2) mask/amplitude selector
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `MAMP1` field.</div>
    #[inline(always)]
    pub fn mamp(&self, n: u8) -> MAMP_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        MAMP_R::new(((self.bits >> (n * 16 + 8)) & 0x0f) as u8)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) mask/amplitude selector
    #[inline(always)]
    pub fn mamp_iter(&self) -> impl Iterator<Item = MAMP_R> + '_ {
        (0..2).map(move |n| MAMP_R::new(((self.bits >> (n * 16 + 8)) & 0x0f) as u8))
    }
    ///Bits 8:11 - DAC channel1 mask/amplitude selector
    #[inline(always)]
    pub fn mamp1(&self) -> MAMP_R {
        MAMP_R::new(((self.bits >> 8) & 0x0f) as u8)
    }
    ///Bits 24:27 - DAC channel2 mask/amplitude selector
    #[inline(always)]
    pub fn mamp2(&self) -> MAMP_R {
        MAMP_R::new(((self.bits >> 24) & 0x0f) as u8)
    }
    ///DAC channel(1-2) DMA enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAEN1` field.</div>
    #[inline(always)]
    pub fn dmaen(&self, n: u8) -> DMAEN_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        DMAEN_R::new(((self.bits >> (n * 16 + 12)) & 1) != 0)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) DMA enable
    #[inline(always)]
    pub fn dmaen_iter(&self) -> impl Iterator<Item = DMAEN_R> + '_ {
        (0..2).map(move |n| DMAEN_R::new(((self.bits >> (n * 16 + 12)) & 1) != 0))
    }
    ///Bit 12 - DAC channel1 DMA enable
    #[inline(always)]
    pub fn dmaen1(&self) -> DMAEN_R {
        DMAEN_R::new(((self.bits >> 12) & 1) != 0)
    }
    ///Bit 28 - DAC channel2 DMA enable
    #[inline(always)]
    pub fn dmaen2(&self) -> DMAEN_R {
        DMAEN_R::new(((self.bits >> 28) & 1) != 0)
    }
    ///DAC channel(1-2) DMA Underrun Interrupt enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAUDRIE1` field.</div>
    #[inline(always)]
    pub fn dmaudrie(&self, n: u8) -> DMAUDRIE_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        DMAUDRIE_R::new(((self.bits >> (n * 16 + 13)) & 1) != 0)
    }
    ///Iterator for array of:
    ///DAC channel(1-2) DMA Underrun Interrupt enable
    #[inline(always)]
    pub fn dmaudrie_iter(&self) -> impl Iterator<Item = DMAUDRIE_R> + '_ {
        (0..2).map(move |n| DMAUDRIE_R::new(((self.bits >> (n * 16 + 13)) & 1) != 0))
    }
    ///Bit 13 - DAC channel1 DMA Underrun Interrupt enable
    #[inline(always)]
    pub fn dmaudrie1(&self) -> DMAUDRIE_R {
        DMAUDRIE_R::new(((self.bits >> 13) & 1) != 0)
    }
    ///Bit 29 - DAC channel2 DMA Underrun Interrupt enable
    #[inline(always)]
    pub fn dmaudrie2(&self) -> DMAUDRIE_R {
        DMAUDRIE_R::new(((self.bits >> 29) & 1) != 0)
    }
    ///Bits 19:21 - DAC channel2 trigger selection
    #[inline(always)]
    pub fn tsel2(&self) -> TSEL2_R {
        TSEL2_R::new(((self.bits >> 19) & 7) as u8)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("CR")
            .field("dmaudrie1", &self.dmaudrie1())
            .field("dmaudrie2", &self.dmaudrie2())
            .field("dmaen1", &self.dmaen1())
            .field("dmaen2", &self.dmaen2())
            .field("mamp1", &self.mamp1())
            .field("mamp2", &self.mamp2())
            .field("wave1", &self.wave1())
            .field("wave2", &self.wave2())
            .field("tsel1", &self.tsel1())
            .field("tsel2", &self.tsel2())
            .field("ten1", &self.ten1())
            .field("ten2", &self.ten2())
            .field("boff1", &self.boff1())
            .field("boff2", &self.boff2())
            .field("en1", &self.en1())
            .field("en2", &self.en2())
            .finish()
    }
}
impl W {
    ///DAC channel(1-2) enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EN1` field.</div>
    #[inline(always)]
    pub fn en(&mut self, n: u8) -> EN_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        EN_W::new(self, n * 16)
    }
    ///Bit 0 - DAC channel1 enable
    #[inline(always)]
    pub fn en1(&mut self) -> EN_W<CRrs> {
        EN_W::new(self, 0)
    }
    ///Bit 16 - DAC channel2 enable
    #[inline(always)]
    pub fn en2(&mut self) -> EN_W<CRrs> {
        EN_W::new(self, 16)
    }
    ///DAC channel(1-2) output buffer disable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `BOFF1` field.</div>
    #[inline(always)]
    pub fn boff(&mut self, n: u8) -> BOFF_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        BOFF_W::new(self, n * 16 + 1)
    }
    ///Bit 1 - DAC channel1 output buffer disable
    #[inline(always)]
    pub fn boff1(&mut self) -> BOFF_W<CRrs> {
        BOFF_W::new(self, 1)
    }
    ///Bit 17 - DAC channel2 output buffer disable
    #[inline(always)]
    pub fn boff2(&mut self) -> BOFF_W<CRrs> {
        BOFF_W::new(self, 17)
    }
    ///DAC channel(1-2) trigger enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TEN1` field.</div>
    #[inline(always)]
    pub fn ten(&mut self, n: u8) -> TEN_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        TEN_W::new(self, n * 16 + 2)
    }
    ///Bit 2 - DAC channel1 trigger enable
    #[inline(always)]
    pub fn ten1(&mut self) -> TEN_W<CRrs> {
        TEN_W::new(self, 2)
    }
    ///Bit 18 - DAC channel2 trigger enable
    #[inline(always)]
    pub fn ten2(&mut self) -> TEN_W<CRrs> {
        TEN_W::new(self, 18)
    }
    ///Bits 3:5 - DAC channel1 trigger selection
    #[inline(always)]
    pub fn tsel1(&mut self) -> TSEL1_W<CRrs> {
        TSEL1_W::new(self, 3)
    }
    ///DAC channel(1-2) noise/triangle wave generation enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `WAVE1` field.</div>
    #[inline(always)]
    pub fn wave(&mut self, n: u8) -> WAVE_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        WAVE_W::new(self, n * 16 + 6)
    }
    ///Bits 6:7 - DAC channel1 noise/triangle wave generation enable
    #[inline(always)]
    pub fn wave1(&mut self) -> WAVE_W<CRrs> {
        WAVE_W::new(self, 6)
    }
    ///Bits 22:23 - DAC channel2 noise/triangle wave generation enable
    #[inline(always)]
    pub fn wave2(&mut self) -> WAVE_W<CRrs> {
        WAVE_W::new(self, 22)
    }
    ///DAC channel(1-2) mask/amplitude selector
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `MAMP1` field.</div>
    #[inline(always)]
    pub fn mamp(&mut self, n: u8) -> MAMP_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        MAMP_W::new(self, n * 16 + 8)
    }
    ///Bits 8:11 - DAC channel1 mask/amplitude selector
    #[inline(always)]
    pub fn mamp1(&mut self) -> MAMP_W<CRrs> {
        MAMP_W::new(self, 8)
    }
    ///Bits 24:27 - DAC channel2 mask/amplitude selector
    #[inline(always)]
    pub fn mamp2(&mut self) -> MAMP_W<CRrs> {
        MAMP_W::new(self, 24)
    }
    ///DAC channel(1-2) DMA enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAEN1` field.</div>
    #[inline(always)]
    pub fn dmaen(&mut self, n: u8) -> DMAEN_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        DMAEN_W::new(self, n * 16 + 12)
    }
    ///Bit 12 - DAC channel1 DMA enable
    #[inline(always)]
    pub fn dmaen1(&mut self) -> DMAEN_W<CRrs> {
        DMAEN_W::new(self, 12)
    }
    ///Bit 28 - DAC channel2 DMA enable
    #[inline(always)]
    pub fn dmaen2(&mut self) -> DMAEN_W<CRrs> {
        DMAEN_W::new(self, 28)
    }
    ///DAC channel(1-2) DMA Underrun Interrupt enable
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAUDRIE1` field.</div>
    #[inline(always)]
    pub fn dmaudrie(&mut self, n: u8) -> DMAUDRIE_W<CRrs> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        DMAUDRIE_W::new(self, n * 16 + 13)
    }
    ///Bit 13 - DAC channel1 DMA Underrun Interrupt enable
    #[inline(always)]
    pub fn dmaudrie1(&mut self) -> DMAUDRIE_W<CRrs> {
        DMAUDRIE_W::new(self, 13)
    }
    ///Bit 29 - DAC channel2 DMA Underrun Interrupt enable
    #[inline(always)]
    pub fn dmaudrie2(&mut self) -> DMAUDRIE_W<CRrs> {
        DMAUDRIE_W::new(self, 29)
    }
    ///Bits 19:21 - DAC channel2 trigger selection
    #[inline(always)]
    pub fn tsel2(&mut self) -> TSEL2_W<CRrs> {
        TSEL2_W::new(self, 19)
    }
}
/**control register

You can [`read`](crate::Reg::read) this register and get [`cr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).

See register [structure](https://stm32-rs.github.io/stm32-rs/STM32L100.html#DAC:CR)*/
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
    type Ux = u32;
}
///`read()` method returns [`cr::R`](R) reader structure
impl crate::Readable for CRrs {}
///`write(|w| ..)` method takes [`cr::W`](W) writer structure
impl crate::Writable for CRrs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets CR to value 0
impl crate::Resettable for CRrs {}