1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::CTAR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct BRR {
47 bits: u8,
48}
49impl BRR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u8 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct DTR {
58 bits: u8,
59}
60impl DTR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u8 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct ASCR {
69 bits: u8,
70}
71impl ASCR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bits(&self) -> u8 {
75 self.bits
76 }
77}
78#[doc = r" Value of the field"]
79pub struct CSSCKR {
80 bits: u8,
81}
82impl CSSCKR {
83 #[doc = r" Value of the field as raw bits"]
84 #[inline]
85 pub fn bits(&self) -> u8 {
86 self.bits
87 }
88}
89#[doc = "Possible values of the field `PBR`"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum PBRR {
92 #[doc = "Baud Rate Prescaler value is 2."]
93 _00,
94 #[doc = "Baud Rate Prescaler value is 3."]
95 _01,
96 #[doc = "Baud Rate Prescaler value is 5."]
97 _10,
98 #[doc = "Baud Rate Prescaler value is 7."]
99 _11,
100}
101impl PBRR {
102 #[doc = r" Value of the field as raw bits"]
103 #[inline]
104 pub fn bits(&self) -> u8 {
105 match *self {
106 PBRR::_00 => 0,
107 PBRR::_01 => 1,
108 PBRR::_10 => 2,
109 PBRR::_11 => 3,
110 }
111 }
112 #[allow(missing_docs)]
113 #[doc(hidden)]
114 #[inline]
115 pub fn _from(value: u8) -> PBRR {
116 match value {
117 0 => PBRR::_00,
118 1 => PBRR::_01,
119 2 => PBRR::_10,
120 3 => PBRR::_11,
121 _ => unreachable!(),
122 }
123 }
124 #[doc = "Checks if the value of the field is `_00`"]
125 #[inline]
126 pub fn is_00(&self) -> bool {
127 *self == PBRR::_00
128 }
129 #[doc = "Checks if the value of the field is `_01`"]
130 #[inline]
131 pub fn is_01(&self) -> bool {
132 *self == PBRR::_01
133 }
134 #[doc = "Checks if the value of the field is `_10`"]
135 #[inline]
136 pub fn is_10(&self) -> bool {
137 *self == PBRR::_10
138 }
139 #[doc = "Checks if the value of the field is `_11`"]
140 #[inline]
141 pub fn is_11(&self) -> bool {
142 *self == PBRR::_11
143 }
144}
145#[doc = "Possible values of the field `PDT`"]
146#[derive(Clone, Copy, Debug, PartialEq)]
147pub enum PDTR {
148 #[doc = "Delay after Transfer Prescaler value is 1."]
149 _00,
150 #[doc = "Delay after Transfer Prescaler value is 3."]
151 _01,
152 #[doc = "Delay after Transfer Prescaler value is 5."]
153 _10,
154 #[doc = "Delay after Transfer Prescaler value is 7."]
155 _11,
156}
157impl PDTR {
158 #[doc = r" Value of the field as raw bits"]
159 #[inline]
160 pub fn bits(&self) -> u8 {
161 match *self {
162 PDTR::_00 => 0,
163 PDTR::_01 => 1,
164 PDTR::_10 => 2,
165 PDTR::_11 => 3,
166 }
167 }
168 #[allow(missing_docs)]
169 #[doc(hidden)]
170 #[inline]
171 pub fn _from(value: u8) -> PDTR {
172 match value {
173 0 => PDTR::_00,
174 1 => PDTR::_01,
175 2 => PDTR::_10,
176 3 => PDTR::_11,
177 _ => unreachable!(),
178 }
179 }
180 #[doc = "Checks if the value of the field is `_00`"]
181 #[inline]
182 pub fn is_00(&self) -> bool {
183 *self == PDTR::_00
184 }
185 #[doc = "Checks if the value of the field is `_01`"]
186 #[inline]
187 pub fn is_01(&self) -> bool {
188 *self == PDTR::_01
189 }
190 #[doc = "Checks if the value of the field is `_10`"]
191 #[inline]
192 pub fn is_10(&self) -> bool {
193 *self == PDTR::_10
194 }
195 #[doc = "Checks if the value of the field is `_11`"]
196 #[inline]
197 pub fn is_11(&self) -> bool {
198 *self == PDTR::_11
199 }
200}
201#[doc = "Possible values of the field `PASC`"]
202#[derive(Clone, Copy, Debug, PartialEq)]
203pub enum PASCR {
204 #[doc = "Delay after Transfer Prescaler value is 1."]
205 _00,
206 #[doc = "Delay after Transfer Prescaler value is 3."]
207 _01,
208 #[doc = "Delay after Transfer Prescaler value is 5."]
209 _10,
210 #[doc = "Delay after Transfer Prescaler value is 7."]
211 _11,
212}
213impl PASCR {
214 #[doc = r" Value of the field as raw bits"]
215 #[inline]
216 pub fn bits(&self) -> u8 {
217 match *self {
218 PASCR::_00 => 0,
219 PASCR::_01 => 1,
220 PASCR::_10 => 2,
221 PASCR::_11 => 3,
222 }
223 }
224 #[allow(missing_docs)]
225 #[doc(hidden)]
226 #[inline]
227 pub fn _from(value: u8) -> PASCR {
228 match value {
229 0 => PASCR::_00,
230 1 => PASCR::_01,
231 2 => PASCR::_10,
232 3 => PASCR::_11,
233 _ => unreachable!(),
234 }
235 }
236 #[doc = "Checks if the value of the field is `_00`"]
237 #[inline]
238 pub fn is_00(&self) -> bool {
239 *self == PASCR::_00
240 }
241 #[doc = "Checks if the value of the field is `_01`"]
242 #[inline]
243 pub fn is_01(&self) -> bool {
244 *self == PASCR::_01
245 }
246 #[doc = "Checks if the value of the field is `_10`"]
247 #[inline]
248 pub fn is_10(&self) -> bool {
249 *self == PASCR::_10
250 }
251 #[doc = "Checks if the value of the field is `_11`"]
252 #[inline]
253 pub fn is_11(&self) -> bool {
254 *self == PASCR::_11
255 }
256}
257#[doc = "Possible values of the field `PCSSCK`"]
258#[derive(Clone, Copy, Debug, PartialEq)]
259pub enum PCSSCKR {
260 #[doc = "PCS to SCK Prescaler value is 1."]
261 _00,
262 #[doc = "PCS to SCK Prescaler value is 3."]
263 _01,
264 #[doc = "PCS to SCK Prescaler value is 5."]
265 _10,
266 #[doc = "PCS to SCK Prescaler value is 7."]
267 _11,
268}
269impl PCSSCKR {
270 #[doc = r" Value of the field as raw bits"]
271 #[inline]
272 pub fn bits(&self) -> u8 {
273 match *self {
274 PCSSCKR::_00 => 0,
275 PCSSCKR::_01 => 1,
276 PCSSCKR::_10 => 2,
277 PCSSCKR::_11 => 3,
278 }
279 }
280 #[allow(missing_docs)]
281 #[doc(hidden)]
282 #[inline]
283 pub fn _from(value: u8) -> PCSSCKR {
284 match value {
285 0 => PCSSCKR::_00,
286 1 => PCSSCKR::_01,
287 2 => PCSSCKR::_10,
288 3 => PCSSCKR::_11,
289 _ => unreachable!(),
290 }
291 }
292 #[doc = "Checks if the value of the field is `_00`"]
293 #[inline]
294 pub fn is_00(&self) -> bool {
295 *self == PCSSCKR::_00
296 }
297 #[doc = "Checks if the value of the field is `_01`"]
298 #[inline]
299 pub fn is_01(&self) -> bool {
300 *self == PCSSCKR::_01
301 }
302 #[doc = "Checks if the value of the field is `_10`"]
303 #[inline]
304 pub fn is_10(&self) -> bool {
305 *self == PCSSCKR::_10
306 }
307 #[doc = "Checks if the value of the field is `_11`"]
308 #[inline]
309 pub fn is_11(&self) -> bool {
310 *self == PCSSCKR::_11
311 }
312}
313#[doc = "Possible values of the field `LSBFE`"]
314#[derive(Clone, Copy, Debug, PartialEq)]
315pub enum LSBFER {
316 #[doc = "Data is transferred MSB first."]
317 _0,
318 #[doc = "Data is transferred LSB first."]
319 _1,
320}
321impl LSBFER {
322 #[doc = r" Returns `true` if the bit is clear (0)"]
323 #[inline]
324 pub fn bit_is_clear(&self) -> bool {
325 !self.bit()
326 }
327 #[doc = r" Returns `true` if the bit is set (1)"]
328 #[inline]
329 pub fn bit_is_set(&self) -> bool {
330 self.bit()
331 }
332 #[doc = r" Value of the field as raw bits"]
333 #[inline]
334 pub fn bit(&self) -> bool {
335 match *self {
336 LSBFER::_0 => false,
337 LSBFER::_1 => true,
338 }
339 }
340 #[allow(missing_docs)]
341 #[doc(hidden)]
342 #[inline]
343 pub fn _from(value: bool) -> LSBFER {
344 match value {
345 false => LSBFER::_0,
346 true => LSBFER::_1,
347 }
348 }
349 #[doc = "Checks if the value of the field is `_0`"]
350 #[inline]
351 pub fn is_0(&self) -> bool {
352 *self == LSBFER::_0
353 }
354 #[doc = "Checks if the value of the field is `_1`"]
355 #[inline]
356 pub fn is_1(&self) -> bool {
357 *self == LSBFER::_1
358 }
359}
360#[doc = "Possible values of the field `CPHA`"]
361#[derive(Clone, Copy, Debug, PartialEq)]
362pub enum CPHAR {
363 #[doc = "Data is captured on the leading edge of SCK and changed on the following edge."]
364 _0,
365 #[doc = "Data is changed on the leading edge of SCK and captured on the following edge."]
366 _1,
367}
368impl CPHAR {
369 #[doc = r" Returns `true` if the bit is clear (0)"]
370 #[inline]
371 pub fn bit_is_clear(&self) -> bool {
372 !self.bit()
373 }
374 #[doc = r" Returns `true` if the bit is set (1)"]
375 #[inline]
376 pub fn bit_is_set(&self) -> bool {
377 self.bit()
378 }
379 #[doc = r" Value of the field as raw bits"]
380 #[inline]
381 pub fn bit(&self) -> bool {
382 match *self {
383 CPHAR::_0 => false,
384 CPHAR::_1 => true,
385 }
386 }
387 #[allow(missing_docs)]
388 #[doc(hidden)]
389 #[inline]
390 pub fn _from(value: bool) -> CPHAR {
391 match value {
392 false => CPHAR::_0,
393 true => CPHAR::_1,
394 }
395 }
396 #[doc = "Checks if the value of the field is `_0`"]
397 #[inline]
398 pub fn is_0(&self) -> bool {
399 *self == CPHAR::_0
400 }
401 #[doc = "Checks if the value of the field is `_1`"]
402 #[inline]
403 pub fn is_1(&self) -> bool {
404 *self == CPHAR::_1
405 }
406}
407#[doc = "Possible values of the field `CPOL`"]
408#[derive(Clone, Copy, Debug, PartialEq)]
409pub enum CPOLR {
410 #[doc = "The inactive state value of SCK is low."]
411 _0,
412 #[doc = "The inactive state value of SCK is high."]
413 _1,
414}
415impl CPOLR {
416 #[doc = r" Returns `true` if the bit is clear (0)"]
417 #[inline]
418 pub fn bit_is_clear(&self) -> bool {
419 !self.bit()
420 }
421 #[doc = r" Returns `true` if the bit is set (1)"]
422 #[inline]
423 pub fn bit_is_set(&self) -> bool {
424 self.bit()
425 }
426 #[doc = r" Value of the field as raw bits"]
427 #[inline]
428 pub fn bit(&self) -> bool {
429 match *self {
430 CPOLR::_0 => false,
431 CPOLR::_1 => true,
432 }
433 }
434 #[allow(missing_docs)]
435 #[doc(hidden)]
436 #[inline]
437 pub fn _from(value: bool) -> CPOLR {
438 match value {
439 false => CPOLR::_0,
440 true => CPOLR::_1,
441 }
442 }
443 #[doc = "Checks if the value of the field is `_0`"]
444 #[inline]
445 pub fn is_0(&self) -> bool {
446 *self == CPOLR::_0
447 }
448 #[doc = "Checks if the value of the field is `_1`"]
449 #[inline]
450 pub fn is_1(&self) -> bool {
451 *self == CPOLR::_1
452 }
453}
454#[doc = r" Value of the field"]
455pub struct FMSZR {
456 bits: u8,
457}
458impl FMSZR {
459 #[doc = r" Value of the field as raw bits"]
460 #[inline]
461 pub fn bits(&self) -> u8 {
462 self.bits
463 }
464}
465#[doc = "Possible values of the field `DBR`"]
466#[derive(Clone, Copy, Debug, PartialEq)]
467pub enum DBRR {
468 #[doc = "The baud rate is computed normally with a 50/50 duty cycle."]
469 _0,
470 #[doc = "The baud rate is doubled with the duty cycle depending on the Baud Rate Prescaler."]
471 _1,
472}
473impl DBRR {
474 #[doc = r" Returns `true` if the bit is clear (0)"]
475 #[inline]
476 pub fn bit_is_clear(&self) -> bool {
477 !self.bit()
478 }
479 #[doc = r" Returns `true` if the bit is set (1)"]
480 #[inline]
481 pub fn bit_is_set(&self) -> bool {
482 self.bit()
483 }
484 #[doc = r" Value of the field as raw bits"]
485 #[inline]
486 pub fn bit(&self) -> bool {
487 match *self {
488 DBRR::_0 => false,
489 DBRR::_1 => true,
490 }
491 }
492 #[allow(missing_docs)]
493 #[doc(hidden)]
494 #[inline]
495 pub fn _from(value: bool) -> DBRR {
496 match value {
497 false => DBRR::_0,
498 true => DBRR::_1,
499 }
500 }
501 #[doc = "Checks if the value of the field is `_0`"]
502 #[inline]
503 pub fn is_0(&self) -> bool {
504 *self == DBRR::_0
505 }
506 #[doc = "Checks if the value of the field is `_1`"]
507 #[inline]
508 pub fn is_1(&self) -> bool {
509 *self == DBRR::_1
510 }
511}
512#[doc = r" Proxy"]
513pub struct _BRW<'a> {
514 w: &'a mut W,
515}
516impl<'a> _BRW<'a> {
517 #[doc = r" Writes raw bits to the field"]
518 #[inline]
519 pub unsafe fn bits(self, value: u8) -> &'a mut W {
520 const MASK: u8 = 15;
521 const OFFSET: u8 = 0;
522 self.w.bits &= !((MASK as u32) << OFFSET);
523 self.w.bits |= ((value & MASK) as u32) << OFFSET;
524 self.w
525 }
526}
527#[doc = r" Proxy"]
528pub struct _DTW<'a> {
529 w: &'a mut W,
530}
531impl<'a> _DTW<'a> {
532 #[doc = r" Writes raw bits to the field"]
533 #[inline]
534 pub unsafe fn bits(self, value: u8) -> &'a mut W {
535 const MASK: u8 = 15;
536 const OFFSET: u8 = 4;
537 self.w.bits &= !((MASK as u32) << OFFSET);
538 self.w.bits |= ((value & MASK) as u32) << OFFSET;
539 self.w
540 }
541}
542#[doc = r" Proxy"]
543pub struct _ASCW<'a> {
544 w: &'a mut W,
545}
546impl<'a> _ASCW<'a> {
547 #[doc = r" Writes raw bits to the field"]
548 #[inline]
549 pub unsafe fn bits(self, value: u8) -> &'a mut W {
550 const MASK: u8 = 15;
551 const OFFSET: u8 = 8;
552 self.w.bits &= !((MASK as u32) << OFFSET);
553 self.w.bits |= ((value & MASK) as u32) << OFFSET;
554 self.w
555 }
556}
557#[doc = r" Proxy"]
558pub struct _CSSCKW<'a> {
559 w: &'a mut W,
560}
561impl<'a> _CSSCKW<'a> {
562 #[doc = r" Writes raw bits to the field"]
563 #[inline]
564 pub unsafe fn bits(self, value: u8) -> &'a mut W {
565 const MASK: u8 = 15;
566 const OFFSET: u8 = 12;
567 self.w.bits &= !((MASK as u32) << OFFSET);
568 self.w.bits |= ((value & MASK) as u32) << OFFSET;
569 self.w
570 }
571}
572#[doc = "Values that can be written to the field `PBR`"]
573pub enum PBRW {
574 #[doc = "Baud Rate Prescaler value is 2."]
575 _00,
576 #[doc = "Baud Rate Prescaler value is 3."]
577 _01,
578 #[doc = "Baud Rate Prescaler value is 5."]
579 _10,
580 #[doc = "Baud Rate Prescaler value is 7."]
581 _11,
582}
583impl PBRW {
584 #[allow(missing_docs)]
585 #[doc(hidden)]
586 #[inline]
587 pub fn _bits(&self) -> u8 {
588 match *self {
589 PBRW::_00 => 0,
590 PBRW::_01 => 1,
591 PBRW::_10 => 2,
592 PBRW::_11 => 3,
593 }
594 }
595}
596#[doc = r" Proxy"]
597pub struct _PBRW<'a> {
598 w: &'a mut W,
599}
600impl<'a> _PBRW<'a> {
601 #[doc = r" Writes `variant` to the field"]
602 #[inline]
603 pub fn variant(self, variant: PBRW) -> &'a mut W {
604 {
605 self.bits(variant._bits())
606 }
607 }
608 #[doc = "Baud Rate Prescaler value is 2."]
609 #[inline]
610 pub fn _00(self) -> &'a mut W {
611 self.variant(PBRW::_00)
612 }
613 #[doc = "Baud Rate Prescaler value is 3."]
614 #[inline]
615 pub fn _01(self) -> &'a mut W {
616 self.variant(PBRW::_01)
617 }
618 #[doc = "Baud Rate Prescaler value is 5."]
619 #[inline]
620 pub fn _10(self) -> &'a mut W {
621 self.variant(PBRW::_10)
622 }
623 #[doc = "Baud Rate Prescaler value is 7."]
624 #[inline]
625 pub fn _11(self) -> &'a mut W {
626 self.variant(PBRW::_11)
627 }
628 #[doc = r" Writes raw bits to the field"]
629 #[inline]
630 pub fn bits(self, value: u8) -> &'a mut W {
631 const MASK: u8 = 3;
632 const OFFSET: u8 = 16;
633 self.w.bits &= !((MASK as u32) << OFFSET);
634 self.w.bits |= ((value & MASK) as u32) << OFFSET;
635 self.w
636 }
637}
638#[doc = "Values that can be written to the field `PDT`"]
639pub enum PDTW {
640 #[doc = "Delay after Transfer Prescaler value is 1."]
641 _00,
642 #[doc = "Delay after Transfer Prescaler value is 3."]
643 _01,
644 #[doc = "Delay after Transfer Prescaler value is 5."]
645 _10,
646 #[doc = "Delay after Transfer Prescaler value is 7."]
647 _11,
648}
649impl PDTW {
650 #[allow(missing_docs)]
651 #[doc(hidden)]
652 #[inline]
653 pub fn _bits(&self) -> u8 {
654 match *self {
655 PDTW::_00 => 0,
656 PDTW::_01 => 1,
657 PDTW::_10 => 2,
658 PDTW::_11 => 3,
659 }
660 }
661}
662#[doc = r" Proxy"]
663pub struct _PDTW<'a> {
664 w: &'a mut W,
665}
666impl<'a> _PDTW<'a> {
667 #[doc = r" Writes `variant` to the field"]
668 #[inline]
669 pub fn variant(self, variant: PDTW) -> &'a mut W {
670 {
671 self.bits(variant._bits())
672 }
673 }
674 #[doc = "Delay after Transfer Prescaler value is 1."]
675 #[inline]
676 pub fn _00(self) -> &'a mut W {
677 self.variant(PDTW::_00)
678 }
679 #[doc = "Delay after Transfer Prescaler value is 3."]
680 #[inline]
681 pub fn _01(self) -> &'a mut W {
682 self.variant(PDTW::_01)
683 }
684 #[doc = "Delay after Transfer Prescaler value is 5."]
685 #[inline]
686 pub fn _10(self) -> &'a mut W {
687 self.variant(PDTW::_10)
688 }
689 #[doc = "Delay after Transfer Prescaler value is 7."]
690 #[inline]
691 pub fn _11(self) -> &'a mut W {
692 self.variant(PDTW::_11)
693 }
694 #[doc = r" Writes raw bits to the field"]
695 #[inline]
696 pub fn bits(self, value: u8) -> &'a mut W {
697 const MASK: u8 = 3;
698 const OFFSET: u8 = 18;
699 self.w.bits &= !((MASK as u32) << OFFSET);
700 self.w.bits |= ((value & MASK) as u32) << OFFSET;
701 self.w
702 }
703}
704#[doc = "Values that can be written to the field `PASC`"]
705pub enum PASCW {
706 #[doc = "Delay after Transfer Prescaler value is 1."]
707 _00,
708 #[doc = "Delay after Transfer Prescaler value is 3."]
709 _01,
710 #[doc = "Delay after Transfer Prescaler value is 5."]
711 _10,
712 #[doc = "Delay after Transfer Prescaler value is 7."]
713 _11,
714}
715impl PASCW {
716 #[allow(missing_docs)]
717 #[doc(hidden)]
718 #[inline]
719 pub fn _bits(&self) -> u8 {
720 match *self {
721 PASCW::_00 => 0,
722 PASCW::_01 => 1,
723 PASCW::_10 => 2,
724 PASCW::_11 => 3,
725 }
726 }
727}
728#[doc = r" Proxy"]
729pub struct _PASCW<'a> {
730 w: &'a mut W,
731}
732impl<'a> _PASCW<'a> {
733 #[doc = r" Writes `variant` to the field"]
734 #[inline]
735 pub fn variant(self, variant: PASCW) -> &'a mut W {
736 {
737 self.bits(variant._bits())
738 }
739 }
740 #[doc = "Delay after Transfer Prescaler value is 1."]
741 #[inline]
742 pub fn _00(self) -> &'a mut W {
743 self.variant(PASCW::_00)
744 }
745 #[doc = "Delay after Transfer Prescaler value is 3."]
746 #[inline]
747 pub fn _01(self) -> &'a mut W {
748 self.variant(PASCW::_01)
749 }
750 #[doc = "Delay after Transfer Prescaler value is 5."]
751 #[inline]
752 pub fn _10(self) -> &'a mut W {
753 self.variant(PASCW::_10)
754 }
755 #[doc = "Delay after Transfer Prescaler value is 7."]
756 #[inline]
757 pub fn _11(self) -> &'a mut W {
758 self.variant(PASCW::_11)
759 }
760 #[doc = r" Writes raw bits to the field"]
761 #[inline]
762 pub fn bits(self, value: u8) -> &'a mut W {
763 const MASK: u8 = 3;
764 const OFFSET: u8 = 20;
765 self.w.bits &= !((MASK as u32) << OFFSET);
766 self.w.bits |= ((value & MASK) as u32) << OFFSET;
767 self.w
768 }
769}
770#[doc = "Values that can be written to the field `PCSSCK`"]
771pub enum PCSSCKW {
772 #[doc = "PCS to SCK Prescaler value is 1."]
773 _00,
774 #[doc = "PCS to SCK Prescaler value is 3."]
775 _01,
776 #[doc = "PCS to SCK Prescaler value is 5."]
777 _10,
778 #[doc = "PCS to SCK Prescaler value is 7."]
779 _11,
780}
781impl PCSSCKW {
782 #[allow(missing_docs)]
783 #[doc(hidden)]
784 #[inline]
785 pub fn _bits(&self) -> u8 {
786 match *self {
787 PCSSCKW::_00 => 0,
788 PCSSCKW::_01 => 1,
789 PCSSCKW::_10 => 2,
790 PCSSCKW::_11 => 3,
791 }
792 }
793}
794#[doc = r" Proxy"]
795pub struct _PCSSCKW<'a> {
796 w: &'a mut W,
797}
798impl<'a> _PCSSCKW<'a> {
799 #[doc = r" Writes `variant` to the field"]
800 #[inline]
801 pub fn variant(self, variant: PCSSCKW) -> &'a mut W {
802 {
803 self.bits(variant._bits())
804 }
805 }
806 #[doc = "PCS to SCK Prescaler value is 1."]
807 #[inline]
808 pub fn _00(self) -> &'a mut W {
809 self.variant(PCSSCKW::_00)
810 }
811 #[doc = "PCS to SCK Prescaler value is 3."]
812 #[inline]
813 pub fn _01(self) -> &'a mut W {
814 self.variant(PCSSCKW::_01)
815 }
816 #[doc = "PCS to SCK Prescaler value is 5."]
817 #[inline]
818 pub fn _10(self) -> &'a mut W {
819 self.variant(PCSSCKW::_10)
820 }
821 #[doc = "PCS to SCK Prescaler value is 7."]
822 #[inline]
823 pub fn _11(self) -> &'a mut W {
824 self.variant(PCSSCKW::_11)
825 }
826 #[doc = r" Writes raw bits to the field"]
827 #[inline]
828 pub fn bits(self, value: u8) -> &'a mut W {
829 const MASK: u8 = 3;
830 const OFFSET: u8 = 22;
831 self.w.bits &= !((MASK as u32) << OFFSET);
832 self.w.bits |= ((value & MASK) as u32) << OFFSET;
833 self.w
834 }
835}
836#[doc = "Values that can be written to the field `LSBFE`"]
837pub enum LSBFEW {
838 #[doc = "Data is transferred MSB first."]
839 _0,
840 #[doc = "Data is transferred LSB first."]
841 _1,
842}
843impl LSBFEW {
844 #[allow(missing_docs)]
845 #[doc(hidden)]
846 #[inline]
847 pub fn _bits(&self) -> bool {
848 match *self {
849 LSBFEW::_0 => false,
850 LSBFEW::_1 => true,
851 }
852 }
853}
854#[doc = r" Proxy"]
855pub struct _LSBFEW<'a> {
856 w: &'a mut W,
857}
858impl<'a> _LSBFEW<'a> {
859 #[doc = r" Writes `variant` to the field"]
860 #[inline]
861 pub fn variant(self, variant: LSBFEW) -> &'a mut W {
862 {
863 self.bit(variant._bits())
864 }
865 }
866 #[doc = "Data is transferred MSB first."]
867 #[inline]
868 pub fn _0(self) -> &'a mut W {
869 self.variant(LSBFEW::_0)
870 }
871 #[doc = "Data is transferred LSB first."]
872 #[inline]
873 pub fn _1(self) -> &'a mut W {
874 self.variant(LSBFEW::_1)
875 }
876 #[doc = r" Sets the field bit"]
877 pub fn set_bit(self) -> &'a mut W {
878 self.bit(true)
879 }
880 #[doc = r" Clears the field bit"]
881 pub fn clear_bit(self) -> &'a mut W {
882 self.bit(false)
883 }
884 #[doc = r" Writes raw bits to the field"]
885 #[inline]
886 pub fn bit(self, value: bool) -> &'a mut W {
887 const MASK: bool = true;
888 const OFFSET: u8 = 24;
889 self.w.bits &= !((MASK as u32) << OFFSET);
890 self.w.bits |= ((value & MASK) as u32) << OFFSET;
891 self.w
892 }
893}
894#[doc = "Values that can be written to the field `CPHA`"]
895pub enum CPHAW {
896 #[doc = "Data is captured on the leading edge of SCK and changed on the following edge."]
897 _0,
898 #[doc = "Data is changed on the leading edge of SCK and captured on the following edge."]
899 _1,
900}
901impl CPHAW {
902 #[allow(missing_docs)]
903 #[doc(hidden)]
904 #[inline]
905 pub fn _bits(&self) -> bool {
906 match *self {
907 CPHAW::_0 => false,
908 CPHAW::_1 => true,
909 }
910 }
911}
912#[doc = r" Proxy"]
913pub struct _CPHAW<'a> {
914 w: &'a mut W,
915}
916impl<'a> _CPHAW<'a> {
917 #[doc = r" Writes `variant` to the field"]
918 #[inline]
919 pub fn variant(self, variant: CPHAW) -> &'a mut W {
920 {
921 self.bit(variant._bits())
922 }
923 }
924 #[doc = "Data is captured on the leading edge of SCK and changed on the following edge."]
925 #[inline]
926 pub fn _0(self) -> &'a mut W {
927 self.variant(CPHAW::_0)
928 }
929 #[doc = "Data is changed on the leading edge of SCK and captured on the following edge."]
930 #[inline]
931 pub fn _1(self) -> &'a mut W {
932 self.variant(CPHAW::_1)
933 }
934 #[doc = r" Sets the field bit"]
935 pub fn set_bit(self) -> &'a mut W {
936 self.bit(true)
937 }
938 #[doc = r" Clears the field bit"]
939 pub fn clear_bit(self) -> &'a mut W {
940 self.bit(false)
941 }
942 #[doc = r" Writes raw bits to the field"]
943 #[inline]
944 pub fn bit(self, value: bool) -> &'a mut W {
945 const MASK: bool = true;
946 const OFFSET: u8 = 25;
947 self.w.bits &= !((MASK as u32) << OFFSET);
948 self.w.bits |= ((value & MASK) as u32) << OFFSET;
949 self.w
950 }
951}
952#[doc = "Values that can be written to the field `CPOL`"]
953pub enum CPOLW {
954 #[doc = "The inactive state value of SCK is low."]
955 _0,
956 #[doc = "The inactive state value of SCK is high."]
957 _1,
958}
959impl CPOLW {
960 #[allow(missing_docs)]
961 #[doc(hidden)]
962 #[inline]
963 pub fn _bits(&self) -> bool {
964 match *self {
965 CPOLW::_0 => false,
966 CPOLW::_1 => true,
967 }
968 }
969}
970#[doc = r" Proxy"]
971pub struct _CPOLW<'a> {
972 w: &'a mut W,
973}
974impl<'a> _CPOLW<'a> {
975 #[doc = r" Writes `variant` to the field"]
976 #[inline]
977 pub fn variant(self, variant: CPOLW) -> &'a mut W {
978 {
979 self.bit(variant._bits())
980 }
981 }
982 #[doc = "The inactive state value of SCK is low."]
983 #[inline]
984 pub fn _0(self) -> &'a mut W {
985 self.variant(CPOLW::_0)
986 }
987 #[doc = "The inactive state value of SCK is high."]
988 #[inline]
989 pub fn _1(self) -> &'a mut W {
990 self.variant(CPOLW::_1)
991 }
992 #[doc = r" Sets the field bit"]
993 pub fn set_bit(self) -> &'a mut W {
994 self.bit(true)
995 }
996 #[doc = r" Clears the field bit"]
997 pub fn clear_bit(self) -> &'a mut W {
998 self.bit(false)
999 }
1000 #[doc = r" Writes raw bits to the field"]
1001 #[inline]
1002 pub fn bit(self, value: bool) -> &'a mut W {
1003 const MASK: bool = true;
1004 const OFFSET: u8 = 26;
1005 self.w.bits &= !((MASK as u32) << OFFSET);
1006 self.w.bits |= ((value & MASK) as u32) << OFFSET;
1007 self.w
1008 }
1009}
1010#[doc = r" Proxy"]
1011pub struct _FMSZW<'a> {
1012 w: &'a mut W,
1013}
1014impl<'a> _FMSZW<'a> {
1015 #[doc = r" Writes raw bits to the field"]
1016 #[inline]
1017 pub unsafe fn bits(self, value: u8) -> &'a mut W {
1018 const MASK: u8 = 15;
1019 const OFFSET: u8 = 27;
1020 self.w.bits &= !((MASK as u32) << OFFSET);
1021 self.w.bits |= ((value & MASK) as u32) << OFFSET;
1022 self.w
1023 }
1024}
1025#[doc = "Values that can be written to the field `DBR`"]
1026pub enum DBRW {
1027 #[doc = "The baud rate is computed normally with a 50/50 duty cycle."]
1028 _0,
1029 #[doc = "The baud rate is doubled with the duty cycle depending on the Baud Rate Prescaler."]
1030 _1,
1031}
1032impl DBRW {
1033 #[allow(missing_docs)]
1034 #[doc(hidden)]
1035 #[inline]
1036 pub fn _bits(&self) -> bool {
1037 match *self {
1038 DBRW::_0 => false,
1039 DBRW::_1 => true,
1040 }
1041 }
1042}
1043#[doc = r" Proxy"]
1044pub struct _DBRW<'a> {
1045 w: &'a mut W,
1046}
1047impl<'a> _DBRW<'a> {
1048 #[doc = r" Writes `variant` to the field"]
1049 #[inline]
1050 pub fn variant(self, variant: DBRW) -> &'a mut W {
1051 {
1052 self.bit(variant._bits())
1053 }
1054 }
1055 #[doc = "The baud rate is computed normally with a 50/50 duty cycle."]
1056 #[inline]
1057 pub fn _0(self) -> &'a mut W {
1058 self.variant(DBRW::_0)
1059 }
1060 #[doc = "The baud rate is doubled with the duty cycle depending on the Baud Rate Prescaler."]
1061 #[inline]
1062 pub fn _1(self) -> &'a mut W {
1063 self.variant(DBRW::_1)
1064 }
1065 #[doc = r" Sets the field bit"]
1066 pub fn set_bit(self) -> &'a mut W {
1067 self.bit(true)
1068 }
1069 #[doc = r" Clears the field bit"]
1070 pub fn clear_bit(self) -> &'a mut W {
1071 self.bit(false)
1072 }
1073 #[doc = r" Writes raw bits to the field"]
1074 #[inline]
1075 pub fn bit(self, value: bool) -> &'a mut W {
1076 const MASK: bool = true;
1077 const OFFSET: u8 = 31;
1078 self.w.bits &= !((MASK as u32) << OFFSET);
1079 self.w.bits |= ((value & MASK) as u32) << OFFSET;
1080 self.w
1081 }
1082}
1083impl R {
1084 #[doc = r" Value of the register as raw bits"]
1085 #[inline]
1086 pub fn bits(&self) -> u32 {
1087 self.bits
1088 }
1089 #[doc = "Bits 0:3 - Baud Rate Scaler"]
1090 #[inline]
1091 pub fn br(&self) -> BRR {
1092 let bits = {
1093 const MASK: u8 = 15;
1094 const OFFSET: u8 = 0;
1095 ((self.bits >> OFFSET) & MASK as u32) as u8
1096 };
1097 BRR { bits }
1098 }
1099 #[doc = "Bits 4:7 - Delay After Transfer Scaler"]
1100 #[inline]
1101 pub fn dt(&self) -> DTR {
1102 let bits = {
1103 const MASK: u8 = 15;
1104 const OFFSET: u8 = 4;
1105 ((self.bits >> OFFSET) & MASK as u32) as u8
1106 };
1107 DTR { bits }
1108 }
1109 #[doc = "Bits 8:11 - After SCK Delay Scaler"]
1110 #[inline]
1111 pub fn asc(&self) -> ASCR {
1112 let bits = {
1113 const MASK: u8 = 15;
1114 const OFFSET: u8 = 8;
1115 ((self.bits >> OFFSET) & MASK as u32) as u8
1116 };
1117 ASCR { bits }
1118 }
1119 #[doc = "Bits 12:15 - PCS to SCK Delay Scaler"]
1120 #[inline]
1121 pub fn cssck(&self) -> CSSCKR {
1122 let bits = {
1123 const MASK: u8 = 15;
1124 const OFFSET: u8 = 12;
1125 ((self.bits >> OFFSET) & MASK as u32) as u8
1126 };
1127 CSSCKR { bits }
1128 }
1129 #[doc = "Bits 16:17 - Baud Rate Prescaler"]
1130 #[inline]
1131 pub fn pbr(&self) -> PBRR {
1132 PBRR::_from({
1133 const MASK: u8 = 3;
1134 const OFFSET: u8 = 16;
1135 ((self.bits >> OFFSET) & MASK as u32) as u8
1136 })
1137 }
1138 #[doc = "Bits 18:19 - Delay after Transfer Prescaler"]
1139 #[inline]
1140 pub fn pdt(&self) -> PDTR {
1141 PDTR::_from({
1142 const MASK: u8 = 3;
1143 const OFFSET: u8 = 18;
1144 ((self.bits >> OFFSET) & MASK as u32) as u8
1145 })
1146 }
1147 #[doc = "Bits 20:21 - After SCK Delay Prescaler"]
1148 #[inline]
1149 pub fn pasc(&self) -> PASCR {
1150 PASCR::_from({
1151 const MASK: u8 = 3;
1152 const OFFSET: u8 = 20;
1153 ((self.bits >> OFFSET) & MASK as u32) as u8
1154 })
1155 }
1156 #[doc = "Bits 22:23 - PCS to SCK Delay Prescaler"]
1157 #[inline]
1158 pub fn pcssck(&self) -> PCSSCKR {
1159 PCSSCKR::_from({
1160 const MASK: u8 = 3;
1161 const OFFSET: u8 = 22;
1162 ((self.bits >> OFFSET) & MASK as u32) as u8
1163 })
1164 }
1165 #[doc = "Bit 24 - LSB First"]
1166 #[inline]
1167 pub fn lsbfe(&self) -> LSBFER {
1168 LSBFER::_from({
1169 const MASK: bool = true;
1170 const OFFSET: u8 = 24;
1171 ((self.bits >> OFFSET) & MASK as u32) != 0
1172 })
1173 }
1174 #[doc = "Bit 25 - Clock Phase"]
1175 #[inline]
1176 pub fn cpha(&self) -> CPHAR {
1177 CPHAR::_from({
1178 const MASK: bool = true;
1179 const OFFSET: u8 = 25;
1180 ((self.bits >> OFFSET) & MASK as u32) != 0
1181 })
1182 }
1183 #[doc = "Bit 26 - Clock Polarity"]
1184 #[inline]
1185 pub fn cpol(&self) -> CPOLR {
1186 CPOLR::_from({
1187 const MASK: bool = true;
1188 const OFFSET: u8 = 26;
1189 ((self.bits >> OFFSET) & MASK as u32) != 0
1190 })
1191 }
1192 #[doc = "Bits 27:30 - Frame Size"]
1193 #[inline]
1194 pub fn fmsz(&self) -> FMSZR {
1195 let bits = {
1196 const MASK: u8 = 15;
1197 const OFFSET: u8 = 27;
1198 ((self.bits >> OFFSET) & MASK as u32) as u8
1199 };
1200 FMSZR { bits }
1201 }
1202 #[doc = "Bit 31 - Double Baud Rate"]
1203 #[inline]
1204 pub fn dbr(&self) -> DBRR {
1205 DBRR::_from({
1206 const MASK: bool = true;
1207 const OFFSET: u8 = 31;
1208 ((self.bits >> OFFSET) & MASK as u32) != 0
1209 })
1210 }
1211}
1212impl W {
1213 #[doc = r" Reset value of the register"]
1214 #[inline]
1215 pub fn reset_value() -> W {
1216 W { bits: 2013265920 }
1217 }
1218 #[doc = r" Writes raw bits to the register"]
1219 #[inline]
1220 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1221 self.bits = bits;
1222 self
1223 }
1224 #[doc = "Bits 0:3 - Baud Rate Scaler"]
1225 #[inline]
1226 pub fn br(&mut self) -> _BRW {
1227 _BRW { w: self }
1228 }
1229 #[doc = "Bits 4:7 - Delay After Transfer Scaler"]
1230 #[inline]
1231 pub fn dt(&mut self) -> _DTW {
1232 _DTW { w: self }
1233 }
1234 #[doc = "Bits 8:11 - After SCK Delay Scaler"]
1235 #[inline]
1236 pub fn asc(&mut self) -> _ASCW {
1237 _ASCW { w: self }
1238 }
1239 #[doc = "Bits 12:15 - PCS to SCK Delay Scaler"]
1240 #[inline]
1241 pub fn cssck(&mut self) -> _CSSCKW {
1242 _CSSCKW { w: self }
1243 }
1244 #[doc = "Bits 16:17 - Baud Rate Prescaler"]
1245 #[inline]
1246 pub fn pbr(&mut self) -> _PBRW {
1247 _PBRW { w: self }
1248 }
1249 #[doc = "Bits 18:19 - Delay after Transfer Prescaler"]
1250 #[inline]
1251 pub fn pdt(&mut self) -> _PDTW {
1252 _PDTW { w: self }
1253 }
1254 #[doc = "Bits 20:21 - After SCK Delay Prescaler"]
1255 #[inline]
1256 pub fn pasc(&mut self) -> _PASCW {
1257 _PASCW { w: self }
1258 }
1259 #[doc = "Bits 22:23 - PCS to SCK Delay Prescaler"]
1260 #[inline]
1261 pub fn pcssck(&mut self) -> _PCSSCKW {
1262 _PCSSCKW { w: self }
1263 }
1264 #[doc = "Bit 24 - LSB First"]
1265 #[inline]
1266 pub fn lsbfe(&mut self) -> _LSBFEW {
1267 _LSBFEW { w: self }
1268 }
1269 #[doc = "Bit 25 - Clock Phase"]
1270 #[inline]
1271 pub fn cpha(&mut self) -> _CPHAW {
1272 _CPHAW { w: self }
1273 }
1274 #[doc = "Bit 26 - Clock Polarity"]
1275 #[inline]
1276 pub fn cpol(&mut self) -> _CPOLW {
1277 _CPOLW { w: self }
1278 }
1279 #[doc = "Bits 27:30 - Frame Size"]
1280 #[inline]
1281 pub fn fmsz(&mut self) -> _FMSZW {
1282 _FMSZW { w: self }
1283 }
1284 #[doc = "Bit 31 - Double Baud Rate"]
1285 #[inline]
1286 pub fn dbr(&mut self) -> _DBRW {
1287 _DBRW { w: self }
1288 }
1289}