@@ -348,7 +348,7 @@ where
348
348
// NOTE: Software is allowed to set ADSTP only when ADSTART=1 and ADDIS=0
349
349
// (ADC is enabled and eventually converting a regular conversion and there is no
350
350
// pending request to disable the ADC)
351
- if self . adc . cr . read ( ) . addis ( ) . bit ( ) == false
351
+ if ! self . adc . cr . read ( ) . addis ( ) . bit ( )
352
352
&& ( self . adc . cr . read ( ) . adstart ( ) . bit ( ) || self . adc . cr . read ( ) . jadstart ( ) . bit ( ) )
353
353
{
354
354
self . adc . cr . modify ( |_, w| w. adstp ( ) . stop ( ) ) ;
@@ -385,7 +385,7 @@ where
385
385
}
386
386
387
387
fn wait_adc_clk_cycles ( & self , cycles : u32 , clocks : Clocks ) {
388
- let frequency = ADC :: clock ( & clocks) . unwrap_or ( clocks. sysclk ( ) ) ;
388
+ let frequency = ADC :: clock ( & clocks) . unwrap_or_else ( || clocks. sysclk ( ) ) ;
389
389
let cpu_cycles = cycles * clocks. sysclk ( ) . 0 / frequency. 0 ;
390
390
asm:: delay ( cpu_cycles) ;
391
391
}
@@ -417,7 +417,7 @@ where
417
417
self . adc . cr . modify ( |_, w| w. adstart ( ) . start ( ) ) ;
418
418
while self . adc . isr . read ( ) . eos ( ) . is_not_complete ( ) { }
419
419
self . adc . isr . modify ( |_, w| w. eos ( ) . clear ( ) ) ;
420
- return self . adc . dr . read ( ) . rdata ( ) . bits ( ) ;
420
+ self . adc . dr . read ( ) . rdata ( ) . bits ( )
421
421
}
422
422
423
423
/// This should only be invoked with the defined channels for the particular
@@ -478,7 +478,7 @@ where
478
478
fn read ( & mut self , _pin : & mut Pin ) -> nb:: Result < Word , Self :: Error > {
479
479
// TODO: Convert back to previous mode after use.
480
480
let res = self . convert_one ( Pin :: channel ( ) ) ;
481
- return Ok ( res. into ( ) ) ;
481
+ Ok ( res. into ( ) )
482
482
}
483
483
}
484
484
0 commit comments