微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 求模拟一个TP滑动事件的办法

求模拟一个TP滑动事件的办法

时间:10-02 整理:3721RD 点击:
要做手势功能,需要在手势的驱动里实现一个模拟的TP消息,让手机实现接电话的功能,比如从 270,777 坐标滑动到 450,777
我在TP的驱动里做了个函数,来实现滑动,但是没什么效果,求实现方法
void tpd_move_right_by_alsps()
{
        struct touch_info cinfo, pinfo;
        int jj;
        
        for ( jj = 0; jj < 37; jj++)
        {
                if (jj < 36)
                        point_num = 1;
                else
                        point_num = 2;
               
                tpd_eint_interrupt_handler();
                        
                  mt65xx_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM);
                        printk("FT5206 touch_event_handler step1\r\n");
                        // set_current_state(TASK_INTERRUPTIBLE);
                        //  wait_event_interruptible(waiter,tpd_flag!=0);
                        printk("FT5206 touch_event_handler step2\r\n");                                 
                                 tpd_flag = 0;
                                 
                         // set_current_state(TASK_RUNNING);
                        
                        printk("FT5206 touch_event_handler step3\r\n");        
                        
                          if (tpd_touchinfo(&cinfo, &pinfo)) {
                          TPD_DEBUG("point_num = %d\n",point_num);
                        printk("FT5206 touch_event_handler step4\r\n");        
                          cinfo.y[0] = 777;
                          cinfo.x[0] = 270 + jj * 5;
                          
                    if(point_num >0) {
                        tpd_down(cinfo.x[0], cinfo.y[0], 1);
                     if(point_num>1)
                             {
                                         tpd_down(cinfo.x[1], cinfo.y[1], 1);
                                   if(point_num >2) tpd_down(cinfo.x[2], cinfo.y[2], 1);
                             }
                        input_sync(tpd->dev);
                                        TPD_DEBUG("press --->\n");
                                       
                    } else  {
                        tpd_up(cinfo.x[0], cinfo.y[0], 0);
                    TPD_DEBUG("release --->\n");
                        input_mt_sync(tpd->dev);
                        input_sync(tpd->dev);
                    }
                }
         }
}

这个功能我认为在上层处理会比低层好处理一些。

没必要这么做,上层监听到相应的手势(向左或向右),然后做相应的动作就行了。你改底层的,这样你在每个界面都有动作,不好控制

必须要在底层实现。呵呵

为什么?

因为很多上层的界面,都是第三方的,没有源代码。

在来电时,并且TP产生中断后,马上启一个定时器,
去读TP现在的报的座标。
只要在规定的时间内,座标变化在你规定的座标内,你就可以认为这个事件是你需要的事件,然后上报上去就行了。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top