From fb8757c690c7265c46bbf04f8172b338a310ee30 Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Fri, 29 Aug 2025 10:46:33 -0400 Subject: fix: stm32/usb: Fixed STM32H5 build requiring time feature A busy loop has been added for when the "time" feature is not enabled. --- embassy-stm32/src/usb/usb.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'embassy-stm32/src') diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 92c1601cc..54596aeae 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs @@ -912,7 +912,16 @@ impl<'d, T: Instance> driver::EndpointOut for Endpoint<'d, T, Out> { // Software should ensure that a small delay is included before accessing the SRAM contents. This delay should be // 800 ns in Full Speed mode and 6.4 μs in Low Speed mode. #[cfg(stm32h5)] - embassy_time::block_for(embassy_time::Duration::from_nanos(800)); + { + #[cfg(feature = "time")] + embassy_time::block_for(embassy_time::Duration::from_nanos(800)); + #[cfg(not(feature = "time"))] + { + let freq = unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 as u64; + let cycles = freq * 800 / 1_000_000; + cortex_m::asm::delay(cycles as u32); + } + } RX_COMPLETE[index].store(false, Ordering::Relaxed); -- cgit