Skip to main content

max32660_pac/uart0/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "UART enabled, to enable UART block, it is used to drive a gated clock in order to save power consumption when UART is not used. FIFOs are flushed when UART is disabled.\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum ENABLE_A {
40    #[doc = "0: UART disabled. FIFOs are flushed. Clock is gated off for power savings."]
41    DIS = 0,
42    #[doc = "1: UART enabled."]
43    EN = 1,
44}
45impl From<ENABLE_A> for bool {
46    #[inline(always)]
47    fn from(variant: ENABLE_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `ENABLE` reader - UART enabled, to enable UART block, it is used to drive a gated clock in order to save power consumption when UART is not used. FIFOs are flushed when UART is disabled."]
52pub struct ENABLE_R(crate::FieldReader<bool, ENABLE_A>);
53impl ENABLE_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        ENABLE_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> ENABLE_A {
61        match self.bits {
62            false => ENABLE_A::DIS,
63            true => ENABLE_A::EN,
64        }
65    }
66    #[doc = "Checks if the value of the field is `DIS`"]
67    #[inline(always)]
68    pub fn is_dis(&self) -> bool {
69        **self == ENABLE_A::DIS
70    }
71    #[doc = "Checks if the value of the field is `EN`"]
72    #[inline(always)]
73    pub fn is_en(&self) -> bool {
74        **self == ENABLE_A::EN
75    }
76}
77impl core::ops::Deref for ENABLE_R {
78    type Target = crate::FieldReader<bool, ENABLE_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `ENABLE` writer - UART enabled, to enable UART block, it is used to drive a gated clock in order to save power consumption when UART is not used. FIFOs are flushed when UART is disabled."]
85pub struct ENABLE_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> ENABLE_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: ENABLE_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "UART disabled. FIFOs are flushed. Clock is gated off for power savings."]
95    #[inline(always)]
96    pub fn dis(self) -> &'a mut W {
97        self.variant(ENABLE_A::DIS)
98    }
99    #[doc = "UART enabled."]
100    #[inline(always)]
101    pub fn en(self) -> &'a mut W {
102        self.variant(ENABLE_A::EN)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
118        self.w
119    }
120}
121#[doc = "Enable/disable Parity bit (9th character).\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum PARITY_EN_A {
124    #[doc = "0: No Parity"]
125    DIS = 0,
126    #[doc = "1: Parity enabled as 9th bit"]
127    EN = 1,
128}
129impl From<PARITY_EN_A> for bool {
130    #[inline(always)]
131    fn from(variant: PARITY_EN_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `PARITY_EN` reader - Enable/disable Parity bit (9th character)."]
136pub struct PARITY_EN_R(crate::FieldReader<bool, PARITY_EN_A>);
137impl PARITY_EN_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        PARITY_EN_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> PARITY_EN_A {
145        match self.bits {
146            false => PARITY_EN_A::DIS,
147            true => PARITY_EN_A::EN,
148        }
149    }
150    #[doc = "Checks if the value of the field is `DIS`"]
151    #[inline(always)]
152    pub fn is_dis(&self) -> bool {
153        **self == PARITY_EN_A::DIS
154    }
155    #[doc = "Checks if the value of the field is `EN`"]
156    #[inline(always)]
157    pub fn is_en(&self) -> bool {
158        **self == PARITY_EN_A::EN
159    }
160}
161impl core::ops::Deref for PARITY_EN_R {
162    type Target = crate::FieldReader<bool, PARITY_EN_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `PARITY_EN` writer - Enable/disable Parity bit (9th character)."]
169pub struct PARITY_EN_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> PARITY_EN_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: PARITY_EN_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "No Parity"]
179    #[inline(always)]
180    pub fn dis(self) -> &'a mut W {
181        self.variant(PARITY_EN_A::DIS)
182    }
183    #[doc = "Parity enabled as 9th bit"]
184    #[inline(always)]
185    pub fn en(self) -> &'a mut W {
186        self.variant(PARITY_EN_A::EN)
187    }
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
202        self.w
203    }
204}
205#[doc = "When PARITY_EN=1, selects odd, even, Mark or Space parity. Mark parity = always 1; Space parity = always 0.\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207#[repr(u8)]
208pub enum PARITY_A {
209    #[doc = "0: Even parity selected."]
210    EVEN = 0,
211    #[doc = "1: Odd parity selected."]
212    ODD = 1,
213    #[doc = "2: Mark parity selected."]
214    MARK = 2,
215    #[doc = "3: Space parity selected."]
216    SPACE = 3,
217}
218impl From<PARITY_A> for u8 {
219    #[inline(always)]
220    fn from(variant: PARITY_A) -> Self {
221        variant as _
222    }
223}
224#[doc = "Field `PARITY` reader - When PARITY_EN=1, selects odd, even, Mark or Space parity. Mark parity = always 1; Space parity = always 0."]
225pub struct PARITY_R(crate::FieldReader<u8, PARITY_A>);
226impl PARITY_R {
227    #[inline(always)]
228    pub(crate) fn new(bits: u8) -> Self {
229        PARITY_R(crate::FieldReader::new(bits))
230    }
231    #[doc = r"Get enumerated values variant"]
232    #[inline(always)]
233    pub fn variant(&self) -> PARITY_A {
234        match self.bits {
235            0 => PARITY_A::EVEN,
236            1 => PARITY_A::ODD,
237            2 => PARITY_A::MARK,
238            3 => PARITY_A::SPACE,
239            _ => unreachable!(),
240        }
241    }
242    #[doc = "Checks if the value of the field is `EVEN`"]
243    #[inline(always)]
244    pub fn is_even(&self) -> bool {
245        **self == PARITY_A::EVEN
246    }
247    #[doc = "Checks if the value of the field is `ODD`"]
248    #[inline(always)]
249    pub fn is_odd(&self) -> bool {
250        **self == PARITY_A::ODD
251    }
252    #[doc = "Checks if the value of the field is `MARK`"]
253    #[inline(always)]
254    pub fn is_mark(&self) -> bool {
255        **self == PARITY_A::MARK
256    }
257    #[doc = "Checks if the value of the field is `SPACE`"]
258    #[inline(always)]
259    pub fn is_space(&self) -> bool {
260        **self == PARITY_A::SPACE
261    }
262}
263impl core::ops::Deref for PARITY_R {
264    type Target = crate::FieldReader<u8, PARITY_A>;
265    #[inline(always)]
266    fn deref(&self) -> &Self::Target {
267        &self.0
268    }
269}
270#[doc = "Field `PARITY` writer - When PARITY_EN=1, selects odd, even, Mark or Space parity. Mark parity = always 1; Space parity = always 0."]
271pub struct PARITY_W<'a> {
272    w: &'a mut W,
273}
274impl<'a> PARITY_W<'a> {
275    #[doc = r"Writes `variant` to the field"]
276    #[inline(always)]
277    pub fn variant(self, variant: PARITY_A) -> &'a mut W {
278        self.bits(variant.into())
279    }
280    #[doc = "Even parity selected."]
281    #[inline(always)]
282    pub fn even(self) -> &'a mut W {
283        self.variant(PARITY_A::EVEN)
284    }
285    #[doc = "Odd parity selected."]
286    #[inline(always)]
287    pub fn odd(self) -> &'a mut W {
288        self.variant(PARITY_A::ODD)
289    }
290    #[doc = "Mark parity selected."]
291    #[inline(always)]
292    pub fn mark(self) -> &'a mut W {
293        self.variant(PARITY_A::MARK)
294    }
295    #[doc = "Space parity selected."]
296    #[inline(always)]
297    pub fn space(self) -> &'a mut W {
298        self.variant(PARITY_A::SPACE)
299    }
300    #[doc = r"Writes raw bits to the field"]
301    #[inline(always)]
302    pub fn bits(self, value: u8) -> &'a mut W {
303        self.w.bits = (self.w.bits & !(0x03 << 2)) | ((value as u32 & 0x03) << 2);
304        self.w
305    }
306}
307#[doc = "Selects parity based on 1s or 0s count (when PARITY_EN=1).\n\nValue on reset: 0"]
308#[derive(Clone, Copy, Debug, PartialEq)]
309pub enum PARMD_A {
310    #[doc = "0: Parity calculation is based on number of 1s in frame."]
311    _1 = 0,
312    #[doc = "1: Parity calculation is based on number of 0s in frame."]
313    _0 = 1,
314}
315impl From<PARMD_A> for bool {
316    #[inline(always)]
317    fn from(variant: PARMD_A) -> Self {
318        variant as u8 != 0
319    }
320}
321#[doc = "Field `PARMD` reader - Selects parity based on 1s or 0s count (when PARITY_EN=1)."]
322pub struct PARMD_R(crate::FieldReader<bool, PARMD_A>);
323impl PARMD_R {
324    #[inline(always)]
325    pub(crate) fn new(bits: bool) -> Self {
326        PARMD_R(crate::FieldReader::new(bits))
327    }
328    #[doc = r"Get enumerated values variant"]
329    #[inline(always)]
330    pub fn variant(&self) -> PARMD_A {
331        match self.bits {
332            false => PARMD_A::_1,
333            true => PARMD_A::_0,
334        }
335    }
336    #[doc = "Checks if the value of the field is `_1`"]
337    #[inline(always)]
338    pub fn is_1(&self) -> bool {
339        **self == PARMD_A::_1
340    }
341    #[doc = "Checks if the value of the field is `_0`"]
342    #[inline(always)]
343    pub fn is_0(&self) -> bool {
344        **self == PARMD_A::_0
345    }
346}
347impl core::ops::Deref for PARMD_R {
348    type Target = crate::FieldReader<bool, PARMD_A>;
349    #[inline(always)]
350    fn deref(&self) -> &Self::Target {
351        &self.0
352    }
353}
354#[doc = "Field `PARMD` writer - Selects parity based on 1s or 0s count (when PARITY_EN=1)."]
355pub struct PARMD_W<'a> {
356    w: &'a mut W,
357}
358impl<'a> PARMD_W<'a> {
359    #[doc = r"Writes `variant` to the field"]
360    #[inline(always)]
361    pub fn variant(self, variant: PARMD_A) -> &'a mut W {
362        self.bit(variant.into())
363    }
364    #[doc = "Parity calculation is based on number of 1s in frame."]
365    #[inline(always)]
366    pub fn _1(self) -> &'a mut W {
367        self.variant(PARMD_A::_1)
368    }
369    #[doc = "Parity calculation is based on number of 0s in frame."]
370    #[inline(always)]
371    pub fn _0(self) -> &'a mut W {
372        self.variant(PARMD_A::_0)
373    }
374    #[doc = r"Sets the field bit"]
375    #[inline(always)]
376    pub fn set_bit(self) -> &'a mut W {
377        self.bit(true)
378    }
379    #[doc = r"Clears the field bit"]
380    #[inline(always)]
381    pub fn clear_bit(self) -> &'a mut W {
382        self.bit(false)
383    }
384    #[doc = r"Writes raw bits to the field"]
385    #[inline(always)]
386    pub fn bit(self, value: bool) -> &'a mut W {
387        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
388        self.w
389    }
390}
391#[doc = "Field `TX_FLUSH` reader - Flushes the TX FIFO buffer."]
392pub struct TX_FLUSH_R(crate::FieldReader<bool, bool>);
393impl TX_FLUSH_R {
394    #[inline(always)]
395    pub(crate) fn new(bits: bool) -> Self {
396        TX_FLUSH_R(crate::FieldReader::new(bits))
397    }
398}
399impl core::ops::Deref for TX_FLUSH_R {
400    type Target = crate::FieldReader<bool, bool>;
401    #[inline(always)]
402    fn deref(&self) -> &Self::Target {
403        &self.0
404    }
405}
406#[doc = "Field `TX_FLUSH` writer - Flushes the TX FIFO buffer."]
407pub struct TX_FLUSH_W<'a> {
408    w: &'a mut W,
409}
410impl<'a> TX_FLUSH_W<'a> {
411    #[doc = r"Sets the field bit"]
412    #[inline(always)]
413    pub fn set_bit(self) -> &'a mut W {
414        self.bit(true)
415    }
416    #[doc = r"Clears the field bit"]
417    #[inline(always)]
418    pub fn clear_bit(self) -> &'a mut W {
419        self.bit(false)
420    }
421    #[doc = r"Writes raw bits to the field"]
422    #[inline(always)]
423    pub fn bit(self, value: bool) -> &'a mut W {
424        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
425        self.w
426    }
427}
428#[doc = "Field `RX_FLUSH` reader - Flushes the RX FIFO buffer."]
429pub struct RX_FLUSH_R(crate::FieldReader<bool, bool>);
430impl RX_FLUSH_R {
431    #[inline(always)]
432    pub(crate) fn new(bits: bool) -> Self {
433        RX_FLUSH_R(crate::FieldReader::new(bits))
434    }
435}
436impl core::ops::Deref for RX_FLUSH_R {
437    type Target = crate::FieldReader<bool, bool>;
438    #[inline(always)]
439    fn deref(&self) -> &Self::Target {
440        &self.0
441    }
442}
443#[doc = "Field `RX_FLUSH` writer - Flushes the RX FIFO buffer."]
444pub struct RX_FLUSH_W<'a> {
445    w: &'a mut W,
446}
447impl<'a> RX_FLUSH_W<'a> {
448    #[doc = r"Sets the field bit"]
449    #[inline(always)]
450    pub fn set_bit(self) -> &'a mut W {
451        self.bit(true)
452    }
453    #[doc = r"Clears the field bit"]
454    #[inline(always)]
455    pub fn clear_bit(self) -> &'a mut W {
456        self.bit(false)
457    }
458    #[doc = r"Writes raw bits to the field"]
459    #[inline(always)]
460    pub fn bit(self, value: bool) -> &'a mut W {
461        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
462        self.w
463    }
464}
465#[doc = "If set, bit accuracy is selected, in this case the bit duration is the same for all the bits with the optimal accuracy. But the frame duration can have a significant deviation from the expected baudrate.If clear, frame accuracy is selected, therefore bits can have different duration in order to guarantee the minimum frame deviation.\n\nValue on reset: 0"]
466#[derive(Clone, Copy, Debug, PartialEq)]
467pub enum BITACC_A {
468    #[doc = "0: Frame accuracy."]
469    FRAME = 0,
470    #[doc = "1: Bit accuracy."]
471    BIT = 1,
472}
473impl From<BITACC_A> for bool {
474    #[inline(always)]
475    fn from(variant: BITACC_A) -> Self {
476        variant as u8 != 0
477    }
478}
479#[doc = "Field `BITACC` reader - If set, bit accuracy is selected, in this case the bit duration is the same for all the bits with the optimal accuracy. But the frame duration can have a significant deviation from the expected baudrate.If clear, frame accuracy is selected, therefore bits can have different duration in order to guarantee the minimum frame deviation."]
480pub struct BITACC_R(crate::FieldReader<bool, BITACC_A>);
481impl BITACC_R {
482    #[inline(always)]
483    pub(crate) fn new(bits: bool) -> Self {
484        BITACC_R(crate::FieldReader::new(bits))
485    }
486    #[doc = r"Get enumerated values variant"]
487    #[inline(always)]
488    pub fn variant(&self) -> BITACC_A {
489        match self.bits {
490            false => BITACC_A::FRAME,
491            true => BITACC_A::BIT,
492        }
493    }
494    #[doc = "Checks if the value of the field is `FRAME`"]
495    #[inline(always)]
496    pub fn is_frame(&self) -> bool {
497        **self == BITACC_A::FRAME
498    }
499    #[doc = "Checks if the value of the field is `BIT`"]
500    #[inline(always)]
501    pub fn is_bit_(&self) -> bool {
502        **self == BITACC_A::BIT
503    }
504}
505impl core::ops::Deref for BITACC_R {
506    type Target = crate::FieldReader<bool, BITACC_A>;
507    #[inline(always)]
508    fn deref(&self) -> &Self::Target {
509        &self.0
510    }
511}
512#[doc = "Field `BITACC` writer - If set, bit accuracy is selected, in this case the bit duration is the same for all the bits with the optimal accuracy. But the frame duration can have a significant deviation from the expected baudrate.If clear, frame accuracy is selected, therefore bits can have different duration in order to guarantee the minimum frame deviation."]
513pub struct BITACC_W<'a> {
514    w: &'a mut W,
515}
516impl<'a> BITACC_W<'a> {
517    #[doc = r"Writes `variant` to the field"]
518    #[inline(always)]
519    pub fn variant(self, variant: BITACC_A) -> &'a mut W {
520        self.bit(variant.into())
521    }
522    #[doc = "Frame accuracy."]
523    #[inline(always)]
524    pub fn frame(self) -> &'a mut W {
525        self.variant(BITACC_A::FRAME)
526    }
527    #[doc = "Bit accuracy."]
528    #[inline(always)]
529    pub fn bit_(self) -> &'a mut W {
530        self.variant(BITACC_A::BIT)
531    }
532    #[doc = r"Sets the field bit"]
533    #[inline(always)]
534    pub fn set_bit(self) -> &'a mut W {
535        self.bit(true)
536    }
537    #[doc = r"Clears the field bit"]
538    #[inline(always)]
539    pub fn clear_bit(self) -> &'a mut W {
540        self.bit(false)
541    }
542    #[doc = r"Writes raw bits to the field"]
543    #[inline(always)]
544    pub fn bit(self, value: bool) -> &'a mut W {
545        self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
546        self.w
547    }
548}
549#[doc = "Selects UART character size.\n\nValue on reset: 0"]
550#[derive(Clone, Copy, Debug, PartialEq)]
551#[repr(u8)]
552pub enum CHAR_SIZE_A {
553    #[doc = "0: 5 bits."]
554    _5 = 0,
555    #[doc = "1: 6 bits."]
556    _6 = 1,
557    #[doc = "2: 7 bits."]
558    _7 = 2,
559    #[doc = "3: 8 bits."]
560    _8 = 3,
561}
562impl From<CHAR_SIZE_A> for u8 {
563    #[inline(always)]
564    fn from(variant: CHAR_SIZE_A) -> Self {
565        variant as _
566    }
567}
568#[doc = "Field `CHAR_SIZE` reader - Selects UART character size."]
569pub struct CHAR_SIZE_R(crate::FieldReader<u8, CHAR_SIZE_A>);
570impl CHAR_SIZE_R {
571    #[inline(always)]
572    pub(crate) fn new(bits: u8) -> Self {
573        CHAR_SIZE_R(crate::FieldReader::new(bits))
574    }
575    #[doc = r"Get enumerated values variant"]
576    #[inline(always)]
577    pub fn variant(&self) -> CHAR_SIZE_A {
578        match self.bits {
579            0 => CHAR_SIZE_A::_5,
580            1 => CHAR_SIZE_A::_6,
581            2 => CHAR_SIZE_A::_7,
582            3 => CHAR_SIZE_A::_8,
583            _ => unreachable!(),
584        }
585    }
586    #[doc = "Checks if the value of the field is `_5`"]
587    #[inline(always)]
588    pub fn is_5(&self) -> bool {
589        **self == CHAR_SIZE_A::_5
590    }
591    #[doc = "Checks if the value of the field is `_6`"]
592    #[inline(always)]
593    pub fn is_6(&self) -> bool {
594        **self == CHAR_SIZE_A::_6
595    }
596    #[doc = "Checks if the value of the field is `_7`"]
597    #[inline(always)]
598    pub fn is_7(&self) -> bool {
599        **self == CHAR_SIZE_A::_7
600    }
601    #[doc = "Checks if the value of the field is `_8`"]
602    #[inline(always)]
603    pub fn is_8(&self) -> bool {
604        **self == CHAR_SIZE_A::_8
605    }
606}
607impl core::ops::Deref for CHAR_SIZE_R {
608    type Target = crate::FieldReader<u8, CHAR_SIZE_A>;
609    #[inline(always)]
610    fn deref(&self) -> &Self::Target {
611        &self.0
612    }
613}
614#[doc = "Field `CHAR_SIZE` writer - Selects UART character size."]
615pub struct CHAR_SIZE_W<'a> {
616    w: &'a mut W,
617}
618impl<'a> CHAR_SIZE_W<'a> {
619    #[doc = r"Writes `variant` to the field"]
620    #[inline(always)]
621    pub fn variant(self, variant: CHAR_SIZE_A) -> &'a mut W {
622        self.bits(variant.into())
623    }
624    #[doc = "5 bits."]
625    #[inline(always)]
626    pub fn _5(self) -> &'a mut W {
627        self.variant(CHAR_SIZE_A::_5)
628    }
629    #[doc = "6 bits."]
630    #[inline(always)]
631    pub fn _6(self) -> &'a mut W {
632        self.variant(CHAR_SIZE_A::_6)
633    }
634    #[doc = "7 bits."]
635    #[inline(always)]
636    pub fn _7(self) -> &'a mut W {
637        self.variant(CHAR_SIZE_A::_7)
638    }
639    #[doc = "8 bits."]
640    #[inline(always)]
641    pub fn _8(self) -> &'a mut W {
642        self.variant(CHAR_SIZE_A::_8)
643    }
644    #[doc = r"Writes raw bits to the field"]
645    #[inline(always)]
646    pub fn bits(self, value: u8) -> &'a mut W {
647        self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
648        self.w
649    }
650}
651#[doc = "Selects the number of stop bits that will be generated.\n\nValue on reset: 0"]
652#[derive(Clone, Copy, Debug, PartialEq)]
653pub enum STOPBITS_A {
654    #[doc = "0: 1 stop bit."]
655    _1 = 0,
656    #[doc = "1: 1.5 stop bits."]
657    _1_5 = 1,
658}
659impl From<STOPBITS_A> for bool {
660    #[inline(always)]
661    fn from(variant: STOPBITS_A) -> Self {
662        variant as u8 != 0
663    }
664}
665#[doc = "Field `STOPBITS` reader - Selects the number of stop bits that will be generated."]
666pub struct STOPBITS_R(crate::FieldReader<bool, STOPBITS_A>);
667impl STOPBITS_R {
668    #[inline(always)]
669    pub(crate) fn new(bits: bool) -> Self {
670        STOPBITS_R(crate::FieldReader::new(bits))
671    }
672    #[doc = r"Get enumerated values variant"]
673    #[inline(always)]
674    pub fn variant(&self) -> STOPBITS_A {
675        match self.bits {
676            false => STOPBITS_A::_1,
677            true => STOPBITS_A::_1_5,
678        }
679    }
680    #[doc = "Checks if the value of the field is `_1`"]
681    #[inline(always)]
682    pub fn is_1(&self) -> bool {
683        **self == STOPBITS_A::_1
684    }
685    #[doc = "Checks if the value of the field is `_1_5`"]
686    #[inline(always)]
687    pub fn is_1_5(&self) -> bool {
688        **self == STOPBITS_A::_1_5
689    }
690}
691impl core::ops::Deref for STOPBITS_R {
692    type Target = crate::FieldReader<bool, STOPBITS_A>;
693    #[inline(always)]
694    fn deref(&self) -> &Self::Target {
695        &self.0
696    }
697}
698#[doc = "Field `STOPBITS` writer - Selects the number of stop bits that will be generated."]
699pub struct STOPBITS_W<'a> {
700    w: &'a mut W,
701}
702impl<'a> STOPBITS_W<'a> {
703    #[doc = r"Writes `variant` to the field"]
704    #[inline(always)]
705    pub fn variant(self, variant: STOPBITS_A) -> &'a mut W {
706        self.bit(variant.into())
707    }
708    #[doc = "1 stop bit."]
709    #[inline(always)]
710    pub fn _1(self) -> &'a mut W {
711        self.variant(STOPBITS_A::_1)
712    }
713    #[doc = "1.5 stop bits."]
714    #[inline(always)]
715    pub fn _1_5(self) -> &'a mut W {
716        self.variant(STOPBITS_A::_1_5)
717    }
718    #[doc = r"Sets the field bit"]
719    #[inline(always)]
720    pub fn set_bit(self) -> &'a mut W {
721        self.bit(true)
722    }
723    #[doc = r"Clears the field bit"]
724    #[inline(always)]
725    pub fn clear_bit(self) -> &'a mut W {
726        self.bit(false)
727    }
728    #[doc = r"Writes raw bits to the field"]
729    #[inline(always)]
730    pub fn bit(self, value: bool) -> &'a mut W {
731        self.w.bits = (self.w.bits & !(0x01 << 10)) | ((value as u32 & 0x01) << 10);
732        self.w
733    }
734}
735#[doc = "Enables/disables hardware flow control.\n\nValue on reset: 0"]
736#[derive(Clone, Copy, Debug, PartialEq)]
737pub enum FLOW_CTRL_A {
738    #[doc = "1: HW Flow Control with RTS/CTS enabled"]
739    EN = 1,
740    #[doc = "0: HW Flow Control disabled"]
741    DIS = 0,
742}
743impl From<FLOW_CTRL_A> for bool {
744    #[inline(always)]
745    fn from(variant: FLOW_CTRL_A) -> Self {
746        variant as u8 != 0
747    }
748}
749#[doc = "Field `FLOW_CTRL` reader - Enables/disables hardware flow control."]
750pub struct FLOW_CTRL_R(crate::FieldReader<bool, FLOW_CTRL_A>);
751impl FLOW_CTRL_R {
752    #[inline(always)]
753    pub(crate) fn new(bits: bool) -> Self {
754        FLOW_CTRL_R(crate::FieldReader::new(bits))
755    }
756    #[doc = r"Get enumerated values variant"]
757    #[inline(always)]
758    pub fn variant(&self) -> FLOW_CTRL_A {
759        match self.bits {
760            true => FLOW_CTRL_A::EN,
761            false => FLOW_CTRL_A::DIS,
762        }
763    }
764    #[doc = "Checks if the value of the field is `EN`"]
765    #[inline(always)]
766    pub fn is_en(&self) -> bool {
767        **self == FLOW_CTRL_A::EN
768    }
769    #[doc = "Checks if the value of the field is `DIS`"]
770    #[inline(always)]
771    pub fn is_dis(&self) -> bool {
772        **self == FLOW_CTRL_A::DIS
773    }
774}
775impl core::ops::Deref for FLOW_CTRL_R {
776    type Target = crate::FieldReader<bool, FLOW_CTRL_A>;
777    #[inline(always)]
778    fn deref(&self) -> &Self::Target {
779        &self.0
780    }
781}
782#[doc = "Field `FLOW_CTRL` writer - Enables/disables hardware flow control."]
783pub struct FLOW_CTRL_W<'a> {
784    w: &'a mut W,
785}
786impl<'a> FLOW_CTRL_W<'a> {
787    #[doc = r"Writes `variant` to the field"]
788    #[inline(always)]
789    pub fn variant(self, variant: FLOW_CTRL_A) -> &'a mut W {
790        self.bit(variant.into())
791    }
792    #[doc = "HW Flow Control with RTS/CTS enabled"]
793    #[inline(always)]
794    pub fn en(self) -> &'a mut W {
795        self.variant(FLOW_CTRL_A::EN)
796    }
797    #[doc = "HW Flow Control disabled"]
798    #[inline(always)]
799    pub fn dis(self) -> &'a mut W {
800        self.variant(FLOW_CTRL_A::DIS)
801    }
802    #[doc = r"Sets the field bit"]
803    #[inline(always)]
804    pub fn set_bit(self) -> &'a mut W {
805        self.bit(true)
806    }
807    #[doc = r"Clears the field bit"]
808    #[inline(always)]
809    pub fn clear_bit(self) -> &'a mut W {
810        self.bit(false)
811    }
812    #[doc = r"Writes raw bits to the field"]
813    #[inline(always)]
814    pub fn bit(self, value: bool) -> &'a mut W {
815        self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u32 & 0x01) << 11);
816        self.w
817    }
818}
819#[doc = "RTS/CTS polarity.\n\nValue on reset: 0"]
820#[derive(Clone, Copy, Debug, PartialEq)]
821pub enum FLOW_POL_A {
822    #[doc = "0: RTS/CTS asserted is logic 0."]
823    _0 = 0,
824    #[doc = "1: RTS/CTS asserted is logic 1."]
825    _1 = 1,
826}
827impl From<FLOW_POL_A> for bool {
828    #[inline(always)]
829    fn from(variant: FLOW_POL_A) -> Self {
830        variant as u8 != 0
831    }
832}
833#[doc = "Field `FLOW_POL` reader - RTS/CTS polarity."]
834pub struct FLOW_POL_R(crate::FieldReader<bool, FLOW_POL_A>);
835impl FLOW_POL_R {
836    #[inline(always)]
837    pub(crate) fn new(bits: bool) -> Self {
838        FLOW_POL_R(crate::FieldReader::new(bits))
839    }
840    #[doc = r"Get enumerated values variant"]
841    #[inline(always)]
842    pub fn variant(&self) -> FLOW_POL_A {
843        match self.bits {
844            false => FLOW_POL_A::_0,
845            true => FLOW_POL_A::_1,
846        }
847    }
848    #[doc = "Checks if the value of the field is `_0`"]
849    #[inline(always)]
850    pub fn is_0(&self) -> bool {
851        **self == FLOW_POL_A::_0
852    }
853    #[doc = "Checks if the value of the field is `_1`"]
854    #[inline(always)]
855    pub fn is_1(&self) -> bool {
856        **self == FLOW_POL_A::_1
857    }
858}
859impl core::ops::Deref for FLOW_POL_R {
860    type Target = crate::FieldReader<bool, FLOW_POL_A>;
861    #[inline(always)]
862    fn deref(&self) -> &Self::Target {
863        &self.0
864    }
865}
866#[doc = "Field `FLOW_POL` writer - RTS/CTS polarity."]
867pub struct FLOW_POL_W<'a> {
868    w: &'a mut W,
869}
870impl<'a> FLOW_POL_W<'a> {
871    #[doc = r"Writes `variant` to the field"]
872    #[inline(always)]
873    pub fn variant(self, variant: FLOW_POL_A) -> &'a mut W {
874        self.bit(variant.into())
875    }
876    #[doc = "RTS/CTS asserted is logic 0."]
877    #[inline(always)]
878    pub fn _0(self) -> &'a mut W {
879        self.variant(FLOW_POL_A::_0)
880    }
881    #[doc = "RTS/CTS asserted is logic 1."]
882    #[inline(always)]
883    pub fn _1(self) -> &'a mut W {
884        self.variant(FLOW_POL_A::_1)
885    }
886    #[doc = r"Sets the field bit"]
887    #[inline(always)]
888    pub fn set_bit(self) -> &'a mut W {
889        self.bit(true)
890    }
891    #[doc = r"Clears the field bit"]
892    #[inline(always)]
893    pub fn clear_bit(self) -> &'a mut W {
894        self.bit(false)
895    }
896    #[doc = r"Writes raw bits to the field"]
897    #[inline(always)]
898    pub fn bit(self, value: bool) -> &'a mut W {
899        self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
900        self.w
901    }
902}
903#[doc = "NULL Modem Support (RTS/CTS and TXD/RXD swap).\n\nValue on reset: 0"]
904#[derive(Clone, Copy, Debug, PartialEq)]
905pub enum NULL_MODEM_A {
906    #[doc = "0: Direct convention."]
907    DIS = 0,
908    #[doc = "1: Null Modem Mode."]
909    EN = 1,
910}
911impl From<NULL_MODEM_A> for bool {
912    #[inline(always)]
913    fn from(variant: NULL_MODEM_A) -> Self {
914        variant as u8 != 0
915    }
916}
917#[doc = "Field `NULL_MODEM` reader - NULL Modem Support (RTS/CTS and TXD/RXD swap)."]
918pub struct NULL_MODEM_R(crate::FieldReader<bool, NULL_MODEM_A>);
919impl NULL_MODEM_R {
920    #[inline(always)]
921    pub(crate) fn new(bits: bool) -> Self {
922        NULL_MODEM_R(crate::FieldReader::new(bits))
923    }
924    #[doc = r"Get enumerated values variant"]
925    #[inline(always)]
926    pub fn variant(&self) -> NULL_MODEM_A {
927        match self.bits {
928            false => NULL_MODEM_A::DIS,
929            true => NULL_MODEM_A::EN,
930        }
931    }
932    #[doc = "Checks if the value of the field is `DIS`"]
933    #[inline(always)]
934    pub fn is_dis(&self) -> bool {
935        **self == NULL_MODEM_A::DIS
936    }
937    #[doc = "Checks if the value of the field is `EN`"]
938    #[inline(always)]
939    pub fn is_en(&self) -> bool {
940        **self == NULL_MODEM_A::EN
941    }
942}
943impl core::ops::Deref for NULL_MODEM_R {
944    type Target = crate::FieldReader<bool, NULL_MODEM_A>;
945    #[inline(always)]
946    fn deref(&self) -> &Self::Target {
947        &self.0
948    }
949}
950#[doc = "Field `NULL_MODEM` writer - NULL Modem Support (RTS/CTS and TXD/RXD swap)."]
951pub struct NULL_MODEM_W<'a> {
952    w: &'a mut W,
953}
954impl<'a> NULL_MODEM_W<'a> {
955    #[doc = r"Writes `variant` to the field"]
956    #[inline(always)]
957    pub fn variant(self, variant: NULL_MODEM_A) -> &'a mut W {
958        self.bit(variant.into())
959    }
960    #[doc = "Direct convention."]
961    #[inline(always)]
962    pub fn dis(self) -> &'a mut W {
963        self.variant(NULL_MODEM_A::DIS)
964    }
965    #[doc = "Null Modem Mode."]
966    #[inline(always)]
967    pub fn en(self) -> &'a mut W {
968        self.variant(NULL_MODEM_A::EN)
969    }
970    #[doc = r"Sets the field bit"]
971    #[inline(always)]
972    pub fn set_bit(self) -> &'a mut W {
973        self.bit(true)
974    }
975    #[doc = r"Clears the field bit"]
976    #[inline(always)]
977    pub fn clear_bit(self) -> &'a mut W {
978        self.bit(false)
979    }
980    #[doc = r"Writes raw bits to the field"]
981    #[inline(always)]
982    pub fn bit(self, value: bool) -> &'a mut W {
983        self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
984        self.w
985    }
986}
987#[doc = "Break control bit. It causes a break condition to be transmitted to receiving UART.\n\nValue on reset: 0"]
988#[derive(Clone, Copy, Debug, PartialEq)]
989pub enum BREAK_A {
990    #[doc = "0: Break characters are not generated."]
991    DIS = 0,
992    #[doc = "1: Break characters are sent(all the bits are at '0' including start/parity/stop)."]
993    EN = 1,
994}
995impl From<BREAK_A> for bool {
996    #[inline(always)]
997    fn from(variant: BREAK_A) -> Self {
998        variant as u8 != 0
999    }
1000}
1001#[doc = "Field `BREAK` reader - Break control bit. It causes a break condition to be transmitted to receiving UART."]
1002pub struct BREAK_R(crate::FieldReader<bool, BREAK_A>);
1003impl BREAK_R {
1004    #[inline(always)]
1005    pub(crate) fn new(bits: bool) -> Self {
1006        BREAK_R(crate::FieldReader::new(bits))
1007    }
1008    #[doc = r"Get enumerated values variant"]
1009    #[inline(always)]
1010    pub fn variant(&self) -> BREAK_A {
1011        match self.bits {
1012            false => BREAK_A::DIS,
1013            true => BREAK_A::EN,
1014        }
1015    }
1016    #[doc = "Checks if the value of the field is `DIS`"]
1017    #[inline(always)]
1018    pub fn is_dis(&self) -> bool {
1019        **self == BREAK_A::DIS
1020    }
1021    #[doc = "Checks if the value of the field is `EN`"]
1022    #[inline(always)]
1023    pub fn is_en(&self) -> bool {
1024        **self == BREAK_A::EN
1025    }
1026}
1027impl core::ops::Deref for BREAK_R {
1028    type Target = crate::FieldReader<bool, BREAK_A>;
1029    #[inline(always)]
1030    fn deref(&self) -> &Self::Target {
1031        &self.0
1032    }
1033}
1034#[doc = "Field `BREAK` writer - Break control bit. It causes a break condition to be transmitted to receiving UART."]
1035pub struct BREAK_W<'a> {
1036    w: &'a mut W,
1037}
1038impl<'a> BREAK_W<'a> {
1039    #[doc = r"Writes `variant` to the field"]
1040    #[inline(always)]
1041    pub fn variant(self, variant: BREAK_A) -> &'a mut W {
1042        self.bit(variant.into())
1043    }
1044    #[doc = "Break characters are not generated."]
1045    #[inline(always)]
1046    pub fn dis(self) -> &'a mut W {
1047        self.variant(BREAK_A::DIS)
1048    }
1049    #[doc = "Break characters are sent(all the bits are at '0' including start/parity/stop)."]
1050    #[inline(always)]
1051    pub fn en(self) -> &'a mut W {
1052        self.variant(BREAK_A::EN)
1053    }
1054    #[doc = r"Sets the field bit"]
1055    #[inline(always)]
1056    pub fn set_bit(self) -> &'a mut W {
1057        self.bit(true)
1058    }
1059    #[doc = r"Clears the field bit"]
1060    #[inline(always)]
1061    pub fn clear_bit(self) -> &'a mut W {
1062        self.bit(false)
1063    }
1064    #[doc = r"Writes raw bits to the field"]
1065    #[inline(always)]
1066    pub fn bit(self, value: bool) -> &'a mut W {
1067        self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
1068        self.w
1069    }
1070}
1071#[doc = "Baud Rate Clock Source Select. Selects the baud rate clock.\n\nValue on reset: 0"]
1072#[derive(Clone, Copy, Debug, PartialEq)]
1073pub enum CLKSEL_A {
1074    #[doc = "0: System clock."]
1075    SYSTEM = 0,
1076    #[doc = "1: Alternate 7.3727MHz internal clock. Useful in low power modes when the system clock is slow."]
1077    ALTERNATE = 1,
1078}
1079impl From<CLKSEL_A> for bool {
1080    #[inline(always)]
1081    fn from(variant: CLKSEL_A) -> Self {
1082        variant as u8 != 0
1083    }
1084}
1085#[doc = "Field `CLKSEL` reader - Baud Rate Clock Source Select. Selects the baud rate clock."]
1086pub struct CLKSEL_R(crate::FieldReader<bool, CLKSEL_A>);
1087impl CLKSEL_R {
1088    #[inline(always)]
1089    pub(crate) fn new(bits: bool) -> Self {
1090        CLKSEL_R(crate::FieldReader::new(bits))
1091    }
1092    #[doc = r"Get enumerated values variant"]
1093    #[inline(always)]
1094    pub fn variant(&self) -> CLKSEL_A {
1095        match self.bits {
1096            false => CLKSEL_A::SYSTEM,
1097            true => CLKSEL_A::ALTERNATE,
1098        }
1099    }
1100    #[doc = "Checks if the value of the field is `SYSTEM`"]
1101    #[inline(always)]
1102    pub fn is_system(&self) -> bool {
1103        **self == CLKSEL_A::SYSTEM
1104    }
1105    #[doc = "Checks if the value of the field is `ALTERNATE`"]
1106    #[inline(always)]
1107    pub fn is_alternate(&self) -> bool {
1108        **self == CLKSEL_A::ALTERNATE
1109    }
1110}
1111impl core::ops::Deref for CLKSEL_R {
1112    type Target = crate::FieldReader<bool, CLKSEL_A>;
1113    #[inline(always)]
1114    fn deref(&self) -> &Self::Target {
1115        &self.0
1116    }
1117}
1118#[doc = "Field `CLKSEL` writer - Baud Rate Clock Source Select. Selects the baud rate clock."]
1119pub struct CLKSEL_W<'a> {
1120    w: &'a mut W,
1121}
1122impl<'a> CLKSEL_W<'a> {
1123    #[doc = r"Writes `variant` to the field"]
1124    #[inline(always)]
1125    pub fn variant(self, variant: CLKSEL_A) -> &'a mut W {
1126        self.bit(variant.into())
1127    }
1128    #[doc = "System clock."]
1129    #[inline(always)]
1130    pub fn system(self) -> &'a mut W {
1131        self.variant(CLKSEL_A::SYSTEM)
1132    }
1133    #[doc = "Alternate 7.3727MHz internal clock. Useful in low power modes when the system clock is slow."]
1134    #[inline(always)]
1135    pub fn alternate(self) -> &'a mut W {
1136        self.variant(CLKSEL_A::ALTERNATE)
1137    }
1138    #[doc = r"Sets the field bit"]
1139    #[inline(always)]
1140    pub fn set_bit(self) -> &'a mut W {
1141        self.bit(true)
1142    }
1143    #[doc = r"Clears the field bit"]
1144    #[inline(always)]
1145    pub fn clear_bit(self) -> &'a mut W {
1146        self.bit(false)
1147    }
1148    #[doc = r"Writes raw bits to the field"]
1149    #[inline(always)]
1150    pub fn bit(self, value: bool) -> &'a mut W {
1151        self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
1152        self.w
1153    }
1154}
1155#[doc = "Field `RX_TO` reader - RX Time Out. RX time out interrupt will occur after RXTO Uart characters if RX-FIFO is not empty and RX FIFO has not been read."]
1156pub struct RX_TO_R(crate::FieldReader<u8, u8>);
1157impl RX_TO_R {
1158    #[inline(always)]
1159    pub(crate) fn new(bits: u8) -> Self {
1160        RX_TO_R(crate::FieldReader::new(bits))
1161    }
1162}
1163impl core::ops::Deref for RX_TO_R {
1164    type Target = crate::FieldReader<u8, u8>;
1165    #[inline(always)]
1166    fn deref(&self) -> &Self::Target {
1167        &self.0
1168    }
1169}
1170#[doc = "Field `RX_TO` writer - RX Time Out. RX time out interrupt will occur after RXTO Uart characters if RX-FIFO is not empty and RX FIFO has not been read."]
1171pub struct RX_TO_W<'a> {
1172    w: &'a mut W,
1173}
1174impl<'a> RX_TO_W<'a> {
1175    #[doc = r"Writes raw bits to the field"]
1176    #[inline(always)]
1177    pub unsafe fn bits(self, value: u8) -> &'a mut W {
1178        self.w.bits = (self.w.bits & !(0xff << 16)) | ((value as u32 & 0xff) << 16);
1179        self.w
1180    }
1181}
1182impl R {
1183    #[doc = "Bit 0 - UART enabled, to enable UART block, it is used to drive a gated clock in order to save power consumption when UART is not used. FIFOs are flushed when UART is disabled."]
1184    #[inline(always)]
1185    pub fn enable(&self) -> ENABLE_R {
1186        ENABLE_R::new((self.bits & 0x01) != 0)
1187    }
1188    #[doc = "Bit 1 - Enable/disable Parity bit (9th character)."]
1189    #[inline(always)]
1190    pub fn parity_en(&self) -> PARITY_EN_R {
1191        PARITY_EN_R::new(((self.bits >> 1) & 0x01) != 0)
1192    }
1193    #[doc = "Bits 2:3 - When PARITY_EN=1, selects odd, even, Mark or Space parity. Mark parity = always 1; Space parity = always 0."]
1194    #[inline(always)]
1195    pub fn parity(&self) -> PARITY_R {
1196        PARITY_R::new(((self.bits >> 2) & 0x03) as u8)
1197    }
1198    #[doc = "Bit 4 - Selects parity based on 1s or 0s count (when PARITY_EN=1)."]
1199    #[inline(always)]
1200    pub fn parmd(&self) -> PARMD_R {
1201        PARMD_R::new(((self.bits >> 4) & 0x01) != 0)
1202    }
1203    #[doc = "Bit 5 - Flushes the TX FIFO buffer."]
1204    #[inline(always)]
1205    pub fn tx_flush(&self) -> TX_FLUSH_R {
1206        TX_FLUSH_R::new(((self.bits >> 5) & 0x01) != 0)
1207    }
1208    #[doc = "Bit 6 - Flushes the RX FIFO buffer."]
1209    #[inline(always)]
1210    pub fn rx_flush(&self) -> RX_FLUSH_R {
1211        RX_FLUSH_R::new(((self.bits >> 6) & 0x01) != 0)
1212    }
1213    #[doc = "Bit 7 - If set, bit accuracy is selected, in this case the bit duration is the same for all the bits with the optimal accuracy. But the frame duration can have a significant deviation from the expected baudrate.If clear, frame accuracy is selected, therefore bits can have different duration in order to guarantee the minimum frame deviation."]
1214    #[inline(always)]
1215    pub fn bitacc(&self) -> BITACC_R {
1216        BITACC_R::new(((self.bits >> 7) & 0x01) != 0)
1217    }
1218    #[doc = "Bits 8:9 - Selects UART character size."]
1219    #[inline(always)]
1220    pub fn char_size(&self) -> CHAR_SIZE_R {
1221        CHAR_SIZE_R::new(((self.bits >> 8) & 0x03) as u8)
1222    }
1223    #[doc = "Bit 10 - Selects the number of stop bits that will be generated."]
1224    #[inline(always)]
1225    pub fn stopbits(&self) -> STOPBITS_R {
1226        STOPBITS_R::new(((self.bits >> 10) & 0x01) != 0)
1227    }
1228    #[doc = "Bit 11 - Enables/disables hardware flow control."]
1229    #[inline(always)]
1230    pub fn flow_ctrl(&self) -> FLOW_CTRL_R {
1231        FLOW_CTRL_R::new(((self.bits >> 11) & 0x01) != 0)
1232    }
1233    #[doc = "Bit 12 - RTS/CTS polarity."]
1234    #[inline(always)]
1235    pub fn flow_pol(&self) -> FLOW_POL_R {
1236        FLOW_POL_R::new(((self.bits >> 12) & 0x01) != 0)
1237    }
1238    #[doc = "Bit 13 - NULL Modem Support (RTS/CTS and TXD/RXD swap)."]
1239    #[inline(always)]
1240    pub fn null_modem(&self) -> NULL_MODEM_R {
1241        NULL_MODEM_R::new(((self.bits >> 13) & 0x01) != 0)
1242    }
1243    #[doc = "Bit 14 - Break control bit. It causes a break condition to be transmitted to receiving UART."]
1244    #[inline(always)]
1245    pub fn break_(&self) -> BREAK_R {
1246        BREAK_R::new(((self.bits >> 14) & 0x01) != 0)
1247    }
1248    #[doc = "Bit 15 - Baud Rate Clock Source Select. Selects the baud rate clock."]
1249    #[inline(always)]
1250    pub fn clksel(&self) -> CLKSEL_R {
1251        CLKSEL_R::new(((self.bits >> 15) & 0x01) != 0)
1252    }
1253    #[doc = "Bits 16:23 - RX Time Out. RX time out interrupt will occur after RXTO Uart characters if RX-FIFO is not empty and RX FIFO has not been read."]
1254    #[inline(always)]
1255    pub fn rx_to(&self) -> RX_TO_R {
1256        RX_TO_R::new(((self.bits >> 16) & 0xff) as u8)
1257    }
1258}
1259impl W {
1260    #[doc = "Bit 0 - UART enabled, to enable UART block, it is used to drive a gated clock in order to save power consumption when UART is not used. FIFOs are flushed when UART is disabled."]
1261    #[inline(always)]
1262    pub fn enable(&mut self) -> ENABLE_W {
1263        ENABLE_W { w: self }
1264    }
1265    #[doc = "Bit 1 - Enable/disable Parity bit (9th character)."]
1266    #[inline(always)]
1267    pub fn parity_en(&mut self) -> PARITY_EN_W {
1268        PARITY_EN_W { w: self }
1269    }
1270    #[doc = "Bits 2:3 - When PARITY_EN=1, selects odd, even, Mark or Space parity. Mark parity = always 1; Space parity = always 0."]
1271    #[inline(always)]
1272    pub fn parity(&mut self) -> PARITY_W {
1273        PARITY_W { w: self }
1274    }
1275    #[doc = "Bit 4 - Selects parity based on 1s or 0s count (when PARITY_EN=1)."]
1276    #[inline(always)]
1277    pub fn parmd(&mut self) -> PARMD_W {
1278        PARMD_W { w: self }
1279    }
1280    #[doc = "Bit 5 - Flushes the TX FIFO buffer."]
1281    #[inline(always)]
1282    pub fn tx_flush(&mut self) -> TX_FLUSH_W {
1283        TX_FLUSH_W { w: self }
1284    }
1285    #[doc = "Bit 6 - Flushes the RX FIFO buffer."]
1286    #[inline(always)]
1287    pub fn rx_flush(&mut self) -> RX_FLUSH_W {
1288        RX_FLUSH_W { w: self }
1289    }
1290    #[doc = "Bit 7 - If set, bit accuracy is selected, in this case the bit duration is the same for all the bits with the optimal accuracy. But the frame duration can have a significant deviation from the expected baudrate.If clear, frame accuracy is selected, therefore bits can have different duration in order to guarantee the minimum frame deviation."]
1291    #[inline(always)]
1292    pub fn bitacc(&mut self) -> BITACC_W {
1293        BITACC_W { w: self }
1294    }
1295    #[doc = "Bits 8:9 - Selects UART character size."]
1296    #[inline(always)]
1297    pub fn char_size(&mut self) -> CHAR_SIZE_W {
1298        CHAR_SIZE_W { w: self }
1299    }
1300    #[doc = "Bit 10 - Selects the number of stop bits that will be generated."]
1301    #[inline(always)]
1302    pub fn stopbits(&mut self) -> STOPBITS_W {
1303        STOPBITS_W { w: self }
1304    }
1305    #[doc = "Bit 11 - Enables/disables hardware flow control."]
1306    #[inline(always)]
1307    pub fn flow_ctrl(&mut self) -> FLOW_CTRL_W {
1308        FLOW_CTRL_W { w: self }
1309    }
1310    #[doc = "Bit 12 - RTS/CTS polarity."]
1311    #[inline(always)]
1312    pub fn flow_pol(&mut self) -> FLOW_POL_W {
1313        FLOW_POL_W { w: self }
1314    }
1315    #[doc = "Bit 13 - NULL Modem Support (RTS/CTS and TXD/RXD swap)."]
1316    #[inline(always)]
1317    pub fn null_modem(&mut self) -> NULL_MODEM_W {
1318        NULL_MODEM_W { w: self }
1319    }
1320    #[doc = "Bit 14 - Break control bit. It causes a break condition to be transmitted to receiving UART."]
1321    #[inline(always)]
1322    pub fn break_(&mut self) -> BREAK_W {
1323        BREAK_W { w: self }
1324    }
1325    #[doc = "Bit 15 - Baud Rate Clock Source Select. Selects the baud rate clock."]
1326    #[inline(always)]
1327    pub fn clksel(&mut self) -> CLKSEL_W {
1328        CLKSEL_W { w: self }
1329    }
1330    #[doc = "Bits 16:23 - RX Time Out. RX time out interrupt will occur after RXTO Uart characters if RX-FIFO is not empty and RX FIFO has not been read."]
1331    #[inline(always)]
1332    pub fn rx_to(&mut self) -> RX_TO_W {
1333        RX_TO_W { w: self }
1334    }
1335    #[doc = "Writes raw bits to the register."]
1336    #[inline(always)]
1337    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1338        self.0.bits(bits);
1339        self
1340    }
1341}
1342#[doc = "Control 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 [ctrl](index.html) module"]
1343pub struct CTRL_SPEC;
1344impl crate::RegisterSpec for CTRL_SPEC {
1345    type Ux = u32;
1346}
1347#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
1348impl crate::Readable for CTRL_SPEC {
1349    type Reader = R;
1350}
1351#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
1352impl crate::Writable for CTRL_SPEC {
1353    type Writer = W;
1354}
1355#[doc = "`reset()` method sets CTRL to value 0"]
1356impl crate::Resettable for CTRL_SPEC {
1357    #[inline(always)]
1358    fn reset_value() -> Self::Ux {
1359        0
1360    }
1361}