stm32f4/stm32f413/adc1/
cr1.rs

1#[doc = "Register `CR1` reader"]
2pub struct R(crate::R<CR1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CR1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CR1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CR1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CR1` writer"]
17pub struct W(crate::W<CR1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CR1_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CR1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CR1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Overrun interrupt enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum OVRIE_A {
40    #[doc = "0: Overrun interrupt disabled"]
41    Disabled = 0,
42    #[doc = "1: Overrun interrupt enabled"]
43    Enabled = 1,
44}
45impl From<OVRIE_A> for bool {
46    #[inline(always)]
47    fn from(variant: OVRIE_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `OVRIE` reader - Overrun interrupt enable"]
52pub type OVRIE_R = crate::BitReader<OVRIE_A>;
53impl OVRIE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> OVRIE_A {
57        match self.bits {
58            false => OVRIE_A::Disabled,
59            true => OVRIE_A::Enabled,
60        }
61    }
62    #[doc = "Checks if the value of the field is `Disabled`"]
63    #[inline(always)]
64    pub fn is_disabled(&self) -> bool {
65        *self == OVRIE_A::Disabled
66    }
67    #[doc = "Checks if the value of the field is `Enabled`"]
68    #[inline(always)]
69    pub fn is_enabled(&self) -> bool {
70        *self == OVRIE_A::Enabled
71    }
72}
73#[doc = "Field `OVRIE` writer - Overrun interrupt enable"]
74pub type OVRIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, OVRIE_A, O>;
75impl<'a, const O: u8> OVRIE_W<'a, O> {
76    #[doc = "Overrun interrupt disabled"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(OVRIE_A::Disabled)
80    }
81    #[doc = "Overrun interrupt enabled"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(OVRIE_A::Enabled)
85    }
86}
87#[doc = "Resolution\n\nValue on reset: 0"]
88#[derive(Clone, Copy, Debug, PartialEq)]
89#[repr(u8)]
90pub enum RES_A {
91    #[doc = "0: 12-bit (15 ADCCLK cycles)"]
92    TwelveBit = 0,
93    #[doc = "1: 10-bit (13 ADCCLK cycles)"]
94    TenBit = 1,
95    #[doc = "2: 8-bit (11 ADCCLK cycles)"]
96    EightBit = 2,
97    #[doc = "3: 6-bit (9 ADCCLK cycles)"]
98    SixBit = 3,
99}
100impl From<RES_A> for u8 {
101    #[inline(always)]
102    fn from(variant: RES_A) -> Self {
103        variant as _
104    }
105}
106#[doc = "Field `RES` reader - Resolution"]
107pub type RES_R = crate::FieldReader<u8, RES_A>;
108impl RES_R {
109    #[doc = "Get enumerated values variant"]
110    #[inline(always)]
111    pub fn variant(&self) -> RES_A {
112        match self.bits {
113            0 => RES_A::TwelveBit,
114            1 => RES_A::TenBit,
115            2 => RES_A::EightBit,
116            3 => RES_A::SixBit,
117            _ => unreachable!(),
118        }
119    }
120    #[doc = "Checks if the value of the field is `TwelveBit`"]
121    #[inline(always)]
122    pub fn is_twelve_bit(&self) -> bool {
123        *self == RES_A::TwelveBit
124    }
125    #[doc = "Checks if the value of the field is `TenBit`"]
126    #[inline(always)]
127    pub fn is_ten_bit(&self) -> bool {
128        *self == RES_A::TenBit
129    }
130    #[doc = "Checks if the value of the field is `EightBit`"]
131    #[inline(always)]
132    pub fn is_eight_bit(&self) -> bool {
133        *self == RES_A::EightBit
134    }
135    #[doc = "Checks if the value of the field is `SixBit`"]
136    #[inline(always)]
137    pub fn is_six_bit(&self) -> bool {
138        *self == RES_A::SixBit
139    }
140}
141#[doc = "Field `RES` writer - Resolution"]
142pub type RES_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CR1_SPEC, u8, RES_A, 2, O>;
143impl<'a, const O: u8> RES_W<'a, O> {
144    #[doc = "12-bit (15 ADCCLK cycles)"]
145    #[inline(always)]
146    pub fn twelve_bit(self) -> &'a mut W {
147        self.variant(RES_A::TwelveBit)
148    }
149    #[doc = "10-bit (13 ADCCLK cycles)"]
150    #[inline(always)]
151    pub fn ten_bit(self) -> &'a mut W {
152        self.variant(RES_A::TenBit)
153    }
154    #[doc = "8-bit (11 ADCCLK cycles)"]
155    #[inline(always)]
156    pub fn eight_bit(self) -> &'a mut W {
157        self.variant(RES_A::EightBit)
158    }
159    #[doc = "6-bit (9 ADCCLK cycles)"]
160    #[inline(always)]
161    pub fn six_bit(self) -> &'a mut W {
162        self.variant(RES_A::SixBit)
163    }
164}
165#[doc = "Analog watchdog enable on regular channels\n\nValue on reset: 0"]
166#[derive(Clone, Copy, Debug, PartialEq)]
167pub enum AWDEN_A {
168    #[doc = "0: Analog watchdog disabled on regular channels"]
169    Disabled = 0,
170    #[doc = "1: Analog watchdog enabled on regular channels"]
171    Enabled = 1,
172}
173impl From<AWDEN_A> for bool {
174    #[inline(always)]
175    fn from(variant: AWDEN_A) -> Self {
176        variant as u8 != 0
177    }
178}
179#[doc = "Field `AWDEN` reader - Analog watchdog enable on regular channels"]
180pub type AWDEN_R = crate::BitReader<AWDEN_A>;
181impl AWDEN_R {
182    #[doc = "Get enumerated values variant"]
183    #[inline(always)]
184    pub fn variant(&self) -> AWDEN_A {
185        match self.bits {
186            false => AWDEN_A::Disabled,
187            true => AWDEN_A::Enabled,
188        }
189    }
190    #[doc = "Checks if the value of the field is `Disabled`"]
191    #[inline(always)]
192    pub fn is_disabled(&self) -> bool {
193        *self == AWDEN_A::Disabled
194    }
195    #[doc = "Checks if the value of the field is `Enabled`"]
196    #[inline(always)]
197    pub fn is_enabled(&self) -> bool {
198        *self == AWDEN_A::Enabled
199    }
200}
201#[doc = "Field `AWDEN` writer - Analog watchdog enable on regular channels"]
202pub type AWDEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, AWDEN_A, O>;
203impl<'a, const O: u8> AWDEN_W<'a, O> {
204    #[doc = "Analog watchdog disabled on regular channels"]
205    #[inline(always)]
206    pub fn disabled(self) -> &'a mut W {
207        self.variant(AWDEN_A::Disabled)
208    }
209    #[doc = "Analog watchdog enabled on regular channels"]
210    #[inline(always)]
211    pub fn enabled(self) -> &'a mut W {
212        self.variant(AWDEN_A::Enabled)
213    }
214}
215#[doc = "Analog watchdog enable on injected channels\n\nValue on reset: 0"]
216#[derive(Clone, Copy, Debug, PartialEq)]
217pub enum JAWDEN_A {
218    #[doc = "0: Analog watchdog disabled on injected channels"]
219    Disabled = 0,
220    #[doc = "1: Analog watchdog enabled on injected channels"]
221    Enabled = 1,
222}
223impl From<JAWDEN_A> for bool {
224    #[inline(always)]
225    fn from(variant: JAWDEN_A) -> Self {
226        variant as u8 != 0
227    }
228}
229#[doc = "Field `JAWDEN` reader - Analog watchdog enable on injected channels"]
230pub type JAWDEN_R = crate::BitReader<JAWDEN_A>;
231impl JAWDEN_R {
232    #[doc = "Get enumerated values variant"]
233    #[inline(always)]
234    pub fn variant(&self) -> JAWDEN_A {
235        match self.bits {
236            false => JAWDEN_A::Disabled,
237            true => JAWDEN_A::Enabled,
238        }
239    }
240    #[doc = "Checks if the value of the field is `Disabled`"]
241    #[inline(always)]
242    pub fn is_disabled(&self) -> bool {
243        *self == JAWDEN_A::Disabled
244    }
245    #[doc = "Checks if the value of the field is `Enabled`"]
246    #[inline(always)]
247    pub fn is_enabled(&self) -> bool {
248        *self == JAWDEN_A::Enabled
249    }
250}
251#[doc = "Field `JAWDEN` writer - Analog watchdog enable on injected channels"]
252pub type JAWDEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, JAWDEN_A, O>;
253impl<'a, const O: u8> JAWDEN_W<'a, O> {
254    #[doc = "Analog watchdog disabled on injected channels"]
255    #[inline(always)]
256    pub fn disabled(self) -> &'a mut W {
257        self.variant(JAWDEN_A::Disabled)
258    }
259    #[doc = "Analog watchdog enabled on injected channels"]
260    #[inline(always)]
261    pub fn enabled(self) -> &'a mut W {
262        self.variant(JAWDEN_A::Enabled)
263    }
264}
265#[doc = "Field `DISCNUM` reader - Discontinuous mode channel count"]
266pub type DISCNUM_R = crate::FieldReader<u8, u8>;
267#[doc = "Field `DISCNUM` writer - Discontinuous mode channel count"]
268pub type DISCNUM_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CR1_SPEC, u8, u8, 3, O>;
269#[doc = "Discontinuous mode on injected channels\n\nValue on reset: 0"]
270#[derive(Clone, Copy, Debug, PartialEq)]
271pub enum JDISCEN_A {
272    #[doc = "0: Discontinuous mode on injected channels disabled"]
273    Disabled = 0,
274    #[doc = "1: Discontinuous mode on injected channels enabled"]
275    Enabled = 1,
276}
277impl From<JDISCEN_A> for bool {
278    #[inline(always)]
279    fn from(variant: JDISCEN_A) -> Self {
280        variant as u8 != 0
281    }
282}
283#[doc = "Field `JDISCEN` reader - Discontinuous mode on injected channels"]
284pub type JDISCEN_R = crate::BitReader<JDISCEN_A>;
285impl JDISCEN_R {
286    #[doc = "Get enumerated values variant"]
287    #[inline(always)]
288    pub fn variant(&self) -> JDISCEN_A {
289        match self.bits {
290            false => JDISCEN_A::Disabled,
291            true => JDISCEN_A::Enabled,
292        }
293    }
294    #[doc = "Checks if the value of the field is `Disabled`"]
295    #[inline(always)]
296    pub fn is_disabled(&self) -> bool {
297        *self == JDISCEN_A::Disabled
298    }
299    #[doc = "Checks if the value of the field is `Enabled`"]
300    #[inline(always)]
301    pub fn is_enabled(&self) -> bool {
302        *self == JDISCEN_A::Enabled
303    }
304}
305#[doc = "Field `JDISCEN` writer - Discontinuous mode on injected channels"]
306pub type JDISCEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, JDISCEN_A, O>;
307impl<'a, const O: u8> JDISCEN_W<'a, O> {
308    #[doc = "Discontinuous mode on injected channels disabled"]
309    #[inline(always)]
310    pub fn disabled(self) -> &'a mut W {
311        self.variant(JDISCEN_A::Disabled)
312    }
313    #[doc = "Discontinuous mode on injected channels enabled"]
314    #[inline(always)]
315    pub fn enabled(self) -> &'a mut W {
316        self.variant(JDISCEN_A::Enabled)
317    }
318}
319#[doc = "Discontinuous mode on regular channels\n\nValue on reset: 0"]
320#[derive(Clone, Copy, Debug, PartialEq)]
321pub enum DISCEN_A {
322    #[doc = "0: Discontinuous mode on regular channels disabled"]
323    Disabled = 0,
324    #[doc = "1: Discontinuous mode on regular channels enabled"]
325    Enabled = 1,
326}
327impl From<DISCEN_A> for bool {
328    #[inline(always)]
329    fn from(variant: DISCEN_A) -> Self {
330        variant as u8 != 0
331    }
332}
333#[doc = "Field `DISCEN` reader - Discontinuous mode on regular channels"]
334pub type DISCEN_R = crate::BitReader<DISCEN_A>;
335impl DISCEN_R {
336    #[doc = "Get enumerated values variant"]
337    #[inline(always)]
338    pub fn variant(&self) -> DISCEN_A {
339        match self.bits {
340            false => DISCEN_A::Disabled,
341            true => DISCEN_A::Enabled,
342        }
343    }
344    #[doc = "Checks if the value of the field is `Disabled`"]
345    #[inline(always)]
346    pub fn is_disabled(&self) -> bool {
347        *self == DISCEN_A::Disabled
348    }
349    #[doc = "Checks if the value of the field is `Enabled`"]
350    #[inline(always)]
351    pub fn is_enabled(&self) -> bool {
352        *self == DISCEN_A::Enabled
353    }
354}
355#[doc = "Field `DISCEN` writer - Discontinuous mode on regular channels"]
356pub type DISCEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, DISCEN_A, O>;
357impl<'a, const O: u8> DISCEN_W<'a, O> {
358    #[doc = "Discontinuous mode on regular channels disabled"]
359    #[inline(always)]
360    pub fn disabled(self) -> &'a mut W {
361        self.variant(DISCEN_A::Disabled)
362    }
363    #[doc = "Discontinuous mode on regular channels enabled"]
364    #[inline(always)]
365    pub fn enabled(self) -> &'a mut W {
366        self.variant(DISCEN_A::Enabled)
367    }
368}
369#[doc = "Automatic injected group conversion\n\nValue on reset: 0"]
370#[derive(Clone, Copy, Debug, PartialEq)]
371pub enum JAUTO_A {
372    #[doc = "0: Automatic injected group conversion disabled"]
373    Disabled = 0,
374    #[doc = "1: Automatic injected group conversion enabled"]
375    Enabled = 1,
376}
377impl From<JAUTO_A> for bool {
378    #[inline(always)]
379    fn from(variant: JAUTO_A) -> Self {
380        variant as u8 != 0
381    }
382}
383#[doc = "Field `JAUTO` reader - Automatic injected group conversion"]
384pub type JAUTO_R = crate::BitReader<JAUTO_A>;
385impl JAUTO_R {
386    #[doc = "Get enumerated values variant"]
387    #[inline(always)]
388    pub fn variant(&self) -> JAUTO_A {
389        match self.bits {
390            false => JAUTO_A::Disabled,
391            true => JAUTO_A::Enabled,
392        }
393    }
394    #[doc = "Checks if the value of the field is `Disabled`"]
395    #[inline(always)]
396    pub fn is_disabled(&self) -> bool {
397        *self == JAUTO_A::Disabled
398    }
399    #[doc = "Checks if the value of the field is `Enabled`"]
400    #[inline(always)]
401    pub fn is_enabled(&self) -> bool {
402        *self == JAUTO_A::Enabled
403    }
404}
405#[doc = "Field `JAUTO` writer - Automatic injected group conversion"]
406pub type JAUTO_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, JAUTO_A, O>;
407impl<'a, const O: u8> JAUTO_W<'a, O> {
408    #[doc = "Automatic injected group conversion disabled"]
409    #[inline(always)]
410    pub fn disabled(self) -> &'a mut W {
411        self.variant(JAUTO_A::Disabled)
412    }
413    #[doc = "Automatic injected group conversion enabled"]
414    #[inline(always)]
415    pub fn enabled(self) -> &'a mut W {
416        self.variant(JAUTO_A::Enabled)
417    }
418}
419#[doc = "Enable the watchdog on a single channel in scan mode\n\nValue on reset: 0"]
420#[derive(Clone, Copy, Debug, PartialEq)]
421pub enum AWDSGL_A {
422    #[doc = "0: Analog watchdog enabled on all channels"]
423    AllChannels = 0,
424    #[doc = "1: Analog watchdog enabled on a single channel"]
425    SingleChannel = 1,
426}
427impl From<AWDSGL_A> for bool {
428    #[inline(always)]
429    fn from(variant: AWDSGL_A) -> Self {
430        variant as u8 != 0
431    }
432}
433#[doc = "Field `AWDSGL` reader - Enable the watchdog on a single channel in scan mode"]
434pub type AWDSGL_R = crate::BitReader<AWDSGL_A>;
435impl AWDSGL_R {
436    #[doc = "Get enumerated values variant"]
437    #[inline(always)]
438    pub fn variant(&self) -> AWDSGL_A {
439        match self.bits {
440            false => AWDSGL_A::AllChannels,
441            true => AWDSGL_A::SingleChannel,
442        }
443    }
444    #[doc = "Checks if the value of the field is `AllChannels`"]
445    #[inline(always)]
446    pub fn is_all_channels(&self) -> bool {
447        *self == AWDSGL_A::AllChannels
448    }
449    #[doc = "Checks if the value of the field is `SingleChannel`"]
450    #[inline(always)]
451    pub fn is_single_channel(&self) -> bool {
452        *self == AWDSGL_A::SingleChannel
453    }
454}
455#[doc = "Field `AWDSGL` writer - Enable the watchdog on a single channel in scan mode"]
456pub type AWDSGL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, AWDSGL_A, O>;
457impl<'a, const O: u8> AWDSGL_W<'a, O> {
458    #[doc = "Analog watchdog enabled on all channels"]
459    #[inline(always)]
460    pub fn all_channels(self) -> &'a mut W {
461        self.variant(AWDSGL_A::AllChannels)
462    }
463    #[doc = "Analog watchdog enabled on a single channel"]
464    #[inline(always)]
465    pub fn single_channel(self) -> &'a mut W {
466        self.variant(AWDSGL_A::SingleChannel)
467    }
468}
469#[doc = "Scan mode\n\nValue on reset: 0"]
470#[derive(Clone, Copy, Debug, PartialEq)]
471pub enum SCAN_A {
472    #[doc = "0: Scan mode disabled"]
473    Disabled = 0,
474    #[doc = "1: Scan mode enabled"]
475    Enabled = 1,
476}
477impl From<SCAN_A> for bool {
478    #[inline(always)]
479    fn from(variant: SCAN_A) -> Self {
480        variant as u8 != 0
481    }
482}
483#[doc = "Field `SCAN` reader - Scan mode"]
484pub type SCAN_R = crate::BitReader<SCAN_A>;
485impl SCAN_R {
486    #[doc = "Get enumerated values variant"]
487    #[inline(always)]
488    pub fn variant(&self) -> SCAN_A {
489        match self.bits {
490            false => SCAN_A::Disabled,
491            true => SCAN_A::Enabled,
492        }
493    }
494    #[doc = "Checks if the value of the field is `Disabled`"]
495    #[inline(always)]
496    pub fn is_disabled(&self) -> bool {
497        *self == SCAN_A::Disabled
498    }
499    #[doc = "Checks if the value of the field is `Enabled`"]
500    #[inline(always)]
501    pub fn is_enabled(&self) -> bool {
502        *self == SCAN_A::Enabled
503    }
504}
505#[doc = "Field `SCAN` writer - Scan mode"]
506pub type SCAN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, SCAN_A, O>;
507impl<'a, const O: u8> SCAN_W<'a, O> {
508    #[doc = "Scan mode disabled"]
509    #[inline(always)]
510    pub fn disabled(self) -> &'a mut W {
511        self.variant(SCAN_A::Disabled)
512    }
513    #[doc = "Scan mode enabled"]
514    #[inline(always)]
515    pub fn enabled(self) -> &'a mut W {
516        self.variant(SCAN_A::Enabled)
517    }
518}
519#[doc = "Interrupt enable for injected channels\n\nValue on reset: 0"]
520#[derive(Clone, Copy, Debug, PartialEq)]
521pub enum JEOCIE_A {
522    #[doc = "0: JEOC interrupt disabled"]
523    Disabled = 0,
524    #[doc = "1: JEOC interrupt enabled"]
525    Enabled = 1,
526}
527impl From<JEOCIE_A> for bool {
528    #[inline(always)]
529    fn from(variant: JEOCIE_A) -> Self {
530        variant as u8 != 0
531    }
532}
533#[doc = "Field `JEOCIE` reader - Interrupt enable for injected channels"]
534pub type JEOCIE_R = crate::BitReader<JEOCIE_A>;
535impl JEOCIE_R {
536    #[doc = "Get enumerated values variant"]
537    #[inline(always)]
538    pub fn variant(&self) -> JEOCIE_A {
539        match self.bits {
540            false => JEOCIE_A::Disabled,
541            true => JEOCIE_A::Enabled,
542        }
543    }
544    #[doc = "Checks if the value of the field is `Disabled`"]
545    #[inline(always)]
546    pub fn is_disabled(&self) -> bool {
547        *self == JEOCIE_A::Disabled
548    }
549    #[doc = "Checks if the value of the field is `Enabled`"]
550    #[inline(always)]
551    pub fn is_enabled(&self) -> bool {
552        *self == JEOCIE_A::Enabled
553    }
554}
555#[doc = "Field `JEOCIE` writer - Interrupt enable for injected channels"]
556pub type JEOCIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, JEOCIE_A, O>;
557impl<'a, const O: u8> JEOCIE_W<'a, O> {
558    #[doc = "JEOC interrupt disabled"]
559    #[inline(always)]
560    pub fn disabled(self) -> &'a mut W {
561        self.variant(JEOCIE_A::Disabled)
562    }
563    #[doc = "JEOC interrupt enabled"]
564    #[inline(always)]
565    pub fn enabled(self) -> &'a mut W {
566        self.variant(JEOCIE_A::Enabled)
567    }
568}
569#[doc = "Analog watchdog interrupt enable\n\nValue on reset: 0"]
570#[derive(Clone, Copy, Debug, PartialEq)]
571pub enum AWDIE_A {
572    #[doc = "0: Analogue watchdog interrupt disabled"]
573    Disabled = 0,
574    #[doc = "1: Analogue watchdog interrupt enabled"]
575    Enabled = 1,
576}
577impl From<AWDIE_A> for bool {
578    #[inline(always)]
579    fn from(variant: AWDIE_A) -> Self {
580        variant as u8 != 0
581    }
582}
583#[doc = "Field `AWDIE` reader - Analog watchdog interrupt enable"]
584pub type AWDIE_R = crate::BitReader<AWDIE_A>;
585impl AWDIE_R {
586    #[doc = "Get enumerated values variant"]
587    #[inline(always)]
588    pub fn variant(&self) -> AWDIE_A {
589        match self.bits {
590            false => AWDIE_A::Disabled,
591            true => AWDIE_A::Enabled,
592        }
593    }
594    #[doc = "Checks if the value of the field is `Disabled`"]
595    #[inline(always)]
596    pub fn is_disabled(&self) -> bool {
597        *self == AWDIE_A::Disabled
598    }
599    #[doc = "Checks if the value of the field is `Enabled`"]
600    #[inline(always)]
601    pub fn is_enabled(&self) -> bool {
602        *self == AWDIE_A::Enabled
603    }
604}
605#[doc = "Field `AWDIE` writer - Analog watchdog interrupt enable"]
606pub type AWDIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, AWDIE_A, O>;
607impl<'a, const O: u8> AWDIE_W<'a, O> {
608    #[doc = "Analogue watchdog interrupt disabled"]
609    #[inline(always)]
610    pub fn disabled(self) -> &'a mut W {
611        self.variant(AWDIE_A::Disabled)
612    }
613    #[doc = "Analogue watchdog interrupt enabled"]
614    #[inline(always)]
615    pub fn enabled(self) -> &'a mut W {
616        self.variant(AWDIE_A::Enabled)
617    }
618}
619#[doc = "Interrupt enable for EOC\n\nValue on reset: 0"]
620#[derive(Clone, Copy, Debug, PartialEq)]
621pub enum EOCIE_A {
622    #[doc = "0: EOC interrupt disabled"]
623    Disabled = 0,
624    #[doc = "1: EOC interrupt enabled"]
625    Enabled = 1,
626}
627impl From<EOCIE_A> for bool {
628    #[inline(always)]
629    fn from(variant: EOCIE_A) -> Self {
630        variant as u8 != 0
631    }
632}
633#[doc = "Field `EOCIE` reader - Interrupt enable for EOC"]
634pub type EOCIE_R = crate::BitReader<EOCIE_A>;
635impl EOCIE_R {
636    #[doc = "Get enumerated values variant"]
637    #[inline(always)]
638    pub fn variant(&self) -> EOCIE_A {
639        match self.bits {
640            false => EOCIE_A::Disabled,
641            true => EOCIE_A::Enabled,
642        }
643    }
644    #[doc = "Checks if the value of the field is `Disabled`"]
645    #[inline(always)]
646    pub fn is_disabled(&self) -> bool {
647        *self == EOCIE_A::Disabled
648    }
649    #[doc = "Checks if the value of the field is `Enabled`"]
650    #[inline(always)]
651    pub fn is_enabled(&self) -> bool {
652        *self == EOCIE_A::Enabled
653    }
654}
655#[doc = "Field `EOCIE` writer - Interrupt enable for EOC"]
656pub type EOCIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, EOCIE_A, O>;
657impl<'a, const O: u8> EOCIE_W<'a, O> {
658    #[doc = "EOC interrupt disabled"]
659    #[inline(always)]
660    pub fn disabled(self) -> &'a mut W {
661        self.variant(EOCIE_A::Disabled)
662    }
663    #[doc = "EOC interrupt enabled"]
664    #[inline(always)]
665    pub fn enabled(self) -> &'a mut W {
666        self.variant(EOCIE_A::Enabled)
667    }
668}
669#[doc = "Field `AWDCH` reader - Analog watchdog channel select bits"]
670pub type AWDCH_R = crate::FieldReader<u8, u8>;
671#[doc = "Field `AWDCH` writer - Analog watchdog channel select bits"]
672pub type AWDCH_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR1_SPEC, u8, u8, 5, O>;
673impl R {
674    #[doc = "Bit 26 - Overrun interrupt enable"]
675    #[inline(always)]
676    pub fn ovrie(&self) -> OVRIE_R {
677        OVRIE_R::new(((self.bits >> 26) & 1) != 0)
678    }
679    #[doc = "Bits 24:25 - Resolution"]
680    #[inline(always)]
681    pub fn res(&self) -> RES_R {
682        RES_R::new(((self.bits >> 24) & 3) as u8)
683    }
684    #[doc = "Bit 23 - Analog watchdog enable on regular channels"]
685    #[inline(always)]
686    pub fn awden(&self) -> AWDEN_R {
687        AWDEN_R::new(((self.bits >> 23) & 1) != 0)
688    }
689    #[doc = "Bit 22 - Analog watchdog enable on injected channels"]
690    #[inline(always)]
691    pub fn jawden(&self) -> JAWDEN_R {
692        JAWDEN_R::new(((self.bits >> 22) & 1) != 0)
693    }
694    #[doc = "Bits 13:15 - Discontinuous mode channel count"]
695    #[inline(always)]
696    pub fn discnum(&self) -> DISCNUM_R {
697        DISCNUM_R::new(((self.bits >> 13) & 7) as u8)
698    }
699    #[doc = "Bit 12 - Discontinuous mode on injected channels"]
700    #[inline(always)]
701    pub fn jdiscen(&self) -> JDISCEN_R {
702        JDISCEN_R::new(((self.bits >> 12) & 1) != 0)
703    }
704    #[doc = "Bit 11 - Discontinuous mode on regular channels"]
705    #[inline(always)]
706    pub fn discen(&self) -> DISCEN_R {
707        DISCEN_R::new(((self.bits >> 11) & 1) != 0)
708    }
709    #[doc = "Bit 10 - Automatic injected group conversion"]
710    #[inline(always)]
711    pub fn jauto(&self) -> JAUTO_R {
712        JAUTO_R::new(((self.bits >> 10) & 1) != 0)
713    }
714    #[doc = "Bit 9 - Enable the watchdog on a single channel in scan mode"]
715    #[inline(always)]
716    pub fn awdsgl(&self) -> AWDSGL_R {
717        AWDSGL_R::new(((self.bits >> 9) & 1) != 0)
718    }
719    #[doc = "Bit 8 - Scan mode"]
720    #[inline(always)]
721    pub fn scan(&self) -> SCAN_R {
722        SCAN_R::new(((self.bits >> 8) & 1) != 0)
723    }
724    #[doc = "Bit 7 - Interrupt enable for injected channels"]
725    #[inline(always)]
726    pub fn jeocie(&self) -> JEOCIE_R {
727        JEOCIE_R::new(((self.bits >> 7) & 1) != 0)
728    }
729    #[doc = "Bit 6 - Analog watchdog interrupt enable"]
730    #[inline(always)]
731    pub fn awdie(&self) -> AWDIE_R {
732        AWDIE_R::new(((self.bits >> 6) & 1) != 0)
733    }
734    #[doc = "Bit 5 - Interrupt enable for EOC"]
735    #[inline(always)]
736    pub fn eocie(&self) -> EOCIE_R {
737        EOCIE_R::new(((self.bits >> 5) & 1) != 0)
738    }
739    #[doc = "Bits 0:4 - Analog watchdog channel select bits"]
740    #[inline(always)]
741    pub fn awdch(&self) -> AWDCH_R {
742        AWDCH_R::new((self.bits & 0x1f) as u8)
743    }
744}
745impl W {
746    #[doc = "Bit 26 - Overrun interrupt enable"]
747    #[inline(always)]
748    pub fn ovrie(&mut self) -> OVRIE_W<26> {
749        OVRIE_W::new(self)
750    }
751    #[doc = "Bits 24:25 - Resolution"]
752    #[inline(always)]
753    pub fn res(&mut self) -> RES_W<24> {
754        RES_W::new(self)
755    }
756    #[doc = "Bit 23 - Analog watchdog enable on regular channels"]
757    #[inline(always)]
758    pub fn awden(&mut self) -> AWDEN_W<23> {
759        AWDEN_W::new(self)
760    }
761    #[doc = "Bit 22 - Analog watchdog enable on injected channels"]
762    #[inline(always)]
763    pub fn jawden(&mut self) -> JAWDEN_W<22> {
764        JAWDEN_W::new(self)
765    }
766    #[doc = "Bits 13:15 - Discontinuous mode channel count"]
767    #[inline(always)]
768    pub fn discnum(&mut self) -> DISCNUM_W<13> {
769        DISCNUM_W::new(self)
770    }
771    #[doc = "Bit 12 - Discontinuous mode on injected channels"]
772    #[inline(always)]
773    pub fn jdiscen(&mut self) -> JDISCEN_W<12> {
774        JDISCEN_W::new(self)
775    }
776    #[doc = "Bit 11 - Discontinuous mode on regular channels"]
777    #[inline(always)]
778    pub fn discen(&mut self) -> DISCEN_W<11> {
779        DISCEN_W::new(self)
780    }
781    #[doc = "Bit 10 - Automatic injected group conversion"]
782    #[inline(always)]
783    pub fn jauto(&mut self) -> JAUTO_W<10> {
784        JAUTO_W::new(self)
785    }
786    #[doc = "Bit 9 - Enable the watchdog on a single channel in scan mode"]
787    #[inline(always)]
788    pub fn awdsgl(&mut self) -> AWDSGL_W<9> {
789        AWDSGL_W::new(self)
790    }
791    #[doc = "Bit 8 - Scan mode"]
792    #[inline(always)]
793    pub fn scan(&mut self) -> SCAN_W<8> {
794        SCAN_W::new(self)
795    }
796    #[doc = "Bit 7 - Interrupt enable for injected channels"]
797    #[inline(always)]
798    pub fn jeocie(&mut self) -> JEOCIE_W<7> {
799        JEOCIE_W::new(self)
800    }
801    #[doc = "Bit 6 - Analog watchdog interrupt enable"]
802    #[inline(always)]
803    pub fn awdie(&mut self) -> AWDIE_W<6> {
804        AWDIE_W::new(self)
805    }
806    #[doc = "Bit 5 - Interrupt enable for EOC"]
807    #[inline(always)]
808    pub fn eocie(&mut self) -> EOCIE_W<5> {
809        EOCIE_W::new(self)
810    }
811    #[doc = "Bits 0:4 - Analog watchdog channel select bits"]
812    #[inline(always)]
813    pub fn awdch(&mut self) -> AWDCH_W<0> {
814        AWDCH_W::new(self)
815    }
816    #[doc = "Writes raw bits to the register."]
817    #[inline(always)]
818    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
819        self.0.bits(bits);
820        self
821    }
822}
823#[doc = "control register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr1](index.html) module"]
824pub struct CR1_SPEC;
825impl crate::RegisterSpec for CR1_SPEC {
826    type Ux = u32;
827}
828#[doc = "`read()` method returns [cr1::R](R) reader structure"]
829impl crate::Readable for CR1_SPEC {
830    type Reader = R;
831}
832#[doc = "`write(|w| ..)` method takes [cr1::W](W) writer structure"]
833impl crate::Writable for CR1_SPEC {
834    type Writer = W;
835}
836#[doc = "`reset()` method sets CR1 to value 0"]
837impl crate::Resettable for CR1_SPEC {
838    #[inline(always)]
839    fn reset_value() -> Self::Ux {
840        0
841    }
842}