Skip to content

Commit 7d72a79

Browse files
ABOSTMfpistm
authored andcommitted
analogRead: don't set ADC common register when ADC doesn't support it.
STM32F103ZE: ADC3 doesn't support common settings. __LL_ADC_COMMON_INSTANCE(ADC3) returns 0
1 parent 05695fb commit 7d72a79

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: libraries/SrcWrapper/src/stm32/analog.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,9 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
10061006
return 0;
10071007
}
10081008

1009-
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(AdcHandle.Instance), LL_ADC_PATH_INTERNAL_NONE);
1010-
1009+
if (__LL_ADC_COMMON_INSTANCE(AdcHandle.Instance) != 0U) {
1010+
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(AdcHandle.Instance), LL_ADC_PATH_INTERNAL_NONE);
1011+
}
10111012
return uhADCxConvertedValue;
10121013
}
10131014
#endif /* HAL_ADC_MODULE_ENABLED && !HAL_ADC_MODULE_ONLY*/

0 commit comments

Comments
 (0)