MaJerle / stm32fxxx-hal-libraries

Libraries for STM32F4xx and STM32F7xx built on HAL drivers from ST
MIT License
764 stars 434 forks source link

ADC for new HAL Library 1.7.1 not checking all flags #23

Open jeremyvnc opened 7 years ago

jeremyvnc commented 7 years ago

Found a bug in the TM_ADC_Read function where at the end of the conversion, it checks the EOC flag. Apparently in the latest HAL that you support (1.7.1), this is not the only flag set now as the READY state is also set.

I fixed it on line 175 of tm_stm32_adc.c by checking for that flag as a flag instead as the equal value: if (HAL_ADC_GetState(&AdcHandle) & HAL_ADC_STATE_EOC_REG == HAL_ADC_STATE_EOC_REG) {

This fixed the issue. I would do a pull request but my github is messed up at the moment.

jinhyuk-im commented 6 years ago

@jeremyvnc or, I think #28 can fix this issue.