Skip to main content
ARM_and
Associate III
July 8, 2025
Solved

TouchGFX display orientation and layout rotation at 180 and 270

  • July 8, 2025
  • 3 replies
  • 570 views

We have a 480W 800H  TFT display that TouchGFXDesigner can nicely display in landscape mode instead of portrait.

The trouble is that the device UI is now upside down. TouchGFXDesigner doesn't seem to accept other display rotations such as 180 and 270. Correct?

 

The designer does allow for the text to be rotated 180 which would look correct on our display. But that has other consequences.

Has anyone else had this issue?

 

 

 

 

 

 

Best answer by GaetanGodart

Hello @ARM_and ,

 

We do not support that feature directly in TouchGFX because the display should have that functionality already (to flip the display at least).
So with just 0 and 90 degree plus the display's driver, you can get to 180 or 270.

 

Regards,

3 replies

GaetanGodart
GaetanGodartBest answer
Technical Moderator
July 10, 2025

Hello @ARM_and ,

 

We do not support that feature directly in TouchGFX because the display should have that functionality already (to flip the display at least).
So with just 0 and 90 degree plus the display's driver, you can get to 180 or 270.

 

Regards,

ARM_and
ARM_andAuthor
Associate III
July 11, 2025

Thank you @GaetanGodart.  I see that there are other posts about this as well: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/dsi-display-is-mirrored/td-p/733566 

 

Regards,

-A

Associate III
July 15, 2025

There is a custom widget on forum,https://community.st.com/s/question/0D50X0000A1lVxs/repost-change-lcd-orientation-in-180-degree

I tried it in my project,It is working,but cost very long time,about 10ms(my screen is 320*240,rgb565,160Mhz cpu),So I changed it a bit.Now it uses 5ms turn screen upside down.here is my  changed part.but your screen is 800*480,the time maybe expand several times.

// 16 Bit implementation

virtual void draw(const touchgfx::Rect& invalidatedArea) const

{

uint16_t *framebuffer = touchgfx::HAL::getInstance()->lockFrameBuffer();

 

const uint32_t total_pixels = 320 * 240;

uint32_t *buffer_32 = (uint32_t *)framebuffer; // 转换为32位指针

const uint32_t nblocks = total_pixels / 2; // 32位块的数量

uint32_t *start = buffer_32;

uint32_t *end = buffer_32 + nblocks - 1;

uint32_t a;

while (start < end) {

// 读取两个32位块(各包含2个像素)

a = *start;

// 交换每个块内的两个像素(高16位和低16位互换)

*start = ((*end) >> 16) | ((*end) << 16);

*end = (a >> 16) | (a << 16);

start++;

end--;

}

 

touchgfx::HAL::getInstance()->unlockFrameBuffer();

}

 

ARM_and
ARM_andAuthor
Associate III
July 30, 2025

It might be helpful to add that little bit about "0 and 90 degree plus the display's driver covering the rest" in the documentation.

Confirming that adding the commands for MADCTRL and SDIR  to the glass init sequence rotates it 180.