AnsweredAssumed Answered

STemWin screen rotate

Question asked by zyx.zxy on Jun 27, 2017
Latest reply on Apr 23, 2018 by Clive One

Hello everyone!

 

I have a 32f429i_disco_MB1075, I have succesfully ran an freeRTOS os with STemWin. Everything is working fine, but I have to rotate the screen. The GUI_Rotate function doesn't seem to work and I believe I don't have enough memory, so I used the other driver:

 

#define COLOR_CONVERSION_0 GUICC_M8888I
#define DISPLAY_DRIVER_0 GUIDRV_LIN_OSX_32

That fixes my problemand rotates the screen, but here comes another problem with the touch screen, I have tried to manually sway X/Y but that doesnt seem to do the trick. As far as i got was to get touch x/y correctly but there was some inappropriate scalling and the cursor driffted out of the screen, calibrating again didn't work either. How you guys deal with the rotating screen together with touchscreen recognition using STemwin library? I have read the whole emWin manual.

The:

GUI_TOUCH_SetOrientation

doesn't seem to work either.

 

This is my touch update function, that I'm calling every 40ms:

void TouchPointer_Update(void)
{
GUI_PID_STATE TS_State;
static TS_StateTypeDef prev_state;
TS_StateTypeDef ts;
uint16_t xDiff, yDiff;

BSP_TS_GetState(&ts);

TS_State.Pressed = ts.TouchDetected;

xDiff = (prev_state.X > ts.X) ? (prev_state.X - ts.X) : (ts.X - prev_state.X);
yDiff = (prev_state.Y > ts.Y) ? (prev_state.Y - ts.Y) : (ts.Y - prev_state.Y);

if((prev_state.TouchDetected != ts.TouchDetected )||
(xDiff > 3 )||
(yDiff > 3))
{
prev_state.TouchDetected = ts.TouchDetected;

if((ts.X != 0) && (ts.Y != 0))
{
prev_state.X = ts.X;
prev_state.Y = ts.Y;
}

if(CALIBRATION_IsDone())
{
TS_State.Layer = 0;
TS_State.x = CALIBRATION_GetX (prev_state.X);
TS_State.y = CALIBRATION_GetY (prev_state.Y);
}
else
{
TS_State.Layer = 0;
TS_State.x = prev_state.X;
TS_State.y = prev_state.Y;
}

GUI_TOUCH_StoreStateEx(&TS_State);
}
}

 

 

Any help and tips are much appreciated. Thanks in advance!

Outcomes