File tree Expand file tree Collapse file tree 6 files changed +15
-9
lines changed Expand file tree Collapse file tree 6 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -22,5 +22,5 @@ lto = true
22
22
opt-level = " s"
23
23
24
24
[patch .crates-io .usb-device ]
25
- git = " https://github.com/jonas-schievink /usb-device.git"
25
+ git = " https://github.com/unrelentingtech /usb-device.git"
26
26
branch = " inhibit-setaddr-resp"
Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ cortex-m-rt = "0.6.12"
10
10
cortex-m-semihosting = " 0.3.5"
11
11
panic-semihosting = " 0.5.3"
12
12
nrf52840-pac = " 0.9.0"
13
- usb-device = " 0.2.5 "
13
+ usb-device = " 0.2.7 "
14
14
usbd-serial = " 0.1.0"
15
15
16
16
[dependencies .nrf52840-hal ]
17
- version = " 0.10 .0"
17
+ version = " 0.12 .0"
18
18
path = " ../../nrf52840-hal"
19
+
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ fn main() -> ! {
51
51
let p1 = p1:: Parts :: new ( periph. P1 ) ;
52
52
53
53
let mut led = p0. p0_23 . into_push_pull_output ( Level :: High ) ;
54
+
54
55
let btn = p1. p1_00 . into_pullup_input ( ) ;
55
56
while btn. is_high ( ) . unwrap ( ) { }
56
57
@@ -79,6 +80,11 @@ fn main() -> ! {
79
80
if new_state != state {
80
81
hprintln ! ( "{:?} {:#x}" , new_state, usb_dev. bus( ) . device_address( ) ) . ok ( ) ;
81
82
state = new_state;
83
+
84
+ if state == UsbDeviceState :: Configured {
85
+ serial. write ( b"Hello, world!\n " ) . unwrap ( ) ;
86
+ serial. flush ( ) . unwrap ( ) ;
87
+ }
82
88
}
83
89
}
84
90
}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ optional = true
39
39
version = " 0.9.0"
40
40
41
41
[dependencies .usb-device ]
42
- version = " 0.2.5 "
42
+ version = " 0.2.7 "
43
43
optional = true
44
44
45
45
[dependencies .nrf52810-pac ]
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ mod errata;
10
10
11
11
use crate :: {
12
12
clocks:: { Clocks , ExternalOscillator } ,
13
- target :: USBD ,
13
+ pac :: USBD ,
14
14
} ;
15
15
use core:: sync:: atomic:: { compiler_fence, Ordering } ;
16
16
use core:: { cell:: Cell , mem, ptr, slice} ;
@@ -470,7 +470,7 @@ impl UsbBus for Usbd<'_> {
470
470
// stage and must be followed by us responding with an ACK token to an OUT token
471
471
// sent from the host (AKA the status stage) -- `usb-device` provides no call back
472
472
// for that so we'll trigger the status stage using a shortcut
473
- let is_short_packet = buf. len ( ) < self . max_packet_size_0 . into ( ) ;
473
+ let is_short_packet = buf. len ( ) < self . max_packet_size_0 as usize ;
474
474
regs. shorts . modify ( |_, w| {
475
475
if is_short_packet {
476
476
w. ep0datadone_ep0status ( ) . set_bit ( )
@@ -572,7 +572,7 @@ impl UsbBus for Usbd<'_> {
572
572
573
573
unsafe {
574
574
if ep_addr. index ( ) == 0 {
575
- regs. tasks_ep0stall . write ( |w| w. tasks_ep0stall ( ) . set_bit ( ) ) ;
575
+ regs. tasks_ep0stall . write ( |w| w. tasks_ep0stall ( ) . bit ( stalled ) ) ;
576
576
} else {
577
577
regs. epstall . write ( |w| {
578
578
w. ep ( )
@@ -607,7 +607,6 @@ impl UsbBus for Usbd<'_> {
607
607
errata:: pre_wakeup ( ) ;
608
608
609
609
regs. lowpower . write ( |w| w. lowpower ( ) . force_normal ( ) ) ;
610
-
611
610
} ) ;
612
611
}
613
612
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ nrf52840-pac = "0.9.0"
22
22
[dependencies .nrf-hal-common ]
23
23
path = " ../nrf-hal-common"
24
24
default-features = false
25
- features = [" 52840" ]
25
+ features = [" 52840" , " usb-device " ]
26
26
version = " =0.12.0"
27
27
28
28
[dependencies .embedded-hal ]
You can’t perform that action at this time.
0 commit comments