examples: remove duplicate delay
This commit is contained in:
parent
b8094f84f3
commit
c146eb155d
|
@ -1,5 +1,6 @@
|
|||
use embedded_hal::blocking::delay::{DelayMs, DelayUs};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct AsmDelay {
|
||||
frequency_us: u32,
|
||||
frequency_ms: u32,
|
||||
|
|
|
@ -13,7 +13,6 @@ use stm32f4xx_hal::{
|
|||
gpio::GpioExt,
|
||||
time::U32Ext,
|
||||
stm32::ITM,
|
||||
delay::Delay,
|
||||
spi::Spi,
|
||||
time::Hertz
|
||||
};
|
||||
|
@ -127,8 +126,7 @@ const APP: () = {
|
|||
.pclk1(42.mhz())
|
||||
.require_pll48clk()
|
||||
.freeze();
|
||||
let asm_delay = AsmDelay::new(clocks.sysclk().0);
|
||||
let mut hal_delay = Delay::new(c.core.SYST, clocks);
|
||||
let mut asm_delay = AsmDelay::new(clocks.sysclk().0);
|
||||
|
||||
// Init ITM
|
||||
let mut itm = c.core.ITM;
|
||||
|
@ -148,7 +146,7 @@ const APP: () = {
|
|||
// Map SPISEL: see Table 1, NIC100 Manual
|
||||
let mut spisel = gpioa.pa1.into_push_pull_output();
|
||||
spisel.set_high().unwrap();
|
||||
hal_delay.delay_ms(1_u32);
|
||||
asm_delay.delay_ms(1_u32);
|
||||
spisel.set_low().unwrap();
|
||||
|
||||
// Create SPI1 for HAL
|
||||
|
@ -211,7 +209,7 @@ const APP: () = {
|
|||
|
||||
// Setup SysTick after releasing SYST from Delay
|
||||
// Reference to stm32-eth:examples/ip.rs
|
||||
timer_setup(hal_delay.free(), clocks);
|
||||
timer_setup(c.core.SYST, clocks);
|
||||
iprintln!(stim0, "Timer initialized");
|
||||
|
||||
init::LateResources {
|
||||
|
|
|
@ -13,7 +13,6 @@ use stm32f4xx_hal::{
|
|||
gpio::GpioExt,
|
||||
time::U32Ext,
|
||||
stm32::ITM,
|
||||
delay::Delay,
|
||||
spi::Spi,
|
||||
time::Hertz
|
||||
};
|
||||
|
@ -40,7 +39,7 @@ type BoosterSpiEth = enc424j600::SpiEth<
|
|||
const APP: () = {
|
||||
struct Resources {
|
||||
spi_eth: BoosterSpiEth,
|
||||
delay: Delay,
|
||||
delay: AsmDelay,
|
||||
itm: ITM,
|
||||
}
|
||||
|
||||
|
@ -58,8 +57,7 @@ const APP: () = {
|
|||
//.pclk2(64.mhz())
|
||||
.require_pll48clk()
|
||||
.freeze();
|
||||
let asm_delay = AsmDelay::new(clocks.sysclk().0);
|
||||
let mut delay = Delay::new(c.core.SYST, clocks);
|
||||
let mut asm_delay = AsmDelay::new(clocks.sysclk().0);
|
||||
|
||||
// Init ITM
|
||||
let mut itm = c.core.ITM;
|
||||
|
@ -78,7 +76,7 @@ const APP: () = {
|
|||
// Map SPISEL: see Table 1, NIC100 Manual
|
||||
let mut spisel = gpioa.pa1.into_push_pull_output();
|
||||
spisel.set_high().unwrap();
|
||||
delay.delay_ms(1_u32);
|
||||
asm_delay.delay_ms(1_u32);
|
||||
spisel.set_low().unwrap();
|
||||
// Create SPI1 for HAL
|
||||
let mut spi_eth = {
|
||||
|
@ -120,7 +118,7 @@ const APP: () = {
|
|||
|
||||
init::LateResources {
|
||||
spi_eth,
|
||||
delay,
|
||||
delay: asm_delay,
|
||||
itm,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue