stm32l4/stm32l4x5/adc_common/
csr.rs

1///Register `CSR` reader
2pub type R = crate::R<CSRrs>;
3/**ADDRDY_MST
4
5Value on reset: 0*/
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum ADRDY_MST {
9    ///0: ADC is not ready to start conversion
10    NotReady = 0,
11    ///1: ADC is ready to start conversion
12    Ready = 1,
13}
14impl From<ADRDY_MST> for bool {
15    #[inline(always)]
16    fn from(variant: ADRDY_MST) -> Self {
17        variant as u8 != 0
18    }
19}
20///Field `ADRDY_MST` reader - ADDRDY_MST
21pub type ADRDY_MST_R = crate::BitReader<ADRDY_MST>;
22impl ADRDY_MST_R {
23    ///Get enumerated values variant
24    #[inline(always)]
25    pub const fn variant(&self) -> ADRDY_MST {
26        match self.bits {
27            false => ADRDY_MST::NotReady,
28            true => ADRDY_MST::Ready,
29        }
30    }
31    ///ADC is not ready to start conversion
32    #[inline(always)]
33    pub fn is_not_ready(&self) -> bool {
34        *self == ADRDY_MST::NotReady
35    }
36    ///ADC is ready to start conversion
37    #[inline(always)]
38    pub fn is_ready(&self) -> bool {
39        *self == ADRDY_MST::Ready
40    }
41}
42/**EOSMP_MST
43
44Value on reset: 0*/
45#[cfg_attr(feature = "defmt", derive(defmt::Format))]
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47pub enum EOSMP_MST {
48    ///0: End of sampling phase no yet reached
49    NotEnded = 0,
50    ///1: End of sampling phase reached
51    Ended = 1,
52}
53impl From<EOSMP_MST> for bool {
54    #[inline(always)]
55    fn from(variant: EOSMP_MST) -> Self {
56        variant as u8 != 0
57    }
58}
59///Field `EOSMP_MST` reader - EOSMP_MST
60pub type EOSMP_MST_R = crate::BitReader<EOSMP_MST>;
61impl EOSMP_MST_R {
62    ///Get enumerated values variant
63    #[inline(always)]
64    pub const fn variant(&self) -> EOSMP_MST {
65        match self.bits {
66            false => EOSMP_MST::NotEnded,
67            true => EOSMP_MST::Ended,
68        }
69    }
70    ///End of sampling phase no yet reached
71    #[inline(always)]
72    pub fn is_not_ended(&self) -> bool {
73        *self == EOSMP_MST::NotEnded
74    }
75    ///End of sampling phase reached
76    #[inline(always)]
77    pub fn is_ended(&self) -> bool {
78        *self == EOSMP_MST::Ended
79    }
80}
81/**EOC_MST
82
83Value on reset: 0*/
84#[cfg_attr(feature = "defmt", derive(defmt::Format))]
85#[derive(Clone, Copy, Debug, PartialEq, Eq)]
86pub enum EOC_MST {
87    ///0: Regular conversion is not complete
88    NotComplete = 0,
89    ///1: Regular conversion complete
90    Complete = 1,
91}
92impl From<EOC_MST> for bool {
93    #[inline(always)]
94    fn from(variant: EOC_MST) -> Self {
95        variant as u8 != 0
96    }
97}
98///Field `EOC_MST` reader - EOC_MST
99pub type EOC_MST_R = crate::BitReader<EOC_MST>;
100impl EOC_MST_R {
101    ///Get enumerated values variant
102    #[inline(always)]
103    pub const fn variant(&self) -> EOC_MST {
104        match self.bits {
105            false => EOC_MST::NotComplete,
106            true => EOC_MST::Complete,
107        }
108    }
109    ///Regular conversion is not complete
110    #[inline(always)]
111    pub fn is_not_complete(&self) -> bool {
112        *self == EOC_MST::NotComplete
113    }
114    ///Regular conversion complete
115    #[inline(always)]
116    pub fn is_complete(&self) -> bool {
117        *self == EOC_MST::Complete
118    }
119}
120/**EOS_MST
121
122Value on reset: 0*/
123#[cfg_attr(feature = "defmt", derive(defmt::Format))]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum EOS_MST {
126    ///0: Regular sequence is not complete
127    NotComplete = 0,
128    ///1: Regular sequence complete
129    Complete = 1,
130}
131impl From<EOS_MST> for bool {
132    #[inline(always)]
133    fn from(variant: EOS_MST) -> Self {
134        variant as u8 != 0
135    }
136}
137///Field `EOS_MST` reader - EOS_MST
138pub type EOS_MST_R = crate::BitReader<EOS_MST>;
139impl EOS_MST_R {
140    ///Get enumerated values variant
141    #[inline(always)]
142    pub const fn variant(&self) -> EOS_MST {
143        match self.bits {
144            false => EOS_MST::NotComplete,
145            true => EOS_MST::Complete,
146        }
147    }
148    ///Regular sequence is not complete
149    #[inline(always)]
150    pub fn is_not_complete(&self) -> bool {
151        *self == EOS_MST::NotComplete
152    }
153    ///Regular sequence complete
154    #[inline(always)]
155    pub fn is_complete(&self) -> bool {
156        *self == EOS_MST::Complete
157    }
158}
159/**OVR_MST
160
161Value on reset: 0*/
162#[cfg_attr(feature = "defmt", derive(defmt::Format))]
163#[derive(Clone, Copy, Debug, PartialEq, Eq)]
164pub enum OVR_MST {
165    ///0: No overrun occurred
166    NoOverrun = 0,
167    ///1: Overrun occurred
168    Overrun = 1,
169}
170impl From<OVR_MST> for bool {
171    #[inline(always)]
172    fn from(variant: OVR_MST) -> Self {
173        variant as u8 != 0
174    }
175}
176///Field `OVR_MST` reader - OVR_MST
177pub type OVR_MST_R = crate::BitReader<OVR_MST>;
178impl OVR_MST_R {
179    ///Get enumerated values variant
180    #[inline(always)]
181    pub const fn variant(&self) -> OVR_MST {
182        match self.bits {
183            false => OVR_MST::NoOverrun,
184            true => OVR_MST::Overrun,
185        }
186    }
187    ///No overrun occurred
188    #[inline(always)]
189    pub fn is_no_overrun(&self) -> bool {
190        *self == OVR_MST::NoOverrun
191    }
192    ///Overrun occurred
193    #[inline(always)]
194    pub fn is_overrun(&self) -> bool {
195        *self == OVR_MST::Overrun
196    }
197}
198/**JEOC_MST
199
200Value on reset: 0*/
201#[cfg_attr(feature = "defmt", derive(defmt::Format))]
202#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum JEOC_MST {
204    ///0: Injected conversion is not complete
205    NotComplete = 0,
206    ///1: Injected conversion complete
207    Complete = 1,
208}
209impl From<JEOC_MST> for bool {
210    #[inline(always)]
211    fn from(variant: JEOC_MST) -> Self {
212        variant as u8 != 0
213    }
214}
215///Field `JEOC_MST` reader - JEOC_MST
216pub type JEOC_MST_R = crate::BitReader<JEOC_MST>;
217impl JEOC_MST_R {
218    ///Get enumerated values variant
219    #[inline(always)]
220    pub const fn variant(&self) -> JEOC_MST {
221        match self.bits {
222            false => JEOC_MST::NotComplete,
223            true => JEOC_MST::Complete,
224        }
225    }
226    ///Injected conversion is not complete
227    #[inline(always)]
228    pub fn is_not_complete(&self) -> bool {
229        *self == JEOC_MST::NotComplete
230    }
231    ///Injected conversion complete
232    #[inline(always)]
233    pub fn is_complete(&self) -> bool {
234        *self == JEOC_MST::Complete
235    }
236}
237/**JEOS_MST
238
239Value on reset: 0*/
240#[cfg_attr(feature = "defmt", derive(defmt::Format))]
241#[derive(Clone, Copy, Debug, PartialEq, Eq)]
242pub enum JEOS_MST {
243    ///0: Injected sequence is not complete
244    NotComplete = 0,
245    ///1: Injected sequence complete
246    Complete = 1,
247}
248impl From<JEOS_MST> for bool {
249    #[inline(always)]
250    fn from(variant: JEOS_MST) -> Self {
251        variant as u8 != 0
252    }
253}
254///Field `JEOS_MST` reader - JEOS_MST
255pub type JEOS_MST_R = crate::BitReader<JEOS_MST>;
256impl JEOS_MST_R {
257    ///Get enumerated values variant
258    #[inline(always)]
259    pub const fn variant(&self) -> JEOS_MST {
260        match self.bits {
261            false => JEOS_MST::NotComplete,
262            true => JEOS_MST::Complete,
263        }
264    }
265    ///Injected sequence is not complete
266    #[inline(always)]
267    pub fn is_not_complete(&self) -> bool {
268        *self == JEOS_MST::NotComplete
269    }
270    ///Injected sequence complete
271    #[inline(always)]
272    pub fn is_complete(&self) -> bool {
273        *self == JEOS_MST::Complete
274    }
275}
276/**AWD1_MST
277
278Value on reset: 0*/
279#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280#[derive(Clone, Copy, Debug, PartialEq, Eq)]
281pub enum AWD1_MST {
282    ///0: No analog watchdog event occurred
283    NoEvent = 0,
284    ///1: Analog watchdog event occurred
285    Event = 1,
286}
287impl From<AWD1_MST> for bool {
288    #[inline(always)]
289    fn from(variant: AWD1_MST) -> Self {
290        variant as u8 != 0
291    }
292}
293///Field `AWD1_MST` reader - AWD1_MST
294pub type AWD1_MST_R = crate::BitReader<AWD1_MST>;
295impl AWD1_MST_R {
296    ///Get enumerated values variant
297    #[inline(always)]
298    pub const fn variant(&self) -> AWD1_MST {
299        match self.bits {
300            false => AWD1_MST::NoEvent,
301            true => AWD1_MST::Event,
302        }
303    }
304    ///No analog watchdog event occurred
305    #[inline(always)]
306    pub fn is_no_event(&self) -> bool {
307        *self == AWD1_MST::NoEvent
308    }
309    ///Analog watchdog event occurred
310    #[inline(always)]
311    pub fn is_event(&self) -> bool {
312        *self == AWD1_MST::Event
313    }
314}
315///Field `AWD2_MST` reader - AWD2_MST
316pub use AWD1_MST_R as AWD2_MST_R;
317///Field `AWD3_MST` reader - AWD3_MST
318pub use AWD1_MST_R as AWD3_MST_R;
319/**JQOVF_MST
320
321Value on reset: 0*/
322#[cfg_attr(feature = "defmt", derive(defmt::Format))]
323#[derive(Clone, Copy, Debug, PartialEq, Eq)]
324pub enum JQOVF_MST {
325    ///0: No injected context queue overflow has occurred
326    NoOverflow = 0,
327    ///1: Injected context queue overflow has occurred
328    Overflow = 1,
329}
330impl From<JQOVF_MST> for bool {
331    #[inline(always)]
332    fn from(variant: JQOVF_MST) -> Self {
333        variant as u8 != 0
334    }
335}
336///Field `JQOVF_MST` reader - JQOVF_MST
337pub type JQOVF_MST_R = crate::BitReader<JQOVF_MST>;
338impl JQOVF_MST_R {
339    ///Get enumerated values variant
340    #[inline(always)]
341    pub const fn variant(&self) -> JQOVF_MST {
342        match self.bits {
343            false => JQOVF_MST::NoOverflow,
344            true => JQOVF_MST::Overflow,
345        }
346    }
347    ///No injected context queue overflow has occurred
348    #[inline(always)]
349    pub fn is_no_overflow(&self) -> bool {
350        *self == JQOVF_MST::NoOverflow
351    }
352    ///Injected context queue overflow has occurred
353    #[inline(always)]
354    pub fn is_overflow(&self) -> bool {
355        *self == JQOVF_MST::Overflow
356    }
357}
358///Field `ADRDY_SLV` reader - ADRDY_SLV
359pub use ADRDY_MST_R as ADRDY_SLV_R;
360///Field `AWD1_SLV` reader - Analog watchdog 1 flag of the slave ADC
361pub use AWD1_MST_R as AWD1_SLV_R;
362///Field `AWD2_SLV` reader - Analog watchdog 2 flag of the slave ADC
363pub use AWD1_MST_R as AWD2_SLV_R;
364///Field `AWD3_SLV` reader - Analog watchdog 3 flag of the slave ADC
365pub use AWD1_MST_R as AWD3_SLV_R;
366///Field `EOC_SLV` reader - End of regular conversion of the slave ADC
367pub use EOC_MST_R as EOC_SLV_R;
368///Field `EOSMP_SLV` reader - EOSMP_SLV
369pub use EOSMP_MST_R as EOSMP_SLV_R;
370///Field `EOS_SLV` reader - End of regular sequence flag of the slave ADC
371pub use EOS_MST_R as EOS_SLV_R;
372///Field `JEOC_SLV` reader - End of injected conversion flag of the slave ADC
373pub use JEOC_MST_R as JEOC_SLV_R;
374///Field `JEOS_SLV` reader - End of injected sequence flag of the slave ADC
375pub use JEOS_MST_R as JEOS_SLV_R;
376///Field `JQOVF_SLV` reader - Injected Context Queue Overflow flag of the slave ADC
377pub use JQOVF_MST_R as JQOVF_SLV_R;
378///Field `OVR_SLV` reader - Overrun flag of the slave ADC
379pub use OVR_MST_R as OVR_SLV_R;
380impl R {
381    ///Bit 0 - ADDRDY_MST
382    #[inline(always)]
383    pub fn adrdy_mst(&self) -> ADRDY_MST_R {
384        ADRDY_MST_R::new((self.bits & 1) != 0)
385    }
386    ///Bit 1 - EOSMP_MST
387    #[inline(always)]
388    pub fn eosmp_mst(&self) -> EOSMP_MST_R {
389        EOSMP_MST_R::new(((self.bits >> 1) & 1) != 0)
390    }
391    ///Bit 2 - EOC_MST
392    #[inline(always)]
393    pub fn eoc_mst(&self) -> EOC_MST_R {
394        EOC_MST_R::new(((self.bits >> 2) & 1) != 0)
395    }
396    ///Bit 3 - EOS_MST
397    #[inline(always)]
398    pub fn eos_mst(&self) -> EOS_MST_R {
399        EOS_MST_R::new(((self.bits >> 3) & 1) != 0)
400    }
401    ///Bit 4 - OVR_MST
402    #[inline(always)]
403    pub fn ovr_mst(&self) -> OVR_MST_R {
404        OVR_MST_R::new(((self.bits >> 4) & 1) != 0)
405    }
406    ///Bit 5 - JEOC_MST
407    #[inline(always)]
408    pub fn jeoc_mst(&self) -> JEOC_MST_R {
409        JEOC_MST_R::new(((self.bits >> 5) & 1) != 0)
410    }
411    ///Bit 6 - JEOS_MST
412    #[inline(always)]
413    pub fn jeos_mst(&self) -> JEOS_MST_R {
414        JEOS_MST_R::new(((self.bits >> 6) & 1) != 0)
415    }
416    ///Bit 7 - AWD1_MST
417    #[inline(always)]
418    pub fn awd1_mst(&self) -> AWD1_MST_R {
419        AWD1_MST_R::new(((self.bits >> 7) & 1) != 0)
420    }
421    ///Bit 8 - AWD2_MST
422    #[inline(always)]
423    pub fn awd2_mst(&self) -> AWD2_MST_R {
424        AWD2_MST_R::new(((self.bits >> 8) & 1) != 0)
425    }
426    ///Bit 9 - AWD3_MST
427    #[inline(always)]
428    pub fn awd3_mst(&self) -> AWD3_MST_R {
429        AWD3_MST_R::new(((self.bits >> 9) & 1) != 0)
430    }
431    ///Bit 10 - JQOVF_MST
432    #[inline(always)]
433    pub fn jqovf_mst(&self) -> JQOVF_MST_R {
434        JQOVF_MST_R::new(((self.bits >> 10) & 1) != 0)
435    }
436    ///Bit 16 - ADRDY_SLV
437    #[inline(always)]
438    pub fn adrdy_slv(&self) -> ADRDY_SLV_R {
439        ADRDY_SLV_R::new(((self.bits >> 16) & 1) != 0)
440    }
441    ///Bit 17 - EOSMP_SLV
442    #[inline(always)]
443    pub fn eosmp_slv(&self) -> EOSMP_SLV_R {
444        EOSMP_SLV_R::new(((self.bits >> 17) & 1) != 0)
445    }
446    ///Bit 18 - End of regular conversion of the slave ADC
447    #[inline(always)]
448    pub fn eoc_slv(&self) -> EOC_SLV_R {
449        EOC_SLV_R::new(((self.bits >> 18) & 1) != 0)
450    }
451    ///Bit 19 - End of regular sequence flag of the slave ADC
452    #[inline(always)]
453    pub fn eos_slv(&self) -> EOS_SLV_R {
454        EOS_SLV_R::new(((self.bits >> 19) & 1) != 0)
455    }
456    ///Bit 20 - Overrun flag of the slave ADC
457    #[inline(always)]
458    pub fn ovr_slv(&self) -> OVR_SLV_R {
459        OVR_SLV_R::new(((self.bits >> 20) & 1) != 0)
460    }
461    ///Bit 21 - End of injected conversion flag of the slave ADC
462    #[inline(always)]
463    pub fn jeoc_slv(&self) -> JEOC_SLV_R {
464        JEOC_SLV_R::new(((self.bits >> 21) & 1) != 0)
465    }
466    ///Bit 22 - End of injected sequence flag of the slave ADC
467    #[inline(always)]
468    pub fn jeos_slv(&self) -> JEOS_SLV_R {
469        JEOS_SLV_R::new(((self.bits >> 22) & 1) != 0)
470    }
471    ///Bit 23 - Analog watchdog 1 flag of the slave ADC
472    #[inline(always)]
473    pub fn awd1_slv(&self) -> AWD1_SLV_R {
474        AWD1_SLV_R::new(((self.bits >> 23) & 1) != 0)
475    }
476    ///Bit 24 - Analog watchdog 2 flag of the slave ADC
477    #[inline(always)]
478    pub fn awd2_slv(&self) -> AWD2_SLV_R {
479        AWD2_SLV_R::new(((self.bits >> 24) & 1) != 0)
480    }
481    ///Bit 25 - Analog watchdog 3 flag of the slave ADC
482    #[inline(always)]
483    pub fn awd3_slv(&self) -> AWD3_SLV_R {
484        AWD3_SLV_R::new(((self.bits >> 25) & 1) != 0)
485    }
486    ///Bit 26 - Injected Context Queue Overflow flag of the slave ADC
487    #[inline(always)]
488    pub fn jqovf_slv(&self) -> JQOVF_SLV_R {
489        JQOVF_SLV_R::new(((self.bits >> 26) & 1) != 0)
490    }
491}
492impl core::fmt::Debug for R {
493    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
494        f.debug_struct("CSR")
495            .field("adrdy_mst", &self.adrdy_mst())
496            .field("eosmp_mst", &self.eosmp_mst())
497            .field("eoc_mst", &self.eoc_mst())
498            .field("eos_mst", &self.eos_mst())
499            .field("ovr_mst", &self.ovr_mst())
500            .field("jeoc_mst", &self.jeoc_mst())
501            .field("jeos_mst", &self.jeos_mst())
502            .field("awd1_mst", &self.awd1_mst())
503            .field("awd2_mst", &self.awd2_mst())
504            .field("awd3_mst", &self.awd3_mst())
505            .field("jqovf_mst", &self.jqovf_mst())
506            .field("adrdy_slv", &self.adrdy_slv())
507            .field("eosmp_slv", &self.eosmp_slv())
508            .field("eoc_slv", &self.eoc_slv())
509            .field("eos_slv", &self.eos_slv())
510            .field("ovr_slv", &self.ovr_slv())
511            .field("jeoc_slv", &self.jeoc_slv())
512            .field("jeos_slv", &self.jeos_slv())
513            .field("awd1_slv", &self.awd1_slv())
514            .field("awd2_slv", &self.awd2_slv())
515            .field("awd3_slv", &self.awd3_slv())
516            .field("jqovf_slv", &self.jqovf_slv())
517            .finish()
518    }
519}
520/**ADC Common status register
521
522You can [`read`](crate::Reg::read) this register and get [`csr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api).
523
524See register [structure](https://stm32-rs.github.io/stm32-rs/STM32L4x5.html#ADC_Common:CSR)*/
525pub struct CSRrs;
526impl crate::RegisterSpec for CSRrs {
527    type Ux = u32;
528}
529///`read()` method returns [`csr::R`](R) reader structure
530impl crate::Readable for CSRrs {}
531///`reset()` method sets CSR to value 0
532impl crate::Resettable for CSRrs {}