1#[doc = "Register `CR3` reader"]
2pub struct R(crate::R<CR3_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR3_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR3_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR3_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CR3` writer"]
17pub struct W(crate::W<CR3_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR3_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<CR3_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR3_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Error interrupt enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum EIE_A {
40 #[doc = "0: Error interrupt disabled"]
41 Disabled = 0,
42 #[doc = "1: Error interrupt enabled"]
43 Enabled = 1,
44}
45impl From<EIE_A> for bool {
46 #[inline(always)]
47 fn from(variant: EIE_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `EIE` reader - Error interrupt enable"]
52pub type EIE_R = crate::BitReader<EIE_A>;
53impl EIE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> EIE_A {
57 match self.bits {
58 false => EIE_A::Disabled,
59 true => EIE_A::Enabled,
60 }
61 }
62 #[doc = "Checks if the value of the field is `Disabled`"]
63 #[inline(always)]
64 pub fn is_disabled(&self) -> bool {
65 *self == EIE_A::Disabled
66 }
67 #[doc = "Checks if the value of the field is `Enabled`"]
68 #[inline(always)]
69 pub fn is_enabled(&self) -> bool {
70 *self == EIE_A::Enabled
71 }
72}
73#[doc = "Field `EIE` writer - Error interrupt enable"]
74pub type EIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR3_SPEC, EIE_A, O>;
75impl<'a, const O: u8> EIE_W<'a, O> {
76 #[doc = "Error interrupt disabled"]
77 #[inline(always)]
78 pub fn disabled(self) -> &'a mut W {
79 self.variant(EIE_A::Disabled)
80 }
81 #[doc = "Error interrupt enabled"]
82 #[inline(always)]
83 pub fn enabled(self) -> &'a mut W {
84 self.variant(EIE_A::Enabled)
85 }
86}
87#[doc = "IrDA mode enable\n\nValue on reset: 0"]
88#[derive(Clone, Copy, Debug, PartialEq)]
89pub enum IREN_A {
90 #[doc = "0: IrDA disabled"]
91 Disabled = 0,
92 #[doc = "1: IrDA enabled"]
93 Enabled = 1,
94}
95impl From<IREN_A> for bool {
96 #[inline(always)]
97 fn from(variant: IREN_A) -> Self {
98 variant as u8 != 0
99 }
100}
101#[doc = "Field `IREN` reader - IrDA mode enable"]
102pub type IREN_R = crate::BitReader<IREN_A>;
103impl IREN_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> IREN_A {
107 match self.bits {
108 false => IREN_A::Disabled,
109 true => IREN_A::Enabled,
110 }
111 }
112 #[doc = "Checks if the value of the field is `Disabled`"]
113 #[inline(always)]
114 pub fn is_disabled(&self) -> bool {
115 *self == IREN_A::Disabled
116 }
117 #[doc = "Checks if the value of the field is `Enabled`"]
118 #[inline(always)]
119 pub fn is_enabled(&self) -> bool {
120 *self == IREN_A::Enabled
121 }
122}
123#[doc = "Field `IREN` writer - IrDA mode enable"]
124pub type IREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR3_SPEC, IREN_A, O>;
125impl<'a, const O: u8> IREN_W<'a, O> {
126 #[doc = "IrDA disabled"]
127 #[inline(always)]
128 pub fn disabled(self) -> &'a mut W {
129 self.variant(IREN_A::Disabled)
130 }
131 #[doc = "IrDA enabled"]
132 #[inline(always)]
133 pub fn enabled(self) -> &'a mut W {
134 self.variant(IREN_A::Enabled)
135 }
136}
137#[doc = "IrDA low-power\n\nValue on reset: 0"]
138#[derive(Clone, Copy, Debug, PartialEq)]
139pub enum IRLP_A {
140 #[doc = "0: Normal mode"]
141 Normal = 0,
142 #[doc = "1: Low-power mode"]
143 LowPower = 1,
144}
145impl From<IRLP_A> for bool {
146 #[inline(always)]
147 fn from(variant: IRLP_A) -> Self {
148 variant as u8 != 0
149 }
150}
151#[doc = "Field `IRLP` reader - IrDA low-power"]
152pub type IRLP_R = crate::BitReader<IRLP_A>;
153impl IRLP_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> IRLP_A {
157 match self.bits {
158 false => IRLP_A::Normal,
159 true => IRLP_A::LowPower,
160 }
161 }
162 #[doc = "Checks if the value of the field is `Normal`"]
163 #[inline(always)]
164 pub fn is_normal(&self) -> bool {
165 *self == IRLP_A::Normal
166 }
167 #[doc = "Checks if the value of the field is `LowPower`"]
168 #[inline(always)]
169 pub fn is_low_power(&self) -> bool {
170 *self == IRLP_A::LowPower
171 }
172}
173#[doc = "Field `IRLP` writer - IrDA low-power"]
174pub type IRLP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR3_SPEC, IRLP_A, O>;
175impl<'a, const O: u8> IRLP_W<'a, O> {
176 #[doc = "Normal mode"]
177 #[inline(always)]
178 pub fn normal(self) -> &'a mut W {
179 self.variant(IRLP_A::Normal)
180 }
181 #[doc = "Low-power mode"]
182 #[inline(always)]
183 pub fn low_power(self) -> &'a mut W {
184 self.variant(IRLP_A::LowPower)
185 }
186}
187#[doc = "Half-duplex selection\n\nValue on reset: 0"]
188#[derive(Clone, Copy, Debug, PartialEq)]
189pub enum HDSEL_A {
190 #[doc = "0: Half duplex mode is not selected"]
191 FullDuplex = 0,
192 #[doc = "1: Half duplex mode is selected"]
193 HalfDuplex = 1,
194}
195impl From<HDSEL_A> for bool {
196 #[inline(always)]
197 fn from(variant: HDSEL_A) -> Self {
198 variant as u8 != 0
199 }
200}
201#[doc = "Field `HDSEL` reader - Half-duplex selection"]
202pub type HDSEL_R = crate::BitReader<HDSEL_A>;
203impl HDSEL_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> HDSEL_A {
207 match self.bits {
208 false => HDSEL_A::FullDuplex,
209 true => HDSEL_A::HalfDuplex,
210 }
211 }
212 #[doc = "Checks if the value of the field is `FullDuplex`"]
213 #[inline(always)]
214 pub fn is_full_duplex(&self) -> bool {
215 *self == HDSEL_A::FullDuplex
216 }
217 #[doc = "Checks if the value of the field is `HalfDuplex`"]
218 #[inline(always)]
219 pub fn is_half_duplex(&self) -> bool {
220 *self == HDSEL_A::HalfDuplex
221 }
222}
223#[doc = "Field `HDSEL` writer - Half-duplex selection"]
224pub type HDSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR3_SPEC, HDSEL_A, O>;
225impl<'a, const O: u8> HDSEL_W<'a, O> {
226 #[doc = "Half duplex mode is not selected"]
227 #[inline(always)]
228 pub fn full_duplex(self) -> &'a mut W {
229 self.variant(HDSEL_A::FullDuplex)
230 }
231 #[doc = "Half duplex mode is selected"]
232 #[inline(always)]
233 pub fn half_duplex(self) -> &'a mut W {
234 self.variant(HDSEL_A::HalfDuplex)
235 }
236}
237#[doc = "DMA enable receiver\n\nValue on reset: 0"]
238#[derive(Clone, Copy, Debug, PartialEq)]
239pub enum DMAR_A {
240 #[doc = "0: DMA mode is disabled for reception"]
241 Disabled = 0,
242 #[doc = "1: DMA mode is enabled for reception"]
243 Enabled = 1,
244}
245impl From<DMAR_A> for bool {
246 #[inline(always)]
247 fn from(variant: DMAR_A) -> Self {
248 variant as u8 != 0
249 }
250}
251#[doc = "Field `DMAR` reader - DMA enable receiver"]
252pub type DMAR_R = crate::BitReader<DMAR_A>;
253impl DMAR_R {
254 #[doc = "Get enumerated values variant"]
255 #[inline(always)]
256 pub fn variant(&self) -> DMAR_A {
257 match self.bits {
258 false => DMAR_A::Disabled,
259 true => DMAR_A::Enabled,
260 }
261 }
262 #[doc = "Checks if the value of the field is `Disabled`"]
263 #[inline(always)]
264 pub fn is_disabled(&self) -> bool {
265 *self == DMAR_A::Disabled
266 }
267 #[doc = "Checks if the value of the field is `Enabled`"]
268 #[inline(always)]
269 pub fn is_enabled(&self) -> bool {
270 *self == DMAR_A::Enabled
271 }
272}
273#[doc = "Field `DMAR` writer - DMA enable receiver"]
274pub type DMAR_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR3_SPEC, DMAR_A, O>;
275impl<'a, const O: u8> DMAR_W<'a, O> {
276 #[doc = "DMA mode is disabled for reception"]
277 #[inline(always)]
278 pub fn disabled(self) -> &'a mut W {
279 self.variant(DMAR_A::Disabled)
280 }
281 #[doc = "DMA mode is enabled for reception"]
282 #[inline(always)]
283 pub fn enabled(self) -> &'a mut W {
284 self.variant(DMAR_A::Enabled)
285 }
286}
287#[doc = "DMA enable transmitter\n\nValue on reset: 0"]
288#[derive(Clone, Copy, Debug, PartialEq)]
289pub enum DMAT_A {
290 #[doc = "0: DMA mode is disabled for transmission"]
291 Disabled = 0,
292 #[doc = "1: DMA mode is enabled for transmission"]
293 Enabled = 1,
294}
295impl From<DMAT_A> for bool {
296 #[inline(always)]
297 fn from(variant: DMAT_A) -> Self {
298 variant as u8 != 0
299 }
300}
301#[doc = "Field `DMAT` reader - DMA enable transmitter"]
302pub type DMAT_R = crate::BitReader<DMAT_A>;
303impl DMAT_R {
304 #[doc = "Get enumerated values variant"]
305 #[inline(always)]
306 pub fn variant(&self) -> DMAT_A {
307 match self.bits {
308 false => DMAT_A::Disabled,
309 true => DMAT_A::Enabled,
310 }
311 }
312 #[doc = "Checks if the value of the field is `Disabled`"]
313 #[inline(always)]
314 pub fn is_disabled(&self) -> bool {
315 *self == DMAT_A::Disabled
316 }
317 #[doc = "Checks if the value of the field is `Enabled`"]
318 #[inline(always)]
319 pub fn is_enabled(&self) -> bool {
320 *self == DMAT_A::Enabled
321 }
322}
323#[doc = "Field `DMAT` writer - DMA enable transmitter"]
324pub type DMAT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR3_SPEC, DMAT_A, O>;
325impl<'a, const O: u8> DMAT_W<'a, O> {
326 #[doc = "DMA mode is disabled for transmission"]
327 #[inline(always)]
328 pub fn disabled(self) -> &'a mut W {
329 self.variant(DMAT_A::Disabled)
330 }
331 #[doc = "DMA mode is enabled for transmission"]
332 #[inline(always)]
333 pub fn enabled(self) -> &'a mut W {
334 self.variant(DMAT_A::Enabled)
335 }
336}
337impl R {
338 #[doc = "Bit 0 - Error interrupt enable"]
339 #[inline(always)]
340 pub fn eie(&self) -> EIE_R {
341 EIE_R::new((self.bits & 1) != 0)
342 }
343 #[doc = "Bit 1 - IrDA mode enable"]
344 #[inline(always)]
345 pub fn iren(&self) -> IREN_R {
346 IREN_R::new(((self.bits >> 1) & 1) != 0)
347 }
348 #[doc = "Bit 2 - IrDA low-power"]
349 #[inline(always)]
350 pub fn irlp(&self) -> IRLP_R {
351 IRLP_R::new(((self.bits >> 2) & 1) != 0)
352 }
353 #[doc = "Bit 3 - Half-duplex selection"]
354 #[inline(always)]
355 pub fn hdsel(&self) -> HDSEL_R {
356 HDSEL_R::new(((self.bits >> 3) & 1) != 0)
357 }
358 #[doc = "Bit 6 - DMA enable receiver"]
359 #[inline(always)]
360 pub fn dmar(&self) -> DMAR_R {
361 DMAR_R::new(((self.bits >> 6) & 1) != 0)
362 }
363 #[doc = "Bit 7 - DMA enable transmitter"]
364 #[inline(always)]
365 pub fn dmat(&self) -> DMAT_R {
366 DMAT_R::new(((self.bits >> 7) & 1) != 0)
367 }
368}
369impl W {
370 #[doc = "Bit 0 - Error interrupt enable"]
371 #[inline(always)]
372 pub fn eie(&mut self) -> EIE_W<0> {
373 EIE_W::new(self)
374 }
375 #[doc = "Bit 1 - IrDA mode enable"]
376 #[inline(always)]
377 pub fn iren(&mut self) -> IREN_W<1> {
378 IREN_W::new(self)
379 }
380 #[doc = "Bit 2 - IrDA low-power"]
381 #[inline(always)]
382 pub fn irlp(&mut self) -> IRLP_W<2> {
383 IRLP_W::new(self)
384 }
385 #[doc = "Bit 3 - Half-duplex selection"]
386 #[inline(always)]
387 pub fn hdsel(&mut self) -> HDSEL_W<3> {
388 HDSEL_W::new(self)
389 }
390 #[doc = "Bit 6 - DMA enable receiver"]
391 #[inline(always)]
392 pub fn dmar(&mut self) -> DMAR_W<6> {
393 DMAR_W::new(self)
394 }
395 #[doc = "Bit 7 - DMA enable transmitter"]
396 #[inline(always)]
397 pub fn dmat(&mut self) -> DMAT_W<7> {
398 DMAT_W::new(self)
399 }
400 #[doc = "Writes raw bits to the register."]
401 #[inline(always)]
402 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
403 self.0.bits(bits);
404 self
405 }
406}
407#[doc = "UART4 CR3\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 [cr3](index.html) module"]
408pub struct CR3_SPEC;
409impl crate::RegisterSpec for CR3_SPEC {
410 type Ux = u32;
411}
412#[doc = "`read()` method returns [cr3::R](R) reader structure"]
413impl crate::Readable for CR3_SPEC {
414 type Reader = R;
415}
416#[doc = "`write(|w| ..)` method takes [cr3::W](W) writer structure"]
417impl crate::Writable for CR3_SPEC {
418 type Writer = W;
419}
420#[doc = "`reset()` method sets CR3 to value 0"]
421impl crate::Resettable for CR3_SPEC {
422 #[inline(always)]
423 fn reset_value() -> Self::Ux {
424 0
425 }
426}