Skip to content

Commit 780ab7f

Browse files
Revert "make the example compile again"
This reverts commit 2dcb6fe.
1 parent d393f0f commit 780ab7f

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

examples/usb/src/main.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use nrf52840_hal::gpio::{p0, p1, Level};
1010
use nrf52840_hal::prelude::*;
1111
use nrf52840_hal::timer::{OneShot, Timer};
1212
use nrf52840_hal::usbd::Usbd;
13-
use nrf52840_hal::clocks::Clocks;
1413
use nrf52840_pac::{interrupt, Peripherals, TIMER0};
1514
use usb_device::device::{UsbDeviceBuilder, UsbDeviceState, UsbVidPid};
1615
use usbd_serial::{SerialPort, USB_CLASS_CDC};
@@ -22,7 +21,7 @@ fn TIMER0() {
2221

2322
#[entry]
2423
fn main() -> ! {
25-
static mut EP_BUF: [u8; 512] = [0; 512];
24+
static mut EP_BUF: [u8; 256] = [0; 256];
2625

2726
let core = cortex_m::Peripherals::take().unwrap();
2827
let periph = Peripherals::take().unwrap();
@@ -34,18 +33,6 @@ fn main() -> ! {
3433
.is_vbus_present()
3534
{}
3635

37-
// wait until USB 3.3V supply is stable
38-
while !periph
39-
.POWER
40-
.events_usbpwrrdy
41-
.read()
42-
.events_usbpwrrdy()
43-
.bit_is_clear()
44-
{}
45-
46-
let clocks = Clocks::new(periph.CLOCK);
47-
let clocks = clocks.enable_ext_hfosc();
48-
4936
let mut nvic = core.NVIC;
5037
let mut timer = Timer::one_shot(periph.TIMER0);
5138
let usbd = periph.USBD;
@@ -61,13 +48,12 @@ fn main() -> ! {
6148

6249
led.set_low().unwrap();
6350

64-
let usb_bus = Usbd::new_alloc(usbd, EP_BUF, &clocks);
51+
let usb_bus = Usbd::new_alloc(usbd, EP_BUF);
6552
let mut serial = SerialPort::new(&usb_bus);
6653

6754
let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
6855
.product("nRF52840 Serial Port Demo")
6956
.device_class(USB_CLASS_CDC)
70-
.max_packet_size_0(64) // (makes control transfers 8x faster)
7157
.build();
7258

7359
hprintln!("<start>").ok();

0 commit comments

Comments
 (0)