LPC546XX: Add check for GPIO IRQ

GPIO IRQ is available on pins for Ports 0 & 1. Add
a check to return error for other ports.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
pull/6735/head
Mahesh Mahadevan 2018-04-24 14:26:20 -05:00
parent 4c973e3aa0
commit 6513091173
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,8 @@
#include "fsl_pint.h"
#include "mbed_error.h"
#define INTERRUPT_PORTS 2
static uint32_t channel_ids[NUMBER_OF_GPIO_INTS] = {0};
static gpio_irq_handler irq_handler;
/* Array of PORT IRQ number. */
@ -83,6 +85,10 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
obj->pin = pin & 0x1F;
obj->port = pin / 32;
if (obj->port >= INTERRUPT_PORTS) {
return -1;
}
/* Connect trigger sources to PINT */
INPUTMUX_Init(INPUTMUX);