HAL EXTI How to Use

group EXTI_How_To_Use

EXTI Peripheral features

A configurable EXTI line can be configured either to use as an event input, or to generate a software interrupt.

  • To use as an event input, an active trigger edge must be selected and an EXTI mode must be enabled as well.

  • In order to generate a software interrupt event on the configurable EXTI line, the interrupt mode must be enabled for the selected EXTI line.

  • The EXTI lines from line 0 to line 15 are linked to GPIO pins. For example: EXTI line 5 can be linked to pin 5 of every GPIO port.

How to use this driver

In case the EXTI line is used as an event input:

  • Instantiate an EXTI handle and associate it to an EXTI line.

  • Configure the EXTI line identified by the given handle.

  • Register a user defined callback for an EXTI line identified by the handle, or else use the default callback functions.

  • Enable EXTI line for Interrupt, Event or both modes.

  • Pending events can be retrieved and cleared.

  • EXTI modes can be disabled.

In case of a software interrupt generation on the EXTI line:

  • Instantiate an EXTI handle and associate it to an EXTI line.

  • Register a user defined callback for an EXTI line identified by the handle, or else use the default callback functions.

  • Generate the software interrupt.

  • Pending software interrupt event can be retrieved and cleared.