1#[doc = "Reader of register ACR"]
2pub type R = crate::R<u16, super::ACR>;
3#[doc = "Writer for register ACR"]
4pub type W = crate::W<u16, super::ACR>;
5#[doc = "Register ACR `reset()`'s with value 0"]
6impl crate::ResetValue for super::ACR {
7 type Type = u16;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Auto Baud Enable\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum ABE_A {
16 #[doc = "0: Disable auto baudrate"]
17 DIS_AUTOBAUD = 0,
18 #[doc = "1: Enable auto baudrate"]
19 EN_AUTOBAUD = 1,
20}
21impl From<ABE_A> for bool {
22 #[inline(always)]
23 fn from(variant: ABE_A) -> Self {
24 variant as u8 != 0
25 }
26}
27#[doc = "Reader of field `ABE`"]
28pub type ABE_R = crate::R<bool, ABE_A>;
29impl ABE_R {
30 #[doc = r"Get enumerated values variant"]
31 #[inline(always)]
32 pub fn variant(&self) -> ABE_A {
33 match self.bits {
34 false => ABE_A::DIS_AUTOBAUD,
35 true => ABE_A::EN_AUTOBAUD,
36 }
37 }
38 #[doc = "Checks if the value of the field is `DIS_AUTOBAUD`"]
39 #[inline(always)]
40 pub fn is_dis_autobaud(&self) -> bool {
41 *self == ABE_A::DIS_AUTOBAUD
42 }
43 #[doc = "Checks if the value of the field is `EN_AUTOBAUD`"]
44 #[inline(always)]
45 pub fn is_en_autobaud(&self) -> bool {
46 *self == ABE_A::EN_AUTOBAUD
47 }
48}
49#[doc = "Write proxy for field `ABE`"]
50pub struct ABE_W<'a> {
51 w: &'a mut W,
52}
53impl<'a> ABE_W<'a> {
54 #[doc = r"Writes `variant` to the field"]
55 #[inline(always)]
56 pub fn variant(self, variant: ABE_A) -> &'a mut W {
57 {
58 self.bit(variant.into())
59 }
60 }
61 #[doc = "Disable auto baudrate"]
62 #[inline(always)]
63 pub fn dis_autobaud(self) -> &'a mut W {
64 self.variant(ABE_A::DIS_AUTOBAUD)
65 }
66 #[doc = "Enable auto baudrate"]
67 #[inline(always)]
68 pub fn en_autobaud(self) -> &'a mut W {
69 self.variant(ABE_A::EN_AUTOBAUD)
70 }
71 #[doc = r"Sets the field bit"]
72 #[inline(always)]
73 pub fn set_bit(self) -> &'a mut W {
74 self.bit(true)
75 }
76 #[doc = r"Clears the field bit"]
77 #[inline(always)]
78 pub fn clear_bit(self) -> &'a mut W {
79 self.bit(false)
80 }
81 #[doc = r"Writes raw bits to the field"]
82 #[inline(always)]
83 pub fn bit(self, value: bool) -> &'a mut W {
84 self.w.bits = (self.w.bits & !0x01) | ((value as u16) & 0x01);
85 self.w
86 }
87}
88#[doc = "Enable Done Interrupt\n\nValue on reset: 0"]
89#[derive(Clone, Copy, Debug, PartialEq)]
90pub enum DNIEN_A {
91 #[doc = "0: Disable done interrupt"]
92 DIS_DONEINT = 0,
93 #[doc = "1: Enable done interrupt"]
94 EN_DONEINT = 1,
95}
96impl From<DNIEN_A> for bool {
97 #[inline(always)]
98 fn from(variant: DNIEN_A) -> Self {
99 variant as u8 != 0
100 }
101}
102#[doc = "Reader of field `DNIEN`"]
103pub type DNIEN_R = crate::R<bool, DNIEN_A>;
104impl DNIEN_R {
105 #[doc = r"Get enumerated values variant"]
106 #[inline(always)]
107 pub fn variant(&self) -> DNIEN_A {
108 match self.bits {
109 false => DNIEN_A::DIS_DONEINT,
110 true => DNIEN_A::EN_DONEINT,
111 }
112 }
113 #[doc = "Checks if the value of the field is `DIS_DONEINT`"]
114 #[inline(always)]
115 pub fn is_dis_doneint(&self) -> bool {
116 *self == DNIEN_A::DIS_DONEINT
117 }
118 #[doc = "Checks if the value of the field is `EN_DONEINT`"]
119 #[inline(always)]
120 pub fn is_en_doneint(&self) -> bool {
121 *self == DNIEN_A::EN_DONEINT
122 }
123}
124#[doc = "Write proxy for field `DNIEN`"]
125pub struct DNIEN_W<'a> {
126 w: &'a mut W,
127}
128impl<'a> DNIEN_W<'a> {
129 #[doc = r"Writes `variant` to the field"]
130 #[inline(always)]
131 pub fn variant(self, variant: DNIEN_A) -> &'a mut W {
132 {
133 self.bit(variant.into())
134 }
135 }
136 #[doc = "Disable done interrupt"]
137 #[inline(always)]
138 pub fn dis_doneint(self) -> &'a mut W {
139 self.variant(DNIEN_A::DIS_DONEINT)
140 }
141 #[doc = "Enable done interrupt"]
142 #[inline(always)]
143 pub fn en_doneint(self) -> &'a mut W {
144 self.variant(DNIEN_A::EN_DONEINT)
145 }
146 #[doc = r"Sets the field bit"]
147 #[inline(always)]
148 pub fn set_bit(self) -> &'a mut W {
149 self.bit(true)
150 }
151 #[doc = r"Clears the field bit"]
152 #[inline(always)]
153 pub fn clear_bit(self) -> &'a mut W {
154 self.bit(false)
155 }
156 #[doc = r"Writes raw bits to the field"]
157 #[inline(always)]
158 pub fn bit(self, value: bool) -> &'a mut W {
159 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u16) & 0x01) << 1);
160 self.w
161 }
162}
163#[doc = "Enable Time-out Interrupt\n\nValue on reset: 0"]
164#[derive(Clone, Copy, Debug, PartialEq)]
165pub enum TOIEN_A {
166 #[doc = "0: Disable timeout interrupt"]
167 DIS_TIMEOUTINT = 0,
168 #[doc = "1: Enable timeout interrupt"]
169 EN_TIMEOUTINT = 1,
170}
171impl From<TOIEN_A> for bool {
172 #[inline(always)]
173 fn from(variant: TOIEN_A) -> Self {
174 variant as u8 != 0
175 }
176}
177#[doc = "Reader of field `TOIEN`"]
178pub type TOIEN_R = crate::R<bool, TOIEN_A>;
179impl TOIEN_R {
180 #[doc = r"Get enumerated values variant"]
181 #[inline(always)]
182 pub fn variant(&self) -> TOIEN_A {
183 match self.bits {
184 false => TOIEN_A::DIS_TIMEOUTINT,
185 true => TOIEN_A::EN_TIMEOUTINT,
186 }
187 }
188 #[doc = "Checks if the value of the field is `DIS_TIMEOUTINT`"]
189 #[inline(always)]
190 pub fn is_dis_timeoutint(&self) -> bool {
191 *self == TOIEN_A::DIS_TIMEOUTINT
192 }
193 #[doc = "Checks if the value of the field is `EN_TIMEOUTINT`"]
194 #[inline(always)]
195 pub fn is_en_timeoutint(&self) -> bool {
196 *self == TOIEN_A::EN_TIMEOUTINT
197 }
198}
199#[doc = "Write proxy for field `TOIEN`"]
200pub struct TOIEN_W<'a> {
201 w: &'a mut W,
202}
203impl<'a> TOIEN_W<'a> {
204 #[doc = r"Writes `variant` to the field"]
205 #[inline(always)]
206 pub fn variant(self, variant: TOIEN_A) -> &'a mut W {
207 {
208 self.bit(variant.into())
209 }
210 }
211 #[doc = "Disable timeout interrupt"]
212 #[inline(always)]
213 pub fn dis_timeoutint(self) -> &'a mut W {
214 self.variant(TOIEN_A::DIS_TIMEOUTINT)
215 }
216 #[doc = "Enable timeout interrupt"]
217 #[inline(always)]
218 pub fn en_timeoutint(self) -> &'a mut W {
219 self.variant(TOIEN_A::EN_TIMEOUTINT)
220 }
221 #[doc = r"Sets the field bit"]
222 #[inline(always)]
223 pub fn set_bit(self) -> &'a mut W {
224 self.bit(true)
225 }
226 #[doc = r"Clears the field bit"]
227 #[inline(always)]
228 pub fn clear_bit(self) -> &'a mut W {
229 self.bit(false)
230 }
231 #[doc = r"Writes raw bits to the field"]
232 #[inline(always)]
233 pub fn bit(self, value: bool) -> &'a mut W {
234 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u16) & 0x01) << 2);
235 self.w
236 }
237}
238#[doc = "Starting Edge Count\n\nValue on reset: 0"]
239#[derive(Clone, Copy, Debug, PartialEq)]
240#[repr(u8)]
241pub enum SEC_A {
242 #[doc = "0: First edge"]
243 SEC_EDGE1 = 0,
244 #[doc = "1: Second edge"]
245 SEC_EDGE2 = 1,
246 #[doc = "2: Third edge"]
247 SEC_EDGE3 = 2,
248 #[doc = "3: Fourth edge"]
249 SEC_EDGE4 = 3,
250 #[doc = "4: Fifth edge"]
251 SEC_EDGE5 = 4,
252 #[doc = "5: Sixth edge"]
253 SEC_EDGE6 = 5,
254 #[doc = "6: Seventh edge"]
255 SEC_EDGE7 = 6,
256 #[doc = "7: Eighth edge"]
257 SEC_EDGE8 = 7,
258}
259impl From<SEC_A> for u8 {
260 #[inline(always)]
261 fn from(variant: SEC_A) -> Self {
262 variant as _
263 }
264}
265#[doc = "Reader of field `SEC`"]
266pub type SEC_R = crate::R<u8, SEC_A>;
267impl SEC_R {
268 #[doc = r"Get enumerated values variant"]
269 #[inline(always)]
270 pub fn variant(&self) -> SEC_A {
271 match self.bits {
272 0 => SEC_A::SEC_EDGE1,
273 1 => SEC_A::SEC_EDGE2,
274 2 => SEC_A::SEC_EDGE3,
275 3 => SEC_A::SEC_EDGE4,
276 4 => SEC_A::SEC_EDGE5,
277 5 => SEC_A::SEC_EDGE6,
278 6 => SEC_A::SEC_EDGE7,
279 7 => SEC_A::SEC_EDGE8,
280 _ => unreachable!(),
281 }
282 }
283 #[doc = "Checks if the value of the field is `SEC_EDGE1`"]
284 #[inline(always)]
285 pub fn is_sec_edge1(&self) -> bool {
286 *self == SEC_A::SEC_EDGE1
287 }
288 #[doc = "Checks if the value of the field is `SEC_EDGE2`"]
289 #[inline(always)]
290 pub fn is_sec_edge2(&self) -> bool {
291 *self == SEC_A::SEC_EDGE2
292 }
293 #[doc = "Checks if the value of the field is `SEC_EDGE3`"]
294 #[inline(always)]
295 pub fn is_sec_edge3(&self) -> bool {
296 *self == SEC_A::SEC_EDGE3
297 }
298 #[doc = "Checks if the value of the field is `SEC_EDGE4`"]
299 #[inline(always)]
300 pub fn is_sec_edge4(&self) -> bool {
301 *self == SEC_A::SEC_EDGE4
302 }
303 #[doc = "Checks if the value of the field is `SEC_EDGE5`"]
304 #[inline(always)]
305 pub fn is_sec_edge5(&self) -> bool {
306 *self == SEC_A::SEC_EDGE5
307 }
308 #[doc = "Checks if the value of the field is `SEC_EDGE6`"]
309 #[inline(always)]
310 pub fn is_sec_edge6(&self) -> bool {
311 *self == SEC_A::SEC_EDGE6
312 }
313 #[doc = "Checks if the value of the field is `SEC_EDGE7`"]
314 #[inline(always)]
315 pub fn is_sec_edge7(&self) -> bool {
316 *self == SEC_A::SEC_EDGE7
317 }
318 #[doc = "Checks if the value of the field is `SEC_EDGE8`"]
319 #[inline(always)]
320 pub fn is_sec_edge8(&self) -> bool {
321 *self == SEC_A::SEC_EDGE8
322 }
323}
324#[doc = "Write proxy for field `SEC`"]
325pub struct SEC_W<'a> {
326 w: &'a mut W,
327}
328impl<'a> SEC_W<'a> {
329 #[doc = r"Writes `variant` to the field"]
330 #[inline(always)]
331 pub fn variant(self, variant: SEC_A) -> &'a mut W {
332 {
333 self.bits(variant.into())
334 }
335 }
336 #[doc = "First edge"]
337 #[inline(always)]
338 pub fn sec_edge1(self) -> &'a mut W {
339 self.variant(SEC_A::SEC_EDGE1)
340 }
341 #[doc = "Second edge"]
342 #[inline(always)]
343 pub fn sec_edge2(self) -> &'a mut W {
344 self.variant(SEC_A::SEC_EDGE2)
345 }
346 #[doc = "Third edge"]
347 #[inline(always)]
348 pub fn sec_edge3(self) -> &'a mut W {
349 self.variant(SEC_A::SEC_EDGE3)
350 }
351 #[doc = "Fourth edge"]
352 #[inline(always)]
353 pub fn sec_edge4(self) -> &'a mut W {
354 self.variant(SEC_A::SEC_EDGE4)
355 }
356 #[doc = "Fifth edge"]
357 #[inline(always)]
358 pub fn sec_edge5(self) -> &'a mut W {
359 self.variant(SEC_A::SEC_EDGE5)
360 }
361 #[doc = "Sixth edge"]
362 #[inline(always)]
363 pub fn sec_edge6(self) -> &'a mut W {
364 self.variant(SEC_A::SEC_EDGE6)
365 }
366 #[doc = "Seventh edge"]
367 #[inline(always)]
368 pub fn sec_edge7(self) -> &'a mut W {
369 self.variant(SEC_A::SEC_EDGE7)
370 }
371 #[doc = "Eighth edge"]
372 #[inline(always)]
373 pub fn sec_edge8(self) -> &'a mut W {
374 self.variant(SEC_A::SEC_EDGE8)
375 }
376 #[doc = r"Writes raw bits to the field"]
377 #[inline(always)]
378 pub fn bits(self, value: u8) -> &'a mut W {
379 self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u16) & 0x07) << 4);
380 self.w
381 }
382}
383#[doc = "Ending Edge Count\n\nValue on reset: 0"]
384#[derive(Clone, Copy, Debug, PartialEq)]
385#[repr(u8)]
386pub enum EEC_A {
387 #[doc = "0: First edge"]
388 EEC_EDGE1 = 0,
389 #[doc = "1: Second edge"]
390 EEC_EDGE2 = 1,
391 #[doc = "2: Third edge"]
392 EEC_EDGE3 = 2,
393 #[doc = "3: Fourth edge"]
394 EEC_EDGE4 = 3,
395 #[doc = "4: Fifth edge"]
396 EEC_EDGE5 = 4,
397 #[doc = "5: Sixth edge"]
398 EEC_EDGE6 = 5,
399 #[doc = "6: Seventh edge"]
400 EEC_EDGE7 = 6,
401 #[doc = "7: Eighth edge"]
402 EEC_EDGE8 = 7,
403 #[doc = "8: Ninth edge"]
404 EEC_EDGE9 = 8,
405}
406impl From<EEC_A> for u8 {
407 #[inline(always)]
408 fn from(variant: EEC_A) -> Self {
409 variant as _
410 }
411}
412#[doc = "Reader of field `EEC`"]
413pub type EEC_R = crate::R<u8, EEC_A>;
414impl EEC_R {
415 #[doc = r"Get enumerated values variant"]
416 #[inline(always)]
417 pub fn variant(&self) -> crate::Variant<u8, EEC_A> {
418 use crate::Variant::*;
419 match self.bits {
420 0 => Val(EEC_A::EEC_EDGE1),
421 1 => Val(EEC_A::EEC_EDGE2),
422 2 => Val(EEC_A::EEC_EDGE3),
423 3 => Val(EEC_A::EEC_EDGE4),
424 4 => Val(EEC_A::EEC_EDGE5),
425 5 => Val(EEC_A::EEC_EDGE6),
426 6 => Val(EEC_A::EEC_EDGE7),
427 7 => Val(EEC_A::EEC_EDGE8),
428 8 => Val(EEC_A::EEC_EDGE9),
429 i => Res(i),
430 }
431 }
432 #[doc = "Checks if the value of the field is `EEC_EDGE1`"]
433 #[inline(always)]
434 pub fn is_eec_edge1(&self) -> bool {
435 *self == EEC_A::EEC_EDGE1
436 }
437 #[doc = "Checks if the value of the field is `EEC_EDGE2`"]
438 #[inline(always)]
439 pub fn is_eec_edge2(&self) -> bool {
440 *self == EEC_A::EEC_EDGE2
441 }
442 #[doc = "Checks if the value of the field is `EEC_EDGE3`"]
443 #[inline(always)]
444 pub fn is_eec_edge3(&self) -> bool {
445 *self == EEC_A::EEC_EDGE3
446 }
447 #[doc = "Checks if the value of the field is `EEC_EDGE4`"]
448 #[inline(always)]
449 pub fn is_eec_edge4(&self) -> bool {
450 *self == EEC_A::EEC_EDGE4
451 }
452 #[doc = "Checks if the value of the field is `EEC_EDGE5`"]
453 #[inline(always)]
454 pub fn is_eec_edge5(&self) -> bool {
455 *self == EEC_A::EEC_EDGE5
456 }
457 #[doc = "Checks if the value of the field is `EEC_EDGE6`"]
458 #[inline(always)]
459 pub fn is_eec_edge6(&self) -> bool {
460 *self == EEC_A::EEC_EDGE6
461 }
462 #[doc = "Checks if the value of the field is `EEC_EDGE7`"]
463 #[inline(always)]
464 pub fn is_eec_edge7(&self) -> bool {
465 *self == EEC_A::EEC_EDGE7
466 }
467 #[doc = "Checks if the value of the field is `EEC_EDGE8`"]
468 #[inline(always)]
469 pub fn is_eec_edge8(&self) -> bool {
470 *self == EEC_A::EEC_EDGE8
471 }
472 #[doc = "Checks if the value of the field is `EEC_EDGE9`"]
473 #[inline(always)]
474 pub fn is_eec_edge9(&self) -> bool {
475 *self == EEC_A::EEC_EDGE9
476 }
477}
478#[doc = "Write proxy for field `EEC`"]
479pub struct EEC_W<'a> {
480 w: &'a mut W,
481}
482impl<'a> EEC_W<'a> {
483 #[doc = r"Writes `variant` to the field"]
484 #[inline(always)]
485 pub fn variant(self, variant: EEC_A) -> &'a mut W {
486 unsafe { self.bits(variant.into()) }
487 }
488 #[doc = "First edge"]
489 #[inline(always)]
490 pub fn eec_edge1(self) -> &'a mut W {
491 self.variant(EEC_A::EEC_EDGE1)
492 }
493 #[doc = "Second edge"]
494 #[inline(always)]
495 pub fn eec_edge2(self) -> &'a mut W {
496 self.variant(EEC_A::EEC_EDGE2)
497 }
498 #[doc = "Third edge"]
499 #[inline(always)]
500 pub fn eec_edge3(self) -> &'a mut W {
501 self.variant(EEC_A::EEC_EDGE3)
502 }
503 #[doc = "Fourth edge"]
504 #[inline(always)]
505 pub fn eec_edge4(self) -> &'a mut W {
506 self.variant(EEC_A::EEC_EDGE4)
507 }
508 #[doc = "Fifth edge"]
509 #[inline(always)]
510 pub fn eec_edge5(self) -> &'a mut W {
511 self.variant(EEC_A::EEC_EDGE5)
512 }
513 #[doc = "Sixth edge"]
514 #[inline(always)]
515 pub fn eec_edge6(self) -> &'a mut W {
516 self.variant(EEC_A::EEC_EDGE6)
517 }
518 #[doc = "Seventh edge"]
519 #[inline(always)]
520 pub fn eec_edge7(self) -> &'a mut W {
521 self.variant(EEC_A::EEC_EDGE7)
522 }
523 #[doc = "Eighth edge"]
524 #[inline(always)]
525 pub fn eec_edge8(self) -> &'a mut W {
526 self.variant(EEC_A::EEC_EDGE8)
527 }
528 #[doc = "Ninth edge"]
529 #[inline(always)]
530 pub fn eec_edge9(self) -> &'a mut W {
531 self.variant(EEC_A::EEC_EDGE9)
532 }
533 #[doc = r"Writes raw bits to the field"]
534 #[inline(always)]
535 pub unsafe fn bits(self, value: u8) -> &'a mut W {
536 self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u16) & 0x0f) << 8);
537 self.w
538 }
539}
540impl R {
541 #[doc = "Bit 0 - Auto Baud Enable"]
542 #[inline(always)]
543 pub fn abe(&self) -> ABE_R {
544 ABE_R::new((self.bits & 0x01) != 0)
545 }
546 #[doc = "Bit 1 - Enable Done Interrupt"]
547 #[inline(always)]
548 pub fn dnien(&self) -> DNIEN_R {
549 DNIEN_R::new(((self.bits >> 1) & 0x01) != 0)
550 }
551 #[doc = "Bit 2 - Enable Time-out Interrupt"]
552 #[inline(always)]
553 pub fn toien(&self) -> TOIEN_R {
554 TOIEN_R::new(((self.bits >> 2) & 0x01) != 0)
555 }
556 #[doc = "Bits 4:6 - Starting Edge Count"]
557 #[inline(always)]
558 pub fn sec(&self) -> SEC_R {
559 SEC_R::new(((self.bits >> 4) & 0x07) as u8)
560 }
561 #[doc = "Bits 8:11 - Ending Edge Count"]
562 #[inline(always)]
563 pub fn eec(&self) -> EEC_R {
564 EEC_R::new(((self.bits >> 8) & 0x0f) as u8)
565 }
566}
567impl W {
568 #[doc = "Bit 0 - Auto Baud Enable"]
569 #[inline(always)]
570 pub fn abe(&mut self) -> ABE_W {
571 ABE_W { w: self }
572 }
573 #[doc = "Bit 1 - Enable Done Interrupt"]
574 #[inline(always)]
575 pub fn dnien(&mut self) -> DNIEN_W {
576 DNIEN_W { w: self }
577 }
578 #[doc = "Bit 2 - Enable Time-out Interrupt"]
579 #[inline(always)]
580 pub fn toien(&mut self) -> TOIEN_W {
581 TOIEN_W { w: self }
582 }
583 #[doc = "Bits 4:6 - Starting Edge Count"]
584 #[inline(always)]
585 pub fn sec(&mut self) -> SEC_W {
586 SEC_W { w: self }
587 }
588 #[doc = "Bits 8:11 - Ending Edge Count"]
589 #[inline(always)]
590 pub fn eec(&mut self) -> EEC_W {
591 EEC_W { w: self }
592 }
593}