cancel
Showing results for 
Search instead for 
Did you mean: 

Flipping the screen upside down inclusive the buttons

mids400
Associate III

Hello everyone,

Hello @Martin KJELDSEN ,

 

I have read all the posts in the community, thats with this topic relevant and tried to do the same thing in this post.

I could reversed the screen with 180 degree, except the buttons they staying on the original position. Even when they are clicked then nothing happens.

The post above is few years ago and i don't know if there is some updates to this subject. Otherwise i muss flipping all the screens in the designer.

Regards,

Mahdi

_____________________________________________________________________________

Before flipping:

mids400_0-1716554969095.png

After:

mids400_1-1716555028340.png

but the button is not touchable.

1 ACCEPTED SOLUTION

Accepted Solutions
JTP1
Lead

Hello

What if you press here (red square) ?

JTP1_1-1716565120659.png

Did you remeber to flip touch panel coordinates in sampleTouch-function like Martin instructed. This function is typically placed STM32TouchController.cpp- file in \TouchGFX\target\- folder.

Br JTP

View solution in original post

4 REPLIES 4
JTP1
Lead

Hello

What if you press here (red square) ?

JTP1_1-1716565120659.png

Did you remeber to flip touch panel coordinates in sampleTouch-function like Martin instructed. This function is typically placed STM32TouchController.cpp- file in \TouchGFX\target\- folder.

Br JTP

Edit 2: It's worked (i was trying with the simulator thats have no touch panel coordinates!)

Hello @JTP1 

When i click on the circle position the button will be clicked and shown on bottom!

That was my question the coordinates of touch even should be also flipped but i don't found where they should?

I will look again..

 

Edit 1: I found it and edited it like this (due my display's resolution 480x272), but I don't know if I did it right because it still doesn't work!

 

 

 

bool STM32F7TouchController::sampleTouch(int32_t& x, int32_t& y)
{
  TS_StateTypeDef state = { 0 };
  
  if (isInitialized) {
    EDT_TS_GetState(&state);
    if (state.touchDetected)
    {
        x = 479 - state.touchX[0];
        y = 271 - state.touchY[0];

        return true;
    }
  }
    return false; 
}

 

 

Br,

Mahdi

Hello

Are you testing it in simulator or target ? For simulator you probably need to modify HALSDL2.cpp file.

bool HALSDL2::doSampleTouch(int32_t& x, int32_t& y) const
{
    x =  479-(_x - getCurrentSkinX());
    y =  271-(_y - getCurrentSkinY());

    if (DISPLAY_ROTATION == rotate90)
    {
        int32_t tmp = x;
        x = y;
        y = DISPLAY_WIDTH - tmp;
    }
    return popTouch();
}

 Br JTP

You are right i was trying it in simulator and then noticed that finally its worked on the display.

Debug -> x,y reading -> on Display testing and worked!

Thanky you...