diff --git a/TFT_Drivers/ILI9163_Defines.h b/TFT_Drivers/ILI9163_Defines.h index 4abaa1d..0aa230c 100644 --- a/TFT_Drivers/ILI9163_Defines.h +++ b/TFT_Drivers/ILI9163_Defines.h @@ -7,10 +7,6 @@ #define TFT_HEIGHT 160 #endif -#if (TFT_HEIGHT == 128) && (TFT_WIDTH == 128) - #define CGRAM_OFFSET -#endif - // Color definitions for backwards compatibility with old sketches // use colour definitions like TFT_BLACK to make sketches more portable #define ILI9163_BLACK 0x0000 /* 0, 0, 0 */ diff --git a/TFT_Drivers/ILI9163_Rotation.h b/TFT_Drivers/ILI9163_Rotation.h index 7232430..eebfea5 100644 --- a/TFT_Drivers/ILI9163_Rotation.h +++ b/TFT_Drivers/ILI9163_Rotation.h @@ -9,36 +9,48 @@ writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR); _width = _width_orig; _height = _height_orig; - #ifdef CGRAM_OFFSET +#if CGRAM_OFFSET == OFFSET_FROM_START + colstart = 0; + rowstart = 32; +#else colstart = 0; rowstart = 0; - #endif +#endif break; case 1: writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR); _width = _height_orig; _height = _width_orig; - #ifdef CGRAM_OFFSET - colstart = 0; - rowstart = 0; - #endif +#if CGRAM_OFFSET == OFFSET_FROM_START + colstart = 32; + rowstart = 0; +#else + colstart = 0; + rowstart = 0; +#endif break; case 2: writedata(TFT_MAD_BGR); _width = _width_orig; _height = _height_orig; - #ifdef CGRAM_OFFSET - colstart = 0; - rowstart = 32; - #endif +#if CGRAM_OFFSET == OFFSET_FROM_START + colstart = 0; + rowstart = 0; +#else + colstart = 0; + rowstart = 32; +#endif break; case 3: writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR); _width = _height_orig; _height = _width_orig; - #ifdef CGRAM_OFFSET - colstart = 32; - rowstart = 0; - #endif +#if CGRAM_OFFSET == OFFSET_FROM_START + colstart = 0; + rowstart = 0; +#else + colstart = 32; + rowstart = 0; +#endif break; } diff --git a/User_Setups/Setup8_ILI9163_128x128.h b/User_Setups/Setup8_ILI9163_128x128.h index f5d6607..a273d18 100644 --- a/User_Setups/Setup8_ILI9163_128x128.h +++ b/User_Setups/Setup8_ILI9163_128x128.h @@ -20,9 +20,15 @@ // For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation #define TFT_WIDTH 128 -//#define TFT_HEIGHT 160 #define TFT_HEIGHT 128 +// There are two variants of 128x128 IL9163. One has CGRAM offset due to unused 32 lines on the beginning of the memory, and one on the end +// If You see that your screen is shifted by 32 pixel change to other setting +#ifndef CGRAM_OFFSET + //#define CGRAM_OFFSET OFFSET_FROM_START + #define CGRAM_OFFSET OFFSET_FROM_END +#endif +// // ################################################################################## // // Section 1. Define the pins that are used to interface with the display here