Merge pull request #2272 from cbruiz/feature/more-gp-timer-driver-candidates

Add GP TIM9 and TIM11 to be used as time_driver candidates
This commit is contained in:
Dario Nieuwenhuis 2023-12-09 18:45:51 +00:00 committed by GitHub
commit 343be37f39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"] time-driver-tim4 = ["_time-driver"]
## Use TIM5 as time driver ## Use TIM5 as time driver
time-driver-tim5 = ["_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 ## Use TIM12 as time driver
time-driver-tim12 = ["_time-driver"] time-driver-tim12 = ["_time-driver"]
## Use TIM15 as time driver ## Use TIM15 as time driver

View File

@ -187,6 +187,8 @@ fn main() {
Some("tim3") => "TIM3", Some("tim3") => "TIM3",
Some("tim4") => "TIM4", Some("tim4") => "TIM4",
Some("tim5") => "TIM5", Some("tim5") => "TIM5",
Some("tim9") => "TIM9",
Some("tim11") => "TIM11",
Some("tim12") => "TIM12", Some("tim12") => "TIM12",
Some("tim15") => "TIM15", Some("tim15") => "TIM15",
Some("any") => { Some("any") => {
@ -198,12 +200,16 @@ fn main() {
"TIM4" "TIM4"
} else if singletons.contains(&"TIM5".to_string()) { } else if singletons.contains(&"TIM5".to_string()) {
"TIM5" "TIM5"
} else if singletons.contains(&"TIM9".to_string()) {
"TIM9"
} else if singletons.contains(&"TIM11".to_string()) {
"TIM11"
} else if singletons.contains(&"TIM12".to_string()) { } else if singletons.contains(&"TIM12".to_string()) {
"TIM12" "TIM12"
} else if singletons.contains(&"TIM15".to_string()) { } else if singletons.contains(&"TIM15".to_string()) {
"TIM15" "TIM15"
} else { } 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), _ => panic!("unknown time_driver {:?}", time_driver),

View File

@ -43,7 +43,10 @@ type T = peripherals::TIM3;
type T = peripherals::TIM4; type T = peripherals::TIM4;
#[cfg(time_driver_tim5)] #[cfg(time_driver_tim5)]
type T = peripherals::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)] #[cfg(time_driver_tim12)]
type T = peripherals::TIM12; type T = peripherals::TIM12;
#[cfg(time_driver_tim15)] #[cfg(time_driver_tim15)]
@ -82,6 +85,22 @@ foreach_interrupt! {
DRIVER.on_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) => { (TIM12, timer, $block:ident, UP, $irq:ident) => {
#[cfg(time_driver_tim12)] #[cfg(time_driver_tim12)]
#[cfg(feature = "rt")] #[cfg(feature = "rt")]