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::SR {
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 RXNER {
47 bits: bool,
48}
49impl RXNER {
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 TXER {
68 bits: bool,
69}
70impl TXER {
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 CRCERRR {
89 bits: bool,
90}
91impl CRCERRR {
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 MODFR {
110 bits: bool,
111}
112impl MODFR {
113 #[doc = r" Value of the field as raw bits"]
114 #[inline]
115 pub fn bit(&self) -> bool {
116 self.bits
117 }
118 #[doc = r" Returns `true` if the bit is clear (0)"]
119 #[inline]
120 pub fn bit_is_clear(&self) -> bool {
121 !self.bit()
122 }
123 #[doc = r" Returns `true` if the bit is set (1)"]
124 #[inline]
125 pub fn bit_is_set(&self) -> bool {
126 self.bit()
127 }
128}
129#[doc = r" Value of the field"]
130pub struct OVRR {
131 bits: bool,
132}
133impl OVRR {
134 #[doc = r" Value of the field as raw bits"]
135 #[inline]
136 pub fn bit(&self) -> bool {
137 self.bits
138 }
139 #[doc = r" Returns `true` if the bit is clear (0)"]
140 #[inline]
141 pub fn bit_is_clear(&self) -> bool {
142 !self.bit()
143 }
144 #[doc = r" Returns `true` if the bit is set (1)"]
145 #[inline]
146 pub fn bit_is_set(&self) -> bool {
147 self.bit()
148 }
149}
150#[doc = r" Value of the field"]
151pub struct BSYR {
152 bits: bool,
153}
154impl BSYR {
155 #[doc = r" Value of the field as raw bits"]
156 #[inline]
157 pub fn bit(&self) -> bool {
158 self.bits
159 }
160 #[doc = r" Returns `true` if the bit is clear (0)"]
161 #[inline]
162 pub fn bit_is_clear(&self) -> bool {
163 !self.bit()
164 }
165 #[doc = r" Returns `true` if the bit is set (1)"]
166 #[inline]
167 pub fn bit_is_set(&self) -> bool {
168 self.bit()
169 }
170}
171#[doc = r" Value of the field"]
172pub struct TIFRFER {
173 bits: bool,
174}
175impl TIFRFER {
176 #[doc = r" Value of the field as raw bits"]
177 #[inline]
178 pub fn bit(&self) -> bool {
179 self.bits
180 }
181 #[doc = r" Returns `true` if the bit is clear (0)"]
182 #[inline]
183 pub fn bit_is_clear(&self) -> bool {
184 !self.bit()
185 }
186 #[doc = r" Returns `true` if the bit is set (1)"]
187 #[inline]
188 pub fn bit_is_set(&self) -> bool {
189 self.bit()
190 }
191}
192#[doc = r" Value of the field"]
193pub struct FRLVLR {
194 bits: u8,
195}
196impl FRLVLR {
197 #[doc = r" Value of the field as raw bits"]
198 #[inline]
199 pub fn bits(&self) -> u8 {
200 self.bits
201 }
202}
203#[doc = r" Value of the field"]
204pub struct FTLVLR {
205 bits: u8,
206}
207impl FTLVLR {
208 #[doc = r" Value of the field as raw bits"]
209 #[inline]
210 pub fn bits(&self) -> u8 {
211 self.bits
212 }
213}
214#[doc = r" Proxy"]
215pub struct _CRCERRW<'a> {
216 w: &'a mut W,
217}
218impl<'a> _CRCERRW<'a> {
219 #[doc = r" Sets the field bit"]
220 pub fn set_bit(self) -> &'a mut W {
221 self.bit(true)
222 }
223 #[doc = r" Clears the field bit"]
224 pub fn clear_bit(self) -> &'a mut W {
225 self.bit(false)
226 }
227 #[doc = r" Writes raw bits to the field"]
228 #[inline]
229 pub fn bit(self, value: bool) -> &'a mut W {
230 const MASK: bool = true;
231 const OFFSET: u8 = 4;
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 0 - Receive buffer not empty"]
244 #[inline]
245 pub fn rxne(&self) -> RXNER {
246 let bits = {
247 const MASK: bool = true;
248 const OFFSET: u8 = 0;
249 ((self.bits >> OFFSET) & MASK as u32) != 0
250 };
251 RXNER { bits }
252 }
253 #[doc = "Bit 1 - Transmit buffer empty"]
254 #[inline]
255 pub fn txe(&self) -> TXER {
256 let bits = {
257 const MASK: bool = true;
258 const OFFSET: u8 = 1;
259 ((self.bits >> OFFSET) & MASK as u32) != 0
260 };
261 TXER { bits }
262 }
263 #[doc = "Bit 4 - CRC error flag"]
264 #[inline]
265 pub fn crcerr(&self) -> CRCERRR {
266 let bits = {
267 const MASK: bool = true;
268 const OFFSET: u8 = 4;
269 ((self.bits >> OFFSET) & MASK as u32) != 0
270 };
271 CRCERRR { bits }
272 }
273 #[doc = "Bit 5 - Mode fault"]
274 #[inline]
275 pub fn modf(&self) -> MODFR {
276 let bits = {
277 const MASK: bool = true;
278 const OFFSET: u8 = 5;
279 ((self.bits >> OFFSET) & MASK as u32) != 0
280 };
281 MODFR { bits }
282 }
283 #[doc = "Bit 6 - Overrun flag"]
284 #[inline]
285 pub fn ovr(&self) -> OVRR {
286 let bits = {
287 const MASK: bool = true;
288 const OFFSET: u8 = 6;
289 ((self.bits >> OFFSET) & MASK as u32) != 0
290 };
291 OVRR { bits }
292 }
293 #[doc = "Bit 7 - Busy flag"]
294 #[inline]
295 pub fn bsy(&self) -> BSYR {
296 let bits = {
297 const MASK: bool = true;
298 const OFFSET: u8 = 7;
299 ((self.bits >> OFFSET) & MASK as u32) != 0
300 };
301 BSYR { bits }
302 }
303 #[doc = "Bit 8 - TI frame format error"]
304 #[inline]
305 pub fn tifrfe(&self) -> TIFRFER {
306 let bits = {
307 const MASK: bool = true;
308 const OFFSET: u8 = 8;
309 ((self.bits >> OFFSET) & MASK as u32) != 0
310 };
311 TIFRFER { bits }
312 }
313 #[doc = "Bits 9:10 - FIFO reception level"]
314 #[inline]
315 pub fn frlvl(&self) -> FRLVLR {
316 let bits = {
317 const MASK: u8 = 3;
318 const OFFSET: u8 = 9;
319 ((self.bits >> OFFSET) & MASK as u32) as u8
320 };
321 FRLVLR { bits }
322 }
323 #[doc = "Bits 11:12 - FIFO transmission level"]
324 #[inline]
325 pub fn ftlvl(&self) -> FTLVLR {
326 let bits = {
327 const MASK: u8 = 3;
328 const OFFSET: u8 = 11;
329 ((self.bits >> OFFSET) & MASK as u32) as u8
330 };
331 FTLVLR { bits }
332 }
333}
334impl W {
335 #[doc = r" Reset value of the register"]
336 #[inline]
337 pub fn reset_value() -> W {
338 W { bits: 2 }
339 }
340 #[doc = r" Writes raw bits to the register"]
341 #[inline]
342 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
343 self.bits = bits;
344 self
345 }
346 #[doc = "Bit 4 - CRC error flag"]
347 #[inline]
348 pub fn crcerr(&mut self) -> _CRCERRW {
349 _CRCERRW { w: self }
350 }
351}