cancel
Showing results for 
Search instead for 
Did you mean: 

I want to rotate screen 90 degree in TouchGFX

Freedom_Neo
Senior

I want to rotate 90 degree the screen. How do it?

Rotate the screen 90 degrees?

27 REPLIES 27

@MM..1​ 

I have same situation , simply create in designer upside down...

The text does not return. Something impossible is on my side.

If your display have this pin maybe have next one pin for flip second axis. For good rotation you need flip both.

Romain ahhh you need flip feature in PC designer app and user see it normal, but adding for example texts or image user see on PC upside down then change to 180 ... No impact in performance.

Now when user have this issue place all widgets upside down

0693W00000JPJTrQAP.png

If your display have this pin maybe have next one pin for flip second axis. For good rotation you need flip both.

When both pins are high, the screen looks normal. But the touch part is not where the buttons are. It detects where there is no button.

This simply change in touchdriver code.

@MM..1​ Thank you for your comments. I don't know exactly which register address to change. I shared the register document, can you take a look?

MM..1
Chief III

You dont need for touch register setup (maybe controller IC have one but simpler way is)

edit in target file TouchGFX\target\STM32TouchController.cpp

bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
    /**
     * By default sampleTouch returns false,
     * return true if a touch has been detected, otherwise false.
     *
     * Coordinates are passed to the caller by reference by x and y.
     *
     * This function is called by the TouchGFX framework.
     * By default sampleTouch is called every tick, this can be adjusted by HAL::setTouchSampleRate(int8_t);
     *
     */
	if(i2cRXbuff[0]==0)    return false;
	x=i2cRXbuff[2];
	y=i2cRXbuff[4];
	return true;
}

This is only example code and for change flip simply rewrite two lines x=XMAX-x; ...

Freedom_Neo
Senior

@MM..1​ It worked. I hope it won't cause any problems in the future.