1pub type R = crate::R<SRrs>;
3pub type W = crate::W<SRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum RXNE {
11 Empty = 0,
13 NotEmpty = 1,
15}
16impl From<RXNE> for bool {
17 #[inline(always)]
18 fn from(variant: RXNE) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type RXNE_R = crate::BitReader<RXNE>;
24impl RXNE_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> RXNE {
28 match self.bits {
29 false => RXNE::Empty,
30 true => RXNE::NotEmpty,
31 }
32 }
33 #[inline(always)]
35 pub fn is_empty(&self) -> bool {
36 *self == RXNE::Empty
37 }
38 #[inline(always)]
40 pub fn is_not_empty(&self) -> bool {
41 *self == RXNE::NotEmpty
42 }
43}
44#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum TXE {
50 NotEmpty = 0,
52 Empty = 1,
54}
55impl From<TXE> for bool {
56 #[inline(always)]
57 fn from(variant: TXE) -> Self {
58 variant as u8 != 0
59 }
60}
61pub type TXE_R = crate::BitReader<TXE>;
63impl TXE_R {
64 #[inline(always)]
66 pub const fn variant(&self) -> TXE {
67 match self.bits {
68 false => TXE::NotEmpty,
69 true => TXE::Empty,
70 }
71 }
72 #[inline(always)]
74 pub fn is_not_empty(&self) -> bool {
75 *self == TXE::NotEmpty
76 }
77 #[inline(always)]
79 pub fn is_empty(&self) -> bool {
80 *self == TXE::Empty
81 }
82}
83#[cfg_attr(feature = "defmt", derive(defmt::Format))]
87#[derive(Clone, Copy, Debug, PartialEq, Eq)]
88pub enum CRCERRR {
89 Match = 0,
91 NoMatch = 1,
93}
94impl From<CRCERRR> for bool {
95 #[inline(always)]
96 fn from(variant: CRCERRR) -> Self {
97 variant as u8 != 0
98 }
99}
100pub type CRCERR_R = crate::BitReader<CRCERRR>;
102impl CRCERR_R {
103 #[inline(always)]
105 pub const fn variant(&self) -> CRCERRR {
106 match self.bits {
107 false => CRCERRR::Match,
108 true => CRCERRR::NoMatch,
109 }
110 }
111 #[inline(always)]
113 pub fn is_match(&self) -> bool {
114 *self == CRCERRR::Match
115 }
116 #[inline(always)]
118 pub fn is_no_match(&self) -> bool {
119 *self == CRCERRR::NoMatch
120 }
121}
122#[cfg_attr(feature = "defmt", derive(defmt::Format))]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum CRCERRW {
128 Clear = 0,
130}
131impl From<CRCERRW> for bool {
132 #[inline(always)]
133 fn from(variant: CRCERRW) -> Self {
134 variant as u8 != 0
135 }
136}
137pub type CRCERR_W<'a, REG> = crate::BitWriter0C<'a, REG, CRCERRW>;
139impl<'a, REG> CRCERR_W<'a, REG>
140where
141 REG: crate::Writable + crate::RegisterSpec,
142{
143 #[inline(always)]
145 pub fn clear(self) -> &'a mut crate::W<REG> {
146 self.variant(CRCERRW::Clear)
147 }
148}
149#[cfg_attr(feature = "defmt", derive(defmt::Format))]
153#[derive(Clone, Copy, Debug, PartialEq, Eq)]
154pub enum MODFR {
155 NoFault = 0,
157 Fault = 1,
159}
160impl From<MODFR> for bool {
161 #[inline(always)]
162 fn from(variant: MODFR) -> Self {
163 variant as u8 != 0
164 }
165}
166pub type MODF_R = crate::BitReader<MODFR>;
168impl MODF_R {
169 #[inline(always)]
171 pub const fn variant(&self) -> MODFR {
172 match self.bits {
173 false => MODFR::NoFault,
174 true => MODFR::Fault,
175 }
176 }
177 #[inline(always)]
179 pub fn is_no_fault(&self) -> bool {
180 *self == MODFR::NoFault
181 }
182 #[inline(always)]
184 pub fn is_fault(&self) -> bool {
185 *self == MODFR::Fault
186 }
187}
188#[cfg_attr(feature = "defmt", derive(defmt::Format))]
192#[derive(Clone, Copy, Debug, PartialEq, Eq)]
193pub enum OVRR {
194 NoOverrun = 0,
196 Overrun = 1,
198}
199impl From<OVRR> for bool {
200 #[inline(always)]
201 fn from(variant: OVRR) -> Self {
202 variant as u8 != 0
203 }
204}
205pub type OVR_R = crate::BitReader<OVRR>;
207impl OVR_R {
208 #[inline(always)]
210 pub const fn variant(&self) -> OVRR {
211 match self.bits {
212 false => OVRR::NoOverrun,
213 true => OVRR::Overrun,
214 }
215 }
216 #[inline(always)]
218 pub fn is_no_overrun(&self) -> bool {
219 *self == OVRR::NoOverrun
220 }
221 #[inline(always)]
223 pub fn is_overrun(&self) -> bool {
224 *self == OVRR::Overrun
225 }
226}
227#[cfg_attr(feature = "defmt", derive(defmt::Format))]
231#[derive(Clone, Copy, Debug, PartialEq, Eq)]
232pub enum BSYR {
233 NotBusy = 0,
235 Busy = 1,
237}
238impl From<BSYR> for bool {
239 #[inline(always)]
240 fn from(variant: BSYR) -> Self {
241 variant as u8 != 0
242 }
243}
244pub type BSY_R = crate::BitReader<BSYR>;
246impl BSY_R {
247 #[inline(always)]
249 pub const fn variant(&self) -> BSYR {
250 match self.bits {
251 false => BSYR::NotBusy,
252 true => BSYR::Busy,
253 }
254 }
255 #[inline(always)]
257 pub fn is_not_busy(&self) -> bool {
258 *self == BSYR::NotBusy
259 }
260 #[inline(always)]
262 pub fn is_busy(&self) -> bool {
263 *self == BSYR::Busy
264 }
265}
266#[cfg_attr(feature = "defmt", derive(defmt::Format))]
270#[derive(Clone, Copy, Debug, PartialEq, Eq)]
271pub enum FRER {
272 NoError = 0,
274 Error = 1,
276}
277impl From<FRER> for bool {
278 #[inline(always)]
279 fn from(variant: FRER) -> Self {
280 variant as u8 != 0
281 }
282}
283pub type FRE_R = crate::BitReader<FRER>;
285impl FRE_R {
286 #[inline(always)]
288 pub const fn variant(&self) -> FRER {
289 match self.bits {
290 false => FRER::NoError,
291 true => FRER::Error,
292 }
293 }
294 #[inline(always)]
296 pub fn is_no_error(&self) -> bool {
297 *self == FRER::NoError
298 }
299 #[inline(always)]
301 pub fn is_error(&self) -> bool {
302 *self == FRER::Error
303 }
304}
305#[cfg_attr(feature = "defmt", derive(defmt::Format))]
309#[derive(Clone, Copy, Debug, PartialEq, Eq)]
310#[repr(u8)]
311pub enum FRLVLR {
312 Empty = 0,
314 Quarter = 1,
316 Half = 2,
318 Full = 3,
320}
321impl From<FRLVLR> for u8 {
322 #[inline(always)]
323 fn from(variant: FRLVLR) -> Self {
324 variant as _
325 }
326}
327impl crate::FieldSpec for FRLVLR {
328 type Ux = u8;
329}
330impl crate::IsEnum for FRLVLR {}
331pub type FRLVL_R = crate::FieldReader<FRLVLR>;
333impl FRLVL_R {
334 #[inline(always)]
336 pub const fn variant(&self) -> FRLVLR {
337 match self.bits {
338 0 => FRLVLR::Empty,
339 1 => FRLVLR::Quarter,
340 2 => FRLVLR::Half,
341 3 => FRLVLR::Full,
342 _ => unreachable!(),
343 }
344 }
345 #[inline(always)]
347 pub fn is_empty(&self) -> bool {
348 *self == FRLVLR::Empty
349 }
350 #[inline(always)]
352 pub fn is_quarter(&self) -> bool {
353 *self == FRLVLR::Quarter
354 }
355 #[inline(always)]
357 pub fn is_half(&self) -> bool {
358 *self == FRLVLR::Half
359 }
360 #[inline(always)]
362 pub fn is_full(&self) -> bool {
363 *self == FRLVLR::Full
364 }
365}
366#[cfg_attr(feature = "defmt", derive(defmt::Format))]
370#[derive(Clone, Copy, Debug, PartialEq, Eq)]
371#[repr(u8)]
372pub enum FTLVLR {
373 Empty = 0,
375 Quarter = 1,
377 Half = 2,
379 Full = 3,
381}
382impl From<FTLVLR> for u8 {
383 #[inline(always)]
384 fn from(variant: FTLVLR) -> Self {
385 variant as _
386 }
387}
388impl crate::FieldSpec for FTLVLR {
389 type Ux = u8;
390}
391impl crate::IsEnum for FTLVLR {}
392pub type FTLVL_R = crate::FieldReader<FTLVLR>;
394impl FTLVL_R {
395 #[inline(always)]
397 pub const fn variant(&self) -> FTLVLR {
398 match self.bits {
399 0 => FTLVLR::Empty,
400 1 => FTLVLR::Quarter,
401 2 => FTLVLR::Half,
402 3 => FTLVLR::Full,
403 _ => unreachable!(),
404 }
405 }
406 #[inline(always)]
408 pub fn is_empty(&self) -> bool {
409 *self == FTLVLR::Empty
410 }
411 #[inline(always)]
413 pub fn is_quarter(&self) -> bool {
414 *self == FTLVLR::Quarter
415 }
416 #[inline(always)]
418 pub fn is_half(&self) -> bool {
419 *self == FTLVLR::Half
420 }
421 #[inline(always)]
423 pub fn is_full(&self) -> bool {
424 *self == FTLVLR::Full
425 }
426}
427impl R {
428 #[inline(always)]
430 pub fn rxne(&self) -> RXNE_R {
431 RXNE_R::new((self.bits & 1) != 0)
432 }
433 #[inline(always)]
435 pub fn txe(&self) -> TXE_R {
436 TXE_R::new(((self.bits >> 1) & 1) != 0)
437 }
438 #[inline(always)]
440 pub fn crcerr(&self) -> CRCERR_R {
441 CRCERR_R::new(((self.bits >> 4) & 1) != 0)
442 }
443 #[inline(always)]
445 pub fn modf(&self) -> MODF_R {
446 MODF_R::new(((self.bits >> 5) & 1) != 0)
447 }
448 #[inline(always)]
450 pub fn ovr(&self) -> OVR_R {
451 OVR_R::new(((self.bits >> 6) & 1) != 0)
452 }
453 #[inline(always)]
455 pub fn bsy(&self) -> BSY_R {
456 BSY_R::new(((self.bits >> 7) & 1) != 0)
457 }
458 #[inline(always)]
460 pub fn fre(&self) -> FRE_R {
461 FRE_R::new(((self.bits >> 8) & 1) != 0)
462 }
463 #[inline(always)]
465 pub fn frlvl(&self) -> FRLVL_R {
466 FRLVL_R::new(((self.bits >> 9) & 3) as u8)
467 }
468 #[inline(always)]
470 pub fn ftlvl(&self) -> FTLVL_R {
471 FTLVL_R::new(((self.bits >> 11) & 3) as u8)
472 }
473}
474impl core::fmt::Debug for R {
475 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
476 f.debug_struct("SR")
477 .field("rxne", &self.rxne())
478 .field("txe", &self.txe())
479 .field("crcerr", &self.crcerr())
480 .field("modf", &self.modf())
481 .field("ovr", &self.ovr())
482 .field("bsy", &self.bsy())
483 .field("fre", &self.fre())
484 .field("frlvl", &self.frlvl())
485 .field("ftlvl", &self.ftlvl())
486 .finish()
487 }
488}
489impl W {
490 #[inline(always)]
492 pub fn crcerr(&mut self) -> CRCERR_W<SRrs> {
493 CRCERR_W::new(self, 4)
494 }
495}
496pub struct SRrs;
502impl crate::RegisterSpec for SRrs {
503 type Ux = u16;
504}
505impl crate::Readable for SRrs {}
507impl crate::Writable for SRrs {
509 type Safety = crate::Unsafe;
510 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0x10;
511}
512impl crate::Resettable for SRrs {
514 const RESET_VALUE: u16 = 0x02;
515}