d1_pac/uart/
lsr.rs

1#[doc = "Register `lsr` reader"]
2pub type R = crate::R<LSR_SPEC>;
3#[doc = "Field `dr` reader - Data Ready"]
4pub type DR_R = crate::BitReader<DR_A>;
5#[doc = "Data Ready\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum DR_A {
8    #[doc = "1: `1`"]
9    READY = 1,
10}
11impl From<DR_A> for bool {
12    #[inline(always)]
13    fn from(variant: DR_A) -> Self {
14        variant as u8 != 0
15    }
16}
17impl DR_R {
18    #[doc = "Get enumerated values variant"]
19    #[inline(always)]
20    pub const fn variant(&self) -> Option<DR_A> {
21        match self.bits {
22            true => Some(DR_A::READY),
23            _ => None,
24        }
25    }
26    #[doc = "`1`"]
27    #[inline(always)]
28    pub fn is_ready(&self) -> bool {
29        *self == DR_A::READY
30    }
31}
32#[doc = "Field `oe` reader - Overrun Error"]
33pub type OE_R = crate::BitReader<OE_A>;
34#[doc = "Overrun Error\n\nValue on reset: 0"]
35#[derive(Clone, Copy, Debug, PartialEq, Eq)]
36pub enum OE_A {
37    #[doc = "1: `1`"]
38    ERROR = 1,
39}
40impl From<OE_A> for bool {
41    #[inline(always)]
42    fn from(variant: OE_A) -> Self {
43        variant as u8 != 0
44    }
45}
46impl OE_R {
47    #[doc = "Get enumerated values variant"]
48    #[inline(always)]
49    pub const fn variant(&self) -> Option<OE_A> {
50        match self.bits {
51            true => Some(OE_A::ERROR),
52            _ => None,
53        }
54    }
55    #[doc = "`1`"]
56    #[inline(always)]
57    pub fn is_error(&self) -> bool {
58        *self == OE_A::ERROR
59    }
60}
61#[doc = "Field `pe` reader - Parity Error"]
62pub type PE_R = crate::BitReader<PE_A>;
63#[doc = "Parity Error\n\nValue on reset: 0"]
64#[derive(Clone, Copy, Debug, PartialEq, Eq)]
65pub enum PE_A {
66    #[doc = "1: `1`"]
67    ERROR = 1,
68}
69impl From<PE_A> for bool {
70    #[inline(always)]
71    fn from(variant: PE_A) -> Self {
72        variant as u8 != 0
73    }
74}
75impl PE_R {
76    #[doc = "Get enumerated values variant"]
77    #[inline(always)]
78    pub const fn variant(&self) -> Option<PE_A> {
79        match self.bits {
80            true => Some(PE_A::ERROR),
81            _ => None,
82        }
83    }
84    #[doc = "`1`"]
85    #[inline(always)]
86    pub fn is_error(&self) -> bool {
87        *self == PE_A::ERROR
88    }
89}
90#[doc = "Field `fe` reader - Framing Error"]
91pub type FE_R = crate::BitReader<FE_A>;
92#[doc = "Framing Error\n\nValue on reset: 0"]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94pub enum FE_A {
95    #[doc = "1: `1`"]
96    ERROR = 1,
97}
98impl From<FE_A> for bool {
99    #[inline(always)]
100    fn from(variant: FE_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl FE_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub const fn variant(&self) -> Option<FE_A> {
108        match self.bits {
109            true => Some(FE_A::ERROR),
110            _ => None,
111        }
112    }
113    #[doc = "`1`"]
114    #[inline(always)]
115    pub fn is_error(&self) -> bool {
116        *self == FE_A::ERROR
117    }
118}
119#[doc = "Field `bi` reader - Break Interrupt"]
120pub type BI_R = crate::BitReader;
121#[doc = "Field `thre` reader - TX Holding Register Empty"]
122pub type THRE_R = crate::BitReader<THRE_A>;
123#[doc = "TX Holding Register Empty\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum THRE_A {
126    #[doc = "1: `1`"]
127    EMPTY = 1,
128}
129impl From<THRE_A> for bool {
130    #[inline(always)]
131    fn from(variant: THRE_A) -> Self {
132        variant as u8 != 0
133    }
134}
135impl THRE_R {
136    #[doc = "Get enumerated values variant"]
137    #[inline(always)]
138    pub const fn variant(&self) -> Option<THRE_A> {
139        match self.bits {
140            true => Some(THRE_A::EMPTY),
141            _ => None,
142        }
143    }
144    #[doc = "`1`"]
145    #[inline(always)]
146    pub fn is_empty(&self) -> bool {
147        *self == THRE_A::EMPTY
148    }
149}
150#[doc = "Field `temt` reader - Transmitter Empty"]
151pub type TEMT_R = crate::BitReader<TEMT_A>;
152#[doc = "Transmitter Empty\n\nValue on reset: 0"]
153#[derive(Clone, Copy, Debug, PartialEq, Eq)]
154pub enum TEMT_A {
155    #[doc = "1: `1`"]
156    EMPTY = 1,
157}
158impl From<TEMT_A> for bool {
159    #[inline(always)]
160    fn from(variant: TEMT_A) -> Self {
161        variant as u8 != 0
162    }
163}
164impl TEMT_R {
165    #[doc = "Get enumerated values variant"]
166    #[inline(always)]
167    pub const fn variant(&self) -> Option<TEMT_A> {
168        match self.bits {
169            true => Some(TEMT_A::EMPTY),
170            _ => None,
171        }
172    }
173    #[doc = "`1`"]
174    #[inline(always)]
175    pub fn is_empty(&self) -> bool {
176        *self == TEMT_A::EMPTY
177    }
178}
179#[doc = "Field `fifoerr` reader - RX Data Error in FIFO"]
180pub type FIFOERR_R = crate::BitReader<FIFOERR_A>;
181#[doc = "RX Data Error in FIFO\n\nValue on reset: 0"]
182#[derive(Clone, Copy, Debug, PartialEq, Eq)]
183pub enum FIFOERR_A {
184    #[doc = "1: `1`"]
185    ERROR = 1,
186}
187impl From<FIFOERR_A> for bool {
188    #[inline(always)]
189    fn from(variant: FIFOERR_A) -> Self {
190        variant as u8 != 0
191    }
192}
193impl FIFOERR_R {
194    #[doc = "Get enumerated values variant"]
195    #[inline(always)]
196    pub const fn variant(&self) -> Option<FIFOERR_A> {
197        match self.bits {
198            true => Some(FIFOERR_A::ERROR),
199            _ => None,
200        }
201    }
202    #[doc = "`1`"]
203    #[inline(always)]
204    pub fn is_error(&self) -> bool {
205        *self == FIFOERR_A::ERROR
206    }
207}
208impl R {
209    #[doc = "Bit 0 - Data Ready"]
210    #[inline(always)]
211    pub fn dr(&self) -> DR_R {
212        DR_R::new((self.bits & 1) != 0)
213    }
214    #[doc = "Bit 1 - Overrun Error"]
215    #[inline(always)]
216    pub fn oe(&self) -> OE_R {
217        OE_R::new(((self.bits >> 1) & 1) != 0)
218    }
219    #[doc = "Bit 2 - Parity Error"]
220    #[inline(always)]
221    pub fn pe(&self) -> PE_R {
222        PE_R::new(((self.bits >> 2) & 1) != 0)
223    }
224    #[doc = "Bit 3 - Framing Error"]
225    #[inline(always)]
226    pub fn fe(&self) -> FE_R {
227        FE_R::new(((self.bits >> 3) & 1) != 0)
228    }
229    #[doc = "Bit 4 - Break Interrupt"]
230    #[inline(always)]
231    pub fn bi(&self) -> BI_R {
232        BI_R::new(((self.bits >> 4) & 1) != 0)
233    }
234    #[doc = "Bit 5 - TX Holding Register Empty"]
235    #[inline(always)]
236    pub fn thre(&self) -> THRE_R {
237        THRE_R::new(((self.bits >> 5) & 1) != 0)
238    }
239    #[doc = "Bit 6 - Transmitter Empty"]
240    #[inline(always)]
241    pub fn temt(&self) -> TEMT_R {
242        TEMT_R::new(((self.bits >> 6) & 1) != 0)
243    }
244    #[doc = "Bit 7 - RX Data Error in FIFO"]
245    #[inline(always)]
246    pub fn fifoerr(&self) -> FIFOERR_R {
247        FIFOERR_R::new(((self.bits >> 7) & 1) != 0)
248    }
249}
250#[doc = "UART Line Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`lsr::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
251pub struct LSR_SPEC;
252impl crate::RegisterSpec for LSR_SPEC {
253    type Ux = u32;
254}
255#[doc = "`read()` method returns [`lsr::R`](R) reader structure"]
256impl crate::Readable for LSR_SPEC {}
257#[doc = "`reset()` method sets lsr to value 0"]
258impl crate::Resettable for LSR_SPEC {
259    const RESET_VALUE: Self::Ux = 0;
260}