diff options
| -rw-r--r-- | embassy-stm32/Cargo.toml | 4 | ||||
| -rw-r--r-- | embassy-stm32/build.rs | 8 | ||||
| -rw-r--r-- | embassy-stm32/src/time_driver.rs | 21 |
3 files changed, 31 insertions, 2 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index f8c4313e5..074538d3b 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -120,6 +120,10 @@ time-driver-tim3 = ["_time-driver"] | |||
| 120 | time-driver-tim4 = ["_time-driver"] | 120 | time-driver-tim4 = ["_time-driver"] |
| 121 | ## Use TIM5 as time driver | 121 | ## Use TIM5 as time driver |
| 122 | time-driver-tim5 = ["_time-driver"] | 122 | time-driver-tim5 = ["_time-driver"] |
| 123 | ## Use TIM9 as time driver | ||
| 124 | time-driver-tim9 = ["_time-driver"] | ||
| 125 | ## Use TIM11 as time driver | ||
| 126 | time-driver-tim11 = ["_time-driver"] | ||
| 123 | ## Use TIM12 as time driver | 127 | ## Use TIM12 as time driver |
| 124 | time-driver-tim12 = ["_time-driver"] | 128 | time-driver-tim12 = ["_time-driver"] |
| 125 | ## Use TIM15 as time driver | 129 | ## Use TIM15 as time driver |
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 0eef43ac4..bb60d244f 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -187,6 +187,8 @@ fn main() { | |||
| 187 | Some("tim3") => "TIM3", | 187 | Some("tim3") => "TIM3", |
| 188 | Some("tim4") => "TIM4", | 188 | Some("tim4") => "TIM4", |
| 189 | Some("tim5") => "TIM5", | 189 | Some("tim5") => "TIM5", |
| 190 | Some("tim9") => "TIM9", | ||
| 191 | Some("tim11") => "TIM11", | ||
| 190 | Some("tim12") => "TIM12", | 192 | Some("tim12") => "TIM12", |
| 191 | Some("tim15") => "TIM15", | 193 | Some("tim15") => "TIM15", |
| 192 | Some("any") => { | 194 | Some("any") => { |
| @@ -198,12 +200,16 @@ fn main() { | |||
| 198 | "TIM4" | 200 | "TIM4" |
| 199 | } else if singletons.contains(&"TIM5".to_string()) { | 201 | } else if singletons.contains(&"TIM5".to_string()) { |
| 200 | "TIM5" | 202 | "TIM5" |
| 203 | } else if singletons.contains(&"TIM9".to_string()) { | ||
| 204 | "TIM9" | ||
| 205 | } else if singletons.contains(&"TIM11".to_string()) { | ||
| 206 | "TIM11" | ||
| 201 | } else if singletons.contains(&"TIM12".to_string()) { | 207 | } else if singletons.contains(&"TIM12".to_string()) { |
| 202 | "TIM12" | 208 | "TIM12" |
| 203 | } else if singletons.contains(&"TIM15".to_string()) { | 209 | } else if singletons.contains(&"TIM15".to_string()) { |
| 204 | "TIM15" | 210 | "TIM15" |
| 205 | } else { | 211 | } else { |
| 206 | panic!("time-driver-any requested, but the chip doesn't have TIM2, TIM3, TIM4, TIM5, TIM12 or TIM15.") | 212 | panic!("time-driver-any requested, but the chip doesn't have TIM2, TIM3, TIM4, TIM5, TIM9, TIM11, TIM12 or TIM15.") |
| 207 | } | 213 | } |
| 208 | } | 214 | } |
| 209 | _ => panic!("unknown time_driver {:?}", time_driver), | 215 | _ => panic!("unknown time_driver {:?}", time_driver), |
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index e2a4cc4da..ea9c22d87 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs | |||
| @@ -43,7 +43,10 @@ type T = peripherals::TIM3; | |||
| 43 | type T = peripherals::TIM4; | 43 | type T = peripherals::TIM4; |
| 44 | #[cfg(time_driver_tim5)] | 44 | #[cfg(time_driver_tim5)] |
| 45 | type T = peripherals::TIM5; | 45 | type T = peripherals::TIM5; |
| 46 | 46 | #[cfg(time_driver_tim9)] | |
| 47 | type T = peripherals::TIM9; | ||
| 48 | #[cfg(time_driver_tim11)] | ||
| 49 | type T = peripherals::TIM11; | ||
| 47 | #[cfg(time_driver_tim12)] | 50 | #[cfg(time_driver_tim12)] |
| 48 | type T = peripherals::TIM12; | 51 | type T = peripherals::TIM12; |
| 49 | #[cfg(time_driver_tim15)] | 52 | #[cfg(time_driver_tim15)] |
| @@ -82,6 +85,22 @@ foreach_interrupt! { | |||
| 82 | DRIVER.on_interrupt() | 85 | DRIVER.on_interrupt() |
| 83 | } | 86 | } |
| 84 | }; | 87 | }; |
| 88 | (TIM9, timer, $block:ident, UP, $irq:ident) => { | ||
| 89 | #[cfg(time_driver_tim9)] | ||
| 90 | #[cfg(feature = "rt")] | ||
| 91 | #[interrupt] | ||
| 92 | fn $irq() { | ||
| 93 | DRIVER.on_interrupt() | ||
| 94 | } | ||
| 95 | }; | ||
| 96 | (TIM11, timer, $block:ident, UP, $irq:ident) => { | ||
| 97 | #[cfg(time_driver_tim11)] | ||
| 98 | #[cfg(feature = "rt")] | ||
| 99 | #[interrupt] | ||
| 100 | fn $irq() { | ||
| 101 | DRIVER.on_interrupt() | ||
| 102 | } | ||
| 103 | }; | ||
| 85 | (TIM12, timer, $block:ident, UP, $irq:ident) => { | 104 | (TIM12, timer, $block:ident, UP, $irq:ident) => { |
| 86 | #[cfg(time_driver_tim12)] | 105 | #[cfg(time_driver_tim12)] |
| 87 | #[cfg(feature = "rt")] | 106 | #[cfg(feature = "rt")] |
