rename "delay" -> "delay_us"

This commit is contained in:
Jörn-Michael Miehe 2024-03-11 23:03:30 +00:00
parent 6b7c18c8da
commit 004a285999

View file

@ -25,7 +25,7 @@ mod app {
#[local] #[local]
struct Local { struct Local {
tx: Option<dma::TxDma<serial::Tx<pac::USART1>, dma::dma1::C4>>, tx: Option<dma::TxDma<serial::Tx<pac::USART1>, dma::dma1::C4>>,
delay: timer::Delay<pac::TIM1, 1_000_000>, delay_us: timer::DelayUs<pac::TIM2>,
led: gpio::gpioc::PC13<gpio::Output>, led: gpio::gpioc::PC13<gpio::Output>,
} }
@ -79,7 +79,7 @@ mod app {
tx: Some(serial.tx.with_dma(dma1.4)), tx: Some(serial.tx.with_dma(dma1.4)),
// Configure timer // 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 // 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. // 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) -> ! { fn idle(cx: idle::Context) -> ! {
let mut tx = cx.local.tx.take().unwrap(); let mut tx = cx.local.tx.take().unwrap();
loop { loop {
let xfer = tx.write(cx.shared.buffer); 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.led.set_high();
cx.local.delay.delay(1.secs()); cx.local.delay_us.delay(1.secs());
cx.local.led.set_low(); cx.local.led.set_low();
(_, tx) = xfer.wait(); (_, tx) = xfer.wait();