cancel
Showing results for 
Search instead for 
Did you mean: 

Resource text colours in TouchGFX V4.18.

Water123
Associate II

I have previously used V4.12 for projects and have been able to set Resouce Text to any colour. After upgrading to V4.18 the text colours can be set in Designer but on the target they seem to be limited to the primary colours and their combinations (three colour bits per pixel). How to I get the full range of RGB565 colours to be used with resource text on 4.18? I tried 4.18.1 and it made no difference. I am using the IAR IDE.

1 ACCEPTED SOLUTION

Accepted Solutions
Water123
Associate II

I was hoping that somebody else could confirm that this is an issue.

As a work around I have set up a macro to convert the RGB colour values into 565, to replace the use of setColorFromRGB():

#define M_TextColour(x, y, z) (uint32_t)( ( (x << 😎 & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) ) /* Convert RGB to the colour value used by text resources */

This makes the text display correctly.

View solution in original post

13 REPLIES 13
Alexandre RENOUX
Principal

Hello Water123,

How did you figure out that on target only primary colors are possible for the text color ?

Are you sure it is not a problem on display side ?

With your current hardware, you see a certain text color with 4.12 but with 4.18 the text color is different even though the color set in the code is the same, is that right ?

/Alexandre

Water123
Associate II

If I use a colour code in TouchGFX for a shape or line the colour displays correctly; if I use resource text, the same colour code does not display correctly. After some investigation it appears that setColor for text has to have the colour setting in RGB565 to work correctly with my 565 hardware.

Alexandre RENOUX
Principal

Hello Water123,

So if I understand correctly you found a workaround to your issue right ?

If that's the case, could you add the code you modified/added to fix your issue ?

Also, if your problem is solved, please close this topic by choosing Select as Best on your answer ^^

/Alexandre

Water123
Associate II

I was hoping that somebody else could confirm that this is an issue.

As a work around I have set up a macro to convert the RGB colour values into 565, to replace the use of setColorFromRGB():

#define M_TextColour(x, y, z) (uint32_t)( ( (x << 😎 & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) ) /* Convert RGB to the colour value used by text resources */

This makes the text display correctly.

Hi

my textcolor doent show the true color too. HW is 565. would you tell me where to add the micro you ve written (#define M_TextColour(x, y, z) (uint32_t)( ( (x << 😎 & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) ) /* Convert RGB to the colour value used by text resources */)

how to replace it with setColorFromRGB().?

Hi Water123,

In order to reproduce and get it fixed, could you provide the steps needed to see the issue ? Otherwise an example project would be also very useful :D

What is your target board ?

Thank you very much for your feedback ~

/Alexandre

Water123
Associate II

Zakba. 1

Add this macro definition somewhere in the same file as the call to set the colour or in an include file that is used by the file:

#define TextColourConvert(x, y, z) (uint32_t)( ( (x << 😎 & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) )

I use a global include file containing a variety of system-wide definitions that is included in every .c and .cpp file.

Where you would normally define the text colour with:

Text.setColor(touchgfx::Color::getColorFromRGB(ColourR, ColourG, ColourB) );

Use this instead:

Text.setColor(TextColourConvert(ColourR, ColourG, ColourB) );

Replacing ColourR, ColourG and ColourB with the colour co-ordinates you want to use.

This should make your test display in the correct colour.

Water123
Associate II

Alexandre RENOUX

The hardware used is a custom system using an STM32L4R7 driving the LCD through the on-board controller and graphics accellerator, connected using the 565 implementation of the RGB bus; the graphics controller was set up using MX-Cube. We originally used the 429 disco board to develop ideas so I expect the issue will show up using this board also.

In TouchGFX designer (V4.18) create a screen that inclues some resource text in a colour that is not white; I found the issue using 121, 227, 255. In the generated code the colour is set using:

Text.setColor(touchgfx::Color::getColorFromRGB(121, 227, 255) );

In designer the text displays as the correct colour. but on the hardware when the code is run, the text displays as a purple colour. Other screen elements such as lines and shapes display in the correct colour, I have only found the problem with resource text.

As explained above getColorFromRGB() returns a 24-bit colour value while setColor() for the text appears to require a 16-bit (565) colour value, for 565 systems. Replacing the call to getColorFromRGB() with the macro above solves the problem.

I can share more detail on this if you require it.

Hello Water123,

I managed to reproduce the issue on the F429-DISCO Rev C01.

I will report to the dev team and let you know when it's fixed.

It's probably a board specific issue since on the F746-DISCO the problem does not occur.

Sorry for the inconvenience,

/Alexandre