@@ -11,10 +11,10 @@ use crate::gpio::gpiof;
11
11
use crate :: gpio:: Analog ;
12
12
use crate :: gpio:: { gpioa, gpiob, gpioc} ;
13
13
use crate :: rcc:: { Clocks , Enable , Reset } ;
14
+ use crate :: time:: kHz;
14
15
use core:: sync:: atomic:: { self , Ordering } ;
15
16
use cortex_m:: asm:: delay;
16
17
use embedded_dma:: StaticWriteBuffer ;
17
- use fugit:: { HertzU32 as Hertz , RateExtU32 } ;
18
18
19
19
#[ cfg( any( feature = "stm32f103" , feature = "connectivity" ) ) ]
20
20
use crate :: pac:: ADC2 ;
@@ -206,11 +206,9 @@ macro_rules! adc_hal {
206
206
// The manual states that we need to wait two ADC clocks cycles after power-up
207
207
// before starting calibration, we already delayed in the power-up process, but
208
208
// if the adc clock is too low that was not enough.
209
- let m2_5: Hertz = 2500 . kHz( ) ;
210
- if s. clocks. adcclk( ) < m2_5 {
209
+ if s. clocks. adcclk( ) < kHz( 2500 ) {
211
210
let two_adc_cycles = s. clocks. sysclk( ) / s. clocks. adcclk( ) * 2 ;
212
- let k800: Hertz = 800 . kHz( ) ;
213
- let already_delayed = s. clocks. sysclk( ) / k800;
211
+ let already_delayed = s. clocks. sysclk( ) / kHz( 800 ) ;
214
212
if two_adc_cycles > already_delayed {
215
213
delay( two_adc_cycles - already_delayed) ;
216
214
}
@@ -272,8 +270,7 @@ macro_rules! adc_hal {
272
270
// this time can be found in the datasheets.
273
271
// Here we are delaying for approximately 1us, considering 1.25 instructions per
274
272
// cycle. Do we support a chip which needs more than 1us ?
275
- let k800: Hertz = 800 . kHz( ) ;
276
- delay( self . clocks. sysclk( ) / k800) ;
273
+ delay( self . clocks. sysclk( ) / kHz( 800 ) ) ;
277
274
}
278
275
279
276
fn power_down( & mut self ) {
0 commit comments