ra6e1/can0/
rfcr.rs

1#[doc = "Register `RFCR` reader"]
2pub struct R(crate::R<RFCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RFCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RFCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RFCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RFCR` writer"]
17pub struct W(crate::W<RFCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RFCR_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<RFCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RFCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RFE` reader - Receive FIFO Enable"]
38pub type RFE_R = crate::BitReader<RFE_A>;
39#[doc = "Receive FIFO Enable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum RFE_A {
42    #[doc = "0: Disable receive FIFO"]
43    _0 = 0,
44    #[doc = "1: Enable receive FIFO"]
45    _1 = 1,
46}
47impl From<RFE_A> for bool {
48    #[inline(always)]
49    fn from(variant: RFE_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl RFE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> RFE_A {
57        match self.bits {
58            false => RFE_A::_0,
59            true => RFE_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == RFE_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == RFE_A::_1
71    }
72}
73#[doc = "Field `RFE` writer - Receive FIFO Enable"]
74pub type RFE_W<'a, const O: u8> = crate::BitWriter<'a, u8, RFCR_SPEC, RFE_A, O>;
75impl<'a, const O: u8> RFE_W<'a, O> {
76    #[doc = "Disable receive FIFO"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(RFE_A::_0)
80    }
81    #[doc = "Enable receive FIFO"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(RFE_A::_1)
85    }
86}
87#[doc = "Field `RFUST` reader - Receive FIFO Unread Message Number Status"]
88pub type RFUST_R = crate::FieldReader<u8, RFUST_A>;
89#[doc = "Receive FIFO Unread Message Number Status\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91#[repr(u8)]
92pub enum RFUST_A {
93    #[doc = "0: No unread message"]
94    _000 = 0,
95    #[doc = "1: 1 unread message"]
96    _001 = 1,
97    #[doc = "2: 2 unread messages"]
98    _010 = 2,
99    #[doc = "3: 3 unread messages"]
100    _011 = 3,
101    #[doc = "4: 4 unread messages"]
102    _100 = 4,
103    #[doc = "5: Reserved"]
104    _101 = 5,
105    #[doc = "6: Reserved"]
106    _110 = 6,
107    #[doc = "7: Reserved"]
108    _111 = 7,
109}
110impl From<RFUST_A> for u8 {
111    #[inline(always)]
112    fn from(variant: RFUST_A) -> Self {
113        variant as _
114    }
115}
116impl RFUST_R {
117    #[doc = "Get enumerated values variant"]
118    #[inline(always)]
119    pub fn variant(&self) -> RFUST_A {
120        match self.bits {
121            0 => RFUST_A::_000,
122            1 => RFUST_A::_001,
123            2 => RFUST_A::_010,
124            3 => RFUST_A::_011,
125            4 => RFUST_A::_100,
126            5 => RFUST_A::_101,
127            6 => RFUST_A::_110,
128            7 => RFUST_A::_111,
129            _ => unreachable!(),
130        }
131    }
132    #[doc = "Checks if the value of the field is `_000`"]
133    #[inline(always)]
134    pub fn is_000(&self) -> bool {
135        *self == RFUST_A::_000
136    }
137    #[doc = "Checks if the value of the field is `_001`"]
138    #[inline(always)]
139    pub fn is_001(&self) -> bool {
140        *self == RFUST_A::_001
141    }
142    #[doc = "Checks if the value of the field is `_010`"]
143    #[inline(always)]
144    pub fn is_010(&self) -> bool {
145        *self == RFUST_A::_010
146    }
147    #[doc = "Checks if the value of the field is `_011`"]
148    #[inline(always)]
149    pub fn is_011(&self) -> bool {
150        *self == RFUST_A::_011
151    }
152    #[doc = "Checks if the value of the field is `_100`"]
153    #[inline(always)]
154    pub fn is_100(&self) -> bool {
155        *self == RFUST_A::_100
156    }
157    #[doc = "Checks if the value of the field is `_101`"]
158    #[inline(always)]
159    pub fn is_101(&self) -> bool {
160        *self == RFUST_A::_101
161    }
162    #[doc = "Checks if the value of the field is `_110`"]
163    #[inline(always)]
164    pub fn is_110(&self) -> bool {
165        *self == RFUST_A::_110
166    }
167    #[doc = "Checks if the value of the field is `_111`"]
168    #[inline(always)]
169    pub fn is_111(&self) -> bool {
170        *self == RFUST_A::_111
171    }
172}
173#[doc = "Field `RFMLF` reader - Receive FIFO Message Lost Flag"]
174pub type RFMLF_R = crate::BitReader<RFMLF_A>;
175#[doc = "Receive FIFO Message Lost Flag\n\nValue on reset: 0"]
176#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177pub enum RFMLF_A {
178    #[doc = "0: Receive FIFO message not lost"]
179    _0 = 0,
180    #[doc = "1: Receive FIFO message lost"]
181    _1 = 1,
182}
183impl From<RFMLF_A> for bool {
184    #[inline(always)]
185    fn from(variant: RFMLF_A) -> Self {
186        variant as u8 != 0
187    }
188}
189impl RFMLF_R {
190    #[doc = "Get enumerated values variant"]
191    #[inline(always)]
192    pub fn variant(&self) -> RFMLF_A {
193        match self.bits {
194            false => RFMLF_A::_0,
195            true => RFMLF_A::_1,
196        }
197    }
198    #[doc = "Checks if the value of the field is `_0`"]
199    #[inline(always)]
200    pub fn is_0(&self) -> bool {
201        *self == RFMLF_A::_0
202    }
203    #[doc = "Checks if the value of the field is `_1`"]
204    #[inline(always)]
205    pub fn is_1(&self) -> bool {
206        *self == RFMLF_A::_1
207    }
208}
209#[doc = "Field `RFMLF` writer - Receive FIFO Message Lost Flag"]
210pub type RFMLF_W<'a, const O: u8> = crate::BitWriter<'a, u8, RFCR_SPEC, RFMLF_A, O>;
211impl<'a, const O: u8> RFMLF_W<'a, O> {
212    #[doc = "Receive FIFO message not lost"]
213    #[inline(always)]
214    pub fn _0(self) -> &'a mut W {
215        self.variant(RFMLF_A::_0)
216    }
217    #[doc = "Receive FIFO message lost"]
218    #[inline(always)]
219    pub fn _1(self) -> &'a mut W {
220        self.variant(RFMLF_A::_1)
221    }
222}
223#[doc = "Field `RFFST` reader - Receive FIFO Full Status Flag"]
224pub type RFFST_R = crate::BitReader<RFFST_A>;
225#[doc = "Receive FIFO Full Status Flag\n\nValue on reset: 0"]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227pub enum RFFST_A {
228    #[doc = "0: Receive FIFO not full"]
229    _0 = 0,
230    #[doc = "1: Receive FIFO full (4 unread messages)"]
231    _1 = 1,
232}
233impl From<RFFST_A> for bool {
234    #[inline(always)]
235    fn from(variant: RFFST_A) -> Self {
236        variant as u8 != 0
237    }
238}
239impl RFFST_R {
240    #[doc = "Get enumerated values variant"]
241    #[inline(always)]
242    pub fn variant(&self) -> RFFST_A {
243        match self.bits {
244            false => RFFST_A::_0,
245            true => RFFST_A::_1,
246        }
247    }
248    #[doc = "Checks if the value of the field is `_0`"]
249    #[inline(always)]
250    pub fn is_0(&self) -> bool {
251        *self == RFFST_A::_0
252    }
253    #[doc = "Checks if the value of the field is `_1`"]
254    #[inline(always)]
255    pub fn is_1(&self) -> bool {
256        *self == RFFST_A::_1
257    }
258}
259#[doc = "Field `RFWST` reader - Receive FIFO Buffer Warning Status Flag"]
260pub type RFWST_R = crate::BitReader<RFWST_A>;
261#[doc = "Receive FIFO Buffer Warning Status Flag\n\nValue on reset: 0"]
262#[derive(Clone, Copy, Debug, PartialEq, Eq)]
263pub enum RFWST_A {
264    #[doc = "0: Receive FIFO is not buffer warning"]
265    _0 = 0,
266    #[doc = "1: Receive FIFO is buffer warning (3 unread messages)"]
267    _1 = 1,
268}
269impl From<RFWST_A> for bool {
270    #[inline(always)]
271    fn from(variant: RFWST_A) -> Self {
272        variant as u8 != 0
273    }
274}
275impl RFWST_R {
276    #[doc = "Get enumerated values variant"]
277    #[inline(always)]
278    pub fn variant(&self) -> RFWST_A {
279        match self.bits {
280            false => RFWST_A::_0,
281            true => RFWST_A::_1,
282        }
283    }
284    #[doc = "Checks if the value of the field is `_0`"]
285    #[inline(always)]
286    pub fn is_0(&self) -> bool {
287        *self == RFWST_A::_0
288    }
289    #[doc = "Checks if the value of the field is `_1`"]
290    #[inline(always)]
291    pub fn is_1(&self) -> bool {
292        *self == RFWST_A::_1
293    }
294}
295#[doc = "Field `RFEST` reader - Receive FIFO Empty Status Flag"]
296pub type RFEST_R = crate::BitReader<RFEST_A>;
297#[doc = "Receive FIFO Empty Status Flag\n\nValue on reset: 1"]
298#[derive(Clone, Copy, Debug, PartialEq, Eq)]
299pub enum RFEST_A {
300    #[doc = "0: Unread message in receive FIFO"]
301    _0 = 0,
302    #[doc = "1: No unread message in receive FIFO"]
303    _1 = 1,
304}
305impl From<RFEST_A> for bool {
306    #[inline(always)]
307    fn from(variant: RFEST_A) -> Self {
308        variant as u8 != 0
309    }
310}
311impl RFEST_R {
312    #[doc = "Get enumerated values variant"]
313    #[inline(always)]
314    pub fn variant(&self) -> RFEST_A {
315        match self.bits {
316            false => RFEST_A::_0,
317            true => RFEST_A::_1,
318        }
319    }
320    #[doc = "Checks if the value of the field is `_0`"]
321    #[inline(always)]
322    pub fn is_0(&self) -> bool {
323        *self == RFEST_A::_0
324    }
325    #[doc = "Checks if the value of the field is `_1`"]
326    #[inline(always)]
327    pub fn is_1(&self) -> bool {
328        *self == RFEST_A::_1
329    }
330}
331impl R {
332    #[doc = "Bit 0 - Receive FIFO Enable"]
333    #[inline(always)]
334    pub fn rfe(&self) -> RFE_R {
335        RFE_R::new((self.bits & 1) != 0)
336    }
337    #[doc = "Bits 1:3 - Receive FIFO Unread Message Number Status"]
338    #[inline(always)]
339    pub fn rfust(&self) -> RFUST_R {
340        RFUST_R::new((self.bits >> 1) & 7)
341    }
342    #[doc = "Bit 4 - Receive FIFO Message Lost Flag"]
343    #[inline(always)]
344    pub fn rfmlf(&self) -> RFMLF_R {
345        RFMLF_R::new(((self.bits >> 4) & 1) != 0)
346    }
347    #[doc = "Bit 5 - Receive FIFO Full Status Flag"]
348    #[inline(always)]
349    pub fn rffst(&self) -> RFFST_R {
350        RFFST_R::new(((self.bits >> 5) & 1) != 0)
351    }
352    #[doc = "Bit 6 - Receive FIFO Buffer Warning Status Flag"]
353    #[inline(always)]
354    pub fn rfwst(&self) -> RFWST_R {
355        RFWST_R::new(((self.bits >> 6) & 1) != 0)
356    }
357    #[doc = "Bit 7 - Receive FIFO Empty Status Flag"]
358    #[inline(always)]
359    pub fn rfest(&self) -> RFEST_R {
360        RFEST_R::new(((self.bits >> 7) & 1) != 0)
361    }
362}
363impl W {
364    #[doc = "Bit 0 - Receive FIFO Enable"]
365    #[inline(always)]
366    #[must_use]
367    pub fn rfe(&mut self) -> RFE_W<0> {
368        RFE_W::new(self)
369    }
370    #[doc = "Bit 4 - Receive FIFO Message Lost Flag"]
371    #[inline(always)]
372    #[must_use]
373    pub fn rfmlf(&mut self) -> RFMLF_W<4> {
374        RFMLF_W::new(self)
375    }
376    #[doc = "Writes raw bits to the register."]
377    #[inline(always)]
378    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
379        self.0.bits(bits);
380        self
381    }
382}
383#[doc = "Receive FIFO Control 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 [rfcr](index.html) module"]
384pub struct RFCR_SPEC;
385impl crate::RegisterSpec for RFCR_SPEC {
386    type Ux = u8;
387}
388#[doc = "`read()` method returns [rfcr::R](R) reader structure"]
389impl crate::Readable for RFCR_SPEC {
390    type Reader = R;
391}
392#[doc = "`write(|w| ..)` method takes [rfcr::W](W) writer structure"]
393impl crate::Writable for RFCR_SPEC {
394    type Writer = W;
395    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
396    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
397}
398#[doc = "`reset()` method sets RFCR to value 0x80"]
399impl crate::Resettable for RFCR_SPEC {
400    const RESET_VALUE: Self::Ux = 0x80;
401}