stm32h7 0.16.0

Device support crates for STM32H7 devices
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
///Register `SR` reader
pub type R = crate::R<SRrs>;
/**Transmit interrupt status The flag indicates that the UCPD_TXDR register is empty and new data write is required (as the amount of data sent has not reached the payload size defined in the TXPAYSZ bitfield). The flag is cleared with the data write into the UCPD_TXDR register.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXIS {
    ///0: New Tx data write not required
    NotRequired = 0,
    ///1: New Tx data write required
    Required = 1,
}
impl From<TXIS> for bool {
    #[inline(always)]
    fn from(variant: TXIS) -> Self {
        variant as u8 != 0
    }
}
///Field `TXIS` reader - Transmit interrupt status The flag indicates that the UCPD_TXDR register is empty and new data write is required (as the amount of data sent has not reached the payload size defined in the TXPAYSZ bitfield). The flag is cleared with the data write into the UCPD_TXDR register.
pub type TXIS_R = crate::BitReader<TXIS>;
impl TXIS_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TXIS {
        match self.bits {
            false => TXIS::NotRequired,
            true => TXIS::Required,
        }
    }
    ///New Tx data write not required
    #[inline(always)]
    pub fn is_not_required(&self) -> bool {
        *self == TXIS::NotRequired
    }
    ///New Tx data write required
    #[inline(always)]
    pub fn is_required(&self) -> bool {
        *self == TXIS::Required
    }
}
/**Message transmission discarded The flag indicates that a message transmission was dropped. The flag is cleared by setting the TXMSGDISCCF bit. Transmission of a message can be dropped if there is a concurrent receive in progress or at excessive noise on the line. After a Tx message is discarded, the flag is only raised when the CC line becomes idle.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXMSGDISC {
    ///0: No Tx message discarded
    NotDiscarded = 0,
    ///1: Tx message discarded
    Discarded = 1,
}
impl From<TXMSGDISC> for bool {
    #[inline(always)]
    fn from(variant: TXMSGDISC) -> Self {
        variant as u8 != 0
    }
}
///Field `TXMSGDISC` reader - Message transmission discarded The flag indicates that a message transmission was dropped. The flag is cleared by setting the TXMSGDISCCF bit. Transmission of a message can be dropped if there is a concurrent receive in progress or at excessive noise on the line. After a Tx message is discarded, the flag is only raised when the CC line becomes idle.
pub type TXMSGDISC_R = crate::BitReader<TXMSGDISC>;
impl TXMSGDISC_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TXMSGDISC {
        match self.bits {
            false => TXMSGDISC::NotDiscarded,
            true => TXMSGDISC::Discarded,
        }
    }
    ///No Tx message discarded
    #[inline(always)]
    pub fn is_not_discarded(&self) -> bool {
        *self == TXMSGDISC::NotDiscarded
    }
    ///Tx message discarded
    #[inline(always)]
    pub fn is_discarded(&self) -> bool {
        *self == TXMSGDISC::Discarded
    }
}
/**Message transmission completed The flag indicates the completion of packet transmission. It is cleared by setting the TXMSGSENTCF bit. In the event of a message transmission interrupted by a Hard Reset, the flag is not raised.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXMSGSENT {
    ///0: No Tx message completed
    NotCompleted = 0,
    ///1: Tx message completed
    Completed = 1,
}
impl From<TXMSGSENT> for bool {
    #[inline(always)]
    fn from(variant: TXMSGSENT) -> Self {
        variant as u8 != 0
    }
}
///Field `TXMSGSENT` reader - Message transmission completed The flag indicates the completion of packet transmission. It is cleared by setting the TXMSGSENTCF bit. In the event of a message transmission interrupted by a Hard Reset, the flag is not raised.
pub type TXMSGSENT_R = crate::BitReader<TXMSGSENT>;
impl TXMSGSENT_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TXMSGSENT {
        match self.bits {
            false => TXMSGSENT::NotCompleted,
            true => TXMSGSENT::Completed,
        }
    }
    ///No Tx message completed
    #[inline(always)]
    pub fn is_not_completed(&self) -> bool {
        *self == TXMSGSENT::NotCompleted
    }
    ///Tx message completed
    #[inline(always)]
    pub fn is_completed(&self) -> bool {
        *self == TXMSGSENT::Completed
    }
}
/**Transmit message abort The flag indicates that a Tx message is aborted due to a subsequent Hard Reset message send request taking priority during transmit. It is cleared by setting the TXMSGABTCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXMSGABT {
    ///0: No transmit message abort
    NoAbort = 0,
    ///1: Transmit message abort
    Abort = 1,
}
impl From<TXMSGABT> for bool {
    #[inline(always)]
    fn from(variant: TXMSGABT) -> Self {
        variant as u8 != 0
    }
}
///Field `TXMSGABT` reader - Transmit message abort The flag indicates that a Tx message is aborted due to a subsequent Hard Reset message send request taking priority during transmit. It is cleared by setting the TXMSGABTCF bit.
pub type TXMSGABT_R = crate::BitReader<TXMSGABT>;
impl TXMSGABT_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TXMSGABT {
        match self.bits {
            false => TXMSGABT::NoAbort,
            true => TXMSGABT::Abort,
        }
    }
    ///No transmit message abort
    #[inline(always)]
    pub fn is_no_abort(&self) -> bool {
        *self == TXMSGABT::NoAbort
    }
    ///Transmit message abort
    #[inline(always)]
    pub fn is_abort(&self) -> bool {
        *self == TXMSGABT::Abort
    }
}
/**Hard Reset discarded The flag indicates that the Hard Reset message is discarded. The flag is cleared by setting the HRSTDISCCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HRSTDISC {
    ///0: No Hard Reset discarded
    NotDiscarded = 0,
    ///1: Hard Reset discarded
    Discarded = 1,
}
impl From<HRSTDISC> for bool {
    #[inline(always)]
    fn from(variant: HRSTDISC) -> Self {
        variant as u8 != 0
    }
}
///Field `HRSTDISC` reader - Hard Reset discarded The flag indicates that the Hard Reset message is discarded. The flag is cleared by setting the HRSTDISCCF bit.
pub type HRSTDISC_R = crate::BitReader<HRSTDISC>;
impl HRSTDISC_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> HRSTDISC {
        match self.bits {
            false => HRSTDISC::NotDiscarded,
            true => HRSTDISC::Discarded,
        }
    }
    ///No Hard Reset discarded
    #[inline(always)]
    pub fn is_not_discarded(&self) -> bool {
        *self == HRSTDISC::NotDiscarded
    }
    ///Hard Reset discarded
    #[inline(always)]
    pub fn is_discarded(&self) -> bool {
        *self == HRSTDISC::Discarded
    }
}
/**Hard Reset message sent The flag indicates that the Hard Reset message is sent. The flag is cleared by setting the HRSTSENTCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HRSTSENT {
    ///0: No Hard Reset message sent
    NotSent = 0,
    ///1: Hard Reset message sent
    Sent = 1,
}
impl From<HRSTSENT> for bool {
    #[inline(always)]
    fn from(variant: HRSTSENT) -> Self {
        variant as u8 != 0
    }
}
///Field `HRSTSENT` reader - Hard Reset message sent The flag indicates that the Hard Reset message is sent. The flag is cleared by setting the HRSTSENTCF bit.
pub type HRSTSENT_R = crate::BitReader<HRSTSENT>;
impl HRSTSENT_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> HRSTSENT {
        match self.bits {
            false => HRSTSENT::NotSent,
            true => HRSTSENT::Sent,
        }
    }
    ///No Hard Reset message sent
    #[inline(always)]
    pub fn is_not_sent(&self) -> bool {
        *self == HRSTSENT::NotSent
    }
    ///Hard Reset message sent
    #[inline(always)]
    pub fn is_sent(&self) -> bool {
        *self == HRSTSENT::Sent
    }
}
/**Tx data underrun detection The flag indicates that the Tx data register (UCPD_TXDR) was not written in time for a transmit message to execute normally. It is cleared by setting the TXUNDCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXUND {
    ///0: No Tx data underrun detected
    NoUnderrun = 0,
    ///1: Tx data underrun detected
    Underrun = 1,
}
impl From<TXUND> for bool {
    #[inline(always)]
    fn from(variant: TXUND) -> Self {
        variant as u8 != 0
    }
}
///Field `TXUND` reader - Tx data underrun detection The flag indicates that the Tx data register (UCPD_TXDR) was not written in time for a transmit message to execute normally. It is cleared by setting the TXUNDCF bit.
pub type TXUND_R = crate::BitReader<TXUND>;
impl TXUND_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TXUND {
        match self.bits {
            false => TXUND::NoUnderrun,
            true => TXUND::Underrun,
        }
    }
    ///No Tx data underrun detected
    #[inline(always)]
    pub fn is_no_underrun(&self) -> bool {
        *self == TXUND::NoUnderrun
    }
    ///Tx data underrun detected
    #[inline(always)]
    pub fn is_underrun(&self) -> bool {
        *self == TXUND::Underrun
    }
}
/**Receive data register not empty detection The flag indicates that the UCPD_RXDR register is not empty. It is automatically cleared upon reading UCPD_RXDR.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXNE {
    ///0: Rx data register empty
    Empty = 0,
    ///1: Rx data register not empty
    NotEmpty = 1,
}
impl From<RXNE> for bool {
    #[inline(always)]
    fn from(variant: RXNE) -> Self {
        variant as u8 != 0
    }
}
///Field `RXNE` reader - Receive data register not empty detection The flag indicates that the UCPD_RXDR register is not empty. It is automatically cleared upon reading UCPD_RXDR.
pub type RXNE_R = crate::BitReader<RXNE>;
impl RXNE_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> RXNE {
        match self.bits {
            false => RXNE::Empty,
            true => RXNE::NotEmpty,
        }
    }
    ///Rx data register empty
    #[inline(always)]
    pub fn is_empty(&self) -> bool {
        *self == RXNE::Empty
    }
    ///Rx data register not empty
    #[inline(always)]
    pub fn is_not_empty(&self) -> bool {
        *self == RXNE::NotEmpty
    }
}
/**Rx ordered set (4 K-codes) detection The flag indicates the detection of an ordered set. The relevant information is stored in the RXORDSET\[2:0\] bitfield of the UCPD_RX_ORDSET register. It is cleared by setting the RXORDDETCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXORDDET {
    ///0: No ordered set detected
    NoOrderedSet = 0,
    ///1: Ordered set detected
    OrderedSet = 1,
}
impl From<RXORDDET> for bool {
    #[inline(always)]
    fn from(variant: RXORDDET) -> Self {
        variant as u8 != 0
    }
}
///Field `RXORDDET` reader - Rx ordered set (4 K-codes) detection The flag indicates the detection of an ordered set. The relevant information is stored in the RXORDSET\[2:0\] bitfield of the UCPD_RX_ORDSET register. It is cleared by setting the RXORDDETCF bit.
pub type RXORDDET_R = crate::BitReader<RXORDDET>;
impl RXORDDET_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> RXORDDET {
        match self.bits {
            false => RXORDDET::NoOrderedSet,
            true => RXORDDET::OrderedSet,
        }
    }
    ///No ordered set detected
    #[inline(always)]
    pub fn is_no_ordered_set(&self) -> bool {
        *self == RXORDDET::NoOrderedSet
    }
    ///Ordered set detected
    #[inline(always)]
    pub fn is_ordered_set(&self) -> bool {
        *self == RXORDDET::OrderedSet
    }
}
/**Rx Hard Reset receipt detection The flag indicates the receipt of valid Hard Reset message. It is cleared by setting the RXHRSTDETCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXHRSTDET {
    ///0: Hard Reset not received
    NoHardReset = 0,
    ///1: Hard Reset received
    HardReset = 1,
}
impl From<RXHRSTDET> for bool {
    #[inline(always)]
    fn from(variant: RXHRSTDET) -> Self {
        variant as u8 != 0
    }
}
///Field `RXHRSTDET` reader - Rx Hard Reset receipt detection The flag indicates the receipt of valid Hard Reset message. It is cleared by setting the RXHRSTDETCF bit.
pub type RXHRSTDET_R = crate::BitReader<RXHRSTDET>;
impl RXHRSTDET_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> RXHRSTDET {
        match self.bits {
            false => RXHRSTDET::NoHardReset,
            true => RXHRSTDET::HardReset,
        }
    }
    ///Hard Reset not received
    #[inline(always)]
    pub fn is_no_hard_reset(&self) -> bool {
        *self == RXHRSTDET::NoHardReset
    }
    ///Hard Reset received
    #[inline(always)]
    pub fn is_hard_reset(&self) -> bool {
        *self == RXHRSTDET::HardReset
    }
}
/**Rx data overflow detection The flag indicates Rx data buffer overflow. It is cleared by setting the RXOVRCF bit. The buffer overflow can occur if the received data are not read fast enough.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXOVR {
    ///0: No overflow
    NoOverflow = 0,
    ///1: Overflow
    Overflow = 1,
}
impl From<RXOVR> for bool {
    #[inline(always)]
    fn from(variant: RXOVR) -> Self {
        variant as u8 != 0
    }
}
///Field `RXOVR` reader - Rx data overflow detection The flag indicates Rx data buffer overflow. It is cleared by setting the RXOVRCF bit. The buffer overflow can occur if the received data are not read fast enough.
pub type RXOVR_R = crate::BitReader<RXOVR>;
impl RXOVR_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> RXOVR {
        match self.bits {
            false => RXOVR::NoOverflow,
            true => RXOVR::Overflow,
        }
    }
    ///No overflow
    #[inline(always)]
    pub fn is_no_overflow(&self) -> bool {
        *self == RXOVR::NoOverflow
    }
    ///Overflow
    #[inline(always)]
    pub fn is_overflow(&self) -> bool {
        *self == RXOVR::Overflow
    }
}
/**Rx message received The flag indicates whether a message (except Hard Reset message) has been received, regardless the CRC value. The flag is cleared by setting the RXMSGENDCF bit. The RXERR flag set when the RXMSGEND flag goes high indicates errors in the last-received message.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXMSGEND {
    ///0: No new Rx message received
    NoNewMessage = 0,
    ///1: A new Rx message received
    NewMessage = 1,
}
impl From<RXMSGEND> for bool {
    #[inline(always)]
    fn from(variant: RXMSGEND) -> Self {
        variant as u8 != 0
    }
}
///Field `RXMSGEND` reader - Rx message received The flag indicates whether a message (except Hard Reset message) has been received, regardless the CRC value. The flag is cleared by setting the RXMSGENDCF bit. The RXERR flag set when the RXMSGEND flag goes high indicates errors in the last-received message.
pub type RXMSGEND_R = crate::BitReader<RXMSGEND>;
impl RXMSGEND_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> RXMSGEND {
        match self.bits {
            false => RXMSGEND::NoNewMessage,
            true => RXMSGEND::NewMessage,
        }
    }
    ///No new Rx message received
    #[inline(always)]
    pub fn is_no_new_message(&self) -> bool {
        *self == RXMSGEND::NoNewMessage
    }
    ///A new Rx message received
    #[inline(always)]
    pub fn is_new_message(&self) -> bool {
        *self == RXMSGEND::NewMessage
    }
}
/**Receive message error The flag indicates errors of the last Rx message declared (via RXMSGEND), such as incorrect CRC or truncated message (a line becoming static before EOP is met). It is asserted whenever the RXMSGEND flag is set.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXERR {
    ///0: No error detected
    NoError = 0,
    ///1: Error(s) detected
    Error = 1,
}
impl From<RXERR> for bool {
    #[inline(always)]
    fn from(variant: RXERR) -> Self {
        variant as u8 != 0
    }
}
///Field `RXERR` reader - Receive message error The flag indicates errors of the last Rx message declared (via RXMSGEND), such as incorrect CRC or truncated message (a line becoming static before EOP is met). It is asserted whenever the RXMSGEND flag is set.
pub type RXERR_R = crate::BitReader<RXERR>;
impl RXERR_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> RXERR {
        match self.bits {
            false => RXERR::NoError,
            true => RXERR::Error,
        }
    }
    ///No error detected
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        *self == RXERR::NoError
    }
    ///Error(s) detected
    #[inline(always)]
    pub fn is_error(&self) -> bool {
        *self == RXERR::Error
    }
}
/**Type-C voltage level event on CC1 line The flag indicates a change of the TYPEC_VSTATE_CC1\[1:0\] bitfield value, which corresponds to a new Type-C event. It is cleared by setting the TYPECEVT2CF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TYPECEVT1 {
    ///0: No new event
    NoNewEvent = 0,
    ///1: A new Type-C event occurred
    NewEvent = 1,
}
impl From<TYPECEVT1> for bool {
    #[inline(always)]
    fn from(variant: TYPECEVT1) -> Self {
        variant as u8 != 0
    }
}
///Field `TYPECEVT1` reader - Type-C voltage level event on CC1 line The flag indicates a change of the TYPEC_VSTATE_CC1\[1:0\] bitfield value, which corresponds to a new Type-C event. It is cleared by setting the TYPECEVT2CF bit.
pub type TYPECEVT1_R = crate::BitReader<TYPECEVT1>;
impl TYPECEVT1_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TYPECEVT1 {
        match self.bits {
            false => TYPECEVT1::NoNewEvent,
            true => TYPECEVT1::NewEvent,
        }
    }
    ///No new event
    #[inline(always)]
    pub fn is_no_new_event(&self) -> bool {
        *self == TYPECEVT1::NoNewEvent
    }
    ///A new Type-C event occurred
    #[inline(always)]
    pub fn is_new_event(&self) -> bool {
        *self == TYPECEVT1::NewEvent
    }
}
///Field `TYPECEVT2` reader - Type-C voltage level event on CC2 line The flag indicates a change of the TYPEC_VSTATE_CC2\[1:0\] bitfield value, which corresponds to a new Type-C event. It is cleared by setting the TYPECEVT2CF bit.
pub use TYPECEVT1_R as TYPECEVT2_R;
/**The status bitfield indicates the voltage level on the CC1 line in its steady state. The voltage variation on the CC1 line during USB PD messages due to the BMC PHY modulation does not impact the bitfield value.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TYPEC_VSTATE_CC1 {
    ///0: Lowest
    Lowest = 0,
    ///1: Low
    Low = 1,
    ///2: High
    High = 2,
    ///3: Highest
    Highest = 3,
}
impl From<TYPEC_VSTATE_CC1> for u8 {
    #[inline(always)]
    fn from(variant: TYPEC_VSTATE_CC1) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for TYPEC_VSTATE_CC1 {
    type Ux = u8;
}
impl crate::IsEnum for TYPEC_VSTATE_CC1 {}
///Field `TYPEC_VSTATE_CC1` reader - The status bitfield indicates the voltage level on the CC1 line in its steady state. The voltage variation on the CC1 line during USB PD messages due to the BMC PHY modulation does not impact the bitfield value.
pub type TYPEC_VSTATE_CC1_R = crate::FieldReader<TYPEC_VSTATE_CC1>;
impl TYPEC_VSTATE_CC1_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> TYPEC_VSTATE_CC1 {
        match self.bits {
            0 => TYPEC_VSTATE_CC1::Lowest,
            1 => TYPEC_VSTATE_CC1::Low,
            2 => TYPEC_VSTATE_CC1::High,
            3 => TYPEC_VSTATE_CC1::Highest,
            _ => unreachable!(),
        }
    }
    ///Lowest
    #[inline(always)]
    pub fn is_lowest(&self) -> bool {
        *self == TYPEC_VSTATE_CC1::Lowest
    }
    ///Low
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == TYPEC_VSTATE_CC1::Low
    }
    ///High
    #[inline(always)]
    pub fn is_high(&self) -> bool {
        *self == TYPEC_VSTATE_CC1::High
    }
    ///Highest
    #[inline(always)]
    pub fn is_highest(&self) -> bool {
        *self == TYPEC_VSTATE_CC1::Highest
    }
}
///Field `TYPEC_VSTATE_CC2` reader - CC2 line voltage level The status bitfield indicates the voltage level on the CC2 line in its steady state. The voltage variation on the CC2 line during USB PD messages due to the BMC PHY modulation does not impact the bitfield value.
pub use TYPEC_VSTATE_CC1_R as TYPEC_VSTATE_CC2_R;
/**FRS detection event The flag is cleared by setting the FRSEVTCF bit.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FRSEVT {
    ///0: No new event
    NoNewEvent = 0,
    ///1: New FRS receive event occurred
    NewEvent = 1,
}
impl From<FRSEVT> for bool {
    #[inline(always)]
    fn from(variant: FRSEVT) -> Self {
        variant as u8 != 0
    }
}
///Field `FRSEVT` reader - FRS detection event The flag is cleared by setting the FRSEVTCF bit.
pub type FRSEVT_R = crate::BitReader<FRSEVT>;
impl FRSEVT_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> FRSEVT {
        match self.bits {
            false => FRSEVT::NoNewEvent,
            true => FRSEVT::NewEvent,
        }
    }
    ///No new event
    #[inline(always)]
    pub fn is_no_new_event(&self) -> bool {
        *self == FRSEVT::NoNewEvent
    }
    ///New FRS receive event occurred
    #[inline(always)]
    pub fn is_new_event(&self) -> bool {
        *self == FRSEVT::NewEvent
    }
}
impl R {
    ///Bit 0 - Transmit interrupt status The flag indicates that the UCPD_TXDR register is empty and new data write is required (as the amount of data sent has not reached the payload size defined in the TXPAYSZ bitfield). The flag is cleared with the data write into the UCPD_TXDR register.
    #[inline(always)]
    pub fn txis(&self) -> TXIS_R {
        TXIS_R::new((self.bits & 1) != 0)
    }
    ///Bit 1 - Message transmission discarded The flag indicates that a message transmission was dropped. The flag is cleared by setting the TXMSGDISCCF bit. Transmission of a message can be dropped if there is a concurrent receive in progress or at excessive noise on the line. After a Tx message is discarded, the flag is only raised when the CC line becomes idle.
    #[inline(always)]
    pub fn txmsgdisc(&self) -> TXMSGDISC_R {
        TXMSGDISC_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - Message transmission completed The flag indicates the completion of packet transmission. It is cleared by setting the TXMSGSENTCF bit. In the event of a message transmission interrupted by a Hard Reset, the flag is not raised.
    #[inline(always)]
    pub fn txmsgsent(&self) -> TXMSGSENT_R {
        TXMSGSENT_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 3 - Transmit message abort The flag indicates that a Tx message is aborted due to a subsequent Hard Reset message send request taking priority during transmit. It is cleared by setting the TXMSGABTCF bit.
    #[inline(always)]
    pub fn txmsgabt(&self) -> TXMSGABT_R {
        TXMSGABT_R::new(((self.bits >> 3) & 1) != 0)
    }
    ///Bit 4 - Hard Reset discarded The flag indicates that the Hard Reset message is discarded. The flag is cleared by setting the HRSTDISCCF bit.
    #[inline(always)]
    pub fn hrstdisc(&self) -> HRSTDISC_R {
        HRSTDISC_R::new(((self.bits >> 4) & 1) != 0)
    }
    ///Bit 5 - Hard Reset message sent The flag indicates that the Hard Reset message is sent. The flag is cleared by setting the HRSTSENTCF bit.
    #[inline(always)]
    pub fn hrstsent(&self) -> HRSTSENT_R {
        HRSTSENT_R::new(((self.bits >> 5) & 1) != 0)
    }
    ///Bit 6 - Tx data underrun detection The flag indicates that the Tx data register (UCPD_TXDR) was not written in time for a transmit message to execute normally. It is cleared by setting the TXUNDCF bit.
    #[inline(always)]
    pub fn txund(&self) -> TXUND_R {
        TXUND_R::new(((self.bits >> 6) & 1) != 0)
    }
    ///Bit 8 - Receive data register not empty detection The flag indicates that the UCPD_RXDR register is not empty. It is automatically cleared upon reading UCPD_RXDR.
    #[inline(always)]
    pub fn rxne(&self) -> RXNE_R {
        RXNE_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bit 9 - Rx ordered set (4 K-codes) detection The flag indicates the detection of an ordered set. The relevant information is stored in the RXORDSET\[2:0\] bitfield of the UCPD_RX_ORDSET register. It is cleared by setting the RXORDDETCF bit.
    #[inline(always)]
    pub fn rxorddet(&self) -> RXORDDET_R {
        RXORDDET_R::new(((self.bits >> 9) & 1) != 0)
    }
    ///Bit 10 - Rx Hard Reset receipt detection The flag indicates the receipt of valid Hard Reset message. It is cleared by setting the RXHRSTDETCF bit.
    #[inline(always)]
    pub fn rxhrstdet(&self) -> RXHRSTDET_R {
        RXHRSTDET_R::new(((self.bits >> 10) & 1) != 0)
    }
    ///Bit 11 - Rx data overflow detection The flag indicates Rx data buffer overflow. It is cleared by setting the RXOVRCF bit. The buffer overflow can occur if the received data are not read fast enough.
    #[inline(always)]
    pub fn rxovr(&self) -> RXOVR_R {
        RXOVR_R::new(((self.bits >> 11) & 1) != 0)
    }
    ///Bit 12 - Rx message received The flag indicates whether a message (except Hard Reset message) has been received, regardless the CRC value. The flag is cleared by setting the RXMSGENDCF bit. The RXERR flag set when the RXMSGEND flag goes high indicates errors in the last-received message.
    #[inline(always)]
    pub fn rxmsgend(&self) -> RXMSGEND_R {
        RXMSGEND_R::new(((self.bits >> 12) & 1) != 0)
    }
    ///Bit 13 - Receive message error The flag indicates errors of the last Rx message declared (via RXMSGEND), such as incorrect CRC or truncated message (a line becoming static before EOP is met). It is asserted whenever the RXMSGEND flag is set.
    #[inline(always)]
    pub fn rxerr(&self) -> RXERR_R {
        RXERR_R::new(((self.bits >> 13) & 1) != 0)
    }
    ///Bit 14 - Type-C voltage level event on CC1 line The flag indicates a change of the TYPEC_VSTATE_CC1\[1:0\] bitfield value, which corresponds to a new Type-C event. It is cleared by setting the TYPECEVT2CF bit.
    #[inline(always)]
    pub fn typecevt1(&self) -> TYPECEVT1_R {
        TYPECEVT1_R::new(((self.bits >> 14) & 1) != 0)
    }
    ///Bit 15 - Type-C voltage level event on CC2 line The flag indicates a change of the TYPEC_VSTATE_CC2\[1:0\] bitfield value, which corresponds to a new Type-C event. It is cleared by setting the TYPECEVT2CF bit.
    #[inline(always)]
    pub fn typecevt2(&self) -> TYPECEVT2_R {
        TYPECEVT2_R::new(((self.bits >> 15) & 1) != 0)
    }
    ///Bits 16:17 - The status bitfield indicates the voltage level on the CC1 line in its steady state. The voltage variation on the CC1 line during USB PD messages due to the BMC PHY modulation does not impact the bitfield value.
    #[inline(always)]
    pub fn typec_vstate_cc1(&self) -> TYPEC_VSTATE_CC1_R {
        TYPEC_VSTATE_CC1_R::new(((self.bits >> 16) & 3) as u8)
    }
    ///Bits 18:19 - CC2 line voltage level The status bitfield indicates the voltage level on the CC2 line in its steady state. The voltage variation on the CC2 line during USB PD messages due to the BMC PHY modulation does not impact the bitfield value.
    #[inline(always)]
    pub fn typec_vstate_cc2(&self) -> TYPEC_VSTATE_CC2_R {
        TYPEC_VSTATE_CC2_R::new(((self.bits >> 18) & 3) as u8)
    }
    ///Bit 20 - FRS detection event The flag is cleared by setting the FRSEVTCF bit.
    #[inline(always)]
    pub fn frsevt(&self) -> FRSEVT_R {
        FRSEVT_R::new(((self.bits >> 20) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("SR")
            .field("txis", &self.txis())
            .field("txmsgdisc", &self.txmsgdisc())
            .field("txmsgsent", &self.txmsgsent())
            .field("txmsgabt", &self.txmsgabt())
            .field("hrstdisc", &self.hrstdisc())
            .field("hrstsent", &self.hrstsent())
            .field("txund", &self.txund())
            .field("rxne", &self.rxne())
            .field("rxorddet", &self.rxorddet())
            .field("rxhrstdet", &self.rxhrstdet())
            .field("rxovr", &self.rxovr())
            .field("rxmsgend", &self.rxmsgend())
            .field("rxerr", &self.rxerr())
            .field("typecevt1", &self.typecevt1())
            .field("typecevt2", &self.typecevt2())
            .field("typec_vstate_cc1", &self.typec_vstate_cc1())
            .field("typec_vstate_cc2", &self.typec_vstate_cc2())
            .field("frsevt", &self.frsevt())
            .finish()
    }
}
/**UCPD status register

You can [`read`](crate::Reg::read) this register and get [`sr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
pub struct SRrs;
impl crate::RegisterSpec for SRrs {
    type Ux = u32;
}
///`read()` method returns [`sr::R`](R) reader structure
impl crate::Readable for SRrs {}
///`reset()` method sets SR to value 0
impl crate::Resettable for SRrs {}