1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::CS7 {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct TIME_STAMPR {
47 bits: u16,
48}
49impl TIME_STAMPR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u16 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct DLCR {
58 bits: u8,
59}
60impl DLCR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u8 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct RTRR {
69 bits: bool,
70}
71impl RTRR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bit(&self) -> bool {
75 self.bits
76 }
77 #[doc = r" Returns `true` if the bit is clear (0)"]
78 #[inline]
79 pub fn bit_is_clear(&self) -> bool {
80 !self.bit()
81 }
82 #[doc = r" Returns `true` if the bit is set (1)"]
83 #[inline]
84 pub fn bit_is_set(&self) -> bool {
85 self.bit()
86 }
87}
88#[doc = r" Value of the field"]
89pub struct IDER {
90 bits: bool,
91}
92impl IDER {
93 #[doc = r" Value of the field as raw bits"]
94 #[inline]
95 pub fn bit(&self) -> bool {
96 self.bits
97 }
98 #[doc = r" Returns `true` if the bit is clear (0)"]
99 #[inline]
100 pub fn bit_is_clear(&self) -> bool {
101 !self.bit()
102 }
103 #[doc = r" Returns `true` if the bit is set (1)"]
104 #[inline]
105 pub fn bit_is_set(&self) -> bool {
106 self.bit()
107 }
108}
109#[doc = r" Value of the field"]
110pub struct SRRR {
111 bits: bool,
112}
113impl SRRR {
114 #[doc = r" Value of the field as raw bits"]
115 #[inline]
116 pub fn bit(&self) -> bool {
117 self.bits
118 }
119 #[doc = r" Returns `true` if the bit is clear (0)"]
120 #[inline]
121 pub fn bit_is_clear(&self) -> bool {
122 !self.bit()
123 }
124 #[doc = r" Returns `true` if the bit is set (1)"]
125 #[inline]
126 pub fn bit_is_set(&self) -> bool {
127 self.bit()
128 }
129}
130#[doc = r" Value of the field"]
131pub struct CODER {
132 bits: u8,
133}
134impl CODER {
135 #[doc = r" Value of the field as raw bits"]
136 #[inline]
137 pub fn bits(&self) -> u8 {
138 self.bits
139 }
140}
141#[doc = r" Proxy"]
142pub struct _TIME_STAMPW<'a> {
143 w: &'a mut W,
144}
145impl<'a> _TIME_STAMPW<'a> {
146 #[doc = r" Writes raw bits to the field"]
147 #[inline]
148 pub unsafe fn bits(self, value: u16) -> &'a mut W {
149 const MASK: u16 = 65535;
150 const OFFSET: u8 = 0;
151 self.w.bits &= !((MASK as u32) << OFFSET);
152 self.w.bits |= ((value & MASK) as u32) << OFFSET;
153 self.w
154 }
155}
156#[doc = r" Proxy"]
157pub struct _DLCW<'a> {
158 w: &'a mut W,
159}
160impl<'a> _DLCW<'a> {
161 #[doc = r" Writes raw bits to the field"]
162 #[inline]
163 pub unsafe fn bits(self, value: u8) -> &'a mut W {
164 const MASK: u8 = 15;
165 const OFFSET: u8 = 16;
166 self.w.bits &= !((MASK as u32) << OFFSET);
167 self.w.bits |= ((value & MASK) as u32) << OFFSET;
168 self.w
169 }
170}
171#[doc = r" Proxy"]
172pub struct _RTRW<'a> {
173 w: &'a mut W,
174}
175impl<'a> _RTRW<'a> {
176 #[doc = r" Sets the field bit"]
177 pub fn set_bit(self) -> &'a mut W {
178 self.bit(true)
179 }
180 #[doc = r" Clears the field bit"]
181 pub fn clear_bit(self) -> &'a mut W {
182 self.bit(false)
183 }
184 #[doc = r" Writes raw bits to the field"]
185 #[inline]
186 pub fn bit(self, value: bool) -> &'a mut W {
187 const MASK: bool = true;
188 const OFFSET: u8 = 20;
189 self.w.bits &= !((MASK as u32) << OFFSET);
190 self.w.bits |= ((value & MASK) as u32) << OFFSET;
191 self.w
192 }
193}
194#[doc = r" Proxy"]
195pub struct _IDEW<'a> {
196 w: &'a mut W,
197}
198impl<'a> _IDEW<'a> {
199 #[doc = r" Sets the field bit"]
200 pub fn set_bit(self) -> &'a mut W {
201 self.bit(true)
202 }
203 #[doc = r" Clears the field bit"]
204 pub fn clear_bit(self) -> &'a mut W {
205 self.bit(false)
206 }
207 #[doc = r" Writes raw bits to the field"]
208 #[inline]
209 pub fn bit(self, value: bool) -> &'a mut W {
210 const MASK: bool = true;
211 const OFFSET: u8 = 21;
212 self.w.bits &= !((MASK as u32) << OFFSET);
213 self.w.bits |= ((value & MASK) as u32) << OFFSET;
214 self.w
215 }
216}
217#[doc = r" Proxy"]
218pub struct _SRRW<'a> {
219 w: &'a mut W,
220}
221impl<'a> _SRRW<'a> {
222 #[doc = r" Sets the field bit"]
223 pub fn set_bit(self) -> &'a mut W {
224 self.bit(true)
225 }
226 #[doc = r" Clears the field bit"]
227 pub fn clear_bit(self) -> &'a mut W {
228 self.bit(false)
229 }
230 #[doc = r" Writes raw bits to the field"]
231 #[inline]
232 pub fn bit(self, value: bool) -> &'a mut W {
233 const MASK: bool = true;
234 const OFFSET: u8 = 22;
235 self.w.bits &= !((MASK as u32) << OFFSET);
236 self.w.bits |= ((value & MASK) as u32) << OFFSET;
237 self.w
238 }
239}
240#[doc = r" Proxy"]
241pub struct _CODEW<'a> {
242 w: &'a mut W,
243}
244impl<'a> _CODEW<'a> {
245 #[doc = r" Writes raw bits to the field"]
246 #[inline]
247 pub unsafe fn bits(self, value: u8) -> &'a mut W {
248 const MASK: u8 = 15;
249 const OFFSET: u8 = 24;
250 self.w.bits &= !((MASK as u32) << OFFSET);
251 self.w.bits |= ((value & MASK) as u32) << OFFSET;
252 self.w
253 }
254}
255impl R {
256 #[doc = r" Value of the register as raw bits"]
257 #[inline]
258 pub fn bits(&self) -> u32 {
259 self.bits
260 }
261 #[doc = "Bits 0:15 - Free-Running Counter Time stamp. This 16-bit field is a copy of the Free-Running Timer, captured for Tx and Rx frames at the time when the beginning of the Identifier field appears on the CAN bus."]
262 #[inline]
263 pub fn time_stamp(&self) -> TIME_STAMPR {
264 let bits = {
265 const MASK: u16 = 65535;
266 const OFFSET: u8 = 0;
267 ((self.bits >> OFFSET) & MASK as u32) as u16
268 };
269 TIME_STAMPR { bits }
270 }
271 #[doc = "Bits 16:19 - Length of the data to be stored/transmitted."]
272 #[inline]
273 pub fn dlc(&self) -> DLCR {
274 let bits = {
275 const MASK: u8 = 15;
276 const OFFSET: u8 = 16;
277 ((self.bits >> OFFSET) & MASK as u32) as u8
278 };
279 DLCR { bits }
280 }
281 #[doc = "Bit 20 - Remote Transmission Request. One/zero for remote/data frame."]
282 #[inline]
283 pub fn rtr(&self) -> RTRR {
284 let bits = {
285 const MASK: bool = true;
286 const OFFSET: u8 = 20;
287 ((self.bits >> OFFSET) & MASK as u32) != 0
288 };
289 RTRR { bits }
290 }
291 #[doc = "Bit 21 - ID Extended. One/zero for extended/standard format frame."]
292 #[inline]
293 pub fn ide(&self) -> IDER {
294 let bits = {
295 const MASK: bool = true;
296 const OFFSET: u8 = 21;
297 ((self.bits >> OFFSET) & MASK as u32) != 0
298 };
299 IDER { bits }
300 }
301 #[doc = "Bit 22 - Substitute Remote Request. Contains a fixed recessive bit."]
302 #[inline]
303 pub fn srr(&self) -> SRRR {
304 let bits = {
305 const MASK: bool = true;
306 const OFFSET: u8 = 22;
307 ((self.bits >> OFFSET) & MASK as u32) != 0
308 };
309 SRRR { bits }
310 }
311 #[doc = "Bits 24:27 - Reserved"]
312 #[inline]
313 pub fn code(&self) -> CODER {
314 let bits = {
315 const MASK: u8 = 15;
316 const OFFSET: u8 = 24;
317 ((self.bits >> OFFSET) & MASK as u32) as u8
318 };
319 CODER { bits }
320 }
321}
322impl W {
323 #[doc = r" Reset value of the register"]
324 #[inline]
325 pub fn reset_value() -> W {
326 W { bits: 0 }
327 }
328 #[doc = r" Writes raw bits to the register"]
329 #[inline]
330 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
331 self.bits = bits;
332 self
333 }
334 #[doc = "Bits 0:15 - Free-Running Counter Time stamp. This 16-bit field is a copy of the Free-Running Timer, captured for Tx and Rx frames at the time when the beginning of the Identifier field appears on the CAN bus."]
335 #[inline]
336 pub fn time_stamp(&mut self) -> _TIME_STAMPW {
337 _TIME_STAMPW { w: self }
338 }
339 #[doc = "Bits 16:19 - Length of the data to be stored/transmitted."]
340 #[inline]
341 pub fn dlc(&mut self) -> _DLCW {
342 _DLCW { w: self }
343 }
344 #[doc = "Bit 20 - Remote Transmission Request. One/zero for remote/data frame."]
345 #[inline]
346 pub fn rtr(&mut self) -> _RTRW {
347 _RTRW { w: self }
348 }
349 #[doc = "Bit 21 - ID Extended. One/zero for extended/standard format frame."]
350 #[inline]
351 pub fn ide(&mut self) -> _IDEW {
352 _IDEW { w: self }
353 }
354 #[doc = "Bit 22 - Substitute Remote Request. Contains a fixed recessive bit."]
355 #[inline]
356 pub fn srr(&mut self) -> _SRRW {
357 _SRRW { w: self }
358 }
359 #[doc = "Bits 24:27 - Reserved"]
360 #[inline]
361 pub fn code(&mut self) -> _CODEW {
362 _CODEW { w: self }
363 }
364}