Does emWin have a driver for waveshare.com/7inch-capacitive-touch-lcd-c.htm ?
7inch Capative Touch LCD
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
-
Hi,
Unfortunately, there is no such driver.
In most cases we simply read the touch data from the touch controller (e.g. via I2C) and pass them forward to emWin.
For single touch this is quite easy. The routine below which polls the touch and gets called periodically from a dedicated task:
C Source Code
- /*********************************************************************
- *
- * PID_X_Exec
- */
- static void PID_X_Exec(void) {
- TS_StateTypeDef TS_State = {0};
- static GUI_PID_STATE StatePID;
- static int IsTouched;
- int IsMirrorX;
- int IsMirrorY;
- int xSize;
- int ySize;
- if (_IsInitialized) {
- BSP_TS_GetState(&TS_State); // Read touch input
- StatePID.Layer = _LayerIndex;
- if (TS_State.touchDetected) { // If touch detected, set up pid statte structure
- IsTouched = 1; // Remember that last even has been touch down
- StatePID.Pressed = 1; // Pressed, "down event"
- //
- // Get some information about the display orientation and its size
- //
- IsMirrorX = LCD_GetMirrorX();
- IsMirrorY = LCD_GetMirrorY();
- xSize = LCD_GetXSize(); // Depending on the orientation these values are swapped.
- ySize = LCD_GetYSize(); // Previous x size will y size vice versa
- if (LCD_GetSwapXYEx(_LayerIndex)) {
- //
- // If an axis is mirrored we have to suptract the input from the given axis, be aware that
- // the axis values might be swapped. That's why we use ySize for x and xSize for y...
- //
- StatePID.y = (IsMirrorX) ? ySize - TS_State.touchX[0] : TS_State.touchX[0]; // XY swapped, use x coordinates (ySize is formaer xSize) for the y coordinate
- StatePID.x = (IsMirrorY) ? xSize - TS_State.touchY[0] : TS_State.touchY[0]; // Same as above but for y
- } else {
- StatePID.x = (IsMirrorX) ? xSize - TS_State.touchX[0] : TS_State.touchX[0]; // Nothings swapped but maybe mirrored
- StatePID.y = (IsMirrorY) ? ySize - TS_State.touchY[0] : TS_State.touchY[0];
- }
- GUI_TOUCH_StoreStateEx(&StatePID); // Pass information to emWin
- } else {
- if (IsTouched == 1) { // No touch detected but last event was touch down
- IsTouched = 0; // Restore IsTouched variable
- StatePID.Pressed = 0; // Unpressed, "up event"
- GUI_TOUCH_StoreStateEx(&StatePID); // Since StatePID is declared as static we use the x/y coordinate
- // from the down event to create an up event.
- }
- }
- }
- }
With multitouch it is a bit more tricky, but works more or less the same (poll the touch data and pass to emWin). The difference are the multiple touch points and their IDs.
emWin offers an API to pass multitouch touch input to emWin. Attached are some examples for different TCs.
Regards,
Sven
Please read the forum rules before posting.
Keep in mind, this is *not* a support forum.
Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
Should you be entitled to support you can contact us via our support system: segger.com/ticket/
Or you can contact us via e-mail. -
Thank you. I understand that there is also no draivera for operating the LCD panel.