Skip to content

Commit 8448640

Browse files
author
Filip Jagodzinski
committed
PSOC6_FUTURE: Fix circular dependency for GPIO-IRQ
The use of `gpio_irq_event` & `gpio_irq_handler` in `gpio_irq_s` creates a circular dependency. hal/gpio_irq_api.h needs targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/TARGET_CY8C63XX/device.h, that needs targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/objects.h, that again needs hal/gpio_irq_api.h, before the types are defined. Remove `#include "gpio_irq_api.h"` directive from objects.h and change the types of `gpio_irq_s` members.
1 parent 5ee22d0 commit 8448640

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/gpio_irq_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void gpio_irq_dispatcher(uint32_t port_id)
4949
MBED_ASSERT(obj);
5050
Cy_GPIO_ClearInterrupt(port, pin);
5151
event = (obj->mode == IRQ_FALL)? IRQ_FALL : IRQ_RISE;
52-
obj->handler(obj->id_arg, event);
52+
((gpio_irq_handler) obj->handler)(obj->id_arg, event);
5353
}
5454
}
5555
}
@@ -202,7 +202,7 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
202202
MBED_ASSERT("Invalid pin ID!");
203203
return (-1);
204204
}
205-
obj->handler = handler;
205+
obj->handler = (uint32_t) handler;
206206
obj->id_arg = id;
207207
return gpio_irq_setup_channel(obj);
208208
} else {

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/objects.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "PinNames.h"
2424
#include "PortNames.h"
2525

26-
#include "gpio_irq_api.h"
2726
#include "gpio_object.h"
2827
#include "cy_sysclk.h"
2928
#include "cy_syspm.h"
@@ -37,8 +36,8 @@ struct gpio_irq_s {
3736
GPIO_PRT_Type* port;
3837
uint32_t port_id;
3938
uint32_t pin;
40-
gpio_irq_event mode;
41-
gpio_irq_handler handler;
39+
uint32_t mode;
40+
uint32_t handler;
4241
uint32_t id_arg;
4342
#if defined (TARGET_MCU_PSOC6_M0)
4443
cy_en_intr_t cm0p_irq_src;

0 commit comments

Comments
 (0)