From 3ad082039061a9620171493e0cc666857c7fbfd1 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Mon, 30 Jul 2018 12:08:02 -0500 Subject: [PATCH] adds support for 160x80 ebay module unknown module 160x80 BGR inverted, offset 26 differs from adafruit of same size --- TFT_Drivers/ST7735_Defines.h | 5 +++++ TFT_Drivers/ST7735_Init.h | 7 +++++++ TFT_Drivers/ST7735_Rotation.h | 16 ++++++++++++++++ User_Setups/SetupX_Template.h | 2 ++ 4 files changed, 30 insertions(+) diff --git a/TFT_Drivers/ST7735_Defines.h b/TFT_Drivers/ST7735_Defines.h index 5fe2662..35e9659 100644 --- a/TFT_Drivers/ST7735_Defines.h +++ b/TFT_Drivers/ST7735_Defines.h @@ -15,6 +15,7 @@ #define INITR_GREENTAB2 0x3 // Use if you get random pixels on two edges of green tab display #define INITR_GREENTAB3 0x4 // Use if you get random pixels on edge(s) of 128x128 screen #define INITR_GREENTAB128 0x5 // Use if you only get part of 128x128 screen in rotation 0 & 1 +#define INITR_GREENTAB160x80 0x6 // Use if you only get part of 128x128 screen in rotation 0 & 1 #define INITB 0xB @@ -38,6 +39,10 @@ #define TAB_COLOUR INITR_GREENTAB128 #define CGRAM_OFFSET +#elif defined (ST7735_GREENTAB160x80) + #define TAB_COLOUR INITR_GREENTAB160x80 + #define CGRAM_OFFSET + #elif defined (ST7735_REDTAB) #define TAB_COLOUR INITR_REDTAB diff --git a/TFT_Drivers/ST7735_Init.h b/TFT_Drivers/ST7735_Init.h index 0df152c..3eef1d9 100644 --- a/TFT_Drivers/ST7735_Init.h +++ b/TFT_Drivers/ST7735_Init.h @@ -173,6 +173,13 @@ colstart = 0; rowstart = 32; } + else if (tabcolor == INITR_GREENTAB160x80) + { + commandList(Rcmd2green); + writecommand(TFT_INVON); + colstart = 26; + rowstart = 1; + } else if (tabcolor == INITR_REDTAB) { commandList(Rcmd2red); diff --git a/TFT_Drivers/ST7735_Rotation.h b/TFT_Drivers/ST7735_Rotation.h index b9476a1..89701f7 100644 --- a/TFT_Drivers/ST7735_Rotation.h +++ b/TFT_Drivers/ST7735_Rotation.h @@ -20,6 +20,10 @@ writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_BGR); colstart = 0; rowstart = 32; + } else if(tabcolor == INITR_GREENTAB160x80) { + writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_BGR); + colstart = 26; + rowstart = 1; } else if(tabcolor == INITB) { writedata(TFT_MAD_MX | TFT_MAD_RGB); } else { @@ -43,6 +47,10 @@ writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR); colstart = 32; rowstart = 0; + } else if(tabcolor == INITR_GREENTAB160x80) { + writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR); + colstart = 1; + rowstart = 26; } else if(tabcolor == INITB) { writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB); } else { @@ -66,6 +74,10 @@ writedata(TFT_MAD_BGR); colstart = 0; rowstart = 0; + } else if(tabcolor == INITR_GREENTAB160x80) { + writedata(TFT_MAD_BGR); + colstart = 0; + rowstart = 0; } else if(tabcolor == INITB) { writedata(TFT_MAD_MY | TFT_MAD_RGB); } else { @@ -89,6 +101,10 @@ writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR); colstart = 0; rowstart = 0; + } else if(tabcolor == INITR_GREENTAB160x80) { + writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR); + colstart = 1; + rowstart = 26; } else if(tabcolor == INITB) { writedata(TFT_MAD_MV | TFT_MAD_RGB); } else { diff --git a/User_Setups/SetupX_Template.h b/User_Setups/SetupX_Template.h index 8b22cbc..f321517 100644 --- a/User_Setups/SetupX_Template.h +++ b/User_Setups/SetupX_Template.h @@ -24,6 +24,7 @@ //#define M5STACK // For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation +//#define TFT_WIDTH 80 //#define TFT_WIDTH 128 //#define TFT_HEIGHT 160 //#define TFT_HEIGHT 128 @@ -40,6 +41,7 @@ //#define ST7735_GREENTAB2 //#define ST7735_GREENTAB3 //#define ST7735_GREENTAB128 // For 128 x 128 display +//#define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset) //#define ST7735_REDTAB //#define ST7735_BLACKTAB