MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / touch_thread_entry

Function touch_thread_entry

bsp/loongson/ls1cdev/drivers/touch.c:407–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405void _set_mouse_position(rt_uint32_t X, rt_uint32_t Y)
406{}
407static void touch_thread_entry(void *parameter)
408{
409 rt_bool_t touch_down = RT_FALSE;
410 rt_uint32_t event_value;
411 struct rtgui_event_mouse emouse;
412 static struct _touch_previous
413 {
414 rt_uint32_t x;
415 rt_uint32_t y;
416 } touch_previous;
417
418 RTGUI_EVENT_MOUSE_BUTTON_INIT(&emouse);
419 emouse.wid = RT_NULL;
420
421 while(1)
422 {
423 /* 接收到触摸中断事件 */
424 if(rt_event_recv(&touch->event,
425 1,
426 RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
427 100,
428 &event_value)
429 == RT_EOK)
430 {
431 while(1)
432 {
433 if (IS_TOUCH_UP())
434 {
435 /* 触摸笔抬起 */
436 /* touch up */
437 emouse.button = (RTGUI_MOUSE_BUTTON_LEFT |RTGUI_MOUSE_BUTTON_UP);
438
439 /* use old value */
440 emouse.x = touch->x;
441 emouse.y = touch->y;
442
443 if(touch_down != RT_TRUE)
444 {
445 touch_int_cmd(RT_TRUE);
446 break;
447 }
448
449 if ((touch->calibrating == RT_TRUE) && (touch->calibration_func != RT_NULL))
450 {
451 /* 触摸校准处理 */
452 /* callback function */
453 touch->calibration_func(emouse.x, emouse.y);
454
455 }
456 else
457 {
458 /* 向ui发送触摸坐标 */
459 rtgui_server_post_event(&emouse.parent, sizeof(struct rtgui_event_mouse));
460 }
461 rt_kprintf("touch up: (%d, %d)\n", emouse.x, emouse.y);
462
463 /* clean */
464 touch_previous.x = touch_previous.y = 0;

Callers

nothing calls this directly

Calls 6

rt_event_recvFunction · 0.85
touch_int_cmdFunction · 0.85
rt_kprintfFunction · 0.85
rt_thread_delayFunction · 0.85
rtgui_touch_calculateFunction · 0.85
_set_mouse_positionFunction · 0.85

Tested by

no test coverage detected