efm32gg11b/can1/
mir1_arb.rs

1#[doc = "Reader of register MIR1_ARB"]
2pub type R = crate::R<u32, super::MIR1_ARB>;
3#[doc = "Writer for register MIR1_ARB"]
4pub type W = crate::W<u32, super::MIR1_ARB>;
5#[doc = "Register MIR1_ARB `reset()`'s with value 0"]
6impl crate::ResetValue for super::MIR1_ARB {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type { 0 }
10}
11#[doc = "Reader of field `ID`"]
12pub type ID_R = crate::R<u32, u32>;
13#[doc = "Write proxy for field `ID`"]
14pub struct ID_W<'a> {
15    w: &'a mut W,
16}
17impl<'a> ID_W<'a> {
18    #[doc = r"Writes raw bits to the field"]
19    #[inline(always)]
20    pub unsafe fn bits(self, value: u32) -> &'a mut W {
21        self.w.bits = (self.w.bits & !0x1fff_ffff) | ((value as u32) & 0x1fff_ffff);
22        self.w
23    }
24}
25#[doc = "Reader of field `DIR`"]
26pub type DIR_R = crate::R<bool, bool>;
27#[doc = "Write proxy for field `DIR`"]
28pub struct DIR_W<'a> {
29    w: &'a mut W,
30}
31impl<'a> DIR_W<'a> {
32    #[doc = r"Sets the field bit"]
33    #[inline(always)]
34    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
35    #[doc = r"Clears the field bit"]
36    #[inline(always)]
37    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
38    #[doc = r"Writes raw bits to the field"]
39    #[inline(always)]
40    pub fn bit(self, value: bool) -> &'a mut W {
41        self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
42        self.w
43    }
44}
45#[doc = "Reader of field `XTD`"]
46pub type XTD_R = crate::R<bool, bool>;
47#[doc = "Write proxy for field `XTD`"]
48pub struct XTD_W<'a> {
49    w: &'a mut W,
50}
51impl<'a> XTD_W<'a> {
52    #[doc = r"Sets the field bit"]
53    #[inline(always)]
54    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
55    #[doc = r"Clears the field bit"]
56    #[inline(always)]
57    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub fn bit(self, value: bool) -> &'a mut W {
61        self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
62        self.w
63    }
64}
65#[doc = "Reader of field `MSGVAL`"]
66pub type MSGVAL_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `MSGVAL`"]
68pub struct MSGVAL_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> MSGVAL_W<'a> {
72    #[doc = r"Sets the field bit"]
73    #[inline(always)]
74    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
75    #[doc = r"Clears the field bit"]
76    #[inline(always)]
77    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
78    #[doc = r"Writes raw bits to the field"]
79    #[inline(always)]
80    pub fn bit(self, value: bool) -> &'a mut W {
81        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
82        self.w
83    }
84}
85impl R {
86    #[doc = "Bits 0:28 - Message Identifier"]
87    #[inline(always)]
88    pub fn id(&self) -> ID_R { ID_R::new((self.bits & 0x1fff_ffff) as u32) }
89    #[doc = "Bit 29 - Message Direction"]
90    #[inline(always)]
91    pub fn dir(&self) -> DIR_R { DIR_R::new(((self.bits >> 29) & 0x01) != 0) }
92    #[doc = "Bit 30 - Extended Identifier"]
93    #[inline(always)]
94    pub fn xtd(&self) -> XTD_R { XTD_R::new(((self.bits >> 30) & 0x01) != 0) }
95    #[doc = "Bit 31 - Message Valid"]
96    #[inline(always)]
97    pub fn msgval(&self) -> MSGVAL_R { MSGVAL_R::new(((self.bits >> 31) & 0x01) != 0) }
98}
99impl W {
100    #[doc = "Bits 0:28 - Message Identifier"]
101    #[inline(always)]
102    pub fn id(&mut self) -> ID_W { ID_W { w: self } }
103    #[doc = "Bit 29 - Message Direction"]
104    #[inline(always)]
105    pub fn dir(&mut self) -> DIR_W { DIR_W { w: self } }
106    #[doc = "Bit 30 - Extended Identifier"]
107    #[inline(always)]
108    pub fn xtd(&mut self) -> XTD_W { XTD_W { w: self } }
109    #[doc = "Bit 31 - Message Valid"]
110    #[inline(always)]
111    pub fn msgval(&mut self) -> MSGVAL_W { MSGVAL_W { w: self } }
112}