s32k116_pac/cmu_fc_0/
sr.rs1#[doc = "Register `SR` reader"]
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SR` writer"]
17pub struct W(crate::W<SR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SR_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<SR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Frequency Lower than Low Frequency Reference Threshold Event Status\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum FLL_A {
40 #[doc = "0: No FLL Event"]
41 _0 = 0,
42 #[doc = "1: FLL Event Occured"]
43 _1 = 1,
44}
45impl From<FLL_A> for bool {
46 #[inline(always)]
47 fn from(variant: FLL_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `FLL` reader - Frequency Lower than Low Frequency Reference Threshold Event Status"]
52pub struct FLL_R(crate::FieldReader<bool, FLL_A>);
53impl FLL_R {
54 #[inline(always)]
55 pub(crate) fn new(bits: bool) -> Self {
56 FLL_R(crate::FieldReader::new(bits))
57 }
58 #[doc = r"Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> FLL_A {
61 match self.bits {
62 false => FLL_A::_0,
63 true => FLL_A::_1,
64 }
65 }
66 #[doc = "Checks if the value of the field is `_0`"]
67 #[inline(always)]
68 pub fn is_0(&self) -> bool {
69 **self == FLL_A::_0
70 }
71 #[doc = "Checks if the value of the field is `_1`"]
72 #[inline(always)]
73 pub fn is_1(&self) -> bool {
74 **self == FLL_A::_1
75 }
76}
77impl core::ops::Deref for FLL_R {
78 type Target = crate::FieldReader<bool, FLL_A>;
79 #[inline(always)]
80 fn deref(&self) -> &Self::Target {
81 &self.0
82 }
83}
84#[doc = "Field `FLL` writer - Frequency Lower than Low Frequency Reference Threshold Event Status"]
85pub struct FLL_W<'a> {
86 w: &'a mut W,
87}
88impl<'a> FLL_W<'a> {
89 #[doc = r"Writes `variant` to the field"]
90 #[inline(always)]
91 pub fn variant(self, variant: FLL_A) -> &'a mut W {
92 self.bit(variant.into())
93 }
94 #[doc = "No FLL Event"]
95 #[inline(always)]
96 pub fn _0(self) -> &'a mut W {
97 self.variant(FLL_A::_0)
98 }
99 #[doc = "FLL Event Occured"]
100 #[inline(always)]
101 pub fn _1(self) -> &'a mut W {
102 self.variant(FLL_A::_1)
103 }
104 #[doc = r"Sets the field bit"]
105 #[inline(always)]
106 pub fn set_bit(self) -> &'a mut W {
107 self.bit(true)
108 }
109 #[doc = r"Clears the field bit"]
110 #[inline(always)]
111 pub fn clear_bit(self) -> &'a mut W {
112 self.bit(false)
113 }
114 #[doc = r"Writes raw bits to the field"]
115 #[inline(always)]
116 pub fn bit(self, value: bool) -> &'a mut W {
117 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
118 self.w
119 }
120}
121#[doc = "Frequency Higher than High Frequency Reference Threshold Event Status\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum FHH_A {
124 #[doc = "0: No FHH Event"]
125 _0 = 0,
126 #[doc = "1: FHH Event Occured"]
127 _1 = 1,
128}
129impl From<FHH_A> for bool {
130 #[inline(always)]
131 fn from(variant: FHH_A) -> Self {
132 variant as u8 != 0
133 }
134}
135#[doc = "Field `FHH` reader - Frequency Higher than High Frequency Reference Threshold Event Status"]
136pub struct FHH_R(crate::FieldReader<bool, FHH_A>);
137impl FHH_R {
138 #[inline(always)]
139 pub(crate) fn new(bits: bool) -> Self {
140 FHH_R(crate::FieldReader::new(bits))
141 }
142 #[doc = r"Get enumerated values variant"]
143 #[inline(always)]
144 pub fn variant(&self) -> FHH_A {
145 match self.bits {
146 false => FHH_A::_0,
147 true => FHH_A::_1,
148 }
149 }
150 #[doc = "Checks if the value of the field is `_0`"]
151 #[inline(always)]
152 pub fn is_0(&self) -> bool {
153 **self == FHH_A::_0
154 }
155 #[doc = "Checks if the value of the field is `_1`"]
156 #[inline(always)]
157 pub fn is_1(&self) -> bool {
158 **self == FHH_A::_1
159 }
160}
161impl core::ops::Deref for FHH_R {
162 type Target = crate::FieldReader<bool, FHH_A>;
163 #[inline(always)]
164 fn deref(&self) -> &Self::Target {
165 &self.0
166 }
167}
168#[doc = "Field `FHH` writer - Frequency Higher than High Frequency Reference Threshold Event Status"]
169pub struct FHH_W<'a> {
170 w: &'a mut W,
171}
172impl<'a> FHH_W<'a> {
173 #[doc = r"Writes `variant` to the field"]
174 #[inline(always)]
175 pub fn variant(self, variant: FHH_A) -> &'a mut W {
176 self.bit(variant.into())
177 }
178 #[doc = "No FHH Event"]
179 #[inline(always)]
180 pub fn _0(self) -> &'a mut W {
181 self.variant(FHH_A::_0)
182 }
183 #[doc = "FHH Event Occured"]
184 #[inline(always)]
185 pub fn _1(self) -> &'a mut W {
186 self.variant(FHH_A::_1)
187 }
188 #[doc = r"Sets the field bit"]
189 #[inline(always)]
190 pub fn set_bit(self) -> &'a mut W {
191 self.bit(true)
192 }
193 #[doc = r"Clears the field bit"]
194 #[inline(always)]
195 pub fn clear_bit(self) -> &'a mut W {
196 self.bit(false)
197 }
198 #[doc = r"Writes raw bits to the field"]
199 #[inline(always)]
200 pub fn bit(self, value: bool) -> &'a mut W {
201 self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
202 self.w
203 }
204}
205#[doc = "Module State\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207#[repr(u8)]
208pub enum STATE_A {
209 #[doc = "0: Configure State- Configuration registers and CMU_FC_IER programming is getting done"]
210 _00 = 0,
211 #[doc = "1: Initialization State- Register configurations are getting loaded internally."]
212 _01 = 1,
213 #[doc = "2: Initialization Wait State- The module stays in this state for 1 bus clock cycle."]
214 _10 = 2,
215 #[doc = "3: Frequency Check State- The module is ready to start frequency check operation in this state."]
216 _11 = 3,
217}
218impl From<STATE_A> for u8 {
219 #[inline(always)]
220 fn from(variant: STATE_A) -> Self {
221 variant as _
222 }
223}
224#[doc = "Field `STATE` reader - Module State"]
225pub struct STATE_R(crate::FieldReader<u8, STATE_A>);
226impl STATE_R {
227 #[inline(always)]
228 pub(crate) fn new(bits: u8) -> Self {
229 STATE_R(crate::FieldReader::new(bits))
230 }
231 #[doc = r"Get enumerated values variant"]
232 #[inline(always)]
233 pub fn variant(&self) -> STATE_A {
234 match self.bits {
235 0 => STATE_A::_00,
236 1 => STATE_A::_01,
237 2 => STATE_A::_10,
238 3 => STATE_A::_11,
239 _ => unreachable!(),
240 }
241 }
242 #[doc = "Checks if the value of the field is `_00`"]
243 #[inline(always)]
244 pub fn is_00(&self) -> bool {
245 **self == STATE_A::_00
246 }
247 #[doc = "Checks if the value of the field is `_01`"]
248 #[inline(always)]
249 pub fn is_01(&self) -> bool {
250 **self == STATE_A::_01
251 }
252 #[doc = "Checks if the value of the field is `_10`"]
253 #[inline(always)]
254 pub fn is_10(&self) -> bool {
255 **self == STATE_A::_10
256 }
257 #[doc = "Checks if the value of the field is `_11`"]
258 #[inline(always)]
259 pub fn is_11(&self) -> bool {
260 **self == STATE_A::_11
261 }
262}
263impl core::ops::Deref for STATE_R {
264 type Target = crate::FieldReader<u8, STATE_A>;
265 #[inline(always)]
266 fn deref(&self) -> &Self::Target {
267 &self.0
268 }
269}
270#[doc = "Run Status\n\nValue on reset: 0"]
271#[derive(Clone, Copy, Debug, PartialEq)]
272pub enum RS_A {
273 #[doc = "0: Frequency Check Stopped"]
274 _0 = 0,
275 #[doc = "1: Frequency Check Running"]
276 _1 = 1,
277}
278impl From<RS_A> for bool {
279 #[inline(always)]
280 fn from(variant: RS_A) -> Self {
281 variant as u8 != 0
282 }
283}
284#[doc = "Field `RS` reader - Run Status"]
285pub struct RS_R(crate::FieldReader<bool, RS_A>);
286impl RS_R {
287 #[inline(always)]
288 pub(crate) fn new(bits: bool) -> Self {
289 RS_R(crate::FieldReader::new(bits))
290 }
291 #[doc = r"Get enumerated values variant"]
292 #[inline(always)]
293 pub fn variant(&self) -> RS_A {
294 match self.bits {
295 false => RS_A::_0,
296 true => RS_A::_1,
297 }
298 }
299 #[doc = "Checks if the value of the field is `_0`"]
300 #[inline(always)]
301 pub fn is_0(&self) -> bool {
302 **self == RS_A::_0
303 }
304 #[doc = "Checks if the value of the field is `_1`"]
305 #[inline(always)]
306 pub fn is_1(&self) -> bool {
307 **self == RS_A::_1
308 }
309}
310impl core::ops::Deref for RS_R {
311 type Target = crate::FieldReader<bool, RS_A>;
312 #[inline(always)]
313 fn deref(&self) -> &Self::Target {
314 &self.0
315 }
316}
317impl R {
318 #[doc = "Bit 0 - Frequency Lower than Low Frequency Reference Threshold Event Status"]
319 #[inline(always)]
320 pub fn fll(&self) -> FLL_R {
321 FLL_R::new((self.bits & 0x01) != 0)
322 }
323 #[doc = "Bit 1 - Frequency Higher than High Frequency Reference Threshold Event Status"]
324 #[inline(always)]
325 pub fn fhh(&self) -> FHH_R {
326 FHH_R::new(((self.bits >> 1) & 0x01) != 0)
327 }
328 #[doc = "Bits 2:3 - Module State"]
329 #[inline(always)]
330 pub fn state(&self) -> STATE_R {
331 STATE_R::new(((self.bits >> 2) & 0x03) as u8)
332 }
333 #[doc = "Bit 4 - Run Status"]
334 #[inline(always)]
335 pub fn rs(&self) -> RS_R {
336 RS_R::new(((self.bits >> 4) & 0x01) != 0)
337 }
338}
339impl W {
340 #[doc = "Bit 0 - Frequency Lower than Low Frequency Reference Threshold Event Status"]
341 #[inline(always)]
342 pub fn fll(&mut self) -> FLL_W {
343 FLL_W { w: self }
344 }
345 #[doc = "Bit 1 - Frequency Higher than High Frequency Reference Threshold Event Status"]
346 #[inline(always)]
347 pub fn fhh(&mut self) -> FHH_W {
348 FHH_W { w: self }
349 }
350 #[doc = "Writes raw bits to the register."]
351 #[inline(always)]
352 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
353 self.0.bits(bits);
354 self
355 }
356}
357#[doc = "CMU Frequency Check Status Register\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 [sr](index.html) module"]
358pub struct SR_SPEC;
359impl crate::RegisterSpec for SR_SPEC {
360 type Ux = u32;
361}
362#[doc = "`read()` method returns [sr::R](R) reader structure"]
363impl crate::Readable for SR_SPEC {
364 type Reader = R;
365}
366#[doc = "`write(|w| ..)` method takes [sr::W](W) writer structure"]
367impl crate::Writable for SR_SPEC {
368 type Writer = W;
369}
370#[doc = "`reset()` method sets SR to value 0"]
371impl crate::Resettable for SR_SPEC {
372 #[inline(always)]
373 fn reset_value() -> Self::Ux {
374 0
375 }
376}