efm32pg22_pac/efm32pg22c200/iadc0_s/
singlefifocfg.rs1#[doc = "Register `SINGLEFIFOCFG` reader"]
2pub struct R(crate::R<SINGLEFIFOCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SINGLEFIFOCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SINGLEFIFOCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SINGLEFIFOCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SINGLEFIFOCFG` writer"]
17pub struct W(crate::W<SINGLEFIFOCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SINGLEFIFOCFG_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<SINGLEFIFOCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SINGLEFIFOCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ALIGNMENT` reader - Alignment"]
38pub type ALIGNMENT_R = crate::FieldReader<u8, ALIGNMENT_A>;
39#[doc = "Alignment\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ALIGNMENT_A {
43 #[doc = "0: ID\\[7:0\\], SIGN_EXT, DATA\\[11:0\\]"]
44 RIGHT12 = 0,
45 #[doc = "1: ID\\[7:0\\], SIGN_EXT, DATA\\[15:0\\]"]
46 RIGHT16 = 1,
47 #[doc = "2: ID\\[7:0\\], SIGN_EXT, DATA\\[19:0\\]"]
48 RIGHT20 = 2,
49 #[doc = "3: DATA\\[11:0\\], 000000000000, ID\\[7:0\\]"]
50 LEFT12 = 3,
51 #[doc = "4: DATA\\[15:0\\], 00000000, ID\\[7:0\\]"]
52 LEFT16 = 4,
53 #[doc = "5: DATA\\[19:0\\], 0000, ID\\[7:0\\]"]
54 LEFT20 = 5,
55}
56impl From<ALIGNMENT_A> for u8 {
57 #[inline(always)]
58 fn from(variant: ALIGNMENT_A) -> Self {
59 variant as _
60 }
61}
62impl ALIGNMENT_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> Option<ALIGNMENT_A> {
66 match self.bits {
67 0 => Some(ALIGNMENT_A::RIGHT12),
68 1 => Some(ALIGNMENT_A::RIGHT16),
69 2 => Some(ALIGNMENT_A::RIGHT20),
70 3 => Some(ALIGNMENT_A::LEFT12),
71 4 => Some(ALIGNMENT_A::LEFT16),
72 5 => Some(ALIGNMENT_A::LEFT20),
73 _ => None,
74 }
75 }
76 #[doc = "Checks if the value of the field is `RIGHT12`"]
77 #[inline(always)]
78 pub fn is_right12(&self) -> bool {
79 *self == ALIGNMENT_A::RIGHT12
80 }
81 #[doc = "Checks if the value of the field is `RIGHT16`"]
82 #[inline(always)]
83 pub fn is_right16(&self) -> bool {
84 *self == ALIGNMENT_A::RIGHT16
85 }
86 #[doc = "Checks if the value of the field is `RIGHT20`"]
87 #[inline(always)]
88 pub fn is_right20(&self) -> bool {
89 *self == ALIGNMENT_A::RIGHT20
90 }
91 #[doc = "Checks if the value of the field is `LEFT12`"]
92 #[inline(always)]
93 pub fn is_left12(&self) -> bool {
94 *self == ALIGNMENT_A::LEFT12
95 }
96 #[doc = "Checks if the value of the field is `LEFT16`"]
97 #[inline(always)]
98 pub fn is_left16(&self) -> bool {
99 *self == ALIGNMENT_A::LEFT16
100 }
101 #[doc = "Checks if the value of the field is `LEFT20`"]
102 #[inline(always)]
103 pub fn is_left20(&self) -> bool {
104 *self == ALIGNMENT_A::LEFT20
105 }
106}
107#[doc = "Field `ALIGNMENT` writer - Alignment"]
108pub type ALIGNMENT_W<'a, const O: u8> =
109 crate::FieldWriter<'a, u32, SINGLEFIFOCFG_SPEC, u8, ALIGNMENT_A, 3, O>;
110impl<'a, const O: u8> ALIGNMENT_W<'a, O> {
111 #[doc = "ID\\[7:0\\], SIGN_EXT, DATA\\[11:0\\]"]
112 #[inline(always)]
113 pub fn right12(self) -> &'a mut W {
114 self.variant(ALIGNMENT_A::RIGHT12)
115 }
116 #[doc = "ID\\[7:0\\], SIGN_EXT, DATA\\[15:0\\]"]
117 #[inline(always)]
118 pub fn right16(self) -> &'a mut W {
119 self.variant(ALIGNMENT_A::RIGHT16)
120 }
121 #[doc = "ID\\[7:0\\], SIGN_EXT, DATA\\[19:0\\]"]
122 #[inline(always)]
123 pub fn right20(self) -> &'a mut W {
124 self.variant(ALIGNMENT_A::RIGHT20)
125 }
126 #[doc = "DATA\\[11:0\\], 000000000000, ID\\[7:0\\]"]
127 #[inline(always)]
128 pub fn left12(self) -> &'a mut W {
129 self.variant(ALIGNMENT_A::LEFT12)
130 }
131 #[doc = "DATA\\[15:0\\], 00000000, ID\\[7:0\\]"]
132 #[inline(always)]
133 pub fn left16(self) -> &'a mut W {
134 self.variant(ALIGNMENT_A::LEFT16)
135 }
136 #[doc = "DATA\\[19:0\\], 0000, ID\\[7:0\\]"]
137 #[inline(always)]
138 pub fn left20(self) -> &'a mut W {
139 self.variant(ALIGNMENT_A::LEFT20)
140 }
141}
142#[doc = "Field `SHOWID` reader - Show ID"]
143pub type SHOWID_R = crate::BitReader<bool>;
144#[doc = "Field `SHOWID` writer - Show ID"]
145pub type SHOWID_W<'a, const O: u8> = crate::BitWriter<'a, u32, SINGLEFIFOCFG_SPEC, bool, O>;
146#[doc = "Field `DVL` reader - Data Valid Level"]
147pub type DVL_R = crate::FieldReader<u8, DVL_A>;
148#[doc = "Data Valid Level\n\nValue on reset: 3"]
149#[derive(Clone, Copy, Debug, PartialEq, Eq)]
150#[repr(u8)]
151pub enum DVL_A {
152 #[doc = "0: When 1 entry in the single FIFO is valid, set the SINGLEFIFODVL interrupt and request DMA."]
153 VALID1 = 0,
154 #[doc = "1: When 2 entries in the single FIFO are valid, set the SINGLEFIFODVL interrupt and request DMA."]
155 VALID2 = 1,
156 #[doc = "2: When 3 entries in the single FIFO are valid, set the SINGLEFIFODVL interrupt and request DMA."]
157 VALID3 = 2,
158 #[doc = "3: When 4 entries in the single FIFO are valid, set the SINGLEFIFODVL interrupt and request DMA."]
159 VALID4 = 3,
160}
161impl From<DVL_A> for u8 {
162 #[inline(always)]
163 fn from(variant: DVL_A) -> Self {
164 variant as _
165 }
166}
167impl DVL_R {
168 #[doc = "Get enumerated values variant"]
169 #[inline(always)]
170 pub fn variant(&self) -> DVL_A {
171 match self.bits {
172 0 => DVL_A::VALID1,
173 1 => DVL_A::VALID2,
174 2 => DVL_A::VALID3,
175 3 => DVL_A::VALID4,
176 _ => unreachable!(),
177 }
178 }
179 #[doc = "Checks if the value of the field is `VALID1`"]
180 #[inline(always)]
181 pub fn is_valid1(&self) -> bool {
182 *self == DVL_A::VALID1
183 }
184 #[doc = "Checks if the value of the field is `VALID2`"]
185 #[inline(always)]
186 pub fn is_valid2(&self) -> bool {
187 *self == DVL_A::VALID2
188 }
189 #[doc = "Checks if the value of the field is `VALID3`"]
190 #[inline(always)]
191 pub fn is_valid3(&self) -> bool {
192 *self == DVL_A::VALID3
193 }
194 #[doc = "Checks if the value of the field is `VALID4`"]
195 #[inline(always)]
196 pub fn is_valid4(&self) -> bool {
197 *self == DVL_A::VALID4
198 }
199}
200#[doc = "Field `DVL` writer - Data Valid Level"]
201pub type DVL_W<'a, const O: u8> =
202 crate::FieldWriterSafe<'a, u32, SINGLEFIFOCFG_SPEC, u8, DVL_A, 2, O>;
203impl<'a, const O: u8> DVL_W<'a, O> {
204 #[doc = "When 1 entry in the single FIFO is valid, set the SINGLEFIFODVL interrupt and request DMA."]
205 #[inline(always)]
206 pub fn valid1(self) -> &'a mut W {
207 self.variant(DVL_A::VALID1)
208 }
209 #[doc = "When 2 entries in the single FIFO are valid, set the SINGLEFIFODVL interrupt and request DMA."]
210 #[inline(always)]
211 pub fn valid2(self) -> &'a mut W {
212 self.variant(DVL_A::VALID2)
213 }
214 #[doc = "When 3 entries in the single FIFO are valid, set the SINGLEFIFODVL interrupt and request DMA."]
215 #[inline(always)]
216 pub fn valid3(self) -> &'a mut W {
217 self.variant(DVL_A::VALID3)
218 }
219 #[doc = "When 4 entries in the single FIFO are valid, set the SINGLEFIFODVL interrupt and request DMA."]
220 #[inline(always)]
221 pub fn valid4(self) -> &'a mut W {
222 self.variant(DVL_A::VALID4)
223 }
224}
225#[doc = "Field `DMAWUFIFOSINGLE` reader - Single FIFO DMA wakeup."]
226pub type DMAWUFIFOSINGLE_R = crate::BitReader<DMAWUFIFOSINGLE_A>;
227#[doc = "Single FIFO DMA wakeup.\n\nValue on reset: 0"]
228#[derive(Clone, Copy, Debug, PartialEq, Eq)]
229pub enum DMAWUFIFOSINGLE_A {
230 #[doc = "0: While in EM2 or EM3, the DMA controller will not be requested."]
231 DISABLED = 0,
232 #[doc = "1: While in EM2 or EM3, the DMA controller will be requested when the single FIFO reaches its Data Valid Level. \\[DVL must be set to 0 (VALID1).\\]"]
233 ENABLED = 1,
234}
235impl From<DMAWUFIFOSINGLE_A> for bool {
236 #[inline(always)]
237 fn from(variant: DMAWUFIFOSINGLE_A) -> Self {
238 variant as u8 != 0
239 }
240}
241impl DMAWUFIFOSINGLE_R {
242 #[doc = "Get enumerated values variant"]
243 #[inline(always)]
244 pub fn variant(&self) -> DMAWUFIFOSINGLE_A {
245 match self.bits {
246 false => DMAWUFIFOSINGLE_A::DISABLED,
247 true => DMAWUFIFOSINGLE_A::ENABLED,
248 }
249 }
250 #[doc = "Checks if the value of the field is `DISABLED`"]
251 #[inline(always)]
252 pub fn is_disabled(&self) -> bool {
253 *self == DMAWUFIFOSINGLE_A::DISABLED
254 }
255 #[doc = "Checks if the value of the field is `ENABLED`"]
256 #[inline(always)]
257 pub fn is_enabled(&self) -> bool {
258 *self == DMAWUFIFOSINGLE_A::ENABLED
259 }
260}
261#[doc = "Field `DMAWUFIFOSINGLE` writer - Single FIFO DMA wakeup."]
262pub type DMAWUFIFOSINGLE_W<'a, const O: u8> =
263 crate::BitWriter<'a, u32, SINGLEFIFOCFG_SPEC, DMAWUFIFOSINGLE_A, O>;
264impl<'a, const O: u8> DMAWUFIFOSINGLE_W<'a, O> {
265 #[doc = "While in EM2 or EM3, the DMA controller will not be requested."]
266 #[inline(always)]
267 pub fn disabled(self) -> &'a mut W {
268 self.variant(DMAWUFIFOSINGLE_A::DISABLED)
269 }
270 #[doc = "While in EM2 or EM3, the DMA controller will be requested when the single FIFO reaches its Data Valid Level. \\[DVL must be set to 0 (VALID1).\\]"]
271 #[inline(always)]
272 pub fn enabled(self) -> &'a mut W {
273 self.variant(DMAWUFIFOSINGLE_A::ENABLED)
274 }
275}
276impl R {
277 #[doc = "Bits 0:2 - Alignment"]
278 #[inline(always)]
279 pub fn alignment(&self) -> ALIGNMENT_R {
280 ALIGNMENT_R::new((self.bits & 7) as u8)
281 }
282 #[doc = "Bit 3 - Show ID"]
283 #[inline(always)]
284 pub fn showid(&self) -> SHOWID_R {
285 SHOWID_R::new(((self.bits >> 3) & 1) != 0)
286 }
287 #[doc = "Bits 4:5 - Data Valid Level"]
288 #[inline(always)]
289 pub fn dvl(&self) -> DVL_R {
290 DVL_R::new(((self.bits >> 4) & 3) as u8)
291 }
292 #[doc = "Bit 8 - Single FIFO DMA wakeup."]
293 #[inline(always)]
294 pub fn dmawufifosingle(&self) -> DMAWUFIFOSINGLE_R {
295 DMAWUFIFOSINGLE_R::new(((self.bits >> 8) & 1) != 0)
296 }
297}
298impl W {
299 #[doc = "Bits 0:2 - Alignment"]
300 #[inline(always)]
301 #[must_use]
302 pub fn alignment(&mut self) -> ALIGNMENT_W<0> {
303 ALIGNMENT_W::new(self)
304 }
305 #[doc = "Bit 3 - Show ID"]
306 #[inline(always)]
307 #[must_use]
308 pub fn showid(&mut self) -> SHOWID_W<3> {
309 SHOWID_W::new(self)
310 }
311 #[doc = "Bits 4:5 - Data Valid Level"]
312 #[inline(always)]
313 #[must_use]
314 pub fn dvl(&mut self) -> DVL_W<4> {
315 DVL_W::new(self)
316 }
317 #[doc = "Bit 8 - Single FIFO DMA wakeup."]
318 #[inline(always)]
319 #[must_use]
320 pub fn dmawufifosingle(&mut self) -> DMAWUFIFOSINGLE_W<8> {
321 DMAWUFIFOSINGLE_W::new(self)
322 }
323 #[doc = "Writes raw bits to the register."]
324 #[inline(always)]
325 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
326 self.0.bits(bits);
327 self
328 }
329}
330#[doc = "Single FIFO Configuration\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 [singlefifocfg](index.html) module"]
331pub struct SINGLEFIFOCFG_SPEC;
332impl crate::RegisterSpec for SINGLEFIFOCFG_SPEC {
333 type Ux = u32;
334}
335#[doc = "`read()` method returns [singlefifocfg::R](R) reader structure"]
336impl crate::Readable for SINGLEFIFOCFG_SPEC {
337 type Reader = R;
338}
339#[doc = "`write(|w| ..)` method takes [singlefifocfg::W](W) writer structure"]
340impl crate::Writable for SINGLEFIFOCFG_SPEC {
341 type Writer = W;
342 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
343 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
344}
345#[doc = "`reset()` method sets SINGLEFIFOCFG to value 0x30"]
346impl crate::Resettable for SINGLEFIFOCFG_SPEC {
347 const RESET_VALUE: Self::Ux = 0x30;
348}