s32k144_pac/ftm1/
fms.rs

1#[doc = "Register `FMS` reader"]
2pub struct R(crate::R<FMS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FMS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FMS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FMS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FMS` writer"]
17pub struct W(crate::W<FMS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FMS_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<FMS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FMS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Fault Detection Flag 0\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum FAULTF0_A {
40    #[doc = "0: No fault condition was detected at the fault input."]
41    _0 = 0,
42    #[doc = "1: A fault condition was detected at the fault input."]
43    _1 = 1,
44}
45impl From<FAULTF0_A> for bool {
46    #[inline(always)]
47    fn from(variant: FAULTF0_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `FAULTF0` reader - Fault Detection Flag 0"]
52pub struct FAULTF0_R(crate::FieldReader<bool, FAULTF0_A>);
53impl FAULTF0_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        FAULTF0_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> FAULTF0_A {
61        match self.bits {
62            false => FAULTF0_A::_0,
63            true => FAULTF0_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 == FAULTF0_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 == FAULTF0_A::_1
75    }
76}
77impl core::ops::Deref for FAULTF0_R {
78    type Target = crate::FieldReader<bool, FAULTF0_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Fault Detection Flag 1\n\nValue on reset: 0"]
85#[derive(Clone, Copy, Debug, PartialEq)]
86pub enum FAULTF1_A {
87    #[doc = "0: No fault condition was detected at the fault input."]
88    _0 = 0,
89    #[doc = "1: A fault condition was detected at the fault input."]
90    _1 = 1,
91}
92impl From<FAULTF1_A> for bool {
93    #[inline(always)]
94    fn from(variant: FAULTF1_A) -> Self {
95        variant as u8 != 0
96    }
97}
98#[doc = "Field `FAULTF1` reader - Fault Detection Flag 1"]
99pub struct FAULTF1_R(crate::FieldReader<bool, FAULTF1_A>);
100impl FAULTF1_R {
101    #[inline(always)]
102    pub(crate) fn new(bits: bool) -> Self {
103        FAULTF1_R(crate::FieldReader::new(bits))
104    }
105    #[doc = r"Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> FAULTF1_A {
108        match self.bits {
109            false => FAULTF1_A::_0,
110            true => FAULTF1_A::_1,
111        }
112    }
113    #[doc = "Checks if the value of the field is `_0`"]
114    #[inline(always)]
115    pub fn is_0(&self) -> bool {
116        **self == FAULTF1_A::_0
117    }
118    #[doc = "Checks if the value of the field is `_1`"]
119    #[inline(always)]
120    pub fn is_1(&self) -> bool {
121        **self == FAULTF1_A::_1
122    }
123}
124impl core::ops::Deref for FAULTF1_R {
125    type Target = crate::FieldReader<bool, FAULTF1_A>;
126    #[inline(always)]
127    fn deref(&self) -> &Self::Target {
128        &self.0
129    }
130}
131#[doc = "Fault Detection Flag 2\n\nValue on reset: 0"]
132#[derive(Clone, Copy, Debug, PartialEq)]
133pub enum FAULTF2_A {
134    #[doc = "0: No fault condition was detected at the fault input."]
135    _0 = 0,
136    #[doc = "1: A fault condition was detected at the fault input."]
137    _1 = 1,
138}
139impl From<FAULTF2_A> for bool {
140    #[inline(always)]
141    fn from(variant: FAULTF2_A) -> Self {
142        variant as u8 != 0
143    }
144}
145#[doc = "Field `FAULTF2` reader - Fault Detection Flag 2"]
146pub struct FAULTF2_R(crate::FieldReader<bool, FAULTF2_A>);
147impl FAULTF2_R {
148    #[inline(always)]
149    pub(crate) fn new(bits: bool) -> Self {
150        FAULTF2_R(crate::FieldReader::new(bits))
151    }
152    #[doc = r"Get enumerated values variant"]
153    #[inline(always)]
154    pub fn variant(&self) -> FAULTF2_A {
155        match self.bits {
156            false => FAULTF2_A::_0,
157            true => FAULTF2_A::_1,
158        }
159    }
160    #[doc = "Checks if the value of the field is `_0`"]
161    #[inline(always)]
162    pub fn is_0(&self) -> bool {
163        **self == FAULTF2_A::_0
164    }
165    #[doc = "Checks if the value of the field is `_1`"]
166    #[inline(always)]
167    pub fn is_1(&self) -> bool {
168        **self == FAULTF2_A::_1
169    }
170}
171impl core::ops::Deref for FAULTF2_R {
172    type Target = crate::FieldReader<bool, FAULTF2_A>;
173    #[inline(always)]
174    fn deref(&self) -> &Self::Target {
175        &self.0
176    }
177}
178#[doc = "Fault Detection Flag 3\n\nValue on reset: 0"]
179#[derive(Clone, Copy, Debug, PartialEq)]
180pub enum FAULTF3_A {
181    #[doc = "0: No fault condition was detected at the fault input."]
182    _0 = 0,
183    #[doc = "1: A fault condition was detected at the fault input."]
184    _1 = 1,
185}
186impl From<FAULTF3_A> for bool {
187    #[inline(always)]
188    fn from(variant: FAULTF3_A) -> Self {
189        variant as u8 != 0
190    }
191}
192#[doc = "Field `FAULTF3` reader - Fault Detection Flag 3"]
193pub struct FAULTF3_R(crate::FieldReader<bool, FAULTF3_A>);
194impl FAULTF3_R {
195    #[inline(always)]
196    pub(crate) fn new(bits: bool) -> Self {
197        FAULTF3_R(crate::FieldReader::new(bits))
198    }
199    #[doc = r"Get enumerated values variant"]
200    #[inline(always)]
201    pub fn variant(&self) -> FAULTF3_A {
202        match self.bits {
203            false => FAULTF3_A::_0,
204            true => FAULTF3_A::_1,
205        }
206    }
207    #[doc = "Checks if the value of the field is `_0`"]
208    #[inline(always)]
209    pub fn is_0(&self) -> bool {
210        **self == FAULTF3_A::_0
211    }
212    #[doc = "Checks if the value of the field is `_1`"]
213    #[inline(always)]
214    pub fn is_1(&self) -> bool {
215        **self == FAULTF3_A::_1
216    }
217}
218impl core::ops::Deref for FAULTF3_R {
219    type Target = crate::FieldReader<bool, FAULTF3_A>;
220    #[inline(always)]
221    fn deref(&self) -> &Self::Target {
222        &self.0
223    }
224}
225#[doc = "Fault Inputs\n\nValue on reset: 0"]
226#[derive(Clone, Copy, Debug, PartialEq)]
227pub enum FAULTIN_A {
228    #[doc = "0: The logic OR of the enabled fault inputs is 0."]
229    _0 = 0,
230    #[doc = "1: The logic OR of the enabled fault inputs is 1."]
231    _1 = 1,
232}
233impl From<FAULTIN_A> for bool {
234    #[inline(always)]
235    fn from(variant: FAULTIN_A) -> Self {
236        variant as u8 != 0
237    }
238}
239#[doc = "Field `FAULTIN` reader - Fault Inputs"]
240pub struct FAULTIN_R(crate::FieldReader<bool, FAULTIN_A>);
241impl FAULTIN_R {
242    #[inline(always)]
243    pub(crate) fn new(bits: bool) -> Self {
244        FAULTIN_R(crate::FieldReader::new(bits))
245    }
246    #[doc = r"Get enumerated values variant"]
247    #[inline(always)]
248    pub fn variant(&self) -> FAULTIN_A {
249        match self.bits {
250            false => FAULTIN_A::_0,
251            true => FAULTIN_A::_1,
252        }
253    }
254    #[doc = "Checks if the value of the field is `_0`"]
255    #[inline(always)]
256    pub fn is_0(&self) -> bool {
257        **self == FAULTIN_A::_0
258    }
259    #[doc = "Checks if the value of the field is `_1`"]
260    #[inline(always)]
261    pub fn is_1(&self) -> bool {
262        **self == FAULTIN_A::_1
263    }
264}
265impl core::ops::Deref for FAULTIN_R {
266    type Target = crate::FieldReader<bool, FAULTIN_A>;
267    #[inline(always)]
268    fn deref(&self) -> &Self::Target {
269        &self.0
270    }
271}
272#[doc = "Write Protection Enable\n\nValue on reset: 0"]
273#[derive(Clone, Copy, Debug, PartialEq)]
274pub enum WPEN_A {
275    #[doc = "0: Write protection is disabled. Write protected bits can be written."]
276    _0 = 0,
277    #[doc = "1: Write protection is enabled. Write protected bits cannot be written."]
278    _1 = 1,
279}
280impl From<WPEN_A> for bool {
281    #[inline(always)]
282    fn from(variant: WPEN_A) -> Self {
283        variant as u8 != 0
284    }
285}
286#[doc = "Field `WPEN` reader - Write Protection Enable"]
287pub struct WPEN_R(crate::FieldReader<bool, WPEN_A>);
288impl WPEN_R {
289    #[inline(always)]
290    pub(crate) fn new(bits: bool) -> Self {
291        WPEN_R(crate::FieldReader::new(bits))
292    }
293    #[doc = r"Get enumerated values variant"]
294    #[inline(always)]
295    pub fn variant(&self) -> WPEN_A {
296        match self.bits {
297            false => WPEN_A::_0,
298            true => WPEN_A::_1,
299        }
300    }
301    #[doc = "Checks if the value of the field is `_0`"]
302    #[inline(always)]
303    pub fn is_0(&self) -> bool {
304        **self == WPEN_A::_0
305    }
306    #[doc = "Checks if the value of the field is `_1`"]
307    #[inline(always)]
308    pub fn is_1(&self) -> bool {
309        **self == WPEN_A::_1
310    }
311}
312impl core::ops::Deref for WPEN_R {
313    type Target = crate::FieldReader<bool, WPEN_A>;
314    #[inline(always)]
315    fn deref(&self) -> &Self::Target {
316        &self.0
317    }
318}
319#[doc = "Field `WPEN` writer - Write Protection Enable"]
320pub struct WPEN_W<'a> {
321    w: &'a mut W,
322}
323impl<'a> WPEN_W<'a> {
324    #[doc = r"Writes `variant` to the field"]
325    #[inline(always)]
326    pub fn variant(self, variant: WPEN_A) -> &'a mut W {
327        self.bit(variant.into())
328    }
329    #[doc = "Write protection is disabled. Write protected bits can be written."]
330    #[inline(always)]
331    pub fn _0(self) -> &'a mut W {
332        self.variant(WPEN_A::_0)
333    }
334    #[doc = "Write protection is enabled. Write protected bits cannot be written."]
335    #[inline(always)]
336    pub fn _1(self) -> &'a mut W {
337        self.variant(WPEN_A::_1)
338    }
339    #[doc = r"Sets the field bit"]
340    #[inline(always)]
341    pub fn set_bit(self) -> &'a mut W {
342        self.bit(true)
343    }
344    #[doc = r"Clears the field bit"]
345    #[inline(always)]
346    pub fn clear_bit(self) -> &'a mut W {
347        self.bit(false)
348    }
349    #[doc = r"Writes raw bits to the field"]
350    #[inline(always)]
351    pub fn bit(self, value: bool) -> &'a mut W {
352        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
353        self.w
354    }
355}
356#[doc = "Fault Detection Flag\n\nValue on reset: 0"]
357#[derive(Clone, Copy, Debug, PartialEq)]
358pub enum FAULTF_A {
359    #[doc = "0: No fault condition was detected."]
360    _0 = 0,
361    #[doc = "1: A fault condition was detected."]
362    _1 = 1,
363}
364impl From<FAULTF_A> for bool {
365    #[inline(always)]
366    fn from(variant: FAULTF_A) -> Self {
367        variant as u8 != 0
368    }
369}
370#[doc = "Field `FAULTF` reader - Fault Detection Flag"]
371pub struct FAULTF_R(crate::FieldReader<bool, FAULTF_A>);
372impl FAULTF_R {
373    #[inline(always)]
374    pub(crate) fn new(bits: bool) -> Self {
375        FAULTF_R(crate::FieldReader::new(bits))
376    }
377    #[doc = r"Get enumerated values variant"]
378    #[inline(always)]
379    pub fn variant(&self) -> FAULTF_A {
380        match self.bits {
381            false => FAULTF_A::_0,
382            true => FAULTF_A::_1,
383        }
384    }
385    #[doc = "Checks if the value of the field is `_0`"]
386    #[inline(always)]
387    pub fn is_0(&self) -> bool {
388        **self == FAULTF_A::_0
389    }
390    #[doc = "Checks if the value of the field is `_1`"]
391    #[inline(always)]
392    pub fn is_1(&self) -> bool {
393        **self == FAULTF_A::_1
394    }
395}
396impl core::ops::Deref for FAULTF_R {
397    type Target = crate::FieldReader<bool, FAULTF_A>;
398    #[inline(always)]
399    fn deref(&self) -> &Self::Target {
400        &self.0
401    }
402}
403impl R {
404    #[doc = "Bit 0 - Fault Detection Flag 0"]
405    #[inline(always)]
406    pub fn faultf0(&self) -> FAULTF0_R {
407        FAULTF0_R::new((self.bits & 0x01) != 0)
408    }
409    #[doc = "Bit 1 - Fault Detection Flag 1"]
410    #[inline(always)]
411    pub fn faultf1(&self) -> FAULTF1_R {
412        FAULTF1_R::new(((self.bits >> 1) & 0x01) != 0)
413    }
414    #[doc = "Bit 2 - Fault Detection Flag 2"]
415    #[inline(always)]
416    pub fn faultf2(&self) -> FAULTF2_R {
417        FAULTF2_R::new(((self.bits >> 2) & 0x01) != 0)
418    }
419    #[doc = "Bit 3 - Fault Detection Flag 3"]
420    #[inline(always)]
421    pub fn faultf3(&self) -> FAULTF3_R {
422        FAULTF3_R::new(((self.bits >> 3) & 0x01) != 0)
423    }
424    #[doc = "Bit 5 - Fault Inputs"]
425    #[inline(always)]
426    pub fn faultin(&self) -> FAULTIN_R {
427        FAULTIN_R::new(((self.bits >> 5) & 0x01) != 0)
428    }
429    #[doc = "Bit 6 - Write Protection Enable"]
430    #[inline(always)]
431    pub fn wpen(&self) -> WPEN_R {
432        WPEN_R::new(((self.bits >> 6) & 0x01) != 0)
433    }
434    #[doc = "Bit 7 - Fault Detection Flag"]
435    #[inline(always)]
436    pub fn faultf(&self) -> FAULTF_R {
437        FAULTF_R::new(((self.bits >> 7) & 0x01) != 0)
438    }
439}
440impl W {
441    #[doc = "Bit 6 - Write Protection Enable"]
442    #[inline(always)]
443    pub fn wpen(&mut self) -> WPEN_W {
444        WPEN_W { w: self }
445    }
446    #[doc = "Writes raw bits to the register."]
447    #[inline(always)]
448    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
449        self.0.bits(bits);
450        self
451    }
452}
453#[doc = "Fault Mode Status\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 [fms](index.html) module"]
454pub struct FMS_SPEC;
455impl crate::RegisterSpec for FMS_SPEC {
456    type Ux = u32;
457}
458#[doc = "`read()` method returns [fms::R](R) reader structure"]
459impl crate::Readable for FMS_SPEC {
460    type Reader = R;
461}
462#[doc = "`write(|w| ..)` method takes [fms::W](W) writer structure"]
463impl crate::Writable for FMS_SPEC {
464    type Writer = W;
465}
466#[doc = "`reset()` method sets FMS to value 0"]
467impl crate::Resettable for FMS_SPEC {
468    #[inline(always)]
469    fn reset_value() -> Self::Ux {
470        0
471    }
472}