* Add GP TIM9 and TIM11 to be used as time_driver

This commit is contained in:
Carlos Barrales Ruiz 2023-12-09 14:14:34 +01:00
parent e99649e37d
commit 78f709a362
3 changed files with 31 additions and 2 deletions

View File

@ -120,6 +120,10 @@ time-driver-tim3 = ["_time-driver"]
time-driver-tim4 = ["_time-driver"]
## Use TIM5 as time driver
time-driver-tim5 = ["_time-driver"]
## Use TIM9 as time driver
time-driver-tim9 = ["_time-driver"]
## Use TIM11 as time driver
time-driver-tim11 = ["_time-driver"]
## Use TIM12 as time driver
time-driver-tim12 = ["_time-driver"]
## Use TIM15 as time driver

View File

@ -187,6 +187,8 @@ fn main() {
Some("tim3") => "TIM3",
Some("tim4") => "TIM4",
Some("tim5") => "TIM5",
Some("tim9") => "TIM9",
Some("tim11") => "TIM11",
Some("tim12") => "TIM12",
Some("tim15") => "TIM15",
Some("any") => {
@ -198,12 +200,16 @@ fn main() {
"TIM4"
} else if singletons.contains(&"TIM5".to_string()) {
"TIM5"
} else if singletons.contains(&"TIM9".to_string()) {
"TIM9"
} else if singletons.contains(&"TIM11".to_string()) {
"TIM11"
} else if singletons.contains(&"TIM12".to_string()) {
"TIM12"
} else if singletons.contains(&"TIM15".to_string()) {
"TIM15"
} else {
panic!("time-driver-any requested, but the chip doesn't have TIM2, TIM3, TIM4, TIM5, TIM12 or TIM15.")
panic!("time-driver-any requested, but the chip doesn't have TIM2, TIM3, TIM4, TIM5, TIM9, TIM11, TIM12 or TIM15.")
}
}
_ => panic!("unknown time_driver {:?}", time_driver),

View File

@ -43,7 +43,10 @@ type T = peripherals::TIM3;
type T = peripherals::TIM4;
#[cfg(time_driver_tim5)]
type T = peripherals::TIM5;
#[cfg(time_driver_tim9)]
type T = peripherals::TIM9;
#[cfg(time_driver_tim11)]
type T = peripherals::TIM11;
#[cfg(time_driver_tim12)]
type T = peripherals::TIM12;
#[cfg(time_driver_tim15)]
@ -82,6 +85,22 @@ foreach_interrupt! {
DRIVER.on_interrupt()
}
};
(TIM9, timer, $block:ident, UP, $irq:ident) => {
#[cfg(time_driver_tim9)]
#[cfg(feature = "rt")]
#[interrupt]
fn $irq() {
DRIVER.on_interrupt()
}
};
(TIM11, timer, $block:ident, UP, $irq:ident) => {
#[cfg(time_driver_tim11)]
#[cfg(feature = "rt")]
#[interrupt]
fn $irq() {
DRIVER.on_interrupt()
}
};
(TIM12, timer, $block:ident, UP, $irq:ident) => {
#[cfg(time_driver_tim12)]
#[cfg(feature = "rt")]