stm32: add tim4, tim5 support for time-driver (stm32f410 doesn't have tim2, tim3)

This commit is contained in:
Dario Nieuwenhuis
2022-01-24 00:50:10 +01:00
parent 79f60adbfb
commit 533ceb707c
3 changed files with 23 additions and 1 deletions

View File

@ -22,6 +22,10 @@ const ALARM_COUNT: usize = 3;
type T = peripherals::TIM2;
#[cfg(time_driver_tim3)]
type T = peripherals::TIM3;
#[cfg(time_driver_tim4)]
type T = peripherals::TIM4;
#[cfg(time_driver_tim5)]
type T = peripherals::TIM5;
#[cfg(time_driver_tim2)]
#[interrupt]
@ -33,6 +37,16 @@ fn TIM2() {
fn TIM3() {
DRIVER.on_interrupt()
}
#[cfg(time_driver_tim4)]
#[interrupt]
fn TIM4() {
DRIVER.on_interrupt()
}
#[cfg(time_driver_tim5)]
#[interrupt]
fn TIM5() {
DRIVER.on_interrupt()
}
// Clock timekeeping works with something we call "periods", which are time intervals
// of 2^15 ticks. The Clock counter value is 16 bits, so one "overflow cycle" is 2 periods.