MIMXRT1050_EVK: Move clock enable after check of pin

Enable clock could return an error if pin is NC

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
pull/7421/head
Mahesh Mahadevan 2018-07-04 14:17:22 -05:00
parent 9f27672f0f
commit c24d158fb4
2 changed files with 3 additions and 3 deletions

View File

@ -33,12 +33,12 @@ void gpio_init(gpio_t *obj, PinName pin)
{
clock_ip_name_t gpio_clocks[] = GPIO_CLOCKS;
CLOCK_EnableClock(gpio_clocks[pin >> GPIO_PORT_SHIFT]);
obj->pin = pin;
if (pin == (PinName)NC)
return;
CLOCK_EnableClock(gpio_clocks[pin >> GPIO_PORT_SHIFT]);
pin_function(pin, GPIO_MUX_PORT);
}

View File

@ -156,7 +156,7 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
break;
}
int_index = 2 * obj->port;;
int_index = 2 * obj->port;
if (obj->pin > 15) {
int_index -= 1;
}