时钟和计时器
在本节中,我们将重新实现LED轮盘应用程序。我会把Led抽象还给你,但这次我要去掉Delay抽象 :-)。
这是启动代码。delay函数未实现,因此如果您运行此程序,LED将闪烁得如此之快,以至于看起来始终亮着。
#![no_main]
#![no_std]
use aux9::{entry, switch_hal::OutputSwitch, tim6};
#[inline(never)]
fn delay(tim6: &tim6::RegisterBlock, ms: u16) {
    // TODO implement this
}
#[entry]
fn main() -> ! {
    let (leds, rcc, tim6) = aux9::init();
    let mut leds = leds.into_array();
    // TODO initialize TIM6
    let ms = 50;
    loop {
        for curr in 0..8 {
            let next = (curr + 1) % 8;
            leds[next].on().unwrap();
            delay(tim6, ms);
            leds[curr].off().unwrap();
            delay(tim6, ms);
        }
    }
}