HAL EXTI Functions

Initialization/De-Initialization and configuration functions

group EXTI_Exported_Functions_Group1

This subsection provides a set of functions allowing to initialize/de-initialize and configure the EXTI :

Initialize the EXTI handle using HAL_EXTI_Init():

  • Provide the EXTI handle as a parameter.

  • Provide the EXTI line number as a second parameter from hal_exti_line_t enumeration.

De-initialize the EXTI and reset the EXTI global state to HAL_EXTI_STATE_RESET by calling HAL_EXTI_DeInit():

  • Provide EXTI handle as parameter.

Configure the EXTI line using HAL_EXTI_SetConfig():

Retrieve current EXTI configuration of a dedicated line using HAL_EXTI_GetConfig():

  • Provide an EXTI handle as a first parameter.

  • Provide a configuration structure used to retrieve the current EXTI line configuration.

Functions

hal_status_t HAL_EXTI_Init ( hal_exti_handle_t * hexti , hal_exti_line_t line )

Store the EXTI line into the handle.

Parameters :
  • hexti – Pointer to EXTI handle.

  • line – EXTI line. This parameter can be a value of hal_exti_line_t .

Return values :
  • HAL_INVALID_PARAM – in case of an invalid parameter.

  • HAL_OK – in case of a successful initialization.

void HAL_EXTI_DeInit ( hal_exti_handle_t * hexti )

De-initialize the EXTI line.

Parameters :

hexti – Pointer to EXTI handle.

hal_status_t HAL_EXTI_SetConfig ( hal_exti_handle_t * hexti , const hal_exti_config_t * p_exti_config )

Set configuration for the selected EXTI line.

Parameters :
  • hexti – Pointer to EXTI handle.

  • p_exti_config – Pointer to EXTI configuration structure.

Return values :
  • HAL_INVALID_PARAM – in case of an invalid parameter.

  • HAL_OK – in case of a successful configuration.

void HAL_EXTI_GetConfig ( const hal_exti_handle_t * hexti , hal_exti_config_t * p_exti_config )

Retrieve the configuration of the selected EXTI line.

Parameters :
  • hexti – Pointer to EXTI handle.

  • p_exti_config – Pointer to structure to store EXTI configuration.

I/O Operations functions

group EXTI_Exported_Functions_Group2

This subsection contains the APIs managing I/O operations of the EXTI lines:

Enable the EXTI line for the selected mode: Interrupt, Event or both using HAL_EXTI_Enable() :

  • Provide the EXTI handle as a first parameter.

  • Provide an EXTI mode from hal_exti_mode_t as a second parameter.

Disable EXTI line using HAL_EXTI_Disable():

  • Provide the EXTI handle as parameter.

Generate a software interrupt using HAL_EXTI_GenerateSWI():

  • Provide the EXTI handle as parameter.

Get interrupt pending edge using HAL_EXTI_GetPending():

  • Provide the EXTI handle as parameter.

Clear interrupt pending bit for the given edge using HAL_EXTI_ClearPending():

  • Provide the EXTI handle as first parameter.

  • Provide the pending edge as second parameter.

Functions

hal_status_t HAL_EXTI_Enable ( hal_exti_handle_t * hexti , hal_exti_mode_t mode )

Enable the EXTI mode for the selected EXTI line.

Parameters :
  • hexti – Pointer to EXTI handle.

  • mode – EXTI mode. This parameter can be a value of hal_exti_mode_t .

Return values :

HAL_OK – in case of a successful Enable.

hal_status_t HAL_EXTI_Disable ( hal_exti_handle_t * hexti )

Disable the EXTI mode for the selected EXTI line.

Parameters :

hexti – Pointer to EXTI handle.

Return values :

HAL_OK – in case of a successful Disable.

hal_status_t HAL_EXTI_GenerateSWI ( hal_exti_handle_t * hexti )

Generate a software interrupt for the selected EXTI line.

Parameters :

hexti – Pointer to EXTI handle.

