@@ -30,7 +30,7 @@ use crate::{
30
30
pac:: { self , adc1, Interrupt } ,
31
31
rcc:: { Clocks , Enable , AHB } ,
32
32
time:: { duration:: Microseconds , fixed_point:: FixedPoint , rate:: Hertz } ,
33
- Toggle ,
33
+ Switch ,
34
34
} ;
35
35
36
36
use crate :: pac:: { adc1_2, adc1_2:: ccr:: CKMODE_A } ;
@@ -493,7 +493,7 @@ where
493
493
// TODO(Sh3Rm4n): Would about concurrent calibrations between related ADCs?
494
494
// int_ref: &mut VoltageInternalReference<ADC>,
495
495
) {
496
- self . configure_voltage_regulator ( Toggle :: On , clocks) ;
496
+ self . configure_voltage_regulator ( Switch :: On , clocks) ;
497
497
498
498
self . reg
499
499
. cr
@@ -512,21 +512,21 @@ where
512
512
asm:: delay ( cpu_cycles) ;
513
513
514
514
// When the internal voltage regulator is disabled, the internal analog calibration is kept
515
- self . configure_voltage_regulator ( Toggle :: Off , clocks) ;
515
+ self . configure_voltage_regulator ( Switch :: Off , clocks) ;
516
516
}
517
517
518
518
/// Enable the interal voltage generator Blocks until regulator is enabled.
519
- fn configure_voltage_regulator ( & mut self , toggle : impl Into < Toggle > , clocks : & Clocks ) {
519
+ fn configure_voltage_regulator ( & mut self , toggle : impl Into < Switch > , clocks : & Clocks ) {
520
520
let already_on = self . reg . cr . read ( ) . advregen ( ) . is_enabled ( ) ;
521
521
let toggle = toggle. into ( ) ;
522
522
self . reg . cr . modify ( |_, w| w. advregen ( ) . intermediate ( ) ) ;
523
523
self . reg . cr . modify ( |_, w| {
524
524
w. advregen ( ) . variant ( match toggle {
525
- Toggle :: On => adc1:: cr:: ADVREGEN_A :: Enabled ,
526
- Toggle :: Off => adc1:: cr:: ADVREGEN_A :: Disabled ,
525
+ Switch :: On => adc1:: cr:: ADVREGEN_A :: Enabled ,
526
+ Switch :: Off => adc1:: cr:: ADVREGEN_A :: Disabled ,
527
527
} )
528
528
} ) ;
529
- if toggle == Toggle :: On && !already_on {
529
+ if toggle == Switch :: On && !already_on {
530
530
let wait = MAX_ADVREGEN_STARTUP . integer ( )
531
531
* clocks. sysclk ( ) . integer ( )
532
532
* <Microseconds as FixedPoint >:: SCALING_FACTOR ;
@@ -1103,20 +1103,20 @@ where
1103
1103
/// Enable the interrupt for the specified [`Event`].
1104
1104
#[ inline]
1105
1105
pub fn enable_interrupt ( & mut self , event : Event ) {
1106
- self . configure_interrupt ( event, Toggle :: On ) ;
1106
+ self . configure_interrupt ( event, Switch :: On ) ;
1107
1107
}
1108
1108
1109
1109
/// Disable the interrupt for the specified [`Event`].
1110
1110
#[ inline]
1111
1111
pub fn disable_interrupt ( & mut self , event : Event ) {
1112
- self . configure_interrupt ( event, Toggle :: Off ) ;
1112
+ self . configure_interrupt ( event, Switch :: Off ) ;
1113
1113
}
1114
1114
1115
1115
/// Enable or disable the interrupt for the specified [`Event`].
1116
1116
#[ inline]
1117
- pub fn configure_interrupt ( & mut self , event : Event , enable : impl Into < Toggle > ) {
1118
- // Do a round way trip to be convert Into<Toggle > -> bool
1119
- let enable: Toggle = enable. into ( ) ;
1117
+ pub fn configure_interrupt ( & mut self , event : Event , enable : impl Into < Switch > ) {
1118
+ // Do a round way trip to be convert Into<Switch > -> bool
1119
+ let enable: Switch = enable. into ( ) ;
1120
1120
let enable: bool = enable. into ( ) ;
1121
1121
match event {
1122
1122
Event :: AdcReady => self . reg . ier . modify ( |_, w| w. adrdyie ( ) . bit ( enable) ) ,
0 commit comments