The external signal mechanism in the BLE SDK, gives you the ability to handle external events, such as GPIO interrupts.
Up to 32 separate signals can be sent from the user application to the Bluetooth stack through a call to the API function gecko_external_signal(). This API takes a 32 bit parameter which is interpreted as a set of 32 flags, one for each channel. The use for each channel can be set by the user. A call to this API causes the stack to send a system_external_signal event to the application. This event has a 32 bit value to indicate which signals have been sent since the last event. Sending the same signal multiple times will only result in multiple events once the signal has been cleared.
The example attached to this article is written for an EFR32BG1P device but can be easily ported to other devices. This application uses the external signal mechanism to signal the Bluetooth stack when a button on the WSTK board is pressed. The first step is to set up the GPIO lines for interrupts. This is done at the system_boot event (gecko_evt_system_boot_id) by calling setup_external_interrupts(). This function sets up the GPIO lines as inputs, configures them to generate interrupts and registers a callback to process the interrupts. When a button is pressed, the callback function ButtonHandler() is called. This function receives a single parameter to indicate which interrupts are active, gecko_external_signal() is then called to indicate to the stack which button was pressed. The system_external_signal event handler (gecko_system_external_signal_id) processes these signals. When this event is handled all of the signals are cleared.
The external signal mechanism is a convenient way for the application to allow the Bluetooth stack to schedule handling of non-Bluetooth tasks required by the application such as interrupt servicing.
"GPIOINT_Init()" and "GPIOINT_CallbackRegister(PB0_PIN,ButtonHandler)" in the example are giving undefined reference error when I compile.
Any idea why ?
Is this project done in Simplicity Studio 4 ?
Which are the steps I must do to import this project into SS4 for doing work it with my BRD4104A ?
GPIOINT_Init()" and "GPIOINT_CallbackRegister(PB0_PIN,ButtonHandler)" come from gpiointerrupt.c, you need to copy this file from the SDK to your project to fix the error.
Yes, it's been done with SimplicityStudio 4. If you need to use it for a different target the best thing to do is create an soc-empty for that board and then copy over main.c, gpiointerrupt.c and ext_interrupts.c. The files all come from the soc-empty sample app.