Linux开发二十_触摸屏驱动

来源:互联网 发布:手机淘宝如何发布二手 编辑:程序博客网 时间:2024/06/04 20:07

Linux开发二十

触摸屏驱动

象棋小子    1048272975

在人机交互系统中,键盘、触摸屏等输入设备是一个不可或缺的部分,触摸屏以其非常良好的用户体验得到了广泛的应用。此处以ft5206电容屏为例,实现Linux内核上的驱动。

1. ft5206设备

电容屏为i2c接口,用i2c_board_info来构建ft5206  i2c设备信息表。

#include <linux/input/ft5x06_ts.h>

static struct ft5x06_ts_platform_dataft5x06 = {

       .irq_gpio= S3C2410_GPG(4),

       .rst_gpio= S3C2410_GPF(5),

};

 

static struct i2c_board_infohome2416_i2c_devs[] __initdata = {

       {

              I2C_BOARD_INFO("ft5206",0x38),

              .platform_data= &ft5x06;

       },

};

 

在板级初始化函数home2416_machine_init()中注册i2c设备,i2c_register_board_info(0,home2416_i2c_devs, ARRAY_SIZE(home2416_i2c_devs));

根据其它i2c电容屏驱动实现,编写ft5x06驱动,ft5x06_ts.c/ ft5x06_ts.h,具体源码可以参考/drivers/input/touchscreen/ft5x06_ts.c、/include/linux/input/ft5x06_ts.h。

在/drivers/input/touchscreen/Makefile中加入ft5x06的内核编译实现。

obj-$(CONFIG_TOUCHSCREEN_FT5X06)    +=ft5x06_ts.o

在/drivers/input/touchscreen/Kconfig中加入ft5x06的内核配置。

config TOUCHSCREEN_FT5X06

       tristate"FocalTech FT5x06 I2C Touchscreen support"

       dependson I2C

       help

         Say Y here to enable FocalTech ft5x06touchscreen support.

 

         If unsure, say N.

 

         To compile this driver as a module, choose Mhere: the

         module will be called ft5x06.

2. 内核配置

Linux配置支持ft5x06设备驱动,选中Device Drivers->Input device support->Touchscreens->FocalTechFT5x06 I2C Touchscreen support。

3. 触摸屏测试

cat/proc/bus/input/devices知道触摸屏设备文件在/dev/input/event1,用hexdump测试触摸屏功能。

hexdump/dev/input/event1。

4. 附录

https://pan.baidu.com/s/1slczwhJ

bootloader源码以及使用说明

https://pan.baidu.com/s/1eRDJtNs

Qt5.8官网源码

https://pan.baidu.com/s/1nuGmSqt

本系列例程的根文件系统

https://pan.baidu.com/s/1i5btLGT

opev3.2.0官网源码

https://pan.baidu.com/s/1pLpuHw3

yaffs官网源码 

https://pan.baidu.com/s/1bpkZynt

busybox-1.26.2官网源码

https://pan.baidu.com/s/1i4EtjfR

tslib官网源码

https://pan.baidu.com/s/1i5MGRhb

mplayer-1.3.0官网源码

https://pan.baidu.com/s/1sl0fXlr

基于S3C2416修改的linux-4.10.10源码

 

0 0
原创粉丝点击