cancel
Showing results for 
Search instead for 
Did you mean: 

What modification is necessary to TouchGFX files to use the TIM interrupt ?

I would like to add a TMR interrupt to manage an action every 1sec.

Code used now in the stm32746g_discovery.c file:

void TIM2_IRQHandler(void)

{

 if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)

 {

   TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

   STM32vldiscovery_LEDToggle(LED3);

 }

}

void BSP_TIM2_Init()

{

 TIM_TimeBaseInitTypeDef TIM_StructInit;

 NVIC_InitTypeDef NVIC_StructInit;

 RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

 TIM_StructInit.TIM_Period=Period;

 TIM_StructInit.TIM_Prescaler=Prescaler;

 TIM_StructInit.TIM_ClockDivision=TIM_CKD_DIV1;

 TIM_StructInit.TIM_CounterMode=TIM_CounterMode_Up;

 TIM_StructInit.TIM_RepetitionCounter=0;

 TIM_TimeBaseInit(TIM2, &TIM_StructInit);

 TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);

 TIM_Cmd(TIM2, ENABLE);   

 TIM_ClearFlag(TIM2, TIM_FLAG_Update);

 NVIC_StructInit.NVIC_IRQChannel=TIM2_IRQn;

 NVIC_StructInit.NVIC_IRQChannelCmd=ENABLE;

 NVIC_StructInit.NVIC_IRQChannelPreemptionPriority=0;

 NVIC_StructInit.NVIC_IRQChannelSubPriority=1;

 NVIC_Init(&NVIC_StructInit);

}

errors:

Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.c: In function 'TIM2_IRQHandler':

       Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.c:379:7: warning: implicit declaration of function 'TIM_GetITStatus' [-Wimplicit-function-declaration]

          if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)

              ^~~~~~~~~~~~~~~

       Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.c:379:29: error: 'TIM_IT_Update' undeclared (first use in this function)

          if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)

                                    ^~~~~~~~~~~~~

       Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.c:379:29: note: each undeclared identifier is reported only once for each function it appears in

       Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.c:381:5: warning: implicit declaration of function 'TIM_ClearITPendingBit' [-Wimplicit-function-declaration]

            TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

            ^~~~~~~~~~~~~~~~~~~~~

0 REPLIES 0