Skip to main content
Graduate
July 4, 2024
Solved

Enable/ disable EXTI interrupts using HAL

  • July 4, 2024
  • 2 replies
  • 1621 views

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.
    Best answer by Sarra.S

    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);

    2 replies

    Super User
    July 4, 2024

    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.SAnswer
    ST Employee
    July 9, 2024

    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);