Update for WROVER to address #232
The library supported 240x240 ST7789 displays only which require an 80 pixel offset in rotation 2 and 3 The library now also supports the 240x320 display which has a different RGB colour order.
This commit is contained in:
1 parent
8d29c396e3
commit
cbc2e66dfd
7 files changed
+112
-45
No files matched your search
@@ -7,7 +7,9 @@
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
#if (TFT_HEIGHT == 240) && (TFT_WIDTH == 240)
|
||||
#define CGRAM_OFFSET
|
||||
#endif
|
||||
|
||||
// Delay between some initialisation commands
|
||||
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
//------------------------------display and color format setting--------------------------------//
|
||||
writecommand(ST7789_MADCTL);
|
||||
writedata(0x00);
|
||||
writedata(0x48);
|
||||
#ifdef CGRAM_OFFSET
|
||||
writedata(0x48); // BGR colour order for 240 x 240 TFT
|
||||
#else
|
||||
writedata(0x40); // RGB colour order for 240 x 320 TFT (Issue #232)
|
||||
#endif
|
||||
|
||||
|
||||
// JLX240 display datasheet
|
||||
writecommand(0xB6);
|
||||
@@ -114,7 +119,9 @@
|
||||
|
||||
writecommand(ST7789_DISPON); //Display on
|
||||
|
||||
#ifdef TFT_BL
|
||||
// Turn on the back-light LED
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
#endif
|
||||
}
|
||||
@@ -7,28 +7,36 @@
|
||||
writedata(TFT_MAD_RGB);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_RGB);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
break;
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
break;
|
||||
case 2: // Inverter portrait
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
colstart = 0;
|
||||
rowstart = 80;
|
||||
break;
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 80;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_RGB);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
colstart = 80;
|
||||
rowstart = 0;
|
||||
break;
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 80;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
Reference in new issue
Block a user