File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -439,10 +439,6 @@ pub mod config {
439
439
///
440
440
/// # Args
441
441
/// * `vdda_mv` - The ADC reference voltage in millivolts.
442
- ///
443
- /// # Note
444
- /// Reference voltage configuration will be overridden for ADC1 by an internal calibration
445
- /// routine.
446
442
pub fn reference_voltage ( mut self , vdda_mv : u32 ) -> Self {
447
443
self . vdda = Some ( vdda_mv) ;
448
444
self
@@ -716,12 +712,10 @@ macro_rules! adc {
716
712
}
717
713
}
718
714
719
- let vdda = if let Some ( vdda) = config. vdda { vdda } else { VDDA_CALIB } ;
720
-
721
715
let mut s = Self {
722
716
config,
723
717
adc_reg: adc,
724
- calibrated_vdda: vdda ,
718
+ calibrated_vdda: VDDA_CALIB ,
725
719
max_sample: 0 ,
726
720
} ;
727
721
@@ -732,6 +726,11 @@ macro_rules! adc {
732
726
s. enable( ) ;
733
727
s. calibrate( ) ;
734
728
729
+ // If the user specified a VDDA, use that over the internally determined value.
730
+ if let Some ( vdda) = s. config. vdda {
731
+ s. calibrated_vdda = vdda;
732
+ }
733
+
735
734
s
736
735
}
737
736
You can’t perform that action at this time.
0 commit comments