android触摸屏ar1011驱动

前些天,工作需要,把ar1011的驱动从linux移来支持imx6q + android4.3.0。

ar1011是TI出的一块串口类型的触摸控制芯片,支持4,5,8线屏。接口是串口的,这个芯片有点贵,但支持温度广。原理上是通过串口上传x,y,pre值。


1.在kernel下,把driver配置编译进去。具体修改源码.linux 和android 有些不同。
  linux相对说来比较简单,在driver/input/touchsreen下加进去,源码都不用修改。但在/udev下增加自动配置脚本。在android里面,每次上送的值是转换后的值。
  这个转换算法是把实际的值,通过校正坐标的值来转换,得到转换后的坐标,再上传到应用层。


  //static int a[7] = {30258,-56,-17665136,26,20336,-17534240,65536};
static int a[7] =   {30336,210,-18065312,77,20355,-17794560,65536};
//static int a[7] =   {30159,970,-17729008,102,20210,-17375808,65536};


static int ts_linear_scale(int *x, int *y, int swap_xy)  
{  
    int xtemp, ytemp;   
     
    xtemp = *x; ytemp = *y;  
    if (a[6] == 0)  
        return -EINVAL;  
  
    *x = (a[2] + a[0] * xtemp + a[1] * ytemp) / a[6];  
    *y = (a[5] + a[3] * xtemp + a[4] * ytemp) / a[6];  
  
    if (swap_xy) {  
        int tmp = *x;  
        *x = *y;  
        *y = tmp;  
    }  
    return 0;  



2.在externl里,把inputactivty作为一个应用编译进去。这个编写Android.mk


3.在system/usr/idc里增加配置文件.这个配置文件命名必须和driver里注册名是一样的。MicrochiptouchScreen.idc
# Basic Parameters
touch.deviceType = touchScreen
touch.orientationAware = 1
# Size 
touch.size.calibration = diameter
touch.size.scale = 10
touch.size.bias = 0
touch.size.isSummed = 0


# Pressure 
# Driver reports signal strength as pressure.
# A normal thumb touch typically registers about 200 signal strength
# units although we don't expect these values to be accurate.


touch.pressure.calibration = amplitude
touch.pressure.scale = 0.005


# Orientation
touch.orientation.calibration = none




4.在启动脚本里,增加启动配置脚本
  service touchscreen /system/bin/inputactivate -ar1xxx /dev/ttySAC3
    class late_start
    oneshot
 
校验值要么在linux得到,要到移植tslib到android系统下进,对屏进行校正后得到的。还在在转换时,要注意屏的解析度大小。   

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

九世坛主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值