Skip to content

Commit 97e63a8

Browse files
committed
timer: add support for every stm32f4 devices
1 parent 9d5235c commit 97e63a8

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ pub mod serial;
4646
#[cfg(any(feature = "stm32f401", feature = "stm32f407", feature = "stm32f412", feature = "stm32f429", feature = "stm32f411"))]
4747
pub mod spi;
4848
pub mod time;
49-
#[cfg(any(feature = "stm32f401", feature = "stm32f407", feature = "stm32f412", feature = "stm32f429", feature = "stm32f411"))]
49+
#[cfg(any(feature = "stm32f401", feature = "stm32f405", feature = "stm32f407", feature = "stm32f410", feature = "stm32f411", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
5050
pub mod timer;

src/timer.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ use hal::timer::{CountDown, Periodic};
77
use nb;
88
use void::Void;
99

10-
use stm32::{RCC, TIM1, TIM5, TIM9, TIM11};
11-
#[cfg(any(feature = "stm32f401", feature = "stm32f407", feature = "stm32f412", feature = "stm32f429", feature = "stm32f411"))]
10+
use stm32::RCC;
11+
#[cfg(any(feature = "stm32f401", feature = "stm32f405", feature = "stm32f407", feature = "stm32f410", feature = "stm32f411", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
12+
use stm32::{TIM1, TIM5, TIM9, TIM11};
13+
#[cfg(any(feature = "stm32f401", feature = "stm32f405", feature = "stm32f407", feature = "stm32f411", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
1214
use stm32::{TIM2, TIM3, TIM4, TIM10};
13-
#[cfg(any(feature = "stm32f407", feature = "stm32f412", feature = "stm32f429"))]
14-
use stm32::{TIM6, TIM7, TIM8, TIM12, TIM13, TIM14};
15+
#[cfg(any(feature = "stm32f405", feature = "stm32f407", feature = "stm32f410", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
16+
use stm32::{TIM6};
17+
#[cfg(any(feature = "stm32f405", feature = "stm32f407", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
18+
use stm32::{TIM7, TIM8, TIM12, TIM13, TIM14};
1519

1620
use rcc::{Clocks};
1721
use time::Hertz;
@@ -175,25 +179,29 @@ macro_rules! hal {
175179
}
176180
}
177181

182+
#[cfg(any(feature = "stm32f401", feature = "stm32f405", feature = "stm32f407", feature = "stm32f410", feature = "stm32f411", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
178183
hal! {
179184
TIM1: (tim1, tim1en, tim1rst, apb2enr, apb2rstr, pclk2, ppre2),
180185
TIM5: (tim5, tim5en, tim5rst, apb1enr, apb1rstr, pclk1, ppre1),
181186
TIM9: (tim9, tim9en, tim9rst, apb2enr, apb2rstr, pclk1, ppre1),
182187
TIM11: (tim11, tim11en, tim11rst, apb2enr, apb2rstr, pclk2, ppre2),
183188
}
184189

185-
// available on all stm32f4 except stm32f410
186-
#[cfg(any(feature = "stm32f401", feature = "stm32f407", feature = "stm32f412", feature = "stm32f429", feature = "stm32f411"))]
190+
#[cfg(any(feature = "stm32f401", feature = "stm32f405", feature = "stm32f407", feature = "stm32f411", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
187191
hal! {
188192
TIM2: (tim2, tim2en, tim2rst, apb1enr, apb1rstr, pclk1, ppre1),
189193
TIM3: (tim3, tim3en, tim3rst, apb1enr, apb1rstr, pclk1, ppre1),
190194
TIM4: (tim4, tim4en, tim4rst, apb1enr, apb1rstr, pclk1, ppre1),
191195
TIM10: (tim10, tim10en, tim10rst, apb2enr, apb2rstr, pclk2, ppre2),
192196
}
193197

194-
#[cfg(any(feature = "stm32f407", feature = "stm32f412", feature = "stm32f429"))]
198+
#[cfg(any(feature = "stm32f405", feature = "stm32f407", feature = "stm32f410", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
195199
hal! {
196200
TIM6: (tim6, tim6en, tim6rst, apb1enr, apb1rstr, pclk1, ppre1),
201+
}
202+
203+
#[cfg(any(feature = "stm32f405", feature = "stm32f407", feature = "stm32f412", feature = "stm32f413", feature = "stm32f415", feature = "stm32f417", feature = "stm32f423", feature = "stm32f427", feature = "stm32f429", feature = "stm32f437", feature = "stm32f439", feature = "stm32f446", feature = "stm32f469", feature = "stm32f479"))]
204+
hal! {
197205
TIM7: (tim7, tim7en, tim7rst, apb1enr, apb1rstr, pclk1, ppre1),
198206
TIM8: (tim8, tim8en, tim8rst, apb2enr, apb2rstr, pclk2, ppre2),
199207
TIM12: (tim12, tim12en, tim12rst, apb1enr, apb1rstr, pclk1, ppre1),

0 commit comments

Comments
 (0)