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

Commitc6ce0a2

Browse files
committed
Beginning touch support
Add a callback function for the touch devicewithin the fixups for the GIGA. This callbacksimply remembers the last touch that happened andsets a semaphore.There is also a function added to retrieve this data.Needed to add the callback function into the exports file.
1 parent42e58a8 commitc6ce0a2

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

‎loader/fixups.c

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,58 @@ SYS_INIT(disable_mpu_rasr_xn, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT)
4545
#include<zephyr/drivers/clock_control.h>
4646
#include<zephyr/logging/log.h>
4747

48+
#include<zephyr/input/input.h>
49+
50+
// experiment to try to capture touch screen events
51+
typedefstruct {
52+
int32_tx;
53+
int32_ty;
54+
int32_tpressed;
55+
}touch_point_t;
56+
57+
touch_point_tlast_touch_point;
58+
59+
staticstructk_semtouch_event_sync;
60+
61+
boolgetVideoTouchEvent(touch_point_t*tp,k_timeout_ttimeout) {
62+
if (k_sem_take(&touch_event_sync,timeout)!=0)return false;
63+
// BUGBUG: should probably put stuff in to return only
64+
// data from whole event, but first see if anything works
65+
memcpy(tp,&last_touch_point,sizeof(touch_point_t));
66+
return true;
67+
}
68+
69+
70+
voidtouch_event_callback(structinput_event*evt,void*user_data)
71+
{
72+
//printk("touch_event_callback(%p %p): %p %u %u %u %d\n", evt, user_data,
73+
// evt->dev, evt->sync, evt->type, evt->code, evt->value);
74+
if (evt->code==INPUT_ABS_X) {
75+
last_touch_point.x=evt->value;
76+
}
77+
if (evt->code==INPUT_ABS_Y) {
78+
last_touch_point.y=evt->value;
79+
}
80+
if (evt->code==INPUT_BTN_TOUCH) {
81+
last_touch_point.pressed=evt->value;
82+
}
83+
if (evt->sync) {
84+
k_sem_give(&touch_event_sync);
85+
}
86+
}
87+
staticconststructdevice*consttouch_dev=DEVICE_DT_GET(DT_CHOSEN(zephyr_touch));
88+
INPUT_CALLBACK_DEFINE(touch_dev,touch_event_callback,NULL);
89+
90+
4891
intcamera_ext_clock_enable(void)
4992
{
5093
intret;
5194
uint32_trate;
95+
96+
// Hack in init semaphore for touch events
97+
k_sem_init(&touch_event_sync,0,1);
98+
99+
52100
conststructdevice*cam_ext_clk_dev=DEVICE_DT_GET(DT_NODELABEL(pwmclock));
53101

54102
if (!device_is_ready(cam_ext_clk_dev)) {
@@ -99,7 +147,7 @@ int smh_init(void) {
99147
return0;
100148
}
101149

102-
SYS_INIT(smh_init,POST_KERNEL,CONFIG_CLOCK_CONTROL_PWM_INIT_PRIORITY);
150+
SYS_INIT(smh_init,POST_KERNEL,CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
103151
#endif
104152

105153
#if defined(CONFIG_BOARD_ARDUINO_PORTENTA_C33)&& defined(CONFIG_LLEXT)

‎loader/llext_exports.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ FORCE_EXPORT_SYM(video_buffer_aligned_alloc);
130130
FORCE_EXPORT_SYM(video_buffer_alloc);
131131
FORCE_EXPORT_SYM(video_buffer_release);
132132
#endif
133+
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1)&& defined(CONFIG_VIDEO)
134+
FORCE_EXPORT_SYM(getVideoTouchEvent)
135+
#endif
133136

134137
#if defined(CONFIG_SHARED_MULTI_HEAP)
135138
FORCE_EXPORT_SYM(shared_multi_heap_aligned_alloc);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp