k66/ftm0/
invctrl.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::INVCTRL {
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 `INV0EN`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum INV0ENR {
48    #[doc = "Inverting is disabled."]
49    _0,
50    #[doc = "Inverting is enabled."]
51    _1,
52}
53impl INV0ENR {
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            INV0ENR::_0 => false,
69            INV0ENR::_1 => true,
70        }
71    }
72    #[allow(missing_docs)]
73    #[doc(hidden)]
74    #[inline]
75    pub fn _from(value: bool) -> INV0ENR {
76        match value {
77            false => INV0ENR::_0,
78            true => INV0ENR::_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 == INV0ENR::_0
85    }
86    #[doc = "Checks if the value of the field is `_1`"]
87    #[inline]
88    pub fn is_1(&self) -> bool {
89        *self == INV0ENR::_1
90    }
91}
92#[doc = "Possible values of the field `INV1EN`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum INV1ENR {
95    #[doc = "Inverting is disabled."]
96    _0,
97    #[doc = "Inverting is enabled."]
98    _1,
99}
100impl INV1ENR {
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            INV1ENR::_0 => false,
116            INV1ENR::_1 => true,
117        }
118    }
119    #[allow(missing_docs)]
120    #[doc(hidden)]
121    #[inline]
122    pub fn _from(value: bool) -> INV1ENR {
123        match value {
124            false => INV1ENR::_0,
125            true => INV1ENR::_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 == INV1ENR::_0
132    }
133    #[doc = "Checks if the value of the field is `_1`"]
134    #[inline]
135    pub fn is_1(&self) -> bool {
136        *self == INV1ENR::_1
137    }
138}
139#[doc = "Possible values of the field `INV2EN`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum INV2ENR {
142    #[doc = "Inverting is disabled."]
143    _0,
144    #[doc = "Inverting is enabled."]
145    _1,
146}
147impl INV2ENR {
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            INV2ENR::_0 => false,
163            INV2ENR::_1 => true,
164        }
165    }
166    #[allow(missing_docs)]
167    #[doc(hidden)]
168    #[inline]
169    pub fn _from(value: bool) -> INV2ENR {
170        match value {
171            false => INV2ENR::_0,
172            true => INV2ENR::_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 == INV2ENR::_0
179    }
180    #[doc = "Checks if the value of the field is `_1`"]
181    #[inline]
182    pub fn is_1(&self) -> bool {
183        *self == INV2ENR::_1
184    }
185}
186#[doc = "Possible values of the field `INV3EN`"]
187#[derive(Clone, Copy, Debug, PartialEq)]
188pub enum INV3ENR {
189    #[doc = "Inverting is disabled."]
190    _0,
191    #[doc = "Inverting is enabled."]
192    _1,
193}
194impl INV3ENR {
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            INV3ENR::_0 => false,
210            INV3ENR::_1 => true,
211        }
212    }
213    #[allow(missing_docs)]
214    #[doc(hidden)]
215    #[inline]
216    pub fn _from(value: bool) -> INV3ENR {
217        match value {
218            false => INV3ENR::_0,
219            true => INV3ENR::_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 == INV3ENR::_0
226    }
227    #[doc = "Checks if the value of the field is `_1`"]
228    #[inline]
229    pub fn is_1(&self) -> bool {
230        *self == INV3ENR::_1
231    }
232}
233#[doc = "Values that can be written to the field `INV0EN`"]
234pub enum INV0ENW {
235    #[doc = "Inverting is disabled."]
236    _0,
237    #[doc = "Inverting is enabled."]
238    _1,
239}
240impl INV0ENW {
241    #[allow(missing_docs)]
242    #[doc(hidden)]
243    #[inline]
244    pub fn _bits(&self) -> bool {
245        match *self {
246            INV0ENW::_0 => false,
247            INV0ENW::_1 => true,
248        }
249    }
250}
251#[doc = r" Proxy"]
252pub struct _INV0ENW<'a> {
253    w: &'a mut W,
254}
255impl<'a> _INV0ENW<'a> {
256    #[doc = r" Writes `variant` to the field"]
257    #[inline]
258    pub fn variant(self, variant: INV0ENW) -> &'a mut W {
259        {
260            self.bit(variant._bits())
261        }
262    }
263    #[doc = "Inverting is disabled."]
264    #[inline]
265    pub fn _0(self) -> &'a mut W {
266        self.variant(INV0ENW::_0)
267    }
268    #[doc = "Inverting is enabled."]
269    #[inline]
270    pub fn _1(self) -> &'a mut W {
271        self.variant(INV0ENW::_1)
272    }
273    #[doc = r" Sets the field bit"]
274    pub fn set_bit(self) -> &'a mut W {
275        self.bit(true)
276    }
277    #[doc = r" Clears the field bit"]
278    pub fn clear_bit(self) -> &'a mut W {
279        self.bit(false)
280    }
281    #[doc = r" Writes raw bits to the field"]
282    #[inline]
283    pub fn bit(self, value: bool) -> &'a mut W {
284        const MASK: bool = true;
285        const OFFSET: u8 = 0;
286        self.w.bits &= !((MASK as u32) << OFFSET);
287        self.w.bits |= ((value & MASK) as u32) << OFFSET;
288        self.w
289    }
290}
291#[doc = "Values that can be written to the field `INV1EN`"]
292pub enum INV1ENW {
293    #[doc = "Inverting is disabled."]
294    _0,
295    #[doc = "Inverting is enabled."]
296    _1,
297}
298impl INV1ENW {
299    #[allow(missing_docs)]
300    #[doc(hidden)]
301    #[inline]
302    pub fn _bits(&self) -> bool {
303        match *self {
304            INV1ENW::_0 => false,
305            INV1ENW::_1 => true,
306        }
307    }
308}
309#[doc = r" Proxy"]
310pub struct _INV1ENW<'a> {
311    w: &'a mut W,
312}
313impl<'a> _INV1ENW<'a> {
314    #[doc = r" Writes `variant` to the field"]
315    #[inline]
316    pub fn variant(self, variant: INV1ENW) -> &'a mut W {
317        {
318            self.bit(variant._bits())
319        }
320    }
321    #[doc = "Inverting is disabled."]
322    #[inline]
323    pub fn _0(self) -> &'a mut W {
324        self.variant(INV1ENW::_0)
325    }
326    #[doc = "Inverting is enabled."]
327    #[inline]
328    pub fn _1(self) -> &'a mut W {
329        self.variant(INV1ENW::_1)
330    }
331    #[doc = r" Sets the field bit"]
332    pub fn set_bit(self) -> &'a mut W {
333        self.bit(true)
334    }
335    #[doc = r" Clears the field bit"]
336    pub fn clear_bit(self) -> &'a mut W {
337        self.bit(false)
338    }
339    #[doc = r" Writes raw bits to the field"]
340    #[inline]
341    pub fn bit(self, value: bool) -> &'a mut W {
342        const MASK: bool = true;
343        const OFFSET: u8 = 1;
344        self.w.bits &= !((MASK as u32) << OFFSET);
345        self.w.bits |= ((value & MASK) as u32) << OFFSET;
346        self.w
347    }
348}
349#[doc = "Values that can be written to the field `INV2EN`"]
350pub enum INV2ENW {
351    #[doc = "Inverting is disabled."]
352    _0,
353    #[doc = "Inverting is enabled."]
354    _1,
355}
356impl INV2ENW {
357    #[allow(missing_docs)]
358    #[doc(hidden)]
359    #[inline]
360    pub fn _bits(&self) -> bool {
361        match *self {
362            INV2ENW::_0 => false,
363            INV2ENW::_1 => true,
364        }
365    }
366}
367#[doc = r" Proxy"]
368pub struct _INV2ENW<'a> {
369    w: &'a mut W,
370}
371impl<'a> _INV2ENW<'a> {
372    #[doc = r" Writes `variant` to the field"]
373    #[inline]
374    pub fn variant(self, variant: INV2ENW) -> &'a mut W {
375        {
376            self.bit(variant._bits())
377        }
378    }
379    #[doc = "Inverting is disabled."]
380    #[inline]
381    pub fn _0(self) -> &'a mut W {
382        self.variant(INV2ENW::_0)
383    }
384    #[doc = "Inverting is enabled."]
385    #[inline]
386    pub fn _1(self) -> &'a mut W {
387        self.variant(INV2ENW::_1)
388    }
389    #[doc = r" Sets the field bit"]
390    pub fn set_bit(self) -> &'a mut W {
391        self.bit(true)
392    }
393    #[doc = r" Clears the field bit"]
394    pub fn clear_bit(self) -> &'a mut W {
395        self.bit(false)
396    }
397    #[doc = r" Writes raw bits to the field"]
398    #[inline]
399    pub fn bit(self, value: bool) -> &'a mut W {
400        const MASK: bool = true;
401        const OFFSET: u8 = 2;
402        self.w.bits &= !((MASK as u32) << OFFSET);
403        self.w.bits |= ((value & MASK) as u32) << OFFSET;
404        self.w
405    }
406}
407#[doc = "Values that can be written to the field `INV3EN`"]
408pub enum INV3ENW {
409    #[doc = "Inverting is disabled."]
410    _0,
411    #[doc = "Inverting is enabled."]
412    _1,
413}
414impl INV3ENW {
415    #[allow(missing_docs)]
416    #[doc(hidden)]
417    #[inline]
418    pub fn _bits(&self) -> bool {
419        match *self {
420            INV3ENW::_0 => false,
421            INV3ENW::_1 => true,
422        }
423    }
424}
425#[doc = r" Proxy"]
426pub struct _INV3ENW<'a> {
427    w: &'a mut W,
428}
429impl<'a> _INV3ENW<'a> {
430    #[doc = r" Writes `variant` to the field"]
431    #[inline]
432    pub fn variant(self, variant: INV3ENW) -> &'a mut W {
433        {
434            self.bit(variant._bits())
435        }
436    }
437    #[doc = "Inverting is disabled."]
438    #[inline]
439    pub fn _0(self) -> &'a mut W {
440        self.variant(INV3ENW::_0)
441    }
442    #[doc = "Inverting is enabled."]
443    #[inline]
444    pub fn _1(self) -> &'a mut W {
445        self.variant(INV3ENW::_1)
446    }
447    #[doc = r" Sets the field bit"]
448    pub fn set_bit(self) -> &'a mut W {
449        self.bit(true)
450    }
451    #[doc = r" Clears the field bit"]
452    pub fn clear_bit(self) -> &'a mut W {
453        self.bit(false)
454    }
455    #[doc = r" Writes raw bits to the field"]
456    #[inline]
457    pub fn bit(self, value: bool) -> &'a mut W {
458        const MASK: bool = true;
459        const OFFSET: u8 = 3;
460        self.w.bits &= !((MASK as u32) << OFFSET);
461        self.w.bits |= ((value & MASK) as u32) << OFFSET;
462        self.w
463    }
464}
465impl R {
466    #[doc = r" Value of the register as raw bits"]
467    #[inline]
468    pub fn bits(&self) -> u32 {
469        self.bits
470    }
471    #[doc = "Bit 0 - Pair Channels 0 Inverting Enable"]
472    #[inline]
473    pub fn inv0en(&self) -> INV0ENR {
474        INV0ENR::_from({
475            const MASK: bool = true;
476            const OFFSET: u8 = 0;
477            ((self.bits >> OFFSET) & MASK as u32) != 0
478        })
479    }
480    #[doc = "Bit 1 - Pair Channels 1 Inverting Enable"]
481    #[inline]
482    pub fn inv1en(&self) -> INV1ENR {
483        INV1ENR::_from({
484            const MASK: bool = true;
485            const OFFSET: u8 = 1;
486            ((self.bits >> OFFSET) & MASK as u32) != 0
487        })
488    }
489    #[doc = "Bit 2 - Pair Channels 2 Inverting Enable"]
490    #[inline]
491    pub fn inv2en(&self) -> INV2ENR {
492        INV2ENR::_from({
493            const MASK: bool = true;
494            const OFFSET: u8 = 2;
495            ((self.bits >> OFFSET) & MASK as u32) != 0
496        })
497    }
498    #[doc = "Bit 3 - Pair Channels 3 Inverting Enable"]
499    #[inline]
500    pub fn inv3en(&self) -> INV3ENR {
501        INV3ENR::_from({
502            const MASK: bool = true;
503            const OFFSET: u8 = 3;
504            ((self.bits >> OFFSET) & MASK as u32) != 0
505        })
506    }
507}
508impl W {
509    #[doc = r" Reset value of the register"]
510    #[inline]
511    pub fn reset_value() -> W {
512        W { bits: 0 }
513    }
514    #[doc = r" Writes raw bits to the register"]
515    #[inline]
516    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
517        self.bits = bits;
518        self
519    }
520    #[doc = "Bit 0 - Pair Channels 0 Inverting Enable"]
521    #[inline]
522    pub fn inv0en(&mut self) -> _INV0ENW {
523        _INV0ENW { w: self }
524    }
525    #[doc = "Bit 1 - Pair Channels 1 Inverting Enable"]
526    #[inline]
527    pub fn inv1en(&mut self) -> _INV1ENW {
528        _INV1ENW { w: self }
529    }
530    #[doc = "Bit 2 - Pair Channels 2 Inverting Enable"]
531    #[inline]
532    pub fn inv2en(&mut self) -> _INV2ENW {
533        _INV2ENW { w: self }
534    }
535    #[doc = "Bit 3 - Pair Channels 3 Inverting Enable"]
536    #[inline]
537    pub fn inv3en(&mut self) -> _INV3ENW {
538        _INV3ENW { w: self }
539    }
540}