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.

GPTimer 在capture 模式下触发回调函数的条件问题?在以下代码中



GPTimerCC26XX_Params params;
  GPTimerCC26XX_Params_init(&params);
  params.width          = GPT_CONFIG_16BIT;
  //params.mode           = GPT_MODE_PERIODIC;
  params.mode           = GPT_MODE_EDGE_COUNT;
  params.direction      = GPTimerCC26XX_DIRECTION_UP;
  params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
  hTimer = GPTimerCC26XX_open(Board_GPTIMER0B, &params);
  if(hTimer == NULL) {
    Log_error0("Failed to open GPTimer");
  }else{
      Log_info0("SUCESS to open GPTimer");
  }
  // Register interrupt when capture happens
  // GPT_MODE_EDGE_COUNT seems to trigger GPT_INT_CAPTURE_MATCH interrupts
  GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_CAPTURE_MATCH);

  // Open pin handle and route pin to timer
   timerPinHandle = PIN_open(&timerPinState, gptPinInitTable);
   GPTimerCC26XX_PinMux pinMux = GPTimerCC26XX_getPinMux(hTimer);
   PINCC26XX_setMux(timerPinHandle, PIN_ID(Board_ENCODER), pinMux);
   GPTimerCC26XX_setCaptureEdge(hTimer, GPTimerCC26XX_BOTH_EDGES);

   // When counting in upwads direction LoadValue needs to be at least as
   // large as matchValue for interrupts to work.
   GPTimerCC26XX_setLoadValue(hTimer, 0xFFFF);
   GPTimerCC26XX_setMatchValue(hTimer, 65535);

   GPTimerCC26XX_start(hTimer);

// When counting in upwads direction LoadValue needs to be at least as
   // large as matchValue for interrupts to work.
   GPTimerCC26XX_setLoadValue(hTimer, 0xFFFF);
   GPTimerCC26XX_setMatchValue(hTimer, 65535);

   GPTimerCC26XX_setLoadValue(hTimer, 0xFFFF);函数都会触发回调函数吗?我设置的是  GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_CAPTURE_MATCH);触发回调函数而还在每次调用之后清除计数值,为啥会打印出0,不是要65535才触发回调函数吗?