Detailed Description

GPIOINT General Purpose Input/Output Interrupt dispatcher.

The source files for the GPIO interrupt dispatcher library resides in the emdrv/gpiointerrupt folder, and are named gpiointerrupt.c and gpiointerrupt.h.


EFM32/EZR32/EFR32 has two GPIO interrupts lines, Odd and Even. If more than two interrupts are used then interrupt routine must dispatch from a callback register. This module provides small dispatcher for both GPIO interrupts enabling handling of up to 16 GPIO pin interrupts.

It is up to the user to configure and enable interrupt on given pin. This can be done using the GPIO library (emlib). This module handles the dispatch register and clearing of interrupt flags.

In order to use this dispatcher, it has to be initialized first by calling GPIOINT_Init(). Then each pin must be configured by first registering the callback function for given pin and then configure and enabling the interrupt in GPIO module.


This section contain brief descriptions of the functions in the API. You will find detailed information on parameters by clicking on the hyperlinked function names.

Your application code must include one header file: gpiointerrupt.h.

This functions initializes the dispatcher register. Typically GPIOINT_Init() is called once in your startup code.

Register a callback function on a pin number.

Un-register a callback function on a pin number.


#include "em_gpio.h"
#include "em_int.h"
#include "gpiointerrupt.h"

int main(void)

  // Enable clock for GPIO module, initialize GPIOINT
  CMU_ClockEnable(cmuClock_GPIO, true);

  // Register callback functions and enable interrupts
  GPIOINT_CallbackRegister(1, gpioCallback1);
  GPIOINT_CallbackRegister(3, gpioCallback3);
  GPIOINT_CallbackRegister(8, gpioCallback8);
  GPIO_IntEnable(1<<1 | 1<<3 | 1<<8);



typedef void(* GPIOINT_IrqCallbackPtr_t) (uint8_t pin)
 GPIO interrupt callback function pointer.


void GPIOINT_CallbackRegister (uint8_t pin, GPIOINT_IrqCallbackPtr_t callbackPtr)
 Registers user callback for given pin number.
static __INLINE void GPIOINT_CallbackUnRegister (uint8_t pin)
 Unregisters user callback for given pin number.
void GPIOINT_Init (void)
 Initialization of GPIOINT module.

Typedef Documentation

typedef void(* GPIOINT_IrqCallbackPtr_t) (uint8_t pin)

GPIO interrupt callback function pointer.


  • pin - The pin index the callback function is invoked for.

Definition at line 46 of file gpiointerrupt.h.

Function Documentation

void GPIOINT_CallbackRegister ( uint8_t  pin,
GPIOINT_IrqCallbackPtr_t  callbackPtr 

Registers user callback for given pin number.

Use this function to register a callback which shall be called upon interrupt generated from given pin number (port is irrelevant). Interrupt itself must be configured externally. Function overwrites previously registered callback.

[in]pinPin number for the callback.
[in]callbackPtrA pointer to callback function.

Definition at line 87 of file gpiointerrupt.c.

References CORE_ATOMIC_SECTION, GPIO_EVEN_IRQHandler(), GPIO_IntClear(), GPIO_IntGetEnabled(), GPIO_ODD_IRQHandler(), and SL_CTZ().

Referenced by BOARD_alsSetIRQCallback(), BOARD_gasSensorSetIRQCallback(), BOARD_hallSensorSetIRQCallback(), BOARD_imuSetIRQCallback(), BOARD_pushButton0SetIRQCallback(), BOARD_pushButton1SetIRQCallback(), ezradio_hal_GpioInit(), GPIOINT_CallbackUnRegister(), and UARTDRV_DeInit().

static __INLINE void GPIOINT_CallbackUnRegister ( uint8_t  pin)

Unregisters user callback for given pin number.

Use this function to unregister a callback.

[in]pinPin number for the callback.

Definition at line 66 of file gpiointerrupt.h.

References GPIOINT_CallbackRegister().