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