Skip to content

Commit

Permalink
STM32WB ADC : Consecutive VBAT values reading was not possible
Browse files Browse the repository at this point in the history
Add Stop after read
  • Loading branch information
jeromecoutant committed Sep 12, 2019
1 parent 0f1962e commit ee8489f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions targets/TARGET_STM/TARGET_STM32WB/analogin_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ee8489f

Please sign in to comment.