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