CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 9395|回复: 5

A20的linux debian 我已经有4线的接口了,怎么配置4线的电阻屏(不用USB)

[复制链接]
发表于 2015-2-5 14:20:20 | 显示全部楼层 |阅读模式
我发现安卓有电阻屏配置,linux没有,该怎么办
回复

使用道具 举报

发表于 2015-2-6 17:15:38 | 显示全部楼层
linux也可以把电阻屏配置进去。
A20:

[rtp_para]
rtp_used = 1
rtp_screen_size = 7
rtp_regidity_level = 7
rtp_press_threshold_enable = 0
rtp_press_threshold = 0x1f40
rtp_sensitive_level = 0xf
rtp_exchange_x_y_flag = 0


A10:

[rtp_para]
rtp_used      =1
rtp_screen_size =5
rtp_regidity_level = 5
rtp_press_threshold_enable = 0
rtp_press_threshold = 0x1f40
rtp_sensitive_level = 0xf
rtp_exchange_x_y_flag = 0
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-7 13:30:42 | 显示全部楼层
sunbeyond 发表于 2015-2-6 17:15
linux也可以把电阻屏配置进去。
A20:

加了没用
回复 支持 反对

使用道具 举报

发表于 2015-2-7 14:22:00 | 显示全部楼层
modong2006 发表于 2015-2-7 13:30
加了没用

驱动编进去了吗?
回复 支持 反对

使用道具 举报

发表于 2015-2-7 14:27:16 | 显示全部楼层
本帖最后由 jiangdou 于 2015-2-7 14:43 编辑

需要驱动,suxi-ts.ko
  1. /*
  2. * author  by jiangdou
  3. * you  have anything,plese to QQ:344283973
  4. * time  at: 2012-0801
  5. *
  6. */


  7. //////////////////add by jiangdou/////////////
  8. #if 1

  9. #define print_dou(format,args...)     printk(KERN_ERR "[spi-err] "format,##args)


  10. #endif

  11. //////////////////add by jiangdou/////////////


  12. #include <linux/interrupt.h>
  13. #include <linux/errno.h>
  14. #include <linux/kernel.h>
  15. #include <linux/module.h>
  16. #include <linux/slab.h>
  17. #include <linux/input.h>
  18. #include <linux/device.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/init.h>
  21. #include <linux/delay.h>
  22. #include <linux/ioport.h>
  23. #include <asm/irq.h>
  24. #include <asm/io.h>
  25. #include <linux/fs.h>
  26. #include <asm/uaccess.h>
  27. #include <linux/mm.h>
  28. #include <linux/slab.h>
  29. #include <linux/timer.h>
  30. #include <linux/jiffies.h>
  31. #include <linux/tick.h>
  32. #include <asm-generic/cputime.h>

  33. #include <mach/system.h>
  34. #include <mach/hardware.h>
  35. #include <mach/sys_config.h>

  36. #ifdef CONFIG_HAS_EARLYSUSPEND
  37. #include <linux/earlysuspend.h>
  38. #endif

  39. #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_PM)
  40. #include <linux/pm.h>
  41. #endif


  42. static int tp_flag = 0;

  43. /* tp status value */
  44. #define TP_INITIAL                      (-1)
  45. #define TP_DOWN                         (0)
  46. #define TP_UP                           (1)
  47. #define TP_DATA_VA                      (2)  

  48. #define DUAL_TOUCH                      (dual_touch_distance)
  49. #define TOUCH_CHANGE                    (3)
  50. #define TP_DATA_AV_NO                   (0x3)

  51. //#define FIX_ORIENTATION
  52. #define ORIENTATION_DEFAULT_VAL         (-1)
  53. //#define TP_INT_PERIOD_TEST
  54. //#define TP_TEMP_DEBUG
  55. //#define TP_FREQ_DEBUG

  56. #define TP_FIX_CENTER

  57. #define IRQ_TP                          (29)
  58. #define TP_BASSADDRESS                  (0xf1c25000)
  59. #define TP_CTRL0                        (0x00)
  60. #define TP_CTRL1                        (0x04)
  61. #define TP_CTRL2                        (0x08)
  62. #define TP_CTRL3                        (0x0c)
  63. #define TP_INT_FIFOC                    (0x10)
  64. #define TP_INT_FIFOS                    (0x14)
  65. #define TP_TPR                          (0x18)
  66. #define TP_CDAT                         (0x1c)
  67. #define TEMP_DATA                       (0x20)
  68. #define TP_DATA                         (0x24)


  69. #define ADC_FIRST_DLY                   (0x1<<24)
  70. #define ADC_FIRST_DLY_MODE              (0x1<<23)
  71. #define ADC_CLK_SELECT                  (0x0<<22)
  72. #define ADC_CLK_DIVIDER                 (0x2<<20)   
  73. //#define CLK                           (6)
  74. #define CLK                             (7)
  75. #define FS_DIV                          (CLK<<16)
  76. #define ACQ                             (0x3f)
  77. #define T_ACQ                           (ACQ)


  78. .............................(略)


  79. static void report_single_point_implement(struct sunxi_ts_data *ts_data, struct ts_sample_data *sample_data)
  80. {


  81.         //print_dou("jiangdou_tp__________________________x1:%d_____y1:%d\n", sample_data->x, sample_data->y);
  82.     input_report_abs(ts_data->input, ABS_MT_TOUCH_MAJOR,800);
  83.         
  84.         sample_data->x = (106458*((4096 - sample_data->x) - 180))/100000;//x轴正反向后左移180到0,同时等比例放大到最大坐标
  85.     //input_report_abs(ts_data->input, ABS_MT_POSITION_X, sample_data->x);
  86.     //sample_data->y = 4096 - sample_data->y;
  87.         sample_data->y = (107758*(sample_data->y - 165))/100000; //107658,,y左移165到0,同时等比例放大到最大坐标
  88.         //为什么107758/100000 =1.07758(放大倍数),内核不支持浮点
  89.         
  90.         //print_dou("\njiangdou_tp__________________________x2:%d_____y2:%d\n", sample_data->x, sample_data->y);
  91.         input_report_abs(ts_data->input, ABS_MT_POSITION_X, sample_data->x);
  92.     input_report_abs(ts_data->input, ABS_MT_POSITION_Y, sample_data->y);   
  93.    
  94.     input_mt_sync(ts_data->input);                 
  95.     input_sync(ts_data->input);

  96.     return;
  97. }

  98. //report_double_point(ts_data, sample_data);//注释掉2点上报,,因为2点不精准,无意义
  99. ...................(略)        
  100.                

  101. static void __exit sunxi_ts_exit(void)
  102. {
  103.         platform_driver_unregister(&sunxi_ts_driver);
  104.         platform_device_unregister(&sunxi_ts_device);
  105. }

  106. module_init(sunxi_ts_init);
  107. module_exit(sunxi_ts_exit);

  108. MODULE_AUTHOR("jiangdou");
  109. MODULE_DESCRIPTION("sunxi touchscreen driver");
  110. MODULE_LICENSE("GPL");

复制代码
vvvv,,,


附带我项目的图片:4线电阻屏:

坐标误差1-2mm以内,小图标点击,效果比电容屏好

抱歉字数限制,代码只是重点片段
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-7 22:04:47 | 显示全部楼层
这是安卓的驱动啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-5-4 16:15 , Processed in 0.021592 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部