swm341_pac/uart0/
baud.rs

1#[doc = "Register `BAUD` reader"]
2pub struct R(crate::R<BAUD_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<BAUD_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<BAUD_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<BAUD_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `BAUD` writer"]
17pub struct W(crate::W<BAUD_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<BAUD_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<BAUD_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<BAUD_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `BAUD` reader - BAUD field"]
38pub type BAUD_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `BAUD` writer - BAUD field"]
40pub type BAUD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BAUD_SPEC, u16, u16, 14, O>;
41#[doc = "Field `TXD` reader - TXD field"]
42pub type TXD_R = crate::BitReader<bool>;
43#[doc = "Field `TXD` writer - TXD field"]
44pub type TXD_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
45#[doc = "Field `RXD` reader - RXD field"]
46pub type RXD_R = crate::BitReader<bool>;
47#[doc = "Field `RXD` writer - RXD field"]
48pub type RXD_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
49#[doc = "Field `RXTOIF` reader - RXTOIF field"]
50pub type RXTOIF_R = crate::BitReader<bool>;
51#[doc = "Field `RXTOIF` writer - RXTOIF field"]
52pub type RXTOIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
53#[doc = "Field `TXIF` reader - TXIF field"]
54pub type TXIF_R = crate::BitReader<bool>;
55#[doc = "Field `TXIF` writer - TXIF field"]
56pub type TXIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
57#[doc = "Field `RXTHRF` reader - RXTHRF field"]
58pub type RXTHRF_R = crate::BitReader<bool>;
59#[doc = "Field `RXTHRF` writer - RXTHRF field"]
60pub type RXTHRF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
61#[doc = "Field `TXTHRF` reader - TXTHRF field"]
62pub type TXTHRF_R = crate::BitReader<bool>;
63#[doc = "Field `TXTHRF` writer - TXTHRF field"]
64pub type TXTHRF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
65#[doc = "Field `TOIF` reader - TOIF field"]
66pub type TOIF_R = crate::BitReader<bool>;
67#[doc = "Field `TOIF` writer - TOIF field"]
68pub type TOIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
69#[doc = "Field `RXIF` reader - RXIF field"]
70pub type RXIF_R = crate::BitReader<bool>;
71#[doc = "Field `RXIF` writer - RXIF field"]
72pub type RXIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
73#[doc = "Field `ABREN` reader - ABREN field"]
74pub type ABREN_R = crate::BitReader<bool>;
75#[doc = "Field `ABREN` writer - ABREN field"]
76pub type ABREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
77#[doc = "Field `ABRBIT` reader - ABRBIT field"]
78pub type ABRBIT_R = crate::FieldReader<u8, u8>;
79#[doc = "Field `ABRBIT` writer - ABRBIT field"]
80pub type ABRBIT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BAUD_SPEC, u8, u8, 2, O>;
81#[doc = "Field `ABRERR` reader - ABRERR field"]
82pub type ABRERR_R = crate::BitReader<bool>;
83#[doc = "Field `ABRERR` writer - ABRERR field"]
84pub type ABRERR_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
85#[doc = "Field `TXDOIF` reader - TXDOIF field"]
86pub type TXDOIF_R = crate::BitReader<bool>;
87#[doc = "Field `TXDOIF` writer - TXDOIF field"]
88pub type TXDOIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, BAUD_SPEC, bool, O>;
89#[doc = "Field `FRAC` reader - FRAC field"]
90pub type FRAC_R = crate::FieldReader<u8, u8>;
91#[doc = "Field `FRAC` writer - FRAC field"]
92pub type FRAC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BAUD_SPEC, u8, u8, 4, O>;
93impl R {
94    #[doc = "Bits 0:13 - BAUD field"]
95    #[inline(always)]
96    pub fn baud(&self) -> BAUD_R {
97        BAUD_R::new((self.bits & 0x3fff) as u16)
98    }
99    #[doc = "Bit 14 - TXD field"]
100    #[inline(always)]
101    pub fn txd(&self) -> TXD_R {
102        TXD_R::new(((self.bits >> 14) & 1) != 0)
103    }
104    #[doc = "Bit 15 - RXD field"]
105    #[inline(always)]
106    pub fn rxd(&self) -> RXD_R {
107        RXD_R::new(((self.bits >> 15) & 1) != 0)
108    }
109    #[doc = "Bit 16 - RXTOIF field"]
110    #[inline(always)]
111    pub fn rxtoif(&self) -> RXTOIF_R {
112        RXTOIF_R::new(((self.bits >> 16) & 1) != 0)
113    }
114    #[doc = "Bit 17 - TXIF field"]
115    #[inline(always)]
116    pub fn txif(&self) -> TXIF_R {
117        TXIF_R::new(((self.bits >> 17) & 1) != 0)
118    }
119    #[doc = "Bit 19 - RXTHRF field"]
120    #[inline(always)]
121    pub fn rxthrf(&self) -> RXTHRF_R {
122        RXTHRF_R::new(((self.bits >> 19) & 1) != 0)
123    }
124    #[doc = "Bit 20 - TXTHRF field"]
125    #[inline(always)]
126    pub fn txthrf(&self) -> TXTHRF_R {
127        TXTHRF_R::new(((self.bits >> 20) & 1) != 0)
128    }
129    #[doc = "Bit 21 - TOIF field"]
130    #[inline(always)]
131    pub fn toif(&self) -> TOIF_R {
132        TOIF_R::new(((self.bits >> 21) & 1) != 0)
133    }
134    #[doc = "Bit 22 - RXIF field"]
135    #[inline(always)]
136    pub fn rxif(&self) -> RXIF_R {
137        RXIF_R::new(((self.bits >> 22) & 1) != 0)
138    }
139    #[doc = "Bit 23 - ABREN field"]
140    #[inline(always)]
141    pub fn abren(&self) -> ABREN_R {
142        ABREN_R::new(((self.bits >> 23) & 1) != 0)
143    }
144    #[doc = "Bits 24:25 - ABRBIT field"]
145    #[inline(always)]
146    pub fn abrbit(&self) -> ABRBIT_R {
147        ABRBIT_R::new(((self.bits >> 24) & 3) as u8)
148    }
149    #[doc = "Bit 26 - ABRERR field"]
150    #[inline(always)]
151    pub fn abrerr(&self) -> ABRERR_R {
152        ABRERR_R::new(((self.bits >> 26) & 1) != 0)
153    }
154    #[doc = "Bit 27 - TXDOIF field"]
155    #[inline(always)]
156    pub fn txdoif(&self) -> TXDOIF_R {
157        TXDOIF_R::new(((self.bits >> 27) & 1) != 0)
158    }
159    #[doc = "Bits 28:31 - FRAC field"]
160    #[inline(always)]
161    pub fn frac(&self) -> FRAC_R {
162        FRAC_R::new(((self.bits >> 28) & 0x0f) as u8)
163    }
164}
165impl W {
166    #[doc = "Bits 0:13 - BAUD field"]
167    #[inline(always)]
168    pub fn baud(&mut self) -> BAUD_W<0> {
169        BAUD_W::new(self)
170    }
171    #[doc = "Bit 14 - TXD field"]
172    #[inline(always)]
173    pub fn txd(&mut self) -> TXD_W<14> {
174        TXD_W::new(self)
175    }
176    #[doc = "Bit 15 - RXD field"]
177    #[inline(always)]
178    pub fn rxd(&mut self) -> RXD_W<15> {
179        RXD_W::new(self)
180    }
181    #[doc = "Bit 16 - RXTOIF field"]
182    #[inline(always)]
183    pub fn rxtoif(&mut self) -> RXTOIF_W<16> {
184        RXTOIF_W::new(self)
185    }
186    #[doc = "Bit 17 - TXIF field"]
187    #[inline(always)]
188    pub fn txif(&mut self) -> TXIF_W<17> {
189        TXIF_W::new(self)
190    }
191    #[doc = "Bit 19 - RXTHRF field"]
192    #[inline(always)]
193    pub fn rxthrf(&mut self) -> RXTHRF_W<19> {
194        RXTHRF_W::new(self)
195    }
196    #[doc = "Bit 20 - TXTHRF field"]
197    #[inline(always)]
198    pub fn txthrf(&mut self) -> TXTHRF_W<20> {
199        TXTHRF_W::new(self)
200    }
201    #[doc = "Bit 21 - TOIF field"]
202    #[inline(always)]
203    pub fn toif(&mut self) -> TOIF_W<21> {
204        TOIF_W::new(self)
205    }
206    #[doc = "Bit 22 - RXIF field"]
207    #[inline(always)]
208    pub fn rxif(&mut self) -> RXIF_W<22> {
209        RXIF_W::new(self)
210    }
211    #[doc = "Bit 23 - ABREN field"]
212    #[inline(always)]
213    pub fn abren(&mut self) -> ABREN_W<23> {
214        ABREN_W::new(self)
215    }
216    #[doc = "Bits 24:25 - ABRBIT field"]
217    #[inline(always)]
218    pub fn abrbit(&mut self) -> ABRBIT_W<24> {
219        ABRBIT_W::new(self)
220    }
221    #[doc = "Bit 26 - ABRERR field"]
222    #[inline(always)]
223    pub fn abrerr(&mut self) -> ABRERR_W<26> {
224        ABRERR_W::new(self)
225    }
226    #[doc = "Bit 27 - TXDOIF field"]
227    #[inline(always)]
228    pub fn txdoif(&mut self) -> TXDOIF_W<27> {
229        TXDOIF_W::new(self)
230    }
231    #[doc = "Bits 28:31 - FRAC field"]
232    #[inline(always)]
233    pub fn frac(&mut self) -> FRAC_W<28> {
234        FRAC_W::new(self)
235    }
236    #[doc = "Writes raw bits to the register."]
237    #[inline(always)]
238    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
239        self.0.bits(bits);
240        self
241    }
242}
243#[doc = "BAUD register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [baud](index.html) module"]
244pub struct BAUD_SPEC;
245impl crate::RegisterSpec for BAUD_SPEC {
246    type Ux = u32;
247}
248#[doc = "`read()` method returns [baud::R](R) reader structure"]
249impl crate::Readable for BAUD_SPEC {
250    type Reader = R;
251}
252#[doc = "`write(|w| ..)` method takes [baud::W](W) writer structure"]
253impl crate::Writable for BAUD_SPEC {
254    type Writer = W;
255}
256#[doc = "`reset()` method sets BAUD to value 0"]
257impl crate::Resettable for BAUD_SPEC {
258    #[inline(always)]
259    fn reset_value() -> Self::Ux {
260        0
261    }
262}