lpc55_pac/adc0/
gcc.rs

1#[doc = "Register `GCC[%s]` reader"]
2pub struct R(crate::R<GCC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GCC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GCC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GCC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `GAIN_CAL` reader - Gain Calibration Value"]
17pub struct GAIN_CAL_R(crate::FieldReader<u16, u16>);
18impl GAIN_CAL_R {
19    #[inline(always)]
20    pub(crate) fn new(bits: u16) -> Self {
21        GAIN_CAL_R(crate::FieldReader::new(bits))
22    }
23}
24impl core::ops::Deref for GAIN_CAL_R {
25    type Target = crate::FieldReader<u16, u16>;
26    #[inline(always)]
27    fn deref(&self) -> &Self::Target {
28        &self.0
29    }
30}
31#[doc = "Gain Calibration Value Valid\n\nValue on reset: 0"]
32#[derive(Clone, Copy, Debug, PartialEq)]
33pub enum RDY_A {
34    #[doc = "0: The gain calibration value is invalid. Run the auto-calibration routine for this value to be written."]
35    RDY_0 = 0,
36    #[doc = "1: The gain calibration value is valid. It should be used to update the GCRa\\[GCALR\\]
37register field."]
38    RDY_1 = 1,
39}
40impl From<RDY_A> for bool {
41    #[inline(always)]
42    fn from(variant: RDY_A) -> Self {
43        variant as u8 != 0
44    }
45}
46#[doc = "Field `RDY` reader - Gain Calibration Value Valid"]
47pub struct RDY_R(crate::FieldReader<bool, RDY_A>);
48impl RDY_R {
49    #[inline(always)]
50    pub(crate) fn new(bits: bool) -> Self {
51        RDY_R(crate::FieldReader::new(bits))
52    }
53    #[doc = r"Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> RDY_A {
56        match self.bits {
57            false => RDY_A::RDY_0,
58            true => RDY_A::RDY_1,
59        }
60    }
61    #[doc = "Checks if the value of the field is `RDY_0`"]
62    #[inline(always)]
63    pub fn is_rdy_0(&self) -> bool {
64        **self == RDY_A::RDY_0
65    }
66    #[doc = "Checks if the value of the field is `RDY_1`"]
67    #[inline(always)]
68    pub fn is_rdy_1(&self) -> bool {
69        **self == RDY_A::RDY_1
70    }
71}
72impl core::ops::Deref for RDY_R {
73    type Target = crate::FieldReader<bool, RDY_A>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79impl R {
80    #[doc = "Bits 0:15 - Gain Calibration Value"]
81    #[inline(always)]
82    pub fn gain_cal(&self) -> GAIN_CAL_R {
83        GAIN_CAL_R::new((self.bits & 0xffff) as u16)
84    }
85    #[doc = "Bit 24 - Gain Calibration Value Valid"]
86    #[inline(always)]
87    pub fn rdy(&self) -> RDY_R {
88        RDY_R::new(((self.bits >> 24) & 0x01) != 0)
89    }
90}
91#[doc = "Gain Calibration Control\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 [gcc](index.html) module"]
92pub struct GCC_SPEC;
93impl crate::RegisterSpec for GCC_SPEC {
94    type Ux = u32;
95}
96#[doc = "`read()` method returns [gcc::R](R) reader structure"]
97impl crate::Readable for GCC_SPEC {
98    type Reader = R;
99}
100#[doc = "`reset()` method sets GCC[%s]
101to value 0"]
102impl crate::Resettable for GCC_SPEC {
103    #[inline(always)]
104    fn reset_value() -> Self::Ux {
105        0
106    }
107}