stm32l4x6/can/
ti1r.rs

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::TI1R {
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 STIDR {
47    bits: u16,
48}
49impl STIDR {
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 EXIDR {
58    bits: u32,
59}
60impl EXIDR {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bits(&self) -> u32 {
64        self.bits
65    }
66}
67#[doc = r" Value of the field"]
68pub struct IDER {
69    bits: bool,
70}
71impl IDER {
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 RTRR {
90    bits: bool,
91}
92impl RTRR {
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 TXRQR {
111    bits: bool,
112}
113impl TXRQR {
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" Proxy"]
131pub struct _STIDW<'a> {
132    w: &'a mut W,
133}
134impl<'a> _STIDW<'a> {
135    #[doc = r" Writes raw bits to the field"]
136    #[inline]
137    pub unsafe fn bits(self, value: u16) -> &'a mut W {
138        const MASK: u16 = 2047;
139        const OFFSET: u8 = 21;
140        self.w.bits &= !((MASK as u32) << OFFSET);
141        self.w.bits |= ((value & MASK) as u32) << OFFSET;
142        self.w
143    }
144}
145#[doc = r" Proxy"]
146pub struct _EXIDW<'a> {
147    w: &'a mut W,
148}
149impl<'a> _EXIDW<'a> {
150    #[doc = r" Writes raw bits to the field"]
151    #[inline]
152    pub unsafe fn bits(self, value: u32) -> &'a mut W {
153        const MASK: u32 = 262143;
154        const OFFSET: u8 = 3;
155        self.w.bits &= !((MASK as u32) << OFFSET);
156        self.w.bits |= ((value & MASK) as u32) << OFFSET;
157        self.w
158    }
159}
160#[doc = r" Proxy"]
161pub struct _IDEW<'a> {
162    w: &'a mut W,
163}
164impl<'a> _IDEW<'a> {
165    #[doc = r" Sets the field bit"]
166    pub fn set_bit(self) -> &'a mut W {
167        self.bit(true)
168    }
169    #[doc = r" Clears the field bit"]
170    pub fn clear_bit(self) -> &'a mut W {
171        self.bit(false)
172    }
173    #[doc = r" Writes raw bits to the field"]
174    #[inline]
175    pub fn bit(self, value: bool) -> &'a mut W {
176        const MASK: bool = true;
177        const OFFSET: u8 = 2;
178        self.w.bits &= !((MASK as u32) << OFFSET);
179        self.w.bits |= ((value & MASK) as u32) << OFFSET;
180        self.w
181    }
182}
183#[doc = r" Proxy"]
184pub struct _RTRW<'a> {
185    w: &'a mut W,
186}
187impl<'a> _RTRW<'a> {
188    #[doc = r" Sets the field bit"]
189    pub fn set_bit(self) -> &'a mut W {
190        self.bit(true)
191    }
192    #[doc = r" Clears the field bit"]
193    pub fn clear_bit(self) -> &'a mut W {
194        self.bit(false)
195    }
196    #[doc = r" Writes raw bits to the field"]
197    #[inline]
198    pub fn bit(self, value: bool) -> &'a mut W {
199        const MASK: bool = true;
200        const OFFSET: u8 = 1;
201        self.w.bits &= !((MASK as u32) << OFFSET);
202        self.w.bits |= ((value & MASK) as u32) << OFFSET;
203        self.w
204    }
205}
206#[doc = r" Proxy"]
207pub struct _TXRQW<'a> {
208    w: &'a mut W,
209}
210impl<'a> _TXRQW<'a> {
211    #[doc = r" Sets the field bit"]
212    pub fn set_bit(self) -> &'a mut W {
213        self.bit(true)
214    }
215    #[doc = r" Clears the field bit"]
216    pub fn clear_bit(self) -> &'a mut W {
217        self.bit(false)
218    }
219    #[doc = r" Writes raw bits to the field"]
220    #[inline]
221    pub fn bit(self, value: bool) -> &'a mut W {
222        const MASK: bool = true;
223        const OFFSET: u8 = 0;
224        self.w.bits &= !((MASK as u32) << OFFSET);
225        self.w.bits |= ((value & MASK) as u32) << OFFSET;
226        self.w
227    }
228}
229impl R {
230    #[doc = r" Value of the register as raw bits"]
231    #[inline]
232    pub fn bits(&self) -> u32 {
233        self.bits
234    }
235    #[doc = "Bits 21:31 - STID"]
236    #[inline]
237    pub fn stid(&self) -> STIDR {
238        let bits = {
239            const MASK: u16 = 2047;
240            const OFFSET: u8 = 21;
241            ((self.bits >> OFFSET) & MASK as u32) as u16
242        };
243        STIDR { bits }
244    }
245    #[doc = "Bits 3:20 - EXID"]
246    #[inline]
247    pub fn exid(&self) -> EXIDR {
248        let bits = {
249            const MASK: u32 = 262143;
250            const OFFSET: u8 = 3;
251            ((self.bits >> OFFSET) & MASK as u32) as u32
252        };
253        EXIDR { bits }
254    }
255    #[doc = "Bit 2 - IDE"]
256    #[inline]
257    pub fn ide(&self) -> IDER {
258        let bits = {
259            const MASK: bool = true;
260            const OFFSET: u8 = 2;
261            ((self.bits >> OFFSET) & MASK as u32) != 0
262        };
263        IDER { bits }
264    }
265    #[doc = "Bit 1 - RTR"]
266    #[inline]
267    pub fn rtr(&self) -> RTRR {
268        let bits = {
269            const MASK: bool = true;
270            const OFFSET: u8 = 1;
271            ((self.bits >> OFFSET) & MASK as u32) != 0
272        };
273        RTRR { bits }
274    }
275    #[doc = "Bit 0 - TXRQ"]
276    #[inline]
277    pub fn txrq(&self) -> TXRQR {
278        let bits = {
279            const MASK: bool = true;
280            const OFFSET: u8 = 0;
281            ((self.bits >> OFFSET) & MASK as u32) != 0
282        };
283        TXRQR { bits }
284    }
285}
286impl W {
287    #[doc = r" Reset value of the register"]
288    #[inline]
289    pub fn reset_value() -> W {
290        W { bits: 0 }
291    }
292    #[doc = r" Writes raw bits to the register"]
293    #[inline]
294    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
295        self.bits = bits;
296        self
297    }
298    #[doc = "Bits 21:31 - STID"]
299    #[inline]
300    pub fn stid(&mut self) -> _STIDW {
301        _STIDW { w: self }
302    }
303    #[doc = "Bits 3:20 - EXID"]
304    #[inline]
305    pub fn exid(&mut self) -> _EXIDW {
306        _EXIDW { w: self }
307    }
308    #[doc = "Bit 2 - IDE"]
309    #[inline]
310    pub fn ide(&mut self) -> _IDEW {
311        _IDEW { w: self }
312    }
313    #[doc = "Bit 1 - RTR"]
314    #[inline]
315    pub fn rtr(&mut self) -> _RTRW {
316        _RTRW { w: self }
317    }
318    #[doc = "Bit 0 - TXRQ"]
319    #[inline]
320    pub fn txrq(&mut self) -> _TXRQW {
321        _TXRQW { w: self }
322    }
323}