Skip to main content
Associate II
Jul 4, 2024 11:47 AM UTC
Solved

Enable/ disable EXTI interrupts using HAL

Hey guys.

I need to enable/disable the line 14 of the EXTI interrupts multiple times, using HAL

Do i just use the HAL_NVIC_DisableIRQ  HAL_NVIC_EnableIRQ  ( and HAL_NVIC_SetPriority whenever i re-enable the line?), providing the correct handle to the api each time?

This topic has been closed for replies.
Sarra.SBest answer
ST Employee
Jul 9, 2024 1:33 PM UTC

Hello @AlexandrosAA, 

You only need to set the priority once using HAL_NVIC_SetPriority unless you need to change the priority dynamically.

to enable the interrupt: HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

to disable the interrupt: HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

2 replies

Pavel A.
Jul 4, 2024 10:16 PM UTC

To enable/disable EXTI interrupts, you can set and clear raising/falling edge detection bit of the needed line in EXTI registers EXTI_RTSR1 and/or EXTI_FTSR1. Leave the NVIC interrupt enabled.  Not sure if the HAL library has a function for this. If not, do it without the HAL.

Sarra.SBest answer
ST Employee
Jul 9, 2024 1:33 PM UTC

Hello @AlexandrosAA, 

You only need to set the priority once using HAL_NVIC_SetPriority unless you need to change the priority dynamically.

to enable the interrupt: HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

to disable the interrupt: HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.