You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The delay function seems to be lacking some methods. It would be nice if this example worked for the commented out lines.
Click to expand
#![deny(warnings)]
#![deny(unsafe_code)]
#![no_main]
#![no_std]
#[cfg(debug_assertions)]
use panic_semihosting as _;
#[cfg(not(debug_assertions))]
use panic_halt as _;
use stm32g4xx_hal::{
delay::DelayFromCountDownTimer,
prelude::*,
rcc::Config,
stm32::Peripherals,
timer::Timer,
};
use cortex_m_rt::entry;
#[entry]
fn main() -> ! {
let dp = Peripherals::take().expect("cannot take peripherals");
let cp = cortex_m::Peripherals::take().expect("cannot take core peripherals");
let mut rcc = dp.RCC.freeze(Config::hsi());
let gpioa = dp.GPIOA.split(&mut rcc);
let mut led = gpioa.pa5.into_push_pull_output();
let mut delay_syst = cp.SYST.delay(&rcc.clocks);
let timer2 = Timer::new(dp.TIM2, &rcc.clocks);
let mut delay_tim2 = DelayFromCountDownTimer::new(timer2.start_count_down(100.ms()));
loop {
led.toggle().unwrap();
delay_syst.delay(1000.ms());
delay_syst.delay_ms(1000);
delay_syst.delay_ms(1000_u32);
//delay_syst.delay_ms(1000_u16); //expected `u32`, found `u16`
//delay_syst.delay_ms(100_u8); //expected `u32`, found `u8`
led.toggle().unwrap();
//delay_tim2.delay(1000.ms()); //method not found
//delay_tim2.delay_ms(1000); //trait `DelayMs<i32>` is not implemented
delay_tim2.delay_ms(1000_u32);
delay_tim2.delay_ms(1000_u16);
delay_tim2.delay_ms(100_u8);
}
}
Also, module stm32 should be called pac. Several hals are doing this by making pac an alias for stm32.
The
delay
function seems to be lacking some methods. It would be nice if this example worked for the commented out lines.Click to expand
Also, module
stm32
should be calledpac
. Several hals are doing this by makingpac
an alias forstm32
.I am attempting several examples on
stm32g4xx_hal
that I have compiling on other hals. Differences withdelay
are causing the most problems at the moment . (See https://github.com/pdgilbert/rust-integration-testing/actions.)The text was updated successfully, but these errors were encountered: