Skip to main content
Visitor II
June 1, 2022
Question

Call HAL lib inside Call back

  • June 1, 2022
  • 2 replies
  • 934 views

Hello,

Is it Ok to read GPIO pins inside a timer call back as follow:

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)

{

if (htim == &htim2 ) //15 ms

{

BT1 = HAL_GPIO_ReadPin(GPIOx, Pin_x);

BT2 = HAL_GPIO_ReadPin(GPIOx, Pin_x);

BT3 = HAL_GPIO_ReadPin(GPIOx, Pin_x);

...

}

}

Thank you

    This topic has been closed for replies.

    2 replies

    Super User
    June 1, 2022

    It is. Look at (debug step) the implementation.

    hth

    KnarfB

    Super User
    June 1, 2022

    0693W000008xsqBQAQ.png