lpc55_pac/adc0/
resfifo.rs

1#[doc = "Register `RESFIFO[%s]` reader"]
2pub struct R(crate::R<RESFIFO_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RESFIFO_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RESFIFO_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RESFIFO_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `D` reader - Data result"]
17pub struct D_R(crate::FieldReader<u16, u16>);
18impl D_R {
19    #[inline(always)]
20    pub(crate) fn new(bits: u16) -> Self {
21        D_R(crate::FieldReader::new(bits))
22    }
23}
24impl core::ops::Deref for D_R {
25    type Target = crate::FieldReader<u16, u16>;
26    #[inline(always)]
27    fn deref(&self) -> &Self::Target {
28        &self.0
29    }
30}
31#[doc = "Trigger Source\n\nValue on reset: 0"]
32#[derive(Clone, Copy, Debug, PartialEq)]
33#[repr(u8)]
34pub enum TSRC_A {
35    #[doc = "0: Trigger source 0 initiated this conversion."]
36    TSRC_0 = 0,
37    #[doc = "1: Trigger source 1 initiated this conversion."]
38    TSRC_1 = 1,
39    #[doc = "2: Corresponding trigger source initiated this conversion."]
40    TSRC_2 = 2,
41    #[doc = "3: Corresponding trigger source initiated this conversion."]
42    TSRC_3 = 3,
43    #[doc = "4: Corresponding trigger source initiated this conversion."]
44    TSRC_4 = 4,
45    #[doc = "5: Corresponding trigger source initiated this conversion."]
46    TSRC_5 = 5,
47    #[doc = "6: Corresponding trigger source initiated this conversion."]
48    TSRC_6 = 6,
49    #[doc = "7: Corresponding trigger source initiated this conversion."]
50    TSRC_7 = 7,
51    #[doc = "8: Corresponding trigger source initiated this conversion."]
52    TSRC_8 = 8,
53    #[doc = "9: Corresponding trigger source initiated this conversion."]
54    TSRC_9 = 9,
55    #[doc = "15: Trigger source 15 initiated this conversion."]
56    TSRC_15 = 15,
57}
58impl From<TSRC_A> for u8 {
59    #[inline(always)]
60    fn from(variant: TSRC_A) -> Self {
61        variant as _
62    }
63}
64#[doc = "Field `TSRC` reader - Trigger Source"]
65pub struct TSRC_R(crate::FieldReader<u8, TSRC_A>);
66impl TSRC_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        TSRC_R(crate::FieldReader::new(bits))
70    }
71    #[doc = r"Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> Option<TSRC_A> {
74        match self.bits {
75            0 => Some(TSRC_A::TSRC_0),
76            1 => Some(TSRC_A::TSRC_1),
77            2 => Some(TSRC_A::TSRC_2),
78            3 => Some(TSRC_A::TSRC_3),
79            4 => Some(TSRC_A::TSRC_4),
80            5 => Some(TSRC_A::TSRC_5),
81            6 => Some(TSRC_A::TSRC_6),
82            7 => Some(TSRC_A::TSRC_7),
83            8 => Some(TSRC_A::TSRC_8),
84            9 => Some(TSRC_A::TSRC_9),
85            15 => Some(TSRC_A::TSRC_15),
86            _ => None,
87        }
88    }
89    #[doc = "Checks if the value of the field is `TSRC_0`"]
90    #[inline(always)]
91    pub fn is_tsrc_0(&self) -> bool {
92        **self == TSRC_A::TSRC_0
93    }
94    #[doc = "Checks if the value of the field is `TSRC_1`"]
95    #[inline(always)]
96    pub fn is_tsrc_1(&self) -> bool {
97        **self == TSRC_A::TSRC_1
98    }
99    #[doc = "Checks if the value of the field is `TSRC_2`"]
100    #[inline(always)]
101    pub fn is_tsrc_2(&self) -> bool {
102        **self == TSRC_A::TSRC_2
103    }
104    #[doc = "Checks if the value of the field is `TSRC_3`"]
105    #[inline(always)]
106    pub fn is_tsrc_3(&self) -> bool {
107        **self == TSRC_A::TSRC_3
108    }
109    #[doc = "Checks if the value of the field is `TSRC_4`"]
110    #[inline(always)]
111    pub fn is_tsrc_4(&self) -> bool {
112        **self == TSRC_A::TSRC_4
113    }
114    #[doc = "Checks if the value of the field is `TSRC_5`"]
115    #[inline(always)]
116    pub fn is_tsrc_5(&self) -> bool {
117        **self == TSRC_A::TSRC_5
118    }
119    #[doc = "Checks if the value of the field is `TSRC_6`"]
120    #[inline(always)]
121    pub fn is_tsrc_6(&self) -> bool {
122        **self == TSRC_A::TSRC_6
123    }
124    #[doc = "Checks if the value of the field is `TSRC_7`"]
125    #[inline(always)]
126    pub fn is_tsrc_7(&self) -> bool {
127        **self == TSRC_A::TSRC_7
128    }
129    #[doc = "Checks if the value of the field is `TSRC_8`"]
130    #[inline(always)]
131    pub fn is_tsrc_8(&self) -> bool {
132        **self == TSRC_A::TSRC_8
133    }
134    #[doc = "Checks if the value of the field is `TSRC_9`"]
135    #[inline(always)]
136    pub fn is_tsrc_9(&self) -> bool {
137        **self == TSRC_A::TSRC_9
138    }
139    #[doc = "Checks if the value of the field is `TSRC_15`"]
140    #[inline(always)]
141    pub fn is_tsrc_15(&self) -> bool {
142        **self == TSRC_A::TSRC_15
143    }
144}
145impl core::ops::Deref for TSRC_R {
146    type Target = crate::FieldReader<u8, TSRC_A>;
147    #[inline(always)]
148    fn deref(&self) -> &Self::Target {
149        &self.0
150    }
151}
152#[doc = "Loop count value\n\nValue on reset: 0"]
153#[derive(Clone, Copy, Debug, PartialEq)]
154#[repr(u8)]
155pub enum LOOPCNT_A {
156    #[doc = "0: Result is from initial conversion in command."]
157    LOOPCNT_0 = 0,
158    #[doc = "1: Result is from second conversion in command."]
159    LOOPCNT_1 = 1,
160    #[doc = "2: Result is from LOOPCNT+1 conversion in command."]
161    LOOPCNT_2 = 2,
162    #[doc = "3: Result is from LOOPCNT+1 conversion in command."]
163    LOOPCNT_3 = 3,
164    #[doc = "4: Result is from LOOPCNT+1 conversion in command."]
165    LOOPCNT_4 = 4,
166    #[doc = "5: Result is from LOOPCNT+1 conversion in command."]
167    LOOPCNT_5 = 5,
168    #[doc = "6: Result is from LOOPCNT+1 conversion in command."]
169    LOOPCNT_6 = 6,
170    #[doc = "7: Result is from LOOPCNT+1 conversion in command."]
171    LOOPCNT_7 = 7,
172    #[doc = "8: Result is from LOOPCNT+1 conversion in command."]
173    LOOPCNT_8 = 8,
174    #[doc = "9: Result is from LOOPCNT+1 conversion in command."]
175    LOOPCNT_9 = 9,
176    #[doc = "15: Result is from 16th conversion in command."]
177    LOOPCNT_15 = 15,
178}
179impl From<LOOPCNT_A> for u8 {
180    #[inline(always)]
181    fn from(variant: LOOPCNT_A) -> Self {
182        variant as _
183    }
184}
185#[doc = "Field `LOOPCNT` reader - Loop count value"]
186pub struct LOOPCNT_R(crate::FieldReader<u8, LOOPCNT_A>);
187impl LOOPCNT_R {
188    #[inline(always)]
189    pub(crate) fn new(bits: u8) -> Self {
190        LOOPCNT_R(crate::FieldReader::new(bits))
191    }
192    #[doc = r"Get enumerated values variant"]
193    #[inline(always)]
194    pub fn variant(&self) -> Option<LOOPCNT_A> {
195        match self.bits {
196            0 => Some(LOOPCNT_A::LOOPCNT_0),
197            1 => Some(LOOPCNT_A::LOOPCNT_1),
198            2 => Some(LOOPCNT_A::LOOPCNT_2),
199            3 => Some(LOOPCNT_A::LOOPCNT_3),
200            4 => Some(LOOPCNT_A::LOOPCNT_4),
201            5 => Some(LOOPCNT_A::LOOPCNT_5),
202            6 => Some(LOOPCNT_A::LOOPCNT_6),
203            7 => Some(LOOPCNT_A::LOOPCNT_7),
204            8 => Some(LOOPCNT_A::LOOPCNT_8),
205            9 => Some(LOOPCNT_A::LOOPCNT_9),
206            15 => Some(LOOPCNT_A::LOOPCNT_15),
207            _ => None,
208        }
209    }
210    #[doc = "Checks if the value of the field is `LOOPCNT_0`"]
211    #[inline(always)]
212    pub fn is_loopcnt_0(&self) -> bool {
213        **self == LOOPCNT_A::LOOPCNT_0
214    }
215    #[doc = "Checks if the value of the field is `LOOPCNT_1`"]
216    #[inline(always)]
217    pub fn is_loopcnt_1(&self) -> bool {
218        **self == LOOPCNT_A::LOOPCNT_1
219    }
220    #[doc = "Checks if the value of the field is `LOOPCNT_2`"]
221    #[inline(always)]
222    pub fn is_loopcnt_2(&self) -> bool {
223        **self == LOOPCNT_A::LOOPCNT_2
224    }
225    #[doc = "Checks if the value of the field is `LOOPCNT_3`"]
226    #[inline(always)]
227    pub fn is_loopcnt_3(&self) -> bool {
228        **self == LOOPCNT_A::LOOPCNT_3
229    }
230    #[doc = "Checks if the value of the field is `LOOPCNT_4`"]
231    #[inline(always)]
232    pub fn is_loopcnt_4(&self) -> bool {
233        **self == LOOPCNT_A::LOOPCNT_4
234    }
235    #[doc = "Checks if the value of the field is `LOOPCNT_5`"]
236    #[inline(always)]
237    pub fn is_loopcnt_5(&self) -> bool {
238        **self == LOOPCNT_A::LOOPCNT_5
239    }
240    #[doc = "Checks if the value of the field is `LOOPCNT_6`"]
241    #[inline(always)]
242    pub fn is_loopcnt_6(&self) -> bool {
243        **self == LOOPCNT_A::LOOPCNT_6
244    }
245    #[doc = "Checks if the value of the field is `LOOPCNT_7`"]
246    #[inline(always)]
247    pub fn is_loopcnt_7(&self) -> bool {
248        **self == LOOPCNT_A::LOOPCNT_7
249    }
250    #[doc = "Checks if the value of the field is `LOOPCNT_8`"]
251    #[inline(always)]
252    pub fn is_loopcnt_8(&self) -> bool {
253        **self == LOOPCNT_A::LOOPCNT_8
254    }
255    #[doc = "Checks if the value of the field is `LOOPCNT_9`"]
256    #[inline(always)]
257    pub fn is_loopcnt_9(&self) -> bool {
258        **self == LOOPCNT_A::LOOPCNT_9
259    }
260    #[doc = "Checks if the value of the field is `LOOPCNT_15`"]
261    #[inline(always)]
262    pub fn is_loopcnt_15(&self) -> bool {
263        **self == LOOPCNT_A::LOOPCNT_15
264    }
265}
266impl core::ops::Deref for LOOPCNT_R {
267    type Target = crate::FieldReader<u8, LOOPCNT_A>;
268    #[inline(always)]
269    fn deref(&self) -> &Self::Target {
270        &self.0
271    }
272}
273#[doc = "Command Buffer Source\n\nValue on reset: 0"]
274#[derive(Clone, Copy, Debug, PartialEq)]
275#[repr(u8)]
276pub enum CMDSRC_A {
277    #[doc = "0: Not a valid value CMDSRC value for a dataword in RESFIFO. 0x0 is only found in initial FIFO state prior to an ADC conversion result dataword being stored to a RESFIFO buffer."]
278    CMDSRC_0 = 0,
279    #[doc = "1: CMD1 buffer used as control settings for this conversion."]
280    CMDSRC_1 = 1,
281    #[doc = "2: Corresponding command buffer used as control settings for this conversion."]
282    CMDSRC_2 = 2,
283    #[doc = "3: Corresponding command buffer used as control settings for this conversion."]
284    CMDSRC_3 = 3,
285    #[doc = "4: Corresponding command buffer used as control settings for this conversion."]
286    CMDSRC_4 = 4,
287    #[doc = "5: Corresponding command buffer used as control settings for this conversion."]
288    CMDSRC_5 = 5,
289    #[doc = "6: Corresponding command buffer used as control settings for this conversion."]
290    CMDSRC_6 = 6,
291    #[doc = "7: Corresponding command buffer used as control settings for this conversion."]
292    CMDSRC_7 = 7,
293    #[doc = "8: Corresponding command buffer used as control settings for this conversion."]
294    CMDSRC_8 = 8,
295    #[doc = "9: Corresponding command buffer used as control settings for this conversion."]
296    CMDSRC_9 = 9,
297    #[doc = "15: CMD15 buffer used as control settings for this conversion."]
298    CMDSRC_15 = 15,
299}
300impl From<CMDSRC_A> for u8 {
301    #[inline(always)]
302    fn from(variant: CMDSRC_A) -> Self {
303        variant as _
304    }
305}
306#[doc = "Field `CMDSRC` reader - Command Buffer Source"]
307pub struct CMDSRC_R(crate::FieldReader<u8, CMDSRC_A>);
308impl CMDSRC_R {
309    #[inline(always)]
310    pub(crate) fn new(bits: u8) -> Self {
311        CMDSRC_R(crate::FieldReader::new(bits))
312    }
313    #[doc = r"Get enumerated values variant"]
314    #[inline(always)]
315    pub fn variant(&self) -> Option<CMDSRC_A> {
316        match self.bits {
317            0 => Some(CMDSRC_A::CMDSRC_0),
318            1 => Some(CMDSRC_A::CMDSRC_1),
319            2 => Some(CMDSRC_A::CMDSRC_2),
320            3 => Some(CMDSRC_A::CMDSRC_3),
321            4 => Some(CMDSRC_A::CMDSRC_4),
322            5 => Some(CMDSRC_A::CMDSRC_5),
323            6 => Some(CMDSRC_A::CMDSRC_6),
324            7 => Some(CMDSRC_A::CMDSRC_7),
325            8 => Some(CMDSRC_A::CMDSRC_8),
326            9 => Some(CMDSRC_A::CMDSRC_9),
327            15 => Some(CMDSRC_A::CMDSRC_15),
328            _ => None,
329        }
330    }
331    #[doc = "Checks if the value of the field is `CMDSRC_0`"]
332    #[inline(always)]
333    pub fn is_cmdsrc_0(&self) -> bool {
334        **self == CMDSRC_A::CMDSRC_0
335    }
336    #[doc = "Checks if the value of the field is `CMDSRC_1`"]
337    #[inline(always)]
338    pub fn is_cmdsrc_1(&self) -> bool {
339        **self == CMDSRC_A::CMDSRC_1
340    }
341    #[doc = "Checks if the value of the field is `CMDSRC_2`"]
342    #[inline(always)]
343    pub fn is_cmdsrc_2(&self) -> bool {
344        **self == CMDSRC_A::CMDSRC_2
345    }
346    #[doc = "Checks if the value of the field is `CMDSRC_3`"]
347    #[inline(always)]
348    pub fn is_cmdsrc_3(&self) -> bool {
349        **self == CMDSRC_A::CMDSRC_3
350    }
351    #[doc = "Checks if the value of the field is `CMDSRC_4`"]
352    #[inline(always)]
353    pub fn is_cmdsrc_4(&self) -> bool {
354        **self == CMDSRC_A::CMDSRC_4
355    }
356    #[doc = "Checks if the value of the field is `CMDSRC_5`"]
357    #[inline(always)]
358    pub fn is_cmdsrc_5(&self) -> bool {
359        **self == CMDSRC_A::CMDSRC_5
360    }
361    #[doc = "Checks if the value of the field is `CMDSRC_6`"]
362    #[inline(always)]
363    pub fn is_cmdsrc_6(&self) -> bool {
364        **self == CMDSRC_A::CMDSRC_6
365    }
366    #[doc = "Checks if the value of the field is `CMDSRC_7`"]
367    #[inline(always)]
368    pub fn is_cmdsrc_7(&self) -> bool {
369        **self == CMDSRC_A::CMDSRC_7
370    }
371    #[doc = "Checks if the value of the field is `CMDSRC_8`"]
372    #[inline(always)]
373    pub fn is_cmdsrc_8(&self) -> bool {
374        **self == CMDSRC_A::CMDSRC_8
375    }
376    #[doc = "Checks if the value of the field is `CMDSRC_9`"]
377    #[inline(always)]
378    pub fn is_cmdsrc_9(&self) -> bool {
379        **self == CMDSRC_A::CMDSRC_9
380    }
381    #[doc = "Checks if the value of the field is `CMDSRC_15`"]
382    #[inline(always)]
383    pub fn is_cmdsrc_15(&self) -> bool {
384        **self == CMDSRC_A::CMDSRC_15
385    }
386}
387impl core::ops::Deref for CMDSRC_R {
388    type Target = crate::FieldReader<u8, CMDSRC_A>;
389    #[inline(always)]
390    fn deref(&self) -> &Self::Target {
391        &self.0
392    }
393}
394#[doc = "FIFO entry is valid\n\nValue on reset: 0"]
395#[derive(Clone, Copy, Debug, PartialEq)]
396pub enum VALID_A {
397    #[doc = "0: FIFO is empty. Discard any read from RESFIFO."]
398    VALID_0 = 0,
399    #[doc = "1: FIFO record read from RESFIFO is valid."]
400    VALID_1 = 1,
401}
402impl From<VALID_A> for bool {
403    #[inline(always)]
404    fn from(variant: VALID_A) -> Self {
405        variant as u8 != 0
406    }
407}
408#[doc = "Field `VALID` reader - FIFO entry is valid"]
409pub struct VALID_R(crate::FieldReader<bool, VALID_A>);
410impl VALID_R {
411    #[inline(always)]
412    pub(crate) fn new(bits: bool) -> Self {
413        VALID_R(crate::FieldReader::new(bits))
414    }
415    #[doc = r"Get enumerated values variant"]
416    #[inline(always)]
417    pub fn variant(&self) -> VALID_A {
418        match self.bits {
419            false => VALID_A::VALID_0,
420            true => VALID_A::VALID_1,
421        }
422    }
423    #[doc = "Checks if the value of the field is `VALID_0`"]
424    #[inline(always)]
425    pub fn is_valid_0(&self) -> bool {
426        **self == VALID_A::VALID_0
427    }
428    #[doc = "Checks if the value of the field is `VALID_1`"]
429    #[inline(always)]
430    pub fn is_valid_1(&self) -> bool {
431        **self == VALID_A::VALID_1
432    }
433}
434impl core::ops::Deref for VALID_R {
435    type Target = crate::FieldReader<bool, VALID_A>;
436    #[inline(always)]
437    fn deref(&self) -> &Self::Target {
438        &self.0
439    }
440}
441impl R {
442    #[doc = "Bits 0:15 - Data result"]
443    #[inline(always)]
444    pub fn d(&self) -> D_R {
445        D_R::new((self.bits & 0xffff) as u16)
446    }
447    #[doc = "Bits 16:19 - Trigger Source"]
448    #[inline(always)]
449    pub fn tsrc(&self) -> TSRC_R {
450        TSRC_R::new(((self.bits >> 16) & 0x0f) as u8)
451    }
452    #[doc = "Bits 20:23 - Loop count value"]
453    #[inline(always)]
454    pub fn loopcnt(&self) -> LOOPCNT_R {
455        LOOPCNT_R::new(((self.bits >> 20) & 0x0f) as u8)
456    }
457    #[doc = "Bits 24:27 - Command Buffer Source"]
458    #[inline(always)]
459    pub fn cmdsrc(&self) -> CMDSRC_R {
460        CMDSRC_R::new(((self.bits >> 24) & 0x0f) as u8)
461    }
462    #[doc = "Bit 31 - FIFO entry is valid"]
463    #[inline(always)]
464    pub fn valid(&self) -> VALID_R {
465        VALID_R::new(((self.bits >> 31) & 0x01) != 0)
466    }
467}
468#[doc = "ADC Data Result FIFO 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 [resfifo](index.html) module"]
469pub struct RESFIFO_SPEC;
470impl crate::RegisterSpec for RESFIFO_SPEC {
471    type Ux = u32;
472}
473#[doc = "`read()` method returns [resfifo::R](R) reader structure"]
474impl crate::Readable for RESFIFO_SPEC {
475    type Reader = R;
476}
477#[doc = "`reset()` method sets RESFIFO[%s]
478to value 0"]
479impl crate::Resettable for RESFIFO_SPEC {
480    #[inline(always)]
481    fn reset_value() -> Self::Ux {
482        0
483    }
484}