aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32
diff options
context:
space:
mode:
authorGabriel Smith <[email protected]>2025-08-29 10:46:33 -0400
committerGabriel Smith <[email protected]>2025-08-29 10:46:33 -0400
commitfb8757c690c7265c46bbf04f8172b338a310ee30 (patch)
tree63dcd84203f6897f8b57e7e524e1febf40d01b7e /embassy-stm32
parentf86cf87f2f20f723e2ba2fe7d83908a2b3bac2d1 (diff)
fix: stm32/usb: Fixed STM32H5 build requiring time feature
A busy loop has been added for when the "time" feature is not enabled.
Diffstat (limited to 'embassy-stm32')
-rw-r--r--embassy-stm32/CHANGELOG.md2
-rw-r--r--embassy-stm32/src/usb/usb.rs11
2 files changed, 12 insertions, 1 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md
index c8ae7a357..dfb8ca066 100644
--- a/embassy-stm32/CHANGELOG.md
+++ b/embassy-stm32/CHANGELOG.md
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8<!-- next-header --> 8<!-- next-header -->
9## Unreleased - ReleaseDate 9## Unreleased - ReleaseDate
10 10
11- fix: Fixed STM32H5 builds requiring time feature
12
11## 0.4.0 - 2025-08-26 13## 0.4.0 - 2025-08-26
12 14
13- feat: stm32/sai: make NODIV independent of MCKDIV 15- feat: stm32/sai: make NODIV independent of MCKDIV
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> {
912 // Software should ensure that a small delay is included before accessing the SRAM contents. This delay should be 912 // Software should ensure that a small delay is included before accessing the SRAM contents. This delay should be
913 // 800 ns in Full Speed mode and 6.4 μs in Low Speed mode. 913 // 800 ns in Full Speed mode and 6.4 μs in Low Speed mode.
914 #[cfg(stm32h5)] 914 #[cfg(stm32h5)]
915 embassy_time::block_for(embassy_time::Duration::from_nanos(800)); 915 {
916 #[cfg(feature = "time")]
917 embassy_time::block_for(embassy_time::Duration::from_nanos(800));
918 #[cfg(not(feature = "time"))]
919 {
920 let freq = unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 as u64;
921 let cycles = freq * 800 / 1_000_000;
922 cortex_m::asm::delay(cycles as u32);
923 }
924 }
916 925
917 RX_COMPLETE[index].store(false, Ordering::Relaxed); 926 RX_COMPLETE[index].store(false, Ordering::Relaxed);
918 927