zoukankan      html  css  js  c++  java
  • Gt9xx芯片,在规格书+Linux驱动的基础上,移植为USB裸机经验。直接用开发板,不去碰硬件的坑。

    1,用内核代码和规格书来印证数据格式:

    //命令3字节,IC地址
    u8  end_cmd[3] = {GTP_READ_COOR_ADDR >> 8, GTP_READ_COOR_ADDR & 0xFF, 0};
    //总长度 前 3个字节、最大点数*8、加1
        u8  point_data[2 + 1 + 8 * GTP_MAX_TOUCH + 1]={GTP_READ_COOR_ADDR >> 8, GTP_READ_COOR_ADDR & 0xFF};
     
    2,读数据:调用STM32的方法,转换原来的方法。并用于读版本号
    1,    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   即buf总长度
    Output:
        numbers of i2c_msgs to transfer:   返回数据
          2: succeed, otherwise: failed
    *********************************************************/
    s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len)
    //2,在AT24CXX里面的指定地址开始读出指定个数的数据
    // DevAddr ,设置I2C地址,如ft是0x36
    //ReadAddr :开始读出的地址
    //pdata1:接收数据的buf
    //size,buf长度
    u8 I2C_Read0(u8 DevAddr,u16 ReadAddr,u8 *pdata1,u8 size)
    3,转换实例,在main.c里来调用,验证一下是否成功:
       u8 buf[8] = {GTP_REG_VERSION >> 8, GTP_REG_VERSION & 0xff};//version是双字节的,这里是取出了高字节,低字节
     ret = gtp_i2c_read(client, buf, sizeof(buf)); 
     
    =>    u8 buf[8] = {GTP_REG_VERSION >> 8, GTP_REG_VERSION & 0xff};
     //前2字节已经存放了GTP_REG_VERSION,从buf[2]开始存,这里为了后面代码,数据结构保持一致也使用了 buf[8]
         ret =I2C_Read0(0x5c,GTP_REG_VERSION ,buf[2],6)
    I2C_Read0(0x5c,GTP_REG_VERSION )//直接原封不动用双字节u16了
     
    3,改写中断函数处理,
    看驱动代码,把不会执行的通通删掉,仅保留#if GTP_SLIDE_WAKEUP #endif标示,以方便和驱动代码对照
     
     
  • 相关阅读:
    el-input 标签中密码的显示和隐藏
    java 使用RedisTemplate实现Redis事务
    mac 安装 Java 环境
    Snowflake 分布式UUID
    lsof 查看端口使用时刻
    nginx.pid" failed (2: No such file or directory)
    解决Redis之MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist
    Linux环境下 Jna 解决so依赖文件not found
    Ubuntu mysql 在线安装
    Linux中为什么执行自己的程序要在前面加./
  • 原文地址:https://www.cnblogs.com/zkp2010/p/5510750.html
Copyright © 2011-2022 走看看