lpc55_pac/adc0/
verid.rs

1#[doc = "Register `VERID` reader"]
2pub struct R(crate::R<VERID_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<VERID_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<VERID_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<VERID_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Resolution\n\nValue on reset: 1"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18pub enum RES_A {
19    #[doc = "0: Up to 13-bit differential/12-bit single ended resolution supported."]
20    RES_0 = 0,
21    #[doc = "1: Up to 16-bit differential/16-bit single ended resolution supported."]
22    RES_1 = 1,
23}
24impl From<RES_A> for bool {
25    #[inline(always)]
26    fn from(variant: RES_A) -> Self {
27        variant as u8 != 0
28    }
29}
30#[doc = "Field `RES` reader - Resolution"]
31pub struct RES_R(crate::FieldReader<bool, RES_A>);
32impl RES_R {
33    #[inline(always)]
34    pub(crate) fn new(bits: bool) -> Self {
35        RES_R(crate::FieldReader::new(bits))
36    }
37    #[doc = r"Get enumerated values variant"]
38    #[inline(always)]
39    pub fn variant(&self) -> RES_A {
40        match self.bits {
41            false => RES_A::RES_0,
42            true => RES_A::RES_1,
43        }
44    }
45    #[doc = "Checks if the value of the field is `RES_0`"]
46    #[inline(always)]
47    pub fn is_res_0(&self) -> bool {
48        **self == RES_A::RES_0
49    }
50    #[doc = "Checks if the value of the field is `RES_1`"]
51    #[inline(always)]
52    pub fn is_res_1(&self) -> bool {
53        **self == RES_A::RES_1
54    }
55}
56impl core::ops::Deref for RES_R {
57    type Target = crate::FieldReader<bool, RES_A>;
58    #[inline(always)]
59    fn deref(&self) -> &Self::Target {
60        &self.0
61    }
62}
63#[doc = "Differential Supported\n\nValue on reset: 1"]
64#[derive(Clone, Copy, Debug, PartialEq)]
65pub enum DIFFEN_A {
66    #[doc = "0: Differential operation not supported."]
67    DIFFEN_0 = 0,
68    #[doc = "1: Differential operation supported. CMDLa\\[CTYPE\\]
69controls fields implemented."]
70    DIFFEN_1 = 1,
71}
72impl From<DIFFEN_A> for bool {
73    #[inline(always)]
74    fn from(variant: DIFFEN_A) -> Self {
75        variant as u8 != 0
76    }
77}
78#[doc = "Field `DIFFEN` reader - Differential Supported"]
79pub struct DIFFEN_R(crate::FieldReader<bool, DIFFEN_A>);
80impl DIFFEN_R {
81    #[inline(always)]
82    pub(crate) fn new(bits: bool) -> Self {
83        DIFFEN_R(crate::FieldReader::new(bits))
84    }
85    #[doc = r"Get enumerated values variant"]
86    #[inline(always)]
87    pub fn variant(&self) -> DIFFEN_A {
88        match self.bits {
89            false => DIFFEN_A::DIFFEN_0,
90            true => DIFFEN_A::DIFFEN_1,
91        }
92    }
93    #[doc = "Checks if the value of the field is `DIFFEN_0`"]
94    #[inline(always)]
95    pub fn is_diffen_0(&self) -> bool {
96        **self == DIFFEN_A::DIFFEN_0
97    }
98    #[doc = "Checks if the value of the field is `DIFFEN_1`"]
99    #[inline(always)]
100    pub fn is_diffen_1(&self) -> bool {
101        **self == DIFFEN_A::DIFFEN_1
102    }
103}
104impl core::ops::Deref for DIFFEN_R {
105    type Target = crate::FieldReader<bool, DIFFEN_A>;
106    #[inline(always)]
107    fn deref(&self) -> &Self::Target {
108        &self.0
109    }
110}
111#[doc = "Multi Vref Implemented\n\nValue on reset: 1"]
112#[derive(Clone, Copy, Debug, PartialEq)]
113pub enum MVI_A {
114    #[doc = "0: Single voltage reference high (VREFH) input supported."]
115    MVI_0 = 0,
116    #[doc = "1: Multiple voltage reference high (VREFH) inputs supported."]
117    MVI_1 = 1,
118}
119impl From<MVI_A> for bool {
120    #[inline(always)]
121    fn from(variant: MVI_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `MVI` reader - Multi Vref Implemented"]
126pub struct MVI_R(crate::FieldReader<bool, MVI_A>);
127impl MVI_R {
128    #[inline(always)]
129    pub(crate) fn new(bits: bool) -> Self {
130        MVI_R(crate::FieldReader::new(bits))
131    }
132    #[doc = r"Get enumerated values variant"]
133    #[inline(always)]
134    pub fn variant(&self) -> MVI_A {
135        match self.bits {
136            false => MVI_A::MVI_0,
137            true => MVI_A::MVI_1,
138        }
139    }
140    #[doc = "Checks if the value of the field is `MVI_0`"]
141    #[inline(always)]
142    pub fn is_mvi_0(&self) -> bool {
143        **self == MVI_A::MVI_0
144    }
145    #[doc = "Checks if the value of the field is `MVI_1`"]
146    #[inline(always)]
147    pub fn is_mvi_1(&self) -> bool {
148        **self == MVI_A::MVI_1
149    }
150}
151impl core::ops::Deref for MVI_R {
152    type Target = crate::FieldReader<bool, MVI_A>;
153    #[inline(always)]
154    fn deref(&self) -> &Self::Target {
155        &self.0
156    }
157}
158#[doc = "Channel Scale Width\n\nValue on reset: 0"]
159#[derive(Clone, Copy, Debug, PartialEq)]
160#[repr(u8)]
161pub enum CSW_A {
162    #[doc = "0: Channel scaling not supported."]
163    CSW_0 = 0,
164    #[doc = "1: Channel scaling supported. 1-bit CSCALE control field."]
165    CSW_1 = 1,
166    #[doc = "6: Channel scaling supported. 6-bit CSCALE control field."]
167    CSW_6 = 6,
168}
169impl From<CSW_A> for u8 {
170    #[inline(always)]
171    fn from(variant: CSW_A) -> Self {
172        variant as _
173    }
174}
175#[doc = "Field `CSW` reader - Channel Scale Width"]
176pub struct CSW_R(crate::FieldReader<u8, CSW_A>);
177impl CSW_R {
178    #[inline(always)]
179    pub(crate) fn new(bits: u8) -> Self {
180        CSW_R(crate::FieldReader::new(bits))
181    }
182    #[doc = r"Get enumerated values variant"]
183    #[inline(always)]
184    pub fn variant(&self) -> Option<CSW_A> {
185        match self.bits {
186            0 => Some(CSW_A::CSW_0),
187            1 => Some(CSW_A::CSW_1),
188            6 => Some(CSW_A::CSW_6),
189            _ => None,
190        }
191    }
192    #[doc = "Checks if the value of the field is `CSW_0`"]
193    #[inline(always)]
194    pub fn is_csw_0(&self) -> bool {
195        **self == CSW_A::CSW_0
196    }
197    #[doc = "Checks if the value of the field is `CSW_1`"]
198    #[inline(always)]
199    pub fn is_csw_1(&self) -> bool {
200        **self == CSW_A::CSW_1
201    }
202    #[doc = "Checks if the value of the field is `CSW_6`"]
203    #[inline(always)]
204    pub fn is_csw_6(&self) -> bool {
205        **self == CSW_A::CSW_6
206    }
207}
208impl core::ops::Deref for CSW_R {
209    type Target = crate::FieldReader<u8, CSW_A>;
210    #[inline(always)]
211    fn deref(&self) -> &Self::Target {
212        &self.0
213    }
214}
215#[doc = "Voltage Reference 1 Range Control Bit Implemented\n\nValue on reset: 0"]
216#[derive(Clone, Copy, Debug, PartialEq)]
217pub enum VR1RNGI_A {
218    #[doc = "0: Range control not required. CFG\\[VREF1RNG\\]
219is not implemented."]
220    VR1RNGI_0 = 0,
221    #[doc = "1: Range control required. CFG\\[VREF1RNG\\]
222is implemented."]
223    VR1RNGI_1 = 1,
224}
225impl From<VR1RNGI_A> for bool {
226    #[inline(always)]
227    fn from(variant: VR1RNGI_A) -> Self {
228        variant as u8 != 0
229    }
230}
231#[doc = "Field `VR1RNGI` reader - Voltage Reference 1 Range Control Bit Implemented"]
232pub struct VR1RNGI_R(crate::FieldReader<bool, VR1RNGI_A>);
233impl VR1RNGI_R {
234    #[inline(always)]
235    pub(crate) fn new(bits: bool) -> Self {
236        VR1RNGI_R(crate::FieldReader::new(bits))
237    }
238    #[doc = r"Get enumerated values variant"]
239    #[inline(always)]
240    pub fn variant(&self) -> VR1RNGI_A {
241        match self.bits {
242            false => VR1RNGI_A::VR1RNGI_0,
243            true => VR1RNGI_A::VR1RNGI_1,
244        }
245    }
246    #[doc = "Checks if the value of the field is `VR1RNGI_0`"]
247    #[inline(always)]
248    pub fn is_vr1rngi_0(&self) -> bool {
249        **self == VR1RNGI_A::VR1RNGI_0
250    }
251    #[doc = "Checks if the value of the field is `VR1RNGI_1`"]
252    #[inline(always)]
253    pub fn is_vr1rngi_1(&self) -> bool {
254        **self == VR1RNGI_A::VR1RNGI_1
255    }
256}
257impl core::ops::Deref for VR1RNGI_R {
258    type Target = crate::FieldReader<bool, VR1RNGI_A>;
259    #[inline(always)]
260    fn deref(&self) -> &Self::Target {
261        &self.0
262    }
263}
264#[doc = "Internal ADC Clock implemented\n\nValue on reset: 0"]
265#[derive(Clone, Copy, Debug, PartialEq)]
266pub enum IADCKI_A {
267    #[doc = "0: Internal clock source not implemented."]
268    IADCKI_0 = 0,
269    #[doc = "1: Internal clock source (and CFG\\[ADCKEN\\]) implemented."]
270    IADCKI_1 = 1,
271}
272impl From<IADCKI_A> for bool {
273    #[inline(always)]
274    fn from(variant: IADCKI_A) -> Self {
275        variant as u8 != 0
276    }
277}
278#[doc = "Field `IADCKI` reader - Internal ADC Clock implemented"]
279pub struct IADCKI_R(crate::FieldReader<bool, IADCKI_A>);
280impl IADCKI_R {
281    #[inline(always)]
282    pub(crate) fn new(bits: bool) -> Self {
283        IADCKI_R(crate::FieldReader::new(bits))
284    }
285    #[doc = r"Get enumerated values variant"]
286    #[inline(always)]
287    pub fn variant(&self) -> IADCKI_A {
288        match self.bits {
289            false => IADCKI_A::IADCKI_0,
290            true => IADCKI_A::IADCKI_1,
291        }
292    }
293    #[doc = "Checks if the value of the field is `IADCKI_0`"]
294    #[inline(always)]
295    pub fn is_iadcki_0(&self) -> bool {
296        **self == IADCKI_A::IADCKI_0
297    }
298    #[doc = "Checks if the value of the field is `IADCKI_1`"]
299    #[inline(always)]
300    pub fn is_iadcki_1(&self) -> bool {
301        **self == IADCKI_A::IADCKI_1
302    }
303}
304impl core::ops::Deref for IADCKI_R {
305    type Target = crate::FieldReader<bool, IADCKI_A>;
306    #[inline(always)]
307    fn deref(&self) -> &Self::Target {
308        &self.0
309    }
310}
311#[doc = "Calibration Function Implemented\n\nValue on reset: 1"]
312#[derive(Clone, Copy, Debug, PartialEq)]
313pub enum CALOFSI_A {
314    #[doc = "0: Calibration Not Implemented."]
315    CALOFSI_0 = 0,
316    #[doc = "1: Calibration Implemented."]
317    CALOFSI_1 = 1,
318}
319impl From<CALOFSI_A> for bool {
320    #[inline(always)]
321    fn from(variant: CALOFSI_A) -> Self {
322        variant as u8 != 0
323    }
324}
325#[doc = "Field `CALOFSI` reader - Calibration Function Implemented"]
326pub struct CALOFSI_R(crate::FieldReader<bool, CALOFSI_A>);
327impl CALOFSI_R {
328    #[inline(always)]
329    pub(crate) fn new(bits: bool) -> Self {
330        CALOFSI_R(crate::FieldReader::new(bits))
331    }
332    #[doc = r"Get enumerated values variant"]
333    #[inline(always)]
334    pub fn variant(&self) -> CALOFSI_A {
335        match self.bits {
336            false => CALOFSI_A::CALOFSI_0,
337            true => CALOFSI_A::CALOFSI_1,
338        }
339    }
340    #[doc = "Checks if the value of the field is `CALOFSI_0`"]
341    #[inline(always)]
342    pub fn is_calofsi_0(&self) -> bool {
343        **self == CALOFSI_A::CALOFSI_0
344    }
345    #[doc = "Checks if the value of the field is `CALOFSI_1`"]
346    #[inline(always)]
347    pub fn is_calofsi_1(&self) -> bool {
348        **self == CALOFSI_A::CALOFSI_1
349    }
350}
351impl core::ops::Deref for CALOFSI_R {
352    type Target = crate::FieldReader<bool, CALOFSI_A>;
353    #[inline(always)]
354    fn deref(&self) -> &Self::Target {
355        &self.0
356    }
357}
358#[doc = "Number of Single Ended Outputs Supported\n\nValue on reset: 1"]
359#[derive(Clone, Copy, Debug, PartialEq)]
360pub enum NUM_SEC_A {
361    #[doc = "0: This design supports one single ended conversion at a time."]
362    NUM_SEC_0 = 0,
363    #[doc = "1: This design supports two simultanious single ended conversions."]
364    NUM_SEC_1 = 1,
365}
366impl From<NUM_SEC_A> for bool {
367    #[inline(always)]
368    fn from(variant: NUM_SEC_A) -> Self {
369        variant as u8 != 0
370    }
371}
372#[doc = "Field `NUM_SEC` reader - Number of Single Ended Outputs Supported"]
373pub struct NUM_SEC_R(crate::FieldReader<bool, NUM_SEC_A>);
374impl NUM_SEC_R {
375    #[inline(always)]
376    pub(crate) fn new(bits: bool) -> Self {
377        NUM_SEC_R(crate::FieldReader::new(bits))
378    }
379    #[doc = r"Get enumerated values variant"]
380    #[inline(always)]
381    pub fn variant(&self) -> NUM_SEC_A {
382        match self.bits {
383            false => NUM_SEC_A::NUM_SEC_0,
384            true => NUM_SEC_A::NUM_SEC_1,
385        }
386    }
387    #[doc = "Checks if the value of the field is `NUM_SEC_0`"]
388    #[inline(always)]
389    pub fn is_num_sec_0(&self) -> bool {
390        **self == NUM_SEC_A::NUM_SEC_0
391    }
392    #[doc = "Checks if the value of the field is `NUM_SEC_1`"]
393    #[inline(always)]
394    pub fn is_num_sec_1(&self) -> bool {
395        **self == NUM_SEC_A::NUM_SEC_1
396    }
397}
398impl core::ops::Deref for NUM_SEC_R {
399    type Target = crate::FieldReader<bool, NUM_SEC_A>;
400    #[inline(always)]
401    fn deref(&self) -> &Self::Target {
402        &self.0
403    }
404}
405#[doc = "Number of FIFOs\n\nValue on reset: 2"]
406#[derive(Clone, Copy, Debug, PartialEq)]
407#[repr(u8)]
408pub enum NUM_FIFO_A {
409    #[doc = "0: N/A"]
410    NUM_FIFO_0 = 0,
411    #[doc = "1: This design supports one result FIFO."]
412    NUM_FIFO_1 = 1,
413    #[doc = "2: This design supports two result FIFOs."]
414    NUM_FIFO_2 = 2,
415    #[doc = "3: This design supports three result FIFOs."]
416    NUM_FIFO_3 = 3,
417    #[doc = "4: This design supports four result FIFOs."]
418    NUM_FIFO_4 = 4,
419}
420impl From<NUM_FIFO_A> for u8 {
421    #[inline(always)]
422    fn from(variant: NUM_FIFO_A) -> Self {
423        variant as _
424    }
425}
426#[doc = "Field `NUM_FIFO` reader - Number of FIFOs"]
427pub struct NUM_FIFO_R(crate::FieldReader<u8, NUM_FIFO_A>);
428impl NUM_FIFO_R {
429    #[inline(always)]
430    pub(crate) fn new(bits: u8) -> Self {
431        NUM_FIFO_R(crate::FieldReader::new(bits))
432    }
433    #[doc = r"Get enumerated values variant"]
434    #[inline(always)]
435    pub fn variant(&self) -> Option<NUM_FIFO_A> {
436        match self.bits {
437            0 => Some(NUM_FIFO_A::NUM_FIFO_0),
438            1 => Some(NUM_FIFO_A::NUM_FIFO_1),
439            2 => Some(NUM_FIFO_A::NUM_FIFO_2),
440            3 => Some(NUM_FIFO_A::NUM_FIFO_3),
441            4 => Some(NUM_FIFO_A::NUM_FIFO_4),
442            _ => None,
443        }
444    }
445    #[doc = "Checks if the value of the field is `NUM_FIFO_0`"]
446    #[inline(always)]
447    pub fn is_num_fifo_0(&self) -> bool {
448        **self == NUM_FIFO_A::NUM_FIFO_0
449    }
450    #[doc = "Checks if the value of the field is `NUM_FIFO_1`"]
451    #[inline(always)]
452    pub fn is_num_fifo_1(&self) -> bool {
453        **self == NUM_FIFO_A::NUM_FIFO_1
454    }
455    #[doc = "Checks if the value of the field is `NUM_FIFO_2`"]
456    #[inline(always)]
457    pub fn is_num_fifo_2(&self) -> bool {
458        **self == NUM_FIFO_A::NUM_FIFO_2
459    }
460    #[doc = "Checks if the value of the field is `NUM_FIFO_3`"]
461    #[inline(always)]
462    pub fn is_num_fifo_3(&self) -> bool {
463        **self == NUM_FIFO_A::NUM_FIFO_3
464    }
465    #[doc = "Checks if the value of the field is `NUM_FIFO_4`"]
466    #[inline(always)]
467    pub fn is_num_fifo_4(&self) -> bool {
468        **self == NUM_FIFO_A::NUM_FIFO_4
469    }
470}
471impl core::ops::Deref for NUM_FIFO_R {
472    type Target = crate::FieldReader<u8, NUM_FIFO_A>;
473    #[inline(always)]
474    fn deref(&self) -> &Self::Target {
475        &self.0
476    }
477}
478#[doc = "Field `MINOR` reader - Minor Version Number"]
479pub struct MINOR_R(crate::FieldReader<u8, u8>);
480impl MINOR_R {
481    #[inline(always)]
482    pub(crate) fn new(bits: u8) -> Self {
483        MINOR_R(crate::FieldReader::new(bits))
484    }
485}
486impl core::ops::Deref for MINOR_R {
487    type Target = crate::FieldReader<u8, u8>;
488    #[inline(always)]
489    fn deref(&self) -> &Self::Target {
490        &self.0
491    }
492}
493#[doc = "Field `MAJOR` reader - Major Version Number"]
494pub struct MAJOR_R(crate::FieldReader<u8, u8>);
495impl MAJOR_R {
496    #[inline(always)]
497    pub(crate) fn new(bits: u8) -> Self {
498        MAJOR_R(crate::FieldReader::new(bits))
499    }
500}
501impl core::ops::Deref for MAJOR_R {
502    type Target = crate::FieldReader<u8, u8>;
503    #[inline(always)]
504    fn deref(&self) -> &Self::Target {
505        &self.0
506    }
507}
508impl R {
509    #[doc = "Bit 0 - Resolution"]
510    #[inline(always)]
511    pub fn res(&self) -> RES_R {
512        RES_R::new((self.bits & 0x01) != 0)
513    }
514    #[doc = "Bit 1 - Differential Supported"]
515    #[inline(always)]
516    pub fn diffen(&self) -> DIFFEN_R {
517        DIFFEN_R::new(((self.bits >> 1) & 0x01) != 0)
518    }
519    #[doc = "Bit 3 - Multi Vref Implemented"]
520    #[inline(always)]
521    pub fn mvi(&self) -> MVI_R {
522        MVI_R::new(((self.bits >> 3) & 0x01) != 0)
523    }
524    #[doc = "Bits 4:6 - Channel Scale Width"]
525    #[inline(always)]
526    pub fn csw(&self) -> CSW_R {
527        CSW_R::new(((self.bits >> 4) & 0x07) as u8)
528    }
529    #[doc = "Bit 8 - Voltage Reference 1 Range Control Bit Implemented"]
530    #[inline(always)]
531    pub fn vr1rngi(&self) -> VR1RNGI_R {
532        VR1RNGI_R::new(((self.bits >> 8) & 0x01) != 0)
533    }
534    #[doc = "Bit 9 - Internal ADC Clock implemented"]
535    #[inline(always)]
536    pub fn iadcki(&self) -> IADCKI_R {
537        IADCKI_R::new(((self.bits >> 9) & 0x01) != 0)
538    }
539    #[doc = "Bit 10 - Calibration Function Implemented"]
540    #[inline(always)]
541    pub fn calofsi(&self) -> CALOFSI_R {
542        CALOFSI_R::new(((self.bits >> 10) & 0x01) != 0)
543    }
544    #[doc = "Bit 11 - Number of Single Ended Outputs Supported"]
545    #[inline(always)]
546    pub fn num_sec(&self) -> NUM_SEC_R {
547        NUM_SEC_R::new(((self.bits >> 11) & 0x01) != 0)
548    }
549    #[doc = "Bits 12:14 - Number of FIFOs"]
550    #[inline(always)]
551    pub fn num_fifo(&self) -> NUM_FIFO_R {
552        NUM_FIFO_R::new(((self.bits >> 12) & 0x07) as u8)
553    }
554    #[doc = "Bits 16:23 - Minor Version Number"]
555    #[inline(always)]
556    pub fn minor(&self) -> MINOR_R {
557        MINOR_R::new(((self.bits >> 16) & 0xff) as u8)
558    }
559    #[doc = "Bits 24:31 - Major Version Number"]
560    #[inline(always)]
561    pub fn major(&self) -> MAJOR_R {
562        MAJOR_R::new(((self.bits >> 24) & 0xff) as u8)
563    }
564}
565#[doc = "Version ID 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 [verid](index.html) module"]
566pub struct VERID_SPEC;
567impl crate::RegisterSpec for VERID_SPEC {
568    type Ux = u32;
569}
570#[doc = "`read()` method returns [verid::R](R) reader structure"]
571impl crate::Readable for VERID_SPEC {
572    type Reader = R;
573}
574#[doc = "`reset()` method sets VERID to value 0x0100_2c0b"]
575impl crate::Resettable for VERID_SPEC {
576    #[inline(always)]
577    fn reset_value() -> Self::Ux {
578        0x0100_2c0b
579    }
580}