资源简介
gt911触摸屏驱动程序,成功运行与linux 系统中。-------------------------------------------------

代码片段和文件信息
#include
#include“hjt_ts_gt911.h“
static const char *goodix_input_phys = “input/ts“;
static const char *goodix_ts_name = “goodix-ts“;
static struct workqueue_struct *goodix_wq;
struct i2c_client * i2c_connect_client = NULL;
int gtp_rst_gpio;
int gtp_int_gpio;
u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH]
= {GTP_REG_CONFIG_DATA>> 8 GTP_REG_CONFIG_DATA & 0xff};
static ssize_t gt91xx_config_read_proc(struct file * char __user * size_t loff_t*);
static ssize_t gt91xx_config_write_proc(struct file * const char __user * size_tloff_t *);
static s8 gtp_i2c_test(struct i2c_client *client);
void gtp_reset_guitar(struct i2c_client *client s32 ms);
s32 gtp_send_cfg(struct i2c_client *client);
void gtp_int_sync(s32 ms);
static struct proc_dir_entry *gt91xx_config_proc = NULL;
static const struct file_operations config_proc_ops = {
.owner = THIS_MODULE
.read = gt91xx_config_read_proc
.write = gt91xx_config_write_proc
};
static int gtp_register_powermanger(struct goodix_ts_data *ts);
static int gtp_unregister_powermanger(struct goodix_ts_data *ts);
/*******************************************************
Function:
Read data from the i2c slave device.
Input:
client: i2c device.
buf[0~1]: read start address.
buf[2~len-1]: read data buffer.
len: GTP_ADDR_LENGTH + read bytes count
Output:
numbers of i2c_msgs to transfer:
2: succeed otherwise: failed
*********************************************************/
s32 gtp_i2c_read(struct i2c_client *client u8 *buf s32 len)
{
struct i2c_msg msgs[2];
s32 ret=-1;
s32 retries = 0;
GTP_DEBUG_FUNC();
msgs[0].flags = !I2C_M_RD;
msgs[0].addr = client->addr;
msgs[0].len = GTP_ADDR_LENGTH;
msgs[0].buf = &buf[0];
//msgs[0].scl_rate = 300 * 1000; // for Rockchip etc.
msgs[1].flags = I2C_M_RD;
msgs[1].addr = client->addr;
msgs[1].len = len - GTP_ADDR_LENGTH;
msgs[1].buf = &buf[GTP_ADDR_LENGTH];
//msgs[1].scl_rate = 300 * 1000;
while(retries < 5)
{
ret = i2c_transfer(client->adapter msgs 2);
if(ret == 2)break;
retries++;
}
if((retries >= 5))
{
GTP_ERROR(“I2C Read: 0x%04X %d bytes failederrcode: %d! Process reset.“ (((u16)(buf[0] << 8)) | buf[1])len-2 ret);
{
gtp_reset_guitar(client 10);
}
}
return ret;
}
/*******************************************************
Function:
Write data to the i2c slave device.
Input:
client: i2c device.
buf[0~1]: write start address.
buf[2~len-1]: data buffer
len: GTP_ADDR_LENGTH + write bytes count
Output:
numbers of i2c_msgs to transfer:
1: succeed otherwise: failed
*********************************************************/
s32 gtp_i2c_write(struct i2c_client *clientu8 *bufs32 len)
{
struct i2c_ms
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 36919 2018-02-27 10:58 gt911\hjt_ts_gt911.c
文件 11676 2018-02-27 10:58 gt911\hjt_ts_gt911.h
目录 0 2018-03-21 12:47 gt911
----------- --------- ---------- ----- ----
48595 3
- 上一篇:身份证识别
- 下一篇:8位二进制计数器vhdl源程序及原理图
相关资源
- pscad近海风电模型 Fortran语言
- Xamarin forms 手势事件
- 弹塑性力学Fortran算例
- IAR For ARM 7.3最新注册机
- IAR for MSP430 v7.10.1 注册机
- IAR For ARM V5.5 注册机
- IAR for ARM 7.40 破解
- IAR For ARM 7.4 破解
- 联想y470无线网卡驱动 for 32位64位
- uboot到linux logo显示不间断 补丁
- 最新版TTF16.OCX Formula One v. 6.1.6.2 控件
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- 通风网络解算程序 fortran90
- Winform倒计时器
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- WinForm属性编辑 propertyGrid示例 仿wind
- 操作系统实验——虚存管理实验
- Winform调用系统的剪切,复制,粘贴文
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- winform跨窗体传值
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
评论
共有 条评论