The MCUXpresso SDK provides a peripheral driver for the external interrupt (IRQ) module of MCUXpresso SDK devices.
The IRQ Initialize is to initialize for common configure: gate the IRQ clock, configure enabled IRQ pins for pullup, edge select and detect mode, then enable the IRQ module. The IRQ Deinitialize is used to ungate the clock.
The IRQ provides the function to enable/disable interrupts. IRQ still provides functions to get and clear IRQF flags.
Typical use case
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/irq
Data Fields |
bool | enablePullDevice |
| Enable/disable the internal pullup device when the IRQ pin is enabled.
|
|
irq_edge_t | edgeSelect |
| Select the polarity of edges or levels on the IRQ pin that cause IRQF to be set.
|
|
irq_mode_t | detectMode |
| select either edge-only detection or edge-and-level detection
|
|
Enumerator |
---|
kIRQ_FallingEdgeorLowlevel |
IRQ is falling-edge or falling-edge/low-level sensitive.
|
kIRQ_RisingEdgeorHighlevel |
IRQ is rising-edge or rising-edge/high-level sensitive.
|
Enumerator |
---|
kIRQ_DetectOnEdgesOnly |
IRQ event is detected only on falling/rising edges.
|
kIRQ_DetectOnEdgesAndEdges |
IRQ event is detected on falling/rising edges and low/high levels.
|
uint32_t IRQ_GetInstance |
( |
IRQ_Type * |
base | ) |
|
- Parameters
-
base | IRQ peripheral base pointer |
- Return values
-
void IRQ_Init |
( |
IRQ_Type * |
base, |
|
|
const irq_config_t * |
config |
|
) |
| |
To initialize the IRQ pin, define a irq configuration, specify whhether enable pull-up, the edge and detect mode. Then, call the IRQ_Init() function.
This is an example to initialize irq configuration.
- Parameters
-
base | IRQ peripheral base pointer |
config | IRQ configuration pointer |
void IRQ_Deinit |
( |
IRQ_Type * |
base | ) |
|
This function disables the IRQ clock.
- Parameters
-
base | IRQ peripheral base pointer. |
- Return values
-
static void IRQ_Enable |
( |
IRQ_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | IRQ peripheral base pointer. |
enable | true to enable IRQ pin, else disable IRQ pin. |
- Return values
-
static void IRQ_EnableInterrupt |
( |
IRQ_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | IRQ peripheral base pointer. |
enable | true to enable IRQF assert interrupt request, else disable. |
- Return values
-
static void IRQ_ClearIRQFlag |
( |
IRQ_Type * |
base | ) |
|
|
inlinestatic |
This function clears the IRQF flag.
- Parameters
-
base | IRQ peripheral base pointer. |
- Return values
-
static uint32_t IRQ_GetIRQFlag |
( |
IRQ_Type * |
base | ) |
|
|
inlinestatic |
This function returns the IRQF flag.
- Parameters
-
base | IRQ peripheral base pointer. |
- Return values
-
status | = 0 IRQF flag deasserted. = 1 IRQF flag asserted. |