24
24
//! }
25
25
//! ```
26
26
27
- #[ cfg( feature = "stm32f030" ) ]
28
- use crate :: stm32:: { RCC , TIM1 , TIM14 , TIM15 , TIM16 , TIM17 , TIM3 , TIM6 , TIM7 } ;
29
- #[ cfg( feature = "stm32f042" ) ]
30
- use crate :: stm32:: { RCC , TIM1 , TIM14 , TIM16 , TIM17 , TIM2 , TIM3 } ;
27
+ use crate :: stm32;
31
28
use cortex_m:: peripheral:: syst:: SystClkSource ;
32
29
use cortex_m:: peripheral:: SYST ;
33
30
@@ -111,6 +108,7 @@ impl Periodic for Timer<SYST> {}
111
108
macro_rules! timers {
112
109
( $( $TIM: ident: ( $tim: ident, $timXen: ident, $timXrst: ident, $apbenr: ident, $apbrstr: ident) , ) +) => {
113
110
$(
111
+ use crate :: stm32:: $TIM;
114
112
impl Timer <$TIM> {
115
113
// XXX(why not name this `new`?) bummer: constructors need to have different names
116
114
// even if the `$TIM` are non overlapping (compare to the `free` function below
@@ -121,7 +119,7 @@ macro_rules! timers {
121
119
T : Into <Hertz >,
122
120
{
123
121
// NOTE(unsafe) This executes only during initialisation
124
- let rcc = unsafe { & ( * RCC :: ptr( ) ) } ;
122
+ let rcc = unsafe { & ( * stm32 :: RCC :: ptr( ) ) } ;
125
123
126
124
// enable and reset peripheral to a clean slate state
127
125
rcc. $apbenr. modify( |_, w| w. $timXen( ) . set_bit( ) ) ;
@@ -159,8 +157,7 @@ macro_rules! timers {
159
157
160
158
/// Releases the TIM peripheral
161
159
pub fn release( self ) -> $TIM {
162
- use crate :: stm32:: RCC ;
163
- let rcc = unsafe { & ( * RCC :: ptr( ) ) } ;
160
+ let rcc = unsafe { & ( * stm32:: RCC :: ptr( ) ) } ;
164
161
// Pause counter
165
162
self . tim. cr1. modify( |_, w| w. cen( ) . clear_bit( ) ) ;
166
163
// Disable timer
0 commit comments