External Interrupt Controller.
More...
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
typedef enum eic_interrupt_trigger | eic_interrupt_trigger |
| An enum defining the types of interrupt trigger you wish to scan for.
|
|
typedef void(* | eic_cb_t) (uint8_t channel) |
|
|
enum | eic_interrupt_trigger { INTERRUPT_TRIGGER_NONE = 0
, INTERRUPT_TRIGGER_RISING
, INTERRUPT_TRIGGER_FALLING
, INTERRUPT_TRIGGER_BOTH
} |
| An enum defining the types of interrupt trigger you wish to scan for.
|
|
|
void | eic_init (void) |
| Initializes the external interrupt controller, but does not enable it.
|
|
void | eic_enable (void) |
| Enables the external interrupt controller.
|
|
bool | eic_configure_pin (const uint32_t pin, eic_interrupt_trigger trigger) |
| Configures an external interrupt on one of the external interrupt pins. More...
|
|
bool | eic_enable_interrupt (const uint8_t pin) |
| Enables an interrupt on the given interrupt channel. More...
|
|
bool | eic_disable_interrupt (const uint8_t pin) |
| Disables the interrupt on the given interrupt channel. More...
|
|
bool | eic_enable_event (const uint8_t pin) |
| Enables an interrupt on the given interrupt channel. More...
|
|
bool | eic_disable_event (const uint8_t pin) |
| Disables the interrupt on the given interrupt channel. More...
|
|
void | eic_configure_callback (eic_cb_t callback) |
| Configures an external interrupt callback. More...
|
|
void | eic_disable (void) |
| Disables the external interrupt controller.
|
|
External Interrupt Controller.
◆ eic_configure_callback()
void eic_configure_callback |
( |
eic_cb_t |
callback | ) |
|
Configures an external interrupt callback.
You only get the one callback, so if you need to handle multiple interrupts, you'll need to check the EIC->INTFLAG register in your callback to determine which interrupt fired.
- Parameters
-
callback | The function that will be called when the interrupt fires. |
- Note
- This function is called from the interrupt handler, so it should be as short as possible.
◆ eic_configure_pin()
Configures an external interrupt on one of the external interrupt pins.
This function configures the interrupt channel with the specified trigger, but it does not set pin direction, mux or pull; you must set up the pin yourself. This function also does not enable an interrupt or event generation. You must call eic_enable_interrupt() or eic_enable_event() to either wake the processor or generate an event for a peripheral.
- Parameters
-
pin | The external interrupt pin you wish to configure |
trigger | The condition on which you wish to trigger: rising, falling or both. |
- Note
- Be sure to check your pin multiplexing table to ensure that you do not have multiple pins assigned to the same interrupt channel.
◆ eic_disable_event()
bool eic_disable_event |
( |
const uint8_t |
pin | ) |
|
Disables the interrupt on the given interrupt channel.
- Parameters
-
pin | The external interrupt pin. |
◆ eic_disable_interrupt()
bool eic_disable_interrupt |
( |
const uint8_t |
pin | ) |
|
Disables the interrupt on the given interrupt channel.
- Parameters
-
pin | The external interrupt pin. |
◆ eic_enable_event()
bool eic_enable_event |
( |
const uint8_t |
pin | ) |
|
Enables an interrupt on the given interrupt channel.
- Parameters
-
pin | The external interrupt pin. |
◆ eic_enable_interrupt()
bool eic_enable_interrupt |
( |
const uint8_t |
pin | ) |
|
Enables an interrupt on the given interrupt channel.
- Parameters
-
pin | The external interrupt pin. |