This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R: Util中定时器工具使用

Part Number: CC2652R


参考SDK中的simple_peripheral中例程中其他定时器的创建方式同时创建了两个one-shot定时器(clockPeriod参数为0),其中一个定时5ms,另一个定时10000ms,并在SimplePeripheral_clockHandler中使用Util_startClock重新开启定时,参考SimplePeripheral_clockHandler中其他定时器方法。发现定时5ms的定时器在10000ms定时器执行之后便不会执行,即之后只会执行10000ms的定时器事件,并且10000ms定时器在第一次回调的时候执行了两次

    Util_constructClock(&ECGSampleTimer, SimplePeripheral_clockHandler,
                        5, 0, true, (UArg)&ecgSample);


    Util_constructClock(&powerSampleTimer, SimplePeripheral_clockHandler,
                        10000, 0, true, (UArg)&powerSample);

else if(pData->event == SP_ECG_SAMPLE_EVT)
 {
     //开启下一个定时5ms,好像有问题
     Util_startClock(&ECGSampleTimer);
     //传递事件到应用层
     SimplePeripheral_enqueueMsg(SP_ECG_SAMPLE_EVT, pData);
 }
 else if(pData->event == SP_POWER_SAMPLE_EVT)
  {
      //开启下一个定时10000ms
      Util_startClock(&powerSampleTimer);
      //传递事件到应用层
      SimplePeripheral_enqueueMsg(SP_POWER_SAMPLE_EVT, pData);
  }