From 17ed4117296717608eaa2261c8392fbda9af6938 Mon Sep 17 00:00:00 2001 From: Alexey Porotnikov Date: Wed, 20 Mar 2019 14:45:24 +0200 Subject: [PATCH] fix wrong ADC state check see also: https://github.com/MaJerle/stm32fxxx_hal_libraries/pull/28 --- 00-STM32_LIBRARIES/tm_stm32_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/00-STM32_LIBRARIES/tm_stm32_adc.c b/00-STM32_LIBRARIES/tm_stm32_adc.c index a562c05..ea21aa5 100644 --- a/00-STM32_LIBRARIES/tm_stm32_adc.c +++ b/00-STM32_LIBRARIES/tm_stm32_adc.c @@ -172,7 +172,7 @@ uint16_t TM_ADC_Read(ADC_TypeDef* ADCx, TM_ADC_Channel_t channel) { HAL_ADC_PollForConversion(&AdcHandle, 10); /* Check if the continous conversion of regular channel is finished */ - if (HAL_ADC_GetState(&AdcHandle) == HAL_ADC_STATE_EOC_REG) { + if (HAL_ADC_GetState(&AdcHandle) & HAL_ADC_STATE_EOC_REG) { /* Get the converted value of regular channel */ return HAL_ADC_GetValue(&AdcHandle); }