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 CHSIDE {
89 Left = 0,
91 Right = 1,
93}
94impl From<CHSIDE> for bool {
95 #[inline(always)]
96 fn from(variant: CHSIDE) -> Self {
97 variant as u8 != 0
98 }
99}
100pub type CHSIDE_R = crate::BitReader<CHSIDE>;
102impl CHSIDE_R {
103 #[inline(always)]
105 pub const fn variant(&self) -> CHSIDE {
106 match self.bits {
107 false => CHSIDE::Left,
108 true => CHSIDE::Right,
109 }
110 }
111 #[inline(always)]
113 pub fn is_left(&self) -> bool {
114 *self == CHSIDE::Left
115 }
116 #[inline(always)]
118 pub fn is_right(&self) -> bool {
119 *self == CHSIDE::Right
120 }
121}
122#[cfg_attr(feature = "defmt", derive(defmt::Format))]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum UDRR {
128 NoUnderrun = 0,
130 Underrun = 1,
132}
133impl From<UDRR> for bool {
134 #[inline(always)]
135 fn from(variant: UDRR) -> Self {
136 variant as u8 != 0
137 }
138}
139pub type UDR_R = crate::BitReader<UDRR>;
141impl UDR_R {
142 #[inline(always)]
144 pub const fn variant(&self) -> UDRR {
145 match self.bits {
146 false => UDRR::NoUnderrun,
147 true => UDRR::Underrun,
148 }
149 }
150 #[inline(always)]
152 pub fn is_no_underrun(&self) -> bool {
153 *self == UDRR::NoUnderrun
154 }
155 #[inline(always)]
157 pub fn is_underrun(&self) -> bool {
158 *self == UDRR::Underrun
159 }
160}
161#[cfg_attr(feature = "defmt", derive(defmt::Format))]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166pub enum CRCERRR {
167 Match = 0,
169 NoMatch = 1,
171}
172impl From<CRCERRR> for bool {
173 #[inline(always)]
174 fn from(variant: CRCERRR) -> Self {
175 variant as u8 != 0
176 }
177}
178pub type CRCERR_R = crate::BitReader<CRCERRR>;
180impl CRCERR_R {
181 #[inline(always)]
183 pub const fn variant(&self) -> CRCERRR {
184 match self.bits {
185 false => CRCERRR::Match,
186 true => CRCERRR::NoMatch,
187 }
188 }
189 #[inline(always)]
191 pub fn is_match(&self) -> bool {
192 *self == CRCERRR::Match
193 }
194 #[inline(always)]
196 pub fn is_no_match(&self) -> bool {
197 *self == CRCERRR::NoMatch
198 }
199}
200#[cfg_attr(feature = "defmt", derive(defmt::Format))]
204#[derive(Clone, Copy, Debug, PartialEq, Eq)]
205pub enum CRCERRW {
206 Clear = 0,
208}
209impl From<CRCERRW> for bool {
210 #[inline(always)]
211 fn from(variant: CRCERRW) -> Self {
212 variant as u8 != 0
213 }
214}
215pub type CRCERR_W<'a, REG> = crate::BitWriter0C<'a, REG, CRCERRW>;
217impl<'a, REG> CRCERR_W<'a, REG>
218where
219 REG: crate::Writable + crate::RegisterSpec,
220{
221 #[inline(always)]
223 pub fn clear(self) -> &'a mut crate::W<REG> {
224 self.variant(CRCERRW::Clear)
225 }
226}
227#[cfg_attr(feature = "defmt", derive(defmt::Format))]
231#[derive(Clone, Copy, Debug, PartialEq, Eq)]
232pub enum MODFR {
233 NoFault = 0,
235 Fault = 1,
237}
238impl From<MODFR> for bool {
239 #[inline(always)]
240 fn from(variant: MODFR) -> Self {
241 variant as u8 != 0
242 }
243}
244pub type MODF_R = crate::BitReader<MODFR>;
246impl MODF_R {
247 #[inline(always)]
249 pub const fn variant(&self) -> MODFR {
250 match self.bits {
251 false => MODFR::NoFault,
252 true => MODFR::Fault,
253 }
254 }
255 #[inline(always)]
257 pub fn is_no_fault(&self) -> bool {
258 *self == MODFR::NoFault
259 }
260 #[inline(always)]
262 pub fn is_fault(&self) -> bool {
263 *self == MODFR::Fault
264 }
265}
266#[cfg_attr(feature = "defmt", derive(defmt::Format))]
270#[derive(Clone, Copy, Debug, PartialEq, Eq)]
271pub enum OVRR {
272 NoOverrun = 0,
274 Overrun = 1,
276}
277impl From<OVRR> for bool {
278 #[inline(always)]
279 fn from(variant: OVRR) -> Self {
280 variant as u8 != 0
281 }
282}
283pub type OVR_R = crate::BitReader<OVRR>;
285impl OVR_R {
286 #[inline(always)]
288 pub const fn variant(&self) -> OVRR {
289 match self.bits {
290 false => OVRR::NoOverrun,
291 true => OVRR::Overrun,
292 }
293 }
294 #[inline(always)]
296 pub fn is_no_overrun(&self) -> bool {
297 *self == OVRR::NoOverrun
298 }
299 #[inline(always)]
301 pub fn is_overrun(&self) -> bool {
302 *self == OVRR::Overrun
303 }
304}
305#[cfg_attr(feature = "defmt", derive(defmt::Format))]
309#[derive(Clone, Copy, Debug, PartialEq, Eq)]
310pub enum BSYR {
311 NotBusy = 0,
313 Busy = 1,
315}
316impl From<BSYR> for bool {
317 #[inline(always)]
318 fn from(variant: BSYR) -> Self {
319 variant as u8 != 0
320 }
321}
322pub type BSY_R = crate::BitReader<BSYR>;
324impl BSY_R {
325 #[inline(always)]
327 pub const fn variant(&self) -> BSYR {
328 match self.bits {
329 false => BSYR::NotBusy,
330 true => BSYR::Busy,
331 }
332 }
333 #[inline(always)]
335 pub fn is_not_busy(&self) -> bool {
336 *self == BSYR::NotBusy
337 }
338 #[inline(always)]
340 pub fn is_busy(&self) -> bool {
341 *self == BSYR::Busy
342 }
343}
344#[cfg_attr(feature = "defmt", derive(defmt::Format))]
348#[derive(Clone, Copy, Debug, PartialEq, Eq)]
349pub enum FRER {
350 NoError = 0,
352 Error = 1,
354}
355impl From<FRER> for bool {
356 #[inline(always)]
357 fn from(variant: FRER) -> Self {
358 variant as u8 != 0
359 }
360}
361pub type FRE_R = crate::BitReader<FRER>;
363impl FRE_R {
364 #[inline(always)]
366 pub const fn variant(&self) -> FRER {
367 match self.bits {
368 false => FRER::NoError,
369 true => FRER::Error,
370 }
371 }
372 #[inline(always)]
374 pub fn is_no_error(&self) -> bool {
375 *self == FRER::NoError
376 }
377 #[inline(always)]
379 pub fn is_error(&self) -> bool {
380 *self == FRER::Error
381 }
382}
383impl R {
384 #[inline(always)]
386 pub fn rxne(&self) -> RXNE_R {
387 RXNE_R::new((self.bits & 1) != 0)
388 }
389 #[inline(always)]
391 pub fn txe(&self) -> TXE_R {
392 TXE_R::new(((self.bits >> 1) & 1) != 0)
393 }
394 #[inline(always)]
396 pub fn chside(&self) -> CHSIDE_R {
397 CHSIDE_R::new(((self.bits >> 2) & 1) != 0)
398 }
399 #[inline(always)]
401 pub fn udr(&self) -> UDR_R {
402 UDR_R::new(((self.bits >> 3) & 1) != 0)
403 }
404 #[inline(always)]
406 pub fn crcerr(&self) -> CRCERR_R {
407 CRCERR_R::new(((self.bits >> 4) & 1) != 0)
408 }
409 #[inline(always)]
411 pub fn modf(&self) -> MODF_R {
412 MODF_R::new(((self.bits >> 5) & 1) != 0)
413 }
414 #[inline(always)]
416 pub fn ovr(&self) -> OVR_R {
417 OVR_R::new(((self.bits >> 6) & 1) != 0)
418 }
419 #[inline(always)]
421 pub fn bsy(&self) -> BSY_R {
422 BSY_R::new(((self.bits >> 7) & 1) != 0)
423 }
424 #[inline(always)]
426 pub fn fre(&self) -> FRE_R {
427 FRE_R::new(((self.bits >> 8) & 1) != 0)
428 }
429}
430impl core::fmt::Debug for R {
431 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
432 f.debug_struct("SR")
433 .field("fre", &self.fre())
434 .field("bsy", &self.bsy())
435 .field("ovr", &self.ovr())
436 .field("modf", &self.modf())
437 .field("crcerr", &self.crcerr())
438 .field("udr", &self.udr())
439 .field("chside", &self.chside())
440 .field("txe", &self.txe())
441 .field("rxne", &self.rxne())
442 .finish()
443 }
444}
445impl W {
446 #[inline(always)]
448 pub fn crcerr(&mut self) -> CRCERR_W<SRrs> {
449 CRCERR_W::new(self, 4)
450 }
451}
452pub struct SRrs;
458impl crate::RegisterSpec for SRrs {
459 type Ux = u16;
460}
461impl crate::Readable for SRrs {}
463impl crate::Writable for SRrs {
465 type Safety = crate::Unsafe;
466 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0x10;
467}
468impl crate::Resettable for SRrs {
470 const RESET_VALUE: u16 = 0x02;
471}