Commit f7e9a91e authored by Bodmer's avatar Bodmer

Fix #1800 Fix #1793

Added offsets for 170x320 ST7789 display
Added offsets for 240x280 display to ST7789_2 dirver
parent 79b41bc8
...@@ -20,6 +20,26 @@ ...@@ -20,6 +20,26 @@
#endif #endif
#endif #endif
// Adafruit 1.69 round corner TFT support
#if (TFT_HEIGHT == 280) && (TFT_WIDTH == 240)
#ifndef CGRAM_OFFSET
#define CGRAM_OFFSET
#endif
#endif
// 1.47" 172x320 Round Rectangle Color IPS TFT Display
#if (TFT_HEIGHT == 320) && (TFT_WIDTH == 172)
#ifndef CGRAM_OFFSET
#define CGRAM_OFFSET
#endif
#endif
#if (TFT_HEIGHT == 300) && (TFT_WIDTH == 240)
#ifndef CGRAM_OFFSET
#define CGRAM_OFFSET
#endif
#endif
// Delay between some initialisation commands // Delay between some initialisation commands
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
......
...@@ -10,6 +10,161 @@ ...@@ -10,6 +10,161 @@
colstart = 52; colstart = 52;
rowstart = 40; rowstart = 40;
} }
else if(_init_height == 280)
{
colstart = 0;
rowstart = 20;
}
else if(_init_width == 172)
{
colstart = 34;
rowstart = 0;
}
else if(_init_width == 170)
{
colstart = 35;
rowstart = 0;
}
else
{
colstart = 0;
rowstart = 0;
}
#endif
writedata(TFT_MAD_COLOR_ORDER);
_width = _init_width;
_height = _init_height;
break;
case 1: // Landscape (Portrait + 90)
#ifdef CGRAM_OFFSET
if (_init_width == 135)
{
colstart = 40;
rowstart = 53;
}
else if(_init_height == 280)
{
colstart = 20;
rowstart = 0;
}
else if(_init_width == 172)
{
colstart = 0;
rowstart = 34;
}
else if(_init_width == 170)
{
colstart = 0;
rowstart = 35;
}
else
{
colstart = 0;
rowstart = 0;
}
#endif
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
_width = _init_height;
_height = _init_width;
break;
case 2: // Inverter portrait
#ifdef CGRAM_OFFSET
if (_init_width == 135)
{
colstart = 53;
rowstart = 40;
}
else if(_init_height == 280)
{
colstart = 0;
rowstart = 20;
}
else if(_init_width == 172)
{
colstart = 34;
rowstart = 0;
}
else if(_init_width == 170)
{
colstart = 35;
rowstart = 0;
}
else
{
colstart = 0;
rowstart = 80;
}
#endif
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
_width = _init_width;
_height = _init_height;
break;
case 3: // Inverted landscape
#ifdef CGRAM_OFFSET
if (_init_width == 135)
{
colstart = 40;
rowstart = 52;
}
else if(_init_height == 280)
{
colstart = 20;
rowstart = 0;
}
else if(_init_width == 172)
{
colstart = 0;
rowstart = 34;
}
else if(_init_width == 170)
{
colstart = 0;
rowstart = 35;
}
else
{
colstart = 80;
rowstart = 0;
}
#endif
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
_width = _init_height;
_height = _init_width;
break;
}
// This is the command sequence that rotates the ST7789 driver coordinate frame
writecommand(TFT_MADCTL);
rotation = m % 4;
switch (rotation) {
case 0: // Portrait
#ifdef CGRAM_OFFSET
if (_init_width == 135)
{
colstart = 52;
rowstart = 40;
}
else if(_init_height == 280)
{
colstart = 0;
rowstart = 20;
}
else if(_init_width == 172)
{
colstart = 34;
rowstart = 0;
}
else if(_init_width == 170)
{
colstart = 35;
rowstart = 0;
}
else else
{ {
colstart = 0; colstart = 0;
...@@ -29,6 +184,21 @@ ...@@ -29,6 +184,21 @@
colstart = 40; colstart = 40;
rowstart = 53; rowstart = 53;
} }
else if(_init_height == 280)
{
colstart = 20;
rowstart = 0;
}
else if(_init_width == 172)
{
colstart = 0;
rowstart = 34;
}
else if(_init_width == 170)
{
colstart = 0;
rowstart = 35;
}
else else
{ {
colstart = 0; colstart = 0;
...@@ -48,6 +218,21 @@ ...@@ -48,6 +218,21 @@
colstart = 53; colstart = 53;
rowstart = 40; rowstart = 40;
} }
else if(_init_height == 280)
{
colstart = 0;
rowstart = 20;
}
else if(_init_width == 172)
{
colstart = 34;
rowstart = 0;
}
else if(_init_width == 170)
{
colstart = 35;
rowstart = 0;
}
else else
{ {
colstart = 0; colstart = 0;
...@@ -66,6 +251,21 @@ ...@@ -66,6 +251,21 @@
colstart = 40; colstart = 40;
rowstart = 52; rowstart = 52;
} }
else if(_init_height == 280)
{
colstart = 20;
rowstart = 0;
}
else if(_init_width == 172)
{
colstart = 0;
rowstart = 34;
}
else if(_init_width == 170)
{
colstart = 0;
rowstart = 35;
}
else else
{ {
colstart = 80; colstart = 80;
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
#endif #endif
#endif #endif
#if (TFT_HEIGHT == 300) && (TFT_WIDTH == 240)
#ifndef CGRAM_OFFSET
#define CGRAM_OFFSET
#endif
#endif
// Delay between some initialisation commands // Delay between some initialisation commands
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
colstart = 34; colstart = 34;
rowstart = 0; rowstart = 0;
} }
else if(_init_width == 170)
{
colstart = 35;
rowstart = 0;
}
else else
{ {
colstart = 0; colstart = 0;
...@@ -49,6 +54,11 @@ ...@@ -49,6 +54,11 @@
colstart = 0; colstart = 0;
rowstart = 34; rowstart = 34;
} }
else if(_init_width == 170)
{
colstart = 0;
rowstart = 35;
}
else else
{ {
colstart = 0; colstart = 0;
...@@ -78,6 +88,11 @@ ...@@ -78,6 +88,11 @@
colstart = 34; colstart = 34;
rowstart = 0; rowstart = 0;
} }
else if(_init_width == 170)
{
colstart = 35;
rowstart = 0;
}
else else
{ {
colstart = 0; colstart = 0;
...@@ -106,6 +121,11 @@ ...@@ -106,6 +121,11 @@
colstart = 0; colstart = 0;
rowstart = 34; rowstart = 34;
} }
else if(_init_width == 170)
{
colstart = 0;
rowstart = 35;
}
else else
{ {
colstart = 80; colstart = 80;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment