更新gt911配置

This commit is contained in:
wen
2025-10-11 20:02:29 +08:00
parent c946907407
commit a2645f37da
6 changed files with 20 additions and 17 deletions

View File

@@ -23,8 +23,8 @@ static struct rt_i2c_client gt911_client;
/* hardware section */
static rt_uint8_t GT911_CFG_TBL[] = {
0x61,0xE0,0x01,0xE0,0x01,0x01,0xF5,0x00,0x01,0xC8,0x28,0x0D,
0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,
0x62,0xE0,0x01,0xE0,0x01,0x01,0xF5,0x00,0x01,0xC8,0x28,0x0F,
0x50,0x3C,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,
0x18,0x1E,0x14,0x85,0x25,0x0A,0x9B,0x9D,0x7C,0x06,0x00,0x00,
0x00,0x00,0x01,0x2D,0x00,0x01,0x00,0x00,0x00,0x03,0x64,0x32,
0x00,0x00,0x00,0x50,0x7D,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,
@@ -38,7 +38,7 @@ static rt_uint8_t GT911_CFG_TBL[] = {
0x04,0x02,0x00,0x1D,0x1E,0x1F,0x20,0x21,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x34,0x01
0x00,0x00,0x00,0x00,0x27,0x01
};
static rt_err_t gt911_write_reg(struct rt_i2c_client *dev, rt_uint8_t *data,
@@ -356,17 +356,19 @@ exit_:
}
static rt_err_t gt911_control(struct rt_touch_device *touch, int cmd, void *arg)
{
{
LOG_I("gt911_control cmd:%x",cmd);
rt_uint8_t regver;
gt911_get_config_version(&gt911_client, &regver, 1);
LOG_I("Cconfig version:%d",regver);
if(regver<=96)
LOG_I("Config version:%d",regver);
if(regver<98)
{
LOG_I("update config ver:97");
LOG_I("update touch config");
rt_uint8_t buf[4];
rt_uint8_t i = 0;
rt_uint8_t *config;
rt_uint8_t *config;
config = (rt_uint8_t *)rt_calloc(1, sizeof(GT911_CFG_TBL) + GT911_REGITER_LEN);
if (config == RT_NULL) {
@@ -449,20 +451,21 @@ static rt_err_t gt911_control(struct rt_touch_device *touch, int cmd, void *arg)
buf[2] += GT911_CFG_TBL[i];
}
buf[2] = (~buf[2]) + 1;
buf[3] = 1;//是否写入到GT9147 FLASH? 即是否掉电保存
LOG_I("checksum:%x",buf[2]);
LOG_I("checksum~:%x",~buf[2]);
buf[2] = (~buf[2]) + 1;
LOG_I("checksum~+1:%x",buf[2]);
buf[3] = 1;//是否写入到GT9147 FLASH? 即是否掉电保存
gt911_write_reg(&gt911_client, buf, 4);
rt_free(config);
LOG_I("update config suss");
}
if (cmd == RT_TOUCH_CTRL_GET_ID) {
return gt911_get_product_id(&gt911_client, arg, 6);
}
if (cmd == RT_TOUCH_CTRL_GET_ID) {
return gt911_get_product_id(&gt911_client, arg, 6);
}

Binary file not shown.

Binary file not shown.

View File

@@ -793,8 +793,8 @@ CONFIG_CONFIG_LANAGUAGE_CHS=y
# CONFIG_CONFIG_LANAGUAGE_CHT is not set
# CONFIG_CONFIG_USER_RELAY_1 is not set
# CONFIG_CONFIG_USER_RELAY_2 is not set
# CONFIG_CONFIG_USER_RELAY_3 is not set
CONFIG_CONFIG_USER_RELAY_4=y
CONFIG_CONFIG_USER_RELAY_3=y
# CONFIG_CONFIG_USER_RELAY_4 is not set
CONFIG_CONFIG_DEVICE_SCR_ACT_JUMP=y
CONFIG_CONFIG_OBJICT_IMAGE=y
CONFIG_CONFIG_USER_MENU_TABLEVEW=y