展讯8810平台:mstar2133_jt_397_2key调试(input子系统)

转载于:http://blog.csdn.net/sunweizhong1024/article/details/8572121 点击打开链接


涉及两个主要函数:

一、input_report_abs,触摸屏显示区域向上报点函数。

正如前面所说,中断来时调用了mstar_ts_poscheck()函数,

1)该函数里包涵了sy_rxdata(&cinfo, &pinfo);读取芯片数据点的数据通过&cinfo传回mstar_ts_poscheck()函数处理。

由于lcd屏为320*480,而TP屏可能是N(此处应为2048),与LCD屏进行点的校正转换如下

cinfo->x1 = (cinfo->x1 * MS_TS_MSG21XX_X_MAX) / 2048;//接收点时处理

input_report_abs(tsdata->input, ABS_MT_POSITION_X,  ((point_slot[i].posy)*320/480));//报点再处理

其中左右反向可把报点时480-去掉,如下两句:

input_report_abs(tsdata->input, ABS_MT_POSITION_X,  ((480-point_slot[i].posy)*320/480));//左右反

input_report_abs(tsdata->input, ABS_MT_POSITION_X,  ((point_slot[i].posy)*320/480));//左右正向.

2)触摸显示区域完整报点如下:

首先得设置参数:

    input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
    input_set_abs_params(input, ABS_MT_POSITION_X, 0, MS_TS_MSG21XX_X_MAX, 0, 0);

    input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MS_TS_MSG21XX_Y_MAX, 0, 0);
    input_set_abs_params(input, ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0);

然后输入完整流程:

input_report_key(tsdata->input, BTN_TOUCH, 1);//置1按下

 input_report_abs(tsdata->input, ABS_MT_POSITION_X,  ((point_slot[i].posy)*320/480));

input_report_abs(tsdata->input, ABS_MT_POSITION_Y,  ((320-point_slot[i].posx)*480/320));

input_mt_sync(tsdata->input);//多组时使用此多组同步先再下面同步

input_sync(tsdata->input);//同步

注意:平时没数据时得提起,即

input_report_key(tsdata->input, BTN_TOUCH, 0);//置0提起,不然触屏无效.

 

触摸按键区域完整报点如下:

首先得注册按键

    __set_bit(KEY_MENU,  input->keybit);
    __set_bit(KEY_BACK,  input->keybit);
 然后输入完整流程:

 input_report_key(tsdata->input, KEY_MENU, 1);置1按下

 //input_report_abs()//不用报点

input_sync(tsdata->input);//同步

注意:同样平时没数据时得提起,即

 input_report_key(tsdata->input, KEY_MENU, 0);置0提起,不然触屏无效.

上层软件会自动根据KEY_MENU去读取该值


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值