Skip to main content
patrickbrataas9
Associate III
November 5, 2014
Question

How to know which timer triggered the callback

  • November 5, 2014
  • 1 reply
  • 610 views
Posted on November 05, 2014 at 12:14

How can I check what timer triggered the callback:

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
}

I investigated the htim structure, but did not find anything that can be used to do this.. There should be some ID or a function for checking if htim == htim1 etc.
    This topic has been closed for replies.

    1 reply

    patrickbrataas9
    Associate III
    November 5, 2014
    Posted on November 05, 2014 at 13:32

    I figured out a way to do it:

    switch( (uint32_t) htim->Instance)
    {
    case TIM1_BASE:
    //Code here.
    break;
    }