ra6m4/can0/
fidcr.rs

1#[doc = "Register `FIDCR%s` reader"]
2pub struct R(crate::R<FIDCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FIDCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FIDCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FIDCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FIDCR%s` writer"]
17pub struct W(crate::W<FIDCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FIDCR_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<FIDCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FIDCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EID` reader - Extended ID of data and remote frames"]
38pub type EID_R = crate::FieldReader<u32, u32>;
39#[doc = "Field `EID` writer - Extended ID of data and remote frames"]
40pub type EID_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FIDCR_SPEC, u32, u32, 18, O>;
41#[doc = "Field `SID` reader - Standard ID of data and remote frames"]
42pub type SID_R = crate::FieldReader<u16, u16>;
43#[doc = "Field `SID` writer - Standard ID of data and remote frames"]
44pub type SID_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FIDCR_SPEC, u16, u16, 11, O>;
45#[doc = "Field `RTR` reader - Remote Transmission Request"]
46pub type RTR_R = crate::BitReader<RTR_A>;
47#[doc = "Remote Transmission Request\n\nValue on reset: 0"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum RTR_A {
50    #[doc = "0: Data frame"]
51    _0 = 0,
52    #[doc = "1: Remote frame"]
53    _1 = 1,
54}
55impl From<RTR_A> for bool {
56    #[inline(always)]
57    fn from(variant: RTR_A) -> Self {
58        variant as u8 != 0
59    }
60}
61impl RTR_R {
62    #[doc = "Get enumerated values variant"]
63    #[inline(always)]
64    pub fn variant(&self) -> RTR_A {
65        match self.bits {
66            false => RTR_A::_0,
67            true => RTR_A::_1,
68        }
69    }
70    #[doc = "Checks if the value of the field is `_0`"]
71    #[inline(always)]
72    pub fn is_0(&self) -> bool {
73        *self == RTR_A::_0
74    }
75    #[doc = "Checks if the value of the field is `_1`"]
76    #[inline(always)]
77    pub fn is_1(&self) -> bool {
78        *self == RTR_A::_1
79    }
80}
81#[doc = "Field `RTR` writer - Remote Transmission Request"]
82pub type RTR_W<'a, const O: u8> = crate::BitWriter<'a, u32, FIDCR_SPEC, RTR_A, O>;
83impl<'a, const O: u8> RTR_W<'a, O> {
84    #[doc = "Data frame"]
85    #[inline(always)]
86    pub fn _0(self) -> &'a mut W {
87        self.variant(RTR_A::_0)
88    }
89    #[doc = "Remote frame"]
90    #[inline(always)]
91    pub fn _1(self) -> &'a mut W {
92        self.variant(RTR_A::_1)
93    }
94}
95#[doc = "Field `IDE` reader - ID Extension"]
96pub type IDE_R = crate::BitReader<IDE_A>;
97#[doc = "ID Extension\n\nValue on reset: 0"]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum IDE_A {
100    #[doc = "0: Standard ID"]
101    _0 = 0,
102    #[doc = "1: Extended ID"]
103    _1 = 1,
104}
105impl From<IDE_A> for bool {
106    #[inline(always)]
107    fn from(variant: IDE_A) -> Self {
108        variant as u8 != 0
109    }
110}
111impl IDE_R {
112    #[doc = "Get enumerated values variant"]
113    #[inline(always)]
114    pub fn variant(&self) -> IDE_A {
115        match self.bits {
116            false => IDE_A::_0,
117            true => IDE_A::_1,
118        }
119    }
120    #[doc = "Checks if the value of the field is `_0`"]
121    #[inline(always)]
122    pub fn is_0(&self) -> bool {
123        *self == IDE_A::_0
124    }
125    #[doc = "Checks if the value of the field is `_1`"]
126    #[inline(always)]
127    pub fn is_1(&self) -> bool {
128        *self == IDE_A::_1
129    }
130}
131#[doc = "Field `IDE` writer - ID Extension"]
132pub type IDE_W<'a, const O: u8> = crate::BitWriter<'a, u32, FIDCR_SPEC, IDE_A, O>;
133impl<'a, const O: u8> IDE_W<'a, O> {
134    #[doc = "Standard ID"]
135    #[inline(always)]
136    pub fn _0(self) -> &'a mut W {
137        self.variant(IDE_A::_0)
138    }
139    #[doc = "Extended ID"]
140    #[inline(always)]
141    pub fn _1(self) -> &'a mut W {
142        self.variant(IDE_A::_1)
143    }
144}
145impl R {
146    #[doc = "Bits 0:17 - Extended ID of data and remote frames"]
147    #[inline(always)]
148    pub fn eid(&self) -> EID_R {
149        EID_R::new(self.bits & 0x0003_ffff)
150    }
151    #[doc = "Bits 18:28 - Standard ID of data and remote frames"]
152    #[inline(always)]
153    pub fn sid(&self) -> SID_R {
154        SID_R::new(((self.bits >> 18) & 0x07ff) as u16)
155    }
156    #[doc = "Bit 30 - Remote Transmission Request"]
157    #[inline(always)]
158    pub fn rtr(&self) -> RTR_R {
159        RTR_R::new(((self.bits >> 30) & 1) != 0)
160    }
161    #[doc = "Bit 31 - ID Extension"]
162    #[inline(always)]
163    pub fn ide(&self) -> IDE_R {
164        IDE_R::new(((self.bits >> 31) & 1) != 0)
165    }
166}
167impl W {
168    #[doc = "Bits 0:17 - Extended ID of data and remote frames"]
169    #[inline(always)]
170    #[must_use]
171    pub fn eid(&mut self) -> EID_W<0> {
172        EID_W::new(self)
173    }
174    #[doc = "Bits 18:28 - Standard ID of data and remote frames"]
175    #[inline(always)]
176    #[must_use]
177    pub fn sid(&mut self) -> SID_W<18> {
178        SID_W::new(self)
179    }
180    #[doc = "Bit 30 - Remote Transmission Request"]
181    #[inline(always)]
182    #[must_use]
183    pub fn rtr(&mut self) -> RTR_W<30> {
184        RTR_W::new(self)
185    }
186    #[doc = "Bit 31 - ID Extension"]
187    #[inline(always)]
188    #[must_use]
189    pub fn ide(&mut self) -> IDE_W<31> {
190        IDE_W::new(self)
191    }
192    #[doc = "Writes raw bits to the register."]
193    #[inline(always)]
194    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
195        self.0.bits(bits);
196        self
197    }
198}
199#[doc = "FIFO Received ID Compare Register %s\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 [fidcr](index.html) module"]
200pub struct FIDCR_SPEC;
201impl crate::RegisterSpec for FIDCR_SPEC {
202    type Ux = u32;
203}
204#[doc = "`read()` method returns [fidcr::R](R) reader structure"]
205impl crate::Readable for FIDCR_SPEC {
206    type Reader = R;
207}
208#[doc = "`write(|w| ..)` method takes [fidcr::W](W) writer structure"]
209impl crate::Writable for FIDCR_SPEC {
210    type Writer = W;
211    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
212    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
213}
214#[doc = "`reset()` method sets FIDCR%s to value 0"]
215impl crate::Resettable for FIDCR_SPEC {
216    const RESET_VALUE: Self::Ux = 0;
217}