cancel
Showing results for 
Search instead for 
Did you mean: 

Call HAL lib inside Call back

NASI
Senior

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

2 REPLIES 2
KnarfB
Principal III

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

hth

KnarfB

Andrew Neil
Evangelist III

0693W000008xsqBQAQ.png