1. Verify the data format with kernel code and spec book:
// Command 3 bytes, IC address U8 end_cmd[380xFF0}; // total length first 3 bytes, Max points *8, plus 1 U8 point_data[218180xFF};
2, read the data: Call the STM32 method and convert the original method. and used to read the version number
1 , Read data from the i²c slave device. INPUT:CLIENT:I2C device. buf[ 0 ~1 2 ~len-1 ]: Read data buffer. len:gtp_addr_length + read bytes count that buf total length outp Ut:numbers of I2c_msgs to transfer: Return data 2 : Succeed, otherwise:failed *********************************************************/s32 gtp_i2c_read ( struct i2c_client *client, U8 *buf, S32 len)
//2, start reading the specified number of data at the specified address in the At24cxx // devaddr, set the I²c address, such as FT is 0x36 // READADDR: The address to begin reading out // pdata1: buf to receive data // size,buf length u8 i2c_read0 (U8 devaddr,u16 readaddr,u8 *pdata1,u8 size)
3, convert instance, call in Main.c, verify success:
U8 buf[8] = {Gtp_reg_version >>8, Gtp_reg_version &0xFF};//version is double-byte, here is the high-byte, low -byteRET = gtp_i2c_read (client, buf,sizeof(BUF)); = U8 buf[8] = {Gtp_reg_version >>8, Gtp_reg_version &0xFF}; //The first 2 bytes have been stored in gtp_reg_version, starting from buf[2], where the data structure remains consistent for subsequent code BUF[8]RET =i2c_read0 (0x5c, Gtp_reg_version, buf[2],6) i2c_read0 (0x5c, gtp_reg_version)//U16 with Double byte.
3, overwrite interrupt function processing,
look at the driver code, delete all that will not be executed, keep only#if gtp_slide_wakeup #endif标示 to facilitate and drive code control
GT9XX chip, on the basis of spec book +linux Drive, ported to USB bare metal experience. Directly with the development Board, do not touch the pit of the hardware.