lpc550x/inputmux/
freqmeas_ref.rs1#[doc = "Register `FREQMEAS_REF` reader"]
2pub struct R(crate::R<FREQMEAS_REF_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FREQMEAS_REF_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FREQMEAS_REF_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FREQMEAS_REF_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FREQMEAS_REF` writer"]
17pub struct W(crate::W<FREQMEAS_REF_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FREQMEAS_REF_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<FREQMEAS_REF_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FREQMEAS_REF_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CLKIN` reader - Clock source number (decimal value) for frequency measure function reference clock:"]
38pub type CLKIN_R = crate::FieldReader<u8, CLKIN_A>;
39#[doc = "Clock source number (decimal value) for frequency measure function reference clock:\n\nValue on reset: 31"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CLKIN_A {
43    #[doc = "0: External main crystal oscilator (Clock_in)."]
44    VALUE0 = 0,
45    #[doc = "1: FRO 12MHz clock."]
46    VALUE1 = 1,
47    #[doc = "2: FRO 96MHz clock."]
48    VALUE2 = 2,
49    #[doc = "3: Watchdog oscillator / FRO1MHz clock."]
50    VALUE3 = 3,
51    #[doc = "4: 32 kHz oscillator (32k_clk) clock."]
52    VALUE4 = 4,
53    #[doc = "5: main clock (main_clock)."]
54    VALUE5 = 5,
55    #[doc = "6: FREQME_GPIO_CLK_A."]
56    VALUE6 = 6,
57    #[doc = "7: FREQME_GPIO_CLK_B."]
58    VALUE7 = 7,
59}
60impl From<CLKIN_A> for u8 {
61    #[inline(always)]
62    fn from(variant: CLKIN_A) -> Self {
63        variant as _
64    }
65}
66impl CLKIN_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> Option<CLKIN_A> {
70        match self.bits {
71            0 => Some(CLKIN_A::VALUE0),
72            1 => Some(CLKIN_A::VALUE1),
73            2 => Some(CLKIN_A::VALUE2),
74            3 => Some(CLKIN_A::VALUE3),
75            4 => Some(CLKIN_A::VALUE4),
76            5 => Some(CLKIN_A::VALUE5),
77            6 => Some(CLKIN_A::VALUE6),
78            7 => Some(CLKIN_A::VALUE7),
79            _ => None,
80        }
81    }
82    #[doc = "Checks if the value of the field is `VALUE0`"]
83    #[inline(always)]
84    pub fn is_value0(&self) -> bool {
85        *self == CLKIN_A::VALUE0
86    }
87    #[doc = "Checks if the value of the field is `VALUE1`"]
88    #[inline(always)]
89    pub fn is_value1(&self) -> bool {
90        *self == CLKIN_A::VALUE1
91    }
92    #[doc = "Checks if the value of the field is `VALUE2`"]
93    #[inline(always)]
94    pub fn is_value2(&self) -> bool {
95        *self == CLKIN_A::VALUE2
96    }
97    #[doc = "Checks if the value of the field is `VALUE3`"]
98    #[inline(always)]
99    pub fn is_value3(&self) -> bool {
100        *self == CLKIN_A::VALUE3
101    }
102    #[doc = "Checks if the value of the field is `VALUE4`"]
103    #[inline(always)]
104    pub fn is_value4(&self) -> bool {
105        *self == CLKIN_A::VALUE4
106    }
107    #[doc = "Checks if the value of the field is `VALUE5`"]
108    #[inline(always)]
109    pub fn is_value5(&self) -> bool {
110        *self == CLKIN_A::VALUE5
111    }
112    #[doc = "Checks if the value of the field is `VALUE6`"]
113    #[inline(always)]
114    pub fn is_value6(&self) -> bool {
115        *self == CLKIN_A::VALUE6
116    }
117    #[doc = "Checks if the value of the field is `VALUE7`"]
118    #[inline(always)]
119    pub fn is_value7(&self) -> bool {
120        *self == CLKIN_A::VALUE7
121    }
122}
123#[doc = "Field `CLKIN` writer - Clock source number (decimal value) for frequency measure function reference clock:"]
124pub type CLKIN_W<'a, const O: u8> =
125    crate::FieldWriter<'a, u32, FREQMEAS_REF_SPEC, u8, CLKIN_A, 5, O>;
126impl<'a, const O: u8> CLKIN_W<'a, O> {
127    #[doc = "External main crystal oscilator (Clock_in)."]
128    #[inline(always)]
129    pub fn value0(self) -> &'a mut W {
130        self.variant(CLKIN_A::VALUE0)
131    }
132    #[doc = "FRO 12MHz clock."]
133    #[inline(always)]
134    pub fn value1(self) -> &'a mut W {
135        self.variant(CLKIN_A::VALUE1)
136    }
137    #[doc = "FRO 96MHz clock."]
138    #[inline(always)]
139    pub fn value2(self) -> &'a mut W {
140        self.variant(CLKIN_A::VALUE2)
141    }
142    #[doc = "Watchdog oscillator / FRO1MHz clock."]
143    #[inline(always)]
144    pub fn value3(self) -> &'a mut W {
145        self.variant(CLKIN_A::VALUE3)
146    }
147    #[doc = "32 kHz oscillator (32k_clk) clock."]
148    #[inline(always)]
149    pub fn value4(self) -> &'a mut W {
150        self.variant(CLKIN_A::VALUE4)
151    }
152    #[doc = "main clock (main_clock)."]
153    #[inline(always)]
154    pub fn value5(self) -> &'a mut W {
155        self.variant(CLKIN_A::VALUE5)
156    }
157    #[doc = "FREQME_GPIO_CLK_A."]
158    #[inline(always)]
159    pub fn value6(self) -> &'a mut W {
160        self.variant(CLKIN_A::VALUE6)
161    }
162    #[doc = "FREQME_GPIO_CLK_B."]
163    #[inline(always)]
164    pub fn value7(self) -> &'a mut W {
165        self.variant(CLKIN_A::VALUE7)
166    }
167}
168impl R {
169    #[doc = "Bits 0:4 - Clock source number (decimal value) for frequency measure function reference clock:"]
170    #[inline(always)]
171    pub fn clkin(&self) -> CLKIN_R {
172        CLKIN_R::new((self.bits & 0x1f) as u8)
173    }
174}
175impl W {
176    #[doc = "Bits 0:4 - Clock source number (decimal value) for frequency measure function reference clock:"]
177    #[inline(always)]
178    pub fn clkin(&mut self) -> CLKIN_W<0> {
179        CLKIN_W::new(self)
180    }
181    #[doc = "Writes raw bits to the register."]
182    #[inline(always)]
183    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
184        self.0.bits(bits);
185        self
186    }
187}
188#[doc = "Selection for frequency measurement reference clock.\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 [freqmeas_ref](index.html) module"]
189pub struct FREQMEAS_REF_SPEC;
190impl crate::RegisterSpec for FREQMEAS_REF_SPEC {
191    type Ux = u32;
192}
193#[doc = "`read()` method returns [freqmeas_ref::R](R) reader structure"]
194impl crate::Readable for FREQMEAS_REF_SPEC {
195    type Reader = R;
196}
197#[doc = "`write(|w| ..)` method takes [freqmeas_ref::W](W) writer structure"]
198impl crate::Writable for FREQMEAS_REF_SPEC {
199    type Writer = W;
200}
201#[doc = "`reset()` method sets FREQMEAS_REF to value 0x1f"]
202impl crate::Resettable for FREQMEAS_REF_SPEC {
203    #[inline(always)]
204    fn reset_value() -> Self::Ux {
205        0x1f
206    }
207}