STM32W108单通道如下设置就可以了
void ADCConfiguration(void){
// 将GPIOA的引脚5定义为模拟输入
halGpioConfig(PORTA_PIN(5), GPIOCFG_ANALOG);
ADC_CFG = 0;
ADC_OFFSET = 0;
ADC_GAIN = 0x8000;
ADC_DMACFG = ADC_DMARST;
ADC_DMACFG = (ADC_DMAAUTOWRAP | ADC_DMALOAD);
ADC_DMABEG = (int32u)&adcData;
ADC_DMASIZE = 1;
// DMA缓冲区满中断使能
INT_ADCCFG = INT_ADCULDFULL;
// 清除所有中断标志
INT_ADCFLAG = 0xFFFF;
// 使能ADC全局中断
INT_CFGSET = INT_ADC;
ADC_CFG = (// 采样时间:1024 clocks,有效位:10 bits
(5 |