Hi. I recently started using several modules from this HAL, and noticed the Timer Module's API was a bit opaque. I wrote a new one, here. If you think code from this would be a good addition (Ie adding some of the methods), I'll make a PR, or a maintainer could copy+paste+commit.
Missing functionality such as PWM, and input capture. May need modifications to work on timers other than 0, 1, and 2.
Example syntax:
let mut timer = Timer::new(dp.TIMER1, TimerMode::Timer, 1., 0); // ie 1Hz, on compare 0.
timer.shortcut(TimerShortcut::Clear, 0); // Clear the timer when it generates an event.
timer.enable_interrupt(0);
timer.start();
// ...
#[interrupt]
fn TIMER1() {
free(|cs| {
// (Code to access the timer struct from an interrupt)
timer.clear_interrupt(0);
)};
}
Hi. I recently started using several modules from this HAL, and noticed the Timer Module's API was a bit opaque. I wrote a new one, here. If you think code from this would be a good addition (Ie adding some of the methods), I'll make a PR, or a maintainer could copy+paste+commit.
Missing functionality such as PWM, and input capture. May need modifications to work on timers other than 0, 1, and 2.
Example syntax: