How to rotate the UI to 180 Degrees

Hi Team,
I would like to rotate my UI to 180 Degrees.
is there any option to change the rotation to 180 degrees?
Can you please help me with this.

Thanks in Advance.

The easiest solution is probably to just flip the coordinates in your display driver. I believe flipping both the X and Y coordinates will do what you want.

Some display drivers have register(s) to change the pixel scanning direction. Say, default is to scan pixels from top left to lower right in zigzag. There are options to change this scanning direction starting from lower right corner to top left. This will flip the whole screen 180 degree. What command to use is hardware dependent.

Hi Team.
I’m having the same issue running the simulator.
Here’s my code:

int32_t x;
int32_t screen = MONITOR_HOR_RES * (MONITOR_VER_RES - 1);
for(y = area->y1; y <= area->y2 && y < disp_drv->ver_res; y++){
	for(x=area->x1;x<=area->x2;x++) {
		memcpy(&monitor.tft_fb[screen - y * MONITOR_HOR_RES + x], color_p, sizeof(lv_color_t));
		color_p ++;
	}

}

Y coordinate seems to flip OK, X coordinates stay the same.

Thanks for your support!

I think this will do what you want.

for(y = area->y1; y <= area->y2 && y < disp_drv->ver_res; y++){
	for(x=area->x1;x<=area->x2;x++) {
		memcpy(&monitor.tft_fb[(MONITOR_VER_RES-y) * MONITOR_HOR_RES + (MONITOR_HOR_RES-x)], color_p, sizeof(lv_color_t));
		color_p ++;
	}
}
1 Like

Thanks @embeddedt.
I tried your code with a 600x600 screen in the simulator and works.
I don’t understand my mistake yet.
If I have a 10x10 screen I thought only 100 values would be available for writing. From 0 to 99.
If VER_RES = 10 I will need to write from 0 to 9.
If HOR_RES = 10 I will need to write from 0 to 9 too.
Using your algorithm with x and y from 0 to 9, position 0,0 points to 110 and positon 9,9 to 11.
Can you please tell me what my error is?