1#[doc = "Register `CTRL2` reader"]
2pub struct R(crate::R<CTRL2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL2` writer"]
17pub struct W(crate::W<CTRL2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL2_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<CTRL2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Edge Filter Disable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum EDFLTDIS_A {
40 #[doc = "0: Edge Filter is enabled."]
41 _0 = 0,
42 #[doc = "1: Edge Filter is disabled."]
43 _1 = 1,
44}
45impl From<EDFLTDIS_A> for bool {
46 #[inline(always)]
47 fn from(variant: EDFLTDIS_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `EDFLTDIS` reader - Edge Filter Disable"]
52pub struct EDFLTDIS_R(crate::FieldReader<bool, EDFLTDIS_A>);
53impl EDFLTDIS_R {
54 #[inline(always)]
55 pub(crate) fn new(bits: bool) -> Self {
56 EDFLTDIS_R(crate::FieldReader::new(bits))
57 }
58 #[doc = r"Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> EDFLTDIS_A {
61 match self.bits {
62 false => EDFLTDIS_A::_0,
63 true => EDFLTDIS_A::_1,
64 }
65 }
66 #[doc = "Checks if the value of the field is `_0`"]
67 #[inline(always)]
68 pub fn is_0(&self) -> bool {
69 **self == EDFLTDIS_A::_0
70 }
71 #[doc = "Checks if the value of the field is `_1`"]
72 #[inline(always)]
73 pub fn is_1(&self) -> bool {
74 **self == EDFLTDIS_A::_1
75 }
76}
77impl core::ops::Deref for EDFLTDIS_R {
78 type Target = crate::FieldReader<bool, EDFLTDIS_A>;
79 #[inline(always)]
80 fn deref(&self) -> &Self::Target {
81 &self.0
82 }
83}
84#[doc = "Field `EDFLTDIS` writer - Edge Filter Disable"]
85pub struct EDFLTDIS_W<'a> {
86 w: &'a mut W,
87}
88impl<'a> EDFLTDIS_W<'a> {
89 #[doc = r"Writes `variant` to the field"]
90 #[inline(always)]
91 pub fn variant(self, variant: EDFLTDIS_A) -> &'a mut W {
92 self.bit(variant.into())
93 }
94 #[doc = "Edge Filter is enabled."]
95 #[inline(always)]
96 pub fn _0(self) -> &'a mut W {
97 self.variant(EDFLTDIS_A::_0)
98 }
99 #[doc = "Edge Filter is disabled."]
100 #[inline(always)]
101 pub fn _1(self) -> &'a mut W {
102 self.variant(EDFLTDIS_A::_1)
103 }
104 #[doc = r"Sets the field bit"]
105 #[inline(always)]
106 pub fn set_bit(self) -> &'a mut W {
107 self.bit(true)
108 }
109 #[doc = r"Clears the field bit"]
110 #[inline(always)]
111 pub fn clear_bit(self) -> &'a mut W {
112 self.bit(false)
113 }
114 #[doc = r"Writes raw bits to the field"]
115 #[inline(always)]
116 pub fn bit(self, value: bool) -> &'a mut W {
117 self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u32 & 0x01) << 11);
118 self.w
119 }
120}
121#[doc = "ISO CAN FD Enable\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum ISOCANFDEN_A {
124 #[doc = "0: FlexCAN operates using the non-ISO CAN FD protocol."]
125 _0 = 0,
126 #[doc = "1: FlexCAN operates using the ISO CAN FD protocol (ISO 11898-1)."]
127 _1 = 1,
128}
129impl From<ISOCANFDEN_A> for bool {
130 #[inline(always)]
131 fn from(variant: ISOCANFDEN_A) -> Self {
132 variant as u8 != 0
133 }
134}
135#[doc = "Field `ISOCANFDEN` reader - ISO CAN FD Enable"]
136pub struct ISOCANFDEN_R(crate::FieldReader<bool, ISOCANFDEN_A>);
137impl ISOCANFDEN_R {
138 #[inline(always)]
139 pub(crate) fn new(bits: bool) -> Self {
140 ISOCANFDEN_R(crate::FieldReader::new(bits))
141 }
142 #[doc = r"Get enumerated values variant"]
143 #[inline(always)]
144 pub fn variant(&self) -> ISOCANFDEN_A {
145 match self.bits {
146 false => ISOCANFDEN_A::_0,
147 true => ISOCANFDEN_A::_1,
148 }
149 }
150 #[doc = "Checks if the value of the field is `_0`"]
151 #[inline(always)]
152 pub fn is_0(&self) -> bool {
153 **self == ISOCANFDEN_A::_0
154 }
155 #[doc = "Checks if the value of the field is `_1`"]
156 #[inline(always)]
157 pub fn is_1(&self) -> bool {
158 **self == ISOCANFDEN_A::_1
159 }
160}
161impl core::ops::Deref for ISOCANFDEN_R {
162 type Target = crate::FieldReader<bool, ISOCANFDEN_A>;
163 #[inline(always)]
164 fn deref(&self) -> &Self::Target {
165 &self.0
166 }
167}
168#[doc = "Field `ISOCANFDEN` writer - ISO CAN FD Enable"]
169pub struct ISOCANFDEN_W<'a> {
170 w: &'a mut W,
171}
172impl<'a> ISOCANFDEN_W<'a> {
173 #[doc = r"Writes `variant` to the field"]
174 #[inline(always)]
175 pub fn variant(self, variant: ISOCANFDEN_A) -> &'a mut W {
176 self.bit(variant.into())
177 }
178 #[doc = "FlexCAN operates using the non-ISO CAN FD protocol."]
179 #[inline(always)]
180 pub fn _0(self) -> &'a mut W {
181 self.variant(ISOCANFDEN_A::_0)
182 }
183 #[doc = "FlexCAN operates using the ISO CAN FD protocol (ISO 11898-1)."]
184 #[inline(always)]
185 pub fn _1(self) -> &'a mut W {
186 self.variant(ISOCANFDEN_A::_1)
187 }
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 = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
202 self.w
203 }
204}
205#[doc = "Protocol Exception Enable\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207pub enum PREXCEN_A {
208 #[doc = "0: Protocol Exception is disabled."]
209 _0 = 0,
210 #[doc = "1: Protocol Exception is enabled."]
211 _1 = 1,
212}
213impl From<PREXCEN_A> for bool {
214 #[inline(always)]
215 fn from(variant: PREXCEN_A) -> Self {
216 variant as u8 != 0
217 }
218}
219#[doc = "Field `PREXCEN` reader - Protocol Exception Enable"]
220pub struct PREXCEN_R(crate::FieldReader<bool, PREXCEN_A>);
221impl PREXCEN_R {
222 #[inline(always)]
223 pub(crate) fn new(bits: bool) -> Self {
224 PREXCEN_R(crate::FieldReader::new(bits))
225 }
226 #[doc = r"Get enumerated values variant"]
227 #[inline(always)]
228 pub fn variant(&self) -> PREXCEN_A {
229 match self.bits {
230 false => PREXCEN_A::_0,
231 true => PREXCEN_A::_1,
232 }
233 }
234 #[doc = "Checks if the value of the field is `_0`"]
235 #[inline(always)]
236 pub fn is_0(&self) -> bool {
237 **self == PREXCEN_A::_0
238 }
239 #[doc = "Checks if the value of the field is `_1`"]
240 #[inline(always)]
241 pub fn is_1(&self) -> bool {
242 **self == PREXCEN_A::_1
243 }
244}
245impl core::ops::Deref for PREXCEN_R {
246 type Target = crate::FieldReader<bool, PREXCEN_A>;
247 #[inline(always)]
248 fn deref(&self) -> &Self::Target {
249 &self.0
250 }
251}
252#[doc = "Field `PREXCEN` writer - Protocol Exception Enable"]
253pub struct PREXCEN_W<'a> {
254 w: &'a mut W,
255}
256impl<'a> PREXCEN_W<'a> {
257 #[doc = r"Writes `variant` to the field"]
258 #[inline(always)]
259 pub fn variant(self, variant: PREXCEN_A) -> &'a mut W {
260 self.bit(variant.into())
261 }
262 #[doc = "Protocol Exception is disabled."]
263 #[inline(always)]
264 pub fn _0(self) -> &'a mut W {
265 self.variant(PREXCEN_A::_0)
266 }
267 #[doc = "Protocol Exception is enabled."]
268 #[inline(always)]
269 pub fn _1(self) -> &'a mut W {
270 self.variant(PREXCEN_A::_1)
271 }
272 #[doc = r"Sets the field bit"]
273 #[inline(always)]
274 pub fn set_bit(self) -> &'a mut W {
275 self.bit(true)
276 }
277 #[doc = r"Clears the field bit"]
278 #[inline(always)]
279 pub fn clear_bit(self) -> &'a mut W {
280 self.bit(false)
281 }
282 #[doc = r"Writes raw bits to the field"]
283 #[inline(always)]
284 pub fn bit(self, value: bool) -> &'a mut W {
285 self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
286 self.w
287 }
288}
289#[doc = "Timer Source\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum TIMER_SRC_A {
292 #[doc = "0: The Free Running Timer is clocked by the CAN bit clock, which defines the baud rate on the CAN bus."]
293 _0 = 0,
294 #[doc = "1: The Free Running Timer is clocked by an external time tick. The period can be either adjusted to be equal to the baud rate on the CAN bus, or a different value as required. See the device specific section for details about the external time tick."]
295 _1 = 1,
296}
297impl From<TIMER_SRC_A> for bool {
298 #[inline(always)]
299 fn from(variant: TIMER_SRC_A) -> Self {
300 variant as u8 != 0
301 }
302}
303#[doc = "Field `TIMER_SRC` reader - Timer Source"]
304pub struct TIMER_SRC_R(crate::FieldReader<bool, TIMER_SRC_A>);
305impl TIMER_SRC_R {
306 #[inline(always)]
307 pub(crate) fn new(bits: bool) -> Self {
308 TIMER_SRC_R(crate::FieldReader::new(bits))
309 }
310 #[doc = r"Get enumerated values variant"]
311 #[inline(always)]
312 pub fn variant(&self) -> TIMER_SRC_A {
313 match self.bits {
314 false => TIMER_SRC_A::_0,
315 true => TIMER_SRC_A::_1,
316 }
317 }
318 #[doc = "Checks if the value of the field is `_0`"]
319 #[inline(always)]
320 pub fn is_0(&self) -> bool {
321 **self == TIMER_SRC_A::_0
322 }
323 #[doc = "Checks if the value of the field is `_1`"]
324 #[inline(always)]
325 pub fn is_1(&self) -> bool {
326 **self == TIMER_SRC_A::_1
327 }
328}
329impl core::ops::Deref for TIMER_SRC_R {
330 type Target = crate::FieldReader<bool, TIMER_SRC_A>;
331 #[inline(always)]
332 fn deref(&self) -> &Self::Target {
333 &self.0
334 }
335}
336#[doc = "Field `TIMER_SRC` writer - Timer Source"]
337pub struct TIMER_SRC_W<'a> {
338 w: &'a mut W,
339}
340impl<'a> TIMER_SRC_W<'a> {
341 #[doc = r"Writes `variant` to the field"]
342 #[inline(always)]
343 pub fn variant(self, variant: TIMER_SRC_A) -> &'a mut W {
344 self.bit(variant.into())
345 }
346 #[doc = "The Free Running Timer is clocked by the CAN bit clock, which defines the baud rate on the CAN bus."]
347 #[inline(always)]
348 pub fn _0(self) -> &'a mut W {
349 self.variant(TIMER_SRC_A::_0)
350 }
351 #[doc = "The Free Running Timer is clocked by an external time tick. The period can be either adjusted to be equal to the baud rate on the CAN bus, or a different value as required. See the device specific section for details about the external time tick."]
352 #[inline(always)]
353 pub fn _1(self) -> &'a mut W {
354 self.variant(TIMER_SRC_A::_1)
355 }
356 #[doc = r"Sets the field bit"]
357 #[inline(always)]
358 pub fn set_bit(self) -> &'a mut W {
359 self.bit(true)
360 }
361 #[doc = r"Clears the field bit"]
362 #[inline(always)]
363 pub fn clear_bit(self) -> &'a mut W {
364 self.bit(false)
365 }
366 #[doc = r"Writes raw bits to the field"]
367 #[inline(always)]
368 pub fn bit(self, value: bool) -> &'a mut W {
369 self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
370 self.w
371 }
372}
373#[doc = "Entire Frame Arbitration Field Comparison Enable For Rx Mailboxes\n\nValue on reset: 0"]
374#[derive(Clone, Copy, Debug, PartialEq)]
375pub enum EACEN_A {
376 #[doc = "0: Rx Mailbox filter's IDE bit is always compared and RTR is never compared despite mask bits."]
377 _0 = 0,
378 #[doc = "1: Enables the comparison of both Rx Mailbox filter's IDE and RTR bit with their corresponding bits within the incoming frame. Mask bits do apply."]
379 _1 = 1,
380}
381impl From<EACEN_A> for bool {
382 #[inline(always)]
383 fn from(variant: EACEN_A) -> Self {
384 variant as u8 != 0
385 }
386}
387#[doc = "Field `EACEN` reader - Entire Frame Arbitration Field Comparison Enable For Rx Mailboxes"]
388pub struct EACEN_R(crate::FieldReader<bool, EACEN_A>);
389impl EACEN_R {
390 #[inline(always)]
391 pub(crate) fn new(bits: bool) -> Self {
392 EACEN_R(crate::FieldReader::new(bits))
393 }
394 #[doc = r"Get enumerated values variant"]
395 #[inline(always)]
396 pub fn variant(&self) -> EACEN_A {
397 match self.bits {
398 false => EACEN_A::_0,
399 true => EACEN_A::_1,
400 }
401 }
402 #[doc = "Checks if the value of the field is `_0`"]
403 #[inline(always)]
404 pub fn is_0(&self) -> bool {
405 **self == EACEN_A::_0
406 }
407 #[doc = "Checks if the value of the field is `_1`"]
408 #[inline(always)]
409 pub fn is_1(&self) -> bool {
410 **self == EACEN_A::_1
411 }
412}
413impl core::ops::Deref for EACEN_R {
414 type Target = crate::FieldReader<bool, EACEN_A>;
415 #[inline(always)]
416 fn deref(&self) -> &Self::Target {
417 &self.0
418 }
419}
420#[doc = "Field `EACEN` writer - Entire Frame Arbitration Field Comparison Enable For Rx Mailboxes"]
421pub struct EACEN_W<'a> {
422 w: &'a mut W,
423}
424impl<'a> EACEN_W<'a> {
425 #[doc = r"Writes `variant` to the field"]
426 #[inline(always)]
427 pub fn variant(self, variant: EACEN_A) -> &'a mut W {
428 self.bit(variant.into())
429 }
430 #[doc = "Rx Mailbox filter's IDE bit is always compared and RTR is never compared despite mask bits."]
431 #[inline(always)]
432 pub fn _0(self) -> &'a mut W {
433 self.variant(EACEN_A::_0)
434 }
435 #[doc = "Enables the comparison of both Rx Mailbox filter's IDE and RTR bit with their corresponding bits within the incoming frame. Mask bits do apply."]
436 #[inline(always)]
437 pub fn _1(self) -> &'a mut W {
438 self.variant(EACEN_A::_1)
439 }
440 #[doc = r"Sets the field bit"]
441 #[inline(always)]
442 pub fn set_bit(self) -> &'a mut W {
443 self.bit(true)
444 }
445 #[doc = r"Clears the field bit"]
446 #[inline(always)]
447 pub fn clear_bit(self) -> &'a mut W {
448 self.bit(false)
449 }
450 #[doc = r"Writes raw bits to the field"]
451 #[inline(always)]
452 pub fn bit(self, value: bool) -> &'a mut W {
453 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
454 self.w
455 }
456}
457#[doc = "Remote Request Storing\n\nValue on reset: 0"]
458#[derive(Clone, Copy, Debug, PartialEq)]
459pub enum RRS_A {
460 #[doc = "0: Remote Response Frame is generated."]
461 _0 = 0,
462 #[doc = "1: Remote Request Frame is stored."]
463 _1 = 1,
464}
465impl From<RRS_A> for bool {
466 #[inline(always)]
467 fn from(variant: RRS_A) -> Self {
468 variant as u8 != 0
469 }
470}
471#[doc = "Field `RRS` reader - Remote Request Storing"]
472pub struct RRS_R(crate::FieldReader<bool, RRS_A>);
473impl RRS_R {
474 #[inline(always)]
475 pub(crate) fn new(bits: bool) -> Self {
476 RRS_R(crate::FieldReader::new(bits))
477 }
478 #[doc = r"Get enumerated values variant"]
479 #[inline(always)]
480 pub fn variant(&self) -> RRS_A {
481 match self.bits {
482 false => RRS_A::_0,
483 true => RRS_A::_1,
484 }
485 }
486 #[doc = "Checks if the value of the field is `_0`"]
487 #[inline(always)]
488 pub fn is_0(&self) -> bool {
489 **self == RRS_A::_0
490 }
491 #[doc = "Checks if the value of the field is `_1`"]
492 #[inline(always)]
493 pub fn is_1(&self) -> bool {
494 **self == RRS_A::_1
495 }
496}
497impl core::ops::Deref for RRS_R {
498 type Target = crate::FieldReader<bool, RRS_A>;
499 #[inline(always)]
500 fn deref(&self) -> &Self::Target {
501 &self.0
502 }
503}
504#[doc = "Field `RRS` writer - Remote Request Storing"]
505pub struct RRS_W<'a> {
506 w: &'a mut W,
507}
508impl<'a> RRS_W<'a> {
509 #[doc = r"Writes `variant` to the field"]
510 #[inline(always)]
511 pub fn variant(self, variant: RRS_A) -> &'a mut W {
512 self.bit(variant.into())
513 }
514 #[doc = "Remote Response Frame is generated."]
515 #[inline(always)]
516 pub fn _0(self) -> &'a mut W {
517 self.variant(RRS_A::_0)
518 }
519 #[doc = "Remote Request Frame is stored."]
520 #[inline(always)]
521 pub fn _1(self) -> &'a mut W {
522 self.variant(RRS_A::_1)
523 }
524 #[doc = r"Sets the field bit"]
525 #[inline(always)]
526 pub fn set_bit(self) -> &'a mut W {
527 self.bit(true)
528 }
529 #[doc = r"Clears the field bit"]
530 #[inline(always)]
531 pub fn clear_bit(self) -> &'a mut W {
532 self.bit(false)
533 }
534 #[doc = r"Writes raw bits to the field"]
535 #[inline(always)]
536 pub fn bit(self, value: bool) -> &'a mut W {
537 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
538 self.w
539 }
540}
541#[doc = "Mailboxes Reception Priority\n\nValue on reset: 0"]
542#[derive(Clone, Copy, Debug, PartialEq)]
543pub enum MRP_A {
544 #[doc = "0: Matching starts from Rx FIFO and continues on Mailboxes."]
545 _0 = 0,
546 #[doc = "1: Matching starts from Mailboxes and continues on Rx FIFO."]
547 _1 = 1,
548}
549impl From<MRP_A> for bool {
550 #[inline(always)]
551 fn from(variant: MRP_A) -> Self {
552 variant as u8 != 0
553 }
554}
555#[doc = "Field `MRP` reader - Mailboxes Reception Priority"]
556pub struct MRP_R(crate::FieldReader<bool, MRP_A>);
557impl MRP_R {
558 #[inline(always)]
559 pub(crate) fn new(bits: bool) -> Self {
560 MRP_R(crate::FieldReader::new(bits))
561 }
562 #[doc = r"Get enumerated values variant"]
563 #[inline(always)]
564 pub fn variant(&self) -> MRP_A {
565 match self.bits {
566 false => MRP_A::_0,
567 true => MRP_A::_1,
568 }
569 }
570 #[doc = "Checks if the value of the field is `_0`"]
571 #[inline(always)]
572 pub fn is_0(&self) -> bool {
573 **self == MRP_A::_0
574 }
575 #[doc = "Checks if the value of the field is `_1`"]
576 #[inline(always)]
577 pub fn is_1(&self) -> bool {
578 **self == MRP_A::_1
579 }
580}
581impl core::ops::Deref for MRP_R {
582 type Target = crate::FieldReader<bool, MRP_A>;
583 #[inline(always)]
584 fn deref(&self) -> &Self::Target {
585 &self.0
586 }
587}
588#[doc = "Field `MRP` writer - Mailboxes Reception Priority"]
589pub struct MRP_W<'a> {
590 w: &'a mut W,
591}
592impl<'a> MRP_W<'a> {
593 #[doc = r"Writes `variant` to the field"]
594 #[inline(always)]
595 pub fn variant(self, variant: MRP_A) -> &'a mut W {
596 self.bit(variant.into())
597 }
598 #[doc = "Matching starts from Rx FIFO and continues on Mailboxes."]
599 #[inline(always)]
600 pub fn _0(self) -> &'a mut W {
601 self.variant(MRP_A::_0)
602 }
603 #[doc = "Matching starts from Mailboxes and continues on Rx FIFO."]
604 #[inline(always)]
605 pub fn _1(self) -> &'a mut W {
606 self.variant(MRP_A::_1)
607 }
608 #[doc = r"Sets the field bit"]
609 #[inline(always)]
610 pub fn set_bit(self) -> &'a mut W {
611 self.bit(true)
612 }
613 #[doc = r"Clears the field bit"]
614 #[inline(always)]
615 pub fn clear_bit(self) -> &'a mut W {
616 self.bit(false)
617 }
618 #[doc = r"Writes raw bits to the field"]
619 #[inline(always)]
620 pub fn bit(self, value: bool) -> &'a mut W {
621 self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
622 self.w
623 }
624}
625#[doc = "Field `TASD` reader - Tx Arbitration Start Delay"]
626pub struct TASD_R(crate::FieldReader<u8, u8>);
627impl TASD_R {
628 #[inline(always)]
629 pub(crate) fn new(bits: u8) -> Self {
630 TASD_R(crate::FieldReader::new(bits))
631 }
632}
633impl core::ops::Deref for TASD_R {
634 type Target = crate::FieldReader<u8, u8>;
635 #[inline(always)]
636 fn deref(&self) -> &Self::Target {
637 &self.0
638 }
639}
640#[doc = "Field `TASD` writer - Tx Arbitration Start Delay"]
641pub struct TASD_W<'a> {
642 w: &'a mut W,
643}
644impl<'a> TASD_W<'a> {
645 #[doc = r"Writes raw bits to the field"]
646 #[inline(always)]
647 pub unsafe fn bits(self, value: u8) -> &'a mut W {
648 self.w.bits = (self.w.bits & !(0x1f << 19)) | ((value as u32 & 0x1f) << 19);
649 self.w
650 }
651}
652#[doc = "Field `RFFN` reader - Number Of Rx FIFO Filters"]
653pub struct RFFN_R(crate::FieldReader<u8, u8>);
654impl RFFN_R {
655 #[inline(always)]
656 pub(crate) fn new(bits: u8) -> Self {
657 RFFN_R(crate::FieldReader::new(bits))
658 }
659}
660impl core::ops::Deref for RFFN_R {
661 type Target = crate::FieldReader<u8, u8>;
662 #[inline(always)]
663 fn deref(&self) -> &Self::Target {
664 &self.0
665 }
666}
667#[doc = "Field `RFFN` writer - Number Of Rx FIFO Filters"]
668pub struct RFFN_W<'a> {
669 w: &'a mut W,
670}
671impl<'a> RFFN_W<'a> {
672 #[doc = r"Writes raw bits to the field"]
673 #[inline(always)]
674 pub unsafe fn bits(self, value: u8) -> &'a mut W {
675 self.w.bits = (self.w.bits & !(0x0f << 24)) | ((value as u32 & 0x0f) << 24);
676 self.w
677 }
678}
679#[doc = "Bus Off Done Interrupt Mask\n\nValue on reset: 0"]
680#[derive(Clone, Copy, Debug, PartialEq)]
681pub enum BOFFDONEMSK_A {
682 #[doc = "0: Bus Off Done interrupt disabled."]
683 _0 = 0,
684 #[doc = "1: Bus Off Done interrupt enabled."]
685 _1 = 1,
686}
687impl From<BOFFDONEMSK_A> for bool {
688 #[inline(always)]
689 fn from(variant: BOFFDONEMSK_A) -> Self {
690 variant as u8 != 0
691 }
692}
693#[doc = "Field `BOFFDONEMSK` reader - Bus Off Done Interrupt Mask"]
694pub struct BOFFDONEMSK_R(crate::FieldReader<bool, BOFFDONEMSK_A>);
695impl BOFFDONEMSK_R {
696 #[inline(always)]
697 pub(crate) fn new(bits: bool) -> Self {
698 BOFFDONEMSK_R(crate::FieldReader::new(bits))
699 }
700 #[doc = r"Get enumerated values variant"]
701 #[inline(always)]
702 pub fn variant(&self) -> BOFFDONEMSK_A {
703 match self.bits {
704 false => BOFFDONEMSK_A::_0,
705 true => BOFFDONEMSK_A::_1,
706 }
707 }
708 #[doc = "Checks if the value of the field is `_0`"]
709 #[inline(always)]
710 pub fn is_0(&self) -> bool {
711 **self == BOFFDONEMSK_A::_0
712 }
713 #[doc = "Checks if the value of the field is `_1`"]
714 #[inline(always)]
715 pub fn is_1(&self) -> bool {
716 **self == BOFFDONEMSK_A::_1
717 }
718}
719impl core::ops::Deref for BOFFDONEMSK_R {
720 type Target = crate::FieldReader<bool, BOFFDONEMSK_A>;
721 #[inline(always)]
722 fn deref(&self) -> &Self::Target {
723 &self.0
724 }
725}
726#[doc = "Field `BOFFDONEMSK` writer - Bus Off Done Interrupt Mask"]
727pub struct BOFFDONEMSK_W<'a> {
728 w: &'a mut W,
729}
730impl<'a> BOFFDONEMSK_W<'a> {
731 #[doc = r"Writes `variant` to the field"]
732 #[inline(always)]
733 pub fn variant(self, variant: BOFFDONEMSK_A) -> &'a mut W {
734 self.bit(variant.into())
735 }
736 #[doc = "Bus Off Done interrupt disabled."]
737 #[inline(always)]
738 pub fn _0(self) -> &'a mut W {
739 self.variant(BOFFDONEMSK_A::_0)
740 }
741 #[doc = "Bus Off Done interrupt enabled."]
742 #[inline(always)]
743 pub fn _1(self) -> &'a mut W {
744 self.variant(BOFFDONEMSK_A::_1)
745 }
746 #[doc = r"Sets the field bit"]
747 #[inline(always)]
748 pub fn set_bit(self) -> &'a mut W {
749 self.bit(true)
750 }
751 #[doc = r"Clears the field bit"]
752 #[inline(always)]
753 pub fn clear_bit(self) -> &'a mut W {
754 self.bit(false)
755 }
756 #[doc = r"Writes raw bits to the field"]
757 #[inline(always)]
758 pub fn bit(self, value: bool) -> &'a mut W {
759 self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
760 self.w
761 }
762}
763#[doc = "Error Interrupt Mask for errors detected in the Data Phase of fast CAN FD frames\n\nValue on reset: 0"]
764#[derive(Clone, Copy, Debug, PartialEq)]
765pub enum ERRMSK_FAST_A {
766 #[doc = "0: ERRINT_FAST Error interrupt disabled."]
767 _0 = 0,
768 #[doc = "1: ERRINT_FAST Error interrupt enabled."]
769 _1 = 1,
770}
771impl From<ERRMSK_FAST_A> for bool {
772 #[inline(always)]
773 fn from(variant: ERRMSK_FAST_A) -> Self {
774 variant as u8 != 0
775 }
776}
777#[doc = "Field `ERRMSK_FAST` reader - Error Interrupt Mask for errors detected in the Data Phase of fast CAN FD frames"]
778pub struct ERRMSK_FAST_R(crate::FieldReader<bool, ERRMSK_FAST_A>);
779impl ERRMSK_FAST_R {
780 #[inline(always)]
781 pub(crate) fn new(bits: bool) -> Self {
782 ERRMSK_FAST_R(crate::FieldReader::new(bits))
783 }
784 #[doc = r"Get enumerated values variant"]
785 #[inline(always)]
786 pub fn variant(&self) -> ERRMSK_FAST_A {
787 match self.bits {
788 false => ERRMSK_FAST_A::_0,
789 true => ERRMSK_FAST_A::_1,
790 }
791 }
792 #[doc = "Checks if the value of the field is `_0`"]
793 #[inline(always)]
794 pub fn is_0(&self) -> bool {
795 **self == ERRMSK_FAST_A::_0
796 }
797 #[doc = "Checks if the value of the field is `_1`"]
798 #[inline(always)]
799 pub fn is_1(&self) -> bool {
800 **self == ERRMSK_FAST_A::_1
801 }
802}
803impl core::ops::Deref for ERRMSK_FAST_R {
804 type Target = crate::FieldReader<bool, ERRMSK_FAST_A>;
805 #[inline(always)]
806 fn deref(&self) -> &Self::Target {
807 &self.0
808 }
809}
810#[doc = "Field `ERRMSK_FAST` writer - Error Interrupt Mask for errors detected in the Data Phase of fast CAN FD frames"]
811pub struct ERRMSK_FAST_W<'a> {
812 w: &'a mut W,
813}
814impl<'a> ERRMSK_FAST_W<'a> {
815 #[doc = r"Writes `variant` to the field"]
816 #[inline(always)]
817 pub fn variant(self, variant: ERRMSK_FAST_A) -> &'a mut W {
818 self.bit(variant.into())
819 }
820 #[doc = "ERRINT_FAST Error interrupt disabled."]
821 #[inline(always)]
822 pub fn _0(self) -> &'a mut W {
823 self.variant(ERRMSK_FAST_A::_0)
824 }
825 #[doc = "ERRINT_FAST Error interrupt enabled."]
826 #[inline(always)]
827 pub fn _1(self) -> &'a mut W {
828 self.variant(ERRMSK_FAST_A::_1)
829 }
830 #[doc = r"Sets the field bit"]
831 #[inline(always)]
832 pub fn set_bit(self) -> &'a mut W {
833 self.bit(true)
834 }
835 #[doc = r"Clears the field bit"]
836 #[inline(always)]
837 pub fn clear_bit(self) -> &'a mut W {
838 self.bit(false)
839 }
840 #[doc = r"Writes raw bits to the field"]
841 #[inline(always)]
842 pub fn bit(self, value: bool) -> &'a mut W {
843 self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
844 self.w
845 }
846}
847impl R {
848 #[doc = "Bit 11 - Edge Filter Disable"]
849 #[inline(always)]
850 pub fn edfltdis(&self) -> EDFLTDIS_R {
851 EDFLTDIS_R::new(((self.bits >> 11) & 0x01) != 0)
852 }
853 #[doc = "Bit 12 - ISO CAN FD Enable"]
854 #[inline(always)]
855 pub fn isocanfden(&self) -> ISOCANFDEN_R {
856 ISOCANFDEN_R::new(((self.bits >> 12) & 0x01) != 0)
857 }
858 #[doc = "Bit 14 - Protocol Exception Enable"]
859 #[inline(always)]
860 pub fn prexcen(&self) -> PREXCEN_R {
861 PREXCEN_R::new(((self.bits >> 14) & 0x01) != 0)
862 }
863 #[doc = "Bit 15 - Timer Source"]
864 #[inline(always)]
865 pub fn timer_src(&self) -> TIMER_SRC_R {
866 TIMER_SRC_R::new(((self.bits >> 15) & 0x01) != 0)
867 }
868 #[doc = "Bit 16 - Entire Frame Arbitration Field Comparison Enable For Rx Mailboxes"]
869 #[inline(always)]
870 pub fn eacen(&self) -> EACEN_R {
871 EACEN_R::new(((self.bits >> 16) & 0x01) != 0)
872 }
873 #[doc = "Bit 17 - Remote Request Storing"]
874 #[inline(always)]
875 pub fn rrs(&self) -> RRS_R {
876 RRS_R::new(((self.bits >> 17) & 0x01) != 0)
877 }
878 #[doc = "Bit 18 - Mailboxes Reception Priority"]
879 #[inline(always)]
880 pub fn mrp(&self) -> MRP_R {
881 MRP_R::new(((self.bits >> 18) & 0x01) != 0)
882 }
883 #[doc = "Bits 19:23 - Tx Arbitration Start Delay"]
884 #[inline(always)]
885 pub fn tasd(&self) -> TASD_R {
886 TASD_R::new(((self.bits >> 19) & 0x1f) as u8)
887 }
888 #[doc = "Bits 24:27 - Number Of Rx FIFO Filters"]
889 #[inline(always)]
890 pub fn rffn(&self) -> RFFN_R {
891 RFFN_R::new(((self.bits >> 24) & 0x0f) as u8)
892 }
893 #[doc = "Bit 30 - Bus Off Done Interrupt Mask"]
894 #[inline(always)]
895 pub fn boffdonemsk(&self) -> BOFFDONEMSK_R {
896 BOFFDONEMSK_R::new(((self.bits >> 30) & 0x01) != 0)
897 }
898 #[doc = "Bit 31 - Error Interrupt Mask for errors detected in the Data Phase of fast CAN FD frames"]
899 #[inline(always)]
900 pub fn errmsk_fast(&self) -> ERRMSK_FAST_R {
901 ERRMSK_FAST_R::new(((self.bits >> 31) & 0x01) != 0)
902 }
903}
904impl W {
905 #[doc = "Bit 11 - Edge Filter Disable"]
906 #[inline(always)]
907 pub fn edfltdis(&mut self) -> EDFLTDIS_W {
908 EDFLTDIS_W { w: self }
909 }
910 #[doc = "Bit 12 - ISO CAN FD Enable"]
911 #[inline(always)]
912 pub fn isocanfden(&mut self) -> ISOCANFDEN_W {
913 ISOCANFDEN_W { w: self }
914 }
915 #[doc = "Bit 14 - Protocol Exception Enable"]
916 #[inline(always)]
917 pub fn prexcen(&mut self) -> PREXCEN_W {
918 PREXCEN_W { w: self }
919 }
920 #[doc = "Bit 15 - Timer Source"]
921 #[inline(always)]
922 pub fn timer_src(&mut self) -> TIMER_SRC_W {
923 TIMER_SRC_W { w: self }
924 }
925 #[doc = "Bit 16 - Entire Frame Arbitration Field Comparison Enable For Rx Mailboxes"]
926 #[inline(always)]
927 pub fn eacen(&mut self) -> EACEN_W {
928 EACEN_W { w: self }
929 }
930 #[doc = "Bit 17 - Remote Request Storing"]
931 #[inline(always)]
932 pub fn rrs(&mut self) -> RRS_W {
933 RRS_W { w: self }
934 }
935 #[doc = "Bit 18 - Mailboxes Reception Priority"]
936 #[inline(always)]
937 pub fn mrp(&mut self) -> MRP_W {
938 MRP_W { w: self }
939 }
940 #[doc = "Bits 19:23 - Tx Arbitration Start Delay"]
941 #[inline(always)]
942 pub fn tasd(&mut self) -> TASD_W {
943 TASD_W { w: self }
944 }
945 #[doc = "Bits 24:27 - Number Of Rx FIFO Filters"]
946 #[inline(always)]
947 pub fn rffn(&mut self) -> RFFN_W {
948 RFFN_W { w: self }
949 }
950 #[doc = "Bit 30 - Bus Off Done Interrupt Mask"]
951 #[inline(always)]
952 pub fn boffdonemsk(&mut self) -> BOFFDONEMSK_W {
953 BOFFDONEMSK_W { w: self }
954 }
955 #[doc = "Bit 31 - Error Interrupt Mask for errors detected in the Data Phase of fast CAN FD frames"]
956 #[inline(always)]
957 pub fn errmsk_fast(&mut self) -> ERRMSK_FAST_W {
958 ERRMSK_FAST_W { w: self }
959 }
960 #[doc = "Writes raw bits to the register."]
961 #[inline(always)]
962 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
963 self.0.bits(bits);
964 self
965 }
966}
967#[doc = "Control 2 register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrl2](index.html) module"]
968pub struct CTRL2_SPEC;
969impl crate::RegisterSpec for CTRL2_SPEC {
970 type Ux = u32;
971}
972#[doc = "`read()` method returns [ctrl2::R](R) reader structure"]
973impl crate::Readable for CTRL2_SPEC {
974 type Reader = R;
975}
976#[doc = "`write(|w| ..)` method takes [ctrl2::W](W) writer structure"]
977impl crate::Writable for CTRL2_SPEC {
978 type Writer = W;
979}
980#[doc = "`reset()` method sets CTRL2 to value 0x00a0_0000"]
981impl crate::Resettable for CTRL2_SPEC {
982 #[inline(always)]
983 fn reset_value() -> Self::Ux {
984 0x00a0_0000
985 }
986}