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.

141 lines
4.1 KiB

9 months ago
  1. // Change the width and height if required (defined in portrait mode)
  2. // or use the constructor to over-ride defaults
  3. #if defined (ILI9341_DRIVER) || defined (ILI9341_2_DRIVER)
  4. #define TFT_WIDTH 240
  5. #define TFT_HEIGHT 320
  6. #elif defined (ILI9342_DRIVER)
  7. #define TFT_WIDTH 320
  8. #define TFT_HEIGHT 240
  9. #endif
  10. // Color definitions for backwards compatibility with old sketches
  11. // use colour definitions like TFT_BLACK to make sketches more portable
  12. #define ILI9341_BLACK 0x0000 /* 0, 0, 0 */
  13. #define ILI9341_NAVY 0x000F /* 0, 0, 128 */
  14. #define ILI9341_DARKGREEN 0x03E0 /* 0, 128, 0 */
  15. #define ILI9341_DARKCYAN 0x03EF /* 0, 128, 128 */
  16. #define ILI9341_MAROON 0x7800 /* 128, 0, 0 */
  17. #define ILI9341_PURPLE 0x780F /* 128, 0, 128 */
  18. #define ILI9341_OLIVE 0x7BE0 /* 128, 128, 0 */
  19. #define ILI9341_LIGHTGREY 0xC618 /* 192, 192, 192 */
  20. #define ILI9341_DARKGREY 0x7BEF /* 128, 128, 128 */
  21. #define ILI9341_BLUE 0x001F /* 0, 0, 255 */
  22. #define ILI9341_GREEN 0x07E0 /* 0, 255, 0 */
  23. #define ILI9341_CYAN 0x07FF /* 0, 255, 255 */
  24. #define ILI9341_RED 0xF800 /* 255, 0, 0 */
  25. #define ILI9341_MAGENTA 0xF81F /* 255, 0, 255 */
  26. #define ILI9341_YELLOW 0xFFE0 /* 255, 255, 0 */
  27. #define ILI9341_WHITE 0xFFFF /* 255, 255, 255 */
  28. #define ILI9341_ORANGE 0xFD20 /* 255, 165, 0 */
  29. #define ILI9341_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
  30. #define ILI9341_PINK 0xF81F
  31. // Delay between some initialisation commands
  32. #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
  33. // Generic commands used by TFT_eSPI.cpp
  34. #define TFT_NOP 0x00
  35. #define TFT_SWRST 0x01
  36. #define TFT_CASET 0x2A
  37. #define TFT_PASET 0x2B
  38. #define TFT_RAMWR 0x2C
  39. #define TFT_RAMRD 0x2E
  40. #define TFT_IDXRD 0xDD // ILI9341 only, indexed control register read
  41. #define TFT_MADCTL 0x36
  42. #define TFT_MAD_MY 0x80
  43. #define TFT_MAD_MX 0x40
  44. #define TFT_MAD_MV 0x20
  45. #define TFT_MAD_ML 0x10
  46. #define TFT_MAD_BGR 0x08
  47. #define TFT_MAD_MH 0x04
  48. #define TFT_MAD_RGB 0x00
  49. #ifdef TFT_RGB_ORDER
  50. #if (TFT_RGB_ORDER == 1)
  51. #define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
  52. #else
  53. #define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
  54. #endif
  55. #else
  56. #define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
  57. #endif
  58. #define TFT_INVOFF 0x20
  59. #define TFT_INVON 0x21
  60. // All ILI9341 specific commands some are used by init()
  61. #define ILI9341_NOP 0x00
  62. #define ILI9341_SWRESET 0x01
  63. #define ILI9341_RDDID 0x04
  64. #define ILI9341_RDDST 0x09
  65. #define ILI9341_SLPIN 0x10
  66. #define ILI9341_SLPOUT 0x11
  67. #define ILI9341_PTLON 0x12
  68. #define ILI9341_NORON 0x13
  69. #define ILI9341_RDMODE 0x0A
  70. #define ILI9341_RDMADCTL 0x0B
  71. #define ILI9341_RDPIXFMT 0x0C
  72. #define ILI9341_RDIMGFMT 0x0A
  73. #define ILI9341_RDSELFDIAG 0x0F
  74. #define ILI9341_INVOFF 0x20
  75. #define ILI9341_INVON 0x21
  76. #define ILI9341_GAMMASET 0x26
  77. #define ILI9341_DISPOFF 0x28
  78. #define ILI9341_DISPON 0x29
  79. #define ILI9341_CASET 0x2A
  80. #define ILI9341_PASET 0x2B
  81. #define ILI9341_RAMWR 0x2C
  82. #define ILI9341_RAMRD 0x2E
  83. #define ILI9341_PTLAR 0x30
  84. #define ILI9341_VSCRDEF 0x33
  85. #define ILI9341_MADCTL 0x36
  86. #define ILI9341_VSCRSADD 0x37
  87. #define ILI9341_PIXFMT 0x3A
  88. #define ILI9341_WRDISBV 0x51
  89. #define ILI9341_RDDISBV 0x52
  90. #define ILI9341_WRCTRLD 0x53
  91. #define ILI9341_FRMCTR1 0xB1
  92. #define ILI9341_FRMCTR2 0xB2
  93. #define ILI9341_FRMCTR3 0xB3
  94. #define ILI9341_INVCTR 0xB4
  95. #define ILI9341_DFUNCTR 0xB6
  96. #define ILI9341_PWCTR1 0xC0
  97. #define ILI9341_PWCTR2 0xC1
  98. #define ILI9341_PWCTR3 0xC2
  99. #define ILI9341_PWCTR4 0xC3
  100. #define ILI9341_PWCTR5 0xC4
  101. #define ILI9341_VMCTR1 0xC5
  102. #define ILI9341_VMCTR2 0xC7
  103. #define ILI9341_RDID4 0xD3
  104. #define ILI9341_RDINDEX 0xD9
  105. #define ILI9341_RDID1 0xDA
  106. #define ILI9341_RDID2 0xDB
  107. #define ILI9341_RDID3 0xDC
  108. #define ILI9341_RDIDX 0xDD // TBC
  109. #define ILI9341_GMCTRP1 0xE0
  110. #define ILI9341_GMCTRN1 0xE1
  111. #define ILI9341_MADCTL_MY 0x80
  112. #define ILI9341_MADCTL_MX 0x40
  113. #define ILI9341_MADCTL_MV 0x20
  114. #define ILI9341_MADCTL_ML 0x10
  115. #define ILI9341_MADCTL_RGB 0x00
  116. #define ILI9341_MADCTL_BGR 0x08
  117. #define ILI9341_MADCTL_MH 0x04