1#[doc = "Reader of register FMS"]
2pub type R = crate::R<u32, super::FMS>;
3#[doc = "Writer for register FMS"]
4pub type W = crate::W<u32, super::FMS>;
5#[doc = "Register FMS `reset()`'s with value 0"]
6impl crate::ResetValue for super::FMS {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Fault Detection Flag 0\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum FAULTF0_A {
16    #[doc = "0: No fault condition was detected at the fault input."]
17    _0,
18    #[doc = "1: A fault condition was detected at the fault input."]
19    _1,
20}
21impl From<FAULTF0_A> for bool {
22    #[inline(always)]
23    fn from(variant: FAULTF0_A) -> Self {
24        match variant {
25            FAULTF0_A::_0 => false,
26            FAULTF0_A::_1 => true,
27        }
28    }
29}
30#[doc = "Reader of field `FAULTF0`"]
31pub type FAULTF0_R = crate::R<bool, FAULTF0_A>;
32impl FAULTF0_R {
33    #[doc = r"Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> FAULTF0_A {
36        match self.bits {
37            false => FAULTF0_A::_0,
38            true => FAULTF0_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == FAULTF0_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == FAULTF0_A::_1
50    }
51}
52#[doc = "Write proxy for field `FAULTF0`"]
53pub struct FAULTF0_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> FAULTF0_W<'a> {
57    #[doc = r"Writes `variant` to the field"]
58    #[inline(always)]
59    pub fn variant(self, variant: FAULTF0_A) -> &'a mut W {
60        {
61            self.bit(variant.into())
62        }
63    }
64    #[doc = "No fault condition was detected at the fault input."]
65    #[inline(always)]
66    pub fn _0(self) -> &'a mut W {
67        self.variant(FAULTF0_A::_0)
68    }
69    #[doc = "A fault condition was detected at the fault input."]
70    #[inline(always)]
71    pub fn _1(self) -> &'a mut W {
72        self.variant(FAULTF0_A::_1)
73    }
74    #[doc = r"Sets the field bit"]
75    #[inline(always)]
76    pub fn set_bit(self) -> &'a mut W {
77        self.bit(true)
78    }
79    #[doc = r"Clears the field bit"]
80    #[inline(always)]
81    pub fn clear_bit(self) -> &'a mut W {
82        self.bit(false)
83    }
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub fn bit(self, value: bool) -> &'a mut W {
87        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
88        self.w
89    }
90}
91#[doc = "Fault Detection Flag 1\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum FAULTF1_A {
94    #[doc = "0: No fault condition was detected at the fault input."]
95    _0,
96    #[doc = "1: A fault condition was detected at the fault input."]
97    _1,
98}
99impl From<FAULTF1_A> for bool {
100    #[inline(always)]
101    fn from(variant: FAULTF1_A) -> Self {
102        match variant {
103            FAULTF1_A::_0 => false,
104            FAULTF1_A::_1 => true,
105        }
106    }
107}
108#[doc = "Reader of field `FAULTF1`"]
109pub type FAULTF1_R = crate::R<bool, FAULTF1_A>;
110impl FAULTF1_R {
111    #[doc = r"Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> FAULTF1_A {
114        match self.bits {
115            false => FAULTF1_A::_0,
116            true => FAULTF1_A::_1,
117        }
118    }
119    #[doc = "Checks if the value of the field is `_0`"]
120    #[inline(always)]
121    pub fn is_0(&self) -> bool {
122        *self == FAULTF1_A::_0
123    }
124    #[doc = "Checks if the value of the field is `_1`"]
125    #[inline(always)]
126    pub fn is_1(&self) -> bool {
127        *self == FAULTF1_A::_1
128    }
129}
130#[doc = "Write proxy for field `FAULTF1`"]
131pub struct FAULTF1_W<'a> {
132    w: &'a mut W,
133}
134impl<'a> FAULTF1_W<'a> {
135    #[doc = r"Writes `variant` to the field"]
136    #[inline(always)]
137    pub fn variant(self, variant: FAULTF1_A) -> &'a mut W {
138        {
139            self.bit(variant.into())
140        }
141    }
142    #[doc = "No fault condition was detected at the fault input."]
143    #[inline(always)]
144    pub fn _0(self) -> &'a mut W {
145        self.variant(FAULTF1_A::_0)
146    }
147    #[doc = "A fault condition was detected at the fault input."]
148    #[inline(always)]
149    pub fn _1(self) -> &'a mut W {
150        self.variant(FAULTF1_A::_1)
151    }
152    #[doc = r"Sets the field bit"]
153    #[inline(always)]
154    pub fn set_bit(self) -> &'a mut W {
155        self.bit(true)
156    }
157    #[doc = r"Clears the field bit"]
158    #[inline(always)]
159    pub fn clear_bit(self) -> &'a mut W {
160        self.bit(false)
161    }
162    #[doc = r"Writes raw bits to the field"]
163    #[inline(always)]
164    pub fn bit(self, value: bool) -> &'a mut W {
165        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
166        self.w
167    }
168}
169#[doc = "Fault Detection Flag 2\n\nValue on reset: 0"]
170#[derive(Clone, Copy, Debug, PartialEq)]
171pub enum FAULTF2_A {
172    #[doc = "0: No fault condition was detected at the fault input."]
173    _0,
174    #[doc = "1: A fault condition was detected at the fault input."]
175    _1,
176}
177impl From<FAULTF2_A> for bool {
178    #[inline(always)]
179    fn from(variant: FAULTF2_A) -> Self {
180        match variant {
181            FAULTF2_A::_0 => false,
182            FAULTF2_A::_1 => true,
183        }
184    }
185}
186#[doc = "Reader of field `FAULTF2`"]
187pub type FAULTF2_R = crate::R<bool, FAULTF2_A>;
188impl FAULTF2_R {
189    #[doc = r"Get enumerated values variant"]
190    #[inline(always)]
191    pub fn variant(&self) -> FAULTF2_A {
192        match self.bits {
193            false => FAULTF2_A::_0,
194            true => FAULTF2_A::_1,
195        }
196    }
197    #[doc = "Checks if the value of the field is `_0`"]
198    #[inline(always)]
199    pub fn is_0(&self) -> bool {
200        *self == FAULTF2_A::_0
201    }
202    #[doc = "Checks if the value of the field is `_1`"]
203    #[inline(always)]
204    pub fn is_1(&self) -> bool {
205        *self == FAULTF2_A::_1
206    }
207}
208#[doc = "Write proxy for field `FAULTF2`"]
209pub struct FAULTF2_W<'a> {
210    w: &'a mut W,
211}
212impl<'a> FAULTF2_W<'a> {
213    #[doc = r"Writes `variant` to the field"]
214    #[inline(always)]
215    pub fn variant(self, variant: FAULTF2_A) -> &'a mut W {
216        {
217            self.bit(variant.into())
218        }
219    }
220    #[doc = "No fault condition was detected at the fault input."]
221    #[inline(always)]
222    pub fn _0(self) -> &'a mut W {
223        self.variant(FAULTF2_A::_0)
224    }
225    #[doc = "A fault condition was detected at the fault input."]
226    #[inline(always)]
227    pub fn _1(self) -> &'a mut W {
228        self.variant(FAULTF2_A::_1)
229    }
230    #[doc = r"Sets the field bit"]
231    #[inline(always)]
232    pub fn set_bit(self) -> &'a mut W {
233        self.bit(true)
234    }
235    #[doc = r"Clears the field bit"]
236    #[inline(always)]
237    pub fn clear_bit(self) -> &'a mut W {
238        self.bit(false)
239    }
240    #[doc = r"Writes raw bits to the field"]
241    #[inline(always)]
242    pub fn bit(self, value: bool) -> &'a mut W {
243        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
244        self.w
245    }
246}
247#[doc = "Fault Detection Flag 3\n\nValue on reset: 0"]
248#[derive(Clone, Copy, Debug, PartialEq)]
249pub enum FAULTF3_A {
250    #[doc = "0: No fault condition was detected at the fault input."]
251    _0,
252    #[doc = "1: A fault condition was detected at the fault input."]
253    _1,
254}
255impl From<FAULTF3_A> for bool {
256    #[inline(always)]
257    fn from(variant: FAULTF3_A) -> Self {
258        match variant {
259            FAULTF3_A::_0 => false,
260            FAULTF3_A::_1 => true,
261        }
262    }
263}
264#[doc = "Reader of field `FAULTF3`"]
265pub type FAULTF3_R = crate::R<bool, FAULTF3_A>;
266impl FAULTF3_R {
267    #[doc = r"Get enumerated values variant"]
268    #[inline(always)]
269    pub fn variant(&self) -> FAULTF3_A {
270        match self.bits {
271            false => FAULTF3_A::_0,
272            true => FAULTF3_A::_1,
273        }
274    }
275    #[doc = "Checks if the value of the field is `_0`"]
276    #[inline(always)]
277    pub fn is_0(&self) -> bool {
278        *self == FAULTF3_A::_0
279    }
280    #[doc = "Checks if the value of the field is `_1`"]
281    #[inline(always)]
282    pub fn is_1(&self) -> bool {
283        *self == FAULTF3_A::_1
284    }
285}
286#[doc = "Write proxy for field `FAULTF3`"]
287pub struct FAULTF3_W<'a> {
288    w: &'a mut W,
289}
290impl<'a> FAULTF3_W<'a> {
291    #[doc = r"Writes `variant` to the field"]
292    #[inline(always)]
293    pub fn variant(self, variant: FAULTF3_A) -> &'a mut W {
294        {
295            self.bit(variant.into())
296        }
297    }
298    #[doc = "No fault condition was detected at the fault input."]
299    #[inline(always)]
300    pub fn _0(self) -> &'a mut W {
301        self.variant(FAULTF3_A::_0)
302    }
303    #[doc = "A fault condition was detected at the fault input."]
304    #[inline(always)]
305    pub fn _1(self) -> &'a mut W {
306        self.variant(FAULTF3_A::_1)
307    }
308    #[doc = r"Sets the field bit"]
309    #[inline(always)]
310    pub fn set_bit(self) -> &'a mut W {
311        self.bit(true)
312    }
313    #[doc = r"Clears the field bit"]
314    #[inline(always)]
315    pub fn clear_bit(self) -> &'a mut W {
316        self.bit(false)
317    }
318    #[doc = r"Writes raw bits to the field"]
319    #[inline(always)]
320    pub fn bit(self, value: bool) -> &'a mut W {
321        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
322        self.w
323    }
324}
325#[doc = "Fault Inputs\n\nValue on reset: 0"]
326#[derive(Clone, Copy, Debug, PartialEq)]
327pub enum FAULTIN_A {
328    #[doc = "0: The logic OR of the enabled fault inputs is 0."]
329    _0,
330    #[doc = "1: The logic OR of the enabled fault inputs is 1."]
331    _1,
332}
333impl From<FAULTIN_A> for bool {
334    #[inline(always)]
335    fn from(variant: FAULTIN_A) -> Self {
336        match variant {
337            FAULTIN_A::_0 => false,
338            FAULTIN_A::_1 => true,
339        }
340    }
341}
342#[doc = "Reader of field `FAULTIN`"]
343pub type FAULTIN_R = crate::R<bool, FAULTIN_A>;
344impl FAULTIN_R {
345    #[doc = r"Get enumerated values variant"]
346    #[inline(always)]
347    pub fn variant(&self) -> FAULTIN_A {
348        match self.bits {
349            false => FAULTIN_A::_0,
350            true => FAULTIN_A::_1,
351        }
352    }
353    #[doc = "Checks if the value of the field is `_0`"]
354    #[inline(always)]
355    pub fn is_0(&self) -> bool {
356        *self == FAULTIN_A::_0
357    }
358    #[doc = "Checks if the value of the field is `_1`"]
359    #[inline(always)]
360    pub fn is_1(&self) -> bool {
361        *self == FAULTIN_A::_1
362    }
363}
364#[doc = "Write Protection Enable\n\nValue on reset: 0"]
365#[derive(Clone, Copy, Debug, PartialEq)]
366pub enum WPEN_A {
367    #[doc = "0: Write protection is disabled. Write protected bits can be written."]
368    _0,
369    #[doc = "1: Write protection is enabled. Write protected bits cannot be written."]
370    _1,
371}
372impl From<WPEN_A> for bool {
373    #[inline(always)]
374    fn from(variant: WPEN_A) -> Self {
375        match variant {
376            WPEN_A::_0 => false,
377            WPEN_A::_1 => true,
378        }
379    }
380}
381#[doc = "Reader of field `WPEN`"]
382pub type WPEN_R = crate::R<bool, WPEN_A>;
383impl WPEN_R {
384    #[doc = r"Get enumerated values variant"]
385    #[inline(always)]
386    pub fn variant(&self) -> WPEN_A {
387        match self.bits {
388            false => WPEN_A::_0,
389            true => WPEN_A::_1,
390        }
391    }
392    #[doc = "Checks if the value of the field is `_0`"]
393    #[inline(always)]
394    pub fn is_0(&self) -> bool {
395        *self == WPEN_A::_0
396    }
397    #[doc = "Checks if the value of the field is `_1`"]
398    #[inline(always)]
399    pub fn is_1(&self) -> bool {
400        *self == WPEN_A::_1
401    }
402}
403#[doc = "Write proxy for field `WPEN`"]
404pub struct WPEN_W<'a> {
405    w: &'a mut W,
406}
407impl<'a> WPEN_W<'a> {
408    #[doc = r"Writes `variant` to the field"]
409    #[inline(always)]
410    pub fn variant(self, variant: WPEN_A) -> &'a mut W {
411        {
412            self.bit(variant.into())
413        }
414    }
415    #[doc = "Write protection is disabled. Write protected bits can be written."]
416    #[inline(always)]
417    pub fn _0(self) -> &'a mut W {
418        self.variant(WPEN_A::_0)
419    }
420    #[doc = "Write protection is enabled. Write protected bits cannot be written."]
421    #[inline(always)]
422    pub fn _1(self) -> &'a mut W {
423        self.variant(WPEN_A::_1)
424    }
425    #[doc = r"Sets the field bit"]
426    #[inline(always)]
427    pub fn set_bit(self) -> &'a mut W {
428        self.bit(true)
429    }
430    #[doc = r"Clears the field bit"]
431    #[inline(always)]
432    pub fn clear_bit(self) -> &'a mut W {
433        self.bit(false)
434    }
435    #[doc = r"Writes raw bits to the field"]
436    #[inline(always)]
437    pub fn bit(self, value: bool) -> &'a mut W {
438        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
439        self.w
440    }
441}
442#[doc = "Fault Detection Flag\n\nValue on reset: 0"]
443#[derive(Clone, Copy, Debug, PartialEq)]
444pub enum FAULTF_A {
445    #[doc = "0: No fault condition was detected."]
446    _0,
447    #[doc = "1: A fault condition was detected."]
448    _1,
449}
450impl From<FAULTF_A> for bool {
451    #[inline(always)]
452    fn from(variant: FAULTF_A) -> Self {
453        match variant {
454            FAULTF_A::_0 => false,
455            FAULTF_A::_1 => true,
456        }
457    }
458}
459#[doc = "Reader of field `FAULTF`"]
460pub type FAULTF_R = crate::R<bool, FAULTF_A>;
461impl FAULTF_R {
462    #[doc = r"Get enumerated values variant"]
463    #[inline(always)]
464    pub fn variant(&self) -> FAULTF_A {
465        match self.bits {
466            false => FAULTF_A::_0,
467            true => FAULTF_A::_1,
468        }
469    }
470    #[doc = "Checks if the value of the field is `_0`"]
471    #[inline(always)]
472    pub fn is_0(&self) -> bool {
473        *self == FAULTF_A::_0
474    }
475    #[doc = "Checks if the value of the field is `_1`"]
476    #[inline(always)]
477    pub fn is_1(&self) -> bool {
478        *self == FAULTF_A::_1
479    }
480}
481#[doc = "Write proxy for field `FAULTF`"]
482pub struct FAULTF_W<'a> {
483    w: &'a mut W,
484}
485impl<'a> FAULTF_W<'a> {
486    #[doc = r"Writes `variant` to the field"]
487    #[inline(always)]
488    pub fn variant(self, variant: FAULTF_A) -> &'a mut W {
489        {
490            self.bit(variant.into())
491        }
492    }
493    #[doc = "No fault condition was detected."]
494    #[inline(always)]
495    pub fn _0(self) -> &'a mut W {
496        self.variant(FAULTF_A::_0)
497    }
498    #[doc = "A fault condition was detected."]
499    #[inline(always)]
500    pub fn _1(self) -> &'a mut W {
501        self.variant(FAULTF_A::_1)
502    }
503    #[doc = r"Sets the field bit"]
504    #[inline(always)]
505    pub fn set_bit(self) -> &'a mut W {
506        self.bit(true)
507    }
508    #[doc = r"Clears the field bit"]
509    #[inline(always)]
510    pub fn clear_bit(self) -> &'a mut W {
511        self.bit(false)
512    }
513    #[doc = r"Writes raw bits to the field"]
514    #[inline(always)]
515    pub fn bit(self, value: bool) -> &'a mut W {
516        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
517        self.w
518    }
519}
520impl R {
521    #[doc = "Bit 0 - Fault Detection Flag 0"]
522    #[inline(always)]
523    pub fn faultf0(&self) -> FAULTF0_R {
524        FAULTF0_R::new((self.bits & 0x01) != 0)
525    }
526    #[doc = "Bit 1 - Fault Detection Flag 1"]
527    #[inline(always)]
528    pub fn faultf1(&self) -> FAULTF1_R {
529        FAULTF1_R::new(((self.bits >> 1) & 0x01) != 0)
530    }
531    #[doc = "Bit 2 - Fault Detection Flag 2"]
532    #[inline(always)]
533    pub fn faultf2(&self) -> FAULTF2_R {
534        FAULTF2_R::new(((self.bits >> 2) & 0x01) != 0)
535    }
536    #[doc = "Bit 3 - Fault Detection Flag 3"]
537    #[inline(always)]
538    pub fn faultf3(&self) -> FAULTF3_R {
539        FAULTF3_R::new(((self.bits >> 3) & 0x01) != 0)
540    }
541    #[doc = "Bit 5 - Fault Inputs"]
542    #[inline(always)]
543    pub fn faultin(&self) -> FAULTIN_R {
544        FAULTIN_R::new(((self.bits >> 5) & 0x01) != 0)
545    }
546    #[doc = "Bit 6 - Write Protection Enable"]
547    #[inline(always)]
548    pub fn wpen(&self) -> WPEN_R {
549        WPEN_R::new(((self.bits >> 6) & 0x01) != 0)
550    }
551    #[doc = "Bit 7 - Fault Detection Flag"]
552    #[inline(always)]
553    pub fn faultf(&self) -> FAULTF_R {
554        FAULTF_R::new(((self.bits >> 7) & 0x01) != 0)
555    }
556}
557impl W {
558    #[doc = "Bit 0 - Fault Detection Flag 0"]
559    #[inline(always)]
560    pub fn faultf0(&mut self) -> FAULTF0_W {
561        FAULTF0_W { w: self }
562    }
563    #[doc = "Bit 1 - Fault Detection Flag 1"]
564    #[inline(always)]
565    pub fn faultf1(&mut self) -> FAULTF1_W {
566        FAULTF1_W { w: self }
567    }
568    #[doc = "Bit 2 - Fault Detection Flag 2"]
569    #[inline(always)]
570    pub fn faultf2(&mut self) -> FAULTF2_W {
571        FAULTF2_W { w: self }
572    }
573    #[doc = "Bit 3 - Fault Detection Flag 3"]
574    #[inline(always)]
575    pub fn faultf3(&mut self) -> FAULTF3_W {
576        FAULTF3_W { w: self }
577    }
578    #[doc = "Bit 6 - Write Protection Enable"]
579    #[inline(always)]
580    pub fn wpen(&mut self) -> WPEN_W {
581        WPEN_W { w: self }
582    }
583    #[doc = "Bit 7 - Fault Detection Flag"]
584    #[inline(always)]
585    pub fn faultf(&mut self) -> FAULTF_W {
586        FAULTF_W { w: self }
587    }
588}