資源簡介
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源程序及原理圖
評論
共有 條評論