Hi ,
I am using a 3.5 TFT LCD. The driver name mentioned on backside of the TFT display is ILI9488.
After running below code, it is showing the text as mirrored.
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
MCUFRIEND_kbv tft;
void setup() {
// Reading TFT ID:
uint16_t ID=tft.readID();
Serial.begin(9600);
Serial.println(ID);
tft.begin(ID);
}
void loop() {
tft.invertDisplay(false);
// Fill TFT Screen with a color:
tft.fillScreen(BLACK);
//Set cursor:
tft.setCursor(80,25);
//Set text size:
tft.setTextSize(5);
//Print text to TFT display:
//tft.WriteCmdData(0x3A,0x66); // tried changing this to random values,didnt help
//tft.setRotation(0);
tft.println("SAMPLE");
delay(20000);
}
That is one of the problems with using a no-name display. The Adafruit GFX library works fine for the displays Adafruit sells, which are competitively priced and guaranteed to work as advertised.
Here is the section of code (from the GFX library) to write out the character bits from the font data base. It is certainly possibly to make this work with yours. It is simply a matter of programmatically reversing the X direction on the display.
for (int8_t i = 0; i < 5; i++) { // Char bitmap = 5 columns
uint8_t line = pgm_read_byte(&font[c * 5 + i]);
for (int8_t j = 0; j < 8; j++, line >>= 1) {
if (line & 1) {
if (size_x == 1 && size_y == 1)
writePixel(x + i, y + j, color);
else
writeFillRect(x + i * size_x, y + j * size_y, size_x, size_y,
color);
} else if (bg != color) {
if (size_x == 1 && size_y == 1)
writePixel(x + i, y + j, bg);
else
writeFillRect(x + i * size_x, y + j * size_y, size_x, size_y, bg);
}
}
}
I think it has to do with data entry modes.
See MCUFriend_kbv line 359: void MCUFRIEND_kbv::setRotation(uint8_t r) ff.
Seems you need either INVERT_GS or INVERT_SS.
But I am not really familiar with this library.
Added:
What ID does MVUFriend_kbv report in Serial Monitor?
Could you provide a link to where you bought your display? Or post a picture of the backside?
Try to add INVERT_GS at line 2877:
case 0x9488:
_lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS;
to
case 0x9488:
_lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | INVERT_GS;
Thanks, it is working now.. I have made the code change given below
Thank you..it is working now..