s32k142_pac/lpuart0/
baud.rs

1#[doc = "Register `BAUD` reader"]
2pub struct R(crate::R<BAUD_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<BAUD_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<BAUD_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<BAUD_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `BAUD` writer"]
17pub struct W(crate::W<BAUD_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<BAUD_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<BAUD_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<BAUD_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SBR` reader - Baud Rate Modulo Divisor."]
38pub struct SBR_R(crate::FieldReader<u16, u16>);
39impl SBR_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        SBR_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for SBR_R {
46    type Target = crate::FieldReader<u16, u16>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `SBR` writer - Baud Rate Modulo Divisor."]
53pub struct SBR_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> SBR_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u16) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x1fff) | (value as u32 & 0x1fff);
61        self.w
62    }
63}
64#[doc = "Stop Bit Number Select\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq)]
66pub enum SBNS_A {
67    #[doc = "0: One stop bit."]
68    _0 = 0,
69    #[doc = "1: Two stop bits."]
70    _1 = 1,
71}
72impl From<SBNS_A> for bool {
73    #[inline(always)]
74    fn from(variant: SBNS_A) -> Self {
75        variant as u8 != 0
76    }
77}
78#[doc = "Field `SBNS` reader - Stop Bit Number Select"]
79pub struct SBNS_R(crate::FieldReader<bool, SBNS_A>);
80impl SBNS_R {
81    #[inline(always)]
82    pub(crate) fn new(bits: bool) -> Self {
83        SBNS_R(crate::FieldReader::new(bits))
84    }
85    #[doc = r"Get enumerated values variant"]
86    #[inline(always)]
87    pub fn variant(&self) -> SBNS_A {
88        match self.bits {
89            false => SBNS_A::_0,
90            true => SBNS_A::_1,
91        }
92    }
93    #[doc = "Checks if the value of the field is `_0`"]
94    #[inline(always)]
95    pub fn is_0(&self) -> bool {
96        **self == SBNS_A::_0
97    }
98    #[doc = "Checks if the value of the field is `_1`"]
99    #[inline(always)]
100    pub fn is_1(&self) -> bool {
101        **self == SBNS_A::_1
102    }
103}
104impl core::ops::Deref for SBNS_R {
105    type Target = crate::FieldReader<bool, SBNS_A>;
106    #[inline(always)]
107    fn deref(&self) -> &Self::Target {
108        &self.0
109    }
110}
111#[doc = "Field `SBNS` writer - Stop Bit Number Select"]
112pub struct SBNS_W<'a> {
113    w: &'a mut W,
114}
115impl<'a> SBNS_W<'a> {
116    #[doc = r"Writes `variant` to the field"]
117    #[inline(always)]
118    pub fn variant(self, variant: SBNS_A) -> &'a mut W {
119        self.bit(variant.into())
120    }
121    #[doc = "One stop bit."]
122    #[inline(always)]
123    pub fn _0(self) -> &'a mut W {
124        self.variant(SBNS_A::_0)
125    }
126    #[doc = "Two stop bits."]
127    #[inline(always)]
128    pub fn _1(self) -> &'a mut W {
129        self.variant(SBNS_A::_1)
130    }
131    #[doc = r"Sets the field bit"]
132    #[inline(always)]
133    pub fn set_bit(self) -> &'a mut W {
134        self.bit(true)
135    }
136    #[doc = r"Clears the field bit"]
137    #[inline(always)]
138    pub fn clear_bit(self) -> &'a mut W {
139        self.bit(false)
140    }
141    #[doc = r"Writes raw bits to the field"]
142    #[inline(always)]
143    pub fn bit(self, value: bool) -> &'a mut W {
144        self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
145        self.w
146    }
147}
148#[doc = "RX Input Active Edge Interrupt Enable\n\nValue on reset: 0"]
149#[derive(Clone, Copy, Debug, PartialEq)]
150pub enum RXEDGIE_A {
151    #[doc = "0: Hardware interrupts from LPUART_STAT\\[RXEDGIF\\]
152disabled."]
153    _0 = 0,
154    #[doc = "1: Hardware interrupt requested when LPUART_STAT\\[RXEDGIF\\]
155flag is 1."]
156    _1 = 1,
157}
158impl From<RXEDGIE_A> for bool {
159    #[inline(always)]
160    fn from(variant: RXEDGIE_A) -> Self {
161        variant as u8 != 0
162    }
163}
164#[doc = "Field `RXEDGIE` reader - RX Input Active Edge Interrupt Enable"]
165pub struct RXEDGIE_R(crate::FieldReader<bool, RXEDGIE_A>);
166impl RXEDGIE_R {
167    #[inline(always)]
168    pub(crate) fn new(bits: bool) -> Self {
169        RXEDGIE_R(crate::FieldReader::new(bits))
170    }
171    #[doc = r"Get enumerated values variant"]
172    #[inline(always)]
173    pub fn variant(&self) -> RXEDGIE_A {
174        match self.bits {
175            false => RXEDGIE_A::_0,
176            true => RXEDGIE_A::_1,
177        }
178    }
179    #[doc = "Checks if the value of the field is `_0`"]
180    #[inline(always)]
181    pub fn is_0(&self) -> bool {
182        **self == RXEDGIE_A::_0
183    }
184    #[doc = "Checks if the value of the field is `_1`"]
185    #[inline(always)]
186    pub fn is_1(&self) -> bool {
187        **self == RXEDGIE_A::_1
188    }
189}
190impl core::ops::Deref for RXEDGIE_R {
191    type Target = crate::FieldReader<bool, RXEDGIE_A>;
192    #[inline(always)]
193    fn deref(&self) -> &Self::Target {
194        &self.0
195    }
196}
197#[doc = "Field `RXEDGIE` writer - RX Input Active Edge Interrupt Enable"]
198pub struct RXEDGIE_W<'a> {
199    w: &'a mut W,
200}
201impl<'a> RXEDGIE_W<'a> {
202    #[doc = r"Writes `variant` to the field"]
203    #[inline(always)]
204    pub fn variant(self, variant: RXEDGIE_A) -> &'a mut W {
205        self.bit(variant.into())
206    }
207    #[doc = "Hardware interrupts from LPUART_STAT\\[RXEDGIF\\]
208disabled."]
209    #[inline(always)]
210    pub fn _0(self) -> &'a mut W {
211        self.variant(RXEDGIE_A::_0)
212    }
213    #[doc = "Hardware interrupt requested when LPUART_STAT\\[RXEDGIF\\]
214flag is 1."]
215    #[inline(always)]
216    pub fn _1(self) -> &'a mut W {
217        self.variant(RXEDGIE_A::_1)
218    }
219    #[doc = r"Sets the field bit"]
220    #[inline(always)]
221    pub fn set_bit(self) -> &'a mut W {
222        self.bit(true)
223    }
224    #[doc = r"Clears the field bit"]
225    #[inline(always)]
226    pub fn clear_bit(self) -> &'a mut W {
227        self.bit(false)
228    }
229    #[doc = r"Writes raw bits to the field"]
230    #[inline(always)]
231    pub fn bit(self, value: bool) -> &'a mut W {
232        self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
233        self.w
234    }
235}
236#[doc = "LIN Break Detect Interrupt Enable\n\nValue on reset: 0"]
237#[derive(Clone, Copy, Debug, PartialEq)]
238pub enum LBKDIE_A {
239    #[doc = "0: Hardware interrupts from LPUART_STAT\\[LBKDIF\\]
240disabled (use polling)."]
241    _0 = 0,
242    #[doc = "1: Hardware interrupt requested when LPUART_STAT\\[LBKDIF\\]
243flag is 1."]
244    _1 = 1,
245}
246impl From<LBKDIE_A> for bool {
247    #[inline(always)]
248    fn from(variant: LBKDIE_A) -> Self {
249        variant as u8 != 0
250    }
251}
252#[doc = "Field `LBKDIE` reader - LIN Break Detect Interrupt Enable"]
253pub struct LBKDIE_R(crate::FieldReader<bool, LBKDIE_A>);
254impl LBKDIE_R {
255    #[inline(always)]
256    pub(crate) fn new(bits: bool) -> Self {
257        LBKDIE_R(crate::FieldReader::new(bits))
258    }
259    #[doc = r"Get enumerated values variant"]
260    #[inline(always)]
261    pub fn variant(&self) -> LBKDIE_A {
262        match self.bits {
263            false => LBKDIE_A::_0,
264            true => LBKDIE_A::_1,
265        }
266    }
267    #[doc = "Checks if the value of the field is `_0`"]
268    #[inline(always)]
269    pub fn is_0(&self) -> bool {
270        **self == LBKDIE_A::_0
271    }
272    #[doc = "Checks if the value of the field is `_1`"]
273    #[inline(always)]
274    pub fn is_1(&self) -> bool {
275        **self == LBKDIE_A::_1
276    }
277}
278impl core::ops::Deref for LBKDIE_R {
279    type Target = crate::FieldReader<bool, LBKDIE_A>;
280    #[inline(always)]
281    fn deref(&self) -> &Self::Target {
282        &self.0
283    }
284}
285#[doc = "Field `LBKDIE` writer - LIN Break Detect Interrupt Enable"]
286pub struct LBKDIE_W<'a> {
287    w: &'a mut W,
288}
289impl<'a> LBKDIE_W<'a> {
290    #[doc = r"Writes `variant` to the field"]
291    #[inline(always)]
292    pub fn variant(self, variant: LBKDIE_A) -> &'a mut W {
293        self.bit(variant.into())
294    }
295    #[doc = "Hardware interrupts from LPUART_STAT\\[LBKDIF\\]
296disabled (use polling)."]
297    #[inline(always)]
298    pub fn _0(self) -> &'a mut W {
299        self.variant(LBKDIE_A::_0)
300    }
301    #[doc = "Hardware interrupt requested when LPUART_STAT\\[LBKDIF\\]
302flag is 1."]
303    #[inline(always)]
304    pub fn _1(self) -> &'a mut W {
305        self.variant(LBKDIE_A::_1)
306    }
307    #[doc = r"Sets the field bit"]
308    #[inline(always)]
309    pub fn set_bit(self) -> &'a mut W {
310        self.bit(true)
311    }
312    #[doc = r"Clears the field bit"]
313    #[inline(always)]
314    pub fn clear_bit(self) -> &'a mut W {
315        self.bit(false)
316    }
317    #[doc = r"Writes raw bits to the field"]
318    #[inline(always)]
319    pub fn bit(self, value: bool) -> &'a mut W {
320        self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
321        self.w
322    }
323}
324#[doc = "Resynchronization Disable\n\nValue on reset: 0"]
325#[derive(Clone, Copy, Debug, PartialEq)]
326pub enum RESYNCDIS_A {
327    #[doc = "0: Resynchronization during received data word is supported"]
328    _0 = 0,
329    #[doc = "1: Resynchronization during received data word is disabled"]
330    _1 = 1,
331}
332impl From<RESYNCDIS_A> for bool {
333    #[inline(always)]
334    fn from(variant: RESYNCDIS_A) -> Self {
335        variant as u8 != 0
336    }
337}
338#[doc = "Field `RESYNCDIS` reader - Resynchronization Disable"]
339pub struct RESYNCDIS_R(crate::FieldReader<bool, RESYNCDIS_A>);
340impl RESYNCDIS_R {
341    #[inline(always)]
342    pub(crate) fn new(bits: bool) -> Self {
343        RESYNCDIS_R(crate::FieldReader::new(bits))
344    }
345    #[doc = r"Get enumerated values variant"]
346    #[inline(always)]
347    pub fn variant(&self) -> RESYNCDIS_A {
348        match self.bits {
349            false => RESYNCDIS_A::_0,
350            true => RESYNCDIS_A::_1,
351        }
352    }
353    #[doc = "Checks if the value of the field is `_0`"]
354    #[inline(always)]
355    pub fn is_0(&self) -> bool {
356        **self == RESYNCDIS_A::_0
357    }
358    #[doc = "Checks if the value of the field is `_1`"]
359    #[inline(always)]
360    pub fn is_1(&self) -> bool {
361        **self == RESYNCDIS_A::_1
362    }
363}
364impl core::ops::Deref for RESYNCDIS_R {
365    type Target = crate::FieldReader<bool, RESYNCDIS_A>;
366    #[inline(always)]
367    fn deref(&self) -> &Self::Target {
368        &self.0
369    }
370}
371#[doc = "Field `RESYNCDIS` writer - Resynchronization Disable"]
372pub struct RESYNCDIS_W<'a> {
373    w: &'a mut W,
374}
375impl<'a> RESYNCDIS_W<'a> {
376    #[doc = r"Writes `variant` to the field"]
377    #[inline(always)]
378    pub fn variant(self, variant: RESYNCDIS_A) -> &'a mut W {
379        self.bit(variant.into())
380    }
381    #[doc = "Resynchronization during received data word is supported"]
382    #[inline(always)]
383    pub fn _0(self) -> &'a mut W {
384        self.variant(RESYNCDIS_A::_0)
385    }
386    #[doc = "Resynchronization during received data word is disabled"]
387    #[inline(always)]
388    pub fn _1(self) -> &'a mut W {
389        self.variant(RESYNCDIS_A::_1)
390    }
391    #[doc = r"Sets the field bit"]
392    #[inline(always)]
393    pub fn set_bit(self) -> &'a mut W {
394        self.bit(true)
395    }
396    #[doc = r"Clears the field bit"]
397    #[inline(always)]
398    pub fn clear_bit(self) -> &'a mut W {
399        self.bit(false)
400    }
401    #[doc = r"Writes raw bits to the field"]
402    #[inline(always)]
403    pub fn bit(self, value: bool) -> &'a mut W {
404        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
405        self.w
406    }
407}
408#[doc = "Both Edge Sampling\n\nValue on reset: 0"]
409#[derive(Clone, Copy, Debug, PartialEq)]
410pub enum BOTHEDGE_A {
411    #[doc = "0: Receiver samples input data using the rising edge of the baud rate clock."]
412    _0 = 0,
413    #[doc = "1: Receiver samples input data using the rising and falling edge of the baud rate clock."]
414    _1 = 1,
415}
416impl From<BOTHEDGE_A> for bool {
417    #[inline(always)]
418    fn from(variant: BOTHEDGE_A) -> Self {
419        variant as u8 != 0
420    }
421}
422#[doc = "Field `BOTHEDGE` reader - Both Edge Sampling"]
423pub struct BOTHEDGE_R(crate::FieldReader<bool, BOTHEDGE_A>);
424impl BOTHEDGE_R {
425    #[inline(always)]
426    pub(crate) fn new(bits: bool) -> Self {
427        BOTHEDGE_R(crate::FieldReader::new(bits))
428    }
429    #[doc = r"Get enumerated values variant"]
430    #[inline(always)]
431    pub fn variant(&self) -> BOTHEDGE_A {
432        match self.bits {
433            false => BOTHEDGE_A::_0,
434            true => BOTHEDGE_A::_1,
435        }
436    }
437    #[doc = "Checks if the value of the field is `_0`"]
438    #[inline(always)]
439    pub fn is_0(&self) -> bool {
440        **self == BOTHEDGE_A::_0
441    }
442    #[doc = "Checks if the value of the field is `_1`"]
443    #[inline(always)]
444    pub fn is_1(&self) -> bool {
445        **self == BOTHEDGE_A::_1
446    }
447}
448impl core::ops::Deref for BOTHEDGE_R {
449    type Target = crate::FieldReader<bool, BOTHEDGE_A>;
450    #[inline(always)]
451    fn deref(&self) -> &Self::Target {
452        &self.0
453    }
454}
455#[doc = "Field `BOTHEDGE` writer - Both Edge Sampling"]
456pub struct BOTHEDGE_W<'a> {
457    w: &'a mut W,
458}
459impl<'a> BOTHEDGE_W<'a> {
460    #[doc = r"Writes `variant` to the field"]
461    #[inline(always)]
462    pub fn variant(self, variant: BOTHEDGE_A) -> &'a mut W {
463        self.bit(variant.into())
464    }
465    #[doc = "Receiver samples input data using the rising edge of the baud rate clock."]
466    #[inline(always)]
467    pub fn _0(self) -> &'a mut W {
468        self.variant(BOTHEDGE_A::_0)
469    }
470    #[doc = "Receiver samples input data using the rising and falling edge of the baud rate clock."]
471    #[inline(always)]
472    pub fn _1(self) -> &'a mut W {
473        self.variant(BOTHEDGE_A::_1)
474    }
475    #[doc = r"Sets the field bit"]
476    #[inline(always)]
477    pub fn set_bit(self) -> &'a mut W {
478        self.bit(true)
479    }
480    #[doc = r"Clears the field bit"]
481    #[inline(always)]
482    pub fn clear_bit(self) -> &'a mut W {
483        self.bit(false)
484    }
485    #[doc = r"Writes raw bits to the field"]
486    #[inline(always)]
487    pub fn bit(self, value: bool) -> &'a mut W {
488        self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
489        self.w
490    }
491}
492#[doc = "Match Configuration\n\nValue on reset: 0"]
493#[derive(Clone, Copy, Debug, PartialEq)]
494#[repr(u8)]
495pub enum MATCFG_A {
496    #[doc = "0: Address Match Wakeup"]
497    _00 = 0,
498    #[doc = "1: Idle Match Wakeup"]
499    _01 = 1,
500    #[doc = "2: Match On and Match Off"]
501    _10 = 2,
502}
503impl From<MATCFG_A> for u8 {
504    #[inline(always)]
505    fn from(variant: MATCFG_A) -> Self {
506        variant as _
507    }
508}
509#[doc = "Field `MATCFG` reader - Match Configuration"]
510pub struct MATCFG_R(crate::FieldReader<u8, MATCFG_A>);
511impl MATCFG_R {
512    #[inline(always)]
513    pub(crate) fn new(bits: u8) -> Self {
514        MATCFG_R(crate::FieldReader::new(bits))
515    }
516    #[doc = r"Get enumerated values variant"]
517    #[inline(always)]
518    pub fn variant(&self) -> Option<MATCFG_A> {
519        match self.bits {
520            0 => Some(MATCFG_A::_00),
521            1 => Some(MATCFG_A::_01),
522            2 => Some(MATCFG_A::_10),
523            _ => None,
524        }
525    }
526    #[doc = "Checks if the value of the field is `_00`"]
527    #[inline(always)]
528    pub fn is_00(&self) -> bool {
529        **self == MATCFG_A::_00
530    }
531    #[doc = "Checks if the value of the field is `_01`"]
532    #[inline(always)]
533    pub fn is_01(&self) -> bool {
534        **self == MATCFG_A::_01
535    }
536    #[doc = "Checks if the value of the field is `_10`"]
537    #[inline(always)]
538    pub fn is_10(&self) -> bool {
539        **self == MATCFG_A::_10
540    }
541}
542impl core::ops::Deref for MATCFG_R {
543    type Target = crate::FieldReader<u8, MATCFG_A>;
544    #[inline(always)]
545    fn deref(&self) -> &Self::Target {
546        &self.0
547    }
548}
549#[doc = "Field `MATCFG` writer - Match Configuration"]
550pub struct MATCFG_W<'a> {
551    w: &'a mut W,
552}
553impl<'a> MATCFG_W<'a> {
554    #[doc = r"Writes `variant` to the field"]
555    #[inline(always)]
556    pub fn variant(self, variant: MATCFG_A) -> &'a mut W {
557        unsafe { self.bits(variant.into()) }
558    }
559    #[doc = "Address Match Wakeup"]
560    #[inline(always)]
561    pub fn _00(self) -> &'a mut W {
562        self.variant(MATCFG_A::_00)
563    }
564    #[doc = "Idle Match Wakeup"]
565    #[inline(always)]
566    pub fn _01(self) -> &'a mut W {
567        self.variant(MATCFG_A::_01)
568    }
569    #[doc = "Match On and Match Off"]
570    #[inline(always)]
571    pub fn _10(self) -> &'a mut W {
572        self.variant(MATCFG_A::_10)
573    }
574    #[doc = r"Writes raw bits to the field"]
575    #[inline(always)]
576    pub unsafe fn bits(self, value: u8) -> &'a mut W {
577        self.w.bits = (self.w.bits & !(0x03 << 18)) | ((value as u32 & 0x03) << 18);
578        self.w
579    }
580}
581#[doc = "Receiver Idle DMA Enable\n\nValue on reset: 0"]
582#[derive(Clone, Copy, Debug, PartialEq)]
583pub enum RIDMAE_A {
584    #[doc = "0: DMA request disabled."]
585    _0 = 0,
586    #[doc = "1: DMA request enabled."]
587    _1 = 1,
588}
589impl From<RIDMAE_A> for bool {
590    #[inline(always)]
591    fn from(variant: RIDMAE_A) -> Self {
592        variant as u8 != 0
593    }
594}
595#[doc = "Field `RIDMAE` reader - Receiver Idle DMA Enable"]
596pub struct RIDMAE_R(crate::FieldReader<bool, RIDMAE_A>);
597impl RIDMAE_R {
598    #[inline(always)]
599    pub(crate) fn new(bits: bool) -> Self {
600        RIDMAE_R(crate::FieldReader::new(bits))
601    }
602    #[doc = r"Get enumerated values variant"]
603    #[inline(always)]
604    pub fn variant(&self) -> RIDMAE_A {
605        match self.bits {
606            false => RIDMAE_A::_0,
607            true => RIDMAE_A::_1,
608        }
609    }
610    #[doc = "Checks if the value of the field is `_0`"]
611    #[inline(always)]
612    pub fn is_0(&self) -> bool {
613        **self == RIDMAE_A::_0
614    }
615    #[doc = "Checks if the value of the field is `_1`"]
616    #[inline(always)]
617    pub fn is_1(&self) -> bool {
618        **self == RIDMAE_A::_1
619    }
620}
621impl core::ops::Deref for RIDMAE_R {
622    type Target = crate::FieldReader<bool, RIDMAE_A>;
623    #[inline(always)]
624    fn deref(&self) -> &Self::Target {
625        &self.0
626    }
627}
628#[doc = "Field `RIDMAE` writer - Receiver Idle DMA Enable"]
629pub struct RIDMAE_W<'a> {
630    w: &'a mut W,
631}
632impl<'a> RIDMAE_W<'a> {
633    #[doc = r"Writes `variant` to the field"]
634    #[inline(always)]
635    pub fn variant(self, variant: RIDMAE_A) -> &'a mut W {
636        self.bit(variant.into())
637    }
638    #[doc = "DMA request disabled."]
639    #[inline(always)]
640    pub fn _0(self) -> &'a mut W {
641        self.variant(RIDMAE_A::_0)
642    }
643    #[doc = "DMA request enabled."]
644    #[inline(always)]
645    pub fn _1(self) -> &'a mut W {
646        self.variant(RIDMAE_A::_1)
647    }
648    #[doc = r"Sets the field bit"]
649    #[inline(always)]
650    pub fn set_bit(self) -> &'a mut W {
651        self.bit(true)
652    }
653    #[doc = r"Clears the field bit"]
654    #[inline(always)]
655    pub fn clear_bit(self) -> &'a mut W {
656        self.bit(false)
657    }
658    #[doc = r"Writes raw bits to the field"]
659    #[inline(always)]
660    pub fn bit(self, value: bool) -> &'a mut W {
661        self.w.bits = (self.w.bits & !(0x01 << 20)) | ((value as u32 & 0x01) << 20);
662        self.w
663    }
664}
665#[doc = "Receiver Full DMA Enable\n\nValue on reset: 0"]
666#[derive(Clone, Copy, Debug, PartialEq)]
667pub enum RDMAE_A {
668    #[doc = "0: DMA request disabled."]
669    _0 = 0,
670    #[doc = "1: DMA request enabled."]
671    _1 = 1,
672}
673impl From<RDMAE_A> for bool {
674    #[inline(always)]
675    fn from(variant: RDMAE_A) -> Self {
676        variant as u8 != 0
677    }
678}
679#[doc = "Field `RDMAE` reader - Receiver Full DMA Enable"]
680pub struct RDMAE_R(crate::FieldReader<bool, RDMAE_A>);
681impl RDMAE_R {
682    #[inline(always)]
683    pub(crate) fn new(bits: bool) -> Self {
684        RDMAE_R(crate::FieldReader::new(bits))
685    }
686    #[doc = r"Get enumerated values variant"]
687    #[inline(always)]
688    pub fn variant(&self) -> RDMAE_A {
689        match self.bits {
690            false => RDMAE_A::_0,
691            true => RDMAE_A::_1,
692        }
693    }
694    #[doc = "Checks if the value of the field is `_0`"]
695    #[inline(always)]
696    pub fn is_0(&self) -> bool {
697        **self == RDMAE_A::_0
698    }
699    #[doc = "Checks if the value of the field is `_1`"]
700    #[inline(always)]
701    pub fn is_1(&self) -> bool {
702        **self == RDMAE_A::_1
703    }
704}
705impl core::ops::Deref for RDMAE_R {
706    type Target = crate::FieldReader<bool, RDMAE_A>;
707    #[inline(always)]
708    fn deref(&self) -> &Self::Target {
709        &self.0
710    }
711}
712#[doc = "Field `RDMAE` writer - Receiver Full DMA Enable"]
713pub struct RDMAE_W<'a> {
714    w: &'a mut W,
715}
716impl<'a> RDMAE_W<'a> {
717    #[doc = r"Writes `variant` to the field"]
718    #[inline(always)]
719    pub fn variant(self, variant: RDMAE_A) -> &'a mut W {
720        self.bit(variant.into())
721    }
722    #[doc = "DMA request disabled."]
723    #[inline(always)]
724    pub fn _0(self) -> &'a mut W {
725        self.variant(RDMAE_A::_0)
726    }
727    #[doc = "DMA request enabled."]
728    #[inline(always)]
729    pub fn _1(self) -> &'a mut W {
730        self.variant(RDMAE_A::_1)
731    }
732    #[doc = r"Sets the field bit"]
733    #[inline(always)]
734    pub fn set_bit(self) -> &'a mut W {
735        self.bit(true)
736    }
737    #[doc = r"Clears the field bit"]
738    #[inline(always)]
739    pub fn clear_bit(self) -> &'a mut W {
740        self.bit(false)
741    }
742    #[doc = r"Writes raw bits to the field"]
743    #[inline(always)]
744    pub fn bit(self, value: bool) -> &'a mut W {
745        self.w.bits = (self.w.bits & !(0x01 << 21)) | ((value as u32 & 0x01) << 21);
746        self.w
747    }
748}
749#[doc = "Transmitter DMA Enable\n\nValue on reset: 0"]
750#[derive(Clone, Copy, Debug, PartialEq)]
751pub enum TDMAE_A {
752    #[doc = "0: DMA request disabled."]
753    _0 = 0,
754    #[doc = "1: DMA request enabled."]
755    _1 = 1,
756}
757impl From<TDMAE_A> for bool {
758    #[inline(always)]
759    fn from(variant: TDMAE_A) -> Self {
760        variant as u8 != 0
761    }
762}
763#[doc = "Field `TDMAE` reader - Transmitter DMA Enable"]
764pub struct TDMAE_R(crate::FieldReader<bool, TDMAE_A>);
765impl TDMAE_R {
766    #[inline(always)]
767    pub(crate) fn new(bits: bool) -> Self {
768        TDMAE_R(crate::FieldReader::new(bits))
769    }
770    #[doc = r"Get enumerated values variant"]
771    #[inline(always)]
772    pub fn variant(&self) -> TDMAE_A {
773        match self.bits {
774            false => TDMAE_A::_0,
775            true => TDMAE_A::_1,
776        }
777    }
778    #[doc = "Checks if the value of the field is `_0`"]
779    #[inline(always)]
780    pub fn is_0(&self) -> bool {
781        **self == TDMAE_A::_0
782    }
783    #[doc = "Checks if the value of the field is `_1`"]
784    #[inline(always)]
785    pub fn is_1(&self) -> bool {
786        **self == TDMAE_A::_1
787    }
788}
789impl core::ops::Deref for TDMAE_R {
790    type Target = crate::FieldReader<bool, TDMAE_A>;
791    #[inline(always)]
792    fn deref(&self) -> &Self::Target {
793        &self.0
794    }
795}
796#[doc = "Field `TDMAE` writer - Transmitter DMA Enable"]
797pub struct TDMAE_W<'a> {
798    w: &'a mut W,
799}
800impl<'a> TDMAE_W<'a> {
801    #[doc = r"Writes `variant` to the field"]
802    #[inline(always)]
803    pub fn variant(self, variant: TDMAE_A) -> &'a mut W {
804        self.bit(variant.into())
805    }
806    #[doc = "DMA request disabled."]
807    #[inline(always)]
808    pub fn _0(self) -> &'a mut W {
809        self.variant(TDMAE_A::_0)
810    }
811    #[doc = "DMA request enabled."]
812    #[inline(always)]
813    pub fn _1(self) -> &'a mut W {
814        self.variant(TDMAE_A::_1)
815    }
816    #[doc = r"Sets the field bit"]
817    #[inline(always)]
818    pub fn set_bit(self) -> &'a mut W {
819        self.bit(true)
820    }
821    #[doc = r"Clears the field bit"]
822    #[inline(always)]
823    pub fn clear_bit(self) -> &'a mut W {
824        self.bit(false)
825    }
826    #[doc = r"Writes raw bits to the field"]
827    #[inline(always)]
828    pub fn bit(self, value: bool) -> &'a mut W {
829        self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
830        self.w
831    }
832}
833#[doc = "Oversampling Ratio\n\nValue on reset: 15"]
834#[derive(Clone, Copy, Debug, PartialEq)]
835#[repr(u8)]
836pub enum OSR_A {
837    #[doc = "0: Writing 0 to this field will result in an oversampling ratio of 16"]
838    _00000 = 0,
839    #[doc = "3: Oversampling ratio of 4, requires BOTHEDGE to be set."]
840    _00011 = 3,
841    #[doc = "4: Oversampling ratio of 5, requires BOTHEDGE to be set."]
842    _00100 = 4,
843    #[doc = "5: Oversampling ratio of 6, requires BOTHEDGE to be set."]
844    _00101 = 5,
845    #[doc = "6: Oversampling ratio of 7, requires BOTHEDGE to be set."]
846    _00110 = 6,
847    #[doc = "7: Oversampling ratio of 8."]
848    _00111 = 7,
849    #[doc = "8: Oversampling ratio of 9."]
850    _01000 = 8,
851    #[doc = "9: Oversampling ratio of 10."]
852    _01001 = 9,
853    #[doc = "10: Oversampling ratio of 11."]
854    _01010 = 10,
855    #[doc = "11: Oversampling ratio of 12."]
856    _01011 = 11,
857    #[doc = "12: Oversampling ratio of 13."]
858    _01100 = 12,
859    #[doc = "13: Oversampling ratio of 14."]
860    _01101 = 13,
861    #[doc = "14: Oversampling ratio of 15."]
862    _01110 = 14,
863    #[doc = "15: Oversampling ratio of 16."]
864    _01111 = 15,
865    #[doc = "16: Oversampling ratio of 17."]
866    _10000 = 16,
867    #[doc = "17: Oversampling ratio of 18."]
868    _10001 = 17,
869    #[doc = "18: Oversampling ratio of 19."]
870    _10010 = 18,
871    #[doc = "19: Oversampling ratio of 20."]
872    _10011 = 19,
873    #[doc = "20: Oversampling ratio of 21."]
874    _10100 = 20,
875    #[doc = "21: Oversampling ratio of 22."]
876    _10101 = 21,
877    #[doc = "22: Oversampling ratio of 23."]
878    _10110 = 22,
879    #[doc = "23: Oversampling ratio of 24."]
880    _10111 = 23,
881    #[doc = "24: Oversampling ratio of 25."]
882    _11000 = 24,
883    #[doc = "25: Oversampling ratio of 26."]
884    _11001 = 25,
885    #[doc = "26: Oversampling ratio of 27."]
886    _11010 = 26,
887    #[doc = "27: Oversampling ratio of 28."]
888    _11011 = 27,
889    #[doc = "28: Oversampling ratio of 29."]
890    _11100 = 28,
891    #[doc = "29: Oversampling ratio of 30."]
892    _11101 = 29,
893    #[doc = "30: Oversampling ratio of 31."]
894    _11110 = 30,
895    #[doc = "31: Oversampling ratio of 32."]
896    _11111 = 31,
897}
898impl From<OSR_A> for u8 {
899    #[inline(always)]
900    fn from(variant: OSR_A) -> Self {
901        variant as _
902    }
903}
904#[doc = "Field `OSR` reader - Oversampling Ratio"]
905pub struct OSR_R(crate::FieldReader<u8, OSR_A>);
906impl OSR_R {
907    #[inline(always)]
908    pub(crate) fn new(bits: u8) -> Self {
909        OSR_R(crate::FieldReader::new(bits))
910    }
911    #[doc = r"Get enumerated values variant"]
912    #[inline(always)]
913    pub fn variant(&self) -> Option<OSR_A> {
914        match self.bits {
915            0 => Some(OSR_A::_00000),
916            3 => Some(OSR_A::_00011),
917            4 => Some(OSR_A::_00100),
918            5 => Some(OSR_A::_00101),
919            6 => Some(OSR_A::_00110),
920            7 => Some(OSR_A::_00111),
921            8 => Some(OSR_A::_01000),
922            9 => Some(OSR_A::_01001),
923            10 => Some(OSR_A::_01010),
924            11 => Some(OSR_A::_01011),
925            12 => Some(OSR_A::_01100),
926            13 => Some(OSR_A::_01101),
927            14 => Some(OSR_A::_01110),
928            15 => Some(OSR_A::_01111),
929            16 => Some(OSR_A::_10000),
930            17 => Some(OSR_A::_10001),
931            18 => Some(OSR_A::_10010),
932            19 => Some(OSR_A::_10011),
933            20 => Some(OSR_A::_10100),
934            21 => Some(OSR_A::_10101),
935            22 => Some(OSR_A::_10110),
936            23 => Some(OSR_A::_10111),
937            24 => Some(OSR_A::_11000),
938            25 => Some(OSR_A::_11001),
939            26 => Some(OSR_A::_11010),
940            27 => Some(OSR_A::_11011),
941            28 => Some(OSR_A::_11100),
942            29 => Some(OSR_A::_11101),
943            30 => Some(OSR_A::_11110),
944            31 => Some(OSR_A::_11111),
945            _ => None,
946        }
947    }
948    #[doc = "Checks if the value of the field is `_00000`"]
949    #[inline(always)]
950    pub fn is_00000(&self) -> bool {
951        **self == OSR_A::_00000
952    }
953    #[doc = "Checks if the value of the field is `_00011`"]
954    #[inline(always)]
955    pub fn is_00011(&self) -> bool {
956        **self == OSR_A::_00011
957    }
958    #[doc = "Checks if the value of the field is `_00100`"]
959    #[inline(always)]
960    pub fn is_00100(&self) -> bool {
961        **self == OSR_A::_00100
962    }
963    #[doc = "Checks if the value of the field is `_00101`"]
964    #[inline(always)]
965    pub fn is_00101(&self) -> bool {
966        **self == OSR_A::_00101
967    }
968    #[doc = "Checks if the value of the field is `_00110`"]
969    #[inline(always)]
970    pub fn is_00110(&self) -> bool {
971        **self == OSR_A::_00110
972    }
973    #[doc = "Checks if the value of the field is `_00111`"]
974    #[inline(always)]
975    pub fn is_00111(&self) -> bool {
976        **self == OSR_A::_00111
977    }
978    #[doc = "Checks if the value of the field is `_01000`"]
979    #[inline(always)]
980    pub fn is_01000(&self) -> bool {
981        **self == OSR_A::_01000
982    }
983    #[doc = "Checks if the value of the field is `_01001`"]
984    #[inline(always)]
985    pub fn is_01001(&self) -> bool {
986        **self == OSR_A::_01001
987    }
988    #[doc = "Checks if the value of the field is `_01010`"]
989    #[inline(always)]
990    pub fn is_01010(&self) -> bool {
991        **self == OSR_A::_01010
992    }
993    #[doc = "Checks if the value of the field is `_01011`"]
994    #[inline(always)]
995    pub fn is_01011(&self) -> bool {
996        **self == OSR_A::_01011
997    }
998    #[doc = "Checks if the value of the field is `_01100`"]
999    #[inline(always)]
1000    pub fn is_01100(&self) -> bool {
1001        **self == OSR_A::_01100
1002    }
1003    #[doc = "Checks if the value of the field is `_01101`"]
1004    #[inline(always)]
1005    pub fn is_01101(&self) -> bool {
1006        **self == OSR_A::_01101
1007    }
1008    #[doc = "Checks if the value of the field is `_01110`"]
1009    #[inline(always)]
1010    pub fn is_01110(&self) -> bool {
1011        **self == OSR_A::_01110
1012    }
1013    #[doc = "Checks if the value of the field is `_01111`"]
1014    #[inline(always)]
1015    pub fn is_01111(&self) -> bool {
1016        **self == OSR_A::_01111
1017    }
1018    #[doc = "Checks if the value of the field is `_10000`"]
1019    #[inline(always)]
1020    pub fn is_10000(&self) -> bool {
1021        **self == OSR_A::_10000
1022    }
1023    #[doc = "Checks if the value of the field is `_10001`"]
1024    #[inline(always)]
1025    pub fn is_10001(&self) -> bool {
1026        **self == OSR_A::_10001
1027    }
1028    #[doc = "Checks if the value of the field is `_10010`"]
1029    #[inline(always)]
1030    pub fn is_10010(&self) -> bool {
1031        **self == OSR_A::_10010
1032    }
1033    #[doc = "Checks if the value of the field is `_10011`"]
1034    #[inline(always)]
1035    pub fn is_10011(&self) -> bool {
1036        **self == OSR_A::_10011
1037    }
1038    #[doc = "Checks if the value of the field is `_10100`"]
1039    #[inline(always)]
1040    pub fn is_10100(&self) -> bool {
1041        **self == OSR_A::_10100
1042    }
1043    #[doc = "Checks if the value of the field is `_10101`"]
1044    #[inline(always)]
1045    pub fn is_10101(&self) -> bool {
1046        **self == OSR_A::_10101
1047    }
1048    #[doc = "Checks if the value of the field is `_10110`"]
1049    #[inline(always)]
1050    pub fn is_10110(&self) -> bool {
1051        **self == OSR_A::_10110
1052    }
1053    #[doc = "Checks if the value of the field is `_10111`"]
1054    #[inline(always)]
1055    pub fn is_10111(&self) -> bool {
1056        **self == OSR_A::_10111
1057    }
1058    #[doc = "Checks if the value of the field is `_11000`"]
1059    #[inline(always)]
1060    pub fn is_11000(&self) -> bool {
1061        **self == OSR_A::_11000
1062    }
1063    #[doc = "Checks if the value of the field is `_11001`"]
1064    #[inline(always)]
1065    pub fn is_11001(&self) -> bool {
1066        **self == OSR_A::_11001
1067    }
1068    #[doc = "Checks if the value of the field is `_11010`"]
1069    #[inline(always)]
1070    pub fn is_11010(&self) -> bool {
1071        **self == OSR_A::_11010
1072    }
1073    #[doc = "Checks if the value of the field is `_11011`"]
1074    #[inline(always)]
1075    pub fn is_11011(&self) -> bool {
1076        **self == OSR_A::_11011
1077    }
1078    #[doc = "Checks if the value of the field is `_11100`"]
1079    #[inline(always)]
1080    pub fn is_11100(&self) -> bool {
1081        **self == OSR_A::_11100
1082    }
1083    #[doc = "Checks if the value of the field is `_11101`"]
1084    #[inline(always)]
1085    pub fn is_11101(&self) -> bool {
1086        **self == OSR_A::_11101
1087    }
1088    #[doc = "Checks if the value of the field is `_11110`"]
1089    #[inline(always)]
1090    pub fn is_11110(&self) -> bool {
1091        **self == OSR_A::_11110
1092    }
1093    #[doc = "Checks if the value of the field is `_11111`"]
1094    #[inline(always)]
1095    pub fn is_11111(&self) -> bool {
1096        **self == OSR_A::_11111
1097    }
1098}
1099impl core::ops::Deref for OSR_R {
1100    type Target = crate::FieldReader<u8, OSR_A>;
1101    #[inline(always)]
1102    fn deref(&self) -> &Self::Target {
1103        &self.0
1104    }
1105}
1106#[doc = "Field `OSR` writer - Oversampling Ratio"]
1107pub struct OSR_W<'a> {
1108    w: &'a mut W,
1109}
1110impl<'a> OSR_W<'a> {
1111    #[doc = r"Writes `variant` to the field"]
1112    #[inline(always)]
1113    pub fn variant(self, variant: OSR_A) -> &'a mut W {
1114        unsafe { self.bits(variant.into()) }
1115    }
1116    #[doc = "Writing 0 to this field will result in an oversampling ratio of 16"]
1117    #[inline(always)]
1118    pub fn _00000(self) -> &'a mut W {
1119        self.variant(OSR_A::_00000)
1120    }
1121    #[doc = "Oversampling ratio of 4, requires BOTHEDGE to be set."]
1122    #[inline(always)]
1123    pub fn _00011(self) -> &'a mut W {
1124        self.variant(OSR_A::_00011)
1125    }
1126    #[doc = "Oversampling ratio of 5, requires BOTHEDGE to be set."]
1127    #[inline(always)]
1128    pub fn _00100(self) -> &'a mut W {
1129        self.variant(OSR_A::_00100)
1130    }
1131    #[doc = "Oversampling ratio of 6, requires BOTHEDGE to be set."]
1132    #[inline(always)]
1133    pub fn _00101(self) -> &'a mut W {
1134        self.variant(OSR_A::_00101)
1135    }
1136    #[doc = "Oversampling ratio of 7, requires BOTHEDGE to be set."]
1137    #[inline(always)]
1138    pub fn _00110(self) -> &'a mut W {
1139        self.variant(OSR_A::_00110)
1140    }
1141    #[doc = "Oversampling ratio of 8."]
1142    #[inline(always)]
1143    pub fn _00111(self) -> &'a mut W {
1144        self.variant(OSR_A::_00111)
1145    }
1146    #[doc = "Oversampling ratio of 9."]
1147    #[inline(always)]
1148    pub fn _01000(self) -> &'a mut W {
1149        self.variant(OSR_A::_01000)
1150    }
1151    #[doc = "Oversampling ratio of 10."]
1152    #[inline(always)]
1153    pub fn _01001(self) -> &'a mut W {
1154        self.variant(OSR_A::_01001)
1155    }
1156    #[doc = "Oversampling ratio of 11."]
1157    #[inline(always)]
1158    pub fn _01010(self) -> &'a mut W {
1159        self.variant(OSR_A::_01010)
1160    }
1161    #[doc = "Oversampling ratio of 12."]
1162    #[inline(always)]
1163    pub fn _01011(self) -> &'a mut W {
1164        self.variant(OSR_A::_01011)
1165    }
1166    #[doc = "Oversampling ratio of 13."]
1167    #[inline(always)]
1168    pub fn _01100(self) -> &'a mut W {
1169        self.variant(OSR_A::_01100)
1170    }
1171    #[doc = "Oversampling ratio of 14."]
1172    #[inline(always)]
1173    pub fn _01101(self) -> &'a mut W {
1174        self.variant(OSR_A::_01101)
1175    }
1176    #[doc = "Oversampling ratio of 15."]
1177    #[inline(always)]
1178    pub fn _01110(self) -> &'a mut W {
1179        self.variant(OSR_A::_01110)
1180    }
1181    #[doc = "Oversampling ratio of 16."]
1182    #[inline(always)]
1183    pub fn _01111(self) -> &'a mut W {
1184        self.variant(OSR_A::_01111)
1185    }
1186    #[doc = "Oversampling ratio of 17."]
1187    #[inline(always)]
1188    pub fn _10000(self) -> &'a mut W {
1189        self.variant(OSR_A::_10000)
1190    }
1191    #[doc = "Oversampling ratio of 18."]
1192    #[inline(always)]
1193    pub fn _10001(self) -> &'a mut W {
1194        self.variant(OSR_A::_10001)
1195    }
1196    #[doc = "Oversampling ratio of 19."]
1197    #[inline(always)]
1198    pub fn _10010(self) -> &'a mut W {
1199        self.variant(OSR_A::_10010)
1200    }
1201    #[doc = "Oversampling ratio of 20."]
1202    #[inline(always)]
1203    pub fn _10011(self) -> &'a mut W {
1204        self.variant(OSR_A::_10011)
1205    }
1206    #[doc = "Oversampling ratio of 21."]
1207    #[inline(always)]
1208    pub fn _10100(self) -> &'a mut W {
1209        self.variant(OSR_A::_10100)
1210    }
1211    #[doc = "Oversampling ratio of 22."]
1212    #[inline(always)]
1213    pub fn _10101(self) -> &'a mut W {
1214        self.variant(OSR_A::_10101)
1215    }
1216    #[doc = "Oversampling ratio of 23."]
1217    #[inline(always)]
1218    pub fn _10110(self) -> &'a mut W {
1219        self.variant(OSR_A::_10110)
1220    }
1221    #[doc = "Oversampling ratio of 24."]
1222    #[inline(always)]
1223    pub fn _10111(self) -> &'a mut W {
1224        self.variant(OSR_A::_10111)
1225    }
1226    #[doc = "Oversampling ratio of 25."]
1227    #[inline(always)]
1228    pub fn _11000(self) -> &'a mut W {
1229        self.variant(OSR_A::_11000)
1230    }
1231    #[doc = "Oversampling ratio of 26."]
1232    #[inline(always)]
1233    pub fn _11001(self) -> &'a mut W {
1234        self.variant(OSR_A::_11001)
1235    }
1236    #[doc = "Oversampling ratio of 27."]
1237    #[inline(always)]
1238    pub fn _11010(self) -> &'a mut W {
1239        self.variant(OSR_A::_11010)
1240    }
1241    #[doc = "Oversampling ratio of 28."]
1242    #[inline(always)]
1243    pub fn _11011(self) -> &'a mut W {
1244        self.variant(OSR_A::_11011)
1245    }
1246    #[doc = "Oversampling ratio of 29."]
1247    #[inline(always)]
1248    pub fn _11100(self) -> &'a mut W {
1249        self.variant(OSR_A::_11100)
1250    }
1251    #[doc = "Oversampling ratio of 30."]
1252    #[inline(always)]
1253    pub fn _11101(self) -> &'a mut W {
1254        self.variant(OSR_A::_11101)
1255    }
1256    #[doc = "Oversampling ratio of 31."]
1257    #[inline(always)]
1258    pub fn _11110(self) -> &'a mut W {
1259        self.variant(OSR_A::_11110)
1260    }
1261    #[doc = "Oversampling ratio of 32."]
1262    #[inline(always)]
1263    pub fn _11111(self) -> &'a mut W {
1264        self.variant(OSR_A::_11111)
1265    }
1266    #[doc = r"Writes raw bits to the field"]
1267    #[inline(always)]
1268    pub unsafe fn bits(self, value: u8) -> &'a mut W {
1269        self.w.bits = (self.w.bits & !(0x1f << 24)) | ((value as u32 & 0x1f) << 24);
1270        self.w
1271    }
1272}
1273#[doc = "10-bit Mode select\n\nValue on reset: 0"]
1274#[derive(Clone, Copy, Debug, PartialEq)]
1275pub enum M10_A {
1276    #[doc = "0: Receiver and transmitter use 7-bit to 9-bit data characters."]
1277    _0 = 0,
1278    #[doc = "1: Receiver and transmitter use 10-bit data characters."]
1279    _1 = 1,
1280}
1281impl From<M10_A> for bool {
1282    #[inline(always)]
1283    fn from(variant: M10_A) -> Self {
1284        variant as u8 != 0
1285    }
1286}
1287#[doc = "Field `M10` reader - 10-bit Mode select"]
1288pub struct M10_R(crate::FieldReader<bool, M10_A>);
1289impl M10_R {
1290    #[inline(always)]
1291    pub(crate) fn new(bits: bool) -> Self {
1292        M10_R(crate::FieldReader::new(bits))
1293    }
1294    #[doc = r"Get enumerated values variant"]
1295    #[inline(always)]
1296    pub fn variant(&self) -> M10_A {
1297        match self.bits {
1298            false => M10_A::_0,
1299            true => M10_A::_1,
1300        }
1301    }
1302    #[doc = "Checks if the value of the field is `_0`"]
1303    #[inline(always)]
1304    pub fn is_0(&self) -> bool {
1305        **self == M10_A::_0
1306    }
1307    #[doc = "Checks if the value of the field is `_1`"]
1308    #[inline(always)]
1309    pub fn is_1(&self) -> bool {
1310        **self == M10_A::_1
1311    }
1312}
1313impl core::ops::Deref for M10_R {
1314    type Target = crate::FieldReader<bool, M10_A>;
1315    #[inline(always)]
1316    fn deref(&self) -> &Self::Target {
1317        &self.0
1318    }
1319}
1320#[doc = "Field `M10` writer - 10-bit Mode select"]
1321pub struct M10_W<'a> {
1322    w: &'a mut W,
1323}
1324impl<'a> M10_W<'a> {
1325    #[doc = r"Writes `variant` to the field"]
1326    #[inline(always)]
1327    pub fn variant(self, variant: M10_A) -> &'a mut W {
1328        self.bit(variant.into())
1329    }
1330    #[doc = "Receiver and transmitter use 7-bit to 9-bit data characters."]
1331    #[inline(always)]
1332    pub fn _0(self) -> &'a mut W {
1333        self.variant(M10_A::_0)
1334    }
1335    #[doc = "Receiver and transmitter use 10-bit data characters."]
1336    #[inline(always)]
1337    pub fn _1(self) -> &'a mut W {
1338        self.variant(M10_A::_1)
1339    }
1340    #[doc = r"Sets the field bit"]
1341    #[inline(always)]
1342    pub fn set_bit(self) -> &'a mut W {
1343        self.bit(true)
1344    }
1345    #[doc = r"Clears the field bit"]
1346    #[inline(always)]
1347    pub fn clear_bit(self) -> &'a mut W {
1348        self.bit(false)
1349    }
1350    #[doc = r"Writes raw bits to the field"]
1351    #[inline(always)]
1352    pub fn bit(self, value: bool) -> &'a mut W {
1353        self.w.bits = (self.w.bits & !(0x01 << 29)) | ((value as u32 & 0x01) << 29);
1354        self.w
1355    }
1356}
1357#[doc = "Match Address Mode Enable 2\n\nValue on reset: 0"]
1358#[derive(Clone, Copy, Debug, PartialEq)]
1359pub enum MAEN2_A {
1360    #[doc = "0: Normal operation."]
1361    _0 = 0,
1362    #[doc = "1: Enables automatic address matching or data matching mode for MATCH\\[MA2\\]."]
1363    _1 = 1,
1364}
1365impl From<MAEN2_A> for bool {
1366    #[inline(always)]
1367    fn from(variant: MAEN2_A) -> Self {
1368        variant as u8 != 0
1369    }
1370}
1371#[doc = "Field `MAEN2` reader - Match Address Mode Enable 2"]
1372pub struct MAEN2_R(crate::FieldReader<bool, MAEN2_A>);
1373impl MAEN2_R {
1374    #[inline(always)]
1375    pub(crate) fn new(bits: bool) -> Self {
1376        MAEN2_R(crate::FieldReader::new(bits))
1377    }
1378    #[doc = r"Get enumerated values variant"]
1379    #[inline(always)]
1380    pub fn variant(&self) -> MAEN2_A {
1381        match self.bits {
1382            false => MAEN2_A::_0,
1383            true => MAEN2_A::_1,
1384        }
1385    }
1386    #[doc = "Checks if the value of the field is `_0`"]
1387    #[inline(always)]
1388    pub fn is_0(&self) -> bool {
1389        **self == MAEN2_A::_0
1390    }
1391    #[doc = "Checks if the value of the field is `_1`"]
1392    #[inline(always)]
1393    pub fn is_1(&self) -> bool {
1394        **self == MAEN2_A::_1
1395    }
1396}
1397impl core::ops::Deref for MAEN2_R {
1398    type Target = crate::FieldReader<bool, MAEN2_A>;
1399    #[inline(always)]
1400    fn deref(&self) -> &Self::Target {
1401        &self.0
1402    }
1403}
1404#[doc = "Field `MAEN2` writer - Match Address Mode Enable 2"]
1405pub struct MAEN2_W<'a> {
1406    w: &'a mut W,
1407}
1408impl<'a> MAEN2_W<'a> {
1409    #[doc = r"Writes `variant` to the field"]
1410    #[inline(always)]
1411    pub fn variant(self, variant: MAEN2_A) -> &'a mut W {
1412        self.bit(variant.into())
1413    }
1414    #[doc = "Normal operation."]
1415    #[inline(always)]
1416    pub fn _0(self) -> &'a mut W {
1417        self.variant(MAEN2_A::_0)
1418    }
1419    #[doc = "Enables automatic address matching or data matching mode for MATCH\\[MA2\\]."]
1420    #[inline(always)]
1421    pub fn _1(self) -> &'a mut W {
1422        self.variant(MAEN2_A::_1)
1423    }
1424    #[doc = r"Sets the field bit"]
1425    #[inline(always)]
1426    pub fn set_bit(self) -> &'a mut W {
1427        self.bit(true)
1428    }
1429    #[doc = r"Clears the field bit"]
1430    #[inline(always)]
1431    pub fn clear_bit(self) -> &'a mut W {
1432        self.bit(false)
1433    }
1434    #[doc = r"Writes raw bits to the field"]
1435    #[inline(always)]
1436    pub fn bit(self, value: bool) -> &'a mut W {
1437        self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
1438        self.w
1439    }
1440}
1441#[doc = "Match Address Mode Enable 1\n\nValue on reset: 0"]
1442#[derive(Clone, Copy, Debug, PartialEq)]
1443pub enum MAEN1_A {
1444    #[doc = "0: Normal operation."]
1445    _0 = 0,
1446    #[doc = "1: Enables automatic address matching or data matching mode for MATCH\\[MA1\\]."]
1447    _1 = 1,
1448}
1449impl From<MAEN1_A> for bool {
1450    #[inline(always)]
1451    fn from(variant: MAEN1_A) -> Self {
1452        variant as u8 != 0
1453    }
1454}
1455#[doc = "Field `MAEN1` reader - Match Address Mode Enable 1"]
1456pub struct MAEN1_R(crate::FieldReader<bool, MAEN1_A>);
1457impl MAEN1_R {
1458    #[inline(always)]
1459    pub(crate) fn new(bits: bool) -> Self {
1460        MAEN1_R(crate::FieldReader::new(bits))
1461    }
1462    #[doc = r"Get enumerated values variant"]
1463    #[inline(always)]
1464    pub fn variant(&self) -> MAEN1_A {
1465        match self.bits {
1466            false => MAEN1_A::_0,
1467            true => MAEN1_A::_1,
1468        }
1469    }
1470    #[doc = "Checks if the value of the field is `_0`"]
1471    #[inline(always)]
1472    pub fn is_0(&self) -> bool {
1473        **self == MAEN1_A::_0
1474    }
1475    #[doc = "Checks if the value of the field is `_1`"]
1476    #[inline(always)]
1477    pub fn is_1(&self) -> bool {
1478        **self == MAEN1_A::_1
1479    }
1480}
1481impl core::ops::Deref for MAEN1_R {
1482    type Target = crate::FieldReader<bool, MAEN1_A>;
1483    #[inline(always)]
1484    fn deref(&self) -> &Self::Target {
1485        &self.0
1486    }
1487}
1488#[doc = "Field `MAEN1` writer - Match Address Mode Enable 1"]
1489pub struct MAEN1_W<'a> {
1490    w: &'a mut W,
1491}
1492impl<'a> MAEN1_W<'a> {
1493    #[doc = r"Writes `variant` to the field"]
1494    #[inline(always)]
1495    pub fn variant(self, variant: MAEN1_A) -> &'a mut W {
1496        self.bit(variant.into())
1497    }
1498    #[doc = "Normal operation."]
1499    #[inline(always)]
1500    pub fn _0(self) -> &'a mut W {
1501        self.variant(MAEN1_A::_0)
1502    }
1503    #[doc = "Enables automatic address matching or data matching mode for MATCH\\[MA1\\]."]
1504    #[inline(always)]
1505    pub fn _1(self) -> &'a mut W {
1506        self.variant(MAEN1_A::_1)
1507    }
1508    #[doc = r"Sets the field bit"]
1509    #[inline(always)]
1510    pub fn set_bit(self) -> &'a mut W {
1511        self.bit(true)
1512    }
1513    #[doc = r"Clears the field bit"]
1514    #[inline(always)]
1515    pub fn clear_bit(self) -> &'a mut W {
1516        self.bit(false)
1517    }
1518    #[doc = r"Writes raw bits to the field"]
1519    #[inline(always)]
1520    pub fn bit(self, value: bool) -> &'a mut W {
1521        self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
1522        self.w
1523    }
1524}
1525impl R {
1526    #[doc = "Bits 0:12 - Baud Rate Modulo Divisor."]
1527    #[inline(always)]
1528    pub fn sbr(&self) -> SBR_R {
1529        SBR_R::new((self.bits & 0x1fff) as u16)
1530    }
1531    #[doc = "Bit 13 - Stop Bit Number Select"]
1532    #[inline(always)]
1533    pub fn sbns(&self) -> SBNS_R {
1534        SBNS_R::new(((self.bits >> 13) & 0x01) != 0)
1535    }
1536    #[doc = "Bit 14 - RX Input Active Edge Interrupt Enable"]
1537    #[inline(always)]
1538    pub fn rxedgie(&self) -> RXEDGIE_R {
1539        RXEDGIE_R::new(((self.bits >> 14) & 0x01) != 0)
1540    }
1541    #[doc = "Bit 15 - LIN Break Detect Interrupt Enable"]
1542    #[inline(always)]
1543    pub fn lbkdie(&self) -> LBKDIE_R {
1544        LBKDIE_R::new(((self.bits >> 15) & 0x01) != 0)
1545    }
1546    #[doc = "Bit 16 - Resynchronization Disable"]
1547    #[inline(always)]
1548    pub fn resyncdis(&self) -> RESYNCDIS_R {
1549        RESYNCDIS_R::new(((self.bits >> 16) & 0x01) != 0)
1550    }
1551    #[doc = "Bit 17 - Both Edge Sampling"]
1552    #[inline(always)]
1553    pub fn bothedge(&self) -> BOTHEDGE_R {
1554        BOTHEDGE_R::new(((self.bits >> 17) & 0x01) != 0)
1555    }
1556    #[doc = "Bits 18:19 - Match Configuration"]
1557    #[inline(always)]
1558    pub fn matcfg(&self) -> MATCFG_R {
1559        MATCFG_R::new(((self.bits >> 18) & 0x03) as u8)
1560    }
1561    #[doc = "Bit 20 - Receiver Idle DMA Enable"]
1562    #[inline(always)]
1563    pub fn ridmae(&self) -> RIDMAE_R {
1564        RIDMAE_R::new(((self.bits >> 20) & 0x01) != 0)
1565    }
1566    #[doc = "Bit 21 - Receiver Full DMA Enable"]
1567    #[inline(always)]
1568    pub fn rdmae(&self) -> RDMAE_R {
1569        RDMAE_R::new(((self.bits >> 21) & 0x01) != 0)
1570    }
1571    #[doc = "Bit 23 - Transmitter DMA Enable"]
1572    #[inline(always)]
1573    pub fn tdmae(&self) -> TDMAE_R {
1574        TDMAE_R::new(((self.bits >> 23) & 0x01) != 0)
1575    }
1576    #[doc = "Bits 24:28 - Oversampling Ratio"]
1577    #[inline(always)]
1578    pub fn osr(&self) -> OSR_R {
1579        OSR_R::new(((self.bits >> 24) & 0x1f) as u8)
1580    }
1581    #[doc = "Bit 29 - 10-bit Mode select"]
1582    #[inline(always)]
1583    pub fn m10(&self) -> M10_R {
1584        M10_R::new(((self.bits >> 29) & 0x01) != 0)
1585    }
1586    #[doc = "Bit 30 - Match Address Mode Enable 2"]
1587    #[inline(always)]
1588    pub fn maen2(&self) -> MAEN2_R {
1589        MAEN2_R::new(((self.bits >> 30) & 0x01) != 0)
1590    }
1591    #[doc = "Bit 31 - Match Address Mode Enable 1"]
1592    #[inline(always)]
1593    pub fn maen1(&self) -> MAEN1_R {
1594        MAEN1_R::new(((self.bits >> 31) & 0x01) != 0)
1595    }
1596}
1597impl W {
1598    #[doc = "Bits 0:12 - Baud Rate Modulo Divisor."]
1599    #[inline(always)]
1600    pub fn sbr(&mut self) -> SBR_W {
1601        SBR_W { w: self }
1602    }
1603    #[doc = "Bit 13 - Stop Bit Number Select"]
1604    #[inline(always)]
1605    pub fn sbns(&mut self) -> SBNS_W {
1606        SBNS_W { w: self }
1607    }
1608    #[doc = "Bit 14 - RX Input Active Edge Interrupt Enable"]
1609    #[inline(always)]
1610    pub fn rxedgie(&mut self) -> RXEDGIE_W {
1611        RXEDGIE_W { w: self }
1612    }
1613    #[doc = "Bit 15 - LIN Break Detect Interrupt Enable"]
1614    #[inline(always)]
1615    pub fn lbkdie(&mut self) -> LBKDIE_W {
1616        LBKDIE_W { w: self }
1617    }
1618    #[doc = "Bit 16 - Resynchronization Disable"]
1619    #[inline(always)]
1620    pub fn resyncdis(&mut self) -> RESYNCDIS_W {
1621        RESYNCDIS_W { w: self }
1622    }
1623    #[doc = "Bit 17 - Both Edge Sampling"]
1624    #[inline(always)]
1625    pub fn bothedge(&mut self) -> BOTHEDGE_W {
1626        BOTHEDGE_W { w: self }
1627    }
1628    #[doc = "Bits 18:19 - Match Configuration"]
1629    #[inline(always)]
1630    pub fn matcfg(&mut self) -> MATCFG_W {
1631        MATCFG_W { w: self }
1632    }
1633    #[doc = "Bit 20 - Receiver Idle DMA Enable"]
1634    #[inline(always)]
1635    pub fn ridmae(&mut self) -> RIDMAE_W {
1636        RIDMAE_W { w: self }
1637    }
1638    #[doc = "Bit 21 - Receiver Full DMA Enable"]
1639    #[inline(always)]
1640    pub fn rdmae(&mut self) -> RDMAE_W {
1641        RDMAE_W { w: self }
1642    }
1643    #[doc = "Bit 23 - Transmitter DMA Enable"]
1644    #[inline(always)]
1645    pub fn tdmae(&mut self) -> TDMAE_W {
1646        TDMAE_W { w: self }
1647    }
1648    #[doc = "Bits 24:28 - Oversampling Ratio"]
1649    #[inline(always)]
1650    pub fn osr(&mut self) -> OSR_W {
1651        OSR_W { w: self }
1652    }
1653    #[doc = "Bit 29 - 10-bit Mode select"]
1654    #[inline(always)]
1655    pub fn m10(&mut self) -> M10_W {
1656        M10_W { w: self }
1657    }
1658    #[doc = "Bit 30 - Match Address Mode Enable 2"]
1659    #[inline(always)]
1660    pub fn maen2(&mut self) -> MAEN2_W {
1661        MAEN2_W { w: self }
1662    }
1663    #[doc = "Bit 31 - Match Address Mode Enable 1"]
1664    #[inline(always)]
1665    pub fn maen1(&mut self) -> MAEN1_W {
1666        MAEN1_W { w: self }
1667    }
1668    #[doc = "Writes raw bits to the register."]
1669    #[inline(always)]
1670    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1671        self.0.bits(bits);
1672        self
1673    }
1674}
1675#[doc = "LPUART Baud Rate Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [baud](index.html) module"]
1676pub struct BAUD_SPEC;
1677impl crate::RegisterSpec for BAUD_SPEC {
1678    type Ux = u32;
1679}
1680#[doc = "`read()` method returns [baud::R](R) reader structure"]
1681impl crate::Readable for BAUD_SPEC {
1682    type Reader = R;
1683}
1684#[doc = "`write(|w| ..)` method takes [baud::W](W) writer structure"]
1685impl crate::Writable for BAUD_SPEC {
1686    type Writer = W;
1687}
1688#[doc = "`reset()` method sets BAUD to value 0x0f00_0004"]
1689impl crate::Resettable for BAUD_SPEC {
1690    #[inline(always)]
1691    fn reset_value() -> Self::Ux {
1692        0x0f00_0004
1693    }
1694}