Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13960d6

Browse files
committed
GIGA touch - convert callback to simple forward instead of processing in the fixups.c
Also add clear out the callback in the initVariant such that if new program is launched it does not use old address
1 parentc6ce0a2 commit13960d6

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

‎loader/fixups.c

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
#defineGIGA_TOUCH_SET_CB
52+
#ifdefGIGA_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)(structinput_event*evt,void*user_data)=0;
59+
60+
voidregisterGigaTouchCallback(void (*cb)(structinput_event*evt,void*user_data)) {
61+
_giga_touch_callback=cb;
62+
}
63+
64+
65+
voidtouch_event_callback(structinput_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
5175
typedefstruct {
52-
int32_tx;
53-
int32_ty;
54-
int32_tpressed;
76+
size_tx;
77+
size_ty;
78+
boolpressed;
5579
}touch_point_t;
5680

5781
touch_point_tlast_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+
87113
staticconststructdevice*consttouch_dev=DEVICE_DT_GET(DT_CHOSEN(zephyr_touch));
88114
INPUT_CALLBACK_DEFINE(touch_dev,touch_event_callback,NULL);
89115

90116

117+
91118
intcamera_ext_clock_enable(void)
92119
{
93120
intret;
94121
uint32_trate;
95122

123+
#ifndefGIGA_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
conststructdevice*cam_ext_clk_dev=DEVICE_DT_GET(DT_NODELABEL(pwmclock));
101129

‎loader/llext_exports.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ FORCE_EXPORT_SYM(video_buffer_alloc);
131131
FORCE_EXPORT_SYM(video_buffer_release);
132132
#endif
133133
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1)&& defined(CONFIG_VIDEO)
134-
FORCE_EXPORT_SYM(getVideoTouchEvent)
134+
//FORCE_EXPORT_SYM(getVideoTouchEvent);
135+
FORCE_EXPORT_SYM(registerGigaTouchCallback);
136+
135137
#endif
136138

137139
#if defined(CONFIG_SHARED_MULTI_HEAP)

‎variants/arduino_giga_r1_stm32h747xx_m7/variant.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ void _on_1200_bps() {
66
*(__IOuint32_t *)tmp = (uint32_t)0xDF59;
77
NVIC_SystemReset();
88
}
9+
10+
extern"C"voidregisterGigaTouchCallback(void (*cb)(structinput_event *evt,void *user_data));
11+
voidinitVariant(void) {
12+
// Make sure to set to NULL in case previous sketch or pvevious build of sketch
13+
// set a callback, whoes pointer may not be valid
14+
registerGigaTouchCallback(nullptr);
15+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp