@@ -48,10 +48,34 @@ SYS_INIT(disable_mpu_rasr_xn, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT)
48
48
#include <zephyr/input/input.h>
49
49
50
50
// 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
51
75
typedef struct {
52
- int32_t x ;
53
- int32_t y ;
54
- int32_t pressed ;
76
+ size_t x ;
77
+ size_t y ;
78
+ bool pressed ;
55
79
} touch_point_t ;
56
80
57
81
touch_point_t last_touch_point ;
@@ -84,18 +108,22 @@ void touch_event_callback(struct input_event *evt, void *user_data)
84
108
k_sem_give (& touch_event_sync );
85
109
}
86
110
}
111
+ #endif
112
+
87
113
static const struct device * const touch_dev = DEVICE_DT_GET (DT_CHOSEN (zephyr_touch ));
88
114
INPUT_CALLBACK_DEFINE (touch_dev , touch_event_callback , NULL );
89
115
90
116
117
+
91
118
int camera_ext_clock_enable (void )
92
119
{
93
120
int ret ;
94
121
uint32_t rate ;
95
122
123
+ #ifndef GIGA_TOUCH_SET_CB
96
124
// Hack in init semaphore for touch events
97
125
k_sem_init (& touch_event_sync , 0 , 1 );
98
-
126
+ #endif
99
127
100
128
const struct device * cam_ext_clk_dev = DEVICE_DT_GET (DT_NODELABEL (pwmclock ));
101
129
0 commit comments