stm32l4x2_pac/can1/
btr.rs1#[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::BTR {
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 SILMR {
47 bits: bool,
48}
49impl SILMR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct LBKMR {
68 bits: bool,
69}
70impl LBKMR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct SJWR {
89 bits: u8,
90}
91impl SJWR {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bits(&self) -> u8 {
95 self.bits
96 }
97}
98#[doc = r" Value of the field"]
99pub struct TS2R {
100 bits: u8,
101}
102impl TS2R {
103 #[doc = r" Value of the field as raw bits"]
104 #[inline]
105 pub fn bits(&self) -> u8 {
106 self.bits
107 }
108}
109#[doc = r" Value of the field"]
110pub struct TS1R {
111 bits: u8,
112}
113impl TS1R {
114 #[doc = r" Value of the field as raw bits"]
115 #[inline]
116 pub fn bits(&self) -> u8 {
117 self.bits
118 }
119}
120#[doc = r" Value of the field"]
121pub struct BRPR {
122 bits: u16,
123}
124impl BRPR {
125 #[doc = r" Value of the field as raw bits"]
126 #[inline]
127 pub fn bits(&self) -> u16 {
128 self.bits
129 }
130}
131#[doc = r" Proxy"]
132pub struct _SILMW<'a> {
133 w: &'a mut W,
134}
135impl<'a> _SILMW<'a> {
136 #[doc = r" Sets the field bit"]
137 pub fn set_bit(self) -> &'a mut W {
138 self.bit(true)
139 }
140 #[doc = r" Clears the field bit"]
141 pub fn clear_bit(self) -> &'a mut W {
142 self.bit(false)
143 }
144 #[doc = r" Writes raw bits to the field"]
145 #[inline]
146 pub fn bit(self, value: bool) -> &'a mut W {
147 const MASK: bool = true;
148 const OFFSET: u8 = 31;
149 self.w.bits &= !((MASK as u32) << OFFSET);
150 self.w.bits |= ((value & MASK) as u32) << OFFSET;
151 self.w
152 }
153}
154#[doc = r" Proxy"]
155pub struct _LBKMW<'a> {
156 w: &'a mut W,
157}
158impl<'a> _LBKMW<'a> {
159 #[doc = r" Sets the field bit"]
160 pub fn set_bit(self) -> &'a mut W {
161 self.bit(true)
162 }
163 #[doc = r" Clears the field bit"]
164 pub fn clear_bit(self) -> &'a mut W {
165 self.bit(false)
166 }
167 #[doc = r" Writes raw bits to the field"]
168 #[inline]
169 pub fn bit(self, value: bool) -> &'a mut W {
170 const MASK: bool = true;
171 const OFFSET: u8 = 30;
172 self.w.bits &= !((MASK as u32) << OFFSET);
173 self.w.bits |= ((value & MASK) as u32) << OFFSET;
174 self.w
175 }
176}
177#[doc = r" Proxy"]
178pub struct _SJWW<'a> {
179 w: &'a mut W,
180}
181impl<'a> _SJWW<'a> {
182 #[doc = r" Writes raw bits to the field"]
183 #[inline]
184 pub unsafe fn bits(self, value: u8) -> &'a mut W {
185 const MASK: u8 = 3;
186 const OFFSET: u8 = 24;
187 self.w.bits &= !((MASK as u32) << OFFSET);
188 self.w.bits |= ((value & MASK) as u32) << OFFSET;
189 self.w
190 }
191}
192#[doc = r" Proxy"]
193pub struct _TS2W<'a> {
194 w: &'a mut W,
195}
196impl<'a> _TS2W<'a> {
197 #[doc = r" Writes raw bits to the field"]
198 #[inline]
199 pub unsafe fn bits(self, value: u8) -> &'a mut W {
200 const MASK: u8 = 7;
201 const OFFSET: u8 = 20;
202 self.w.bits &= !((MASK as u32) << OFFSET);
203 self.w.bits |= ((value & MASK) as u32) << OFFSET;
204 self.w
205 }
206}
207#[doc = r" Proxy"]
208pub struct _TS1W<'a> {
209 w: &'a mut W,
210}
211impl<'a> _TS1W<'a> {
212 #[doc = r" Writes raw bits to the field"]
213 #[inline]
214 pub unsafe fn bits(self, value: u8) -> &'a mut W {
215 const MASK: u8 = 15;
216 const OFFSET: u8 = 16;
217 self.w.bits &= !((MASK as u32) << OFFSET);
218 self.w.bits |= ((value & MASK) as u32) << OFFSET;
219 self.w
220 }
221}
222#[doc = r" Proxy"]
223pub struct _BRPW<'a> {
224 w: &'a mut W,
225}
226impl<'a> _BRPW<'a> {
227 #[doc = r" Writes raw bits to the field"]
228 #[inline]
229 pub unsafe fn bits(self, value: u16) -> &'a mut W {
230 const MASK: u16 = 1023;
231 const OFFSET: u8 = 0;
232 self.w.bits &= !((MASK as u32) << OFFSET);
233 self.w.bits |= ((value & MASK) as u32) << OFFSET;
234 self.w
235 }
236}
237impl R {
238 #[doc = r" Value of the register as raw bits"]
239 #[inline]
240 pub fn bits(&self) -> u32 {
241 self.bits
242 }
243 #[doc = "Bit 31 - SILM"]
244 #[inline]
245 pub fn silm(&self) -> SILMR {
246 let bits = {
247 const MASK: bool = true;
248 const OFFSET: u8 = 31;
249 ((self.bits >> OFFSET) & MASK as u32) != 0
250 };
251 SILMR { bits }
252 }
253 #[doc = "Bit 30 - LBKM"]
254 #[inline]
255 pub fn lbkm(&self) -> LBKMR {
256 let bits = {
257 const MASK: bool = true;
258 const OFFSET: u8 = 30;
259 ((self.bits >> OFFSET) & MASK as u32) != 0
260 };
261 LBKMR { bits }
262 }
263 #[doc = "Bits 24:25 - SJW"]
264 #[inline]
265 pub fn sjw(&self) -> SJWR {
266 let bits = {
267 const MASK: u8 = 3;
268 const OFFSET: u8 = 24;
269 ((self.bits >> OFFSET) & MASK as u32) as u8
270 };
271 SJWR { bits }
272 }
273 #[doc = "Bits 20:22 - TS2"]
274 #[inline]
275 pub fn ts2(&self) -> TS2R {
276 let bits = {
277 const MASK: u8 = 7;
278 const OFFSET: u8 = 20;
279 ((self.bits >> OFFSET) & MASK as u32) as u8
280 };
281 TS2R { bits }
282 }
283 #[doc = "Bits 16:19 - TS1"]
284 #[inline]
285 pub fn ts1(&self) -> TS1R {
286 let bits = {
287 const MASK: u8 = 15;
288 const OFFSET: u8 = 16;
289 ((self.bits >> OFFSET) & MASK as u32) as u8
290 };
291 TS1R { bits }
292 }
293 #[doc = "Bits 0:9 - BRP"]
294 #[inline]
295 pub fn brp(&self) -> BRPR {
296 let bits = {
297 const MASK: u16 = 1023;
298 const OFFSET: u8 = 0;
299 ((self.bits >> OFFSET) & MASK as u32) as u16
300 };
301 BRPR { bits }
302 }
303}
304impl W {
305 #[doc = r" Reset value of the register"]
306 #[inline]
307 pub fn reset_value() -> W {
308 W { bits: 0 }
309 }
310 #[doc = r" Writes raw bits to the register"]
311 #[inline]
312 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
313 self.bits = bits;
314 self
315 }
316 #[doc = "Bit 31 - SILM"]
317 #[inline]
318 pub fn silm(&mut self) -> _SILMW {
319 _SILMW { w: self }
320 }
321 #[doc = "Bit 30 - LBKM"]
322 #[inline]
323 pub fn lbkm(&mut self) -> _LBKMW {
324 _LBKMW { w: self }
325 }
326 #[doc = "Bits 24:25 - SJW"]
327 #[inline]
328 pub fn sjw(&mut self) -> _SJWW {
329 _SJWW { w: self }
330 }
331 #[doc = "Bits 20:22 - TS2"]
332 #[inline]
333 pub fn ts2(&mut self) -> _TS2W {
334 _TS2W { w: self }
335 }
336 #[doc = "Bits 16:19 - TS1"]
337 #[inline]
338 pub fn ts1(&mut self) -> _TS1W {
339 _TS1W { w: self }
340 }
341 #[doc = "Bits 0:9 - BRP"]
342 #[inline]
343 pub fn brp(&mut self) -> _BRPW {
344 _BRPW { w: self }
345 }
346}