2023-04-21 03:27 PM
Hi, I am looking into processor based ways to flip the display, using a STM32L4R9. My display can handle horizontal pixel flip, but unfortunately not vertical so I want to see if I can do that without too much overhead in the processor.
@Martin KJELDSEN had an answer on this post a few years ago, where he mentions that the GFXMMU can be used to do the vertical flip by changing the LUT. I tried reversing the order of the GFXMMU_LUT__H entries to reverse the order of the vertical lines in the physical frame buffer. However no flip occurs since TouchGFX writes to the frame buffer through GFXMMU and LTDC then reads from the frame buffer through GFXMMU using the same lookup table.
I could see this being done using two instances of GFXMMU, one with the reversed lookup table for LTDC reads. But STM32L4R9 only has one...
Any ideas on how this could be done?
Thank you,
Russell
2023-05-08 05:04 AM - edited 2023-11-20 07:26 AM
Hello RBurg.2,
What @Martin KJELDSEN said GFXMMU can be used to do the vertical flip by changing the LUT is correct. But it's only graphical, meaning that if you have for example a button, the coordinate of your button is still the ones before your vertical flip so when you'll press on it after your vertical flip, nothing will happen. If you press at the area it was originally located, then it will react.
If you want to investigate more, I invite you to try to modify the gfxmmu_lut_config_touchgfx[] in gfxmmu_lut_touchgfx.h file. What we want to change is the address values here :
These values are written in the table at each GFXMMU_LUTxH position like here :
uint32_t gfxmmu_lut_config_touchgfx[2*GFXMMU_LUT_SIZE_TOUCHGFX] = {
0x001A1501, //GFXMMU_LUT0L
0x003FFEB0, //GFXMMU_LUT0H <------------
0x001B1401, //GFXMMU_LUT1L
0x003FFF20, //GFXMMU_LUT1H <------------
0x001C1401, //GFXMMU_LUT2L
0x003FFFA0, //GFXMMU_LUT2H <------------
0x001D1301, //GFXMMU_LUT3L
0x00000040, //GFXMMU_LUT3H <------------
0x001D1201, //GFXMMU_LUT4L
0x00000100, //GFXMMU_LUT4H <------------
0x001E1201, //GFXMMU_LUT5L
So If you take the value at the bottom and you place them at the top instead, then you'll have a vertical flipped display in theory (maybe you'll need to mirror it as well because the pixels will be placed from right to left in that case, you'll need to put it back from left to right).
PS: Don't regenerate code in STM32CubeMX after changing this table if you want to keep your modification.
/Osman