esp8266/uart1/
uart_conf1.rs

1#[doc = "Register `UART_CONF1` reader"]
2pub struct R(crate::R<UART_CONF1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<UART_CONF1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<UART_CONF1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<UART_CONF1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `UART_CONF1` writer"]
17pub struct W(crate::W<UART_CONF1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<UART_CONF1_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<UART_CONF1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<UART_CONF1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `rx_tout_en` reader - Set this bit to enable rx time-out function"]
38pub struct RX_TOUT_EN_R(crate::FieldReader<bool, bool>);
39impl RX_TOUT_EN_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        RX_TOUT_EN_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for RX_TOUT_EN_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `rx_tout_en` writer - Set this bit to enable rx time-out function"]
53pub struct RX_TOUT_EN_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> RX_TOUT_EN_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !(1 << 31)) | ((value as u32 & 1) << 31);
71        self.w
72    }
73}
74#[doc = "Field `rx_tout_thrhd` reader - Config bits for rx time-out threshold,uint: byte,0-127"]
75pub struct RX_TOUT_THRHD_R(crate::FieldReader<u8, u8>);
76impl RX_TOUT_THRHD_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: u8) -> Self {
79        RX_TOUT_THRHD_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for RX_TOUT_THRHD_R {
83    type Target = crate::FieldReader<u8, u8>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `rx_tout_thrhd` writer - Config bits for rx time-out threshold,uint: byte,0-127"]
90pub struct RX_TOUT_THRHD_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> RX_TOUT_THRHD_W<'a> {
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub unsafe fn bits(self, value: u8) -> &'a mut W {
97        self.w.bits = (self.w.bits & !(0x7f << 24)) | ((value as u32 & 0x7f) << 24);
98        self.w
99    }
100}
101#[doc = "Field `rx_flow_en` reader - Set this bit to enable rx hardware flow control"]
102pub struct RX_FLOW_EN_R(crate::FieldReader<bool, bool>);
103impl RX_FLOW_EN_R {
104    #[inline(always)]
105    pub(crate) fn new(bits: bool) -> Self {
106        RX_FLOW_EN_R(crate::FieldReader::new(bits))
107    }
108}
109impl core::ops::Deref for RX_FLOW_EN_R {
110    type Target = crate::FieldReader<bool, bool>;
111    #[inline(always)]
112    fn deref(&self) -> &Self::Target {
113        &self.0
114    }
115}
116#[doc = "Field `rx_flow_en` writer - Set this bit to enable rx hardware flow control"]
117pub struct RX_FLOW_EN_W<'a> {
118    w: &'a mut W,
119}
120impl<'a> RX_FLOW_EN_W<'a> {
121    #[doc = r"Sets the field bit"]
122    #[inline(always)]
123    pub fn set_bit(self) -> &'a mut W {
124        self.bit(true)
125    }
126    #[doc = r"Clears the field bit"]
127    #[inline(always)]
128    pub fn clear_bit(self) -> &'a mut W {
129        self.bit(false)
130    }
131    #[doc = r"Writes raw bits to the field"]
132    #[inline(always)]
133    pub fn bit(self, value: bool) -> &'a mut W {
134        self.w.bits = (self.w.bits & !(1 << 23)) | ((value as u32 & 1) << 23);
135        self.w
136    }
137}
138#[doc = "Field `rx_flow_thrhd` reader - The config bits for rx flow control threshold,0-127"]
139pub struct RX_FLOW_THRHD_R(crate::FieldReader<u8, u8>);
140impl RX_FLOW_THRHD_R {
141    #[inline(always)]
142    pub(crate) fn new(bits: u8) -> Self {
143        RX_FLOW_THRHD_R(crate::FieldReader::new(bits))
144    }
145}
146impl core::ops::Deref for RX_FLOW_THRHD_R {
147    type Target = crate::FieldReader<u8, u8>;
148    #[inline(always)]
149    fn deref(&self) -> &Self::Target {
150        &self.0
151    }
152}
153#[doc = "Field `rx_flow_thrhd` writer - The config bits for rx flow control threshold,0-127"]
154pub struct RX_FLOW_THRHD_W<'a> {
155    w: &'a mut W,
156}
157impl<'a> RX_FLOW_THRHD_W<'a> {
158    #[doc = r"Writes raw bits to the field"]
159    #[inline(always)]
160    pub unsafe fn bits(self, value: u8) -> &'a mut W {
161        self.w.bits = (self.w.bits & !(0x7f << 16)) | ((value as u32 & 0x7f) << 16);
162        self.w
163    }
164}
165#[doc = "Field `txfifo_empty_thrhd` reader - The config bits for tx fifo empty threshold,0-127"]
166pub struct TXFIFO_EMPTY_THRHD_R(crate::FieldReader<u8, u8>);
167impl TXFIFO_EMPTY_THRHD_R {
168    #[inline(always)]
169    pub(crate) fn new(bits: u8) -> Self {
170        TXFIFO_EMPTY_THRHD_R(crate::FieldReader::new(bits))
171    }
172}
173impl core::ops::Deref for TXFIFO_EMPTY_THRHD_R {
174    type Target = crate::FieldReader<u8, u8>;
175    #[inline(always)]
176    fn deref(&self) -> &Self::Target {
177        &self.0
178    }
179}
180#[doc = "Field `txfifo_empty_thrhd` writer - The config bits for tx fifo empty threshold,0-127"]
181pub struct TXFIFO_EMPTY_THRHD_W<'a> {
182    w: &'a mut W,
183}
184impl<'a> TXFIFO_EMPTY_THRHD_W<'a> {
185    #[doc = r"Writes raw bits to the field"]
186    #[inline(always)]
187    pub unsafe fn bits(self, value: u8) -> &'a mut W {
188        self.w.bits = (self.w.bits & !(0x7f << 8)) | ((value as u32 & 0x7f) << 8);
189        self.w
190    }
191}
192#[doc = "Field `rxfifo_full_thrhd` reader - The config bits for rx fifo full threshold,0-127"]
193pub struct RXFIFO_FULL_THRHD_R(crate::FieldReader<u8, u8>);
194impl RXFIFO_FULL_THRHD_R {
195    #[inline(always)]
196    pub(crate) fn new(bits: u8) -> Self {
197        RXFIFO_FULL_THRHD_R(crate::FieldReader::new(bits))
198    }
199}
200impl core::ops::Deref for RXFIFO_FULL_THRHD_R {
201    type Target = crate::FieldReader<u8, u8>;
202    #[inline(always)]
203    fn deref(&self) -> &Self::Target {
204        &self.0
205    }
206}
207#[doc = "Field `rxfifo_full_thrhd` writer - The config bits for rx fifo full threshold,0-127"]
208pub struct RXFIFO_FULL_THRHD_W<'a> {
209    w: &'a mut W,
210}
211impl<'a> RXFIFO_FULL_THRHD_W<'a> {
212    #[doc = r"Writes raw bits to the field"]
213    #[inline(always)]
214    pub unsafe fn bits(self, value: u8) -> &'a mut W {
215        self.w.bits = (self.w.bits & !0x7f) | (value as u32 & 0x7f);
216        self.w
217    }
218}
219impl R {
220    #[doc = "Bit 31 - Set this bit to enable rx time-out function"]
221    #[inline(always)]
222    pub fn rx_tout_en(&self) -> RX_TOUT_EN_R {
223        RX_TOUT_EN_R::new(((self.bits >> 31) & 1) != 0)
224    }
225    #[doc = "Bits 24:30 - Config bits for rx time-out threshold,uint: byte,0-127"]
226    #[inline(always)]
227    pub fn rx_tout_thrhd(&self) -> RX_TOUT_THRHD_R {
228        RX_TOUT_THRHD_R::new(((self.bits >> 24) & 0x7f) as u8)
229    }
230    #[doc = "Bit 23 - Set this bit to enable rx hardware flow control"]
231    #[inline(always)]
232    pub fn rx_flow_en(&self) -> RX_FLOW_EN_R {
233        RX_FLOW_EN_R::new(((self.bits >> 23) & 1) != 0)
234    }
235    #[doc = "Bits 16:22 - The config bits for rx flow control threshold,0-127"]
236    #[inline(always)]
237    pub fn rx_flow_thrhd(&self) -> RX_FLOW_THRHD_R {
238        RX_FLOW_THRHD_R::new(((self.bits >> 16) & 0x7f) as u8)
239    }
240    #[doc = "Bits 8:14 - The config bits for tx fifo empty threshold,0-127"]
241    #[inline(always)]
242    pub fn txfifo_empty_thrhd(&self) -> TXFIFO_EMPTY_THRHD_R {
243        TXFIFO_EMPTY_THRHD_R::new(((self.bits >> 8) & 0x7f) as u8)
244    }
245    #[doc = "Bits 0:6 - The config bits for rx fifo full threshold,0-127"]
246    #[inline(always)]
247    pub fn rxfifo_full_thrhd(&self) -> RXFIFO_FULL_THRHD_R {
248        RXFIFO_FULL_THRHD_R::new((self.bits & 0x7f) as u8)
249    }
250}
251impl W {
252    #[doc = "Bit 31 - Set this bit to enable rx time-out function"]
253    #[inline(always)]
254    pub fn rx_tout_en(&mut self) -> RX_TOUT_EN_W {
255        RX_TOUT_EN_W { w: self }
256    }
257    #[doc = "Bits 24:30 - Config bits for rx time-out threshold,uint: byte,0-127"]
258    #[inline(always)]
259    pub fn rx_tout_thrhd(&mut self) -> RX_TOUT_THRHD_W {
260        RX_TOUT_THRHD_W { w: self }
261    }
262    #[doc = "Bit 23 - Set this bit to enable rx hardware flow control"]
263    #[inline(always)]
264    pub fn rx_flow_en(&mut self) -> RX_FLOW_EN_W {
265        RX_FLOW_EN_W { w: self }
266    }
267    #[doc = "Bits 16:22 - The config bits for rx flow control threshold,0-127"]
268    #[inline(always)]
269    pub fn rx_flow_thrhd(&mut self) -> RX_FLOW_THRHD_W {
270        RX_FLOW_THRHD_W { w: self }
271    }
272    #[doc = "Bits 8:14 - The config bits for tx fifo empty threshold,0-127"]
273    #[inline(always)]
274    pub fn txfifo_empty_thrhd(&mut self) -> TXFIFO_EMPTY_THRHD_W {
275        TXFIFO_EMPTY_THRHD_W { w: self }
276    }
277    #[doc = "Bits 0:6 - The config bits for rx fifo full threshold,0-127"]
278    #[inline(always)]
279    pub fn rxfifo_full_thrhd(&mut self) -> RXFIFO_FULL_THRHD_W {
280        RXFIFO_FULL_THRHD_W { w: self }
281    }
282    #[doc = "Writes raw bits to the register."]
283    #[inline(always)]
284    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
285        self.0.bits(bits);
286        self
287    }
288}
289#[doc = "Set this bit to enable rx time-out function\n\nThis register you can [`read`]
290(crate::generic::Reg::read), [`write_with_zero`]
291(crate::generic::Reg::write_with_zero), [`reset`]
292(crate::generic::Reg::reset), [`write`]
293(crate::generic::Reg::write), [`modify`]
294(crate::generic::Reg::modify). See [API]
295(https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [uart_conf1]
296(index.html) module"]
297pub struct UART_CONF1_SPEC;
298impl crate::RegisterSpec for UART_CONF1_SPEC {
299    type Ux = u32;
300}
301#[doc = "`read()` method returns [uart_conf1::R]
302(R) reader structure"]
303impl crate::Readable for UART_CONF1_SPEC {
304    type Reader = R;
305}
306#[doc = "`write(|w| ..)` method takes [uart_conf1::W]
307(W) writer structure"]
308impl crate::Writable for UART_CONF1_SPEC {
309    type Writer = W;
310}
311#[doc = "`reset()` method sets UART_CONF1 to value 0"]
312impl crate::Resettable for UART_CONF1_SPEC {
313    #[inline(always)]
314    fn reset_value() -> Self::Ux {
315        0
316    }
317}