有大神指导一下吗?
现在我在用CC2640R2F的ADC功能是参考ti例程adcsinglechannel做的。但是我发现我一旦调用ADC_init();函数我所有的按键中断全部失灵。而且ADC功能也不正常。
以下是我的配置:
引用的头文件如下:
#include <ti/drivers/ADC.h>
#include <ti/drivers/adc/ADCCC26XX.h>
配置文件如下:
/* Analog Capable DIOs */
#define CC2640R2_LAUNCHXL_DIO5_ANALOG IOID_5
#define CC2640R2_ADCCOUNT 1
typedef enum CC2640R2_LAUNCHXL_ADCName {
CC2640R2_LAUNCHXL_ADC0 = 0,
CC2640R2_LAUNCHXL_ADC1,
CC2640R2_LAUNCHXL_ADC2,
CC2640R2_LAUNCHXL_ADC3,
CC2640R2_LAUNCHXL_ADC4,
CC2640R2_LAUNCHXL_ADC5,
CC2640R2_LAUNCHXL_ADC6,
CC2640R2_LAUNCHXL_ADC7,
CC2640R2_LAUNCHXL_ADCDCOUPL,
CC2640R2_LAUNCHXL_ADCVSS,
CC2640R2_LAUNCHXL_ADCVDDS,
CC2640R2_LAUNCHXL_ADCCOUNT
} CC2640R2_LAUNCHXL_ADCName;
ADCCC26XX_Object adcCC26xxObjects[CC2640R2_ADCCOUNT];
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2640R2_ADCCOUNT] = {
{
.adcDIO = CC2640R2_LAUNCHXL_DIO5_ANALOG,
.adcCompBInput = ADC_COMPB_IN_AUXIO5,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL,
.returnAdjustedVal = false
}
};
//ADC
const ADC_Config ADC_config[CC2640R2_ADCCOUNT] = {
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC5]},
};
//ADC_COMPB_IN_AUXIO5
const uint_least8_t ADC_count = CC2640R2_ADCCOUNT;
其他什么都不做,然后我在初始化函数那里加上 ADC_init();就出问题了。请问我哪个地方配置出错了?
有能够正常跑起来的ADC例子可以给我参考一下吗?