1#[doc = "Register `mcr` reader"]
2pub struct R(crate::R<MCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<MCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<MCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<MCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `mcr` writer"]
17pub struct W(crate::W<MCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<MCR_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<MCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<MCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "UART Function: Select IrDA or RS485\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum FUNCTION_A {
41 #[doc = "0: `0`"]
42 UART = 0,
43 #[doc = "1: `1`"]
44 IR_DA_SIR = 1,
45 #[doc = "2: `10`"]
46 RS485 = 2,
47}
48impl From<FUNCTION_A> for u8 {
49 #[inline(always)]
50 fn from(variant: FUNCTION_A) -> Self {
51 variant as _
52 }
53}
54#[doc = "Field `function` reader - UART Function: Select IrDA or RS485"]
55pub type FUNCTION_R = crate::FieldReader<u8, FUNCTION_A>;
56impl FUNCTION_R {
57 #[doc = "Get enumerated values variant"]
58 #[inline(always)]
59 pub fn variant(&self) -> FUNCTION_A {
60 match self.bits {
61 0 => FUNCTION_A::UART,
62 1 => FUNCTION_A::IR_DA_SIR,
63 2 => FUNCTION_A::RS485,
64 _ => unreachable!(),
65 }
66 }
67 #[doc = "Checks if the value of the field is `UART`"]
68 #[inline(always)]
69 pub fn is_uart(&self) -> bool {
70 *self == FUNCTION_A::UART
71 }
72 #[doc = "Checks if the value of the field is `IR_DA_SIR`"]
73 #[inline(always)]
74 pub fn is_ir_da_sir(&self) -> bool {
75 *self == FUNCTION_A::IR_DA_SIR
76 }
77 #[doc = "Checks if the value of the field is `RS485`"]
78 #[inline(always)]
79 pub fn is_rs485(&self) -> bool {
80 *self == FUNCTION_A::RS485
81 }
82}
83#[doc = "Field `function` writer - UART Function: Select IrDA or RS485"]
84pub type FUNCTION_W<'a, const O: u8> = crate::FieldWriter<'a, u32, MCR_SPEC, u8, FUNCTION_A, 2, O>;
85impl<'a, const O: u8> FUNCTION_W<'a, O> {
86 #[doc = "`0`"]
87 #[inline(always)]
88 pub fn uart(self) -> &'a mut W {
89 self.variant(FUNCTION_A::UART)
90 }
91 #[doc = "`1`"]
92 #[inline(always)]
93 pub fn ir_da_sir(self) -> &'a mut W {
94 self.variant(FUNCTION_A::IR_DA_SIR)
95 }
96 #[doc = "`10`"]
97 #[inline(always)]
98 pub fn rs485(self) -> &'a mut W {
99 self.variant(FUNCTION_A::RS485)
100 }
101}
102#[doc = "Auto Flow Control Enable\n\nValue on reset: 0"]
103#[derive(Clone, Copy, Debug, PartialEq)]
104pub enum AFCE_A {
105 #[doc = "0: `0`"]
106 DISABLED = 0,
107 #[doc = "1: `1`"]
108 ENABLED = 1,
109}
110impl From<AFCE_A> for bool {
111 #[inline(always)]
112 fn from(variant: AFCE_A) -> Self {
113 variant as u8 != 0
114 }
115}
116#[doc = "Field `afce` reader - Auto Flow Control Enable"]
117pub type AFCE_R = crate::BitReader<AFCE_A>;
118impl AFCE_R {
119 #[doc = "Get enumerated values variant"]
120 #[inline(always)]
121 pub fn variant(&self) -> AFCE_A {
122 match self.bits {
123 false => AFCE_A::DISABLED,
124 true => AFCE_A::ENABLED,
125 }
126 }
127 #[doc = "Checks if the value of the field is `DISABLED`"]
128 #[inline(always)]
129 pub fn is_disabled(&self) -> bool {
130 *self == AFCE_A::DISABLED
131 }
132 #[doc = "Checks if the value of the field is `ENABLED`"]
133 #[inline(always)]
134 pub fn is_enabled(&self) -> bool {
135 *self == AFCE_A::ENABLED
136 }
137}
138#[doc = "Field `afce` writer - Auto Flow Control Enable"]
139pub type AFCE_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, AFCE_A, O>;
140impl<'a, const O: u8> AFCE_W<'a, O> {
141 #[doc = "`0`"]
142 #[inline(always)]
143 pub fn disabled(self) -> &'a mut W {
144 self.variant(AFCE_A::DISABLED)
145 }
146 #[doc = "`1`"]
147 #[inline(always)]
148 pub fn enabled(self) -> &'a mut W {
149 self.variant(AFCE_A::ENABLED)
150 }
151}
152#[doc = "Loop Back Mode\n\nValue on reset: 0"]
153#[derive(Clone, Copy, Debug, PartialEq)]
154pub enum LOOP_A {
155 #[doc = "0: `0`"]
156 NORMAL = 0,
157 #[doc = "1: `1`"]
158 LOOP_BACK = 1,
159}
160impl From<LOOP_A> for bool {
161 #[inline(always)]
162 fn from(variant: LOOP_A) -> Self {
163 variant as u8 != 0
164 }
165}
166#[doc = "Field `loop` reader - Loop Back Mode"]
167pub type LOOP_R = crate::BitReader<LOOP_A>;
168impl LOOP_R {
169 #[doc = "Get enumerated values variant"]
170 #[inline(always)]
171 pub fn variant(&self) -> LOOP_A {
172 match self.bits {
173 false => LOOP_A::NORMAL,
174 true => LOOP_A::LOOP_BACK,
175 }
176 }
177 #[doc = "Checks if the value of the field is `NORMAL`"]
178 #[inline(always)]
179 pub fn is_normal(&self) -> bool {
180 *self == LOOP_A::NORMAL
181 }
182 #[doc = "Checks if the value of the field is `LOOP_BACK`"]
183 #[inline(always)]
184 pub fn is_loop_back(&self) -> bool {
185 *self == LOOP_A::LOOP_BACK
186 }
187}
188#[doc = "Field `loop` writer - Loop Back Mode"]
189pub type LOOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, LOOP_A, O>;
190impl<'a, const O: u8> LOOP_W<'a, O> {
191 #[doc = "`0`"]
192 #[inline(always)]
193 pub fn normal(self) -> &'a mut W {
194 self.variant(LOOP_A::NORMAL)
195 }
196 #[doc = "`1`"]
197 #[inline(always)]
198 pub fn loop_back(self) -> &'a mut W {
199 self.variant(LOOP_A::LOOP_BACK)
200 }
201}
202#[doc = "Request to Send\n\nValue on reset: 0"]
203#[derive(Clone, Copy, Debug, PartialEq)]
204pub enum RTS_A {
205 #[doc = "0: `0`"]
206 DEASSERTED = 0,
207 #[doc = "1: `1`"]
208 ASSERTED = 1,
209}
210impl From<RTS_A> for bool {
211 #[inline(always)]
212 fn from(variant: RTS_A) -> Self {
213 variant as u8 != 0
214 }
215}
216#[doc = "Field `rts` reader - Request to Send"]
217pub type RTS_R = crate::BitReader<RTS_A>;
218impl RTS_R {
219 #[doc = "Get enumerated values variant"]
220 #[inline(always)]
221 pub fn variant(&self) -> RTS_A {
222 match self.bits {
223 false => RTS_A::DEASSERTED,
224 true => RTS_A::ASSERTED,
225 }
226 }
227 #[doc = "Checks if the value of the field is `DEASSERTED`"]
228 #[inline(always)]
229 pub fn is_deasserted(&self) -> bool {
230 *self == RTS_A::DEASSERTED
231 }
232 #[doc = "Checks if the value of the field is `ASSERTED`"]
233 #[inline(always)]
234 pub fn is_asserted(&self) -> bool {
235 *self == RTS_A::ASSERTED
236 }
237}
238#[doc = "Field `rts` writer - Request to Send"]
239pub type RTS_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, RTS_A, O>;
240impl<'a, const O: u8> RTS_W<'a, O> {
241 #[doc = "`0`"]
242 #[inline(always)]
243 pub fn deasserted(self) -> &'a mut W {
244 self.variant(RTS_A::DEASSERTED)
245 }
246 #[doc = "`1`"]
247 #[inline(always)]
248 pub fn asserted(self) -> &'a mut W {
249 self.variant(RTS_A::ASSERTED)
250 }
251}
252#[doc = "Data Terminal Ready\n\nValue on reset: 0"]
253#[derive(Clone, Copy, Debug, PartialEq)]
254pub enum DTR_A {
255 #[doc = "0: `0`"]
256 DEASSERTED = 0,
257 #[doc = "1: `1`"]
258 ASSERTED = 1,
259}
260impl From<DTR_A> for bool {
261 #[inline(always)]
262 fn from(variant: DTR_A) -> Self {
263 variant as u8 != 0
264 }
265}
266#[doc = "Field `dtr` reader - Data Terminal Ready"]
267pub type DTR_R = crate::BitReader<DTR_A>;
268impl DTR_R {
269 #[doc = "Get enumerated values variant"]
270 #[inline(always)]
271 pub fn variant(&self) -> DTR_A {
272 match self.bits {
273 false => DTR_A::DEASSERTED,
274 true => DTR_A::ASSERTED,
275 }
276 }
277 #[doc = "Checks if the value of the field is `DEASSERTED`"]
278 #[inline(always)]
279 pub fn is_deasserted(&self) -> bool {
280 *self == DTR_A::DEASSERTED
281 }
282 #[doc = "Checks if the value of the field is `ASSERTED`"]
283 #[inline(always)]
284 pub fn is_asserted(&self) -> bool {
285 *self == DTR_A::ASSERTED
286 }
287}
288#[doc = "Field `dtr` writer - Data Terminal Ready"]
289pub type DTR_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, DTR_A, O>;
290impl<'a, const O: u8> DTR_W<'a, O> {
291 #[doc = "`0`"]
292 #[inline(always)]
293 pub fn deasserted(self) -> &'a mut W {
294 self.variant(DTR_A::DEASSERTED)
295 }
296 #[doc = "`1`"]
297 #[inline(always)]
298 pub fn asserted(self) -> &'a mut W {
299 self.variant(DTR_A::ASSERTED)
300 }
301}
302impl R {
303 #[doc = "Bits 6:7 - UART Function: Select IrDA or RS485"]
304 #[inline(always)]
305 pub fn function(&self) -> FUNCTION_R {
306 FUNCTION_R::new(((self.bits >> 6) & 3) as u8)
307 }
308 #[doc = "Bit 5 - Auto Flow Control Enable"]
309 #[inline(always)]
310 pub fn afce(&self) -> AFCE_R {
311 AFCE_R::new(((self.bits >> 5) & 1) != 0)
312 }
313 #[doc = "Bit 4 - Loop Back Mode"]
314 #[inline(always)]
315 pub fn loop_(&self) -> LOOP_R {
316 LOOP_R::new(((self.bits >> 4) & 1) != 0)
317 }
318 #[doc = "Bit 1 - Request to Send"]
319 #[inline(always)]
320 pub fn rts(&self) -> RTS_R {
321 RTS_R::new(((self.bits >> 1) & 1) != 0)
322 }
323 #[doc = "Bit 0 - Data Terminal Ready"]
324 #[inline(always)]
325 pub fn dtr(&self) -> DTR_R {
326 DTR_R::new((self.bits & 1) != 0)
327 }
328}
329impl W {
330 #[doc = "Bits 6:7 - UART Function: Select IrDA or RS485"]
331 #[inline(always)]
332 pub fn function(&mut self) -> FUNCTION_W<6> {
333 FUNCTION_W::new(self)
334 }
335 #[doc = "Bit 5 - Auto Flow Control Enable"]
336 #[inline(always)]
337 pub fn afce(&mut self) -> AFCE_W<5> {
338 AFCE_W::new(self)
339 }
340 #[doc = "Bit 4 - Loop Back Mode"]
341 #[inline(always)]
342 pub fn loop_(&mut self) -> LOOP_W<4> {
343 LOOP_W::new(self)
344 }
345 #[doc = "Bit 1 - Request to Send"]
346 #[inline(always)]
347 pub fn rts(&mut self) -> RTS_W<1> {
348 RTS_W::new(self)
349 }
350 #[doc = "Bit 0 - Data Terminal Ready"]
351 #[inline(always)]
352 pub fn dtr(&mut self) -> DTR_W<0> {
353 DTR_W::new(self)
354 }
355 #[doc = "Writes raw bits to the register."]
356 #[inline(always)]
357 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
358 self.0.bits(bits);
359 self
360 }
361}
362#[doc = "UART Modem Control 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 [mcr](index.html) module"]
363pub struct MCR_SPEC;
364impl crate::RegisterSpec for MCR_SPEC {
365 type Ux = u32;
366}
367#[doc = "`read()` method returns [mcr::R](R) reader structure"]
368impl crate::Readable for MCR_SPEC {
369 type Reader = R;
370}
371#[doc = "`write(|w| ..)` method takes [mcr::W](W) writer structure"]
372impl crate::Writable for MCR_SPEC {
373 type Writer = W;
374}
375#[doc = "`reset()` method sets mcr to value 0"]
376impl crate::Resettable for MCR_SPEC {
377 #[inline(always)]
378 fn reset_value() -> Self::Ux {
379 0
380 }
381}