Update display init command

This commit is contained in:
lewisxhe
2024-07-26 14:22:52 +08:00
parent 36841457bf
commit 6adb8884c6
2 changed files with 116 additions and 109 deletions
+113 -106
View File
@@ -4,8 +4,120 @@
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
//
// See ST7735_Setup.h file for an alternative format
#ifdef INIT_SEQUENCE_2
{
writecommand(ST7789_SLPOUT); // Sleep out
delay(120);
#ifndef INIT_SEQUENCE_3
writecommand(ST7789_NORON); // Normal display mode on
//------------------------------display and color format setting--------------------------------//
writecommand(ST7789_MADCTL);
//writedata(0x00);
writedata(TFT_MAD_COLOR_ORDER);
// JLX240 display datasheet
writecommand(ST7789_COLMOD); //0x3a
writedata(0x55);
delay(10);
//--------------------------------ST7789V Frame rate setting----------------------------------//
writecommand(ST7789_PORCTRL); //b2
writedata(0x0c);
writedata(0x0c);
writedata(0x00);
writedata(0x33);
writedata(0x33);
writecommand(ST7789_GCTRL); //b7 Voltages: VGH / VGL
writedata(0x75);
//---------------------------------ST7789V Power setting--------------------------------------//
writecommand(ST7789_VCOMS); //0xbb
writedata(0x1a); // JLX240 display datasheet
writecommand(ST7789_LCMCTRL); //c0
writedata(0x2c);
writecommand(ST7789_VDVVRHEN); //c2
writedata(0x01);
writecommand(ST7789_VRHS); //c3 voltage VRHS
writedata(0x13);
writecommand(ST7789_VDVSET); //c4
writedata(0x20);
writecommand(ST7789_FRCTR2); //c6
writedata(0x0f);
writecommand(ST7789_PWCTRL1); //d0
writedata(0xa4);
writedata(0xa1);
//--------------------------------ST7789V gamma setting---------------------------------------//
writecommand(ST7789_PVGAMCTRL); //e0
writedata(0xd0);
writedata(0x0D);
writedata(0x14);
writedata(0x0D);
writedata(0x0D);
writedata(0x09);
writedata(0x38);
writedata(0x44);
writedata(0x4E);
writedata(0x3A);
writedata(0x17);
writedata(0x18);
writedata(0x2F);
writedata(0x30);
writecommand(ST7789_NVGAMCTRL); //e1
writedata(0xd0);
writedata(0x09);
writedata(0x0F);
writedata(0x08);
writedata(0x07);
writedata(0x14);
writedata(0x37);
writedata(0x44);
writedata(0x4D);
writedata(0x38);
writedata(0x15);
writedata(0x16);
writedata(0x2C);
writedata(0x3E);
writecommand(ST7789_INVON); //21
writecommand(ST7789_CASET); // Column address set
writedata(0x00);
writedata(0x00);
writedata(0x00);
writedata(0xEF); // 239
writecommand(ST7789_RASET); // Row address set
writedata(0x00);
writedata(0x00);
writedata(0x01);
writedata(0x3F); // 319
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
end_tft_write();
delay(120);
begin_tft_write();
writecommand(ST7789_DISPON); //Display on
delay(120);
#ifdef TFT_BL
// Turn on the back-light LED
digitalWrite(TFT_BL, HIGH);
pinMode(TFT_BL, OUTPUT);
#endif
}
#else
{
writecommand(ST7789_SLPOUT); // Sleep out
delay(120);
@@ -129,109 +241,4 @@
}
#else
// TTGO ESP32 S3 T-Display
{
writecommand(ST7789_SLPOUT); // Sleep out
delay(120);
writecommand(ST7789_NORON); // Normal display mode on
//------------------------------display and color format setting--------------------------------//
writecommand(ST7789_MADCTL);
writedata(TFT_MAD_COLOR_ORDER);
// writecommand(ST7789_RAMCTRL);
// writedata(0x00);
// writedata(0xE0); // 5 to 6 bit conversion: r0 = r5, b0 = b5
writecommand(ST7789_COLMOD);
writedata(0x55);
delay(10);
//--------------------------------ST7789V Frame rate setting----------------------------------//
writecommand(ST7789_PORCTRL);
writedata(0x0b);
writedata(0x0b);
writedata(0x00);
writedata(0x33);
writedata(0x33);
writecommand(ST7789_GCTRL); // Voltages: VGH / VGL
writedata(0x75);
//---------------------------------ST7789V Power setting--------------------------------------//
writecommand(ST7789_VCOMS);
writedata(0x28); // JLX240 display datasheet
writecommand(ST7789_LCMCTRL);
writedata(0x2C);
writecommand(ST7789_VDVVRHEN);
writedata(0x01);
writecommand(ST7789_VRHS); // voltage VRHS
writedata(0x1F);
writecommand(ST7789_FRCTR2);
writedata(0x13);
writecommand(ST7789_PWCTRL1);
writedata(0xa7);
writecommand(ST7789_PWCTRL1);
writedata(0xa4);
writedata(0xa1);
writecommand(0xD6);
writedata(0xa1);
//--------------------------------ST7789V gamma setting---------------------------------------//
writecommand(ST7789_PVGAMCTRL);
writedata(0xf0);
writedata(0x05);
writedata(0x0a);
writedata(0x06);
writedata(0x06);
writedata(0x03);
writedata(0x2b);
writedata(0x32);
writedata(0x43);
writedata(0x36);
writedata(0x11);
writedata(0x10);
writedata(0x2b);
writedata(0x32);
writecommand(ST7789_NVGAMCTRL);
writedata(0xf0);
writedata(0x08);
writedata(0x0c);
writedata(0x0b);
writedata(0x09);
writedata(0x24);
writedata(0x2b);
writedata(0x22);
writedata(0x43);
writedata(0x38);
writedata(0x15);
writedata(0x16);
writedata(0x2f);
writedata(0x37);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
end_tft_write();
delay(120);
begin_tft_write();
writecommand(ST7789_DISPON); //Display on
delay(120);
#ifdef TFT_BL
// Turn on the back-light LED
digitalWrite(TFT_BL, HIGH);
pinMode(TFT_BL, OUTPUT);
#endif
}
#endif
@@ -8,9 +8,9 @@
// #define CGRAM_OFFSET // Library will add offsets required
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define INIT_SEQUENCE_2 //Different gamma values
// #define TFT_INVERSION_ON
// #define TFT_INVERSION_OFF //For the first sample of T-Deck need to turn on color inversion