Skip to content

Commit c20d473

Browse files
committed
GiGA Touch - define a callback function forwarder.
Register a callback function to be called by the zephyr input system. This new code is only there if it is a GIGA and CONFIG_INPUT_GT911_INTERRUPT is defined. This includes adding a callback function that is linked in to the zephyr build, and export a function to call to allow us to register our own. Added an init variant to GIGA that if the touch interrupt is enabled, then it will clear out the old user defined callback if any. Signed-off-by: Kurt Eckhardt <[email protected]> cr
1 parent db649d0 commit c20d473

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

loader/fixups.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,30 @@ SYS_INIT(disable_bootloader_mpu, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAU
3939
SYS_INIT(disable_mpu_rasr_xn, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
4040
#endif
4141

42-
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO)
42+
#if defined(CONFIG_INPUT)
43+
#include <zephyr/kernel.h>
44+
#include <zephyr/device.h>
45+
#include <zephyr/input/input.h>
46+
47+
typedef void (*zephyr_input_callback_t)(struct input_event *evt, void *user_data);
48+
49+
static zephyr_input_callback_t zephyr_input_cb = NULL;
50+
51+
void zephyr_input_register_callback(zephyr_input_callback_t cb) {
52+
zephyr_input_cb = cb;
53+
}
54+
55+
static void zephyr_input_callback(struct input_event *evt, void *user_data) {
56+
if (zephyr_input_cb) {
57+
zephyr_input_cb(evt, user_data);
58+
}
59+
}
60+
61+
INPUT_CALLBACK_DEFINE(NULL, zephyr_input_callback, NULL);
62+
#endif
63+
64+
#if (defined(CONFIG_BOARD_ARDUINO_GIGA_R1) || defined(CONFIG_BOARD_ARDUINO_PORTENTA_H7)) \
65+
&& defined(CONFIG_VIDEO)
4366
#include <zephyr/kernel.h>
4467
#include <zephyr/device.h>
4568
#include <zephyr/drivers/clock_control.h>

loader/llext_exports.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ FORCE_EXPORT_SYM(video_buffer_alloc);
134134
FORCE_EXPORT_SYM(video_buffer_release);
135135
FORCE_EXPORT_SYM(video_set_ctrl);
136136
#endif
137+
#if defined(CONFIG_INPUT)
138+
FORCE_EXPORT_SYM(zephyr_input_register_callback);
139+
#endif
137140

138141
#if defined(CONFIG_SHARED_MULTI_HEAP)
139142
FORCE_EXPORT_SYM(shared_multi_heap_aligned_alloc);
@@ -239,4 +242,4 @@ FORCE_EXPORT_SYM(__aeabi_dcmpge);
239242

240243
#if defined (CONFIG_CPP)
241244
FORCE_EXPORT_SYM(__cxa_pure_virtual);
242-
#endif
245+
#endif

0 commit comments

Comments
 (0)