efm32pg12_pac/usart0/
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 `TXDATAX`"]
14pub type TXDATAX_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `TXDATAX`"]
16pub struct TXDATAX_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> TXDATAX_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 `UBRXAT`"]
28pub type UBRXAT_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `UBRXAT`"]
30pub struct UBRXAT_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> UBRXAT_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 << 11)) | (((value as u32) & 0x01) << 11);
48        self.w
49    }
50}
51#[doc = "Reader of field `TXTRIAT`"]
52pub type TXTRIAT_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `TXTRIAT`"]
54pub struct TXTRIAT_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> TXTRIAT_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 << 12)) | (((value as u32) & 0x01) << 12);
72        self.w
73    }
74}
75#[doc = "Reader of field `TXBREAK`"]
76pub type TXBREAK_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `TXBREAK`"]
78pub struct TXBREAK_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> TXBREAK_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 << 13)) | (((value as u32) & 0x01) << 13);
96        self.w
97    }
98}
99#[doc = "Reader of field `TXDISAT`"]
100pub type TXDISAT_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `TXDISAT`"]
102pub struct TXDISAT_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> TXDISAT_W<'a> {
106    #[doc = r"Sets the field bit"]
107    #[inline(always)]
108    pub fn set_bit(self) -> &'a mut W {
109        self.bit(true)
110    }
111    #[doc = r"Clears the field bit"]
112    #[inline(always)]
113    pub fn clear_bit(self) -> &'a mut W {
114        self.bit(false)
115    }
116    #[doc = r"Writes raw bits to the field"]
117    #[inline(always)]
118    pub fn bit(self, value: bool) -> &'a mut W {
119        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
120        self.w
121    }
122}
123#[doc = "Reader of field `RXENAT`"]
124pub type RXENAT_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `RXENAT`"]
126pub struct RXENAT_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> RXENAT_W<'a> {
130    #[doc = r"Sets the field bit"]
131    #[inline(always)]
132    pub fn set_bit(self) -> &'a mut W {
133        self.bit(true)
134    }
135    #[doc = r"Clears the field bit"]
136    #[inline(always)]
137    pub fn clear_bit(self) -> &'a mut W {
138        self.bit(false)
139    }
140    #[doc = r"Writes raw bits to the field"]
141    #[inline(always)]
142    pub fn bit(self, value: bool) -> &'a mut W {
143        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
144        self.w
145    }
146}
147impl R {
148    #[doc = "Bits 0:8 - TX Data"]
149    #[inline(always)]
150    pub fn txdatax(&self) -> TXDATAX_R {
151        TXDATAX_R::new((self.bits & 0x01ff) as u16)
152    }
153    #[doc = "Bit 11 - Unblock RX After Transmission"]
154    #[inline(always)]
155    pub fn ubrxat(&self) -> UBRXAT_R {
156        UBRXAT_R::new(((self.bits >> 11) & 0x01) != 0)
157    }
158    #[doc = "Bit 12 - Set TXTRI After Transmission"]
159    #[inline(always)]
160    pub fn txtriat(&self) -> TXTRIAT_R {
161        TXTRIAT_R::new(((self.bits >> 12) & 0x01) != 0)
162    }
163    #[doc = "Bit 13 - Transmit Data as Break"]
164    #[inline(always)]
165    pub fn txbreak(&self) -> TXBREAK_R {
166        TXBREAK_R::new(((self.bits >> 13) & 0x01) != 0)
167    }
168    #[doc = "Bit 14 - Clear TXEN After Transmission"]
169    #[inline(always)]
170    pub fn txdisat(&self) -> TXDISAT_R {
171        TXDISAT_R::new(((self.bits >> 14) & 0x01) != 0)
172    }
173    #[doc = "Bit 15 - Enable RX After Transmission"]
174    #[inline(always)]
175    pub fn rxenat(&self) -> RXENAT_R {
176        RXENAT_R::new(((self.bits >> 15) & 0x01) != 0)
177    }
178}
179impl W {
180    #[doc = "Bits 0:8 - TX Data"]
181    #[inline(always)]
182    pub fn txdatax(&mut self) -> TXDATAX_W {
183        TXDATAX_W { w: self }
184    }
185    #[doc = "Bit 11 - Unblock RX After Transmission"]
186    #[inline(always)]
187    pub fn ubrxat(&mut self) -> UBRXAT_W {
188        UBRXAT_W { w: self }
189    }
190    #[doc = "Bit 12 - Set TXTRI After Transmission"]
191    #[inline(always)]
192    pub fn txtriat(&mut self) -> TXTRIAT_W {
193        TXTRIAT_W { w: self }
194    }
195    #[doc = "Bit 13 - Transmit Data as Break"]
196    #[inline(always)]
197    pub fn txbreak(&mut self) -> TXBREAK_W {
198        TXBREAK_W { w: self }
199    }
200    #[doc = "Bit 14 - Clear TXEN After Transmission"]
201    #[inline(always)]
202    pub fn txdisat(&mut self) -> TXDISAT_W {
203        TXDISAT_W { w: self }
204    }
205    #[doc = "Bit 15 - Enable RX After Transmission"]
206    #[inline(always)]
207    pub fn rxenat(&mut self) -> RXENAT_W {
208        RXENAT_W { w: self }
209    }
210}