efm32gg12b510_pac/adc1/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `SINGLEACT` reader - Single Channel Conversion Active"]
17pub type SINGLEACT_R = crate::BitReader<bool>;
18#[doc = "Field `SCANACT` reader - Scan Conversion Active"]
19pub type SCANACT_R = crate::BitReader<bool>;
20#[doc = "Field `SCANPENDING` reader - Scan Conversion Pending"]
21pub type SCANPENDING_R = crate::BitReader<bool>;
22#[doc = "Field `SINGLEREFWARM` reader - Single Channel Reference Warmed Up"]
23pub type SINGLEREFWARM_R = crate::BitReader<bool>;
24#[doc = "Field `SCANREFWARM` reader - Scan Reference Warmed Up"]
25pub type SCANREFWARM_R = crate::BitReader<bool>;
26#[doc = "Programming Error Status\n\nValue on reset: 0"]
27#[derive(Clone, Copy, Debug, PartialEq)]
28#[repr(u8)]
29pub enum PROGERR_A {
30    #[doc = "1: `1`"]
31    BUSCONF = 1,
32    #[doc = "2: `10`"]
33    NEGSELCONF = 2,
34}
35impl From<PROGERR_A> for u8 {
36    #[inline(always)]
37    fn from(variant: PROGERR_A) -> Self {
38        variant as _
39    }
40}
41#[doc = "Field `PROGERR` reader - Programming Error Status"]
42pub type PROGERR_R = crate::FieldReader<u8, PROGERR_A>;
43impl PROGERR_R {
44    #[doc = "Get enumerated values variant"]
45    #[inline(always)]
46    pub fn variant(&self) -> Option<PROGERR_A> {
47        match self.bits {
48            1 => Some(PROGERR_A::BUSCONF),
49            2 => Some(PROGERR_A::NEGSELCONF),
50            _ => None,
51        }
52    }
53    #[doc = "Checks if the value of the field is `BUSCONF`"]
54    #[inline(always)]
55    pub fn is_busconf(&self) -> bool {
56        *self == PROGERR_A::BUSCONF
57    }
58    #[doc = "Checks if the value of the field is `NEGSELCONF`"]
59    #[inline(always)]
60    pub fn is_negselconf(&self) -> bool {
61        *self == PROGERR_A::NEGSELCONF
62    }
63}
64#[doc = "Field `WARM` reader - ADC Warmed Up"]
65pub type WARM_R = crate::BitReader<bool>;
66#[doc = "Field `SINGLEDV` reader - Single Channel Data Valid"]
67pub type SINGLEDV_R = crate::BitReader<bool>;
68#[doc = "Field `SCANDV` reader - Scan Data Valid"]
69pub type SCANDV_R = crate::BitReader<bool>;
70impl R {
71    #[doc = "Bit 0 - Single Channel Conversion Active"]
72    #[inline(always)]
73    pub fn singleact(&self) -> SINGLEACT_R {
74        SINGLEACT_R::new((self.bits & 1) != 0)
75    }
76    #[doc = "Bit 1 - Scan Conversion Active"]
77    #[inline(always)]
78    pub fn scanact(&self) -> SCANACT_R {
79        SCANACT_R::new(((self.bits >> 1) & 1) != 0)
80    }
81    #[doc = "Bit 2 - Scan Conversion Pending"]
82    #[inline(always)]
83    pub fn scanpending(&self) -> SCANPENDING_R {
84        SCANPENDING_R::new(((self.bits >> 2) & 1) != 0)
85    }
86    #[doc = "Bit 8 - Single Channel Reference Warmed Up"]
87    #[inline(always)]
88    pub fn singlerefwarm(&self) -> SINGLEREFWARM_R {
89        SINGLEREFWARM_R::new(((self.bits >> 8) & 1) != 0)
90    }
91    #[doc = "Bit 9 - Scan Reference Warmed Up"]
92    #[inline(always)]
93    pub fn scanrefwarm(&self) -> SCANREFWARM_R {
94        SCANREFWARM_R::new(((self.bits >> 9) & 1) != 0)
95    }
96    #[doc = "Bits 10:11 - Programming Error Status"]
97    #[inline(always)]
98    pub fn progerr(&self) -> PROGERR_R {
99        PROGERR_R::new(((self.bits >> 10) & 3) as u8)
100    }
101    #[doc = "Bit 12 - ADC Warmed Up"]
102    #[inline(always)]
103    pub fn warm(&self) -> WARM_R {
104        WARM_R::new(((self.bits >> 12) & 1) != 0)
105    }
106    #[doc = "Bit 16 - Single Channel Data Valid"]
107    #[inline(always)]
108    pub fn singledv(&self) -> SINGLEDV_R {
109        SINGLEDV_R::new(((self.bits >> 16) & 1) != 0)
110    }
111    #[doc = "Bit 17 - Scan Data Valid"]
112    #[inline(always)]
113    pub fn scandv(&self) -> SCANDV_R {
114        SCANDV_R::new(((self.bits >> 17) & 1) != 0)
115    }
116}
117#[doc = "Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [status](index.html) module"]
118pub struct STATUS_SPEC;
119impl crate::RegisterSpec for STATUS_SPEC {
120    type Ux = u32;
121}
122#[doc = "`read()` method returns [status::R](R) reader structure"]
123impl crate::Readable for STATUS_SPEC {
124    type Reader = R;
125}
126#[doc = "`reset()` method sets STATUS to value 0"]
127impl crate::Resettable for STATUS_SPEC {
128    #[inline(always)]
129    fn reset_value() -> Self::Ux {
130        0
131    }
132}