7

Dependencies:   mbed

Committer:
troshha
Date:
Wed Nov 13 10:28:49 2019 +0000
Revision:
3:9909607749dd
Parent:
0:02841331478b
7

Who changed what in which revision?

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