TI中文支持网
TI专业的中文技术问题搜集分享网站

CC2640R2F GPTimer怎么修改定时时间

CC2640R2F GPTimer在运行时怎么修改定时时间, 有函数接口吗?

Susan Yang:

您可以在下面的链接找到如何使用GPT timer

C:/ti/simplelink_cc2640r2_sdk/docs/tidrivers/doxygen/html/_g_p_timer_c_c26_x_x_8h.html

以下代码是每1ms产生一个中断

GPTimerCC26XX_Handle hTimer;
void timerCallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) {// interrupt callback code goes here. Minimize processing in interrupt.
}
void taskFxn(UArg a0, UArg a1) {GPTimerCC26XX_Params params;GPTimerCC26XX_Params_init(&params);params.width= GPT_CONFIG_16BIT;params.mode= GPT_MODE_PERIODIC_UP;params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;hTimer = GPTimerCC26XX_open(CC2650_GPTIMER0A, &params);if(hTimer == NULL) {Log_error0("Failed to open GPTimer");Task_exit();}Types_FreqHzfreq;BIOS_getCpuFreq(&freq);GPTimerCC26XX_Value loadVal = freq.lo / 1000 - 1; //47999GPTimerCC26XX_setLoadValue(hTimer, loadVal);GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_TIMEOUT);GPTimerCC26XX_start(hTimer);while(1) {Task_sleep(BIOS_WAIT_FOREVER);}
}

 

赞(0)
未经允许不得转载:TI中文支持网 » CC2640R2F GPTimer怎么修改定时时间
分享到: 更多 (0)