PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TFT_ILI9163C_settings.h 4.1KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef _TFT_ILI9163C_USETT_H_
  2. #define _TFT_ILI9163C_USETT_H_
  3. //DID YOU HAVE A RED PCB, BLACk PCB or WHAT DISPLAY TYPE????????????
  4. // ---> SELECT HERE <----
  5. #define __144_RED_PCB__//128x128
  6. //#define __144_BLACK_PCB__//128x128
  7. //#define __22_RED_PCB__//240x320
  8. //---------------------------------------
  9. #if defined(__144_RED_PCB__)
  10. /*
  11. This display:
  12. http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-Color-TFT-LCD-Display-Module-/271422122271
  13. This particular display has a design error! The controller has 3 pins to configure to constrain
  14. the memory and resolution to a fixed dimension (in that case 128x128) but they leaved those pins
  15. configured for 128x160 so there was several pixel memory addressing problems.
  16. I solved by setup several parameters that dinamically fix the resolution as needed so below
  17. the parameters for this diplay. If you have a strain or a correct display (can happen with chinese)
  18. you can copy those parameters and create setup for different displays.
  19. */
  20. #define _TFTWIDTH 128//the REAL W resolution of the TFT
  21. #define _TFTHEIGHT 128//the REAL H resolution of the TFT
  22. #define _GRAMWIDTH 128
  23. #define _GRAMHEIGH 160//160
  24. #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH//*see note 1
  25. #define __COLORSPC 1// 1:GBR - 0:RGB
  26. #define __GAMMASET3 //uncomment for another gamma
  27. #define __OFFSET 32//*see note 2
  28. //Tested!
  29. #elif defined (__144_BLACK_PCB__)
  30. #define _TFTWIDTH 128//the REAL W resolution of the TFT
  31. #define _TFTHEIGHT 128//the REAL H resolution of the TFT
  32. #define _GRAMWIDTH 128
  33. #define _GRAMHEIGH 128
  34. #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH//*see note 1
  35. #define __COLORSPC 1// 1:GBR - 0:RGB
  36. #define __GAMMASET1 //uncomment for another gamma
  37. #define __OFFSET 0
  38. //not tested
  39. #elif defined (__22_RED_PCB__)
  40. /*
  41. Like this one:
  42. http://www.ebay.it/itm/2-2-Serial-SPI-TFT-LCD-Display-Module-240x320-Chip-ILI9340C-PCB-Adapter-SD-Card-/281304733556
  43. Not tested!
  44. */
  45. #define _TFTWIDTH 240//the REAL W resolution of the TFT
  46. #define _TFTHEIGHT 320//the REAL H resolution of the TFT
  47. #define _GRAMWIDTH 240
  48. #define _GRAMHEIGH 320
  49. #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH
  50. #define __COLORSPC 1// 1:GBR - 0:RGB
  51. #define __GAMMASET1 //uncomment for another gamma
  52. #define __OFFSET 0
  53. #else
  54. #define _TFTWIDTH 128//128
  55. #define _TFTHEIGHT 160//160
  56. #define _GRAMWIDTH 128
  57. #define _GRAMHEIGH 160
  58. #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH
  59. #define __COLORSPC 1// 1:GBR - 0:RGB
  60. #define __GAMMASET1
  61. #define __OFFSET 0
  62. #endif
  63. #if defined(__GAMMASET1)
  64. const uint8_t pGammaSet[15]= {0x36,0x29,0x12,0x22,0x1C,0x15,0x42,0xB7,0x2F,0x13,0x12,0x0A,0x11,0x0B,0x06};
  65. const uint8_t nGammaSet[15]= {0x09,0x16,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x34,0x39};
  66. #elif defined(__GAMMASET2)
  67. const uint8_t pGammaSet[15]= {0x3F,0x21,0x12,0x22,0x1C,0x15,0x42,0xB7,0x2F,0x13,0x02,0x0A,0x01,0x00,0x00};
  68. const uint8_t nGammaSet[15]= {0x09,0x18,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x24,0x29};
  69. #elif defined(__GAMMASET3)
  70. const uint8_t pGammaSet[15]= {0x3F,0x26,0x23,0x30,0x28,0x10,0x55,0xB7,0x40,0x19,0x10,0x1E,0x02,0x01,0x00};
  71. const uint8_t nGammaSet[15]= {0x09,0x18,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x24,0x29};
  72. #else
  73. const uint8_t pGammaSet[15]= {0x3F,0x25,0x1C,0x1E,0x20,0x12,0x2A,0x90,0x24,0x11,0x00,0x00,0x00,0x00,0x00};
  74. const uint8_t nGammaSet[15]= {0x20,0x20,0x20,0x20,0x05,0x15,0x00,0xA7,0x3D,0x18,0x25,0x2A,0x2B,0x2B,0x3A};
  75. #endif
  76. /*
  77. Note 1: The __144_RED_PCB__ display has hardware addressing of 128 x 160
  78. but the tft resolution it's 128 x 128 so the dram should be set correctly
  79. Note 2: This is the offset between image in RAM and TFT. In that case 160 - 128 = 32;
  80. */
  81. #endif
  82. /*
  83. Benchmark Time (microseconds)
  84. Screen fill 74698
  85. Text 4253
  86. Text2 15366
  87. Lines 16034
  88. Horiz/Vert Lines 5028
  89. Rectangles (outline) 4183
  90. Rectangles (filled) 91226
  91. Circles (filled) 14436
  92. Circles (outline) 14910
  93. Triangles (outline) 5069
  94. Triangles (filled) 30717
  95. Rounded rects (outline) 9910
  96. Rounded rects (filled) 99550
  97. Done!
  98. */