Arctic_Eddie
Well-known member
I have a T4.1 and the 3.5" color touch display from PJRC. Using the ILI9341_t3 and XPT2046 libraries gives me the proper colors and touch action. I can use the color generator method and get what I expect. However, when using the ILI9341_T4 library, the colors come out wrong. An attempt to get dark gray comes out purple. Using a power of two gives an entirely different color than the some number minus 1. I pulled a color generator function from an earlier project using the same display and a T3.2 and it produces the right colors. The ILI9341_T4 library seems to have a bug in the color generation. My color generator code is shown below. An example generating dark gray with both methods produces the expected result with mine but total white with the other. There are other problems with this library to be posted separately, namely touch value stability.
Code:
// Examples of the problem
#define DARKGRAY1 Color8To5(63,63,63)
#define DARKGRAY2 RGB565(63,63,63)
RGB565 Color8To5( uint16_t r, uint16_t g, uint16_t b )
{
// Convert 888 color to 565 color
uint16_t c565;
//c565 = ((r / 8) << 11) | ((g / 4) << 5) | (b / 8);
c565 = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
return c565;
}