stm32l4x2_pac/can1/
mcr.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::MCR {
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 DBFR {
47 bits: bool,
48}
49impl DBFR {
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 RESETR {
68 bits: bool,
69}
70impl RESETR {
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 TTCMR {
89 bits: bool,
90}
91impl TTCMR {
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 ABOMR {
110 bits: bool,
111}
112impl ABOMR {
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 AWUMR {
131 bits: bool,
132}
133impl AWUMR {
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 NARTR {
152 bits: bool,
153}
154impl NARTR {
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 RFLMR {
173 bits: bool,
174}
175impl RFLMR {
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 TXFPR {
194 bits: bool,
195}
196impl TXFPR {
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 SLEEPR {
215 bits: bool,
216}
217impl SLEEPR {
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" Value of the field"]
235pub struct INRQR {
236 bits: bool,
237}
238impl INRQR {
239 #[doc = r" Value of the field as raw bits"]
240 #[inline]
241 pub fn bit(&self) -> bool {
242 self.bits
243 }
244 #[doc = r" Returns `true` if the bit is clear (0)"]
245 #[inline]
246 pub fn bit_is_clear(&self) -> bool {
247 !self.bit()
248 }
249 #[doc = r" Returns `true` if the bit is set (1)"]
250 #[inline]
251 pub fn bit_is_set(&self) -> bool {
252 self.bit()
253 }
254}
255#[doc = r" Proxy"]
256pub struct _DBFW<'a> {
257 w: &'a mut W,
258}
259impl<'a> _DBFW<'a> {
260 #[doc = r" Sets the field bit"]
261 pub fn set_bit(self) -> &'a mut W {
262 self.bit(true)
263 }
264 #[doc = r" Clears the field bit"]
265 pub fn clear_bit(self) -> &'a mut W {
266 self.bit(false)
267 }
268 #[doc = r" Writes raw bits to the field"]
269 #[inline]
270 pub fn bit(self, value: bool) -> &'a mut W {
271 const MASK: bool = true;
272 const OFFSET: u8 = 16;
273 self.w.bits &= !((MASK as u32) << OFFSET);
274 self.w.bits |= ((value & MASK) as u32) << OFFSET;
275 self.w
276 }
277}
278#[doc = r" Proxy"]
279pub struct _RESETW<'a> {
280 w: &'a mut W,
281}
282impl<'a> _RESETW<'a> {
283 #[doc = r" Sets the field bit"]
284 pub fn set_bit(self) -> &'a mut W {
285 self.bit(true)
286 }
287 #[doc = r" Clears the field bit"]
288 pub fn clear_bit(self) -> &'a mut W {
289 self.bit(false)
290 }
291 #[doc = r" Writes raw bits to the field"]
292 #[inline]
293 pub fn bit(self, value: bool) -> &'a mut W {
294 const MASK: bool = true;
295 const OFFSET: u8 = 15;
296 self.w.bits &= !((MASK as u32) << OFFSET);
297 self.w.bits |= ((value & MASK) as u32) << OFFSET;
298 self.w
299 }
300}
301#[doc = r" Proxy"]
302pub struct _TTCMW<'a> {
303 w: &'a mut W,
304}
305impl<'a> _TTCMW<'a> {
306 #[doc = r" Sets the field bit"]
307 pub fn set_bit(self) -> &'a mut W {
308 self.bit(true)
309 }
310 #[doc = r" Clears the field bit"]
311 pub fn clear_bit(self) -> &'a mut W {
312 self.bit(false)
313 }
314 #[doc = r" Writes raw bits to the field"]
315 #[inline]
316 pub fn bit(self, value: bool) -> &'a mut W {
317 const MASK: bool = true;
318 const OFFSET: u8 = 7;
319 self.w.bits &= !((MASK as u32) << OFFSET);
320 self.w.bits |= ((value & MASK) as u32) << OFFSET;
321 self.w
322 }
323}
324#[doc = r" Proxy"]
325pub struct _ABOMW<'a> {
326 w: &'a mut W,
327}
328impl<'a> _ABOMW<'a> {
329 #[doc = r" Sets the field bit"]
330 pub fn set_bit(self) -> &'a mut W {
331 self.bit(true)
332 }
333 #[doc = r" Clears the field bit"]
334 pub fn clear_bit(self) -> &'a mut W {
335 self.bit(false)
336 }
337 #[doc = r" Writes raw bits to the field"]
338 #[inline]
339 pub fn bit(self, value: bool) -> &'a mut W {
340 const MASK: bool = true;
341 const OFFSET: u8 = 6;
342 self.w.bits &= !((MASK as u32) << OFFSET);
343 self.w.bits |= ((value & MASK) as u32) << OFFSET;
344 self.w
345 }
346}
347#[doc = r" Proxy"]
348pub struct _AWUMW<'a> {
349 w: &'a mut W,
350}
351impl<'a> _AWUMW<'a> {
352 #[doc = r" Sets the field bit"]
353 pub fn set_bit(self) -> &'a mut W {
354 self.bit(true)
355 }
356 #[doc = r" Clears the field bit"]
357 pub fn clear_bit(self) -> &'a mut W {
358 self.bit(false)
359 }
360 #[doc = r" Writes raw bits to the field"]
361 #[inline]
362 pub fn bit(self, value: bool) -> &'a mut W {
363 const MASK: bool = true;
364 const OFFSET: u8 = 5;
365 self.w.bits &= !((MASK as u32) << OFFSET);
366 self.w.bits |= ((value & MASK) as u32) << OFFSET;
367 self.w
368 }
369}
370#[doc = r" Proxy"]
371pub struct _NARTW<'a> {
372 w: &'a mut W,
373}
374impl<'a> _NARTW<'a> {
375 #[doc = r" Sets the field bit"]
376 pub fn set_bit(self) -> &'a mut W {
377 self.bit(true)
378 }
379 #[doc = r" Clears the field bit"]
380 pub fn clear_bit(self) -> &'a mut W {
381 self.bit(false)
382 }
383 #[doc = r" Writes raw bits to the field"]
384 #[inline]
385 pub fn bit(self, value: bool) -> &'a mut W {
386 const MASK: bool = true;
387 const OFFSET: u8 = 4;
388 self.w.bits &= !((MASK as u32) << OFFSET);
389 self.w.bits |= ((value & MASK) as u32) << OFFSET;
390 self.w
391 }
392}
393#[doc = r" Proxy"]
394pub struct _RFLMW<'a> {
395 w: &'a mut W,
396}
397impl<'a> _RFLMW<'a> {
398 #[doc = r" Sets the field bit"]
399 pub fn set_bit(self) -> &'a mut W {
400 self.bit(true)
401 }
402 #[doc = r" Clears the field bit"]
403 pub fn clear_bit(self) -> &'a mut W {
404 self.bit(false)
405 }
406 #[doc = r" Writes raw bits to the field"]
407 #[inline]
408 pub fn bit(self, value: bool) -> &'a mut W {
409 const MASK: bool = true;
410 const OFFSET: u8 = 3;
411 self.w.bits &= !((MASK as u32) << OFFSET);
412 self.w.bits |= ((value & MASK) as u32) << OFFSET;
413 self.w
414 }
415}
416#[doc = r" Proxy"]
417pub struct _TXFPW<'a> {
418 w: &'a mut W,
419}
420impl<'a> _TXFPW<'a> {
421 #[doc = r" Sets the field bit"]
422 pub fn set_bit(self) -> &'a mut W {
423 self.bit(true)
424 }
425 #[doc = r" Clears the field bit"]
426 pub fn clear_bit(self) -> &'a mut W {
427 self.bit(false)
428 }
429 #[doc = r" Writes raw bits to the field"]
430 #[inline]
431 pub fn bit(self, value: bool) -> &'a mut W {
432 const MASK: bool = true;
433 const OFFSET: u8 = 2;
434 self.w.bits &= !((MASK as u32) << OFFSET);
435 self.w.bits |= ((value & MASK) as u32) << OFFSET;
436 self.w
437 }
438}
439#[doc = r" Proxy"]
440pub struct _SLEEPW<'a> {
441 w: &'a mut W,
442}
443impl<'a> _SLEEPW<'a> {
444 #[doc = r" Sets the field bit"]
445 pub fn set_bit(self) -> &'a mut W {
446 self.bit(true)
447 }
448 #[doc = r" Clears the field bit"]
449 pub fn clear_bit(self) -> &'a mut W {
450 self.bit(false)
451 }
452 #[doc = r" Writes raw bits to the field"]
453 #[inline]
454 pub fn bit(self, value: bool) -> &'a mut W {
455 const MASK: bool = true;
456 const OFFSET: u8 = 1;
457 self.w.bits &= !((MASK as u32) << OFFSET);
458 self.w.bits |= ((value & MASK) as u32) << OFFSET;
459 self.w
460 }
461}
462#[doc = r" Proxy"]
463pub struct _INRQW<'a> {
464 w: &'a mut W,
465}
466impl<'a> _INRQW<'a> {
467 #[doc = r" Sets the field bit"]
468 pub fn set_bit(self) -> &'a mut W {
469 self.bit(true)
470 }
471 #[doc = r" Clears the field bit"]
472 pub fn clear_bit(self) -> &'a mut W {
473 self.bit(false)
474 }
475 #[doc = r" Writes raw bits to the field"]
476 #[inline]
477 pub fn bit(self, value: bool) -> &'a mut W {
478 const MASK: bool = true;
479 const OFFSET: u8 = 0;
480 self.w.bits &= !((MASK as u32) << OFFSET);
481 self.w.bits |= ((value & MASK) as u32) << OFFSET;
482 self.w
483 }
484}
485impl R {
486 #[doc = r" Value of the register as raw bits"]
487 #[inline]
488 pub fn bits(&self) -> u32 {
489 self.bits
490 }
491 #[doc = "Bit 16 - DBF"]
492 #[inline]
493 pub fn dbf(&self) -> DBFR {
494 let bits = {
495 const MASK: bool = true;
496 const OFFSET: u8 = 16;
497 ((self.bits >> OFFSET) & MASK as u32) != 0
498 };
499 DBFR { bits }
500 }
501 #[doc = "Bit 15 - RESET"]
502 #[inline]
503 pub fn reset(&self) -> RESETR {
504 let bits = {
505 const MASK: bool = true;
506 const OFFSET: u8 = 15;
507 ((self.bits >> OFFSET) & MASK as u32) != 0
508 };
509 RESETR { bits }
510 }
511 #[doc = "Bit 7 - TTCM"]
512 #[inline]
513 pub fn ttcm(&self) -> TTCMR {
514 let bits = {
515 const MASK: bool = true;
516 const OFFSET: u8 = 7;
517 ((self.bits >> OFFSET) & MASK as u32) != 0
518 };
519 TTCMR { bits }
520 }
521 #[doc = "Bit 6 - ABOM"]
522 #[inline]
523 pub fn abom(&self) -> ABOMR {
524 let bits = {
525 const MASK: bool = true;
526 const OFFSET: u8 = 6;
527 ((self.bits >> OFFSET) & MASK as u32) != 0
528 };
529 ABOMR { bits }
530 }
531 #[doc = "Bit 5 - AWUM"]
532 #[inline]
533 pub fn awum(&self) -> AWUMR {
534 let bits = {
535 const MASK: bool = true;
536 const OFFSET: u8 = 5;
537 ((self.bits >> OFFSET) & MASK as u32) != 0
538 };
539 AWUMR { bits }
540 }
541 #[doc = "Bit 4 - NART"]
542 #[inline]
543 pub fn nart(&self) -> NARTR {
544 let bits = {
545 const MASK: bool = true;
546 const OFFSET: u8 = 4;
547 ((self.bits >> OFFSET) & MASK as u32) != 0
548 };
549 NARTR { bits }
550 }
551 #[doc = "Bit 3 - RFLM"]
552 #[inline]
553 pub fn rflm(&self) -> RFLMR {
554 let bits = {
555 const MASK: bool = true;
556 const OFFSET: u8 = 3;
557 ((self.bits >> OFFSET) & MASK as u32) != 0
558 };
559 RFLMR { bits }
560 }
561 #[doc = "Bit 2 - TXFP"]
562 #[inline]
563 pub fn txfp(&self) -> TXFPR {
564 let bits = {
565 const MASK: bool = true;
566 const OFFSET: u8 = 2;
567 ((self.bits >> OFFSET) & MASK as u32) != 0
568 };
569 TXFPR { bits }
570 }
571 #[doc = "Bit 1 - SLEEP"]
572 #[inline]
573 pub fn sleep(&self) -> SLEEPR {
574 let bits = {
575 const MASK: bool = true;
576 const OFFSET: u8 = 1;
577 ((self.bits >> OFFSET) & MASK as u32) != 0
578 };
579 SLEEPR { bits }
580 }
581 #[doc = "Bit 0 - INRQ"]
582 #[inline]
583 pub fn inrq(&self) -> INRQR {
584 let bits = {
585 const MASK: bool = true;
586 const OFFSET: u8 = 0;
587 ((self.bits >> OFFSET) & MASK as u32) != 0
588 };
589 INRQR { bits }
590 }
591}
592impl W {
593 #[doc = r" Reset value of the register"]
594 #[inline]
595 pub fn reset_value() -> W {
596 W { bits: 65538 }
597 }
598 #[doc = r" Writes raw bits to the register"]
599 #[inline]
600 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
601 self.bits = bits;
602 self
603 }
604 #[doc = "Bit 16 - DBF"]
605 #[inline]
606 pub fn dbf(&mut self) -> _DBFW {
607 _DBFW { w: self }
608 }
609 #[doc = "Bit 15 - RESET"]
610 #[inline]
611 pub fn reset(&mut self) -> _RESETW {
612 _RESETW { w: self }
613 }
614 #[doc = "Bit 7 - TTCM"]
615 #[inline]
616 pub fn ttcm(&mut self) -> _TTCMW {
617 _TTCMW { w: self }
618 }
619 #[doc = "Bit 6 - ABOM"]
620 #[inline]
621 pub fn abom(&mut self) -> _ABOMW {
622 _ABOMW { w: self }
623 }
624 #[doc = "Bit 5 - AWUM"]
625 #[inline]
626 pub fn awum(&mut self) -> _AWUMW {
627 _AWUMW { w: self }
628 }
629 #[doc = "Bit 4 - NART"]
630 #[inline]
631 pub fn nart(&mut self) -> _NARTW {
632 _NARTW { w: self }
633 }
634 #[doc = "Bit 3 - RFLM"]
635 #[inline]
636 pub fn rflm(&mut self) -> _RFLMW {
637 _RFLMW { w: self }
638 }
639 #[doc = "Bit 2 - TXFP"]
640 #[inline]
641 pub fn txfp(&mut self) -> _TXFPW {
642 _TXFPW { w: self }
643 }
644 #[doc = "Bit 1 - SLEEP"]
645 #[inline]
646 pub fn sleep(&mut self) -> _SLEEPW {
647 _SLEEPW { w: self }
648 }
649 #[doc = "Bit 0 - INRQ"]
650 #[inline]
651 pub fn inrq(&mut self) -> _INRQW {
652 _INRQW { w: self }
653 }
654}