解决上电和长期运行屏幕触摸无效的问题

This commit is contained in:
2025-12-05 17:42:01 +08:00
parent fe65a0c408
commit bdcc73bc2b
15 changed files with 95 additions and 40 deletions

View File

@@ -58,7 +58,7 @@ static void touch_entry(void *parameter) /* touch panel control entry */
while (1)
{
rt_sem_take(touch_sem, RT_WAITING_FOREVER);
// rt_sem_take(touch_sem, RT_WAITING_FOREVER);
int num = rt_device_read(dev, 0, read_data, info.point_num);
if (num > 0)
{
@@ -81,19 +81,26 @@ static void touch_entry(void *parameter) /* touch panel control entry */
}
}
}
//aicos_msleep(10);
rt_device_control(dev, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL);
// rt_device_control(dev, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL);//处理完毕再使能中断
/*
* If using polling mode,
* the following conmments must be opened,
* and the masking related to semaphores must be removed.
*/
rt_thread_mdelay(10);
}
}
static rt_err_t rx_callback(rt_device_t dev, rt_size_t size)
{
rt_sem_release(touch_sem);
rt_device_control(dev, RT_TOUCH_CTRL_DISABLE_INT, RT_NULL);
#ifdef AIC_PM_DEMO
extern struct rt_event pm_event;
rt_event_send(&pm_event, 2);
#endif
// rt_sem_release(touch_sem);
// rt_device_control(dev, RT_TOUCH_CTRL_DISABLE_INT, RT_NULL);//中断来了 暂时关闭中断 等处理完毕再打开
// #ifdef AIC_PM_DEMO
// extern struct rt_event pm_event;
// rt_event_send(&pm_event, 2);
// #endif
return 0;
}
@@ -105,7 +112,7 @@ int tpc_run(const char *name, rt_uint16_t x, rt_uint16_t y)
rt_kprintf("can't find device:%s\n", name);
return -1;
}
//中断接收
if (rt_device_open(dev, RT_DEVICE_FLAG_INT_RX) != RT_EOK)
{
rt_kprintf("dev %s is occupied by someone!\n", name);