stm32_usbd/pac/usb/
fnr.rs1#[doc = "Reader of register FNR"]
2pub type R = crate::pac::generic::R<u32, super::FNR>;
3#[doc = "Reader of field `FN`"]
4pub type FN_R = crate::pac::generic::R<u16, u16>;
5#[doc = "Reader of field `LSOF`"]
6pub type LSOF_R = crate::pac::generic::R<u8, u8>;
7#[doc = "Locked\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq)]
9pub enum LCK_A {
10 #[doc = "1: the frame timer remains in this state until an USB reset or USB suspend event occurs"]
11 LOCKED = 1,
12}
13impl From<LCK_A> for bool {
14 #[inline(always)]
15 fn from(variant: LCK_A) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Reader of field `LCK`"]
20pub type LCK_R = crate::pac::generic::R<bool, LCK_A>;
21impl LCK_R {
22 #[doc = r"Get enumerated values variant"]
23 #[inline(always)]
24 pub fn variant(&self) -> crate::pac::generic::Variant<bool, LCK_A> {
25 use crate::pac::generic::Variant::*;
26 match self.bits {
27 true => Val(LCK_A::LOCKED),
28 i => Res(i),
29 }
30 }
31 #[doc = "Checks if the value of the field is `LOCKED`"]
32 #[inline(always)]
33 pub fn is_locked(&self) -> bool {
34 *self == LCK_A::LOCKED
35 }
36}
37#[doc = "Receive data - line status\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum RXDM_A {
40 #[doc = "1: received data minus upstream port data line"]
41 RECEIVED = 1,
42}
43impl From<RXDM_A> for bool {
44 #[inline(always)]
45 fn from(variant: RXDM_A) -> Self {
46 variant as u8 != 0
47 }
48}
49#[doc = "Reader of field `RXDM`"]
50pub type RXDM_R = crate::pac::generic::R<bool, RXDM_A>;
51impl RXDM_R {
52 #[doc = r"Get enumerated values variant"]
53 #[inline(always)]
54 pub fn variant(&self) -> crate::pac::generic::Variant<bool, RXDM_A> {
55 use crate::pac::generic::Variant::*;
56 match self.bits {
57 true => Val(RXDM_A::RECEIVED),
58 i => Res(i),
59 }
60 }
61 #[doc = "Checks if the value of the field is `RECEIVED`"]
62 #[inline(always)]
63 pub fn is_received(&self) -> bool {
64 *self == RXDM_A::RECEIVED
65 }
66}
67#[doc = "Receive data + line status\n\nValue on reset: 0"]
68#[derive(Clone, Copy, Debug, PartialEq)]
69pub enum RXDP_A {
70 #[doc = "1: received data plus upstream port data line"]
71 RECEIVED = 1,
72}
73impl From<RXDP_A> for bool {
74 #[inline(always)]
75 fn from(variant: RXDP_A) -> Self {
76 variant as u8 != 0
77 }
78}
79#[doc = "Reader of field `RXDP`"]
80pub type RXDP_R = crate::pac::generic::R<bool, RXDP_A>;
81impl RXDP_R {
82 #[doc = r"Get enumerated values variant"]
83 #[inline(always)]
84 pub fn variant(&self) -> crate::pac::generic::Variant<bool, RXDP_A> {
85 use crate::pac::generic::Variant::*;
86 match self.bits {
87 true => Val(RXDP_A::RECEIVED),
88 i => Res(i),
89 }
90 }
91 #[doc = "Checks if the value of the field is `RECEIVED`"]
92 #[inline(always)]
93 pub fn is_received(&self) -> bool {
94 *self == RXDP_A::RECEIVED
95 }
96}
97impl R {
98 #[doc = "Bits 0:10 - Frame number"]
99 #[inline(always)]
100 pub fn fn_(&self) -> FN_R {
101 FN_R::new((self.bits & 0x07ff) as u16)
102 }
103 #[doc = "Bits 11:12 - Lost SOF"]
104 #[inline(always)]
105 pub fn lsof(&self) -> LSOF_R {
106 LSOF_R::new(((self.bits >> 11) & 0x03) as u8)
107 }
108 #[doc = "Bit 13 - Locked"]
109 #[inline(always)]
110 pub fn lck(&self) -> LCK_R {
111 LCK_R::new(((self.bits >> 13) & 0x01) != 0)
112 }
113 #[doc = "Bit 14 - Receive data - line status"]
114 #[inline(always)]
115 pub fn rxdm(&self) -> RXDM_R {
116 RXDM_R::new(((self.bits >> 14) & 0x01) != 0)
117 }
118 #[doc = "Bit 15 - Receive data + line status"]
119 #[inline(always)]
120 pub fn rxdp(&self) -> RXDP_R {
121 RXDP_R::new(((self.bits >> 15) & 0x01) != 0)
122 }
123}