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 {
439439 ///
440440 /// # Args
441441 /// * `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.
446442 pub fn reference_voltage ( mut self , vdda_mv : u32 ) -> Self {
447443 self . vdda = Some ( vdda_mv) ;
448444 self
@@ -716,12 +712,10 @@ macro_rules! adc {
716712 }
717713 }
718714
719- let vdda = if let Some ( vdda) = config. vdda { vdda } else { VDDA_CALIB } ;
720-
721715 let mut s = Self {
722716 config,
723717 adc_reg: adc,
724- calibrated_vdda: vdda ,
718+ calibrated_vdda: VDDA_CALIB ,
725719 max_sample: 0 ,
726720 } ;
727721
@@ -732,6 +726,11 @@ macro_rules! adc {
732726 s. enable( ) ;
733727 s. calibrate( ) ;
734728
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+
735734 s
736735 }
737736
You can’t perform that action at this time.
0 commit comments