swm341_pac/uart0/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TXIDLE` reader - TXIDLE field"]
38pub type TXIDLE_R = crate::BitReader<bool>;
39#[doc = "Field `TXIDLE` writer - TXIDLE field"]
40pub type TXIDLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
41#[doc = "Field `TXFF` reader - TXFF field"]
42pub type TXFF_R = crate::BitReader<bool>;
43#[doc = "Field `TXFF` writer - TXFF field"]
44pub type TXFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
45#[doc = "Field `TXIE` reader - TXIE field"]
46pub type TXIE_R = crate::BitReader<bool>;
47#[doc = "Field `TXIE` writer - TXIE field"]
48pub type TXIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
49#[doc = "Field `RXNE` reader - RXNE field"]
50pub type RXNE_R = crate::BitReader<bool>;
51#[doc = "Field `RXNE` writer - RXNE field"]
52pub type RXNE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
53#[doc = "Field `RXIE` reader - RXIE field"]
54pub type RXIE_R = crate::BitReader<bool>;
55#[doc = "Field `RXIE` writer - RXIE field"]
56pub type RXIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
57#[doc = "Field `RXOV` reader - RXOV field"]
58pub type RXOV_R = crate::BitReader<bool>;
59#[doc = "Field `RXOV` writer - RXOV field"]
60pub type RXOV_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
61#[doc = "Field `TXDOIE` reader - TXDOIE field"]
62pub type TXDOIE_R = crate::BitReader<bool>;
63#[doc = "Field `TXDOIE` writer - TXDOIE field"]
64pub type TXDOIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
65#[doc = "Field `EN` reader - EN field"]
66pub type EN_R = crate::BitReader<bool>;
67#[doc = "Field `EN` writer - EN field"]
68pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
69#[doc = "Field `LOOP` reader - LOOP field"]
70pub type LOOP_R = crate::BitReader<bool>;
71#[doc = "Field `LOOP` writer - LOOP field"]
72pub type LOOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
73#[doc = "Field `TOIE` reader - TOIE field"]
74pub type TOIE_R = crate::BitReader<bool>;
75#[doc = "Field `TOIE` writer - TOIE field"]
76pub type TOIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
77#[doc = "Field `DATA9b` reader - DATA9b field"]
78pub type DATA9B_R = crate::BitReader<bool>;
79#[doc = "Field `DATA9b` writer - DATA9b field"]
80pub type DATA9B_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
81#[doc = "Field `PARITY` reader - PARITY field"]
82pub type PARITY_R = crate::FieldReader<u8, u8>;
83#[doc = "Field `PARITY` writer - PARITY field"]
84pub type PARITY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 3, O>;
85#[doc = "Field `STOP2b` reader - STOP2b field"]
86pub type STOP2B_R = crate::FieldReader<u8, u8>;
87#[doc = "Field `STOP2b` writer - STOP2b field"]
88pub type STOP2B_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 2, O>;
89impl R {
90    #[doc = "Bit 0 - TXIDLE field"]
91    #[inline(always)]
92    pub fn txidle(&self) -> TXIDLE_R {
93        TXIDLE_R::new((self.bits & 1) != 0)
94    }
95    #[doc = "Bit 1 - TXFF field"]
96    #[inline(always)]
97    pub fn txff(&self) -> TXFF_R {
98        TXFF_R::new(((self.bits >> 1) & 1) != 0)
99    }
100    #[doc = "Bit 2 - TXIE field"]
101    #[inline(always)]
102    pub fn txie(&self) -> TXIE_R {
103        TXIE_R::new(((self.bits >> 2) & 1) != 0)
104    }
105    #[doc = "Bit 3 - RXNE field"]
106    #[inline(always)]
107    pub fn rxne(&self) -> RXNE_R {
108        RXNE_R::new(((self.bits >> 3) & 1) != 0)
109    }
110    #[doc = "Bit 4 - RXIE field"]
111    #[inline(always)]
112    pub fn rxie(&self) -> RXIE_R {
113        RXIE_R::new(((self.bits >> 4) & 1) != 0)
114    }
115    #[doc = "Bit 5 - RXOV field"]
116    #[inline(always)]
117    pub fn rxov(&self) -> RXOV_R {
118        RXOV_R::new(((self.bits >> 5) & 1) != 0)
119    }
120    #[doc = "Bit 6 - TXDOIE field"]
121    #[inline(always)]
122    pub fn txdoie(&self) -> TXDOIE_R {
123        TXDOIE_R::new(((self.bits >> 6) & 1) != 0)
124    }
125    #[doc = "Bit 9 - EN field"]
126    #[inline(always)]
127    pub fn en(&self) -> EN_R {
128        EN_R::new(((self.bits >> 9) & 1) != 0)
129    }
130    #[doc = "Bit 10 - LOOP field"]
131    #[inline(always)]
132    pub fn loop_(&self) -> LOOP_R {
133        LOOP_R::new(((self.bits >> 10) & 1) != 0)
134    }
135    #[doc = "Bit 14 - TOIE field"]
136    #[inline(always)]
137    pub fn toie(&self) -> TOIE_R {
138        TOIE_R::new(((self.bits >> 14) & 1) != 0)
139    }
140    #[doc = "Bit 18 - DATA9b field"]
141    #[inline(always)]
142    pub fn data9b(&self) -> DATA9B_R {
143        DATA9B_R::new(((self.bits >> 18) & 1) != 0)
144    }
145    #[doc = "Bits 19:21 - PARITY field"]
146    #[inline(always)]
147    pub fn parity(&self) -> PARITY_R {
148        PARITY_R::new(((self.bits >> 19) & 7) as u8)
149    }
150    #[doc = "Bits 22:23 - STOP2b field"]
151    #[inline(always)]
152    pub fn stop2b(&self) -> STOP2B_R {
153        STOP2B_R::new(((self.bits >> 22) & 3) as u8)
154    }
155}
156impl W {
157    #[doc = "Bit 0 - TXIDLE field"]
158    #[inline(always)]
159    pub fn txidle(&mut self) -> TXIDLE_W<0> {
160        TXIDLE_W::new(self)
161    }
162    #[doc = "Bit 1 - TXFF field"]
163    #[inline(always)]
164    pub fn txff(&mut self) -> TXFF_W<1> {
165        TXFF_W::new(self)
166    }
167    #[doc = "Bit 2 - TXIE field"]
168    #[inline(always)]
169    pub fn txie(&mut self) -> TXIE_W<2> {
170        TXIE_W::new(self)
171    }
172    #[doc = "Bit 3 - RXNE field"]
173    #[inline(always)]
174    pub fn rxne(&mut self) -> RXNE_W<3> {
175        RXNE_W::new(self)
176    }
177    #[doc = "Bit 4 - RXIE field"]
178    #[inline(always)]
179    pub fn rxie(&mut self) -> RXIE_W<4> {
180        RXIE_W::new(self)
181    }
182    #[doc = "Bit 5 - RXOV field"]
183    #[inline(always)]
184    pub fn rxov(&mut self) -> RXOV_W<5> {
185        RXOV_W::new(self)
186    }
187    #[doc = "Bit 6 - TXDOIE field"]
188    #[inline(always)]
189    pub fn txdoie(&mut self) -> TXDOIE_W<6> {
190        TXDOIE_W::new(self)
191    }
192    #[doc = "Bit 9 - EN field"]
193    #[inline(always)]
194    pub fn en(&mut self) -> EN_W<9> {
195        EN_W::new(self)
196    }
197    #[doc = "Bit 10 - LOOP field"]
198    #[inline(always)]
199    pub fn loop_(&mut self) -> LOOP_W<10> {
200        LOOP_W::new(self)
201    }
202    #[doc = "Bit 14 - TOIE field"]
203    #[inline(always)]
204    pub fn toie(&mut self) -> TOIE_W<14> {
205        TOIE_W::new(self)
206    }
207    #[doc = "Bit 18 - DATA9b field"]
208    #[inline(always)]
209    pub fn data9b(&mut self) -> DATA9B_W<18> {
210        DATA9B_W::new(self)
211    }
212    #[doc = "Bits 19:21 - PARITY field"]
213    #[inline(always)]
214    pub fn parity(&mut self) -> PARITY_W<19> {
215        PARITY_W::new(self)
216    }
217    #[doc = "Bits 22:23 - STOP2b field"]
218    #[inline(always)]
219    pub fn stop2b(&mut self) -> STOP2B_W<22> {
220        STOP2B_W::new(self)
221    }
222    #[doc = "Writes raw bits to the register."]
223    #[inline(always)]
224    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
225        self.0.bits(bits);
226        self
227    }
228}
229#[doc = "CTRL 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 [ctrl](index.html) module"]
230pub struct CTRL_SPEC;
231impl crate::RegisterSpec for CTRL_SPEC {
232    type Ux = u32;
233}
234#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
235impl crate::Readable for CTRL_SPEC {
236    type Reader = R;
237}
238#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
239impl crate::Writable for CTRL_SPEC {
240    type Writer = W;
241}
242#[doc = "`reset()` method sets CTRL to value 0"]
243impl crate::Resettable for CTRL_SPEC {
244    #[inline(always)]
245    fn reset_value() -> Self::Ux {
246        0
247    }
248}