Merge pull request #11471 from jeromecoutant/PR_WB_ADC

STM32WB ADC : consecutive VBAT reading
pull/11514/head
Martin Kojtal 2019-09-16 13:19:09 +02:00 committed by GitHub
commit f51bbe01c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -194,6 +194,11 @@ uint16_t adc_read(analogin_t *obj)
if (HAL_ADC_PollForConversion(&obj->handle, 10) == HAL_OK) {
adcValue = (uint16_t)HAL_ADC_GetValue(&obj->handle);
}
if (HAL_ADC_Stop(&obj->handle) != HAL_OK) {
debug("HAL_ADC_Stop failed\r\n");
}
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE((&obj->handle)->Instance), LL_ADC_PATH_INTERNAL_NONE);
return adcValue;
}