AnsweredAssumed Answered

disable interrupt

Question asked by Mr.Cscn on Jan 18, 2016
Latest reply on Jan 19, 2016 by dembek.radoslaw.001
i know how to set properly timer interrupt and it works fine. now i'm trying to create a function to disable interrupt. i should be something like this:

void TimDisableInterrupt(TIM_TypeDef* TIMx)
{


     switch((int)TIMx)
     {
     case (int)TIM2:
               NVIC_DisableIRQ(TIM2_IRQn);
          break;
     case (int)TIM3:
               NVIC_DisableIRQ(TIM3_IRQn);
          break;
     case (int)TIM4:
               NVIC_DisableIRQ(TIM4_IRQn);
          break;
     case (int)TIM5:
               NVIC_DisableIRQ(TIM5_IRQn);
          break;
     case (int)TIM6:
               NVIC_DisableIRQ(TIM6_IRQn);
          break;
     case (int)TIM7:
               NVIC_DisableIRQ(TIM7_IRQn);
          break;
     default:
          break;
     }


     NVIC_InitTypeDef nvicStructure;


     nvicStructure.NVIC_IRQChannelCmd = DISABLE;


     NVIC_Init(&nvicStructure);


     TIM_ITConfig(TIMx, TIM_IT_Update, DISABLE);
     TIM_Cmd(TIMx, DISABLE);
     TIM_ClearITPendingBit(TIMx, TIM_IT_Update);
}

so TimDisableInterrupt(TIM6) should disable TIM6 interrupt, but it doesn't work and it continue to go inside here:

void TIM6_IRQHandler(void)
{
    if (TIM_GetITStatus(TIM6, TIM_IT_Update) != RESET)
    /*do something */
    TIM_ClearITPendingBit(TIM6, TIM_IT_Update);
}

why?
i'm using stm32f10x

Outcomes