stm32f4_staging/stm32f407/dac/
cr.rs

1///Register `CR` reader
2pub type R = crate::R<CRrs>;
3///Register `CR` writer
4pub type W = crate::W<CRrs>;
5/**DAC channel%s enable
6
7Value on reset: 0*/
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum EN1 {
11    ///0: DAC channel X disabled
12    Disabled = 0,
13    ///1: DAC channel X enabled
14    Enabled = 1,
15}
16impl From<EN1> for bool {
17    #[inline(always)]
18    fn from(variant: EN1) -> Self {
19        variant as u8 != 0
20    }
21}
22///Field `EN(1-2)` reader - DAC channel%s enable
23pub type EN_R = crate::BitReader<EN1>;
24impl EN_R {
25    ///Get enumerated values variant
26    #[inline(always)]
27    pub const fn variant(&self) -> EN1 {
28        match self.bits {
29            false => EN1::Disabled,
30            true => EN1::Enabled,
31        }
32    }
33    ///DAC channel X disabled
34    #[inline(always)]
35    pub fn is_disabled(&self) -> bool {
36        *self == EN1::Disabled
37    }
38    ///DAC channel X enabled
39    #[inline(always)]
40    pub fn is_enabled(&self) -> bool {
41        *self == EN1::Enabled
42    }
43}
44///Field `EN(1-2)` writer - DAC channel%s enable
45pub type EN_W<'a, REG> = crate::BitWriter<'a, REG, EN1>;
46impl<'a, REG> EN_W<'a, REG>
47where
48    REG: crate::Writable + crate::RegisterSpec,
49{
50    ///DAC channel X disabled
51    #[inline(always)]
52    pub fn disabled(self) -> &'a mut crate::W<REG> {
53        self.variant(EN1::Disabled)
54    }
55    ///DAC channel X enabled
56    #[inline(always)]
57    pub fn enabled(self) -> &'a mut crate::W<REG> {
58        self.variant(EN1::Enabled)
59    }
60}
61/**DAC channel%s output buffer disable
62
63Value on reset: 0*/
64#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum BOFF1 {
67    ///0: DAC channel X output buffer enabled
68    Enabled = 0,
69    ///1: DAC channel X output buffer disabled
70    Disabled = 1,
71}
72impl From<BOFF1> for bool {
73    #[inline(always)]
74    fn from(variant: BOFF1) -> Self {
75        variant as u8 != 0
76    }
77}
78///Field `BOFF(1-2)` reader - DAC channel%s output buffer disable
79pub type BOFF_R = crate::BitReader<BOFF1>;
80impl BOFF_R {
81    ///Get enumerated values variant
82    #[inline(always)]
83    pub const fn variant(&self) -> BOFF1 {
84        match self.bits {
85            false => BOFF1::Enabled,
86            true => BOFF1::Disabled,
87        }
88    }
89    ///DAC channel X output buffer enabled
90    #[inline(always)]
91    pub fn is_enabled(&self) -> bool {
92        *self == BOFF1::Enabled
93    }
94    ///DAC channel X output buffer disabled
95    #[inline(always)]
96    pub fn is_disabled(&self) -> bool {
97        *self == BOFF1::Disabled
98    }
99}
100///Field `BOFF(1-2)` writer - DAC channel%s output buffer disable
101pub type BOFF_W<'a, REG> = crate::BitWriter<'a, REG, BOFF1>;
102impl<'a, REG> BOFF_W<'a, REG>
103where
104    REG: crate::Writable + crate::RegisterSpec,
105{
106    ///DAC channel X output buffer enabled
107    #[inline(always)]
108    pub fn enabled(self) -> &'a mut crate::W<REG> {
109        self.variant(BOFF1::Enabled)
110    }
111    ///DAC channel X output buffer disabled
112    #[inline(always)]
113    pub fn disabled(self) -> &'a mut crate::W<REG> {
114        self.variant(BOFF1::Disabled)
115    }
116}
117/**DAC channel%s trigger enable
118
119Value on reset: 0*/
120#[cfg_attr(feature = "defmt", derive(defmt::Format))]
121#[derive(Clone, Copy, Debug, PartialEq, Eq)]
122pub enum TEN1 {
123    ///0: DAC channel X trigger disabled
124    Disabled = 0,
125    ///1: DAC channel X trigger enabled
126    Enabled = 1,
127}
128impl From<TEN1> for bool {
129    #[inline(always)]
130    fn from(variant: TEN1) -> Self {
131        variant as u8 != 0
132    }
133}
134///Field `TEN(1-2)` reader - DAC channel%s trigger enable
135pub type TEN_R = crate::BitReader<TEN1>;
136impl TEN_R {
137    ///Get enumerated values variant
138    #[inline(always)]
139    pub const fn variant(&self) -> TEN1 {
140        match self.bits {
141            false => TEN1::Disabled,
142            true => TEN1::Enabled,
143        }
144    }
145    ///DAC channel X trigger disabled
146    #[inline(always)]
147    pub fn is_disabled(&self) -> bool {
148        *self == TEN1::Disabled
149    }
150    ///DAC channel X trigger enabled
151    #[inline(always)]
152    pub fn is_enabled(&self) -> bool {
153        *self == TEN1::Enabled
154    }
155}
156///Field `TEN(1-2)` writer - DAC channel%s trigger enable
157pub type TEN_W<'a, REG> = crate::BitWriter<'a, REG, TEN1>;
158impl<'a, REG> TEN_W<'a, REG>
159where
160    REG: crate::Writable + crate::RegisterSpec,
161{
162    ///DAC channel X trigger disabled
163    #[inline(always)]
164    pub fn disabled(self) -> &'a mut crate::W<REG> {
165        self.variant(TEN1::Disabled)
166    }
167    ///DAC channel X trigger enabled
168    #[inline(always)]
169    pub fn enabled(self) -> &'a mut crate::W<REG> {
170        self.variant(TEN1::Enabled)
171    }
172}
173/**DAC channel1 trigger selection
174
175Value on reset: 0*/
176#[cfg_attr(feature = "defmt", derive(defmt::Format))]
177#[derive(Clone, Copy, Debug, PartialEq, Eq)]
178#[repr(u8)]
179pub enum TSEL1 {
180    ///0: Timer 6 TRGO event
181    Tim6trgo = 0,
182    ///1: Timer 8 TRGO event
183    Tim8trgo = 1,
184    ///2: Timer 7 TRGO event
185    Tim7trgo = 2,
186    ///3: Timer 5 TRGO event
187    Tim5trgo = 3,
188    ///4: Timer 2 TRGO event
189    Tim2trgo = 4,
190    ///5: Timer 4 TRGO event
191    Tim4trgo = 5,
192    ///6: EXTI line 9
193    Exti9 = 6,
194    ///7: Software trigger
195    Swtrig = 7,
196}
197impl From<TSEL1> for u8 {
198    #[inline(always)]
199    fn from(variant: TSEL1) -> Self {
200        variant as _
201    }
202}
203impl crate::FieldSpec for TSEL1 {
204    type Ux = u8;
205}
206impl crate::IsEnum for TSEL1 {}
207///Field `TSEL1` reader - DAC channel1 trigger selection
208pub type TSEL1_R = crate::FieldReader<TSEL1>;
209impl TSEL1_R {
210    ///Get enumerated values variant
211    #[inline(always)]
212    pub const fn variant(&self) -> TSEL1 {
213        match self.bits {
214            0 => TSEL1::Tim6trgo,
215            1 => TSEL1::Tim8trgo,
216            2 => TSEL1::Tim7trgo,
217            3 => TSEL1::Tim5trgo,
218            4 => TSEL1::Tim2trgo,
219            5 => TSEL1::Tim4trgo,
220            6 => TSEL1::Exti9,
221            7 => TSEL1::Swtrig,
222            _ => unreachable!(),
223        }
224    }
225    ///Timer 6 TRGO event
226    #[inline(always)]
227    pub fn is_tim6trgo(&self) -> bool {
228        *self == TSEL1::Tim6trgo
229    }
230    ///Timer 8 TRGO event
231    #[inline(always)]
232    pub fn is_tim8trgo(&self) -> bool {
233        *self == TSEL1::Tim8trgo
234    }
235    ///Timer 7 TRGO event
236    #[inline(always)]
237    pub fn is_tim7trgo(&self) -> bool {
238        *self == TSEL1::Tim7trgo
239    }
240    ///Timer 5 TRGO event
241    #[inline(always)]
242    pub fn is_tim5trgo(&self) -> bool {
243        *self == TSEL1::Tim5trgo
244    }
245    ///Timer 2 TRGO event
246    #[inline(always)]
247    pub fn is_tim2trgo(&self) -> bool {
248        *self == TSEL1::Tim2trgo
249    }
250    ///Timer 4 TRGO event
251    #[inline(always)]
252    pub fn is_tim4trgo(&self) -> bool {
253        *self == TSEL1::Tim4trgo
254    }
255    ///EXTI line 9
256    #[inline(always)]
257    pub fn is_exti9(&self) -> bool {
258        *self == TSEL1::Exti9
259    }
260    ///Software trigger
261    #[inline(always)]
262    pub fn is_swtrig(&self) -> bool {
263        *self == TSEL1::Swtrig
264    }
265}
266///Field `TSEL1` writer - DAC channel1 trigger selection
267pub type TSEL1_W<'a, REG> = crate::FieldWriter<'a, REG, 3, TSEL1, crate::Safe>;
268impl<'a, REG> TSEL1_W<'a, REG>
269where
270    REG: crate::Writable + crate::RegisterSpec,
271    REG::Ux: From<u8>,
272{
273    ///Timer 6 TRGO event
274    #[inline(always)]
275    pub fn tim6trgo(self) -> &'a mut crate::W<REG> {
276        self.variant(TSEL1::Tim6trgo)
277    }
278    ///Timer 8 TRGO event
279    #[inline(always)]
280    pub fn tim8trgo(self) -> &'a mut crate::W<REG> {
281        self.variant(TSEL1::Tim8trgo)
282    }
283    ///Timer 7 TRGO event
284    #[inline(always)]
285    pub fn tim7trgo(self) -> &'a mut crate::W<REG> {
286        self.variant(TSEL1::Tim7trgo)
287    }
288    ///Timer 5 TRGO event
289    #[inline(always)]
290    pub fn tim5trgo(self) -> &'a mut crate::W<REG> {
291        self.variant(TSEL1::Tim5trgo)
292    }
293    ///Timer 2 TRGO event
294    #[inline(always)]
295    pub fn tim2trgo(self) -> &'a mut crate::W<REG> {
296        self.variant(TSEL1::Tim2trgo)
297    }
298    ///Timer 4 TRGO event
299    #[inline(always)]
300    pub fn tim4trgo(self) -> &'a mut crate::W<REG> {
301        self.variant(TSEL1::Tim4trgo)
302    }
303    ///EXTI line 9
304    #[inline(always)]
305    pub fn exti9(self) -> &'a mut crate::W<REG> {
306        self.variant(TSEL1::Exti9)
307    }
308    ///Software trigger
309    #[inline(always)]
310    pub fn swtrig(self) -> &'a mut crate::W<REG> {
311        self.variant(TSEL1::Swtrig)
312    }
313}
314/**DAC channel%s noise/triangle wave generation enable
315
316Value on reset: 0*/
317#[cfg_attr(feature = "defmt", derive(defmt::Format))]
318#[derive(Clone, Copy, Debug, PartialEq, Eq)]
319#[repr(u8)]
320pub enum WAVE1 {
321    ///0: Wave generation disabled
322    Disabled = 0,
323    ///1: Noise wave generation enabled
324    Noise = 1,
325    ///2: Triangle wave generation enabled
326    Triangle = 2,
327}
328impl From<WAVE1> for u8 {
329    #[inline(always)]
330    fn from(variant: WAVE1) -> Self {
331        variant as _
332    }
333}
334impl crate::FieldSpec for WAVE1 {
335    type Ux = u8;
336}
337impl crate::IsEnum for WAVE1 {}
338///Field `WAVE(1-2)` reader - DAC channel%s noise/triangle wave generation enable
339pub type WAVE_R = crate::FieldReader<WAVE1>;
340impl WAVE_R {
341    ///Get enumerated values variant
342    #[inline(always)]
343    pub const fn variant(&self) -> WAVE1 {
344        match self.bits {
345            0 => WAVE1::Disabled,
346            1 => WAVE1::Noise,
347            _ => WAVE1::Triangle,
348        }
349    }
350    ///Wave generation disabled
351    #[inline(always)]
352    pub fn is_disabled(&self) -> bool {
353        *self == WAVE1::Disabled
354    }
355    ///Noise wave generation enabled
356    #[inline(always)]
357    pub fn is_noise(&self) -> bool {
358        *self == WAVE1::Noise
359    }
360    ///Triangle wave generation enabled
361    #[inline(always)]
362    pub fn is_triangle(&self) -> bool {
363        matches!(self.variant(), WAVE1::Triangle)
364    }
365}
366///Field `WAVE(1-2)` writer - DAC channel%s noise/triangle wave generation enable
367pub type WAVE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, WAVE1, crate::Safe>;
368impl<'a, REG> WAVE_W<'a, REG>
369where
370    REG: crate::Writable + crate::RegisterSpec,
371    REG::Ux: From<u8>,
372{
373    ///Wave generation disabled
374    #[inline(always)]
375    pub fn disabled(self) -> &'a mut crate::W<REG> {
376        self.variant(WAVE1::Disabled)
377    }
378    ///Noise wave generation enabled
379    #[inline(always)]
380    pub fn noise(self) -> &'a mut crate::W<REG> {
381        self.variant(WAVE1::Noise)
382    }
383    ///Triangle wave generation enabled
384    #[inline(always)]
385    pub fn triangle(self) -> &'a mut crate::W<REG> {
386        self.variant(WAVE1::Triangle)
387    }
388}
389/**DAC channel%s mask/amplitude selector
390
391Value on reset: 0*/
392#[cfg_attr(feature = "defmt", derive(defmt::Format))]
393#[derive(Clone, Copy, Debug, PartialEq, Eq)]
394#[repr(u8)]
395pub enum MAMP1 {
396    ///0: Unmask bit0 of LFSR/ triangle amplitude equal to 1
397    Amp1 = 0,
398    ///1: Unmask bits\[1:0\] of LFSR/ triangle amplitude equal to 3
399    Amp3 = 1,
400    ///2: Unmask bits\[2:0\] of LFSR/ triangle amplitude equal to 7
401    Amp7 = 2,
402    ///3: Unmask bits\[3:0\] of LFSR/ triangle amplitude equal to 15
403    Amp15 = 3,
404    ///4: Unmask bits\[4:0\] of LFSR/ triangle amplitude equal to 31
405    Amp31 = 4,
406    ///5: Unmask bits\[5:0\] of LFSR/ triangle amplitude equal 63
407    Amp63 = 5,
408    ///6: Unmask bits\[6:0\] of LFSR/ triangle amplitude equal to 127
409    Amp127 = 6,
410    ///7: Unmask bits\[7:0\] of LFSR/ triangle amplitude equal to 255
411    Amp255 = 7,
412    ///8: Unmask bits\[8:0\] of LFSR/ triangle amplitude equal to 511
413    Amp511 = 8,
414    ///9: Unmask bits\[9:0\] of LFSR/ triangle amplitude equal to 1023
415    Amp1023 = 9,
416    ///10: Unmask bits\[10:0\] of LFSR/ triangle amplitude equal to 2047
417    Amp2047 = 10,
418    ///11: Unmask bits\[11:0\] of LFSR/ triangle amplitude equal to 4095
419    Amp4095 = 11,
420}
421impl From<MAMP1> for u8 {
422    #[inline(always)]
423    fn from(variant: MAMP1) -> Self {
424        variant as _
425    }
426}
427impl crate::FieldSpec for MAMP1 {
428    type Ux = u8;
429}
430impl crate::IsEnum for MAMP1 {}
431///Field `MAMP(1-2)` reader - DAC channel%s mask/amplitude selector
432pub type MAMP_R = crate::FieldReader<MAMP1>;
433impl MAMP_R {
434    ///Get enumerated values variant
435    #[inline(always)]
436    pub const fn variant(&self) -> MAMP1 {
437        match self.bits {
438            0 => MAMP1::Amp1,
439            1 => MAMP1::Amp3,
440            2 => MAMP1::Amp7,
441            3 => MAMP1::Amp15,
442            4 => MAMP1::Amp31,
443            5 => MAMP1::Amp63,
444            6 => MAMP1::Amp127,
445            7 => MAMP1::Amp255,
446            8 => MAMP1::Amp511,
447            9 => MAMP1::Amp1023,
448            10 => MAMP1::Amp2047,
449            _ => MAMP1::Amp4095,
450        }
451    }
452    ///Unmask bit0 of LFSR/ triangle amplitude equal to 1
453    #[inline(always)]
454    pub fn is_amp1(&self) -> bool {
455        *self == MAMP1::Amp1
456    }
457    ///Unmask bits\[1:0\] of LFSR/ triangle amplitude equal to 3
458    #[inline(always)]
459    pub fn is_amp3(&self) -> bool {
460        *self == MAMP1::Amp3
461    }
462    ///Unmask bits\[2:0\] of LFSR/ triangle amplitude equal to 7
463    #[inline(always)]
464    pub fn is_amp7(&self) -> bool {
465        *self == MAMP1::Amp7
466    }
467    ///Unmask bits\[3:0\] of LFSR/ triangle amplitude equal to 15
468    #[inline(always)]
469    pub fn is_amp15(&self) -> bool {
470        *self == MAMP1::Amp15
471    }
472    ///Unmask bits\[4:0\] of LFSR/ triangle amplitude equal to 31
473    #[inline(always)]
474    pub fn is_amp31(&self) -> bool {
475        *self == MAMP1::Amp31
476    }
477    ///Unmask bits\[5:0\] of LFSR/ triangle amplitude equal 63
478    #[inline(always)]
479    pub fn is_amp63(&self) -> bool {
480        *self == MAMP1::Amp63
481    }
482    ///Unmask bits\[6:0\] of LFSR/ triangle amplitude equal to 127
483    #[inline(always)]
484    pub fn is_amp127(&self) -> bool {
485        *self == MAMP1::Amp127
486    }
487    ///Unmask bits\[7:0\] of LFSR/ triangle amplitude equal to 255
488    #[inline(always)]
489    pub fn is_amp255(&self) -> bool {
490        *self == MAMP1::Amp255
491    }
492    ///Unmask bits\[8:0\] of LFSR/ triangle amplitude equal to 511
493    #[inline(always)]
494    pub fn is_amp511(&self) -> bool {
495        *self == MAMP1::Amp511
496    }
497    ///Unmask bits\[9:0\] of LFSR/ triangle amplitude equal to 1023
498    #[inline(always)]
499    pub fn is_amp1023(&self) -> bool {
500        *self == MAMP1::Amp1023
501    }
502    ///Unmask bits\[10:0\] of LFSR/ triangle amplitude equal to 2047
503    #[inline(always)]
504    pub fn is_amp2047(&self) -> bool {
505        *self == MAMP1::Amp2047
506    }
507    ///Unmask bits\[11:0\] of LFSR/ triangle amplitude equal to 4095
508    #[inline(always)]
509    pub fn is_amp4095(&self) -> bool {
510        matches!(self.variant(), MAMP1::Amp4095)
511    }
512}
513///Field `MAMP(1-2)` writer - DAC channel%s mask/amplitude selector
514pub type MAMP_W<'a, REG> = crate::FieldWriter<'a, REG, 4, MAMP1, crate::Safe>;
515impl<'a, REG> MAMP_W<'a, REG>
516where
517    REG: crate::Writable + crate::RegisterSpec,
518    REG::Ux: From<u8>,
519{
520    ///Unmask bit0 of LFSR/ triangle amplitude equal to 1
521    #[inline(always)]
522    pub fn amp1(self) -> &'a mut crate::W<REG> {
523        self.variant(MAMP1::Amp1)
524    }
525    ///Unmask bits\[1:0\] of LFSR/ triangle amplitude equal to 3
526    #[inline(always)]
527    pub fn amp3(self) -> &'a mut crate::W<REG> {
528        self.variant(MAMP1::Amp3)
529    }
530    ///Unmask bits\[2:0\] of LFSR/ triangle amplitude equal to 7
531    #[inline(always)]
532    pub fn amp7(self) -> &'a mut crate::W<REG> {
533        self.variant(MAMP1::Amp7)
534    }
535    ///Unmask bits\[3:0\] of LFSR/ triangle amplitude equal to 15
536    #[inline(always)]
537    pub fn amp15(self) -> &'a mut crate::W<REG> {
538        self.variant(MAMP1::Amp15)
539    }
540    ///Unmask bits\[4:0\] of LFSR/ triangle amplitude equal to 31
541    #[inline(always)]
542    pub fn amp31(self) -> &'a mut crate::W<REG> {
543        self.variant(MAMP1::Amp31)
544    }
545    ///Unmask bits\[5:0\] of LFSR/ triangle amplitude equal 63
546    #[inline(always)]
547    pub fn amp63(self) -> &'a mut crate::W<REG> {
548        self.variant(MAMP1::Amp63)
549    }
550    ///Unmask bits\[6:0\] of LFSR/ triangle amplitude equal to 127
551    #[inline(always)]
552    pub fn amp127(self) -> &'a mut crate::W<REG> {
553        self.variant(MAMP1::Amp127)
554    }
555    ///Unmask bits\[7:0\] of LFSR/ triangle amplitude equal to 255
556    #[inline(always)]
557    pub fn amp255(self) -> &'a mut crate::W<REG> {
558        self.variant(MAMP1::Amp255)
559    }
560    ///Unmask bits\[8:0\] of LFSR/ triangle amplitude equal to 511
561    #[inline(always)]
562    pub fn amp511(self) -> &'a mut crate::W<REG> {
563        self.variant(MAMP1::Amp511)
564    }
565    ///Unmask bits\[9:0\] of LFSR/ triangle amplitude equal to 1023
566    #[inline(always)]
567    pub fn amp1023(self) -> &'a mut crate::W<REG> {
568        self.variant(MAMP1::Amp1023)
569    }
570    ///Unmask bits\[10:0\] of LFSR/ triangle amplitude equal to 2047
571    #[inline(always)]
572    pub fn amp2047(self) -> &'a mut crate::W<REG> {
573        self.variant(MAMP1::Amp2047)
574    }
575    ///Unmask bits\[11:0\] of LFSR/ triangle amplitude equal to 4095
576    #[inline(always)]
577    pub fn amp4095(self) -> &'a mut crate::W<REG> {
578        self.variant(MAMP1::Amp4095)
579    }
580}
581/**DAC channel%s DMA enable
582
583Value on reset: 0*/
584#[cfg_attr(feature = "defmt", derive(defmt::Format))]
585#[derive(Clone, Copy, Debug, PartialEq, Eq)]
586pub enum DMAEN1 {
587    ///0: DAC channel X DMA mode disabled
588    Disabled = 0,
589    ///1: DAC channel X DMA mode enabled
590    Enabled = 1,
591}
592impl From<DMAEN1> for bool {
593    #[inline(always)]
594    fn from(variant: DMAEN1) -> Self {
595        variant as u8 != 0
596    }
597}
598///Field `DMAEN(1-2)` reader - DAC channel%s DMA enable
599pub type DMAEN_R = crate::BitReader<DMAEN1>;
600impl DMAEN_R {
601    ///Get enumerated values variant
602    #[inline(always)]
603    pub const fn variant(&self) -> DMAEN1 {
604        match self.bits {
605            false => DMAEN1::Disabled,
606            true => DMAEN1::Enabled,
607        }
608    }
609    ///DAC channel X DMA mode disabled
610    #[inline(always)]
611    pub fn is_disabled(&self) -> bool {
612        *self == DMAEN1::Disabled
613    }
614    ///DAC channel X DMA mode enabled
615    #[inline(always)]
616    pub fn is_enabled(&self) -> bool {
617        *self == DMAEN1::Enabled
618    }
619}
620///Field `DMAEN(1-2)` writer - DAC channel%s DMA enable
621pub type DMAEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAEN1>;
622impl<'a, REG> DMAEN_W<'a, REG>
623where
624    REG: crate::Writable + crate::RegisterSpec,
625{
626    ///DAC channel X DMA mode disabled
627    #[inline(always)]
628    pub fn disabled(self) -> &'a mut crate::W<REG> {
629        self.variant(DMAEN1::Disabled)
630    }
631    ///DAC channel X DMA mode enabled
632    #[inline(always)]
633    pub fn enabled(self) -> &'a mut crate::W<REG> {
634        self.variant(DMAEN1::Enabled)
635    }
636}
637/**DAC channel%s DMA Underrun Interrupt enable
638
639Value on reset: 0*/
640#[cfg_attr(feature = "defmt", derive(defmt::Format))]
641#[derive(Clone, Copy, Debug, PartialEq, Eq)]
642pub enum DMAUDRIE1 {
643    ///0: DAC channel X DMA Underrun Interrupt disabled
644    Disabled = 0,
645    ///1: DAC channel X DMA Underrun Interrupt enabled
646    Enabled = 1,
647}
648impl From<DMAUDRIE1> for bool {
649    #[inline(always)]
650    fn from(variant: DMAUDRIE1) -> Self {
651        variant as u8 != 0
652    }
653}
654///Field `DMAUDRIE(1-2)` reader - DAC channel%s DMA Underrun Interrupt enable
655pub type DMAUDRIE_R = crate::BitReader<DMAUDRIE1>;
656impl DMAUDRIE_R {
657    ///Get enumerated values variant
658    #[inline(always)]
659    pub const fn variant(&self) -> DMAUDRIE1 {
660        match self.bits {
661            false => DMAUDRIE1::Disabled,
662            true => DMAUDRIE1::Enabled,
663        }
664    }
665    ///DAC channel X DMA Underrun Interrupt disabled
666    #[inline(always)]
667    pub fn is_disabled(&self) -> bool {
668        *self == DMAUDRIE1::Disabled
669    }
670    ///DAC channel X DMA Underrun Interrupt enabled
671    #[inline(always)]
672    pub fn is_enabled(&self) -> bool {
673        *self == DMAUDRIE1::Enabled
674    }
675}
676///Field `DMAUDRIE(1-2)` writer - DAC channel%s DMA Underrun Interrupt enable
677pub type DMAUDRIE_W<'a, REG> = crate::BitWriter<'a, REG, DMAUDRIE1>;
678impl<'a, REG> DMAUDRIE_W<'a, REG>
679where
680    REG: crate::Writable + crate::RegisterSpec,
681{
682    ///DAC channel X DMA Underrun Interrupt disabled
683    #[inline(always)]
684    pub fn disabled(self) -> &'a mut crate::W<REG> {
685        self.variant(DMAUDRIE1::Disabled)
686    }
687    ///DAC channel X DMA Underrun Interrupt enabled
688    #[inline(always)]
689    pub fn enabled(self) -> &'a mut crate::W<REG> {
690        self.variant(DMAUDRIE1::Enabled)
691    }
692}
693///Field `TSEL2` reader - DAC channel2 trigger selection
694pub use TSEL1_R as TSEL2_R;
695///Field `TSEL2` writer - DAC channel2 trigger selection
696pub use TSEL1_W as TSEL2_W;
697impl R {
698    ///DAC channel(1-2) enable
699    ///
700    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EN1` field.</div>
701    #[inline(always)]
702    pub fn en(&self, n: u8) -> EN_R {
703        #[allow(clippy::no_effect)]
704        [(); 2][n as usize];
705        EN_R::new(((self.bits >> (n * 16)) & 1) != 0)
706    }
707    ///Iterator for array of:
708    ///DAC channel(1-2) enable
709    #[inline(always)]
710    pub fn en_iter(&self) -> impl Iterator<Item = EN_R> + '_ {
711        (0..2).map(move |n| EN_R::new(((self.bits >> (n * 16)) & 1) != 0))
712    }
713    ///Bit 0 - DAC channel1 enable
714    #[inline(always)]
715    pub fn en1(&self) -> EN_R {
716        EN_R::new((self.bits & 1) != 0)
717    }
718    ///Bit 16 - DAC channel2 enable
719    #[inline(always)]
720    pub fn en2(&self) -> EN_R {
721        EN_R::new(((self.bits >> 16) & 1) != 0)
722    }
723    ///DAC channel(1-2) output buffer disable
724    ///
725    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `BOFF1` field.</div>
726    #[inline(always)]
727    pub fn boff(&self, n: u8) -> BOFF_R {
728        #[allow(clippy::no_effect)]
729        [(); 2][n as usize];
730        BOFF_R::new(((self.bits >> (n * 16 + 1)) & 1) != 0)
731    }
732    ///Iterator for array of:
733    ///DAC channel(1-2) output buffer disable
734    #[inline(always)]
735    pub fn boff_iter(&self) -> impl Iterator<Item = BOFF_R> + '_ {
736        (0..2).map(move |n| BOFF_R::new(((self.bits >> (n * 16 + 1)) & 1) != 0))
737    }
738    ///Bit 1 - DAC channel1 output buffer disable
739    #[inline(always)]
740    pub fn boff1(&self) -> BOFF_R {
741        BOFF_R::new(((self.bits >> 1) & 1) != 0)
742    }
743    ///Bit 17 - DAC channel2 output buffer disable
744    #[inline(always)]
745    pub fn boff2(&self) -> BOFF_R {
746        BOFF_R::new(((self.bits >> 17) & 1) != 0)
747    }
748    ///DAC channel(1-2) trigger enable
749    ///
750    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TEN1` field.</div>
751    #[inline(always)]
752    pub fn ten(&self, n: u8) -> TEN_R {
753        #[allow(clippy::no_effect)]
754        [(); 2][n as usize];
755        TEN_R::new(((self.bits >> (n * 16 + 2)) & 1) != 0)
756    }
757    ///Iterator for array of:
758    ///DAC channel(1-2) trigger enable
759    #[inline(always)]
760    pub fn ten_iter(&self) -> impl Iterator<Item = TEN_R> + '_ {
761        (0..2).map(move |n| TEN_R::new(((self.bits >> (n * 16 + 2)) & 1) != 0))
762    }
763    ///Bit 2 - DAC channel1 trigger enable
764    #[inline(always)]
765    pub fn ten1(&self) -> TEN_R {
766        TEN_R::new(((self.bits >> 2) & 1) != 0)
767    }
768    ///Bit 18 - DAC channel2 trigger enable
769    #[inline(always)]
770    pub fn ten2(&self) -> TEN_R {
771        TEN_R::new(((self.bits >> 18) & 1) != 0)
772    }
773    ///Bits 3:5 - DAC channel1 trigger selection
774    #[inline(always)]
775    pub fn tsel1(&self) -> TSEL1_R {
776        TSEL1_R::new(((self.bits >> 3) & 7) as u8)
777    }
778    ///DAC channel(1-2) noise/triangle wave generation enable
779    ///
780    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `WAVE1` field.</div>
781    #[inline(always)]
782    pub fn wave(&self, n: u8) -> WAVE_R {
783        #[allow(clippy::no_effect)]
784        [(); 2][n as usize];
785        WAVE_R::new(((self.bits >> (n * 16 + 6)) & 3) as u8)
786    }
787    ///Iterator for array of:
788    ///DAC channel(1-2) noise/triangle wave generation enable
789    #[inline(always)]
790    pub fn wave_iter(&self) -> impl Iterator<Item = WAVE_R> + '_ {
791        (0..2).map(move |n| WAVE_R::new(((self.bits >> (n * 16 + 6)) & 3) as u8))
792    }
793    ///Bits 6:7 - DAC channel1 noise/triangle wave generation enable
794    #[inline(always)]
795    pub fn wave1(&self) -> WAVE_R {
796        WAVE_R::new(((self.bits >> 6) & 3) as u8)
797    }
798    ///Bits 22:23 - DAC channel2 noise/triangle wave generation enable
799    #[inline(always)]
800    pub fn wave2(&self) -> WAVE_R {
801        WAVE_R::new(((self.bits >> 22) & 3) as u8)
802    }
803    ///DAC channel(1-2) mask/amplitude selector
804    ///
805    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `MAMP1` field.</div>
806    #[inline(always)]
807    pub fn mamp(&self, n: u8) -> MAMP_R {
808        #[allow(clippy::no_effect)]
809        [(); 2][n as usize];
810        MAMP_R::new(((self.bits >> (n * 16 + 8)) & 0x0f) as u8)
811    }
812    ///Iterator for array of:
813    ///DAC channel(1-2) mask/amplitude selector
814    #[inline(always)]
815    pub fn mamp_iter(&self) -> impl Iterator<Item = MAMP_R> + '_ {
816        (0..2).map(move |n| MAMP_R::new(((self.bits >> (n * 16 + 8)) & 0x0f) as u8))
817    }
818    ///Bits 8:11 - DAC channel1 mask/amplitude selector
819    #[inline(always)]
820    pub fn mamp1(&self) -> MAMP_R {
821        MAMP_R::new(((self.bits >> 8) & 0x0f) as u8)
822    }
823    ///Bits 24:27 - DAC channel2 mask/amplitude selector
824    #[inline(always)]
825    pub fn mamp2(&self) -> MAMP_R {
826        MAMP_R::new(((self.bits >> 24) & 0x0f) as u8)
827    }
828    ///DAC channel(1-2) DMA enable
829    ///
830    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAEN1` field.</div>
831    #[inline(always)]
832    pub fn dmaen(&self, n: u8) -> DMAEN_R {
833        #[allow(clippy::no_effect)]
834        [(); 2][n as usize];
835        DMAEN_R::new(((self.bits >> (n * 16 + 12)) & 1) != 0)
836    }
837    ///Iterator for array of:
838    ///DAC channel(1-2) DMA enable
839    #[inline(always)]
840    pub fn dmaen_iter(&self) -> impl Iterator<Item = DMAEN_R> + '_ {
841        (0..2).map(move |n| DMAEN_R::new(((self.bits >> (n * 16 + 12)) & 1) != 0))
842    }
843    ///Bit 12 - DAC channel1 DMA enable
844    #[inline(always)]
845    pub fn dmaen1(&self) -> DMAEN_R {
846        DMAEN_R::new(((self.bits >> 12) & 1) != 0)
847    }
848    ///Bit 28 - DAC channel2 DMA enable
849    #[inline(always)]
850    pub fn dmaen2(&self) -> DMAEN_R {
851        DMAEN_R::new(((self.bits >> 28) & 1) != 0)
852    }
853    ///DAC channel(1-2) DMA Underrun Interrupt enable
854    ///
855    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAUDRIE1` field.</div>
856    #[inline(always)]
857    pub fn dmaudrie(&self, n: u8) -> DMAUDRIE_R {
858        #[allow(clippy::no_effect)]
859        [(); 2][n as usize];
860        DMAUDRIE_R::new(((self.bits >> (n * 16 + 13)) & 1) != 0)
861    }
862    ///Iterator for array of:
863    ///DAC channel(1-2) DMA Underrun Interrupt enable
864    #[inline(always)]
865    pub fn dmaudrie_iter(&self) -> impl Iterator<Item = DMAUDRIE_R> + '_ {
866        (0..2).map(move |n| DMAUDRIE_R::new(((self.bits >> (n * 16 + 13)) & 1) != 0))
867    }
868    ///Bit 13 - DAC channel1 DMA Underrun Interrupt enable
869    #[inline(always)]
870    pub fn dmaudrie1(&self) -> DMAUDRIE_R {
871        DMAUDRIE_R::new(((self.bits >> 13) & 1) != 0)
872    }
873    ///Bit 29 - DAC channel2 DMA Underrun Interrupt enable
874    #[inline(always)]
875    pub fn dmaudrie2(&self) -> DMAUDRIE_R {
876        DMAUDRIE_R::new(((self.bits >> 29) & 1) != 0)
877    }
878    ///Bits 19:21 - DAC channel2 trigger selection
879    #[inline(always)]
880    pub fn tsel2(&self) -> TSEL2_R {
881        TSEL2_R::new(((self.bits >> 19) & 7) as u8)
882    }
883}
884impl core::fmt::Debug for R {
885    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
886        f.debug_struct("CR")
887            .field("dmaudrie1", &self.dmaudrie1())
888            .field("dmaudrie2", &self.dmaudrie2())
889            .field("dmaen1", &self.dmaen1())
890            .field("dmaen2", &self.dmaen2())
891            .field("mamp1", &self.mamp1())
892            .field("mamp2", &self.mamp2())
893            .field("wave1", &self.wave1())
894            .field("wave2", &self.wave2())
895            .field("tsel1", &self.tsel1())
896            .field("tsel2", &self.tsel2())
897            .field("ten1", &self.ten1())
898            .field("ten2", &self.ten2())
899            .field("boff1", &self.boff1())
900            .field("boff2", &self.boff2())
901            .field("en1", &self.en1())
902            .field("en2", &self.en2())
903            .finish()
904    }
905}
906impl W {
907    ///DAC channel(1-2) enable
908    ///
909    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EN1` field.</div>
910    #[inline(always)]
911    pub fn en(&mut self, n: u8) -> EN_W<CRrs> {
912        #[allow(clippy::no_effect)]
913        [(); 2][n as usize];
914        EN_W::new(self, n * 16)
915    }
916    ///Bit 0 - DAC channel1 enable
917    #[inline(always)]
918    pub fn en1(&mut self) -> EN_W<CRrs> {
919        EN_W::new(self, 0)
920    }
921    ///Bit 16 - DAC channel2 enable
922    #[inline(always)]
923    pub fn en2(&mut self) -> EN_W<CRrs> {
924        EN_W::new(self, 16)
925    }
926    ///DAC channel(1-2) output buffer disable
927    ///
928    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `BOFF1` field.</div>
929    #[inline(always)]
930    pub fn boff(&mut self, n: u8) -> BOFF_W<CRrs> {
931        #[allow(clippy::no_effect)]
932        [(); 2][n as usize];
933        BOFF_W::new(self, n * 16 + 1)
934    }
935    ///Bit 1 - DAC channel1 output buffer disable
936    #[inline(always)]
937    pub fn boff1(&mut self) -> BOFF_W<CRrs> {
938        BOFF_W::new(self, 1)
939    }
940    ///Bit 17 - DAC channel2 output buffer disable
941    #[inline(always)]
942    pub fn boff2(&mut self) -> BOFF_W<CRrs> {
943        BOFF_W::new(self, 17)
944    }
945    ///DAC channel(1-2) trigger enable
946    ///
947    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TEN1` field.</div>
948    #[inline(always)]
949    pub fn ten(&mut self, n: u8) -> TEN_W<CRrs> {
950        #[allow(clippy::no_effect)]
951        [(); 2][n as usize];
952        TEN_W::new(self, n * 16 + 2)
953    }
954    ///Bit 2 - DAC channel1 trigger enable
955    #[inline(always)]
956    pub fn ten1(&mut self) -> TEN_W<CRrs> {
957        TEN_W::new(self, 2)
958    }
959    ///Bit 18 - DAC channel2 trigger enable
960    #[inline(always)]
961    pub fn ten2(&mut self) -> TEN_W<CRrs> {
962        TEN_W::new(self, 18)
963    }
964    ///Bits 3:5 - DAC channel1 trigger selection
965    #[inline(always)]
966    pub fn tsel1(&mut self) -> TSEL1_W<CRrs> {
967        TSEL1_W::new(self, 3)
968    }
969    ///DAC channel(1-2) noise/triangle wave generation enable
970    ///
971    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `WAVE1` field.</div>
972    #[inline(always)]
973    pub fn wave(&mut self, n: u8) -> WAVE_W<CRrs> {
974        #[allow(clippy::no_effect)]
975        [(); 2][n as usize];
976        WAVE_W::new(self, n * 16 + 6)
977    }
978    ///Bits 6:7 - DAC channel1 noise/triangle wave generation enable
979    #[inline(always)]
980    pub fn wave1(&mut self) -> WAVE_W<CRrs> {
981        WAVE_W::new(self, 6)
982    }
983    ///Bits 22:23 - DAC channel2 noise/triangle wave generation enable
984    #[inline(always)]
985    pub fn wave2(&mut self) -> WAVE_W<CRrs> {
986        WAVE_W::new(self, 22)
987    }
988    ///DAC channel(1-2) mask/amplitude selector
989    ///
990    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `MAMP1` field.</div>
991    #[inline(always)]
992    pub fn mamp(&mut self, n: u8) -> MAMP_W<CRrs> {
993        #[allow(clippy::no_effect)]
994        [(); 2][n as usize];
995        MAMP_W::new(self, n * 16 + 8)
996    }
997    ///Bits 8:11 - DAC channel1 mask/amplitude selector
998    #[inline(always)]
999    pub fn mamp1(&mut self) -> MAMP_W<CRrs> {
1000        MAMP_W::new(self, 8)
1001    }
1002    ///Bits 24:27 - DAC channel2 mask/amplitude selector
1003    #[inline(always)]
1004    pub fn mamp2(&mut self) -> MAMP_W<CRrs> {
1005        MAMP_W::new(self, 24)
1006    }
1007    ///DAC channel(1-2) DMA enable
1008    ///
1009    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAEN1` field.</div>
1010    #[inline(always)]
1011    pub fn dmaen(&mut self, n: u8) -> DMAEN_W<CRrs> {
1012        #[allow(clippy::no_effect)]
1013        [(); 2][n as usize];
1014        DMAEN_W::new(self, n * 16 + 12)
1015    }
1016    ///Bit 12 - DAC channel1 DMA enable
1017    #[inline(always)]
1018    pub fn dmaen1(&mut self) -> DMAEN_W<CRrs> {
1019        DMAEN_W::new(self, 12)
1020    }
1021    ///Bit 28 - DAC channel2 DMA enable
1022    #[inline(always)]
1023    pub fn dmaen2(&mut self) -> DMAEN_W<CRrs> {
1024        DMAEN_W::new(self, 28)
1025    }
1026    ///DAC channel(1-2) DMA Underrun Interrupt enable
1027    ///
1028    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `DMAUDRIE1` field.</div>
1029    #[inline(always)]
1030    pub fn dmaudrie(&mut self, n: u8) -> DMAUDRIE_W<CRrs> {
1031        #[allow(clippy::no_effect)]
1032        [(); 2][n as usize];
1033        DMAUDRIE_W::new(self, n * 16 + 13)
1034    }
1035    ///Bit 13 - DAC channel1 DMA Underrun Interrupt enable
1036    #[inline(always)]
1037    pub fn dmaudrie1(&mut self) -> DMAUDRIE_W<CRrs> {
1038        DMAUDRIE_W::new(self, 13)
1039    }
1040    ///Bit 29 - DAC channel2 DMA Underrun Interrupt enable
1041    #[inline(always)]
1042    pub fn dmaudrie2(&mut self) -> DMAUDRIE_W<CRrs> {
1043        DMAUDRIE_W::new(self, 29)
1044    }
1045    ///Bits 19:21 - DAC channel2 trigger selection
1046    #[inline(always)]
1047    pub fn tsel2(&mut self) -> TSEL2_W<CRrs> {
1048        TSEL2_W::new(self, 19)
1049    }
1050}
1051/**control register
1052
1053You 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).
1054
1055See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F407.html#DAC:CR)*/
1056pub struct CRrs;
1057impl crate::RegisterSpec for CRrs {
1058    type Ux = u32;
1059}
1060///`read()` method returns [`cr::R`](R) reader structure
1061impl crate::Readable for CRrs {}
1062///`write(|w| ..)` method takes [`cr::W`](W) writer structure
1063impl crate::Writable for CRrs {
1064    type Safety = crate::Unsafe;
1065}
1066///`reset()` method sets CR to value 0
1067impl crate::Resettable for CRrs {}