提交 3f33f036 编写于 作者: qiuyiuestc's avatar qiuyiuestc

[mini2440]fix bugs in touch driver

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@709 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 ca81f820
......@@ -177,7 +177,7 @@ void rt_hw_lcd_update(rtgui_rect_t *rect)
pitch = 2 * (rect->x2 - rect->x1);
rt_kprintf("update (%d,%d - %d,%d)\n", rect->x1, rect->y1, rect->x2, rect->y2);
/* rt_kprintf("update (%d,%d - %d,%d)\n", rect->x1, rect->y1, rect->x2, rect->y2); */
/* copy from framebuffer to physical framebuffer */
src_ptr = &_rt_framebuffer[rect->x1][rect->y1];
......
......@@ -3,6 +3,7 @@
#include <s3c24x0.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/event.h>
#include "touch.h"
......@@ -82,13 +83,12 @@ struct rtgui_touch_device
static struct rtgui_touch_device *touch = RT_NULL;
static int first_down_report;
#include <rtgui/event.h>
static void report_touch_input(int updown)
{
struct rtgui_event_mouse emouse;
/* set emouse button */
emouse.button |= RTGUI_MOUSE_BUTTON_LEFT;
emouse.button = RTGUI_MOUSE_BUTTON_LEFT;
emouse.parent.sender = RT_NULL;
if (updown)
......@@ -96,15 +96,19 @@ static void report_touch_input(int updown)
ts.xp = ts.xp / ts.count;
ts.yp = ts.yp / ts.count;;
ts.xp = 240 * (ts.xp-touch->min_x)/(touch->max_x-touch->min_x);
ts.yp = 320 - (320*(ts.yp-touch->min_y)/(touch->max_y-touch->min_y));
if ((touch->calibrating == RT_TRUE) && (touch->calibration_func != RT_NULL))
{
touch->x = ts.xp;
touch->y = ts.yp;
}
else
{
touch->x = 240 * (ts.xp-touch->min_x)/(touch->max_x-touch->min_x);
touch->y = 320 - (320*(ts.yp-touch->min_y)/(touch->max_y-touch->min_y));
}
emouse.x = touch->x;
emouse.y = touch->y;
if(first_down_report == 1)
{
emouse.parent.type = RTGUI_EVENT_MOUSE_BUTTON;
......@@ -311,8 +315,13 @@ static rt_err_t rtgui_touch_control (rt_device_t dev, rt_uint8_t cmd, void *args
//update
touch->min_x = data->min_x;
touch->max_x = data->max_x;
touch->min_y = data->min_y;
touch->max_y = data->max_y;
touch->min_y = data->max_y;
touch->max_y = data->min_y;
/*
rt_kprintf("min_x = %d, max_x = %d, min_y = %d, max_y = %d\n",
touch->min_x, touch->max_x, touch->min_y, touch->max_y);
*/
}
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册