stm32f1_staging/stm32f103/usb/
fnr.rs

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
///Register `FNR` reader
pub type R = crate::R<FNRrs>;
///Field `FN` reader - Frame number
pub type FN_R = crate::FieldReader<u16>;
///Field `LSOF` reader - Lost SOF
pub type LSOF_R = crate::FieldReader;
/**Locked

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LCK {
    ///1: the frame timer remains in this state until an USB reset or USB suspend event occurs
    Locked = 1,
}
impl From<LCK> for bool {
    #[inline(always)]
    fn from(variant: LCK) -> Self {
        variant as u8 != 0
    }
}
///Field `LCK` reader - Locked
pub type LCK_R = crate::BitReader<LCK>;
impl LCK_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<LCK> {
        match self.bits {
            true => Some(LCK::Locked),
            _ => None,
        }
    }
    ///the frame timer remains in this state until an USB reset or USB suspend event occurs
    #[inline(always)]
    pub fn is_locked(&self) -> bool {
        *self == LCK::Locked
    }
}
/**Receive data - line status

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXDM {
    ///1: received data minus upstream port data line
    Received = 1,
}
impl From<RXDM> for bool {
    #[inline(always)]
    fn from(variant: RXDM) -> Self {
        variant as u8 != 0
    }
}
///Field `RXDM` reader - Receive data - line status
pub type RXDM_R = crate::BitReader<RXDM>;
impl RXDM_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<RXDM> {
        match self.bits {
            true => Some(RXDM::Received),
            _ => None,
        }
    }
    ///received data minus upstream port data line
    #[inline(always)]
    pub fn is_received(&self) -> bool {
        *self == RXDM::Received
    }
}
/**Receive data + line status

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXDP {
    ///1: received data plus upstream port data line
    Received = 1,
}
impl From<RXDP> for bool {
    #[inline(always)]
    fn from(variant: RXDP) -> Self {
        variant as u8 != 0
    }
}
///Field `RXDP` reader - Receive data + line status
pub type RXDP_R = crate::BitReader<RXDP>;
impl RXDP_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<RXDP> {
        match self.bits {
            true => Some(RXDP::Received),
            _ => None,
        }
    }
    ///received data plus upstream port data line
    #[inline(always)]
    pub fn is_received(&self) -> bool {
        *self == RXDP::Received
    }
}
impl R {
    ///Bits 0:10 - Frame number
    #[inline(always)]
    pub fn fn_(&self) -> FN_R {
        FN_R::new((self.bits & 0x07ff) as u16)
    }
    ///Bits 11:12 - Lost SOF
    #[inline(always)]
    pub fn lsof(&self) -> LSOF_R {
        LSOF_R::new(((self.bits >> 11) & 3) as u8)
    }
    ///Bit 13 - Locked
    #[inline(always)]
    pub fn lck(&self) -> LCK_R {
        LCK_R::new(((self.bits >> 13) & 1) != 0)
    }
    ///Bit 14 - Receive data - line status
    #[inline(always)]
    pub fn rxdm(&self) -> RXDM_R {
        RXDM_R::new(((self.bits >> 14) & 1) != 0)
    }
    ///Bit 15 - Receive data + line status
    #[inline(always)]
    pub fn rxdp(&self) -> RXDP_R {
        RXDP_R::new(((self.bits >> 15) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("FNR")
            .field("fn_", &self.fn_())
            .field("lsof", &self.lsof())
            .field("lck", &self.lck())
            .field("rxdm", &self.rxdm())
            .field("rxdp", &self.rxdp())
            .finish()
    }
}
/**frame number register

You can [`read`](crate::Reg::read) this register and get [`fnr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api).

See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#USB:FNR)*/
pub struct FNRrs;
impl crate::RegisterSpec for FNRrs {
    type Ux = u32;
}
///`read()` method returns [`fnr::R`](R) reader structure
impl crate::Readable for FNRrs {}
///`reset()` method sets FNR to value 0
impl crate::Resettable for FNRrs {
    const RESET_VALUE: u32 = 0;
}