Skip to content

Commit 35b64e8

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 <kurte@rockisland.com>
1 parent 8a1206c commit 35b64e8

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

loader/fixups.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@ int enable_bkp_access(void)
5050
SYS_INIT(enable_bkp_access, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
5151
#endif
5252

53+
#if defined(CONFIG_INPUT)
54+
#include <zephyr/kernel.h>
55+
#include <zephyr/device.h>
56+
#include <zephyr/input/input.h>
57+
58+
typedef void (*zephyr_input_callback_t)(struct input_event *evt, void *user_data);
59+
60+
static zephyr_input_callback_t zephyr_input_cb = NULL;
61+
62+
void zephyr_input_register_callback(zephyr_input_callback_t cb) {
63+
zephyr_input_cb = cb;
64+
}
65+
66+
static void zephyr_input_callback(struct input_event *evt, void *user_data) {
67+
if (zephyr_input_cb) {
68+
zephyr_input_cb(evt, user_data);
69+
}
70+
}
71+
72+
INPUT_CALLBACK_DEFINE(NULL, zephyr_input_callback, NULL);
73+
#endif
74+
5375
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO)
5476
#include <zephyr/kernel.h>
5577
#include <zephyr/device.h>

loader/llext_exports.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ FORCE_EXPORT_SYM(video_buffer_alloc);
141141
FORCE_EXPORT_SYM(video_buffer_release);
142142
FORCE_EXPORT_SYM(video_set_ctrl);
143143
#endif
144+
#if defined(CONFIG_INPUT)
145+
FORCE_EXPORT_SYM(zephyr_input_register_callback);
146+
#endif
144147

145148
#if defined(CONFIG_SHARED_MULTI_HEAP)
146149
FORCE_EXPORT_SYM(shared_multi_heap_aligned_alloc);
@@ -246,4 +249,4 @@ FORCE_EXPORT_SYM(__aeabi_dcmpge);
246249

247250
#if defined (CONFIG_CPP)
248251
FORCE_EXPORT_SYM(__cxa_pure_virtual);
249-
#endif
252+
#endif

0 commit comments

Comments
 (0)