efm32pg12_pac/leuart0/
txdatax.rs

1#[doc = "Reader of register TXDATAX"]
2pub type R = crate::R<u32, super::TXDATAX>;
3#[doc = "Writer for register TXDATAX"]
4pub type W = crate::W<u32, super::TXDATAX>;
5#[doc = "Register TXDATAX `reset()`'s with value 0"]
6impl crate::ResetValue for super::TXDATAX {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `TXDATA`"]
14pub type TXDATA_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `TXDATA`"]
16pub struct TXDATA_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> TXDATA_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x01ff) | ((value as u32) & 0x01ff);
24        self.w
25    }
26}
27#[doc = "Reader of field `TXBREAK`"]
28pub type TXBREAK_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `TXBREAK`"]
30pub struct TXBREAK_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> TXBREAK_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
48        self.w
49    }
50}
51#[doc = "Reader of field `TXDISAT`"]
52pub type TXDISAT_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `TXDISAT`"]
54pub struct TXDISAT_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> TXDISAT_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
72        self.w
73    }
74}
75#[doc = "Reader of field `RXENAT`"]
76pub type RXENAT_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `RXENAT`"]
78pub struct RXENAT_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> RXENAT_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
96        self.w
97    }
98}
99impl R {
100    #[doc = "Bits 0:8 - TX Data"]
101    #[inline(always)]
102    pub fn txdata(&self) -> TXDATA_R {
103        TXDATA_R::new((self.bits & 0x01ff) as u16)
104    }
105    #[doc = "Bit 13 - Transmit Data as Break"]
106    #[inline(always)]
107    pub fn txbreak(&self) -> TXBREAK_R {
108        TXBREAK_R::new(((self.bits >> 13) & 0x01) != 0)
109    }
110    #[doc = "Bit 14 - Disable TX After Transmission"]
111    #[inline(always)]
112    pub fn txdisat(&self) -> TXDISAT_R {
113        TXDISAT_R::new(((self.bits >> 14) & 0x01) != 0)
114    }
115    #[doc = "Bit 15 - Enable RX After Transmission"]
116    #[inline(always)]
117    pub fn rxenat(&self) -> RXENAT_R {
118        RXENAT_R::new(((self.bits >> 15) & 0x01) != 0)
119    }
120}
121impl W {
122    #[doc = "Bits 0:8 - TX Data"]
123    #[inline(always)]
124    pub fn txdata(&mut self) -> TXDATA_W {
125        TXDATA_W { w: self }
126    }
127    #[doc = "Bit 13 - Transmit Data as Break"]
128    #[inline(always)]
129    pub fn txbreak(&mut self) -> TXBREAK_W {
130        TXBREAK_W { w: self }
131    }
132    #[doc = "Bit 14 - Disable TX After Transmission"]
133    #[inline(always)]
134    pub fn txdisat(&mut self) -> TXDISAT_W {
135        TXDISAT_W { w: self }
136    }
137    #[doc = "Bit 15 - Enable RX After Transmission"]
138    #[inline(always)]
139    pub fn rxenat(&mut self) -> RXENAT_W {
140        RXENAT_W { w: self }
141    }
142}