提交 27f90145 编写于 作者: D dzzxzz@gmail.com

initialize the variable "emouse"

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2243 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 f7aadffc
/* /*
* File : touch.c * File : touch.c
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2010, RT-Thread Develop Team * COPYRIGHT (C) 2010 - 2012, RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
...@@ -113,6 +113,9 @@ static void report_touch_input(int updown) ...@@ -113,6 +113,9 @@ static void report_touch_input(int updown)
{ {
struct rtgui_event_mouse emouse; struct rtgui_event_mouse emouse;
RTGUI_EVENT_MOUSE_BUTTON_INIT(&emouse);
emouse.wid = RT_NULL;
/* set emouse button */ /* set emouse button */
emouse.button = RTGUI_MOUSE_BUTTON_LEFT; emouse.button = RTGUI_MOUSE_BUTTON_LEFT;
emouse.parent.sender = RT_NULL; emouse.parent.sender = RT_NULL;
...@@ -150,7 +153,7 @@ static void report_touch_input(int updown) ...@@ -150,7 +153,7 @@ static void report_touch_input(int updown)
emouse.x = touch->x; emouse.x = touch->x;
emouse.y = touch->y; emouse.y = touch->y;
if(touch->first_down_report == RT_TRUE) if (touch->first_down_report == RT_TRUE)
{ {
emouse.parent.type = RTGUI_EVENT_MOUSE_BUTTON; emouse.parent.type = RTGUI_EVENT_MOUSE_BUTTON;
emouse.button |= RTGUI_MOUSE_BUTTON_DOWN; emouse.button |= RTGUI_MOUSE_BUTTON_DOWN;
...@@ -223,7 +226,7 @@ static void report_touch_input(int updown) ...@@ -223,7 +226,7 @@ static void report_touch_input(int updown)
touch_event.y = touch->y; touch_event.y = touch->y;
touch_event.pressed = 1; touch_event.pressed = 1;
if(touch->first_down_report == RT_TRUE) if (touch->first_down_report == RT_TRUE)
{ {
if (touch->calibrating != RT_TRUE && touch->eventpost_func) if (touch->calibrating != RT_TRUE && touch->eventpost_func)
{ {
...@@ -251,7 +254,7 @@ static void report_touch_input(int updown) ...@@ -251,7 +254,7 @@ static void report_touch_input(int updown)
} }
#endif #endif
static void touch_timer_fire(void* parameter) static void touch_timer_fire(void *parameter)
{ {
rt_uint32_t data0; rt_uint32_t data0;
rt_uint32_t data1; rt_uint32_t data1;
...@@ -288,7 +291,7 @@ static void s3c2410_adc_stylus_action(void) ...@@ -288,7 +291,7 @@ static void s3c2410_adc_stylus_action(void)
ts.xp += data0 & S3C2410_ADCDAT0_XPDATA_MASK; ts.xp += data0 & S3C2410_ADCDAT0_XPDATA_MASK;
ts.yp += data1 & S3C2410_ADCDAT1_YPDATA_MASK; ts.yp += data1 & S3C2410_ADCDAT1_YPDATA_MASK;
ts.count++; ts.count ++;
if (ts.count < (1<<ts.shift)) if (ts.count < (1<<ts.shift))
{ {
...@@ -365,7 +368,7 @@ static void rt_touch_handler(int irqno) ...@@ -365,7 +368,7 @@ static void rt_touch_handler(int irqno)
} }
/* RT-Thread Device Interface */ /* RT-Thread Device Interface */
static rt_err_t rtgui_touch_init (rt_device_t dev) static rt_err_t rtgui_touch_init(rt_device_t dev)
{ {
/* init touch screen structure */ /* init touch screen structure */
rt_memset(&ts, 0, sizeof(struct s3c2410ts)); rt_memset(&ts, 0, sizeof(struct s3c2410ts));
...@@ -399,7 +402,7 @@ static rt_err_t rtgui_touch_init (rt_device_t dev) ...@@ -399,7 +402,7 @@ static rt_err_t rtgui_touch_init (rt_device_t dev)
return RT_EOK; return RT_EOK;
} }
static rt_err_t rtgui_touch_control (rt_device_t dev, rt_uint8_t cmd, void *args) static rt_err_t rtgui_touch_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{ {
switch (cmd) switch (cmd)
{ {
...@@ -414,9 +417,9 @@ static rt_err_t rtgui_touch_control (rt_device_t dev, rt_uint8_t cmd, void *args ...@@ -414,9 +417,9 @@ static rt_err_t rtgui_touch_control (rt_device_t dev, rt_uint8_t cmd, void *args
case RT_TOUCH_CALIBRATION_DATA: case RT_TOUCH_CALIBRATION_DATA:
{ {
struct calibration_data* data; struct calibration_data *data;
data = (struct calibration_data*) args; data = (struct calibration_data *)args;
/* update */ /* update */
touch->min_x = data->min_x; touch->min_x = data->min_x;
...@@ -449,8 +452,9 @@ void rtgui_touch_hw_init(void) ...@@ -449,8 +452,9 @@ void rtgui_touch_hw_init(void)
rt_device_t device = RT_NULL; rt_device_t device = RT_NULL;
struct rt_device_graphic_info info; struct rt_device_graphic_info info;
touch = (struct rtgui_touch_device*)rt_malloc (sizeof(struct rtgui_touch_device)); touch = (struct rtgui_touch_device *)rt_malloc(sizeof(struct rtgui_touch_device));
if (touch == RT_NULL) return; /* no memory yet */ if (touch == RT_NULL)
return; /* no memory yet */
/* clear device structure */ /* clear device structure */
rt_memset(&(touch->parent), 0, sizeof(struct rt_device)); rt_memset(&(touch->parent), 0, sizeof(struct rt_device));
...@@ -469,13 +473,16 @@ void rtgui_touch_hw_init(void) ...@@ -469,13 +473,16 @@ void rtgui_touch_hw_init(void)
touch->parent.user_data = RT_NULL; touch->parent.user_data = RT_NULL;
device = rt_device_find("lcd"); device = rt_device_find("lcd");
if (device == RT_NULL) return; /* no this device */ if (device == RT_NULL)
return; /* no this device */
/* get graphic device info */ /* get graphic device info */
result = rt_device_control(device, RTGRAPHIC_CTRL_GET_INFO, &info); result = rt_device_control(device, RTGRAPHIC_CTRL_GET_INFO, &info);
if (result != RT_EOK) if (result != RT_EOK)
{ {
/* get device information failed */ /* get device information failed */
return; return;
} }
...@@ -489,4 +496,3 @@ void rtgui_touch_hw_init(void) ...@@ -489,4 +496,3 @@ void rtgui_touch_hw_init(void)
/* register touch device to RT-Thread */ /* register touch device to RT-Thread */
rt_device_register(&(touch->parent), "touch", RT_DEVICE_FLAG_RDWR); rt_device_register(&(touch->parent), "touch", RT_DEVICE_FLAG_RDWR);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册