1#[doc = "Register `LSR` reader"]
2pub struct R(crate::R<LSR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LSR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LSR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LSR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `ORER` reader - Overrun Error Flag"]
17pub type ORER_R = crate::BitReader<ORER_A>;
18#[doc = "Overrun Error Flag\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum ORER_A {
21 #[doc = "0: No overrun error occurred"]
22 _0 = 0,
23 #[doc = "1: Overrun error occurred"]
24 _1 = 1,
25}
26impl From<ORER_A> for bool {
27 #[inline(always)]
28 fn from(variant: ORER_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl ORER_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> ORER_A {
36 match self.bits {
37 false => ORER_A::_0,
38 true => ORER_A::_1,
39 }
40 }
41 #[doc = "Checks if the value of the field is `_0`"]
42 #[inline(always)]
43 pub fn is_0(&self) -> bool {
44 *self == ORER_A::_0
45 }
46 #[doc = "Checks if the value of the field is `_1`"]
47 #[inline(always)]
48 pub fn is_1(&self) -> bool {
49 *self == ORER_A::_1
50 }
51}
52#[doc = "Field `FNUM` reader - Framing Error Count"]
53pub type FNUM_R = crate::FieldReader<u8, u8>;
54#[doc = "Field `PNUM` reader - Parity Error Count"]
55pub type PNUM_R = crate::FieldReader<u8, u8>;
56impl R {
57 #[doc = "Bit 0 - Overrun Error Flag"]
58 #[inline(always)]
59 pub fn orer(&self) -> ORER_R {
60 ORER_R::new((self.bits & 1) != 0)
61 }
62 #[doc = "Bits 2:6 - Framing Error Count"]
63 #[inline(always)]
64 pub fn fnum(&self) -> FNUM_R {
65 FNUM_R::new(((self.bits >> 2) & 0x1f) as u8)
66 }
67 #[doc = "Bits 8:12 - Parity Error Count"]
68 #[inline(always)]
69 pub fn pnum(&self) -> PNUM_R {
70 PNUM_R::new(((self.bits >> 8) & 0x1f) as u8)
71 }
72}
73#[doc = "Line Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lsr](index.html) module"]
74pub struct LSR_SPEC;
75impl crate::RegisterSpec for LSR_SPEC {
76 type Ux = u16;
77}
78#[doc = "`read()` method returns [lsr::R](R) reader structure"]
79impl crate::Readable for LSR_SPEC {
80 type Reader = R;
81}
82#[doc = "`reset()` method sets LSR to value 0"]
83impl crate::Resettable for LSR_SPEC {
84 const RESET_VALUE: Self::Ux = 0;
85}