mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Fix errors
This commit is contained in:
parent
f6f312270f
commit
6db0daf79b
@ -77,7 +77,7 @@ pub(crate) fn blocking_delay_us(us: u32) {
|
|||||||
embassy_time::block_for(embassy_time::Duration::from_micros(us as u64));
|
embassy_time::block_for(embassy_time::Duration::from_micros(us as u64));
|
||||||
#[cfg(not(feature = "time"))]
|
#[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 us = us as u64;
|
||||||
let cycles = freq * us / 1_000_000;
|
let cycles = freq * us / 1_000_000;
|
||||||
cortex_m::asm::delay(cycles as u32);
|
cortex_m::asm::delay(cycles as u32);
|
||||||
|
@ -14,7 +14,7 @@ pub fn blocking_delay_ms(ms: u32) {
|
|||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
embassy_time::block_for(embassy_time::Duration::from_millis(ms as u64));
|
embassy_time::block_for(embassy_time::Duration::from_millis(ms as u64));
|
||||||
#[cfg(not(feature = "time"))]
|
#[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
|
/// PacketTypes extracted from CubeMX
|
||||||
|
@ -132,7 +132,7 @@ impl Rtc {
|
|||||||
|
|
||||||
// Panic if the rcc mod knows we're not using low-power rtc
|
// Panic if the rcc mod knows we're not using low-power rtc
|
||||||
#[cfg(any(rcc_wb, rcc_f4, rcc_f410))]
|
#[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 requested_duration = requested_duration.as_ticks().clamp(0, u32::MAX as u64);
|
||||||
let rtc_hz = Self::frequency().0 as u64;
|
let rtc_hz = Self::frequency().0 as u64;
|
||||||
|
@ -270,7 +270,7 @@ impl<'d, T: Instance> Driver<'d, T> {
|
|||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
embassy_time::block_for(embassy_time::Duration::from_millis(100));
|
embassy_time::block_for(embassy_time::Duration::from_millis(100));
|
||||||
#[cfg(not(feature = "time"))]
|
#[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))]
|
#[cfg(not(usb_v4))]
|
||||||
regs.btable().write(|w| w.set_btable(0));
|
regs.btable().write(|w| w.set_btable(0));
|
||||||
|
Loading…
Reference in New Issue
Block a user