优化tp驱动 1446/1
authorSnickerSun <snickersun@163.com>
Fri, 22 Nov 2024 06:46:03 +0000 (14:46 +0800)
committerSnickerSun <snickersun@163.com>
Fri, 22 Nov 2024 06:46:03 +0000 (14:46 +0800)
code/sdk/drivers/peripheral/touch/ft6x46_touch/ft6x46_ctrl.c
code/sdk/drivers/peripheral/touch/ft6x46_touch/ft6x46_touch1.c
code/sdk/drivers/peripheral/touch/touch_screen_drv.c

index 753f2d8..0fcc4f2 100644 (file)
@@ -392,6 +392,6 @@ void ft6x46_resume_reset(void)
     uapi_gpio_set_val(FT6X46_RESET_GPIO, GPIO_LEVEL_HIGH);
     /* delay 100ms */
     osDelay(200);
-    uapi_gpio_set_dir(FT6X46_RESET_GPIO, GPIO_DIRECTION_INPUT);
+    // uapi_gpio_set_dir(FT6X46_RESET_GPIO, GPIO_DIRECTION_INPUT);
 }
 
index 23e43a8..abd5f0b 100644 (file)
@@ -340,13 +340,19 @@ ext_errno ft6x46_irq_callback(uint8_t *data_buf, uint8_t data_len)
 
     int32_t mem_ret;
     static int fail_count = 0;
+    if (g_ft6x46_drv.work_status != FT6X46_WORK_NORMAL) {
+        tp_print("TOUCH:ft6x46_irq_callback not in normal mode skip read touch");
+        return ERRCODE_FAIL;
+    }
+
     if (fts_touch_process() != ERRCODE_SUCC)
     {
         fail_count ++ ;
     }else{
         fail_count = 0;
     }
-    if (fail_count > 10){
+    if (fail_count%50 == 49){
+        tp_print("TOUCH:ft6x46_irq_callback fail to reset touch ");
         hal_custom_resume_touch();                
     }
 
index c78a429..e115d19 100644 (file)
@@ -437,9 +437,10 @@ void touch_screen_suspend(void)
     if (ret != EXT_ERR_SUCCESS) { tp_err("touch sleep ret=0x%x", ret); }
 #if defined(TPTYPE_FT6X46)
     if (ft6x46_suspend() == EXT_ERR_SUCCESS){
-        i2c_save_reg(TOUCH_I2C_BUS);
-        uapi_gpio_disable_interrupt(TOUCH_INT_GPIO); // close tp_int gpio interrupt
+        
     }
+    i2c_save_reg(TOUCH_I2C_BUS);
+    uapi_gpio_disable_interrupt(TOUCH_INT_GPIO); // close tp_int gpio interrupt
 #else
     i2c_save_reg(TOUCH_I2C_BUS);
     uapi_gpio_disable_interrupt(TOUCH_INT_GPIO); // close tp_int gpio interrupt