cubemx配置ADC
参考博客:https://blog.csdn.net/qq_29031103/article/details/119894077
生成代码;
接着编写代码:
1)在main函数bsp初始化部分;
添加:HAL_ADCEx_Calibration_Start(&hadc1);
2)在业务逻辑里添加:
uint16_t ADC_value[2]; //AD转换值
HAL_ADC_Start_DMA(&hadc1,(uint32_t *)&ADC_value,2);
DBG_log("\r\nADC_value0:%d,ADC_value1:%d\r\n",ADC_value[0],ADC_value[1]);
没了
验证: