3.1.6. exti — External interrupts

Source code: src/drivers/basic/exti.h, src/drivers/basic/exti.c

Test code: tst/drivers/hardware/basic/exti/main.c


Defines

EXTI_TRIGGER_BOTH_EDGES
EXTI_TRIGGER_FALLING_EDGE

Trigger an interrupt on falling edges.

EXTI_TRIGGER_RISING_EDGE

Trigger an interrupt on rising edges.

Functions

int exti_module_init(void)

Initialize the external interrupt (EXTI) module. This function must be called before calling any other function in this module.

The module will only be initialized once even if this function is called multiple times.

Return
zero(0) or negative error code.

int exti_init(struct exti_driver_t *self_p, struct exti_device_t *dev_p, int trigger, void (*on_interrupt)(void *arg_p), void *arg_p, )

Initialize given driver object.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object to be initialized.
  • dev_p: Device to use.
  • trigger: One of EXTI_TRIGGER_BOTH_EDGES, EXTI_TRIGGER_FALLING_EDGE or EXTI_TRIGGER_RISING_EDGE.
  • on_interrupt: Function callback called when an interrupt occurs.
  • arg_p: Function callback argument.

int exti_start(struct exti_driver_t *self_p)

Starts the EXTI device using given driver object. Enables interrupts for given external interrupt driver.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object.

int exti_stop(struct exti_driver_t *self_p)

Stops the EXTI device referenced by given driver object. Disables interrupts for given external interrupt driver.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object.

int exti_clear(struct exti_driver_t *self_p)

Clear the interrupt flag.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object.

Variables

struct exti_device_t exti_device[EXTI_DEVICE_MAX]