2018-11-27 01:44 AM
QUESTION - TouchGFX Community repost - Eyal goltzman - July 2016
Hello,
Following Yossi question from today and Martin reference to Soren answer in https://touchgfx.zendesk.com/hc/en-us/community/posts/206708899--orientation-180-degree
We are using LCD without SPI interface, only parallel RGB interface through the LCD-TFT Controller peripheral, so controlling the LCD as describe in your answer to the above link is not an option.
Since our customers have a mechanical issue with the display orientation (the flat cable position) we are trying to address it with SW solution.
As I see it, there is an option to rotate the frame buffer just before calling swapFrameBuffers, what do you think? It could be done? performance issues? Can we do it ourselves? How?
Thanks,
Eyal
ANSWER - TouchGFX Community repost - Soren Pingel Dalsgaard - July 2016
Hi Eyal,
How unfortunate! You could do the rotation manually, but the performance penalty will be very significant, to the extent that only very simple UIs can be realized.
This is due to two things:
I think the right place to do such a rotation would be by overriding HAL::endFrame. Something like this:
void MyHAL::endFrame()
{
dma.flush(); //wait for all dma operations to have completed
rotateFb(getClientFrameBuffer()); //apply rotation on the fb
HAL::endFrame(); //call base impl when rotation is done.}
Apart from this you would need also to invert the coordinates in your touch controller driver.
You can give it a shot, but I am not too optimistic to be honest. Hopefully you could convince your customer to switch to another display that can either be mounted normally or supports scan direction swap.
Solved! Go to Solution.
2019-02-18 01:18 PM
Thank you Martin. We are unfortunately using an STM32H743 which does not seem to have this option.
Will there be something done in a future version on Touch GFX to support this? I think it would be an awesome addition to the library.
We will need to work on the mechanical side to position our LCD at 0 degrees but this has a big impact on the esthetics of our product. It would save a lot of time, effort and money to at least know ahead if it is planned and if so, in what kind of timeframe.
Thank you,
2019-09-02 11:26 PM
Hi @DS.5chramm
Hi @Martin KJELDSEN
I'm new to TouchGFX and I also wanted to rotate the display 180°.
How do I get this mirroring working?
Do I have to do it for every screen I have?
Regards
Dejan
2019-09-03 12:42 AM
Hi @Dejan Nedeljkovic,
You may be able to rotate your display 180 degrees through hardware configuration. The hw config solution should be investigated first, because this software solution is very inefficient. It's basically swapping all the pixels in the framebuffer. We may add support for 180, natively, but we found that in most cases it was possible to do in hardware config.
So, yes, you have to add this widget as the top most widget on every screen.
/Martin
2019-09-03 01:15 AM
Hi @Martin KJELDSEN
In our setting it is not possible to rotate the hardware.
It would be great if there is a support to rotate it natively.
I think I'm doing something wrong. This is my Screen which I want to rotate 180 degrees:
void Screen1View::setupScreen()
{
Mirror mirror;
Rect r(0, 0, HAL::DISPLAY_WIDTH, HAL::DISPLAY_HEIGHT);
mirror.draw(r);
Screen1ViewBase::setupScreen();
}
2019-09-03 01:54 AM
You can just add Mirror as a child element to your view root container.
add(mirror);
Also, if you call setupScreen() in the baseclass, mirror won't be on top.
void Screen1View::setupScreen()
{
Screen1ViewBase::setupScreen();
add(mirror); // declared in headerfile
}
2019-09-03 02:37 AM
Do I need to draw the mirror widget or is it enough just to add the child?
I've declared mirror in the header file and added the child after setupScreen().
It doesn't mirror the screen.
Regards
Dejan
2019-09-03 04:08 AM
It should be enough to simply add it. You can put a break point in its draw() method to verify that it's getting called. I forgot to mention that you need to give it a size. e.g.
mirror.setPosition(0, 0, 800, 480);
2019-09-03 06:43 AM
That got me a step forward. Now it's rotating almost right, just a small part of a corner shows the unrotated picture.
Maybe it has to do with that it enters the HardFault_Handler().
Do you have any working example?
Regards
Dejan
2019-09-03 06:52 AM
There's an example somewhere on this forum, maybe in this post. In any case, it would be different for you because you're on hardware - I've only tested this on the simulator and an F746G-DISCO but the result should be the same. It literally is just a widget that swaps pixels directly in the framebuffer.
Can you create a small example with just a screen and a box in the corner with Mirror as the topmost widget? Then you should see the effects.
/Martin
2019-09-03 10:59 PM
If you have the F746G-DISCO example it would be great. I have this discovery board lying around here.
Somehow my GUI Task gets stuck somewhere. I see that it's partly mirrored except this one corner that has the old state (not mirrored).
Regards
Dejan