Linux開發二十_觸摸屏驅動

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源碼

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章