Return values :

HAL_OK – when software interrupt is successfully generated.

hal_exti_trigger_t HAL_EXTI_GetPending ( const hal_exti_handle_t * hexti )

Get interrupt pending bit of the selected EXTI line.

Parameters :

hexti – Pointer to EXTI handle.

Return values :

pending_edge – of type hal_exti_trigger_t Trigger value.

void HAL_EXTI_ClearPending ( const hal_exti_handle_t * hexti , hal_exti_trigger_t edge )

Clear interrupt pending bit of the selected EXTI line.

Parameters :
  • hexti – Pointer to EXTI handle.

  • edge – Pending edge to be cleared. This parameter can be a value of hal_exti_trigger_t Trigger value.

IRQHandler and callbacks functions

group EXTI_Exported_Functions_Group3

This subsection contains the EXTI IRQHandler and callbacks registration functions:

Handle EXTI interrupt requests using HAL_EXTI_IRQHandler():

  • Provide the EXTI handle as parameter.

Register callback function for interrupts on trigger edge using HAL_EXTI_RegisterTriggerCallback():

  • Provide the EXTI handle as first parameter.

  • Provide a pointer to callback function as second parameter.

Default callback function for interrupts on trigger edge using HAL_EXTI_TriggerCallback():

  • Provide the EXTI handle as parameter.

  • Provide the trigger as second parameter.

Store user data pointer into the handle using HAL_EXTI_SetUserData():

  • Provide the EXTI handle as first parameter.

  • Provide the pointer to the user data as a second parameter

Retrieve user data pointer from the handle using HAL_EXTI_GetUserData():

  • Provide the EXTI handle as parameter.

Functions

void HAL_EXTI_IRQHandler ( hal_exti_handle_t * hexti )

Handle EXTI Interrupt request.

Parameters :

hexti – Pointer to EXTI handle.

hal_status_t HAL_EXTI_RegisterTriggerCallback ( hal_exti_handle_t * hexti , hal_exti_cb_t p_exti_cb )

Register callback function for the selected EXTI line on trigger edge.

Parameters :
  • hexti – Pointer to EXTI handle.

  • p_exti_cb – Pointer to the callback function to be registered.

Return values :
  • HAL_INVALID_PARAM – in case of an invalid parameter.

  • HAL_OK – in case of a successful callback registration.

void HAL_EXTI_TriggerCallback ( hal_exti_handle_t * hexti , hal_exti_trigger_t trigger )

EXTI line trigger edge default callback.

Parameters :
  • hexti – Pointer to EXTI handle.

  • trigger – This parameter can be a value of hal_exti_trigger_t Trigger value.

void HAL_EXTI_SetUserData ( hal_exti_handle_t * hexti , const void * p_user_data )

Store User Data pointer into the handle.

Parameters :
  • hexti – Pointer to EXTI handle.

  • p_user_data – Pointer to the user data.

const void * HAL_EXTI_GetUserData ( const hal_exti_handle_t * hexti )

Retrieve User Data Pointer from the handle.

Parameters :

hexti – Pointer to EXTI handle.

Return values :

Pointer – to the user data.

EXTI state and info functions

group EXTI_Exported_Functions_Group4

This subsection contains the EXTI state and info functions:

Retrieve the global state of the current EXTI line using HAL_EXTI_GetState():

  • Provide the EXTI handle as a parameter.

Functions

hal_exti_state_t HAL_EXTI_GetState ( const hal_exti_handle_t * hexti )

Get the current general state of the EXTI line.

Parameters :

hexti – Pointer to EXTI handle.

Return values :
  • HAL_EXTI_STATE_RESET – when EXTI is de-initialized.

  • HAL_EXTI_STATE_INIT – when EXTI is initialized but not yet configured.

  • HAL_EXTI_STATE_IDLE – when EXTI is initialized and configured.

  • HAL_EXTI_STATE_ACTIVE – when EXTI is initialized, configured and Enabled.