19 External IRQ Driver
The External Interrupt driver allows external pins to be configured as interrupt lines. Each interrupt line can be individually masked and generate an interrupt on rising, falling, or both edges, or on high or low levels. Some of the external pins can also be configured to wake up the device from sleep modes where all clocks have been disabled.
External IRQ Basics and Best Practice
Generate an interrupt on rising, falling or both edges, or on high or low levels
Summary of the API's Functional Features
-
Initialize and deinitialize the driver and associated hardware
-
Hookup callback handler on external pin interrupt
-
Enable or disable interrupt on external pin
Summary of Configuration Options
Select external pin signal for each interrupt line
Select interrupt detection type for a pin (rising, falling, or both edges etc.)
Select if pin interrupt will wake up the device
Example of Usage
The following shows a simple example of registering a callback on an external pin interrupt.
The External Interrupt driver must have been initialized by ext_irq_init. This initialization will configure the operation of the hardware External Interrupt instance.
static void button_on_PA16_pressed(void)
{
}
/**
* Example of using EXTERNAL_IRQ_0
*/
void EXTERNAL_IRQ_0_example(void)
{
ext_irq_register(PIN_PA16, button_on_PA16_pressed);
}
Dependencies
-
External Interrupt Controller and its related I/O lines and clocks