Skip to content

Commit cee2a35

Browse files
authored
Merge pull request #12357 from ABOSTM/F103_ADC3_NOT_SUPPORTING_COMMON_SETTINGS
TARGET_STM32F1: don't set ADC common register when ADC doesn't support it
2 parents f73a62a + 03b03fe commit cee2a35

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

targets/TARGET_STM/TARGET_STM32F1/analogin_device.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ uint16_t adc_read(analogin_t *obj)
177177
if (HAL_ADC_PollForConversion(&obj->handle, 10) == HAL_OK) {
178178
adcValue = (uint16_t)HAL_ADC_GetValue(&obj->handle);
179179
}
180-
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE((&obj->handle)->Instance), LL_ADC_PATH_INTERNAL_NONE);
180+
181+
if (__LL_ADC_COMMON_INSTANCE(__LL_ADC_COMMON_INSTANCE((&obj->handle)->Instance)) != 0U) {
182+
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE((&obj->handle)->Instance), LL_ADC_PATH_INTERNAL_NONE);
183+
}
181184
return adcValue;
182185
}
183186

0 commit comments

Comments
 (0)