File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ edition = "2018"
12
12
version = " 0.7.0"
13
13
14
14
[package .metadata .docs .rs ]
15
- features = [" stm32f103" , " rt" , " stm32-usbd " ]
15
+ features = [" stm32f103" , " rt" ]
16
16
default-target = " x86_64-unknown-linux-gnu"
17
17
18
18
[dependencies ]
@@ -36,8 +36,7 @@ version = "0.2.3"
36
36
features = [" unproven" ]
37
37
38
38
[dependencies .stm32-usbd ]
39
- version = " 0.5.0"
40
- features = [" ram_access_1x16" ]
39
+ version = " 0.6.0"
41
40
optional = true
42
41
43
42
[dev-dependencies ]
@@ -79,7 +78,7 @@ doc = []
79
78
rt = [" stm32f1/rt" ]
80
79
stm32f100 = [" stm32f1/stm32f100" , " device-selected" ]
81
80
stm32f101 = [" stm32f1/stm32f101" , " device-selected" ]
82
- stm32f103 = [" stm32f1/stm32f103" , " device-selected" , " has-can" ]
81
+ stm32f103 = [" stm32f1/stm32f103" , " device-selected" , " has-can" , " stm32-usbd " ]
83
82
stm32f105 = [" stm32f1/stm32f107" , " device-selected" , " connectivity" ]
84
83
stm32f107 = [" stm32f1/stm32f107" , " device-selected" , " connectivity" ]
85
84
Original file line number Diff line number Diff line change @@ -180,10 +180,7 @@ pub mod spi;
180
180
pub mod time;
181
181
#[ cfg( feature = "device-selected" ) ]
182
182
pub mod timer;
183
- #[ cfg( all(
184
- feature = "stm32-usbd" ,
185
- any( feature = "stm32f102" , feature = "stm32f103" )
186
- ) ) ]
183
+ #[ cfg( all( feature = "device-selected" , feature = "stm32-usbd" ) ) ]
187
184
pub mod usb;
188
185
#[ cfg( feature = "device-selected" ) ]
189
186
pub mod watchdog;
Original file line number Diff line number Diff line change 5
5
//! for usage examples.
6
6
7
7
use crate :: pac:: { RCC , USB } ;
8
+ use crate :: rcc:: { Enable , Reset } ;
8
9
use stm32_usbd:: UsbPeripheral ;
9
10
10
11
use crate :: gpio:: gpioa:: { PA11 , PA12 } ;
@@ -24,18 +25,17 @@ unsafe impl UsbPeripheral for Peripheral {
24
25
const DP_PULL_UP_FEATURE : bool = false ;
25
26
const EP_MEMORY : * const ( ) = 0x4000_6000 as _ ;
26
27
const EP_MEMORY_SIZE : usize = 512 ;
28
+ const EP_MEMORY_ACCESS_2X16 : bool = false ;
27
29
28
30
fn enable ( ) {
29
- let rcc = unsafe { ( & * RCC :: ptr ( ) ) } ;
31
+ unsafe {
32
+ let rcc = & * RCC :: ptr ( ) ;
30
33
31
- cortex_m:: interrupt:: free ( |_| {
32
34
// Enable USB peripheral
33
- rcc. apb1enr . modify ( |_, w| w. usben ( ) . set_bit ( ) ) ;
34
-
35
+ USB :: enable ( rcc) ;
35
36
// Reset USB peripheral
36
- rcc. apb1rstr . modify ( |_, w| w. usbrst ( ) . set_bit ( ) ) ;
37
- rcc. apb1rstr . modify ( |_, w| w. usbrst ( ) . clear_bit ( ) ) ;
38
- } ) ;
37
+ USB :: reset ( rcc) ;
38
+ }
39
39
}
40
40
41
41
fn startup_delay ( ) {
You can’t perform that action at this time.
0 commit comments