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?

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief II

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; ...

View solution in original post

27 REPLIES 27
Romain DIELEMAN
ST Employee

Hi,

Within TouchGFX Designer you can set the display orientation to either Landscape or Portrait mode, so a 90degree rotation. To do so, go to the Config tab in the bottom left of TouchGFX Designer and go to the Display section.

Otherwise you can do this as you said within STM32CubeMX where you set the display to 480*800.

/Romain

I rotated 90 degree. But Letters rotated 180 degrees. How can I it solve this problem.

What option did you use to rotate 90 degrees in the end ? That issue is unusual I never faced it. Could you try to delete that TextArea widget and create another one to see if you still face it ? Did you by any chance added some user code before where you would change the text rotation :grinning_face_with_sweat:?

What option did you use to rotate 90 degrees in the end ?

TouchGFX->Config->Display->Display Orientation

0693W00000JOoB3QAL.pngCould you try to delete that TextArea widget and create another one to see if you still face it ?

I rebuilt. But the same situation continues.

Did you by any chance added some user code before where you would change the text rotation?

No, I didnt. I just created a simple interface with TouchGFX. I didn't even get to the code part.

MM..1
Chief II

TouchGFX rotate 90 change communication width and heigth , other rotations you need create mechanicaly rotate LCD or by LCD setup config registers. Try search and change MADCTL

What MCU are you using ? And what version of TouchGFX ? I was not able to replicate that issue on my side.

/Romain

Wait now that i look at your picture again I can see that the button is also rotated in the same way, are you sure it isn't just properly rotated but your display is inverted/upside-down :grinning_face_with_sweat:?

/Romain

MCU: STM32H7B3IIT6

TouchGFX Version: 4.18.1

The screen is as follows.