Question
HAL Timer IRQ Handler
Posted on July 10, 2015 at 22:34
I'm trying to configure Timer2, and I've initialized it as follows based on some sample code, but I'm not sure how I'm supposed to handle the IRQ it generates.
Usually I would use TIM2_IRQHandler for example, but some samples I see use HAL_TIM_IRQHandler. Can someone explain what this new function is for?I'm also unable to check the status of the interrupt the way I used to using the TIM_GetITStatus function or clear the interrupt using TIM_ClearITPendingBitvoid WS2812_Timer_Init(void){ TIM_HandleTypeDef TimHandle; uint16_t PrescalerValue = (uint16_t) (SystemCoreClock / 24000000) - 1;; __TIM2_CLK_ENABLE(); TimHandle.Instance = WS2812_Timer; TimHandle.Init.Period = Timer_Period; TimHandle.Init.Prescaler = PrescalerValue; TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; /* Initialize Timer */ HAL_TIM_Base_Init(&TimHandle); /* Start Timer Interrupts */ HAL_TIM_Base_Start_IT(&TimHandle); /*##-2- Configure the NVIC for TIMx ########################################*/ /* Set Interrupt Group Priority */ HAL_NVIC_SetPriority(WS2812_Timer_IRQ, 0, 1); /* Enable the TIMx global Interrupt */ HAL_NVIC_EnableIRQ(WS2812_Timer_IRQ);}