mk66f18/uart2/
s1.rs

1#[doc = "Reader of register S1"]
2pub type R = crate::R<u8, super::S1>;
3#[doc = "Parity Error Flag\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq)]
5pub enum PF_A {
6    #[doc = "0: No parity error detected since the last time this flag was cleared. If the receive buffer has a depth greater than 1, then there may be data in the receive buffer what was received with a parity error."]
7    _0,
8    #[doc = "1: At least one dataword was received with a parity error since the last time this flag was cleared."]
9    _1,
10}
11impl From<PF_A> for bool {
12    #[inline(always)]
13    fn from(variant: PF_A) -> Self {
14        match variant {
15            PF_A::_0 => false,
16            PF_A::_1 => true,
17        }
18    }
19}
20#[doc = "Reader of field `PF`"]
21pub type PF_R = crate::R<bool, PF_A>;
22impl PF_R {
23    #[doc = r"Get enumerated values variant"]
24    #[inline(always)]
25    pub fn variant(&self) -> PF_A {
26        match self.bits {
27            false => PF_A::_0,
28            true => PF_A::_1,
29        }
30    }
31    #[doc = "Checks if the value of the field is `_0`"]
32    #[inline(always)]
33    pub fn is_0(&self) -> bool {
34        *self == PF_A::_0
35    }
36    #[doc = "Checks if the value of the field is `_1`"]
37    #[inline(always)]
38    pub fn is_1(&self) -> bool {
39        *self == PF_A::_1
40    }
41}
42#[doc = "Framing Error Flag\n\nValue on reset: 0"]
43#[derive(Clone, Copy, Debug, PartialEq)]
44pub enum FE_A {
45    #[doc = "0: No framing error detected."]
46    _0,
47    #[doc = "1: Framing error."]
48    _1,
49}
50impl From<FE_A> for bool {
51    #[inline(always)]
52    fn from(variant: FE_A) -> Self {
53        match variant {
54            FE_A::_0 => false,
55            FE_A::_1 => true,
56        }
57    }
58}
59#[doc = "Reader of field `FE`"]
60pub type FE_R = crate::R<bool, FE_A>;
61impl FE_R {
62    #[doc = r"Get enumerated values variant"]
63    #[inline(always)]
64    pub fn variant(&self) -> FE_A {
65        match self.bits {
66            false => FE_A::_0,
67            true => FE_A::_1,
68        }
69    }
70    #[doc = "Checks if the value of the field is `_0`"]
71    #[inline(always)]
72    pub fn is_0(&self) -> bool {
73        *self == FE_A::_0
74    }
75    #[doc = "Checks if the value of the field is `_1`"]
76    #[inline(always)]
77    pub fn is_1(&self) -> bool {
78        *self == FE_A::_1
79    }
80}
81#[doc = "Noise Flag\n\nValue on reset: 0"]
82#[derive(Clone, Copy, Debug, PartialEq)]
83pub enum NF_A {
84    #[doc = "0: No noise detected since the last time this flag was cleared. If the receive buffer has a depth greater than 1 then there may be data in the receiver buffer that was received with noise."]
85    _0,
86    #[doc = "1: At least one dataword was received with noise detected since the last time the flag was cleared."]
87    _1,
88}
89impl From<NF_A> for bool {
90    #[inline(always)]
91    fn from(variant: NF_A) -> Self {
92        match variant {
93            NF_A::_0 => false,
94            NF_A::_1 => true,
95        }
96    }
97}
98#[doc = "Reader of field `NF`"]
99pub type NF_R = crate::R<bool, NF_A>;
100impl NF_R {
101    #[doc = r"Get enumerated values variant"]
102    #[inline(always)]
103    pub fn variant(&self) -> NF_A {
104        match self.bits {
105            false => NF_A::_0,
106            true => NF_A::_1,
107        }
108    }
109    #[doc = "Checks if the value of the field is `_0`"]
110    #[inline(always)]
111    pub fn is_0(&self) -> bool {
112        *self == NF_A::_0
113    }
114    #[doc = "Checks if the value of the field is `_1`"]
115    #[inline(always)]
116    pub fn is_1(&self) -> bool {
117        *self == NF_A::_1
118    }
119}
120#[doc = "Receiver Overrun Flag\n\nValue on reset: 0"]
121#[derive(Clone, Copy, Debug, PartialEq)]
122pub enum OR_A {
123    #[doc = "0: No overrun has occurred since the last time the flag was cleared."]
124    _0,
125    #[doc = "1: Overrun has occurred or the overrun flag has not been cleared since the last overrun occurred."]
126    _1,
127}
128impl From<OR_A> for bool {
129    #[inline(always)]
130    fn from(variant: OR_A) -> Self {
131        match variant {
132            OR_A::_0 => false,
133            OR_A::_1 => true,
134        }
135    }
136}
137#[doc = "Reader of field `OR`"]
138pub type OR_R = crate::R<bool, OR_A>;
139impl OR_R {
140    #[doc = r"Get enumerated values variant"]
141    #[inline(always)]
142    pub fn variant(&self) -> OR_A {
143        match self.bits {
144            false => OR_A::_0,
145            true => OR_A::_1,
146        }
147    }
148    #[doc = "Checks if the value of the field is `_0`"]
149    #[inline(always)]
150    pub fn is_0(&self) -> bool {
151        *self == OR_A::_0
152    }
153    #[doc = "Checks if the value of the field is `_1`"]
154    #[inline(always)]
155    pub fn is_1(&self) -> bool {
156        *self == OR_A::_1
157    }
158}
159#[doc = "Idle Line Flag\n\nValue on reset: 0"]
160#[derive(Clone, Copy, Debug, PartialEq)]
161pub enum IDLE_A {
162    #[doc = "0: Receiver input is either active now or has never become active since the IDLE flag was last cleared."]
163    _0,
164    #[doc = "1: Receiver input has become idle or the flag has not been cleared since it last asserted."]
165    _1,
166}
167impl From<IDLE_A> for bool {
168    #[inline(always)]
169    fn from(variant: IDLE_A) -> Self {
170        match variant {
171            IDLE_A::_0 => false,
172            IDLE_A::_1 => true,
173        }
174    }
175}
176#[doc = "Reader of field `IDLE`"]
177pub type IDLE_R = crate::R<bool, IDLE_A>;
178impl IDLE_R {
179    #[doc = r"Get enumerated values variant"]
180    #[inline(always)]
181    pub fn variant(&self) -> IDLE_A {
182        match self.bits {
183            false => IDLE_A::_0,
184            true => IDLE_A::_1,
185        }
186    }
187    #[doc = "Checks if the value of the field is `_0`"]
188    #[inline(always)]
189    pub fn is_0(&self) -> bool {
190        *self == IDLE_A::_0
191    }
192    #[doc = "Checks if the value of the field is `_1`"]
193    #[inline(always)]
194    pub fn is_1(&self) -> bool {
195        *self == IDLE_A::_1
196    }
197}
198#[doc = "Receive Data Register Full Flag\n\nValue on reset: 0"]
199#[derive(Clone, Copy, Debug, PartialEq)]
200pub enum RDRF_A {
201    #[doc = "0: The number of datawords in the receive buffer is less than the number indicated by RXWATER."]
202    _0,
203    #[doc = "1: The number of datawords in the receive buffer is equal to or greater than the number indicated by RXWATER at some point in time since this flag was last cleared."]
204    _1,
205}
206impl From<RDRF_A> for bool {
207    #[inline(always)]
208    fn from(variant: RDRF_A) -> Self {
209        match variant {
210            RDRF_A::_0 => false,
211            RDRF_A::_1 => true,
212        }
213    }
214}
215#[doc = "Reader of field `RDRF`"]
216pub type RDRF_R = crate::R<bool, RDRF_A>;
217impl RDRF_R {
218    #[doc = r"Get enumerated values variant"]
219    #[inline(always)]
220    pub fn variant(&self) -> RDRF_A {
221        match self.bits {
222            false => RDRF_A::_0,
223            true => RDRF_A::_1,
224        }
225    }
226    #[doc = "Checks if the value of the field is `_0`"]
227    #[inline(always)]
228    pub fn is_0(&self) -> bool {
229        *self == RDRF_A::_0
230    }
231    #[doc = "Checks if the value of the field is `_1`"]
232    #[inline(always)]
233    pub fn is_1(&self) -> bool {
234        *self == RDRF_A::_1
235    }
236}
237#[doc = "Transmit Complete Flag\n\nValue on reset: 1"]
238#[derive(Clone, Copy, Debug, PartialEq)]
239pub enum TC_A {
240    #[doc = "0: Transmitter active (sending data, a preamble, or a break)."]
241    _0,
242    #[doc = "1: Transmitter idle (transmission activity complete)."]
243    _1,
244}
245impl From<TC_A> for bool {
246    #[inline(always)]
247    fn from(variant: TC_A) -> Self {
248        match variant {
249            TC_A::_0 => false,
250            TC_A::_1 => true,
251        }
252    }
253}
254#[doc = "Reader of field `TC`"]
255pub type TC_R = crate::R<bool, TC_A>;
256impl TC_R {
257    #[doc = r"Get enumerated values variant"]
258    #[inline(always)]
259    pub fn variant(&self) -> TC_A {
260        match self.bits {
261            false => TC_A::_0,
262            true => TC_A::_1,
263        }
264    }
265    #[doc = "Checks if the value of the field is `_0`"]
266    #[inline(always)]
267    pub fn is_0(&self) -> bool {
268        *self == TC_A::_0
269    }
270    #[doc = "Checks if the value of the field is `_1`"]
271    #[inline(always)]
272    pub fn is_1(&self) -> bool {
273        *self == TC_A::_1
274    }
275}
276#[doc = "Transmit Data Register Empty Flag\n\nValue on reset: 1"]
277#[derive(Clone, Copy, Debug, PartialEq)]
278pub enum TDRE_A {
279    #[doc = "0: The amount of data in the transmit buffer is greater than the value indicated by TWFIFO\\[TXWATER\\]."]
280    _0,
281    #[doc = "1: The amount of data in the transmit buffer is less than or equal to the value indicated by TWFIFO\\[TXWATER\\] at some point in time since the flag has been cleared."]
282    _1,
283}
284impl From<TDRE_A> for bool {
285    #[inline(always)]
286    fn from(variant: TDRE_A) -> Self {
287        match variant {
288            TDRE_A::_0 => false,
289            TDRE_A::_1 => true,
290        }
291    }
292}
293#[doc = "Reader of field `TDRE`"]
294pub type TDRE_R = crate::R<bool, TDRE_A>;
295impl TDRE_R {
296    #[doc = r"Get enumerated values variant"]
297    #[inline(always)]
298    pub fn variant(&self) -> TDRE_A {
299        match self.bits {
300            false => TDRE_A::_0,
301            true => TDRE_A::_1,
302        }
303    }
304    #[doc = "Checks if the value of the field is `_0`"]
305    #[inline(always)]
306    pub fn is_0(&self) -> bool {
307        *self == TDRE_A::_0
308    }
309    #[doc = "Checks if the value of the field is `_1`"]
310    #[inline(always)]
311    pub fn is_1(&self) -> bool {
312        *self == TDRE_A::_1
313    }
314}
315impl R {
316    #[doc = "Bit 0 - Parity Error Flag"]
317    #[inline(always)]
318    pub fn pf(&self) -> PF_R {
319        PF_R::new((self.bits & 0x01) != 0)
320    }
321    #[doc = "Bit 1 - Framing Error Flag"]
322    #[inline(always)]
323    pub fn fe(&self) -> FE_R {
324        FE_R::new(((self.bits >> 1) & 0x01) != 0)
325    }
326    #[doc = "Bit 2 - Noise Flag"]
327    #[inline(always)]
328    pub fn nf(&self) -> NF_R {
329        NF_R::new(((self.bits >> 2) & 0x01) != 0)
330    }
331    #[doc = "Bit 3 - Receiver Overrun Flag"]
332    #[inline(always)]
333    pub fn or(&self) -> OR_R {
334        OR_R::new(((self.bits >> 3) & 0x01) != 0)
335    }
336    #[doc = "Bit 4 - Idle Line Flag"]
337    #[inline(always)]
338    pub fn idle(&self) -> IDLE_R {
339        IDLE_R::new(((self.bits >> 4) & 0x01) != 0)
340    }
341    #[doc = "Bit 5 - Receive Data Register Full Flag"]
342    #[inline(always)]
343    pub fn rdrf(&self) -> RDRF_R {
344        RDRF_R::new(((self.bits >> 5) & 0x01) != 0)
345    }
346    #[doc = "Bit 6 - Transmit Complete Flag"]
347    #[inline(always)]
348    pub fn tc(&self) -> TC_R {
349        TC_R::new(((self.bits >> 6) & 0x01) != 0)
350    }
351    #[doc = "Bit 7 - Transmit Data Register Empty Flag"]
352    #[inline(always)]
353    pub fn tdre(&self) -> TDRE_R {
354        TDRE_R::new(((self.bits >> 7) & 0x01) != 0)
355    }
356}