提交 4b8f518c 编写于 作者: mysterywolf's avatar mysterywolf 提交者: mysterywolf

[stm32][adc] add error code return

上级 b33e1cbf
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册