cancel
Showing results for 
Search instead for 
Did you mean: 

STemWin screen rotate

SimonP
Associate II
Posted on June 27, 2017 at 14:04

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!

3 REPLIES 3
tomasz radomski
Associate II
Posted on November 30, 2017 at 08:12

Hi, 

did you solve that problem with touchscreen orientation?

I have the same issue.

BR

Tom

sanjeev majumdar
Associate III
Posted on April 23, 2018 at 13:50

i too have the same issue and also when i run TOUCH_sample.c the moment i touch the screen cursor points some other location and always the GUI_PID_STATE.Pressed is 1. who is calling GUI_TOUCH_StoreState to store the state??

MY lacd has TSC2003 touch controller which used x+, X-, Y+, Y- and provide the measurement through I2C.

kindly suggest how to debug the issue.

thanks

Posted on April 23, 2018 at 15:04

>>kindly suggest how to debug the issue.

Get a good static analysis tool and walk the code.

Understand the data returned by the touch controller.

Understand the math and transforms applied to the data and into the co-ordinate system returned.

Adjust and/or scale the returned values to ones you need/expect.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..