msp432e4/can0/
if1arb2.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::IF1ARB2 {
10    #[doc = r"Modifies the contents of the register"]
11    #[inline(always)]
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        self.register.set(f(&R { bits }, &mut W { bits }).bits);
18    }
19    #[doc = r"Reads the contents of the register"]
20    #[inline(always)]
21    pub fn read(&self) -> R {
22        R {
23            bits: self.register.get(),
24        }
25    }
26    #[doc = r"Writes to the register"]
27    #[inline(always)]
28    pub fn write<F>(&self, f: F)
29    where
30        F: FnOnce(&mut W) -> &mut W,
31    {
32        self.register.set(
33            f(&mut W {
34                bits: Self::reset_value(),
35            })
36            .bits,
37        );
38    }
39    #[doc = r"Reset value of the register"]
40    #[inline(always)]
41    pub const fn reset_value() -> u32 {
42        0
43    }
44    #[doc = r"Writes the reset value to the register"]
45    #[inline(always)]
46    pub fn reset(&self) {
47        self.register.set(Self::reset_value())
48    }
49}
50#[doc = r"Value of the field"]
51pub struct CAN_IF1ARB2_IDR {
52    bits: u16,
53}
54impl CAN_IF1ARB2_IDR {
55    #[doc = r"Value of the field as raw bits"]
56    #[inline(always)]
57    pub fn bits(&self) -> u16 {
58        self.bits
59    }
60}
61#[doc = r"Proxy"]
62pub struct _CAN_IF1ARB2_IDW<'a> {
63    w: &'a mut W,
64}
65impl<'a> _CAN_IF1ARB2_IDW<'a> {
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub unsafe fn bits(self, value: u16) -> &'a mut W {
69        self.w.bits &= !(8191 << 0);
70        self.w.bits |= ((value as u32) & 8191) << 0;
71        self.w
72    }
73}
74#[doc = r"Value of the field"]
75pub struct CAN_IF1ARB2_DIRR {
76    bits: bool,
77}
78impl CAN_IF1ARB2_DIRR {
79    #[doc = r"Value of the field as raw bits"]
80    #[inline(always)]
81    pub fn bit(&self) -> bool {
82        self.bits
83    }
84    #[doc = r"Returns `true` if the bit is clear (0)"]
85    #[inline(always)]
86    pub fn bit_is_clear(&self) -> bool {
87        !self.bit()
88    }
89    #[doc = r"Returns `true` if the bit is set (1)"]
90    #[inline(always)]
91    pub fn bit_is_set(&self) -> bool {
92        self.bit()
93    }
94}
95#[doc = r"Proxy"]
96pub struct _CAN_IF1ARB2_DIRW<'a> {
97    w: &'a mut W,
98}
99impl<'a> _CAN_IF1ARB2_DIRW<'a> {
100    #[doc = r"Sets the field bit"]
101    #[inline(always)]
102    pub fn set_bit(self) -> &'a mut W {
103        self.bit(true)
104    }
105    #[doc = r"Clears the field bit"]
106    #[inline(always)]
107    pub fn clear_bit(self) -> &'a mut W {
108        self.bit(false)
109    }
110    #[doc = r"Writes raw bits to the field"]
111    #[inline(always)]
112    pub fn bit(self, value: bool) -> &'a mut W {
113        self.w.bits &= !(1 << 13);
114        self.w.bits |= ((value as u32) & 1) << 13;
115        self.w
116    }
117}
118#[doc = r"Value of the field"]
119pub struct CAN_IF1ARB2_XTDR {
120    bits: bool,
121}
122impl CAN_IF1ARB2_XTDR {
123    #[doc = r"Value of the field as raw bits"]
124    #[inline(always)]
125    pub fn bit(&self) -> bool {
126        self.bits
127    }
128    #[doc = r"Returns `true` if the bit is clear (0)"]
129    #[inline(always)]
130    pub fn bit_is_clear(&self) -> bool {
131        !self.bit()
132    }
133    #[doc = r"Returns `true` if the bit is set (1)"]
134    #[inline(always)]
135    pub fn bit_is_set(&self) -> bool {
136        self.bit()
137    }
138}
139#[doc = r"Proxy"]
140pub struct _CAN_IF1ARB2_XTDW<'a> {
141    w: &'a mut W,
142}
143impl<'a> _CAN_IF1ARB2_XTDW<'a> {
144    #[doc = r"Sets the field bit"]
145    #[inline(always)]
146    pub fn set_bit(self) -> &'a mut W {
147        self.bit(true)
148    }
149    #[doc = r"Clears the field bit"]
150    #[inline(always)]
151    pub fn clear_bit(self) -> &'a mut W {
152        self.bit(false)
153    }
154    #[doc = r"Writes raw bits to the field"]
155    #[inline(always)]
156    pub fn bit(self, value: bool) -> &'a mut W {
157        self.w.bits &= !(1 << 14);
158        self.w.bits |= ((value as u32) & 1) << 14;
159        self.w
160    }
161}
162#[doc = r"Value of the field"]
163pub struct CAN_IF1ARB2_MSGVALR {
164    bits: bool,
165}
166impl CAN_IF1ARB2_MSGVALR {
167    #[doc = r"Value of the field as raw bits"]
168    #[inline(always)]
169    pub fn bit(&self) -> bool {
170        self.bits
171    }
172    #[doc = r"Returns `true` if the bit is clear (0)"]
173    #[inline(always)]
174    pub fn bit_is_clear(&self) -> bool {
175        !self.bit()
176    }
177    #[doc = r"Returns `true` if the bit is set (1)"]
178    #[inline(always)]
179    pub fn bit_is_set(&self) -> bool {
180        self.bit()
181    }
182}
183#[doc = r"Proxy"]
184pub struct _CAN_IF1ARB2_MSGVALW<'a> {
185    w: &'a mut W,
186}
187impl<'a> _CAN_IF1ARB2_MSGVALW<'a> {
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits &= !(1 << 15);
202        self.w.bits |= ((value as u32) & 1) << 15;
203        self.w
204    }
205}
206impl R {
207    #[doc = r"Value of the register as raw bits"]
208    #[inline(always)]
209    pub fn bits(&self) -> u32 {
210        self.bits
211    }
212    #[doc = "Bits 0:12 - Message Identifier"]
213    #[inline(always)]
214    pub fn can_if1arb2_id(&self) -> CAN_IF1ARB2_IDR {
215        let bits = ((self.bits >> 0) & 8191) as u16;
216        CAN_IF1ARB2_IDR { bits }
217    }
218    #[doc = "Bit 13 - Message Direction"]
219    #[inline(always)]
220    pub fn can_if1arb2_dir(&self) -> CAN_IF1ARB2_DIRR {
221        let bits = ((self.bits >> 13) & 1) != 0;
222        CAN_IF1ARB2_DIRR { bits }
223    }
224    #[doc = "Bit 14 - Extended Identifier"]
225    #[inline(always)]
226    pub fn can_if1arb2_xtd(&self) -> CAN_IF1ARB2_XTDR {
227        let bits = ((self.bits >> 14) & 1) != 0;
228        CAN_IF1ARB2_XTDR { bits }
229    }
230    #[doc = "Bit 15 - Message Valid"]
231    #[inline(always)]
232    pub fn can_if1arb2_msgval(&self) -> CAN_IF1ARB2_MSGVALR {
233        let bits = ((self.bits >> 15) & 1) != 0;
234        CAN_IF1ARB2_MSGVALR { bits }
235    }
236}
237impl W {
238    #[doc = r"Writes raw bits to the register"]
239    #[inline(always)]
240    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
241        self.bits = bits;
242        self
243    }
244    #[doc = "Bits 0:12 - Message Identifier"]
245    #[inline(always)]
246    pub fn can_if1arb2_id(&mut self) -> _CAN_IF1ARB2_IDW {
247        _CAN_IF1ARB2_IDW { w: self }
248    }
249    #[doc = "Bit 13 - Message Direction"]
250    #[inline(always)]
251    pub fn can_if1arb2_dir(&mut self) -> _CAN_IF1ARB2_DIRW {
252        _CAN_IF1ARB2_DIRW { w: self }
253    }
254    #[doc = "Bit 14 - Extended Identifier"]
255    #[inline(always)]
256    pub fn can_if1arb2_xtd(&mut self) -> _CAN_IF1ARB2_XTDW {
257        _CAN_IF1ARB2_XTDW { w: self }
258    }
259    #[doc = "Bit 15 - Message Valid"]
260    #[inline(always)]
261    pub fn can_if1arb2_msgval(&mut self) -> _CAN_IF1ARB2_MSGVALW {
262        _CAN_IF1ARB2_MSGVALW { w: self }
263    }
264}