v853_pac/uart/
lsr.rs

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