mk20d7/can0/iflag1/
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::IFLAG1 {
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 `BUF4TO0I`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum BUF4TO0IR {
48    #[doc = "The corresponding buffer has no occurrence of successfully completed transmission or reception (when MCR[RFEN]=0)."]
49    _0,
50    #[doc = "The corresponding buffer has successfully completed transmission or reception (when MCR[RFEN]=0)."]
51    _1,
52    #[doc = r" Reserved"]
53    _Reserved(u8),
54}
55impl BUF4TO0IR {
56    #[doc = r" Value of the field as raw bits"]
57    #[inline]
58    pub fn bits(&self) -> u8 {
59        match *self {
60            BUF4TO0IR::_0 => 0,
61            BUF4TO0IR::_1 => 1,
62            BUF4TO0IR::_Reserved(bits) => bits,
63        }
64    }
65    #[allow(missing_docs)]
66    #[doc(hidden)]
67    #[inline]
68    pub fn _from(value: u8) -> BUF4TO0IR {
69        match value {
70            0 => BUF4TO0IR::_0,
71            1 => BUF4TO0IR::_1,
72            i => BUF4TO0IR::_Reserved(i),
73        }
74    }
75    #[doc = "Checks if the value of the field is `_0`"]
76    #[inline]
77    pub fn is_0(&self) -> bool {
78        *self == BUF4TO0IR::_0
79    }
80    #[doc = "Checks if the value of the field is `_1`"]
81    #[inline]
82    pub fn is_1(&self) -> bool {
83        *self == BUF4TO0IR::_1
84    }
85}
86#[doc = "Possible values of the field `BUF5I`"]
87#[derive(Clone, Copy, Debug, PartialEq)]
88pub enum BUF5IR {
89    #[doc = "No occurrence of MB5 completing transmission/reception (when MCR[RFEN]=0) or of frame(s) available in the Rx FIFO (when MCR[RFEN]=1)"]
90    _0,
91    #[doc = "MB5 completed transmission/reception (when MCR[RFEN]=0) or frame(s) available in the Rx FIFO (when MCR[RFEN]=1)"]
92    _1,
93}
94impl BUF5IR {
95    #[doc = r" Returns `true` if the bit is clear (0)"]
96    #[inline]
97    pub fn bit_is_clear(&self) -> bool {
98        !self.bit()
99    }
100    #[doc = r" Returns `true` if the bit is set (1)"]
101    #[inline]
102    pub fn bit_is_set(&self) -> bool {
103        self.bit()
104    }
105    #[doc = r" Value of the field as raw bits"]
106    #[inline]
107    pub fn bit(&self) -> bool {
108        match *self {
109            BUF5IR::_0 => false,
110            BUF5IR::_1 => true,
111        }
112    }
113    #[allow(missing_docs)]
114    #[doc(hidden)]
115    #[inline]
116    pub fn _from(value: bool) -> BUF5IR {
117        match value {
118            false => BUF5IR::_0,
119            true => BUF5IR::_1,
120        }
121    }
122    #[doc = "Checks if the value of the field is `_0`"]
123    #[inline]
124    pub fn is_0(&self) -> bool {
125        *self == BUF5IR::_0
126    }
127    #[doc = "Checks if the value of the field is `_1`"]
128    #[inline]
129    pub fn is_1(&self) -> bool {
130        *self == BUF5IR::_1
131    }
132}
133#[doc = "Possible values of the field `BUF6I`"]
134#[derive(Clone, Copy, Debug, PartialEq)]
135pub enum BUF6IR {
136    #[doc = "No occurrence of MB6 completing transmission/reception (when MCR[RFEN]=0) or of Rx FIFO almost full (when MCR[RFEN]=1)"]
137    _0,
138    #[doc = "MB6 completed transmission/reception (when MCR[RFEN]=0) or Rx FIFO almost full (when MCR[RFEN]=1)"]
139    _1,
140}
141impl BUF6IR {
142    #[doc = r" Returns `true` if the bit is clear (0)"]
143    #[inline]
144    pub fn bit_is_clear(&self) -> bool {
145        !self.bit()
146    }
147    #[doc = r" Returns `true` if the bit is set (1)"]
148    #[inline]
149    pub fn bit_is_set(&self) -> bool {
150        self.bit()
151    }
152    #[doc = r" Value of the field as raw bits"]
153    #[inline]
154    pub fn bit(&self) -> bool {
155        match *self {
156            BUF6IR::_0 => false,
157            BUF6IR::_1 => true,
158        }
159    }
160    #[allow(missing_docs)]
161    #[doc(hidden)]
162    #[inline]
163    pub fn _from(value: bool) -> BUF6IR {
164        match value {
165            false => BUF6IR::_0,
166            true => BUF6IR::_1,
167        }
168    }
169    #[doc = "Checks if the value of the field is `_0`"]
170    #[inline]
171    pub fn is_0(&self) -> bool {
172        *self == BUF6IR::_0
173    }
174    #[doc = "Checks if the value of the field is `_1`"]
175    #[inline]
176    pub fn is_1(&self) -> bool {
177        *self == BUF6IR::_1
178    }
179}
180#[doc = "Possible values of the field `BUF7I`"]
181#[derive(Clone, Copy, Debug, PartialEq)]
182pub enum BUF7IR {
183    #[doc = "No occurrence of MB7 completing transmission/reception (when MCR[RFEN]=0) or of Rx FIFO overflow (when MCR[RFEN]=1)"]
184    _0,
185    #[doc = "MB7 completed transmission/reception (when MCR[RFEN]=0) or Rx FIFO overflow (when MCR[RFEN]=1)"]
186    _1,
187}
188impl BUF7IR {
189    #[doc = r" Returns `true` if the bit is clear (0)"]
190    #[inline]
191    pub fn bit_is_clear(&self) -> bool {
192        !self.bit()
193    }
194    #[doc = r" Returns `true` if the bit is set (1)"]
195    #[inline]
196    pub fn bit_is_set(&self) -> bool {
197        self.bit()
198    }
199    #[doc = r" Value of the field as raw bits"]
200    #[inline]
201    pub fn bit(&self) -> bool {
202        match *self {
203            BUF7IR::_0 => false,
204            BUF7IR::_1 => true,
205        }
206    }
207    #[allow(missing_docs)]
208    #[doc(hidden)]
209    #[inline]
210    pub fn _from(value: bool) -> BUF7IR {
211        match value {
212            false => BUF7IR::_0,
213            true => BUF7IR::_1,
214        }
215    }
216    #[doc = "Checks if the value of the field is `_0`"]
217    #[inline]
218    pub fn is_0(&self) -> bool {
219        *self == BUF7IR::_0
220    }
221    #[doc = "Checks if the value of the field is `_1`"]
222    #[inline]
223    pub fn is_1(&self) -> bool {
224        *self == BUF7IR::_1
225    }
226}
227#[doc = "Possible values of the field `BUF31TO8I`"]
228#[derive(Clone, Copy, Debug, PartialEq)]
229pub enum BUF31TO8IR {
230    #[doc = "The corresponding buffer has no occurrence of successfully completed transmission or reception."]
231    _0,
232    #[doc = "The corresponding buffer has successfully completed transmission or reception."]
233    _1,
234    #[doc = r" Reserved"]
235    _Reserved(u32),
236}
237impl BUF31TO8IR {
238    #[doc = r" Value of the field as raw bits"]
239    #[inline]
240    pub fn bits(&self) -> u32 {
241        match *self {
242            BUF31TO8IR::_0 => 0,
243            BUF31TO8IR::_1 => 1,
244            BUF31TO8IR::_Reserved(bits) => bits,
245        }
246    }
247    #[allow(missing_docs)]
248    #[doc(hidden)]
249    #[inline]
250    pub fn _from(value: u32) -> BUF31TO8IR {
251        match value {
252            0 => BUF31TO8IR::_0,
253            1 => BUF31TO8IR::_1,
254            i => BUF31TO8IR::_Reserved(i),
255        }
256    }
257    #[doc = "Checks if the value of the field is `_0`"]
258    #[inline]
259    pub fn is_0(&self) -> bool {
260        *self == BUF31TO8IR::_0
261    }
262    #[doc = "Checks if the value of the field is `_1`"]
263    #[inline]
264    pub fn is_1(&self) -> bool {
265        *self == BUF31TO8IR::_1
266    }
267}
268#[doc = "Values that can be written to the field `BUF4TO0I`"]
269pub enum BUF4TO0IW {
270    #[doc = "The corresponding buffer has no occurrence of successfully completed transmission or reception (when MCR[RFEN]=0)."]
271    _0,
272    #[doc = "The corresponding buffer has successfully completed transmission or reception (when MCR[RFEN]=0)."]
273    _1,
274}
275impl BUF4TO0IW {
276    #[allow(missing_docs)]
277    #[doc(hidden)]
278    #[inline]
279    pub fn _bits(&self) -> u8 {
280        match *self {
281            BUF4TO0IW::_0 => 0,
282            BUF4TO0IW::_1 => 1,
283        }
284    }
285}
286#[doc = r" Proxy"]
287pub struct _BUF4TO0IW<'a> {
288    w: &'a mut W,
289}
290impl<'a> _BUF4TO0IW<'a> {
291    #[doc = r" Writes `variant` to the field"]
292    #[inline]
293    pub fn variant(self, variant: BUF4TO0IW) -> &'a mut W {
294        unsafe { self.bits(variant._bits()) }
295    }
296    #[doc = "The corresponding buffer has no occurrence of successfully completed transmission or reception (when MCR[RFEN]=0)."]
297    #[inline]
298    pub fn _0(self) -> &'a mut W {
299        self.variant(BUF4TO0IW::_0)
300    }
301    #[doc = "The corresponding buffer has successfully completed transmission or reception (when MCR[RFEN]=0)."]
302    #[inline]
303    pub fn _1(self) -> &'a mut W {
304        self.variant(BUF4TO0IW::_1)
305    }
306    #[doc = r" Writes raw bits to the field"]
307    #[inline]
308    pub unsafe fn bits(self, value: u8) -> &'a mut W {
309        const MASK: u8 = 31;
310        const OFFSET: u8 = 0;
311        self.w.bits &= !((MASK as u32) << OFFSET);
312        self.w.bits |= ((value & MASK) as u32) << OFFSET;
313        self.w
314    }
315}
316#[doc = "Values that can be written to the field `BUF5I`"]
317pub enum BUF5IW {
318    #[doc = "No occurrence of MB5 completing transmission/reception (when MCR[RFEN]=0) or of frame(s) available in the Rx FIFO (when MCR[RFEN]=1)"]
319    _0,
320    #[doc = "MB5 completed transmission/reception (when MCR[RFEN]=0) or frame(s) available in the Rx FIFO (when MCR[RFEN]=1)"]
321    _1,
322}
323impl BUF5IW {
324    #[allow(missing_docs)]
325    #[doc(hidden)]
326    #[inline]
327    pub fn _bits(&self) -> bool {
328        match *self {
329            BUF5IW::_0 => false,
330            BUF5IW::_1 => true,
331        }
332    }
333}
334#[doc = r" Proxy"]
335pub struct _BUF5IW<'a> {
336    w: &'a mut W,
337}
338impl<'a> _BUF5IW<'a> {
339    #[doc = r" Writes `variant` to the field"]
340    #[inline]
341    pub fn variant(self, variant: BUF5IW) -> &'a mut W {
342        {
343            self.bit(variant._bits())
344        }
345    }
346    #[doc = "No occurrence of MB5 completing transmission/reception (when MCR[RFEN]=0) or of frame(s) available in the Rx FIFO (when MCR[RFEN]=1)"]
347    #[inline]
348    pub fn _0(self) -> &'a mut W {
349        self.variant(BUF5IW::_0)
350    }
351    #[doc = "MB5 completed transmission/reception (when MCR[RFEN]=0) or frame(s) available in the Rx FIFO (when MCR[RFEN]=1)"]
352    #[inline]
353    pub fn _1(self) -> &'a mut W {
354        self.variant(BUF5IW::_1)
355    }
356    #[doc = r" Sets the field bit"]
357    pub fn set_bit(self) -> &'a mut W {
358        self.bit(true)
359    }
360    #[doc = r" Clears the field bit"]
361    pub fn clear_bit(self) -> &'a mut W {
362        self.bit(false)
363    }
364    #[doc = r" Writes raw bits to the field"]
365    #[inline]
366    pub fn bit(self, value: bool) -> &'a mut W {
367        const MASK: bool = true;
368        const OFFSET: u8 = 5;
369        self.w.bits &= !((MASK as u32) << OFFSET);
370        self.w.bits |= ((value & MASK) as u32) << OFFSET;
371        self.w
372    }
373}
374#[doc = "Values that can be written to the field `BUF6I`"]
375pub enum BUF6IW {
376    #[doc = "No occurrence of MB6 completing transmission/reception (when MCR[RFEN]=0) or of Rx FIFO almost full (when MCR[RFEN]=1)"]
377    _0,
378    #[doc = "MB6 completed transmission/reception (when MCR[RFEN]=0) or Rx FIFO almost full (when MCR[RFEN]=1)"]
379    _1,
380}
381impl BUF6IW {
382    #[allow(missing_docs)]
383    #[doc(hidden)]
384    #[inline]
385    pub fn _bits(&self) -> bool {
386        match *self {
387            BUF6IW::_0 => false,
388            BUF6IW::_1 => true,
389        }
390    }
391}
392#[doc = r" Proxy"]
393pub struct _BUF6IW<'a> {
394    w: &'a mut W,
395}
396impl<'a> _BUF6IW<'a> {
397    #[doc = r" Writes `variant` to the field"]
398    #[inline]
399    pub fn variant(self, variant: BUF6IW) -> &'a mut W {
400        {
401            self.bit(variant._bits())
402        }
403    }
404    #[doc = "No occurrence of MB6 completing transmission/reception (when MCR[RFEN]=0) or of Rx FIFO almost full (when MCR[RFEN]=1)"]
405    #[inline]
406    pub fn _0(self) -> &'a mut W {
407        self.variant(BUF6IW::_0)
408    }
409    #[doc = "MB6 completed transmission/reception (when MCR[RFEN]=0) or Rx FIFO almost full (when MCR[RFEN]=1)"]
410    #[inline]
411    pub fn _1(self) -> &'a mut W {
412        self.variant(BUF6IW::_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}
432#[doc = "Values that can be written to the field `BUF7I`"]
433pub enum BUF7IW {
434    #[doc = "No occurrence of MB7 completing transmission/reception (when MCR[RFEN]=0) or of Rx FIFO overflow (when MCR[RFEN]=1)"]
435    _0,
436    #[doc = "MB7 completed transmission/reception (when MCR[RFEN]=0) or Rx FIFO overflow (when MCR[RFEN]=1)"]
437    _1,
438}
439impl BUF7IW {
440    #[allow(missing_docs)]
441    #[doc(hidden)]
442    #[inline]
443    pub fn _bits(&self) -> bool {
444        match *self {
445            BUF7IW::_0 => false,
446            BUF7IW::_1 => true,
447        }
448    }
449}
450#[doc = r" Proxy"]
451pub struct _BUF7IW<'a> {
452    w: &'a mut W,
453}
454impl<'a> _BUF7IW<'a> {
455    #[doc = r" Writes `variant` to the field"]
456    #[inline]
457    pub fn variant(self, variant: BUF7IW) -> &'a mut W {
458        {
459            self.bit(variant._bits())
460        }
461    }
462    #[doc = "No occurrence of MB7 completing transmission/reception (when MCR[RFEN]=0) or of Rx FIFO overflow (when MCR[RFEN]=1)"]
463    #[inline]
464    pub fn _0(self) -> &'a mut W {
465        self.variant(BUF7IW::_0)
466    }
467    #[doc = "MB7 completed transmission/reception (when MCR[RFEN]=0) or Rx FIFO overflow (when MCR[RFEN]=1)"]
468    #[inline]
469    pub fn _1(self) -> &'a mut W {
470        self.variant(BUF7IW::_1)
471    }
472    #[doc = r" Sets the field bit"]
473    pub fn set_bit(self) -> &'a mut W {
474        self.bit(true)
475    }
476    #[doc = r" Clears the field bit"]
477    pub fn clear_bit(self) -> &'a mut W {
478        self.bit(false)
479    }
480    #[doc = r" Writes raw bits to the field"]
481    #[inline]
482    pub fn bit(self, value: bool) -> &'a mut W {
483        const MASK: bool = true;
484        const OFFSET: u8 = 7;
485        self.w.bits &= !((MASK as u32) << OFFSET);
486        self.w.bits |= ((value & MASK) as u32) << OFFSET;
487        self.w
488    }
489}
490#[doc = "Values that can be written to the field `BUF31TO8I`"]
491pub enum BUF31TO8IW {
492    #[doc = "The corresponding buffer has no occurrence of successfully completed transmission or reception."]
493    _0,
494    #[doc = "The corresponding buffer has successfully completed transmission or reception."]
495    _1,
496}
497impl BUF31TO8IW {
498    #[allow(missing_docs)]
499    #[doc(hidden)]
500    #[inline]
501    pub fn _bits(&self) -> u32 {
502        match *self {
503            BUF31TO8IW::_0 => 0,
504            BUF31TO8IW::_1 => 1,
505        }
506    }
507}
508#[doc = r" Proxy"]
509pub struct _BUF31TO8IW<'a> {
510    w: &'a mut W,
511}
512impl<'a> _BUF31TO8IW<'a> {
513    #[doc = r" Writes `variant` to the field"]
514    #[inline]
515    pub fn variant(self, variant: BUF31TO8IW) -> &'a mut W {
516        unsafe { self.bits(variant._bits()) }
517    }
518    #[doc = "The corresponding buffer has no occurrence of successfully completed transmission or reception."]
519    #[inline]
520    pub fn _0(self) -> &'a mut W {
521        self.variant(BUF31TO8IW::_0)
522    }
523    #[doc = "The corresponding buffer has successfully completed transmission or reception."]
524    #[inline]
525    pub fn _1(self) -> &'a mut W {
526        self.variant(BUF31TO8IW::_1)
527    }
528    #[doc = r" Writes raw bits to the field"]
529    #[inline]
530    pub unsafe fn bits(self, value: u32) -> &'a mut W {
531        const MASK: u32 = 16777215;
532        const OFFSET: u8 = 8;
533        self.w.bits &= !((MASK as u32) << OFFSET);
534        self.w.bits |= ((value & MASK) as u32) << OFFSET;
535        self.w
536    }
537}
538impl R {
539    #[doc = r" Value of the register as raw bits"]
540    #[inline]
541    pub fn bits(&self) -> u32 {
542        self.bits
543    }
544    #[doc = "Bits 0:4 - Buffer MBi Interrupt or \"reserved\""]
545    #[inline]
546    pub fn buf4to0i(&self) -> BUF4TO0IR {
547        BUF4TO0IR::_from({
548            const MASK: u8 = 31;
549            const OFFSET: u8 = 0;
550            ((self.bits >> OFFSET) & MASK as u32) as u8
551        })
552    }
553    #[doc = "Bit 5 - Buffer MB5 Interrupt or \"Frames available in Rx FIFO\""]
554    #[inline]
555    pub fn buf5i(&self) -> BUF5IR {
556        BUF5IR::_from({
557            const MASK: bool = true;
558            const OFFSET: u8 = 5;
559            ((self.bits >> OFFSET) & MASK as u32) != 0
560        })
561    }
562    #[doc = "Bit 6 - Buffer MB6 Interrupt or \"Rx FIFO Warning\""]
563    #[inline]
564    pub fn buf6i(&self) -> BUF6IR {
565        BUF6IR::_from({
566            const MASK: bool = true;
567            const OFFSET: u8 = 6;
568            ((self.bits >> OFFSET) & MASK as u32) != 0
569        })
570    }
571    #[doc = "Bit 7 - Buffer MB7 Interrupt or \"Rx FIFO Overflow\""]
572    #[inline]
573    pub fn buf7i(&self) -> BUF7IR {
574        BUF7IR::_from({
575            const MASK: bool = true;
576            const OFFSET: u8 = 7;
577            ((self.bits >> OFFSET) & MASK as u32) != 0
578        })
579    }
580    #[doc = "Bits 8:31 - Buffer MBi Interrupt"]
581    #[inline]
582    pub fn buf31to8i(&self) -> BUF31TO8IR {
583        BUF31TO8IR::_from({
584            const MASK: u32 = 16777215;
585            const OFFSET: u8 = 8;
586            ((self.bits >> OFFSET) & MASK as u32) as u32
587        })
588    }
589}
590impl W {
591    #[doc = r" Reset value of the register"]
592    #[inline]
593    pub fn reset_value() -> W {
594        W { bits: 0 }
595    }
596    #[doc = r" Writes raw bits to the register"]
597    #[inline]
598    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
599        self.bits = bits;
600        self
601    }
602    #[doc = "Bits 0:4 - Buffer MBi Interrupt or \"reserved\""]
603    #[inline]
604    pub fn buf4to0i(&mut self) -> _BUF4TO0IW {
605        _BUF4TO0IW { w: self }
606    }
607    #[doc = "Bit 5 - Buffer MB5 Interrupt or \"Frames available in Rx FIFO\""]
608    #[inline]
609    pub fn buf5i(&mut self) -> _BUF5IW {
610        _BUF5IW { w: self }
611    }
612    #[doc = "Bit 6 - Buffer MB6 Interrupt or \"Rx FIFO Warning\""]
613    #[inline]
614    pub fn buf6i(&mut self) -> _BUF6IW {
615        _BUF6IW { w: self }
616    }
617    #[doc = "Bit 7 - Buffer MB7 Interrupt or \"Rx FIFO Overflow\""]
618    #[inline]
619    pub fn buf7i(&mut self) -> _BUF7IW {
620        _BUF7IW { w: self }
621    }
622    #[doc = "Bits 8:31 - Buffer MBi Interrupt"]
623    #[inline]
624    pub fn buf31to8i(&mut self) -> _BUF31TO8IW {
625        _BUF31TO8IW { w: self }
626    }
627}