我们实际中会用到多路ADC采样,这边举例说明多路ADC使用方法及注意事项
其中:adc_config.channel = ADC_CH_GPIO7 | ADC_CH_GPIO8 | ADC_CH_GPIO11| ADC_CH_VBAT; 分别代表VBAT ,GPIO7,GPIO8,GPIO11这4路,顺序如下 /// ADC channels typedef enum { /// temperature channel ADC_CH_TEMPERATURE = (1<<0U), /// VBAT channel ADC_CH_VBAT = (1<<1U), /// GPIO2 channel ADC_CH_GPIO2 = (1<<4U), /// GPIO3 channel ADC_CH_GPIO3 = (1<<5U), /// GPIO7 channel ADC_CH_GPIO7 = (1<<6U), /// GPIO8 channel ADC_CH_GPIO8 = (1<<7U), /// GPIO11 channel ADC_CH_GPIO11 = (1<<8U), /// GPIO12 channel ADC_CH_GPIO12 = (1<<9U), /// GPIO14 channel ADC_CH_GPIO14 = (1<<10U), /// GPIO15 channel ADC_CH_GPIO15 = (1<<11U), } drv_adc_channel_t; out5[4]数组分别采集到的数据是VBAT 、GPIO7、GPIO8、GPIO11
为降低功耗,代码都放在RAM里运行,修改如下 此处修改如下:(都加*) ER_RAM_CODE +0 ALIGN 32 { *.o(RAM_CODE*) *.o(RAM_RODATA*) } 4. 工程默认主频是32MHZ,这边测试32M比64M主频的平均功耗会低 5. ADC采样测试在入口和出口测试采样时间,这边验证在32M主频下的时间是400us左右 |