stm32f0/stm32f0x8/usb/
fnr.rs1#[doc = "Register `FNR` reader"]
2pub struct R(crate::R<FNR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FNR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FNR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FNR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `FN` reader - Frame number"]
17pub type FN_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `LSOF` reader - Lost SOF"]
19pub type LSOF_R = crate::FieldReader<u8, u8>;
20#[doc = "Locked\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq)]
22pub enum LCK_A {
23 #[doc = "1: the frame timer remains in this state until an USB reset or USB suspend event occurs"]
24 Locked = 1,
25}
26impl From<LCK_A> for bool {
27 #[inline(always)]
28 fn from(variant: LCK_A) -> Self {
29 variant as u8 != 0
30 }
31}
32#[doc = "Field `LCK` reader - Locked"]
33pub type LCK_R = crate::BitReader<LCK_A>;
34impl LCK_R {
35 #[doc = "Get enumerated values variant"]
36 #[inline(always)]
37 pub fn variant(&self) -> Option<LCK_A> {
38 match self.bits {
39 true => Some(LCK_A::Locked),
40 _ => None,
41 }
42 }
43 #[doc = "Checks if the value of the field is `Locked`"]
44 #[inline(always)]
45 pub fn is_locked(&self) -> bool {
46 *self == LCK_A::Locked
47 }
48}
49#[doc = "Receive data - line status\n\nValue on reset: 0"]
50#[derive(Clone, Copy, Debug, PartialEq)]
51pub enum RXDM_A {
52 #[doc = "1: received data minus upstream port data line"]
53 Received = 1,
54}
55impl From<RXDM_A> for bool {
56 #[inline(always)]
57 fn from(variant: RXDM_A) -> Self {
58 variant as u8 != 0
59 }
60}
61#[doc = "Field `RXDM` reader - Receive data - line status"]
62pub type RXDM_R = crate::BitReader<RXDM_A>;
63impl RXDM_R {
64 #[doc = "Get enumerated values variant"]
65 #[inline(always)]
66 pub fn variant(&self) -> Option<RXDM_A> {
67 match self.bits {
68 true => Some(RXDM_A::Received),
69 _ => None,
70 }
71 }
72 #[doc = "Checks if the value of the field is `Received`"]
73 #[inline(always)]
74 pub fn is_received(&self) -> bool {
75 *self == RXDM_A::Received
76 }
77}
78#[doc = "Receive data + line status\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq)]
80pub enum RXDP_A {
81 #[doc = "1: received data plus upstream port data line"]
82 Received = 1,
83}
84impl From<RXDP_A> for bool {
85 #[inline(always)]
86 fn from(variant: RXDP_A) -> Self {
87 variant as u8 != 0
88 }
89}
90#[doc = "Field `RXDP` reader - Receive data + line status"]
91pub type RXDP_R = crate::BitReader<RXDP_A>;
92impl RXDP_R {
93 #[doc = "Get enumerated values variant"]
94 #[inline(always)]
95 pub fn variant(&self) -> Option<RXDP_A> {
96 match self.bits {
97 true => Some(RXDP_A::Received),
98 _ => None,
99 }
100 }
101 #[doc = "Checks if the value of the field is `Received`"]
102 #[inline(always)]
103 pub fn is_received(&self) -> bool {
104 *self == RXDP_A::Received
105 }
106}
107impl R {
108 #[doc = "Bits 0:10 - Frame number"]
109 #[inline(always)]
110 pub fn fn_(&self) -> FN_R {
111 FN_R::new((self.bits & 0x07ff) as u16)
112 }
113 #[doc = "Bits 11:12 - Lost SOF"]
114 #[inline(always)]
115 pub fn lsof(&self) -> LSOF_R {
116 LSOF_R::new(((self.bits >> 11) & 3) as u8)
117 }
118 #[doc = "Bit 13 - Locked"]
119 #[inline(always)]
120 pub fn lck(&self) -> LCK_R {
121 LCK_R::new(((self.bits >> 13) & 1) != 0)
122 }
123 #[doc = "Bit 14 - Receive data - line status"]
124 #[inline(always)]
125 pub fn rxdm(&self) -> RXDM_R {
126 RXDM_R::new(((self.bits >> 14) & 1) != 0)
127 }
128 #[doc = "Bit 15 - Receive data + line status"]
129 #[inline(always)]
130 pub fn rxdp(&self) -> RXDP_R {
131 RXDP_R::new(((self.bits >> 15) & 1) != 0)
132 }
133}
134#[doc = "frame number register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fnr](index.html) module"]
135pub struct FNR_SPEC;
136impl crate::RegisterSpec for FNR_SPEC {
137 type Ux = u32;
138}
139#[doc = "`read()` method returns [fnr::R](R) reader structure"]
140impl crate::Readable for FNR_SPEC {
141 type Reader = R;
142}
143#[doc = "`reset()` method sets FNR to value 0"]
144impl crate::Resettable for FNR_SPEC {
145 #[inline(always)]
146 fn reset_value() -> Self::Ux {
147 0
148 }
149}