Merge pull request #6735 from codeauroraforum/Add_GPIO_IRQ_Check

LPC546XX: Add check for GPIO IRQ
pull/6715/merge
Martin Kojtal 2018-04-25 13:16:01 +01:00 committed by GitHub
commit beb8da965c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,8 @@
#include "fsl_pint.h" #include "fsl_pint.h"
#include "mbed_error.h" #include "mbed_error.h"
#define INTERRUPT_PORTS 2
static uint32_t channel_ids[NUMBER_OF_GPIO_INTS] = {0}; static uint32_t channel_ids[NUMBER_OF_GPIO_INTS] = {0};
static gpio_irq_handler irq_handler; static gpio_irq_handler irq_handler;
/* Array of PORT IRQ number. */ /* 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->pin = pin & 0x1F;
obj->port = pin / 32; obj->port = pin / 32;
if (obj->port >= INTERRUPT_PORTS) {
return -1;
}
/* Connect trigger sources to PINT */ /* Connect trigger sources to PINT */
INPUTMUX_Init(INPUTMUX); INPUTMUX_Init(INPUTMUX);