stm32/usb: do not require embassy-time.

Fixes #1466
This commit is contained in:
Dario Nieuwenhuis 2023-05-19 15:20:37 +02:00
parent 4b303949bf
commit f43d57846e
2 changed files with 5 additions and 3 deletions

View File

@ -58,7 +58,7 @@ pub mod spi;
pub mod tl_mbox;
#[cfg(usart)]
pub mod usart;
#[cfg(all(usb, feature = "time"))]
#[cfg(usb)]
pub mod usb;
#[cfg(otg)]
pub mod usb_otg;

View File

@ -7,7 +7,6 @@ use core::task::Poll;
use embassy_hal_common::into_ref;
use embassy_sync::waitqueue::AtomicWaker;
use embassy_time::{block_for, Duration};
use embassy_usb_driver as driver;
use embassy_usb_driver::{
Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointInfo, EndpointType, Event, Unsupported,
@ -200,7 +199,10 @@ impl<'d, T: Instance> Driver<'d, T> {
w.set_fres(true);
});
block_for(Duration::from_millis(100));
#[cfg(time)]
embassy_time::block_for(embassy_time::Duration::from_millis(100));
#[cfg(not(time))]
cortex_m::asm::delay(crate::rcc::get_freqs().sys.0 / 10);
#[cfg(not(usb_v4))]
regs.btable().write(|w| w.set_btable(0));