cc2538/uart0/
dr.rs

1#[doc = "Reader of register DR"]
2pub type R = crate::R<u32, super::DR>;
3#[doc = "Writer for register DR"]
4pub type W = crate::W<u32, super::DR>;
5#[doc = "Register DR `reset()`'s with value 0"]
6impl crate::ResetValue for super::DR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved20`"]
14pub type RESERVED20_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved20`"]
16pub struct RESERVED20_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED20_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x000f_ffff << 12)) | (((value as u32) & 0x000f_ffff) << 12);
24        self.w
25    }
26}
27#[doc = "Reader of field `OE`"]
28pub type OE_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `OE`"]
30pub struct OE_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> OE_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 `BE`"]
52pub type BE_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `BE`"]
54pub struct BE_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> BE_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 << 10)) | (((value as u32) & 0x01) << 10);
72        self.w
73    }
74}
75#[doc = "Reader of field `PE`"]
76pub type PE_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `PE`"]
78pub struct PE_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> PE_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 << 9)) | (((value as u32) & 0x01) << 9);
96        self.w
97    }
98}
99#[doc = "Reader of field `FE`"]
100pub type FE_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `FE`"]
102pub struct FE_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> FE_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 << 8)) | (((value as u32) & 0x01) << 8);
120        self.w
121    }
122}
123#[doc = "Reader of field `DATA`"]
124pub type DATA_R = crate::R<u8, u8>;
125#[doc = "Write proxy for field `DATA`"]
126pub struct DATA_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> DATA_W<'a> {
130    #[doc = r"Writes raw bits to the field"]
131    #[inline(always)]
132    pub unsafe fn bits(self, value: u8) -> &'a mut W {
133        self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
134        self.w
135    }
136}
137impl R {
138    #[doc = "Bits 12:31 - 31:12\\] Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation."]
139    #[inline(always)]
140    pub fn reserved20(&self) -> RESERVED20_R {
141        RESERVED20_R::new(((self.bits >> 12) & 0x000f_ffff) as u32)
142    }
143    #[doc = "Bit 11 - 11:11\\] UART overrun error 1: New data was received when the FIFO was full, resulting in data loss. 0: No data has been lost due to a FIFO overrun."]
144    #[inline(always)]
145    pub fn oe(&self) -> OE_R {
146        OE_R::new(((self.bits >> 11) & 0x01) != 0)
147    }
148    #[doc = "Bit 10 - 10:10\\] UART break error 1: A break condition has been detected, indicating that the receive data input was held low for longer than a full-word transmission time (defined as start, data, parity, and stop bits). 0: No break condition has occurred. In FIFO mode, this error is associated with the character at the top of the FIFO. When a break occurs, only the one 0 character is loaded into the FIFO. The next character is only enabled after the received data input goes to a 1 (marking state), and the next valid start bit is received."]
149    #[inline(always)]
150    pub fn be(&self) -> BE_R {
151        BE_R::new(((self.bits >> 10) & 0x01) != 0)
152    }
153    #[doc = "Bit 9 - 9:9\\] UART parity error 1: The parity of the received data character does not match the parity defined by bits 2 and 7 of the UARTLCRH register 0: No parity error has occurred. In FIFO mode, this error is associated with the character at the top of the FIFO."]
154    #[inline(always)]
155    pub fn pe(&self) -> PE_R {
156        PE_R::new(((self.bits >> 9) & 0x01) != 0)
157    }
158    #[doc = "Bit 8 - 8:8\\] UART framing error 1: The received character does not have a valid stop bit (a valid stop bit is 1). 0: No framing error has occurred."]
159    #[inline(always)]
160    pub fn fe(&self) -> FE_R {
161        FE_R::new(((self.bits >> 8) & 0x01) != 0)
162    }
163    #[doc = "Bits 0:7 - 7:0\\] Data transmitted or received Data that is to be transmitted via the UART is written to this field. When read, this field contains the data that was received by the UART."]
164    #[inline(always)]
165    pub fn data(&self) -> DATA_R {
166        DATA_R::new((self.bits & 0xff) as u8)
167    }
168}
169impl W {
170    #[doc = "Bits 12:31 - 31:12\\] Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation."]
171    #[inline(always)]
172    pub fn reserved20(&mut self) -> RESERVED20_W {
173        RESERVED20_W { w: self }
174    }
175    #[doc = "Bit 11 - 11:11\\] UART overrun error 1: New data was received when the FIFO was full, resulting in data loss. 0: No data has been lost due to a FIFO overrun."]
176    #[inline(always)]
177    pub fn oe(&mut self) -> OE_W {
178        OE_W { w: self }
179    }
180    #[doc = "Bit 10 - 10:10\\] UART break error 1: A break condition has been detected, indicating that the receive data input was held low for longer than a full-word transmission time (defined as start, data, parity, and stop bits). 0: No break condition has occurred. In FIFO mode, this error is associated with the character at the top of the FIFO. When a break occurs, only the one 0 character is loaded into the FIFO. The next character is only enabled after the received data input goes to a 1 (marking state), and the next valid start bit is received."]
181    #[inline(always)]
182    pub fn be(&mut self) -> BE_W {
183        BE_W { w: self }
184    }
185    #[doc = "Bit 9 - 9:9\\] UART parity error 1: The parity of the received data character does not match the parity defined by bits 2 and 7 of the UARTLCRH register 0: No parity error has occurred. In FIFO mode, this error is associated with the character at the top of the FIFO."]
186    #[inline(always)]
187    pub fn pe(&mut self) -> PE_W {
188        PE_W { w: self }
189    }
190    #[doc = "Bit 8 - 8:8\\] UART framing error 1: The received character does not have a valid stop bit (a valid stop bit is 1). 0: No framing error has occurred."]
191    #[inline(always)]
192    pub fn fe(&mut self) -> FE_W {
193        FE_W { w: self }
194    }
195    #[doc = "Bits 0:7 - 7:0\\] Data transmitted or received Data that is to be transmitted via the UART is written to this field. When read, this field contains the data that was received by the UART."]
196    #[inline(always)]
197    pub fn data(&mut self) -> DATA_W {
198        DATA_W { w: self }
199    }
200}