Lines Matching refs:touch
132 static struct rtgui_touch_device *touch = RT_NULL; variable
215 if (touch != RT_NULL) in rtgui_touch_calculate()
227 touch_send_then_recv(touch->spi_device, send_buffer, 1, recv_buffer, 2); in rtgui_touch_calculate()
238 touch_send_then_recv(touch->spi_device, send_buffer, 1, recv_buffer, 2); in rtgui_touch_calculate()
251 touch_send_then_recv(touch->spi_device, send_buffer, 1, recv_buffer, 2); in rtgui_touch_calculate()
252 touch_send_then_recv(touch->spi_device, send_buffer, 1, recv_buffer, 2); in rtgui_touch_calculate()
281 touch->x=total_x>>2; in rtgui_touch_calculate()
282 touch->y=total_y>>2; in rtgui_touch_calculate()
283 rt_kprintf("touch->x:%d touch->y:%d\r\n", touch->x, touch->y); in rtgui_touch_calculate()
289 if (touch->calibrating != RT_TRUE) in rtgui_touch_calculate()
291 if (touch->max_x > touch->min_x) in rtgui_touch_calculate()
293 touch->x = (touch->x - touch->min_x) * X_WIDTH/(touch->max_x - touch->min_x); in rtgui_touch_calculate()
297 touch->x = (touch->min_x - touch->x) * X_WIDTH/(touch->min_x - touch->max_x); in rtgui_touch_calculate()
300 if (touch->max_y > touch->min_y) in rtgui_touch_calculate()
302 touch->y = (touch->y - touch->min_y) * Y_WIDTH /(touch->max_y - touch->min_y); in rtgui_touch_calculate()
306 touch->y = (touch->min_y - touch->y) * Y_WIDTH /(touch->min_y - touch->max_y); in rtgui_touch_calculate()
338 rt_event_send(&touch->event, 1); in ls1c_touch_irqhandler()
370 touch_send_then_recv(touch->spi_device, &send, 1, recv_buffer, 2); in rtgui_touch_init()
380 touch->calibrating = RT_TRUE; in rtgui_touch_control()
381 touch->calibration_func = (rt_touch_calibration_func_t)args; in rtgui_touch_control()
385 touch->calibrating = RT_FALSE; in rtgui_touch_control()
394 touch->min_x = data->min_x; in rtgui_touch_control()
395 touch->max_x = data->max_x; in rtgui_touch_control()
396 touch->min_y = data->min_y; in rtgui_touch_control()
397 touch->max_y = data->max_y; in rtgui_touch_control()
424 if(rt_event_recv(&touch->event, in touch_thread_entry()
440 emouse.x = touch->x; in touch_thread_entry()
441 emouse.y = touch->y; in touch_thread_entry()
449 if ((touch->calibrating == RT_TRUE) && (touch->calibration_func != RT_NULL)) in touch_thread_entry()
453 touch->calibration_func(emouse.x, emouse.y); in touch_thread_entry()
490 emouse.x = touch->x; in touch_thread_entry()
491 emouse.y = touch->y; in touch_thread_entry()
498 if (touch->calibrating != RT_TRUE) in touch_thread_entry()
502 if((touch_previous.x > touch->x + previous_keep) in touch_thread_entry()
503 || (touch_previous.x < touch->x - previous_keep) in touch_thread_entry()
504 || (touch_previous.y > touch->y + previous_keep) in touch_thread_entry()
505 || (touch_previous.y < touch->y - previous_keep)) in touch_thread_entry()
507 touch_previous.x = touch->x; in touch_thread_entry()
508 touch_previous.y = touch->y; in touch_thread_entry()
563 touch = (struct rtgui_touch_device*)rt_malloc (sizeof(struct rtgui_touch_device)); in rtgui_touch_hw_init()
564 if (touch == RT_NULL) return -RT_ENOMEM; /* no memory yet */ in rtgui_touch_hw_init()
567 rt_memset(&(touch->parent), 0, sizeof(struct rt_device)); in rtgui_touch_hw_init()
569 rt_event_init(&touch->event, "touch", RT_IPC_FLAG_FIFO); in rtgui_touch_hw_init()
571 touch->spi_device = (struct rt_spi_device *)spi_device; in rtgui_touch_hw_init()
572 touch->calibrating = false; in rtgui_touch_hw_init()
574 touch->min_x = MIN_X_DEFAULT; in rtgui_touch_hw_init()
575 touch->max_x = MAX_X_DEFAULT; in rtgui_touch_hw_init()
576 touch->min_y = MIN_Y_DEFAULT; in rtgui_touch_hw_init()
577 touch->max_y = MAX_Y_DEFAULT; in rtgui_touch_hw_init()
580 touch->parent.type = RT_Device_Class_Miscellaneous; in rtgui_touch_hw_init()
581 touch->parent.init = rtgui_touch_init; in rtgui_touch_hw_init()
582 touch->parent.control = rtgui_touch_control; in rtgui_touch_hw_init()
583 touch->parent.user_data = RT_NULL; in rtgui_touch_hw_init()
586 rt_device_register(&(touch->parent), "touch", RT_DEVICE_FLAG_RDWR); in rtgui_touch_hw_init()
594 rt_device_init((rt_device_t)touch); in rtgui_touch_hw_init()