t
Fork of mbed-dev by
Diff: targets/TARGET_WIZNET/TARGET_W7500x/gpio_irq_api.c
- Revision:
- 165:e614a9f1c9e2
- Parent:
- 149:156823d33999
diff -r 289d4deac6e4 -r e614a9f1c9e2 targets/TARGET_WIZNET/TARGET_W7500x/gpio_irq_api.c --- a/targets/TARGET_WIZNET/TARGET_W7500x/gpio_irq_api.c Wed May 10 12:06:41 2017 +0100 +++ b/targets/TARGET_WIZNET/TARGET_W7500x/gpio_irq_api.c Fri May 26 12:39:01 2017 +0100 @@ -43,6 +43,7 @@ static uint32_t channel_ids[4][16]; + #ifdef __cplusplus extern "C"{ #endif @@ -50,6 +51,7 @@ void PORT0_Handler(void) { + NVIC_ClearPendingIRQ(PORT0_IRQn); port_generic_handler(GPIOA, 0); } @@ -99,6 +101,8 @@ obj->pin_num = WIZ_PIN_NUM(pin); obj->pin_index = WIZ_PIN_INDEX(pin); + //gpio_irq_disable(obj); + if (pin == NC) return -1; if(obj->port_num == 0) @@ -110,10 +114,11 @@ else obj->irq_n = PORT3_IRQn; - //obj->event = EDGE_FALL; obj->pin = pin; - + obj->event = EDGE_NONE; + // Enable EXTI interrupt + NVIC_ClearPendingIRQ(obj->irq_n); NVIC_EnableIRQ(obj->irq_n); channel_ids[obj->port_num][obj->pin_num] = id; @@ -141,10 +146,13 @@ obj->rise_null = 0; } else if (event == IRQ_FALL) { - gpio->INTPOLSET &= ~obj->pin_index; + gpio->INTPOLCLR |= obj->pin_index; obj->event = EDGE_FALL; obj->fall_null = 0; } + + + gpio->INTENCLR |= obj->pin_index; gpio->INTTYPESET |= obj->pin_index; gpio->INTENSET |= obj->pin_index;