mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
4c973e3aa0
commit
6513091173
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue