ra4w1/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: Receive FIFO disabled"]
43    _0 = 0,
44    #[doc = "1: Receive FIFO enabled"]
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 = "Receive FIFO disabled"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(RFE_A::_0)
80    }
81    #[doc = "Receive FIFO enabled"]
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}
104impl From<RFUST_A> for u8 {
105    #[inline(always)]
106    fn from(variant: RFUST_A) -> Self {
107        variant as _
108    }
109}
110impl RFUST_R {
111    #[doc = "Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> Option<RFUST_A> {
114        match self.bits {
115            0 => Some(RFUST_A::_000),
116            1 => Some(RFUST_A::_001),
117            2 => Some(RFUST_A::_010),
118            3 => Some(RFUST_A::_011),
119            4 => Some(RFUST_A::_100),
120            _ => None,
121        }
122    }
123    #[doc = "Checks if the value of the field is `_000`"]
124    #[inline(always)]
125    pub fn is_000(&self) -> bool {
126        *self == RFUST_A::_000
127    }
128    #[doc = "Checks if the value of the field is `_001`"]
129    #[inline(always)]
130    pub fn is_001(&self) -> bool {
131        *self == RFUST_A::_001
132    }
133    #[doc = "Checks if the value of the field is `_010`"]
134    #[inline(always)]
135    pub fn is_010(&self) -> bool {
136        *self == RFUST_A::_010
137    }
138    #[doc = "Checks if the value of the field is `_011`"]
139    #[inline(always)]
140    pub fn is_011(&self) -> bool {
141        *self == RFUST_A::_011
142    }
143    #[doc = "Checks if the value of the field is `_100`"]
144    #[inline(always)]
145    pub fn is_100(&self) -> bool {
146        *self == RFUST_A::_100
147    }
148}
149#[doc = "Field `RFMLF` reader - Receive FIFO Message Lost Flag"]
150pub type RFMLF_R = crate::BitReader<RFMLF_A>;
151#[doc = "Receive FIFO Message Lost Flag\n\nValue on reset: 0"]
152#[derive(Clone, Copy, Debug, PartialEq, Eq)]
153pub enum RFMLF_A {
154    #[doc = "0: No receive FIFO message lost has occurred"]
155    _0 = 0,
156    #[doc = "1: Receive FIFO message lost has occurred"]
157    _1 = 1,
158}
159impl From<RFMLF_A> for bool {
160    #[inline(always)]
161    fn from(variant: RFMLF_A) -> Self {
162        variant as u8 != 0
163    }
164}
165impl RFMLF_R {
166    #[doc = "Get enumerated values variant"]
167    #[inline(always)]
168    pub fn variant(&self) -> RFMLF_A {
169        match self.bits {
170            false => RFMLF_A::_0,
171            true => RFMLF_A::_1,
172        }
173    }
174    #[doc = "Checks if the value of the field is `_0`"]
175    #[inline(always)]
176    pub fn is_0(&self) -> bool {
177        *self == RFMLF_A::_0
178    }
179    #[doc = "Checks if the value of the field is `_1`"]
180    #[inline(always)]
181    pub fn is_1(&self) -> bool {
182        *self == RFMLF_A::_1
183    }
184}
185#[doc = "Field `RFMLF` writer - Receive FIFO Message Lost Flag"]
186pub type RFMLF_W<'a, const O: u8> = crate::BitWriter<'a, u8, RFCR_SPEC, RFMLF_A, O>;
187impl<'a, const O: u8> RFMLF_W<'a, O> {
188    #[doc = "No receive FIFO message lost has occurred"]
189    #[inline(always)]
190    pub fn _0(self) -> &'a mut W {
191        self.variant(RFMLF_A::_0)
192    }
193    #[doc = "Receive FIFO message lost has occurred"]
194    #[inline(always)]
195    pub fn _1(self) -> &'a mut W {
196        self.variant(RFMLF_A::_1)
197    }
198}
199#[doc = "Field `RFFST` reader - Receive FIFO Full Status Flag"]
200pub type RFFST_R = crate::BitReader<RFFST_A>;
201#[doc = "Receive FIFO Full Status Flag\n\nValue on reset: 0"]
202#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum RFFST_A {
204    #[doc = "0: Receive FIFO is not full"]
205    _0 = 0,
206    #[doc = "1: Receive FIFO is full (4 unread messages)"]
207    _1 = 1,
208}
209impl From<RFFST_A> for bool {
210    #[inline(always)]
211    fn from(variant: RFFST_A) -> Self {
212        variant as u8 != 0
213    }
214}
215impl RFFST_R {
216    #[doc = "Get enumerated values variant"]
217    #[inline(always)]
218    pub fn variant(&self) -> RFFST_A {
219        match self.bits {
220            false => RFFST_A::_0,
221            true => RFFST_A::_1,
222        }
223    }
224    #[doc = "Checks if the value of the field is `_0`"]
225    #[inline(always)]
226    pub fn is_0(&self) -> bool {
227        *self == RFFST_A::_0
228    }
229    #[doc = "Checks if the value of the field is `_1`"]
230    #[inline(always)]
231    pub fn is_1(&self) -> bool {
232        *self == RFFST_A::_1
233    }
234}
235#[doc = "Field `RFWST` reader - Receive FIFO Buffer Warning Status Flag"]
236pub type RFWST_R = crate::BitReader<RFWST_A>;
237#[doc = "Receive FIFO Buffer Warning Status Flag\n\nValue on reset: 0"]
238#[derive(Clone, Copy, Debug, PartialEq, Eq)]
239pub enum RFWST_A {
240    #[doc = "0: Receive FIFO is not buffer warning"]
241    _0 = 0,
242    #[doc = "1: Receive FIFO is buffer warning (3 unread messages)"]
243    _1 = 1,
244}
245impl From<RFWST_A> for bool {
246    #[inline(always)]
247    fn from(variant: RFWST_A) -> Self {
248        variant as u8 != 0
249    }
250}
251impl RFWST_R {
252    #[doc = "Get enumerated values variant"]
253    #[inline(always)]
254    pub fn variant(&self) -> RFWST_A {
255        match self.bits {
256            false => RFWST_A::_0,
257            true => RFWST_A::_1,
258        }
259    }
260    #[doc = "Checks if the value of the field is `_0`"]
261    #[inline(always)]
262    pub fn is_0(&self) -> bool {
263        *self == RFWST_A::_0
264    }
265    #[doc = "Checks if the value of the field is `_1`"]
266    #[inline(always)]
267    pub fn is_1(&self) -> bool {
268        *self == RFWST_A::_1
269    }
270}
271#[doc = "Field `RFEST` reader - Receive FIFO Empty Status Flag"]
272pub type RFEST_R = crate::BitReader<RFEST_A>;
273#[doc = "Receive FIFO Empty Status Flag\n\nValue on reset: 1"]
274#[derive(Clone, Copy, Debug, PartialEq, Eq)]
275pub enum RFEST_A {
276    #[doc = "0: Unread message in receive FIFO"]
277    _0 = 0,
278    #[doc = "1: No unread message in receive FIFO"]
279    _1 = 1,
280}
281impl From<RFEST_A> for bool {
282    #[inline(always)]
283    fn from(variant: RFEST_A) -> Self {
284        variant as u8 != 0
285    }
286}
287impl RFEST_R {
288    #[doc = "Get enumerated values variant"]
289    #[inline(always)]
290    pub fn variant(&self) -> RFEST_A {
291        match self.bits {
292            false => RFEST_A::_0,
293            true => RFEST_A::_1,
294        }
295    }
296    #[doc = "Checks if the value of the field is `_0`"]
297    #[inline(always)]
298    pub fn is_0(&self) -> bool {
299        *self == RFEST_A::_0
300    }
301    #[doc = "Checks if the value of the field is `_1`"]
302    #[inline(always)]
303    pub fn is_1(&self) -> bool {
304        *self == RFEST_A::_1
305    }
306}
307impl R {
308    #[doc = "Bit 0 - Receive FIFO Enable"]
309    #[inline(always)]
310    pub fn rfe(&self) -> RFE_R {
311        RFE_R::new((self.bits & 1) != 0)
312    }
313    #[doc = "Bits 1:3 - Receive FIFO Unread Message Number Status"]
314    #[inline(always)]
315    pub fn rfust(&self) -> RFUST_R {
316        RFUST_R::new((self.bits >> 1) & 7)
317    }
318    #[doc = "Bit 4 - Receive FIFO Message Lost Flag"]
319    #[inline(always)]
320    pub fn rfmlf(&self) -> RFMLF_R {
321        RFMLF_R::new(((self.bits >> 4) & 1) != 0)
322    }
323    #[doc = "Bit 5 - Receive FIFO Full Status Flag"]
324    #[inline(always)]
325    pub fn rffst(&self) -> RFFST_R {
326        RFFST_R::new(((self.bits >> 5) & 1) != 0)
327    }
328    #[doc = "Bit 6 - Receive FIFO Buffer Warning Status Flag"]
329    #[inline(always)]
330    pub fn rfwst(&self) -> RFWST_R {
331        RFWST_R::new(((self.bits >> 6) & 1) != 0)
332    }
333    #[doc = "Bit 7 - Receive FIFO Empty Status Flag"]
334    #[inline(always)]
335    pub fn rfest(&self) -> RFEST_R {
336        RFEST_R::new(((self.bits >> 7) & 1) != 0)
337    }
338}
339impl W {
340    #[doc = "Bit 0 - Receive FIFO Enable"]
341    #[inline(always)]
342    #[must_use]
343    pub fn rfe(&mut self) -> RFE_W<0> {
344        RFE_W::new(self)
345    }
346    #[doc = "Bit 4 - Receive FIFO Message Lost Flag"]
347    #[inline(always)]
348    #[must_use]
349    pub fn rfmlf(&mut self) -> RFMLF_W<4> {
350        RFMLF_W::new(self)
351    }
352    #[doc = "Writes raw bits to the register."]
353    #[inline(always)]
354    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
355        self.0.bits(bits);
356        self
357    }
358}
359#[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"]
360pub struct RFCR_SPEC;
361impl crate::RegisterSpec for RFCR_SPEC {
362    type Ux = u8;
363}
364#[doc = "`read()` method returns [rfcr::R](R) reader structure"]
365impl crate::Readable for RFCR_SPEC {
366    type Reader = R;
367}
368#[doc = "`write(|w| ..)` method takes [rfcr::W](W) writer structure"]
369impl crate::Writable for RFCR_SPEC {
370    type Writer = W;
371    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
372    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
373}
374#[doc = "`reset()` method sets RFCR to value 0x80"]
375impl crate::Resettable for RFCR_SPEC {
376    const RESET_VALUE: Self::Ux = 0x80;
377}