cancel
Showing results for 
Search instead for 
Did you mean: 

How do I avoid multiple definitions for the HAL_TIM_PeriodElapsedCallback

raptorhal2
Lead
Posted on October 14, 2017 at 23:43

Problem occurs because TIM6 dedicated to incrementing SysTick in stm32l4xx_hal_timebase_tim.c and uses same callback function.

Hal

3 REPLIES 3
Posted on October 15, 2017 at 01:51

It is provided as a template, modify the function to check for the htim value, and run your code when appropriate.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
raptorhal2
Lead
Posted on October 15, 2017 at 16:14

Thanks, Clive1. It was much simpler when you knew which timer triggered the interrupt. And you could test for the most critical interrupt event first.

Hal

Posted on October 15, 2017 at 18:12

the callback passes you a handle to whichever timer caused the interrupt.

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim->Instance == TIM6)
{
do tim6 stuff
}
if (htim->Instance == TIM7)
{
do tim7 stuff
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?