efm32pg12_pac/usart0/
txdoublex.rs

1#[doc = "Reader of register TXDOUBLEX"]
2pub type R = crate::R<u32, super::TXDOUBLEX>;
3#[doc = "Writer for register TXDOUBLEX"]
4pub type W = crate::W<u32, super::TXDOUBLEX>;
5#[doc = "Register TXDOUBLEX `reset()`'s with value 0"]
6impl crate::ResetValue for super::TXDOUBLEX {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `TXDATA0`"]
14pub type TXDATA0_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `TXDATA0`"]
16pub struct TXDATA0_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> TXDATA0_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 `UBRXAT0`"]
28pub type UBRXAT0_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `UBRXAT0`"]
30pub struct UBRXAT0_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> UBRXAT0_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 `TXTRIAT0`"]
52pub type TXTRIAT0_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `TXTRIAT0`"]
54pub struct TXTRIAT0_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> TXTRIAT0_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 `TXBREAK0`"]
76pub type TXBREAK0_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `TXBREAK0`"]
78pub struct TXBREAK0_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> TXBREAK0_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 `TXDISAT0`"]
100pub type TXDISAT0_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `TXDISAT0`"]
102pub struct TXDISAT0_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> TXDISAT0_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 `RXENAT0`"]
124pub type RXENAT0_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `RXENAT0`"]
126pub struct RXENAT0_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> RXENAT0_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}
147#[doc = "Reader of field `TXDATA1`"]
148pub type TXDATA1_R = crate::R<u16, u16>;
149#[doc = "Write proxy for field `TXDATA1`"]
150pub struct TXDATA1_W<'a> {
151    w: &'a mut W,
152}
153impl<'a> TXDATA1_W<'a> {
154    #[doc = r"Writes raw bits to the field"]
155    #[inline(always)]
156    pub unsafe fn bits(self, value: u16) -> &'a mut W {
157        self.w.bits = (self.w.bits & !(0x01ff << 16)) | (((value as u32) & 0x01ff) << 16);
158        self.w
159    }
160}
161#[doc = "Reader of field `UBRXAT1`"]
162pub type UBRXAT1_R = crate::R<bool, bool>;
163#[doc = "Write proxy for field `UBRXAT1`"]
164pub struct UBRXAT1_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> UBRXAT1_W<'a> {
168    #[doc = r"Sets the field bit"]
169    #[inline(always)]
170    pub fn set_bit(self) -> &'a mut W {
171        self.bit(true)
172    }
173    #[doc = r"Clears the field bit"]
174    #[inline(always)]
175    pub fn clear_bit(self) -> &'a mut W {
176        self.bit(false)
177    }
178    #[doc = r"Writes raw bits to the field"]
179    #[inline(always)]
180    pub fn bit(self, value: bool) -> &'a mut W {
181        self.w.bits = (self.w.bits & !(0x01 << 27)) | (((value as u32) & 0x01) << 27);
182        self.w
183    }
184}
185#[doc = "Reader of field `TXTRIAT1`"]
186pub type TXTRIAT1_R = crate::R<bool, bool>;
187#[doc = "Write proxy for field `TXTRIAT1`"]
188pub struct TXTRIAT1_W<'a> {
189    w: &'a mut W,
190}
191impl<'a> TXTRIAT1_W<'a> {
192    #[doc = r"Sets the field bit"]
193    #[inline(always)]
194    pub fn set_bit(self) -> &'a mut W {
195        self.bit(true)
196    }
197    #[doc = r"Clears the field bit"]
198    #[inline(always)]
199    pub fn clear_bit(self) -> &'a mut W {
200        self.bit(false)
201    }
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub fn bit(self, value: bool) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
206        self.w
207    }
208}
209#[doc = "Reader of field `TXBREAK1`"]
210pub type TXBREAK1_R = crate::R<bool, bool>;
211#[doc = "Write proxy for field `TXBREAK1`"]
212pub struct TXBREAK1_W<'a> {
213    w: &'a mut W,
214}
215impl<'a> TXBREAK1_W<'a> {
216    #[doc = r"Sets the field bit"]
217    #[inline(always)]
218    pub fn set_bit(self) -> &'a mut W {
219        self.bit(true)
220    }
221    #[doc = r"Clears the field bit"]
222    #[inline(always)]
223    pub fn clear_bit(self) -> &'a mut W {
224        self.bit(false)
225    }
226    #[doc = r"Writes raw bits to the field"]
227    #[inline(always)]
228    pub fn bit(self, value: bool) -> &'a mut W {
229        self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
230        self.w
231    }
232}
233#[doc = "Reader of field `TXDISAT1`"]
234pub type TXDISAT1_R = crate::R<bool, bool>;
235#[doc = "Write proxy for field `TXDISAT1`"]
236pub struct TXDISAT1_W<'a> {
237    w: &'a mut W,
238}
239impl<'a> TXDISAT1_W<'a> {
240    #[doc = r"Sets the field bit"]
241    #[inline(always)]
242    pub fn set_bit(self) -> &'a mut W {
243        self.bit(true)
244    }
245    #[doc = r"Clears the field bit"]
246    #[inline(always)]
247    pub fn clear_bit(self) -> &'a mut W {
248        self.bit(false)
249    }
250    #[doc = r"Writes raw bits to the field"]
251    #[inline(always)]
252    pub fn bit(self, value: bool) -> &'a mut W {
253        self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
254        self.w
255    }
256}
257#[doc = "Reader of field `RXENAT1`"]
258pub type RXENAT1_R = crate::R<bool, bool>;
259#[doc = "Write proxy for field `RXENAT1`"]
260pub struct RXENAT1_W<'a> {
261    w: &'a mut W,
262}
263impl<'a> RXENAT1_W<'a> {
264    #[doc = r"Sets the field bit"]
265    #[inline(always)]
266    pub fn set_bit(self) -> &'a mut W {
267        self.bit(true)
268    }
269    #[doc = r"Clears the field bit"]
270    #[inline(always)]
271    pub fn clear_bit(self) -> &'a mut W {
272        self.bit(false)
273    }
274    #[doc = r"Writes raw bits to the field"]
275    #[inline(always)]
276    pub fn bit(self, value: bool) -> &'a mut W {
277        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
278        self.w
279    }
280}
281impl R {
282    #[doc = "Bits 0:8 - TX Data"]
283    #[inline(always)]
284    pub fn txdata0(&self) -> TXDATA0_R {
285        TXDATA0_R::new((self.bits & 0x01ff) as u16)
286    }
287    #[doc = "Bit 11 - Unblock RX After Transmission"]
288    #[inline(always)]
289    pub fn ubrxat0(&self) -> UBRXAT0_R {
290        UBRXAT0_R::new(((self.bits >> 11) & 0x01) != 0)
291    }
292    #[doc = "Bit 12 - Set TXTRI After Transmission"]
293    #[inline(always)]
294    pub fn txtriat0(&self) -> TXTRIAT0_R {
295        TXTRIAT0_R::new(((self.bits >> 12) & 0x01) != 0)
296    }
297    #[doc = "Bit 13 - Transmit Data as Break"]
298    #[inline(always)]
299    pub fn txbreak0(&self) -> TXBREAK0_R {
300        TXBREAK0_R::new(((self.bits >> 13) & 0x01) != 0)
301    }
302    #[doc = "Bit 14 - Clear TXEN After Transmission"]
303    #[inline(always)]
304    pub fn txdisat0(&self) -> TXDISAT0_R {
305        TXDISAT0_R::new(((self.bits >> 14) & 0x01) != 0)
306    }
307    #[doc = "Bit 15 - Enable RX After Transmission"]
308    #[inline(always)]
309    pub fn rxenat0(&self) -> RXENAT0_R {
310        RXENAT0_R::new(((self.bits >> 15) & 0x01) != 0)
311    }
312    #[doc = "Bits 16:24 - TX Data"]
313    #[inline(always)]
314    pub fn txdata1(&self) -> TXDATA1_R {
315        TXDATA1_R::new(((self.bits >> 16) & 0x01ff) as u16)
316    }
317    #[doc = "Bit 27 - Unblock RX After Transmission"]
318    #[inline(always)]
319    pub fn ubrxat1(&self) -> UBRXAT1_R {
320        UBRXAT1_R::new(((self.bits >> 27) & 0x01) != 0)
321    }
322    #[doc = "Bit 28 - Set TXTRI After Transmission"]
323    #[inline(always)]
324    pub fn txtriat1(&self) -> TXTRIAT1_R {
325        TXTRIAT1_R::new(((self.bits >> 28) & 0x01) != 0)
326    }
327    #[doc = "Bit 29 - Transmit Data as Break"]
328    #[inline(always)]
329    pub fn txbreak1(&self) -> TXBREAK1_R {
330        TXBREAK1_R::new(((self.bits >> 29) & 0x01) != 0)
331    }
332    #[doc = "Bit 30 - Clear TXEN After Transmission"]
333    #[inline(always)]
334    pub fn txdisat1(&self) -> TXDISAT1_R {
335        TXDISAT1_R::new(((self.bits >> 30) & 0x01) != 0)
336    }
337    #[doc = "Bit 31 - Enable RX After Transmission"]
338    #[inline(always)]
339    pub fn rxenat1(&self) -> RXENAT1_R {
340        RXENAT1_R::new(((self.bits >> 31) & 0x01) != 0)
341    }
342}
343impl W {
344    #[doc = "Bits 0:8 - TX Data"]
345    #[inline(always)]
346    pub fn txdata0(&mut self) -> TXDATA0_W {
347        TXDATA0_W { w: self }
348    }
349    #[doc = "Bit 11 - Unblock RX After Transmission"]
350    #[inline(always)]
351    pub fn ubrxat0(&mut self) -> UBRXAT0_W {
352        UBRXAT0_W { w: self }
353    }
354    #[doc = "Bit 12 - Set TXTRI After Transmission"]
355    #[inline(always)]
356    pub fn txtriat0(&mut self) -> TXTRIAT0_W {
357        TXTRIAT0_W { w: self }
358    }
359    #[doc = "Bit 13 - Transmit Data as Break"]
360    #[inline(always)]
361    pub fn txbreak0(&mut self) -> TXBREAK0_W {
362        TXBREAK0_W { w: self }
363    }
364    #[doc = "Bit 14 - Clear TXEN After Transmission"]
365    #[inline(always)]
366    pub fn txdisat0(&mut self) -> TXDISAT0_W {
367        TXDISAT0_W { w: self }
368    }
369    #[doc = "Bit 15 - Enable RX After Transmission"]
370    #[inline(always)]
371    pub fn rxenat0(&mut self) -> RXENAT0_W {
372        RXENAT0_W { w: self }
373    }
374    #[doc = "Bits 16:24 - TX Data"]
375    #[inline(always)]
376    pub fn txdata1(&mut self) -> TXDATA1_W {
377        TXDATA1_W { w: self }
378    }
379    #[doc = "Bit 27 - Unblock RX After Transmission"]
380    #[inline(always)]
381    pub fn ubrxat1(&mut self) -> UBRXAT1_W {
382        UBRXAT1_W { w: self }
383    }
384    #[doc = "Bit 28 - Set TXTRI After Transmission"]
385    #[inline(always)]
386    pub fn txtriat1(&mut self) -> TXTRIAT1_W {
387        TXTRIAT1_W { w: self }
388    }
389    #[doc = "Bit 29 - Transmit Data as Break"]
390    #[inline(always)]
391    pub fn txbreak1(&mut self) -> TXBREAK1_W {
392        TXBREAK1_W { w: self }
393    }
394    #[doc = "Bit 30 - Clear TXEN After Transmission"]
395    #[inline(always)]
396    pub fn txdisat1(&mut self) -> TXDISAT1_W {
397        TXDISAT1_W { w: self }
398    }
399    #[doc = "Bit 31 - Enable RX After Transmission"]
400    #[inline(always)]
401    pub fn rxenat1(&mut self) -> RXENAT1_W {
402        RXENAT1_W { w: self }
403    }
404}