CC1310使用GPTimer, GPTimer在开启后无法产生中断, 具体代码如下:
//频率控制 void hzirqcallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) { LEDOR(); } void timerhz_init(void) { GPTimerCC26XX_Params params; GPTimerCC26XX_Params_init(¶ms); params.width = GPT_CONFIG_32BIT; params.mode = GPT_MODE_PERIODIC_UP; params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF; Power_setDependency(PowerCC26XX_XOSC_HF); //使能高速时钟 hztimer = GPTimerCC26XX_open(HZGPTIMERNUM, ¶ms); GPTimerCC26XX_Value loadVal = 48000000 / hz - 1; //47999 GPTimerCC26XX_setLoadValue(hztimer, loadVal); GPTimerCC26XX_registerInterrupt(hztimer, hzirqcallback, GPT_INT_TIMEOUT); timerhz_setstatus(0); } void timerhz_setstatus(uint8_t flag) { if(flag == 1) //打开频率定时器 { GPTimerCC26XX_start(hztimer); } else if(flag == 0) //关闭频率定时器 { GPTimerCC26XX_stop(hztimer); } } void timerhz_sethz(uint8_t h) { timerhz_setstatus(0); GPTimerCC26XX_Value loadVal = 48000000 / h - 1; //47999 GPTimerCC26XX_setLoadValue(hztimer, loadVal); }
调用GPTimerCC26XX_start后, 无法产生中断是什么原因? 怎么判断定时器是否启动?