stm32f103xx/can/can_rf0r/
mod.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::CAN_RF0R {
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 RFOM0R {
47    bits: bool,
48}
49impl RFOM0R {
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 FOVR0R {
68    bits: bool,
69}
70impl FOVR0R {
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 FULL0R {
89    bits: bool,
90}
91impl FULL0R {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct FMP0R {
110    bits: u8,
111}
112impl FMP0R {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bits(&self) -> u8 {
116        self.bits
117    }
118}
119#[doc = r" Proxy"]
120pub struct _RFOM0W<'a> {
121    w: &'a mut W,
122}
123impl<'a> _RFOM0W<'a> {
124    #[doc = r" Sets the field bit"]
125    pub fn set_bit(self) -> &'a mut W {
126        self.bit(true)
127    }
128    #[doc = r" Clears the field bit"]
129    pub fn clear_bit(self) -> &'a mut W {
130        self.bit(false)
131    }
132    #[doc = r" Writes raw bits to the field"]
133    #[inline]
134    pub fn bit(self, value: bool) -> &'a mut W {
135        const MASK: bool = true;
136        const OFFSET: u8 = 5;
137        self.w.bits &= !((MASK as u32) << OFFSET);
138        self.w.bits |= ((value & MASK) as u32) << OFFSET;
139        self.w
140    }
141}
142#[doc = r" Proxy"]
143pub struct _FOVR0W<'a> {
144    w: &'a mut W,
145}
146impl<'a> _FOVR0W<'a> {
147    #[doc = r" Sets the field bit"]
148    pub fn set_bit(self) -> &'a mut W {
149        self.bit(true)
150    }
151    #[doc = r" Clears the field bit"]
152    pub fn clear_bit(self) -> &'a mut W {
153        self.bit(false)
154    }
155    #[doc = r" Writes raw bits to the field"]
156    #[inline]
157    pub fn bit(self, value: bool) -> &'a mut W {
158        const MASK: bool = true;
159        const OFFSET: u8 = 4;
160        self.w.bits &= !((MASK as u32) << OFFSET);
161        self.w.bits |= ((value & MASK) as u32) << OFFSET;
162        self.w
163    }
164}
165#[doc = r" Proxy"]
166pub struct _FULL0W<'a> {
167    w: &'a mut W,
168}
169impl<'a> _FULL0W<'a> {
170    #[doc = r" Sets the field bit"]
171    pub fn set_bit(self) -> &'a mut W {
172        self.bit(true)
173    }
174    #[doc = r" Clears the field bit"]
175    pub fn clear_bit(self) -> &'a mut W {
176        self.bit(false)
177    }
178    #[doc = r" Writes raw bits to the field"]
179    #[inline]
180    pub fn bit(self, value: bool) -> &'a mut W {
181        const MASK: bool = true;
182        const OFFSET: u8 = 3;
183        self.w.bits &= !((MASK as u32) << OFFSET);
184        self.w.bits |= ((value & MASK) as u32) << OFFSET;
185        self.w
186    }
187}
188impl R {
189    #[doc = r" Value of the register as raw bits"]
190    #[inline]
191    pub fn bits(&self) -> u32 {
192        self.bits
193    }
194    #[doc = "Bit 5 - RFOM0"]
195    #[inline]
196    pub fn rfom0(&self) -> RFOM0R {
197        let bits = {
198            const MASK: bool = true;
199            const OFFSET: u8 = 5;
200            ((self.bits >> OFFSET) & MASK as u32) != 0
201        };
202        RFOM0R { bits }
203    }
204    #[doc = "Bit 4 - FOVR0"]
205    #[inline]
206    pub fn fovr0(&self) -> FOVR0R {
207        let bits = {
208            const MASK: bool = true;
209            const OFFSET: u8 = 4;
210            ((self.bits >> OFFSET) & MASK as u32) != 0
211        };
212        FOVR0R { bits }
213    }
214    #[doc = "Bit 3 - FULL0"]
215    #[inline]
216    pub fn full0(&self) -> FULL0R {
217        let bits = {
218            const MASK: bool = true;
219            const OFFSET: u8 = 3;
220            ((self.bits >> OFFSET) & MASK as u32) != 0
221        };
222        FULL0R { bits }
223    }
224    #[doc = "Bits 0:1 - FMP0"]
225    #[inline]
226    pub fn fmp0(&self) -> FMP0R {
227        let bits = {
228            const MASK: u8 = 3;
229            const OFFSET: u8 = 0;
230            ((self.bits >> OFFSET) & MASK as u32) as u8
231        };
232        FMP0R { bits }
233    }
234}
235impl W {
236    #[doc = r" Reset value of the register"]
237    #[inline]
238    pub fn reset_value() -> W {
239        W { bits: 0 }
240    }
241    #[doc = r" Writes raw bits to the register"]
242    #[inline]
243    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
244        self.bits = bits;
245        self
246    }
247    #[doc = "Bit 5 - RFOM0"]
248    #[inline]
249    pub fn rfom0(&mut self) -> _RFOM0W {
250        _RFOM0W { w: self }
251    }
252    #[doc = "Bit 4 - FOVR0"]
253    #[inline]
254    pub fn fovr0(&mut self) -> _FOVR0W {
255        _FOVR0W { w: self }
256    }
257    #[doc = "Bit 3 - FULL0"]
258    #[inline]
259    pub fn full0(&mut self) -> _FULL0W {
260        _FULL0W { w: self }
261    }
262}