Skip to content

Commit c162148

Browse files
committed
GiGA Touch - define a callback function forwarder.
Register a callback function to be called by the zephyr input system. 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. Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
1 parent 8a1206c commit c162148

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

loader/fixups.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,27 @@ 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+
typedef void (*zephyr_input_callback_t)(struct input_event *evt, void *user_data);
58+
59+
static zephyr_input_callback_t zephyr_input_cb = NULL;
60+
61+
void zephyr_input_register_callback(zephyr_input_callback_t cb) {
62+
zephyr_input_cb = cb;
63+
}
64+
65+
static void zephyr_input_callback(struct input_event *evt, void *user_data) {
66+
if (zephyr_input_cb) {
67+
zephyr_input_cb(evt, user_data);
68+
}
69+
}
70+
71+
INPUT_CALLBACK_DEFINE(NULL, zephyr_input_callback, NULL);
72+
#endif
73+
5374
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO)
5475
#include <zephyr/kernel.h>
5576
#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)