efm32g230_pac/adc0/
status.rs1#[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 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 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 = "Field `WARM` reader - ADC Warmed Up"]
25pub type WARM_R = crate::BitReader<bool>;
26#[doc = "Field `SINGLEDV` reader - Single Sample Data Valid"]
27pub type SINGLEDV_R = crate::BitReader<bool>;
28#[doc = "Field `SCANDV` reader - Scan Data Valid"]
29pub type SCANDV_R = crate::BitReader<bool>;
30#[doc = "Scan Data Source\n\nValue on reset: 0"]
31#[derive(Clone, Copy, Debug, PartialEq)]
32#[repr(u8)]
33pub enum SCANDATASRC_A {
34 #[doc = "0: Single ended mode: SCANDATA result originates from ADCn_CH0. Differential mode: SCANDATA result originates from ADCn_CH0-ADCn_CH1"]
35 CH0 = 0,
36 #[doc = "1: Single ended mode: SCANDATA result originates from ADCn_CH1. Differential mode: SCANDATA result originates from ADCn_CH2_ADCn_CH3"]
37 CH1 = 1,
38 #[doc = "2: Single ended mode: SCANDATA result originates from ADCn_CH2. Differential mode: SCANDATA result originates from ADCn_CH4-ADCn_CH5"]
39 CH2 = 2,
40 #[doc = "3: Single ended mode: SCANDATA result originates from ADCn_CH3. Differential mode: SCANDATA result originates from ADCn_CH6-ADCn_CH7"]
41 CH3 = 3,
42 #[doc = "4: SCANDATA result originates from ADCn_CH4"]
43 CH4 = 4,
44 #[doc = "5: SCANDATA result originates from ADCn_CH5"]
45 CH5 = 5,
46 #[doc = "6: SCANDATA result originates from ADCn_CH6"]
47 CH6 = 6,
48 #[doc = "7: SCANDATA result originates from ADCn_CH7"]
49 CH7 = 7,
50}
51impl From<SCANDATASRC_A> for u8 {
52 #[inline(always)]
53 fn from(variant: SCANDATASRC_A) -> Self {
54 variant as _
55 }
56}
57#[doc = "Field `SCANDATASRC` reader - Scan Data Source"]
58pub type SCANDATASRC_R = crate::FieldReader<u8, SCANDATASRC_A>;
59impl SCANDATASRC_R {
60 #[doc = "Get enumerated values variant"]
61 #[inline(always)]
62 pub fn variant(&self) -> SCANDATASRC_A {
63 match self.bits {
64 0 => SCANDATASRC_A::CH0,
65 1 => SCANDATASRC_A::CH1,
66 2 => SCANDATASRC_A::CH2,
67 3 => SCANDATASRC_A::CH3,
68 4 => SCANDATASRC_A::CH4,
69 5 => SCANDATASRC_A::CH5,
70 6 => SCANDATASRC_A::CH6,
71 7 => SCANDATASRC_A::CH7,
72 _ => unreachable!(),
73 }
74 }
75 #[doc = "Checks if the value of the field is `CH0`"]
76 #[inline(always)]
77 pub fn is_ch0(&self) -> bool {
78 *self == SCANDATASRC_A::CH0
79 }
80 #[doc = "Checks if the value of the field is `CH1`"]
81 #[inline(always)]
82 pub fn is_ch1(&self) -> bool {
83 *self == SCANDATASRC_A::CH1
84 }
85 #[doc = "Checks if the value of the field is `CH2`"]
86 #[inline(always)]
87 pub fn is_ch2(&self) -> bool {
88 *self == SCANDATASRC_A::CH2
89 }
90 #[doc = "Checks if the value of the field is `CH3`"]
91 #[inline(always)]
92 pub fn is_ch3(&self) -> bool {
93 *self == SCANDATASRC_A::CH3
94 }
95 #[doc = "Checks if the value of the field is `CH4`"]
96 #[inline(always)]
97 pub fn is_ch4(&self) -> bool {
98 *self == SCANDATASRC_A::CH4
99 }
100 #[doc = "Checks if the value of the field is `CH5`"]
101 #[inline(always)]
102 pub fn is_ch5(&self) -> bool {
103 *self == SCANDATASRC_A::CH5
104 }
105 #[doc = "Checks if the value of the field is `CH6`"]
106 #[inline(always)]
107 pub fn is_ch6(&self) -> bool {
108 *self == SCANDATASRC_A::CH6
109 }
110 #[doc = "Checks if the value of the field is `CH7`"]
111 #[inline(always)]
112 pub fn is_ch7(&self) -> bool {
113 *self == SCANDATASRC_A::CH7
114 }
115}
116impl R {
117 #[doc = "Bit 0 - Single Conversion Active"]
118 #[inline(always)]
119 pub fn singleact(&self) -> SINGLEACT_R {
120 SINGLEACT_R::new((self.bits & 1) != 0)
121 }
122 #[doc = "Bit 1 - Scan Conversion Active"]
123 #[inline(always)]
124 pub fn scanact(&self) -> SCANACT_R {
125 SCANACT_R::new(((self.bits >> 1) & 1) != 0)
126 }
127 #[doc = "Bit 8 - Single Reference Warmed Up"]
128 #[inline(always)]
129 pub fn singlerefwarm(&self) -> SINGLEREFWARM_R {
130 SINGLEREFWARM_R::new(((self.bits >> 8) & 1) != 0)
131 }
132 #[doc = "Bit 9 - Scan Reference Warmed Up"]
133 #[inline(always)]
134 pub fn scanrefwarm(&self) -> SCANREFWARM_R {
135 SCANREFWARM_R::new(((self.bits >> 9) & 1) != 0)
136 }
137 #[doc = "Bit 12 - ADC Warmed Up"]
138 #[inline(always)]
139 pub fn warm(&self) -> WARM_R {
140 WARM_R::new(((self.bits >> 12) & 1) != 0)
141 }
142 #[doc = "Bit 16 - Single Sample Data Valid"]
143 #[inline(always)]
144 pub fn singledv(&self) -> SINGLEDV_R {
145 SINGLEDV_R::new(((self.bits >> 16) & 1) != 0)
146 }
147 #[doc = "Bit 17 - Scan Data Valid"]
148 #[inline(always)]
149 pub fn scandv(&self) -> SCANDV_R {
150 SCANDV_R::new(((self.bits >> 17) & 1) != 0)
151 }
152 #[doc = "Bits 24:26 - Scan Data Source"]
153 #[inline(always)]
154 pub fn scandatasrc(&self) -> SCANDATASRC_R {
155 SCANDATASRC_R::new(((self.bits >> 24) & 7) as u8)
156 }
157}
158#[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"]
159pub struct STATUS_SPEC;
160impl crate::RegisterSpec for STATUS_SPEC {
161 type Ux = u32;
162}
163#[doc = "`read()` method returns [status::R](R) reader structure"]
164impl crate::Readable for STATUS_SPEC {
165 type Reader = R;
166}
167#[doc = "`reset()` method sets STATUS to value 0"]
168impl crate::Resettable for STATUS_SPEC {
169 #[inline(always)]
170 fn reset_value() -> Self::Ux {
171 0
172 }
173}