Fix errors

This commit is contained in:
Dion Dokter 2024-07-09 09:53:01 +02:00
parent f6f312270f
commit 6db0daf79b
4 changed files with 4 additions and 4 deletions

View File

@ -77,7 +77,7 @@ pub(crate) fn blocking_delay_us(us: u32) {
embassy_time::block_for(embassy_time::Duration::from_micros(us as u64));
#[cfg(not(feature = "time"))]
{
let freq = unsafe { crate::rcc::get_freqs() }.sys.unwrap().0 as u64;
let freq = unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 as u64;
let us = us as u64;
let cycles = freq * us / 1_000_000;
cortex_m::asm::delay(cycles as u32);

View File

@ -14,7 +14,7 @@ pub fn blocking_delay_ms(ms: u32) {
#[cfg(feature = "time")]
embassy_time::block_for(embassy_time::Duration::from_millis(ms as u64));
#[cfg(not(feature = "time"))]
cortex_m::asm::delay(unsafe { crate::rcc::get_freqs() }.sys.unwrap().0 / 1_000 * ms);
cortex_m::asm::delay(unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 / 1_000 * ms);
}
/// PacketTypes extracted from CubeMX

View File

@ -132,7 +132,7 @@ impl Rtc {
// Panic if the rcc mod knows we're not using low-power rtc
#[cfg(any(rcc_wb, rcc_f4, rcc_f410))]
unsafe { crate::rcc::get_freqs() }.rtc.unwrap();
unsafe { crate::rcc::get_freqs() }.rtc.to_hertz().unwrap();
let requested_duration = requested_duration.as_ticks().clamp(0, u32::MAX as u64);
let rtc_hz = Self::frequency().0 as u64;

View File

@ -270,7 +270,7 @@ impl<'d, T: Instance> Driver<'d, T> {
#[cfg(feature = "time")]
embassy_time::block_for(embassy_time::Duration::from_millis(100));
#[cfg(not(feature = "time"))]
cortex_m::asm::delay(unsafe { crate::rcc::get_freqs() }.sys.unwrap().0 / 10);
cortex_m::asm::delay(unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 / 10);
#[cfg(not(usb_v4))]
regs.btable().write(|w| w.set_btable(0));