esp8266/uart0/
uart_autobaud.rs

1#[doc = "Register `UART_AUTOBAUD` reader"]
2pub struct R(crate::R<UART_AUTOBAUD_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<UART_AUTOBAUD_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<UART_AUTOBAUD_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<UART_AUTOBAUD_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `UART_AUTOBAUD` writer"]
17pub struct W(crate::W<UART_AUTOBAUD_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<UART_AUTOBAUD_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_AUTOBAUD_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<UART_AUTOBAUD_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `glitch_filt` reader - "]
38pub struct GLITCH_FILT_R(crate::FieldReader<u8, u8>);
39impl GLITCH_FILT_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        GLITCH_FILT_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for GLITCH_FILT_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `glitch_filt` writer - "]
53pub struct GLITCH_FILT_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> GLITCH_FILT_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !(0xff << 8)) | ((value as u32 & 0xff) << 8);
61        self.w
62    }
63}
64#[doc = "Field `autobaud_en` reader - Set this bit to enable baudrate detect"]
65pub struct AUTOBAUD_EN_R(crate::FieldReader<bool, bool>);
66impl AUTOBAUD_EN_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: bool) -> Self {
69        AUTOBAUD_EN_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for AUTOBAUD_EN_R {
73    type Target = crate::FieldReader<bool, bool>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `autobaud_en` writer - Set this bit to enable baudrate detect"]
80pub struct AUTOBAUD_EN_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> AUTOBAUD_EN_W<'a> {
84    #[doc = r"Sets the field bit"]
85    #[inline(always)]
86    pub fn set_bit(self) -> &'a mut W {
87        self.bit(true)
88    }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W {
92        self.bit(false)
93    }
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub fn bit(self, value: bool) -> &'a mut W {
97        self.w.bits = (self.w.bits & !1) | (value as u32 & 1);
98        self.w
99    }
100}
101impl R {
102    #[doc = "Bits 8:15"]
103    #[inline(always)]
104    pub fn glitch_filt(&self) -> GLITCH_FILT_R {
105        GLITCH_FILT_R::new(((self.bits >> 8) & 0xff) as u8)
106    }
107    #[doc = "Bit 0 - Set this bit to enable baudrate detect"]
108    #[inline(always)]
109    pub fn autobaud_en(&self) -> AUTOBAUD_EN_R {
110        AUTOBAUD_EN_R::new((self.bits & 1) != 0)
111    }
112}
113impl W {
114    #[doc = "Bits 8:15"]
115    #[inline(always)]
116    pub fn glitch_filt(&mut self) -> GLITCH_FILT_W {
117        GLITCH_FILT_W { w: self }
118    }
119    #[doc = "Bit 0 - Set this bit to enable baudrate detect"]
120    #[inline(always)]
121    pub fn autobaud_en(&mut self) -> AUTOBAUD_EN_W {
122        AUTOBAUD_EN_W { w: self }
123    }
124    #[doc = "Writes raw bits to the register."]
125    #[inline(always)]
126    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
127        self.0.bits(bits);
128        self
129    }
130}
131#[doc = "UART BAUDRATE DETECT REGISTER\n\nThis register you can [`read`]
132(crate::generic::Reg::read), [`write_with_zero`]
133(crate::generic::Reg::write_with_zero), [`reset`]
134(crate::generic::Reg::reset), [`write`]
135(crate::generic::Reg::write), [`modify`]
136(crate::generic::Reg::modify). See [API]
137(https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [uart_autobaud]
138(index.html) module"]
139pub struct UART_AUTOBAUD_SPEC;
140impl crate::RegisterSpec for UART_AUTOBAUD_SPEC {
141    type Ux = u32;
142}
143#[doc = "`read()` method returns [uart_autobaud::R]
144(R) reader structure"]
145impl crate::Readable for UART_AUTOBAUD_SPEC {
146    type Reader = R;
147}
148#[doc = "`write(|w| ..)` method takes [uart_autobaud::W]
149(W) writer structure"]
150impl crate::Writable for UART_AUTOBAUD_SPEC {
151    type Writer = W;
152}
153#[doc = "`reset()` method sets UART_AUTOBAUD to value 0"]
154impl crate::Resettable for UART_AUTOBAUD_SPEC {
155    #[inline(always)]
156    fn reset_value() -> Self::Ux {
157        0
158    }
159}