@@ -11,10 +11,10 @@ use crate::gpio::gpiof;
1111use crate :: gpio:: Analog ;
1212use crate :: gpio:: { gpioa, gpiob, gpioc} ;
1313use crate :: rcc:: { Clocks , Enable , Reset } ;
14+ use crate :: time:: kHz;
1415use core:: sync:: atomic:: { self , Ordering } ;
1516use cortex_m:: asm:: delay;
1617use embedded_dma:: StaticWriteBuffer ;
17- use fugit:: { HertzU32 as Hertz , RateExtU32 } ;
1818
1919#[ cfg( any( feature = "stm32f103" , feature = "connectivity" ) ) ]
2020use crate :: pac:: ADC2 ;
@@ -206,11 +206,9 @@ macro_rules! adc_hal {
206206 // The manual states that we need to wait two ADC clocks cycles after power-up
207207 // before starting calibration, we already delayed in the power-up process, but
208208 // 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 ) {
211210 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 ) ;
214212 if two_adc_cycles > already_delayed {
215213 delay( two_adc_cycles - already_delayed) ;
216214 }
@@ -272,8 +270,7 @@ macro_rules! adc_hal {
272270 // this time can be found in the datasheets.
273271 // Here we are delaying for approximately 1us, considering 1.25 instructions per
274272 // 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 ) ) ;
277274 }
278275
279276 fn power_down( & mut self ) {
0 commit comments