mk20d7/ftm2/fms/
mod.rs

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