16 #ifndef _ADAFRUIT_ILI9341H_
17 #define _ADAFRUIT_ILI9341H_
25 #include <Adafruit_GFX.h>
29 #include <avr/pgmspace.h>
32 #define ILI9341_TFTWIDTH 240
33 #define ILI9341_TFTHEIGHT 320
35 #define ILI9341_NOP 0x00
36 #define ILI9341_SWRESET 0x01
37 #define ILI9341_RDDID 0x04
38 #define ILI9341_RDDST 0x09
40 #define ILI9341_SLPIN 0x10
41 #define ILI9341_SLPOUT 0x11
42 #define ILI9341_PTLON 0x12
43 #define ILI9341_NORON 0x13
45 #define ILI9341_RDMODE 0x0A
46 #define ILI9341_RDMADCTL 0x0B
47 #define ILI9341_RDPIXFMT 0x0C
48 #define ILI9341_RDIMGFMT 0x0D
49 #define ILI9341_RDSELFDIAG 0x0F
51 #define ILI9341_INVOFF 0x20
52 #define ILI9341_INVON 0x21
53 #define ILI9341_GAMMASET 0x26
54 #define ILI9341_DISPOFF 0x28
55 #define ILI9341_DISPON 0x29
57 #define ILI9341_CASET 0x2A
58 #define ILI9341_PASET 0x2B
59 #define ILI9341_RAMWR 0x2C
60 #define ILI9341_RAMRD 0x2E
62 #define ILI9341_PTLAR 0x30
63 #define ILI9341_MADCTL 0x36
64 #define ILI9341_PIXFMT 0x3A
66 #define ILI9341_FRMCTR1 0xB1
67 #define ILI9341_FRMCTR2 0xB2
68 #define ILI9341_FRMCTR3 0xB3
69 #define ILI9341_INVCTR 0xB4
70 #define ILI9341_DFUNCTR 0xB6
72 #define ILI9341_PWCTR1 0xC0
73 #define ILI9341_PWCTR2 0xC1
74 #define ILI9341_PWCTR3 0xC2
75 #define ILI9341_PWCTR4 0xC3
76 #define ILI9341_PWCTR5 0xC4
77 #define ILI9341_VMCTR1 0xC5
78 #define ILI9341_VMCTR2 0xC7
80 #define ILI9341_RDID1 0xDA
81 #define ILI9341_RDID2 0xDB
82 #define ILI9341_RDID3 0xDC
83 #define ILI9341_RDID4 0xDD
85 #define ILI9341_GMCTRP1 0xE0
86 #define ILI9341_GMCTRN1 0xE1
93 #define ILI9341_BLACK 0x0000
94 #define ILI9341_NAVY 0x000F
95 #define ILI9341_DARKGREEN 0x03E0
96 #define ILI9341_DARKCYAN 0x03EF
97 #define ILI9341_MAROON 0x7800
98 #define ILI9341_PURPLE 0x780F
99 #define ILI9341_OLIVE 0x7BE0
100 #define ILI9341_LIGHTGREY 0xC618
101 #define ILI9341_DARKGREY 0x7BEF
102 #define ILI9341_BLUE 0x001F
103 #define ILI9341_GREEN 0x07E0
104 #define ILI9341_LIGHTBLUE 0x061F
105 #define ILI9341_CYAN 0x07FF
106 #define ILI9341_RED 0xF800
107 #define ILI9341_MAGENTA 0xF81F
108 #define ILI9341_YELLOW 0xFFE0
109 #define ILI9341_WHITE 0xFFFF
110 #define ILI9341_ORANGE 0xFD20
111 #define ILI9341_GREENYELLOW 0xAFE5
112 #define ILI9341_PINK 0xF81F
126 int8_t _RST, int8_t _MISO);
128 #if defined(USE_HW_CS) || defined(USE_NO_CS)
134 setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1),
135 pushColor(uint16_t color),
136 fillScreen(uint16_t color),
137 drawPixel(int16_t x, int16_t y, uint16_t color),
138 drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
139 drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
140 fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
142 setRotation(uint8_t r),
143 invertDisplay(
boolean i);
144 uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
146 void commandList(uint8_t *addr);
149 uint8_t readdata(
void),
150 readcommand8(uint8_t reg, uint8_t index = 0);
157 void writecommand(uint8_t c);
158 void writedata(uint8_t d);
159 void writedata(uint8_t * data, uint8_t size);
160 void writeCmdData(uint8_t cmd, uint8_t * data, uint8_t size);
163 uint16_t getHeight(
void);
164 uint16_t getWidth(
void);
166 void area_update_start(uint32_t x, uint32_t y, uint32_t w, uint32_t h);
167 void area_update_data(uint8_t *data, uint32_t pixel);
168 void area_update_end(
void);
171 uint8_t spiread(
void);
175 inline void spiwrite(uint8_t data);
176 inline void spiwrite16(uint16_t data);
177 inline void spiwriteBytes(uint8_t * data, uint32_t size);
178 inline void spiwritePattern(uint8_t * data, uint8_t size, uint32_t repeat);
180 inline void setAddrWindow_(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
182 void spiwrite(uint8_t);
183 void spiwrite16(uint16_t data);
184 void spiwriteBytes(uint8_t * data, uint8_t size);
185 void spiwritePattern(uint8_t * data, uint8_t size, uint8_t repeat);
186 void setAddrWindow_(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
189 inline void spiCsHigh(
void);
190 inline void spiCsLow(
void);
191 inline void spiDcHigh(
void);
192 inline void spiDcLow(
void);
198 #if defined (__AVR__) || defined(TEENSYDUINO)
200 volatile uint8_t *mosiport, *clkport, *dcport, *rsport, *csport;
201 int8_t _cs, _dc, _rst, _mosi, _miso, _sclk;
202 uint8_t mosipinmask, clkpinmask, cspinmask, dcpinmask;
203 #elif defined (__arm__)
204 volatile RwReg *mosiport, *clkport, *dcport, *rsport, *csport;
205 uint32_t _cs, _dc, _rst, _mosi, _miso, _sclk;
206 uint32_t mosipinmask, clkpinmask, cspinmask, dcpinmask;
207 #elif defined (ESP8266)
213 uint32_t _dcMask, _rstMask;
Definition: Adafruit_ILI9341.h:121