stm32l4x2_pac/can1/
msr.rs1#[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::MSR {
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 = r" Value of the field"]
46pub struct RXR {
47 bits: bool,
48}
49impl RXR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct SAMPR {
68 bits: bool,
69}
70impl SAMPR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct RXMR {
89 bits: bool,
90}
91impl RXMR {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bit(&self) -> bool {
95 self.bits
96 }
97 #[doc = r" Returns `true` if the bit is clear (0)"]
98 #[inline]
99 pub fn bit_is_clear(&self) -> bool {
100 !self.bit()
101 }
102 #[doc = r" Returns `true` if the bit is set (1)"]
103 #[inline]
104 pub fn bit_is_set(&self) -> bool {
105 self.bit()
106 }
107}
108#[doc = r" Value of the field"]
109pub struct TXMR {
110 bits: bool,
111}
112impl TXMR {
113 #[doc = r" Value of the field as raw bits"]
114 #[inline]
115 pub fn bit(&self) -> bool {
116 self.bits
117 }
118 #[doc = r" Returns `true` if the bit is clear (0)"]
119 #[inline]
120 pub fn bit_is_clear(&self) -> bool {
121 !self.bit()
122 }
123 #[doc = r" Returns `true` if the bit is set (1)"]
124 #[inline]
125 pub fn bit_is_set(&self) -> bool {
126 self.bit()
127 }
128}
129#[doc = r" Value of the field"]
130pub struct SLAKIR {
131 bits: bool,
132}
133impl SLAKIR {
134 #[doc = r" Value of the field as raw bits"]
135 #[inline]
136 pub fn bit(&self) -> bool {
137 self.bits
138 }
139 #[doc = r" Returns `true` if the bit is clear (0)"]
140 #[inline]
141 pub fn bit_is_clear(&self) -> bool {
142 !self.bit()
143 }
144 #[doc = r" Returns `true` if the bit is set (1)"]
145 #[inline]
146 pub fn bit_is_set(&self) -> bool {
147 self.bit()
148 }
149}
150#[doc = r" Value of the field"]
151pub struct WKUIR {
152 bits: bool,
153}
154impl WKUIR {
155 #[doc = r" Value of the field as raw bits"]
156 #[inline]
157 pub fn bit(&self) -> bool {
158 self.bits
159 }
160 #[doc = r" Returns `true` if the bit is clear (0)"]
161 #[inline]
162 pub fn bit_is_clear(&self) -> bool {
163 !self.bit()
164 }
165 #[doc = r" Returns `true` if the bit is set (1)"]
166 #[inline]
167 pub fn bit_is_set(&self) -> bool {
168 self.bit()
169 }
170}
171#[doc = r" Value of the field"]
172pub struct ERRIR {
173 bits: bool,
174}
175impl ERRIR {
176 #[doc = r" Value of the field as raw bits"]
177 #[inline]
178 pub fn bit(&self) -> bool {
179 self.bits
180 }
181 #[doc = r" Returns `true` if the bit is clear (0)"]
182 #[inline]
183 pub fn bit_is_clear(&self) -> bool {
184 !self.bit()
185 }
186 #[doc = r" Returns `true` if the bit is set (1)"]
187 #[inline]
188 pub fn bit_is_set(&self) -> bool {
189 self.bit()
190 }
191}
192#[doc = r" Value of the field"]
193pub struct SLAKR {
194 bits: bool,
195}
196impl SLAKR {
197 #[doc = r" Value of the field as raw bits"]
198 #[inline]
199 pub fn bit(&self) -> bool {
200 self.bits
201 }
202 #[doc = r" Returns `true` if the bit is clear (0)"]
203 #[inline]
204 pub fn bit_is_clear(&self) -> bool {
205 !self.bit()
206 }
207 #[doc = r" Returns `true` if the bit is set (1)"]
208 #[inline]
209 pub fn bit_is_set(&self) -> bool {
210 self.bit()
211 }
212}
213#[doc = r" Value of the field"]
214pub struct INAKR {
215 bits: bool,
216}
217impl INAKR {
218 #[doc = r" Value of the field as raw bits"]
219 #[inline]
220 pub fn bit(&self) -> bool {
221 self.bits
222 }
223 #[doc = r" Returns `true` if the bit is clear (0)"]
224 #[inline]
225 pub fn bit_is_clear(&self) -> bool {
226 !self.bit()
227 }
228 #[doc = r" Returns `true` if the bit is set (1)"]
229 #[inline]
230 pub fn bit_is_set(&self) -> bool {
231 self.bit()
232 }
233}
234#[doc = r" Proxy"]
235pub struct _SLAKIW<'a> {
236 w: &'a mut W,
237}
238impl<'a> _SLAKIW<'a> {
239 #[doc = r" Sets the field bit"]
240 pub fn set_bit(self) -> &'a mut W {
241 self.bit(true)
242 }
243 #[doc = r" Clears the field bit"]
244 pub fn clear_bit(self) -> &'a mut W {
245 self.bit(false)
246 }
247 #[doc = r" Writes raw bits to the field"]
248 #[inline]
249 pub fn bit(self, value: bool) -> &'a mut W {
250 const MASK: bool = true;
251 const OFFSET: u8 = 4;
252 self.w.bits &= !((MASK as u32) << OFFSET);
253 self.w.bits |= ((value & MASK) as u32) << OFFSET;
254 self.w
255 }
256}
257#[doc = r" Proxy"]
258pub struct _WKUIW<'a> {
259 w: &'a mut W,
260}
261impl<'a> _WKUIW<'a> {
262 #[doc = r" Sets the field bit"]
263 pub fn set_bit(self) -> &'a mut W {
264 self.bit(true)
265 }
266 #[doc = r" Clears the field bit"]
267 pub fn clear_bit(self) -> &'a mut W {
268 self.bit(false)
269 }
270 #[doc = r" Writes raw bits to the field"]
271 #[inline]
272 pub fn bit(self, value: bool) -> &'a mut W {
273 const MASK: bool = true;
274 const OFFSET: u8 = 3;
275 self.w.bits &= !((MASK as u32) << OFFSET);
276 self.w.bits |= ((value & MASK) as u32) << OFFSET;
277 self.w
278 }
279}
280#[doc = r" Proxy"]
281pub struct _ERRIW<'a> {
282 w: &'a mut W,
283}
284impl<'a> _ERRIW<'a> {
285 #[doc = r" Sets the field bit"]
286 pub fn set_bit(self) -> &'a mut W {
287 self.bit(true)
288 }
289 #[doc = r" Clears the field bit"]
290 pub fn clear_bit(self) -> &'a mut W {
291 self.bit(false)
292 }
293 #[doc = r" Writes raw bits to the field"]
294 #[inline]
295 pub fn bit(self, value: bool) -> &'a mut W {
296 const MASK: bool = true;
297 const OFFSET: u8 = 2;
298 self.w.bits &= !((MASK as u32) << OFFSET);
299 self.w.bits |= ((value & MASK) as u32) << OFFSET;
300 self.w
301 }
302}
303impl R {
304 #[doc = r" Value of the register as raw bits"]
305 #[inline]
306 pub fn bits(&self) -> u32 {
307 self.bits
308 }
309 #[doc = "Bit 11 - RX"]
310 #[inline]
311 pub fn rx(&self) -> RXR {
312 let bits = {
313 const MASK: bool = true;
314 const OFFSET: u8 = 11;
315 ((self.bits >> OFFSET) & MASK as u32) != 0
316 };
317 RXR { bits }
318 }
319 #[doc = "Bit 10 - SAMP"]
320 #[inline]
321 pub fn samp(&self) -> SAMPR {
322 let bits = {
323 const MASK: bool = true;
324 const OFFSET: u8 = 10;
325 ((self.bits >> OFFSET) & MASK as u32) != 0
326 };
327 SAMPR { bits }
328 }
329 #[doc = "Bit 9 - RXM"]
330 #[inline]
331 pub fn rxm(&self) -> RXMR {
332 let bits = {
333 const MASK: bool = true;
334 const OFFSET: u8 = 9;
335 ((self.bits >> OFFSET) & MASK as u32) != 0
336 };
337 RXMR { bits }
338 }
339 #[doc = "Bit 8 - TXM"]
340 #[inline]
341 pub fn txm(&self) -> TXMR {
342 let bits = {
343 const MASK: bool = true;
344 const OFFSET: u8 = 8;
345 ((self.bits >> OFFSET) & MASK as u32) != 0
346 };
347 TXMR { bits }
348 }
349 #[doc = "Bit 4 - SLAKI"]
350 #[inline]
351 pub fn slaki(&self) -> SLAKIR {
352 let bits = {
353 const MASK: bool = true;
354 const OFFSET: u8 = 4;
355 ((self.bits >> OFFSET) & MASK as u32) != 0
356 };
357 SLAKIR { bits }
358 }
359 #[doc = "Bit 3 - WKUI"]
360 #[inline]
361 pub fn wkui(&self) -> WKUIR {
362 let bits = {
363 const MASK: bool = true;
364 const OFFSET: u8 = 3;
365 ((self.bits >> OFFSET) & MASK as u32) != 0
366 };
367 WKUIR { bits }
368 }
369 #[doc = "Bit 2 - ERRI"]
370 #[inline]
371 pub fn erri(&self) -> ERRIR {
372 let bits = {
373 const MASK: bool = true;
374 const OFFSET: u8 = 2;
375 ((self.bits >> OFFSET) & MASK as u32) != 0
376 };
377 ERRIR { bits }
378 }
379 #[doc = "Bit 1 - SLAK"]
380 #[inline]
381 pub fn slak(&self) -> SLAKR {
382 let bits = {
383 const MASK: bool = true;
384 const OFFSET: u8 = 1;
385 ((self.bits >> OFFSET) & MASK as u32) != 0
386 };
387 SLAKR { bits }
388 }
389 #[doc = "Bit 0 - INAK"]
390 #[inline]
391 pub fn inak(&self) -> INAKR {
392 let bits = {
393 const MASK: bool = true;
394 const OFFSET: u8 = 0;
395 ((self.bits >> OFFSET) & MASK as u32) != 0
396 };
397 INAKR { bits }
398 }
399}
400impl W {
401 #[doc = r" Reset value of the register"]
402 #[inline]
403 pub fn reset_value() -> W {
404 W { bits: 3074 }
405 }
406 #[doc = r" Writes raw bits to the register"]
407 #[inline]
408 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
409 self.bits = bits;
410 self
411 }
412 #[doc = "Bit 4 - SLAKI"]
413 #[inline]
414 pub fn slaki(&mut self) -> _SLAKIW {
415 _SLAKIW { w: self }
416 }
417 #[doc = "Bit 3 - WKUI"]
418 #[inline]
419 pub fn wkui(&mut self) -> _WKUIW {
420 _WKUIW { w: self }
421 }
422 #[doc = "Bit 2 - ERRI"]
423 #[inline]
424 pub fn erri(&mut self) -> _ERRIW {
425 _ERRIW { w: self }
426 }
427}