使用汇顶Gt9xxx触摸屏,需要修改 drivers/input/touchscreen/gt9xxnewgt9xx.h 来更改分辨率
红色部分为分辨率,绿色部分为整个数组的求和校验。
如分辨率为1024*600,1024 = 0x0400 ; 600 = 0x0258
则红色部分为 0x00,0x04,0x58,0x02
分辨率为1280*800,1280 = 0x0500 ; 800 = 0x0320
则红色部分为 0x00,0x05,0x20,0x03
举例 1600*480
uint8_t CTP_CFG_GROUP7[]= {\
0x42,0x40,0x06,0xE0,0x01,0x0A,0x0D,0x00,0x01,0x08,\
0x28,0x05,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x2D,0x08,\
0x17,0x15,0x31,0x0D,0x00,0x00,0x01,0xB9,0x04,0x1D,\
0x00,0x00,0x00,0x00,0x00,0x03,0x64,0x32,0x00,0x00,\
0x00,0x0F,0x23,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,\
0x9E,0x10,0x00,0x8A,0x13,0x00,0x7C,0x16,0x00,0x6B,\
0x1B,0x00,0x60,0x20,0x00,0x60,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,\
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,\
0x10,0x12,0x13,0x14,0x16,0x18,0x1C,0x1D,0x1E,0x1F,\
0x20,0x21,0x22,0x24,0x26,0x28,0x29,0xFF,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0xE1,0x01};
以下是测试校验和程序。
#include
#include
#include
uint8_t CTP_CFG_GROUP1[]= {\
0x00,0x00,0x04,0x58,0x02,0x0A,0x0D,0x00,0x01,0x0A,
0x1E,0x0F,0x58,0x41,0x03,0x05,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x2E,0x0E,
0x2F,0x31,0xEB,0x04,0x00,0x00,0x00,0x22,0x02,0x1D,
0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
0x00,0x1E,0x50,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,
0xC8,0x21,0x00,0xAA,0x28,0x00,0x90,0x31,0x00,0x7C,
0x3B,0x00,0x6C,0x48,0x00,0x6C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,
0x12,0x14,0x16,0x18,0x1A,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,
0x10,0x12,0x13,0x14,0x16,0x18,0x1C,0x1D,0x1E,0x1F,
0x20,0x21,0x22,0x24,0x26,0x28,0x29,0x2A,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0x01};
uint8_t CTP_CFG_GROUP2[]= {\
0x42,0x00,0x05,0x20,0x03,0x0A,0x3D,0x00,0x01,0x08,\
0x28,0x0F,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x17,0x19,0x1D,0x14,0x8D,0x2D,0x88,\
0x1E,0x20,0x31,0x0D,0x00,0x00,0x00,0x42,0x03,0x1D,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x14,0x2D,0x94,0xD5,0x02,0x07,0x00,0x00,0x04,\
0xAF,0x15,0x00,0x95,0x19,0x00,0x80,0x1E,0x00,0x70,\
0x23,0x00,0x63,0x29,0x00,0x63,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x01,0x04,0x05,0x06,0x07,0x08,0x09,\
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x14,0x15,0xFF,0xFF,\
0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x02,0x04,0x06,0x07,0x08,0x0A,0x0C,\
0x0F,0x10,0x11,0x12,0x13,0x19,0x1B,0x1C,0x1E,0x1F,\
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0xFF,0xFF,\
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0xEE,0x01};
uint8_t CTP_CFG_GROUP3[]= {\
0x42,0x00,0x04,0x58,0x02,0x0A,0x3D,0x00,0x01,0x08,\
0x28,0x0F,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x17,0x19,0x1D,0x14,0x8D,0x2D,0x88,\
0x1E,0x20,0x31,0x0D,0x00,0x00,0x00,0x42,0x03,0x1D,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x14,0x2D,0x94,0xD5,0x02,0x07,0x00,0x00,0x04,\
0xAF,0x15,0x00,0x95,0x19,0x00,0x80,0x1E,0x00,0x70,\
0x23,0x00,0x63,0x29,0x00,0x63,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x01,0x04,0x05,0x06,0x07,0x08,0x09,\
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x14,0x15,0xFF,0xFF,\
0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x02,0x04,0x06,0x07,0x08,0x0A,0x0C,\
0x0F,0x10,0x11,0x12,0x13,0x19,0x1B,0x1C,0x1E,0x1F,\
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0xFF,0xFF,\
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0xB8,0x01};
/* TODO: define your config for Sensor_ID == 3 here, if needed*/
/*for dushulang gt9110,COF*/
uint8_t CTP_CFG_GROUP4[]= {\
0x41,0x56,0x05,0x00,0x03,0x0A,0x3D,0x00,0x01,0x08,\
0x28,0x08,0x50,0x32,0x03,0x07,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x19,0x1A,0x1E,0x14,0x95,0x35,0xFF,\
0x2A,0x2C,0x39,0x13,0x00,0x00,0x00,0x9A,0x03,0x2D,\
0x00,0x00,0x00,0x80,0x83,0x04,0x6E,0x64,0x14,0x00,\
0x00,0x1E,0x3C,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,\
0x96,0x20,0x00,0x89,0x25,0x00,0x7F,0x2A,0x00,0x77,\
0x30,0x00,0x6F,0x38,0x00,0x6F,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,\
0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,\
0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,\
0x1C,0x1D,0x2A,0x29,0x28,0x27,0x26,0x25,0x24,0x23,\
0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x19,0x18,\
0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,\
0x0D,0x0C,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,\
0x03,0x02,0x01,0x00,0x24,0x01};
/* TODO: define your config for Sensor_ID == 4 here, if needed*/
/* machine: noah*/
uint8_t CTP_CFG_GROUP5[]= {\
0x46,0x00,0x05,0x20,0x03,0x0A,0x3D,0x00,0x01,0x0A,\
0x1E,0x0F,0x50,0x3C,0x03,0x04,0x01,0x01,0x00,0x00,\
0x00,0x00,0x00,0x1A,0x1C,0x1E,0x14,0x90,0x30,0xAA,\
0x32,0x30,0x03,0x15,0x00,0x00,0x02,0x03,0x03,0x1D,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x27,0x3B,0x94,0xC5,0x02,0x08,0x00,0x00,0x04,\
0x8C,0x28,0x00,0x85,0x2C,0x00,0x80,0x30,0x00,0x7B,\
0x34,0x00,0x77,0x38,0x00,0x77,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x01,0x04,0x05,0x06,0x07,0x08,0x09,\
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x14,0x15,0x16,0x17,\
0x18,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x2A,0x29,0x28,0x27,0x26,0x25,0x24,0x23,\
0x22,0x21,0x20,0x1F,0x1E,0x1C,0x1B,0x19,0x14,0x13,\
0x12,0x11,0x10,0x0F,0x0E,0x0D,0x0C,0x0A,0x08,0x07,\
0x06,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x7B,0x01};
/* TODO: define your config for Sensor_ID == 5 here, if needed*/
uint8_t CTP_CFG_GROUP6[]= {\
0x41,0x00,0x06,0x00,0x08,0x0A,0x35,0x00,0x01,0x0A,\
0x28,0x0A,0x50,0x32,0x03,0x03,0x00,0x00,0xFF,0x7F,\
0x00,0x00,0x04,0x16,0x1A,0x1E,0x14,0x90,0x30,0xAA,\
0x30,0x32,0x2E,0x0B,0x00,0x00,0x00,0x9A,0x33,0x45,\
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x23,0x1E,0x41,0x4F,0xC5,0x01,0x08,0x00,0x00,0x04,\
0xC1,0x20,0x00,0xAD,0x25,0x00,0x99,0x2C,0x00,0x8B,\
0x33,0x00,0x7E,0x3C,0x00,0x7E,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,\
0x50,0x37,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x01,0x04,0x05,0x06,0x07,0x08,0x09,\
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x14,0x15,0x16,0x17,\
0x18,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x2A,0x29,0x28,0x27,0x26,0x25,0x24,0x23,\
0x22,0x21,0x20,0x1F,0x1E,0x1C,0x1B,0x19,0x14,0x13,\
0x12,0x11,0x10,0x0F,0x0E,0x0D,0x0C,0x0A,0x08,0x07,\
0x06,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x21,0x01};
uint8_t CTP_CFG_GROUP7[]= {\
0x42,0x40,0x06,0xE0,0x01,0x0A,0x0D,0x00,0x01,0x08,\
0x28,0x05,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x2D,0x08,\
0x17,0x15,0x31,0x0D,0x00,0x00,0x01,0xB9,0x04,0x1D,\
0x00,0x00,0x00,0x00,0x00,0x03,0x64,0x32,0x00,0x00,\
0x00,0x0F,0x23,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,\
0x9E,0x10,0x00,0x8A,0x13,0x00,0x7C,0x16,0x00,0x6B,\
0x1B,0x00,0x60,0x20,0x00,0x60,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,\
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,\
0x10,0x12,0x13,0x14,0x16,0x18,0x1C,0x1D,0x1E,0x1F,\
0x20,0x21,0x22,0x24,0x26,0x28,0x29,0xFF,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0xE1,0x01};
uint8_t SumCheck(uint8_t *data,int data_len)
{
uint8_t sum_check = 0;
for(int i = 0;(i