1pub type R = crate::R<CR2rs>;
3pub type W = crate::W<CR2rs>;
5pub type SADD_R = crate::FieldReader<u16>;
7pub type SADD_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16, crate::Safe>;
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14pub enum RD_WRN {
15 Write = 0,
17 Read = 1,
19}
20impl From<RD_WRN> for bool {
21 #[inline(always)]
22 fn from(variant: RD_WRN) -> Self {
23 variant as u8 != 0
24 }
25}
26pub type RD_WRN_R = crate::BitReader<RD_WRN>;
28impl RD_WRN_R {
29 #[inline(always)]
31 pub const fn variant(&self) -> RD_WRN {
32 match self.bits {
33 false => RD_WRN::Write,
34 true => RD_WRN::Read,
35 }
36 }
37 #[inline(always)]
39 pub fn is_write(&self) -> bool {
40 *self == RD_WRN::Write
41 }
42 #[inline(always)]
44 pub fn is_read(&self) -> bool {
45 *self == RD_WRN::Read
46 }
47}
48pub type RD_WRN_W<'a, REG> = crate::BitWriter<'a, REG, RD_WRN>;
50impl<'a, REG> RD_WRN_W<'a, REG>
51where
52 REG: crate::Writable + crate::RegisterSpec,
53{
54 #[inline(always)]
56 pub fn write(self) -> &'a mut crate::W<REG> {
57 self.variant(RD_WRN::Write)
58 }
59 #[inline(always)]
61 pub fn read(self) -> &'a mut crate::W<REG> {
62 self.variant(RD_WRN::Read)
63 }
64}
65#[cfg_attr(feature = "defmt", derive(defmt::Format))]
69#[derive(Clone, Copy, Debug, PartialEq, Eq)]
70pub enum ADD10 {
71 Bit7 = 0,
73 Bit10 = 1,
75}
76impl From<ADD10> for bool {
77 #[inline(always)]
78 fn from(variant: ADD10) -> Self {
79 variant as u8 != 0
80 }
81}
82pub type ADD10_R = crate::BitReader<ADD10>;
84impl ADD10_R {
85 #[inline(always)]
87 pub const fn variant(&self) -> ADD10 {
88 match self.bits {
89 false => ADD10::Bit7,
90 true => ADD10::Bit10,
91 }
92 }
93 #[inline(always)]
95 pub fn is_bit7(&self) -> bool {
96 *self == ADD10::Bit7
97 }
98 #[inline(always)]
100 pub fn is_bit10(&self) -> bool {
101 *self == ADD10::Bit10
102 }
103}
104pub type ADD10_W<'a, REG> = crate::BitWriter<'a, REG, ADD10>;
106impl<'a, REG> ADD10_W<'a, REG>
107where
108 REG: crate::Writable + crate::RegisterSpec,
109{
110 #[inline(always)]
112 pub fn bit7(self) -> &'a mut crate::W<REG> {
113 self.variant(ADD10::Bit7)
114 }
115 #[inline(always)]
117 pub fn bit10(self) -> &'a mut crate::W<REG> {
118 self.variant(ADD10::Bit10)
119 }
120}
121#[cfg_attr(feature = "defmt", derive(defmt::Format))]
125#[derive(Clone, Copy, Debug, PartialEq, Eq)]
126pub enum HEAD10R {
127 Complete = 0,
129 Partial = 1,
131}
132impl From<HEAD10R> for bool {
133 #[inline(always)]
134 fn from(variant: HEAD10R) -> Self {
135 variant as u8 != 0
136 }
137}
138pub type HEAD10R_R = crate::BitReader<HEAD10R>;
140impl HEAD10R_R {
141 #[inline(always)]
143 pub const fn variant(&self) -> HEAD10R {
144 match self.bits {
145 false => HEAD10R::Complete,
146 true => HEAD10R::Partial,
147 }
148 }
149 #[inline(always)]
151 pub fn is_complete(&self) -> bool {
152 *self == HEAD10R::Complete
153 }
154 #[inline(always)]
156 pub fn is_partial(&self) -> bool {
157 *self == HEAD10R::Partial
158 }
159}
160pub type HEAD10R_W<'a, REG> = crate::BitWriter<'a, REG, HEAD10R>;
162impl<'a, REG> HEAD10R_W<'a, REG>
163where
164 REG: crate::Writable + crate::RegisterSpec,
165{
166 #[inline(always)]
168 pub fn complete(self) -> &'a mut crate::W<REG> {
169 self.variant(HEAD10R::Complete)
170 }
171 #[inline(always)]
173 pub fn partial(self) -> &'a mut crate::W<REG> {
174 self.variant(HEAD10R::Partial)
175 }
176}
177#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum STARTR {
183 NoStart = 0,
185 Start = 1,
187}
188impl From<STARTR> for bool {
189 #[inline(always)]
190 fn from(variant: STARTR) -> Self {
191 variant as u8 != 0
192 }
193}
194pub type START_R = crate::BitReader<STARTR>;
196impl START_R {
197 #[inline(always)]
199 pub const fn variant(&self) -> STARTR {
200 match self.bits {
201 false => STARTR::NoStart,
202 true => STARTR::Start,
203 }
204 }
205 #[inline(always)]
207 pub fn is_no_start(&self) -> bool {
208 *self == STARTR::NoStart
209 }
210 #[inline(always)]
212 pub fn is_start(&self) -> bool {
213 *self == STARTR::Start
214 }
215}
216#[cfg_attr(feature = "defmt", derive(defmt::Format))]
220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
221pub enum STARTW {
222 Start = 1,
224}
225impl From<STARTW> for bool {
226 #[inline(always)]
227 fn from(variant: STARTW) -> Self {
228 variant as u8 != 0
229 }
230}
231pub type START_W<'a, REG> = crate::BitWriter1S<'a, REG, STARTW>;
233impl<'a, REG> START_W<'a, REG>
234where
235 REG: crate::Writable + crate::RegisterSpec,
236{
237 #[inline(always)]
239 pub fn start(self) -> &'a mut crate::W<REG> {
240 self.variant(STARTW::Start)
241 }
242}
243#[cfg_attr(feature = "defmt", derive(defmt::Format))]
247#[derive(Clone, Copy, Debug, PartialEq, Eq)]
248pub enum STOPR {
249 NoStop = 0,
251 Stop = 1,
253}
254impl From<STOPR> for bool {
255 #[inline(always)]
256 fn from(variant: STOPR) -> Self {
257 variant as u8 != 0
258 }
259}
260pub type STOP_R = crate::BitReader<STOPR>;
262impl STOP_R {
263 #[inline(always)]
265 pub const fn variant(&self) -> STOPR {
266 match self.bits {
267 false => STOPR::NoStop,
268 true => STOPR::Stop,
269 }
270 }
271 #[inline(always)]
273 pub fn is_no_stop(&self) -> bool {
274 *self == STOPR::NoStop
275 }
276 #[inline(always)]
278 pub fn is_stop(&self) -> bool {
279 *self == STOPR::Stop
280 }
281}
282#[cfg_attr(feature = "defmt", derive(defmt::Format))]
286#[derive(Clone, Copy, Debug, PartialEq, Eq)]
287pub enum STOPW {
288 Stop = 1,
290}
291impl From<STOPW> for bool {
292 #[inline(always)]
293 fn from(variant: STOPW) -> Self {
294 variant as u8 != 0
295 }
296}
297pub type STOP_W<'a, REG> = crate::BitWriter1S<'a, REG, STOPW>;
299impl<'a, REG> STOP_W<'a, REG>
300where
301 REG: crate::Writable + crate::RegisterSpec,
302{
303 #[inline(always)]
305 pub fn stop(self) -> &'a mut crate::W<REG> {
306 self.variant(STOPW::Stop)
307 }
308}
309#[cfg_attr(feature = "defmt", derive(defmt::Format))]
313#[derive(Clone, Copy, Debug, PartialEq, Eq)]
314pub enum NACKR {
315 Ack = 0,
317 Nack = 1,
319}
320impl From<NACKR> for bool {
321 #[inline(always)]
322 fn from(variant: NACKR) -> Self {
323 variant as u8 != 0
324 }
325}
326pub type NACK_R = crate::BitReader<NACKR>;
328impl NACK_R {
329 #[inline(always)]
331 pub const fn variant(&self) -> NACKR {
332 match self.bits {
333 false => NACKR::Ack,
334 true => NACKR::Nack,
335 }
336 }
337 #[inline(always)]
339 pub fn is_ack(&self) -> bool {
340 *self == NACKR::Ack
341 }
342 #[inline(always)]
344 pub fn is_nack(&self) -> bool {
345 *self == NACKR::Nack
346 }
347}
348#[cfg_attr(feature = "defmt", derive(defmt::Format))]
352#[derive(Clone, Copy, Debug, PartialEq, Eq)]
353pub enum NACKW {
354 Nack = 1,
356}
357impl From<NACKW> for bool {
358 #[inline(always)]
359 fn from(variant: NACKW) -> Self {
360 variant as u8 != 0
361 }
362}
363pub type NACK_W<'a, REG> = crate::BitWriter1S<'a, REG, NACKW>;
365impl<'a, REG> NACK_W<'a, REG>
366where
367 REG: crate::Writable + crate::RegisterSpec,
368{
369 #[inline(always)]
371 pub fn nack(self) -> &'a mut crate::W<REG> {
372 self.variant(NACKW::Nack)
373 }
374}
375pub type NBYTES_R = crate::FieldReader;
377pub type NBYTES_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
379#[cfg_attr(feature = "defmt", derive(defmt::Format))]
383#[derive(Clone, Copy, Debug, PartialEq, Eq)]
384pub enum RELOAD {
385 Completed = 0,
387 NotCompleted = 1,
389}
390impl From<RELOAD> for bool {
391 #[inline(always)]
392 fn from(variant: RELOAD) -> Self {
393 variant as u8 != 0
394 }
395}
396pub type RELOAD_R = crate::BitReader<RELOAD>;
398impl RELOAD_R {
399 #[inline(always)]
401 pub const fn variant(&self) -> RELOAD {
402 match self.bits {
403 false => RELOAD::Completed,
404 true => RELOAD::NotCompleted,
405 }
406 }
407 #[inline(always)]
409 pub fn is_completed(&self) -> bool {
410 *self == RELOAD::Completed
411 }
412 #[inline(always)]
414 pub fn is_not_completed(&self) -> bool {
415 *self == RELOAD::NotCompleted
416 }
417}
418pub type RELOAD_W<'a, REG> = crate::BitWriter<'a, REG, RELOAD>;
420impl<'a, REG> RELOAD_W<'a, REG>
421where
422 REG: crate::Writable + crate::RegisterSpec,
423{
424 #[inline(always)]
426 pub fn completed(self) -> &'a mut crate::W<REG> {
427 self.variant(RELOAD::Completed)
428 }
429 #[inline(always)]
431 pub fn not_completed(self) -> &'a mut crate::W<REG> {
432 self.variant(RELOAD::NotCompleted)
433 }
434}
435#[cfg_attr(feature = "defmt", derive(defmt::Format))]
439#[derive(Clone, Copy, Debug, PartialEq, Eq)]
440pub enum AUTOEND {
441 Software = 0,
443 Automatic = 1,
445}
446impl From<AUTOEND> for bool {
447 #[inline(always)]
448 fn from(variant: AUTOEND) -> Self {
449 variant as u8 != 0
450 }
451}
452pub type AUTOEND_R = crate::BitReader<AUTOEND>;
454impl AUTOEND_R {
455 #[inline(always)]
457 pub const fn variant(&self) -> AUTOEND {
458 match self.bits {
459 false => AUTOEND::Software,
460 true => AUTOEND::Automatic,
461 }
462 }
463 #[inline(always)]
465 pub fn is_software(&self) -> bool {
466 *self == AUTOEND::Software
467 }
468 #[inline(always)]
470 pub fn is_automatic(&self) -> bool {
471 *self == AUTOEND::Automatic
472 }
473}
474pub type AUTOEND_W<'a, REG> = crate::BitWriter<'a, REG, AUTOEND>;
476impl<'a, REG> AUTOEND_W<'a, REG>
477where
478 REG: crate::Writable + crate::RegisterSpec,
479{
480 #[inline(always)]
482 pub fn software(self) -> &'a mut crate::W<REG> {
483 self.variant(AUTOEND::Software)
484 }
485 #[inline(always)]
487 pub fn automatic(self) -> &'a mut crate::W<REG> {
488 self.variant(AUTOEND::Automatic)
489 }
490}
491#[cfg_attr(feature = "defmt", derive(defmt::Format))]
495#[derive(Clone, Copy, Debug, PartialEq, Eq)]
496pub enum PECBYTER {
497 NoPec = 0,
499 Pec = 1,
501}
502impl From<PECBYTER> for bool {
503 #[inline(always)]
504 fn from(variant: PECBYTER) -> Self {
505 variant as u8 != 0
506 }
507}
508pub type PECBYTE_R = crate::BitReader<PECBYTER>;
510impl PECBYTE_R {
511 #[inline(always)]
513 pub const fn variant(&self) -> PECBYTER {
514 match self.bits {
515 false => PECBYTER::NoPec,
516 true => PECBYTER::Pec,
517 }
518 }
519 #[inline(always)]
521 pub fn is_no_pec(&self) -> bool {
522 *self == PECBYTER::NoPec
523 }
524 #[inline(always)]
526 pub fn is_pec(&self) -> bool {
527 *self == PECBYTER::Pec
528 }
529}
530#[cfg_attr(feature = "defmt", derive(defmt::Format))]
534#[derive(Clone, Copy, Debug, PartialEq, Eq)]
535pub enum PECBYTEW {
536 Pec = 1,
538}
539impl From<PECBYTEW> for bool {
540 #[inline(always)]
541 fn from(variant: PECBYTEW) -> Self {
542 variant as u8 != 0
543 }
544}
545pub type PECBYTE_W<'a, REG> = crate::BitWriter1S<'a, REG, PECBYTEW>;
547impl<'a, REG> PECBYTE_W<'a, REG>
548where
549 REG: crate::Writable + crate::RegisterSpec,
550{
551 #[inline(always)]
553 pub fn pec(self) -> &'a mut crate::W<REG> {
554 self.variant(PECBYTEW::Pec)
555 }
556}
557impl R {
558 #[inline(always)]
560 pub fn sadd(&self) -> SADD_R {
561 SADD_R::new((self.bits & 0x03ff) as u16)
562 }
563 #[inline(always)]
565 pub fn rd_wrn(&self) -> RD_WRN_R {
566 RD_WRN_R::new(((self.bits >> 10) & 1) != 0)
567 }
568 #[inline(always)]
570 pub fn add10(&self) -> ADD10_R {
571 ADD10_R::new(((self.bits >> 11) & 1) != 0)
572 }
573 #[inline(always)]
575 pub fn head10r(&self) -> HEAD10R_R {
576 HEAD10R_R::new(((self.bits >> 12) & 1) != 0)
577 }
578 #[inline(always)]
580 pub fn start(&self) -> START_R {
581 START_R::new(((self.bits >> 13) & 1) != 0)
582 }
583 #[inline(always)]
585 pub fn stop(&self) -> STOP_R {
586 STOP_R::new(((self.bits >> 14) & 1) != 0)
587 }
588 #[inline(always)]
590 pub fn nack(&self) -> NACK_R {
591 NACK_R::new(((self.bits >> 15) & 1) != 0)
592 }
593 #[inline(always)]
595 pub fn nbytes(&self) -> NBYTES_R {
596 NBYTES_R::new(((self.bits >> 16) & 0xff) as u8)
597 }
598 #[inline(always)]
600 pub fn reload(&self) -> RELOAD_R {
601 RELOAD_R::new(((self.bits >> 24) & 1) != 0)
602 }
603 #[inline(always)]
605 pub fn autoend(&self) -> AUTOEND_R {
606 AUTOEND_R::new(((self.bits >> 25) & 1) != 0)
607 }
608 #[inline(always)]
610 pub fn pecbyte(&self) -> PECBYTE_R {
611 PECBYTE_R::new(((self.bits >> 26) & 1) != 0)
612 }
613}
614impl core::fmt::Debug for R {
615 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
616 f.debug_struct("CR2")
617 .field("sadd", &self.sadd())
618 .field("rd_wrn", &self.rd_wrn())
619 .field("add10", &self.add10())
620 .field("head10r", &self.head10r())
621 .field("start", &self.start())
622 .field("stop", &self.stop())
623 .field("nack", &self.nack())
624 .field("nbytes", &self.nbytes())
625 .field("reload", &self.reload())
626 .field("autoend", &self.autoend())
627 .field("pecbyte", &self.pecbyte())
628 .finish()
629 }
630}
631impl W {
632 #[inline(always)]
634 pub fn sadd(&mut self) -> SADD_W<CR2rs> {
635 SADD_W::new(self, 0)
636 }
637 #[inline(always)]
639 pub fn rd_wrn(&mut self) -> RD_WRN_W<CR2rs> {
640 RD_WRN_W::new(self, 10)
641 }
642 #[inline(always)]
644 pub fn add10(&mut self) -> ADD10_W<CR2rs> {
645 ADD10_W::new(self, 11)
646 }
647 #[inline(always)]
649 pub fn head10r(&mut self) -> HEAD10R_W<CR2rs> {
650 HEAD10R_W::new(self, 12)
651 }
652 #[inline(always)]
654 pub fn start(&mut self) -> START_W<CR2rs> {
655 START_W::new(self, 13)
656 }
657 #[inline(always)]
659 pub fn stop(&mut self) -> STOP_W<CR2rs> {
660 STOP_W::new(self, 14)
661 }
662 #[inline(always)]
664 pub fn nack(&mut self) -> NACK_W<CR2rs> {
665 NACK_W::new(self, 15)
666 }
667 #[inline(always)]
669 pub fn nbytes(&mut self) -> NBYTES_W<CR2rs> {
670 NBYTES_W::new(self, 16)
671 }
672 #[inline(always)]
674 pub fn reload(&mut self) -> RELOAD_W<CR2rs> {
675 RELOAD_W::new(self, 24)
676 }
677 #[inline(always)]
679 pub fn autoend(&mut self) -> AUTOEND_W<CR2rs> {
680 AUTOEND_W::new(self, 25)
681 }
682 #[inline(always)]
684 pub fn pecbyte(&mut self) -> PECBYTE_W<CR2rs> {
685 PECBYTE_W::new(self, 26)
686 }
687}
688pub struct CR2rs;
694impl crate::RegisterSpec for CR2rs {
695 type Ux = u32;
696}
697impl crate::Readable for CR2rs {}
699impl crate::Writable for CR2rs {
701 type Safety = crate::Unsafe;
702 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0400_e000;
703}
704impl crate::Resettable for CR2rs {}