Xinyuan-LilyGO / T-Watch-2021

MIT License
82 stars 18 forks source link

Touch screen wake gesture #13

Open xyzzy42 opened 1 year ago

xyzzy42 commented 1 year ago

Is it possible to have the touch screen wake only on a gesture? The reason is to let the ESP32 sleep, then wake only on touch screen gesture, like vertical swipe. Not to wake on all touches of screen.

I've tried programming the controller to do this, but it just doesn't work. I can get normal touch information fine: interrupts from touch, motion, release. Also put controller into sleep mode. But it will not wake from sleep mode except by reset line. And the gesture interrupts never fire. Turning off touch/motion interrupts but leaving gesture interrupts on results in no interrupts at all.

It looks like the CST816S controller is supposed to support this features. There are references to it in the provided touch screen driver: https://github.com/Xinyuan-LilyGO/T-Watch-2021/blob/d2a53e063a649275b5c73af40c948a8c53f6783b/TWatch_2021_Library/src/libraries/Cst816s/CST816S.cpp#L140

I found some documentation about CST816S: https://github.com/koendv/cst816t/tree/0df7f431a5ae12edc8d32bdc88b0de1597f1f67d/extras

The feature is described there: image image image

2、 手势模式 触摸 IC 更据用户触摸轨迹识别成指定手势码(单击,双击,长按,上下左右滑动),当手势码生成时,会拉一次中断,主控更据中断读取生成的手势码。

  1. gesture mode The touch IC recognizes the specified gesture code (single click, double click, long press, up, down, left, and right) according to the user's touch track. When the gesture code is generated, an interrupt will be pulled, and the main control will read the generated gesture code according to the interrupt.
设置为手势模式
data[0] = 0x11;
drv_Touch_Write(0xFA, data, 1); // 生成手势后拉一次中断。