atsam4e8e_pac/can0/
sr.rs

1#[doc = "Register `SR` reader"]
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `MB0` reader - Mailbox 0 Event"]
17pub type MB0_R = crate::BitReader<bool>;
18#[doc = "Field `MB1` reader - Mailbox 1 Event"]
19pub type MB1_R = crate::BitReader<bool>;
20#[doc = "Field `MB2` reader - Mailbox 2 Event"]
21pub type MB2_R = crate::BitReader<bool>;
22#[doc = "Field `MB3` reader - Mailbox 3 Event"]
23pub type MB3_R = crate::BitReader<bool>;
24#[doc = "Field `MB4` reader - Mailbox 4 Event"]
25pub type MB4_R = crate::BitReader<bool>;
26#[doc = "Field `MB5` reader - Mailbox 5 Event"]
27pub type MB5_R = crate::BitReader<bool>;
28#[doc = "Field `MB6` reader - Mailbox 6 Event"]
29pub type MB6_R = crate::BitReader<bool>;
30#[doc = "Field `MB7` reader - Mailbox 7 Event"]
31pub type MB7_R = crate::BitReader<bool>;
32#[doc = "Field `ERRA` reader - Error Active Mode"]
33pub type ERRA_R = crate::BitReader<bool>;
34#[doc = "Field `WARN` reader - Warning Limit"]
35pub type WARN_R = crate::BitReader<bool>;
36#[doc = "Field `ERRP` reader - Error Passive Mode"]
37pub type ERRP_R = crate::BitReader<bool>;
38#[doc = "Field `BOFF` reader - Bus Off Mode"]
39pub type BOFF_R = crate::BitReader<bool>;
40#[doc = "Field `SLEEP` reader - CAN controller in Low power Mode"]
41pub type SLEEP_R = crate::BitReader<bool>;
42#[doc = "Field `WAKEUP` reader - CAN controller is not in Low power Mode"]
43pub type WAKEUP_R = crate::BitReader<bool>;
44#[doc = "Field `TOVF` reader - Timer Overflow"]
45pub type TOVF_R = crate::BitReader<bool>;
46#[doc = "Field `TSTP` reader - Timestamp"]
47pub type TSTP_R = crate::BitReader<bool>;
48#[doc = "Field `CERR` reader - Mailbox CRC Error"]
49pub type CERR_R = crate::BitReader<bool>;
50#[doc = "Field `SERR` reader - Mailbox Stuffing Error"]
51pub type SERR_R = crate::BitReader<bool>;
52#[doc = "Field `AERR` reader - Acknowledgment Error"]
53pub type AERR_R = crate::BitReader<bool>;
54#[doc = "Field `FERR` reader - Form Error"]
55pub type FERR_R = crate::BitReader<bool>;
56#[doc = "Field `BERR` reader - Bit Error"]
57pub type BERR_R = crate::BitReader<bool>;
58#[doc = "Field `RBSY` reader - Receiver busy"]
59pub type RBSY_R = crate::BitReader<bool>;
60#[doc = "Field `TBSY` reader - Transmitter busy"]
61pub type TBSY_R = crate::BitReader<bool>;
62#[doc = "Field `OVLSY` reader - Overload busy"]
63pub type OVLSY_R = crate::BitReader<bool>;
64impl R {
65    #[doc = "Bit 0 - Mailbox 0 Event"]
66    #[inline(always)]
67    pub fn mb0(&self) -> MB0_R {
68        MB0_R::new((self.bits & 1) != 0)
69    }
70    #[doc = "Bit 1 - Mailbox 1 Event"]
71    #[inline(always)]
72    pub fn mb1(&self) -> MB1_R {
73        MB1_R::new(((self.bits >> 1) & 1) != 0)
74    }
75    #[doc = "Bit 2 - Mailbox 2 Event"]
76    #[inline(always)]
77    pub fn mb2(&self) -> MB2_R {
78        MB2_R::new(((self.bits >> 2) & 1) != 0)
79    }
80    #[doc = "Bit 3 - Mailbox 3 Event"]
81    #[inline(always)]
82    pub fn mb3(&self) -> MB3_R {
83        MB3_R::new(((self.bits >> 3) & 1) != 0)
84    }
85    #[doc = "Bit 4 - Mailbox 4 Event"]
86    #[inline(always)]
87    pub fn mb4(&self) -> MB4_R {
88        MB4_R::new(((self.bits >> 4) & 1) != 0)
89    }
90    #[doc = "Bit 5 - Mailbox 5 Event"]
91    #[inline(always)]
92    pub fn mb5(&self) -> MB5_R {
93        MB5_R::new(((self.bits >> 5) & 1) != 0)
94    }
95    #[doc = "Bit 6 - Mailbox 6 Event"]
96    #[inline(always)]
97    pub fn mb6(&self) -> MB6_R {
98        MB6_R::new(((self.bits >> 6) & 1) != 0)
99    }
100    #[doc = "Bit 7 - Mailbox 7 Event"]
101    #[inline(always)]
102    pub fn mb7(&self) -> MB7_R {
103        MB7_R::new(((self.bits >> 7) & 1) != 0)
104    }
105    #[doc = "Bit 16 - Error Active Mode"]
106    #[inline(always)]
107    pub fn erra(&self) -> ERRA_R {
108        ERRA_R::new(((self.bits >> 16) & 1) != 0)
109    }
110    #[doc = "Bit 17 - Warning Limit"]
111    #[inline(always)]
112    pub fn warn(&self) -> WARN_R {
113        WARN_R::new(((self.bits >> 17) & 1) != 0)
114    }
115    #[doc = "Bit 18 - Error Passive Mode"]
116    #[inline(always)]
117    pub fn errp(&self) -> ERRP_R {
118        ERRP_R::new(((self.bits >> 18) & 1) != 0)
119    }
120    #[doc = "Bit 19 - Bus Off Mode"]
121    #[inline(always)]
122    pub fn boff(&self) -> BOFF_R {
123        BOFF_R::new(((self.bits >> 19) & 1) != 0)
124    }
125    #[doc = "Bit 20 - CAN controller in Low power Mode"]
126    #[inline(always)]
127    pub fn sleep(&self) -> SLEEP_R {
128        SLEEP_R::new(((self.bits >> 20) & 1) != 0)
129    }
130    #[doc = "Bit 21 - CAN controller is not in Low power Mode"]
131    #[inline(always)]
132    pub fn wakeup(&self) -> WAKEUP_R {
133        WAKEUP_R::new(((self.bits >> 21) & 1) != 0)
134    }
135    #[doc = "Bit 22 - Timer Overflow"]
136    #[inline(always)]
137    pub fn tovf(&self) -> TOVF_R {
138        TOVF_R::new(((self.bits >> 22) & 1) != 0)
139    }
140    #[doc = "Bit 23 - Timestamp"]
141    #[inline(always)]
142    pub fn tstp(&self) -> TSTP_R {
143        TSTP_R::new(((self.bits >> 23) & 1) != 0)
144    }
145    #[doc = "Bit 24 - Mailbox CRC Error"]
146    #[inline(always)]
147    pub fn cerr(&self) -> CERR_R {
148        CERR_R::new(((self.bits >> 24) & 1) != 0)
149    }
150    #[doc = "Bit 25 - Mailbox Stuffing Error"]
151    #[inline(always)]
152    pub fn serr(&self) -> SERR_R {
153        SERR_R::new(((self.bits >> 25) & 1) != 0)
154    }
155    #[doc = "Bit 26 - Acknowledgment Error"]
156    #[inline(always)]
157    pub fn aerr(&self) -> AERR_R {
158        AERR_R::new(((self.bits >> 26) & 1) != 0)
159    }
160    #[doc = "Bit 27 - Form Error"]
161    #[inline(always)]
162    pub fn ferr(&self) -> FERR_R {
163        FERR_R::new(((self.bits >> 27) & 1) != 0)
164    }
165    #[doc = "Bit 28 - Bit Error"]
166    #[inline(always)]
167    pub fn berr(&self) -> BERR_R {
168        BERR_R::new(((self.bits >> 28) & 1) != 0)
169    }
170    #[doc = "Bit 29 - Receiver busy"]
171    #[inline(always)]
172    pub fn rbsy(&self) -> RBSY_R {
173        RBSY_R::new(((self.bits >> 29) & 1) != 0)
174    }
175    #[doc = "Bit 30 - Transmitter busy"]
176    #[inline(always)]
177    pub fn tbsy(&self) -> TBSY_R {
178        TBSY_R::new(((self.bits >> 30) & 1) != 0)
179    }
180    #[doc = "Bit 31 - Overload busy"]
181    #[inline(always)]
182    pub fn ovlsy(&self) -> OVLSY_R {
183        OVLSY_R::new(((self.bits >> 31) & 1) != 0)
184    }
185}
186#[doc = "Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [sr](index.html) module"]
187pub struct SR_SPEC;
188impl crate::RegisterSpec for SR_SPEC {
189    type Ux = u32;
190}
191#[doc = "`read()` method returns [sr::R](R) reader structure"]
192impl crate::Readable for SR_SPEC {
193    type Reader = R;
194}
195#[doc = "`reset()` method sets SR to value 0"]
196impl crate::Resettable for SR_SPEC {
197    const RESET_VALUE: Self::Ux = 0;
198}