Jump to main content

##

# 3.5.10 External Interrupt Controller (EIC)

The External Interrupt Controller (EIC) allows external pins to be configured as interrupt lines. Each interrupt line can be individually masked and can generate an interrupt on edge or level. Each external pin has a configurable filter to remove spikes. Each external pin can also be configured to be asynchronous in order to wake up the device from sleep modes where all clocks have been disabled. External pins can also generate an event.

A separate non-maskable interrupt (NMI) is also supported. It has properties similar to the other external interrupts, but is connected to the NMI request of the CPU, enabling it to interrupt any other interrupt mode.

## Using The Library

The External Interrupt Controller (EIC) allows external pins to be configured as interrupt lines. The registered callback function will be call when the interrupt is triggered.

    void EIC15_Callback(uintptr_t context)
    {
        LED_Toggle();
    }

    int main ( void )
    {

        EIC_CallbackRegister(EIC_PIN_15,EIC15_Callback, 0);

    }

## Library Interface

External Interrupt Controller peripheral library provides the following interfaces:

Functions

Name | Description
--- | ---
EIC_Initialize | Initializes given instance of EIC peripheral
EIC_InterruptEnable | Enable external interrupt on the specified pin
EIC_InterruptDisable | Disable external interrupt on the specified pin
EIC_CallbackRegister | Registers the function to be called when an interrupt condition has been sensed on the pin
EIC_NMICallbackRegister | Registers the function to be called when an interrupt condition has been sensed on the NMI pin

Data types and constants

Name | Type | Description
--- | --- | ---
EIC_PIN | Enum | Identifies the available EIC pins
EIC_CALLBACK | Typedef | Defines the data type and function signature of the EIC peripheral callback function
EIC_NMI_CALLBACK | Typedef | Defines the data type and function signature of the EIC peripheral NMI callback function