mkl26z4/uart1/
s2.rs

1#[doc = "Reader of register S2"]
2pub type R = crate::R<u8, super::S2>;
3#[doc = "Writer for register S2"]
4pub type W = crate::W<u8, super::S2>;
5#[doc = "Register S2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::S2 {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Possible values of the field `RAF`"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum RAF_A {
16    #[doc = "UART receiver idle waiting for a start bit."]
17    _0,
18    #[doc = "UART receiver active (RxD input not idle)."]
19    _1,
20}
21impl crate::ToBits<bool> for RAF_A {
22    #[inline(always)]
23    fn _bits(&self) -> bool {
24        match *self {
25            RAF_A::_0 => false,
26            RAF_A::_1 => true,
27        }
28    }
29}
30#[doc = "Reader of field `RAF`"]
31pub type RAF_R = crate::R<bool, RAF_A>;
32impl RAF_R {
33    #[doc = r"Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> RAF_A {
36        match self.bits {
37            false => RAF_A::_0,
38            true => RAF_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 == RAF_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 == RAF_A::_1
50    }
51}
52#[doc = "Possible values of the field `LBKDE`"]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub enum LBKDE_A {
55    #[doc = "Break detection is disabled."]
56    _0,
57    #[doc = "Break detection is enabled (Break character is detected at length 11 bit times (if C1\\[M\\] = 0, BDH\\[SBNS\\] = 0) or 12 (if C1\\[M\\] = 1, BDH\\[SBNS\\] = 0 or C1\\[M\\] = 0, BDH\\[SBNS\\] = 1) or 13 (if C1\\[M\\] = 1, BDH\\[SBNS\\] = 1))."]
58    _1,
59}
60impl crate::ToBits<bool> for LBKDE_A {
61    #[inline(always)]
62    fn _bits(&self) -> bool {
63        match *self {
64            LBKDE_A::_0 => false,
65            LBKDE_A::_1 => true,
66        }
67    }
68}
69#[doc = "Reader of field `LBKDE`"]
70pub type LBKDE_R = crate::R<bool, LBKDE_A>;
71impl LBKDE_R {
72    #[doc = r"Get enumerated values variant"]
73    #[inline(always)]
74    pub fn variant(&self) -> LBKDE_A {
75        match self.bits {
76            false => LBKDE_A::_0,
77            true => LBKDE_A::_1,
78        }
79    }
80    #[doc = "Checks if the value of the field is `_0`"]
81    #[inline(always)]
82    pub fn is_0(&self) -> bool {
83        *self == LBKDE_A::_0
84    }
85    #[doc = "Checks if the value of the field is `_1`"]
86    #[inline(always)]
87    pub fn is_1(&self) -> bool {
88        *self == LBKDE_A::_1
89    }
90}
91#[doc = "Write proxy for field `LBKDE`"]
92pub struct LBKDE_W<'a> {
93    w: &'a mut W,
94}
95impl<'a> LBKDE_W<'a> {
96    #[doc = r"Writes `variant` to the field"]
97    #[inline(always)]
98    pub fn variant(self, variant: LBKDE_A) -> &'a mut W {
99        use crate::ToBits;
100        {
101            self.bit(variant._bits())
102        }
103    }
104    #[doc = "Break detection is disabled."]
105    #[inline(always)]
106    pub fn _0(self) -> &'a mut W {
107        self.variant(LBKDE_A::_0)
108    }
109    #[doc = "Break detection is enabled (Break character is detected at length 11 bit times (if C1\\[M\\] = 0, BDH\\[SBNS\\] = 0) or 12 (if C1\\[M\\] = 1, BDH\\[SBNS\\] = 0 or C1\\[M\\] = 0, BDH\\[SBNS\\] = 1) or 13 (if C1\\[M\\] = 1, BDH\\[SBNS\\] = 1))."]
110    #[inline(always)]
111    pub fn _1(self) -> &'a mut W {
112        self.variant(LBKDE_A::_1)
113    }
114    #[doc = r"Sets the field bit"]
115    #[inline(always)]
116    pub fn set_bit(self) -> &'a mut W {
117        self.bit(true)
118    }
119    #[doc = r"Clears the field bit"]
120    #[inline(always)]
121    pub fn clear_bit(self) -> &'a mut W {
122        self.bit(false)
123    }
124    #[doc = r"Writes raw bits to the field"]
125    #[inline(always)]
126    pub fn bit(self, value: bool) -> &'a mut W {
127        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u8) & 0x01) << 1);
128        self.w
129    }
130}
131#[doc = "Possible values of the field `BRK13`"]
132#[derive(Clone, Copy, Debug, PartialEq)]
133pub enum BRK13_A {
134    #[doc = "Break character is transmitted with length of 10 bit times (if M = 0, SBNS = 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1, SBNS = 1)."]
135    _0,
136    #[doc = "Break character is transmitted with length of 13 bit times (if M = 0, SBNS = 0) or 14 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 15 (if M = 1, SBNS = 1)."]
137    _1,
138}
139impl crate::ToBits<bool> for BRK13_A {
140    #[inline(always)]
141    fn _bits(&self) -> bool {
142        match *self {
143            BRK13_A::_0 => false,
144            BRK13_A::_1 => true,
145        }
146    }
147}
148#[doc = "Reader of field `BRK13`"]
149pub type BRK13_R = crate::R<bool, BRK13_A>;
150impl BRK13_R {
151    #[doc = r"Get enumerated values variant"]
152    #[inline(always)]
153    pub fn variant(&self) -> BRK13_A {
154        match self.bits {
155            false => BRK13_A::_0,
156            true => BRK13_A::_1,
157        }
158    }
159    #[doc = "Checks if the value of the field is `_0`"]
160    #[inline(always)]
161    pub fn is_0(&self) -> bool {
162        *self == BRK13_A::_0
163    }
164    #[doc = "Checks if the value of the field is `_1`"]
165    #[inline(always)]
166    pub fn is_1(&self) -> bool {
167        *self == BRK13_A::_1
168    }
169}
170#[doc = "Write proxy for field `BRK13`"]
171pub struct BRK13_W<'a> {
172    w: &'a mut W,
173}
174impl<'a> BRK13_W<'a> {
175    #[doc = r"Writes `variant` to the field"]
176    #[inline(always)]
177    pub fn variant(self, variant: BRK13_A) -> &'a mut W {
178        use crate::ToBits;
179        {
180            self.bit(variant._bits())
181        }
182    }
183    #[doc = "Break character is transmitted with length of 10 bit times (if M = 0, SBNS = 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1, SBNS = 1)."]
184    #[inline(always)]
185    pub fn _0(self) -> &'a mut W {
186        self.variant(BRK13_A::_0)
187    }
188    #[doc = "Break character is transmitted with length of 13 bit times (if M = 0, SBNS = 0) or 14 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 15 (if M = 1, SBNS = 1)."]
189    #[inline(always)]
190    pub fn _1(self) -> &'a mut W {
191        self.variant(BRK13_A::_1)
192    }
193    #[doc = r"Sets the field bit"]
194    #[inline(always)]
195    pub fn set_bit(self) -> &'a mut W {
196        self.bit(true)
197    }
198    #[doc = r"Clears the field bit"]
199    #[inline(always)]
200    pub fn clear_bit(self) -> &'a mut W {
201        self.bit(false)
202    }
203    #[doc = r"Writes raw bits to the field"]
204    #[inline(always)]
205    pub fn bit(self, value: bool) -> &'a mut W {
206        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u8) & 0x01) << 2);
207        self.w
208    }
209}
210#[doc = "Possible values of the field `RWUID`"]
211#[derive(Clone, Copy, Debug, PartialEq)]
212pub enum RWUID_A {
213    #[doc = "During receive standby state (RWU = 1), S1\\[IDLE\\] does not get set upon detection of an idle character."]
214    _0,
215    #[doc = "During receive standby state (RWU = 1), S1\\[IDLE\\] gets set upon detection of an idle character."]
216    _1,
217}
218impl crate::ToBits<bool> for RWUID_A {
219    #[inline(always)]
220    fn _bits(&self) -> bool {
221        match *self {
222            RWUID_A::_0 => false,
223            RWUID_A::_1 => true,
224        }
225    }
226}
227#[doc = "Reader of field `RWUID`"]
228pub type RWUID_R = crate::R<bool, RWUID_A>;
229impl RWUID_R {
230    #[doc = r"Get enumerated values variant"]
231    #[inline(always)]
232    pub fn variant(&self) -> RWUID_A {
233        match self.bits {
234            false => RWUID_A::_0,
235            true => RWUID_A::_1,
236        }
237    }
238    #[doc = "Checks if the value of the field is `_0`"]
239    #[inline(always)]
240    pub fn is_0(&self) -> bool {
241        *self == RWUID_A::_0
242    }
243    #[doc = "Checks if the value of the field is `_1`"]
244    #[inline(always)]
245    pub fn is_1(&self) -> bool {
246        *self == RWUID_A::_1
247    }
248}
249#[doc = "Write proxy for field `RWUID`"]
250pub struct RWUID_W<'a> {
251    w: &'a mut W,
252}
253impl<'a> RWUID_W<'a> {
254    #[doc = r"Writes `variant` to the field"]
255    #[inline(always)]
256    pub fn variant(self, variant: RWUID_A) -> &'a mut W {
257        use crate::ToBits;
258        {
259            self.bit(variant._bits())
260        }
261    }
262    #[doc = "During receive standby state (RWU = 1), S1\\[IDLE\\] does not get set upon detection of an idle character."]
263    #[inline(always)]
264    pub fn _0(self) -> &'a mut W {
265        self.variant(RWUID_A::_0)
266    }
267    #[doc = "During receive standby state (RWU = 1), S1\\[IDLE\\] gets set upon detection of an idle character."]
268    #[inline(always)]
269    pub fn _1(self) -> &'a mut W {
270        self.variant(RWUID_A::_1)
271    }
272    #[doc = r"Sets the field bit"]
273    #[inline(always)]
274    pub fn set_bit(self) -> &'a mut W {
275        self.bit(true)
276    }
277    #[doc = r"Clears the field bit"]
278    #[inline(always)]
279    pub fn clear_bit(self) -> &'a mut W {
280        self.bit(false)
281    }
282    #[doc = r"Writes raw bits to the field"]
283    #[inline(always)]
284    pub fn bit(self, value: bool) -> &'a mut W {
285        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u8) & 0x01) << 3);
286        self.w
287    }
288}
289#[doc = "Possible values of the field `RXINV`"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum RXINV_A {
292    #[doc = "Receive data not inverted."]
293    _0,
294    #[doc = "Receive data inverted."]
295    _1,
296}
297impl crate::ToBits<bool> for RXINV_A {
298    #[inline(always)]
299    fn _bits(&self) -> bool {
300        match *self {
301            RXINV_A::_0 => false,
302            RXINV_A::_1 => true,
303        }
304    }
305}
306#[doc = "Reader of field `RXINV`"]
307pub type RXINV_R = crate::R<bool, RXINV_A>;
308impl RXINV_R {
309    #[doc = r"Get enumerated values variant"]
310    #[inline(always)]
311    pub fn variant(&self) -> RXINV_A {
312        match self.bits {
313            false => RXINV_A::_0,
314            true => RXINV_A::_1,
315        }
316    }
317    #[doc = "Checks if the value of the field is `_0`"]
318    #[inline(always)]
319    pub fn is_0(&self) -> bool {
320        *self == RXINV_A::_0
321    }
322    #[doc = "Checks if the value of the field is `_1`"]
323    #[inline(always)]
324    pub fn is_1(&self) -> bool {
325        *self == RXINV_A::_1
326    }
327}
328#[doc = "Write proxy for field `RXINV`"]
329pub struct RXINV_W<'a> {
330    w: &'a mut W,
331}
332impl<'a> RXINV_W<'a> {
333    #[doc = r"Writes `variant` to the field"]
334    #[inline(always)]
335    pub fn variant(self, variant: RXINV_A) -> &'a mut W {
336        use crate::ToBits;
337        {
338            self.bit(variant._bits())
339        }
340    }
341    #[doc = "Receive data not inverted."]
342    #[inline(always)]
343    pub fn _0(self) -> &'a mut W {
344        self.variant(RXINV_A::_0)
345    }
346    #[doc = "Receive data inverted."]
347    #[inline(always)]
348    pub fn _1(self) -> &'a mut W {
349        self.variant(RXINV_A::_1)
350    }
351    #[doc = r"Sets the field bit"]
352    #[inline(always)]
353    pub fn set_bit(self) -> &'a mut W {
354        self.bit(true)
355    }
356    #[doc = r"Clears the field bit"]
357    #[inline(always)]
358    pub fn clear_bit(self) -> &'a mut W {
359        self.bit(false)
360    }
361    #[doc = r"Writes raw bits to the field"]
362    #[inline(always)]
363    pub fn bit(self, value: bool) -> &'a mut W {
364        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
365        self.w
366    }
367}
368#[doc = "Possible values of the field `RXEDGIF`"]
369#[derive(Clone, Copy, Debug, PartialEq)]
370pub enum RXEDGIF_A {
371    #[doc = "No active edge on the receive pin has occurred."]
372    _0,
373    #[doc = "An active edge on the receive pin has occurred."]
374    _1,
375}
376impl crate::ToBits<bool> for RXEDGIF_A {
377    #[inline(always)]
378    fn _bits(&self) -> bool {
379        match *self {
380            RXEDGIF_A::_0 => false,
381            RXEDGIF_A::_1 => true,
382        }
383    }
384}
385#[doc = "Reader of field `RXEDGIF`"]
386pub type RXEDGIF_R = crate::R<bool, RXEDGIF_A>;
387impl RXEDGIF_R {
388    #[doc = r"Get enumerated values variant"]
389    #[inline(always)]
390    pub fn variant(&self) -> RXEDGIF_A {
391        match self.bits {
392            false => RXEDGIF_A::_0,
393            true => RXEDGIF_A::_1,
394        }
395    }
396    #[doc = "Checks if the value of the field is `_0`"]
397    #[inline(always)]
398    pub fn is_0(&self) -> bool {
399        *self == RXEDGIF_A::_0
400    }
401    #[doc = "Checks if the value of the field is `_1`"]
402    #[inline(always)]
403    pub fn is_1(&self) -> bool {
404        *self == RXEDGIF_A::_1
405    }
406}
407#[doc = "Write proxy for field `RXEDGIF`"]
408pub struct RXEDGIF_W<'a> {
409    w: &'a mut W,
410}
411impl<'a> RXEDGIF_W<'a> {
412    #[doc = r"Writes `variant` to the field"]
413    #[inline(always)]
414    pub fn variant(self, variant: RXEDGIF_A) -> &'a mut W {
415        use crate::ToBits;
416        {
417            self.bit(variant._bits())
418        }
419    }
420    #[doc = "No active edge on the receive pin has occurred."]
421    #[inline(always)]
422    pub fn _0(self) -> &'a mut W {
423        self.variant(RXEDGIF_A::_0)
424    }
425    #[doc = "An active edge on the receive pin has occurred."]
426    #[inline(always)]
427    pub fn _1(self) -> &'a mut W {
428        self.variant(RXEDGIF_A::_1)
429    }
430    #[doc = r"Sets the field bit"]
431    #[inline(always)]
432    pub fn set_bit(self) -> &'a mut W {
433        self.bit(true)
434    }
435    #[doc = r"Clears the field bit"]
436    #[inline(always)]
437    pub fn clear_bit(self) -> &'a mut W {
438        self.bit(false)
439    }
440    #[doc = r"Writes raw bits to the field"]
441    #[inline(always)]
442    pub fn bit(self, value: bool) -> &'a mut W {
443        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
444        self.w
445    }
446}
447#[doc = "Possible values of the field `LBKDIF`"]
448#[derive(Clone, Copy, Debug, PartialEq)]
449pub enum LBKDIF_A {
450    #[doc = "No LIN break character has been detected."]
451    _0,
452    #[doc = "LIN break character has been detected."]
453    _1,
454}
455impl crate::ToBits<bool> for LBKDIF_A {
456    #[inline(always)]
457    fn _bits(&self) -> bool {
458        match *self {
459            LBKDIF_A::_0 => false,
460            LBKDIF_A::_1 => true,
461        }
462    }
463}
464#[doc = "Reader of field `LBKDIF`"]
465pub type LBKDIF_R = crate::R<bool, LBKDIF_A>;
466impl LBKDIF_R {
467    #[doc = r"Get enumerated values variant"]
468    #[inline(always)]
469    pub fn variant(&self) -> LBKDIF_A {
470        match self.bits {
471            false => LBKDIF_A::_0,
472            true => LBKDIF_A::_1,
473        }
474    }
475    #[doc = "Checks if the value of the field is `_0`"]
476    #[inline(always)]
477    pub fn is_0(&self) -> bool {
478        *self == LBKDIF_A::_0
479    }
480    #[doc = "Checks if the value of the field is `_1`"]
481    #[inline(always)]
482    pub fn is_1(&self) -> bool {
483        *self == LBKDIF_A::_1
484    }
485}
486#[doc = "Write proxy for field `LBKDIF`"]
487pub struct LBKDIF_W<'a> {
488    w: &'a mut W,
489}
490impl<'a> LBKDIF_W<'a> {
491    #[doc = r"Writes `variant` to the field"]
492    #[inline(always)]
493    pub fn variant(self, variant: LBKDIF_A) -> &'a mut W {
494        use crate::ToBits;
495        {
496            self.bit(variant._bits())
497        }
498    }
499    #[doc = "No LIN break character has been detected."]
500    #[inline(always)]
501    pub fn _0(self) -> &'a mut W {
502        self.variant(LBKDIF_A::_0)
503    }
504    #[doc = "LIN break character has been detected."]
505    #[inline(always)]
506    pub fn _1(self) -> &'a mut W {
507        self.variant(LBKDIF_A::_1)
508    }
509    #[doc = r"Sets the field bit"]
510    #[inline(always)]
511    pub fn set_bit(self) -> &'a mut W {
512        self.bit(true)
513    }
514    #[doc = r"Clears the field bit"]
515    #[inline(always)]
516    pub fn clear_bit(self) -> &'a mut W {
517        self.bit(false)
518    }
519    #[doc = r"Writes raw bits to the field"]
520    #[inline(always)]
521    pub fn bit(self, value: bool) -> &'a mut W {
522        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
523        self.w
524    }
525}
526impl R {
527    #[doc = "Bit 0 - Receiver Active Flag"]
528    #[inline(always)]
529    pub fn raf(&self) -> RAF_R {
530        RAF_R::new((self.bits & 0x01) != 0)
531    }
532    #[doc = "Bit 1 - LIN Break Detection Enable"]
533    #[inline(always)]
534    pub fn lbkde(&self) -> LBKDE_R {
535        LBKDE_R::new(((self.bits >> 1) & 0x01) != 0)
536    }
537    #[doc = "Bit 2 - Break Character Generation Length"]
538    #[inline(always)]
539    pub fn brk13(&self) -> BRK13_R {
540        BRK13_R::new(((self.bits >> 2) & 0x01) != 0)
541    }
542    #[doc = "Bit 3 - Receive Wake Up Idle Detect"]
543    #[inline(always)]
544    pub fn rwuid(&self) -> RWUID_R {
545        RWUID_R::new(((self.bits >> 3) & 0x01) != 0)
546    }
547    #[doc = "Bit 4 - Receive Data Inversion"]
548    #[inline(always)]
549    pub fn rxinv(&self) -> RXINV_R {
550        RXINV_R::new(((self.bits >> 4) & 0x01) != 0)
551    }
552    #[doc = "Bit 6 - RxD Pin Active Edge Interrupt Flag"]
553    #[inline(always)]
554    pub fn rxedgif(&self) -> RXEDGIF_R {
555        RXEDGIF_R::new(((self.bits >> 6) & 0x01) != 0)
556    }
557    #[doc = "Bit 7 - LIN Break Detect Interrupt Flag"]
558    #[inline(always)]
559    pub fn lbkdif(&self) -> LBKDIF_R {
560        LBKDIF_R::new(((self.bits >> 7) & 0x01) != 0)
561    }
562}
563impl W {
564    #[doc = "Bit 1 - LIN Break Detection Enable"]
565    #[inline(always)]
566    pub fn lbkde(&mut self) -> LBKDE_W {
567        LBKDE_W { w: self }
568    }
569    #[doc = "Bit 2 - Break Character Generation Length"]
570    #[inline(always)]
571    pub fn brk13(&mut self) -> BRK13_W {
572        BRK13_W { w: self }
573    }
574    #[doc = "Bit 3 - Receive Wake Up Idle Detect"]
575    #[inline(always)]
576    pub fn rwuid(&mut self) -> RWUID_W {
577        RWUID_W { w: self }
578    }
579    #[doc = "Bit 4 - Receive Data Inversion"]
580    #[inline(always)]
581    pub fn rxinv(&mut self) -> RXINV_W {
582        RXINV_W { w: self }
583    }
584    #[doc = "Bit 6 - RxD Pin Active Edge Interrupt Flag"]
585    #[inline(always)]
586    pub fn rxedgif(&mut self) -> RXEDGIF_W {
587        RXEDGIF_W { w: self }
588    }
589    #[doc = "Bit 7 - LIN Break Detect Interrupt Flag"]
590    #[inline(always)]
591    pub fn lbkdif(&mut self) -> LBKDIF_W {
592        LBKDIF_W { w: self }
593    }
594}