1
\$\begingroup\$

I need to disable EXTI interrupt under stm32 with SPL. Here is my configuration:

NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIOStruc;
EXTI_InitTypeDef EXTI_InitStruct;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);

GPIOStruc.GPIO_Mode=GPIO_Mode_IPU;
GPIOStruc.GPIO_Pin=GPIO_Pin_4;
GPIOStruc.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIOStruc);

GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource4);

EXTI_InitStruct.EXTI_Line=EXTI_Line4;
EXTI_InitStruct.EXTI_LineCmd = ENABLE;
EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
EXTI_Init(&EXTI_InitStruct);    

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); 
NVIC_InitStructure.NVIC_IRQChannel =EXTI4_IRQn ;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); 

I need to disable the above EXTI.

\$\endgroup\$
2
  • \$\begingroup\$ Did you try something like NVIC_DisableIRQ(EXTI4_IRQn);? \$\endgroup\$
    – brhans
    Aug 22, 2020 at 15:09
  • \$\begingroup\$ Thank you very much. \$\endgroup\$
    – John Jin
    Aug 22, 2020 at 18:19

1 Answer 1

3
\$\begingroup\$

As Brhans said by using the NVIC_DisableIRQ the EXTI can be disabled.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.