diff --git a/bluepill-rs/src/main.rs b/bluepill-rs/src/main.rs index c9c0166..96f9233 100644 --- a/bluepill-rs/src/main.rs +++ b/bluepill-rs/src/main.rs @@ -25,7 +25,7 @@ mod app { #[local] struct Local { tx: Option, dma::dma1::C4>>, - delay: timer::Delay, + delay_us: timer::DelayUs, led: gpio::gpioc::PC13, } @@ -79,7 +79,7 @@ mod app { tx: Some(serial.tx.with_dma(dma1.4)), // Configure timer - delay: cx.device.TIM1.delay_us(&clocks), + delay_us: cx.device.TIM2.delay_us(&clocks), // Configure gpio C pin 13 as a push-pull output. The `crh` register is passed to the function // in order to configure the port. For pins 0-7, crl should be passed instead. @@ -89,17 +89,17 @@ mod app { ) } - #[idle(local = [tx, delay, led], shared = [&buffer])] + #[idle(local = [tx, delay_us, led], shared = [&buffer])] fn idle(cx: idle::Context) -> ! { let mut tx = cx.local.tx.take().unwrap(); loop { let xfer = tx.write(cx.shared.buffer); - cx.local.delay.delay(1.secs()); + cx.local.delay_us.delay(1.secs()); cx.local.led.set_high(); - cx.local.delay.delay(1.secs()); + cx.local.delay_us.delay(1.secs()); cx.local.led.set_low(); (_, tx) = xfer.wait();