[stm32][adc] add error code return

This commit is contained in:
Meco Man 2023-03-19 20:40:47 -04:00 committed by Man, Jianting (Meco)
parent b33e1cbf68
commit 4b8f518c48
1 changed files with 2 additions and 0 deletions

View File

@ -329,8 +329,10 @@ static rt_int16_t stm32_adc_get_vref (struct rt_adc_device *device)
ADC_HandleTypeDef *stm32_adc_handler = device->parent.user_data;
ret = rt_adc_enable(device, ADC_CHANNEL_VREFINT - ADC_CHANNEL_0);
if (ret != RT_EOK) return (rt_int16_t)ret;
vref_value = rt_adc_read(device, ADC_CHANNEL_VREFINT - ADC_CHANNEL_0);
ret = rt_adc_disable(device, ADC_CHANNEL_VREFINT - ADC_CHANNEL_0);
if (ret != RT_EOK) return (rt_int16_t)ret;
vref_mv = __LL_ADC_CALC_VREFANALOG_VOLTAGE(vref_value, stm32_adc_handler->Init.Resolution);
#else