@@ -48,10 +48,34 @@ SYS_INIT(disable_mpu_rasr_xn, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT)
4848#include <zephyr/input/input.h>
4949
5050// experiment to try to capture touch screen events
51+ #define GIGA_TOUCH_SET_CB
52+ #ifdef GIGA_TOUCH_SET_CB
53+ // This version we just register a callback function with the zephyr
54+ // object, which then allows are Arduino Code to register a call back
55+ // to be called...
56+
57+
58+ void (* _giga_touch_callback )(struct input_event * evt , void * user_data ) = 0 ;
59+
60+ void registerGigaTouchCallback (void (* cb )(struct input_event * evt , void * user_data )) {
61+ _giga_touch_callback = cb ;
62+ }
63+
64+
65+ void touch_event_callback (struct input_event * evt , void * user_data )
66+ {
67+ //printk("touch_event_callback(%p %p): %p %u %u %u %d\n", evt, user_data,
68+ // evt->dev, evt->sync, evt->type, evt->code, evt->value);
69+ if (_giga_touch_callback ) {
70+ (* _giga_touch_callback )(evt , user_data );
71+
72+ }
73+ }
74+ #else
5175typedef struct {
52- int32_t x ;
53- int32_t y ;
54- int32_t pressed ;
76+ size_t x ;
77+ size_t y ;
78+ bool pressed ;
5579} touch_point_t ;
5680
5781touch_point_t last_touch_point ;
@@ -84,18 +108,22 @@ void touch_event_callback(struct input_event *evt, void *user_data)
84108 k_sem_give (& touch_event_sync );
85109 }
86110}
111+ #endif
112+
87113static const struct device * const touch_dev = DEVICE_DT_GET (DT_CHOSEN (zephyr_touch ));
88114INPUT_CALLBACK_DEFINE (touch_dev , touch_event_callback , NULL );
89115
90116
117+
91118int camera_ext_clock_enable (void )
92119{
93120 int ret ;
94121 uint32_t rate ;
95122
123+ #ifndef GIGA_TOUCH_SET_CB
96124 // Hack in init semaphore for touch events
97125 k_sem_init (& touch_event_sync , 0 , 1 );
98-
126+ #endif
99127
100128 const struct device * cam_ext_clk_dev = DEVICE_DT_GET (DT_NODELABEL (pwmclock ));
101129
0 commit comments