Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
Adafruit_ILI9341.cpp
Go to the documentation of this file.
1 /***************************************************
2  This is our library for the Adafruit ILI9341 Breakout and Shield
3  ----> http://www.adafruit.com/products/1651
4 
5  Check out the links above for our tutorials and wiring diagrams
6  These displays use SPI to communicate, 4 or 5 pins are required to
7  interface (RST is optional)
8  Adafruit invests time and resources providing this open source code,
9  please support Adafruit and open-source hardware by purchasing
10  products from Adafruit!
11 
12  Written by Limor Fried/Ladyada for Adafruit Industries.
13  MIT license, all text above must be included in any redistribution
14  ****************************************************/
15 
16 #include "Adafruit_ILI9341.h"
17 #ifdef __AVR
18 #include <avr/pgmspace.h>
19 #elif defined(ESP8266)
20 #include <pgmspace.h>
21 #endif
22 #include <limits.h>
23 #include "pins_arduino.h"
24 #include "wiring_private.h"
25 #include <SPI.h>
26 
27 
28 // If the SPI library has transaction support, these functions
29 // establish settings and protect from interference from other
30 // libraries. Otherwise, they simply do nothing.
31 #ifdef SPI_HAS_TRANSACTION
32 static inline void spi_begin(void) __attribute__((always_inline));
33 static inline void spi_begin(void)
34 {
35 #if defined (ARDUINO_ARCH_ARC32)
36  // max speed!
37  SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));
38 #else
39  // max speed!
40  SPI.beginTransaction(SPISettings(24000000, MSBFIRST, SPI_MODE0));
41 #endif
42 }
43 static inline void spi_end(void) __attribute__((always_inline));
44 static inline void spi_end(void)
45 {
46  SPI.endTransaction();
47 }
48 #else
49 #define spi_begin()
50 #define spi_end()
51 #endif
52 
53 
54 // Constructor when using software SPI. All output pins are configurable.
55 Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t mosi,
56  int8_t sclk, int8_t rst, int8_t miso) : Adafruit_GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT)
57 {
58  _cs = cs;
59  _dc = dc;
60  _mosi = mosi;
61  _miso = miso;
62  _sclk = sclk;
63  _rst = rst;
64  hwSPI = false;
65 }
66 
67 
68 // Constructor when using hardware SPI. Faster, but must use SPI pins
69 // specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
71 {
72  _cs = cs;
73  _dc = dc;
74  _rst = rst;
75  hwSPI = true;
76  _mosi = _sclk = 0;
77 }
78 
80 {
81 
82  //Serial.print("0x"); Serial.print(c, HEX); Serial.print(", ");
83 
84  if (hwSPI)
85  {
86 #if defined (__AVR__)
87 #ifndef SPI_HAS_TRANSACTION
88  uint8_t backupSPCR = SPCR;
89  SPCR = mySPCR;
90 #endif
91  SPDR = c;
92  while (!(SPSR & _BV(SPIF)));
93 #ifndef SPI_HAS_TRANSACTION
94  SPCR = backupSPCR;
95 #endif
96 #else
97  SPI.transfer(c);
98 #endif
99  }
100  else
101  {
102 #if defined(ESP8266) || defined (ARDUINO_ARCH_ARC32)
103  for (uint8_t bit = 0x80; bit; bit >>= 1)
104  {
105  if (c & bit)
106  {
107  digitalWrite(_mosi, HIGH);
108  }
109  else
110  {
111  digitalWrite(_mosi, LOW);
112  }
113  digitalWrite(_sclk, HIGH);
114  digitalWrite(_sclk, LOW);
115  }
116 #else
117  // Fast SPI bitbang swiped from LPD8806 library
118  for (uint8_t bit = 0x80; bit; bit >>= 1)
119  {
120  if (c & bit)
121  {
122  //digitalWrite(_mosi, HIGH);
123  *mosiport |= mosipinmask;
124  }
125  else
126  {
127  //digitalWrite(_mosi, LOW);
128  *mosiport &= ~mosipinmask;
129  }
130  //digitalWrite(_sclk, HIGH);
131  *clkport |= clkpinmask;
132  //digitalWrite(_sclk, LOW);
133  *clkport &= ~clkpinmask;
134  }
135 #endif
136  }
137 }
138 
139 
141 {
142 #if defined (USE_FAST_PINIO)
143  *dcport &= ~dcpinmask;
144  *csport &= ~cspinmask;
145 #else
146  digitalWrite(_dc, LOW);
147  digitalWrite(_sclk, LOW);
148  digitalWrite(_cs, LOW);
149 #endif
150 
151  spiwrite(c);
152 
153 #if defined (USE_FAST_PINIO)
154  *csport |= cspinmask;
155 #else
156  digitalWrite(_cs, HIGH);
157 #endif
158 }
159 
160 
162 {
163 #if defined (USE_FAST_PINIO)
164  *dcport |= dcpinmask;
165  *csport &= ~cspinmask;
166 #else
167  digitalWrite(_dc, HIGH);
168  digitalWrite(_cs, LOW);
169 #endif
170 
171  spiwrite(c);
172 
173 #if defined (USE_FAST_PINIO)
174  *csport |= cspinmask;
175 #else
176  digitalWrite(_cs, HIGH);
177 #endif
178 }
179 
180 
181 // Rather than a bazillion writecommand() and writedata() calls, screen
182 // initialization commands and arguments are organized in these tables
183 // stored in PROGMEM. The table may look bulky, but that's mostly the
184 // formatting -- storage-wise this is hundreds of bytes more compact
185 // than the equivalent code. Companion function follows.
186 #define DELAY 0x80
187 
188 
189 // Companion code to the above tables. Reads and issues
190 // a series of LCD commands stored in PROGMEM byte array.
191 void Adafruit_ILI9341::commandList(uint8_t *addr)
192 {
193 
194  uint8_t numCommands, numArgs;
195  uint16_t ms;
196 
197  numCommands = pgm_read_byte(addr++); // Number of commands to follow
198  while (numCommands--) // For each command...
199  {
200  writecommand(pgm_read_byte(addr++)); // Read, issue command
201  numArgs = pgm_read_byte(addr++); // Number of args to follow
202  ms = numArgs & DELAY; // If hibit set, delay follows args
203  numArgs &= ~DELAY; // Mask out delay bit
204  while (numArgs--) // For each argument...
205  {
206  writedata(pgm_read_byte(addr++)); // Read, issue argument
207  }
208 
209  if (ms)
210  {
211  ms = pgm_read_byte(addr++); // Read post-command delay time (ms)
212  if (ms == 255) ms = 500; // If 255, delay for 500 ms
213  delay(ms);
214  }
215  }
216 }
217 
218 
220 {
221  if (_rst > 0)
222  {
223  pinMode(_rst, OUTPUT);
224  digitalWrite(_rst, LOW);
225  }
226 
227  pinMode(_dc, OUTPUT);
228  pinMode(_cs, OUTPUT);
229 
230 #if defined (USE_FAST_PINIO)
231  csport = portOutputRegister(digitalPinToPort(_cs));
232  cspinmask = digitalPinToBitMask(_cs);
233  dcport = portOutputRegister(digitalPinToPort(_dc));
234  dcpinmask = digitalPinToBitMask(_dc);
235 #endif
236 
237  if (hwSPI) // Using hardware SPI
238  {
239  SPI.begin();
240 
241 #ifndef SPI_HAS_TRANSACTION
242  SPI.setBitOrder(MSBFIRST);
243  SPI.setDataMode(SPI_MODE0);
244 #if defined (_AVR__)
245  SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
246  mySPCR = SPCR;
247 #elif defined(TEENSYDUINO)
248  SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
249 #elif defined (__arm__)
250  SPI.setClockDivider(11); // 8-ish MHz (full! speed!)
251 #endif
252 #endif
253  }
254  else
255  {
256  pinMode(_sclk, OUTPUT);
257  pinMode(_mosi, OUTPUT);
258  pinMode(_miso, INPUT);
259 
260 #if defined (USE_FAST_PINIO)
261  clkport = portOutputRegister(digitalPinToPort(_sclk));
262  clkpinmask = digitalPinToBitMask(_sclk);
263  mosiport = portOutputRegister(digitalPinToPort(_mosi));
264  mosipinmask = digitalPinToBitMask(_mosi);
265  *clkport &= ~clkpinmask;
266  *mosiport &= ~mosipinmask;
267 #endif
268  }
269 
270  // toggle RST low to reset
271  if (_rst > 0)
272  {
273  digitalWrite(_rst, HIGH);
274  delay(5);
275  digitalWrite(_rst, LOW);
276  delay(20);
277  digitalWrite(_rst, HIGH);
278  delay(150);
279  }
280 
281  /*
282  uint8_t x = readcommand8(ILI9341_RDMODE);
283  Serial.print("\nDisplay Power Mode: 0x"); Serial.println(x, HEX);
284  x = readcommand8(ILI9341_RDMADCTL);
285  Serial.print("\nMADCTL Mode: 0x"); Serial.println(x, HEX);
286  x = readcommand8(ILI9341_RDPIXFMT);
287  Serial.print("\nPixel Format: 0x"); Serial.println(x, HEX);
288  x = readcommand8(ILI9341_RDIMGFMT);
289  Serial.print("\nImage Format: 0x"); Serial.println(x, HEX);
290  x = readcommand8(ILI9341_RDSELFDIAG);
291  Serial.print("\nSelf Diagnostic: 0x"); Serial.println(x, HEX);
292  */
293  //if(cmdList) commandList(cmdList);
294 
295  if (hwSPI) spi_begin();
296  writecommand(0xEF);
297  writedata(0x03);
298  writedata(0x80);
299  writedata(0x02);
300 
301  writecommand(0xCF);
302  writedata(0x00);
303  writedata(0XC1);
304  writedata(0X30);
305 
306  writecommand(0xED);
307  writedata(0x64);
308  writedata(0x03);
309  writedata(0X12);
310  writedata(0X81);
311 
312  writecommand(0xE8);
313  writedata(0x85);
314  writedata(0x00);
315  writedata(0x78);
316 
317  writecommand(0xCB);
318  writedata(0x39);
319  writedata(0x2C);
320  writedata(0x00);
321  writedata(0x34);
322  writedata(0x02);
323 
324  writecommand(0xF7);
325  writedata(0x20);
326 
327  writecommand(0xEA);
328  writedata(0x00);
329  writedata(0x00);
330 
331  writecommand(ILI9341_PWCTR1); //Power control
332  writedata(0x23); //VRH[5:0]
333 
334  writecommand(ILI9341_PWCTR2); //Power control
335  writedata(0x10); //SAP[2:0];BT[3:0]
336 
337  writecommand(ILI9341_VMCTR1); //VCM control
338  writedata(0x3e); //¶Ô±È¶Èµ÷½Ú
339  writedata(0x28);
340 
341  writecommand(ILI9341_VMCTR2); //VCM control2
342  writedata(0x86); //--
343 
344  writecommand(ILI9341_MADCTL); // Memory Access Control
345  writedata(0x48);
346 
348  writedata(0x55);
349 
351  writedata(0x00);
352  writedata(0x18);
353 
354  writecommand(ILI9341_DFUNCTR); // Display Function Control
355  writedata(0x08);
356  writedata(0x82);
357  writedata(0x27);
358 
359  writecommand(0xF2); // 3Gamma Function Disable
360  writedata(0x00);
361 
362  writecommand(ILI9341_GAMMASET); //Gamma curve selected
363  writedata(0x01);
364 
365  writecommand(ILI9341_GMCTRP1); //Set Gamma
366  writedata(0x0F);
367  writedata(0x31);
368  writedata(0x2B);
369  writedata(0x0C);
370  writedata(0x0E);
371  writedata(0x08);
372  writedata(0x4E);
373  writedata(0xF1);
374  writedata(0x37);
375  writedata(0x07);
376  writedata(0x10);
377  writedata(0x03);
378  writedata(0x0E);
379  writedata(0x09);
380  writedata(0x00);
381 
382  writecommand(ILI9341_GMCTRN1); //Set Gamma
383  writedata(0x00);
384  writedata(0x0E);
385  writedata(0x14);
386  writedata(0x03);
387  writedata(0x11);
388  writedata(0x07);
389  writedata(0x31);
390  writedata(0xC1);
391  writedata(0x48);
392  writedata(0x08);
393  writedata(0x0F);
394  writedata(0x0C);
395  writedata(0x31);
396  writedata(0x36);
397  writedata(0x0F);
398 
399  writecommand(ILI9341_SLPOUT); //Exit Sleep
400  if (hwSPI) spi_end();
401  delay(120);
402  if (hwSPI) spi_begin();
403  writecommand(ILI9341_DISPON); //Display on
404  if (hwSPI) spi_end();
405 
406 }
407 
408 
409 void Adafruit_ILI9341::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1,
410  uint16_t y1)
411 {
412 
413  writecommand(ILI9341_CASET); // Column addr set
414  writedata(x0 >> 8);
415  writedata(x0 & 0xFF); // XSTART
416  writedata(x1 >> 8);
417  writedata(x1 & 0xFF); // XEND
418 
419  writecommand(ILI9341_PASET); // Row addr set
420  writedata(y0>>8);
421  writedata(y0); // YSTART
422  writedata(y1>>8);
423  writedata(y1); // YEND
424 
425  writecommand(ILI9341_RAMWR); // write to RAM
426 }
427 
428 
429 void Adafruit_ILI9341::pushColor(uint16_t color)
430 {
431  if (hwSPI) spi_begin();
432 
433 #if defined(USE_FAST_PINIO)
434  *dcport |= dcpinmask;
435  *csport &= ~cspinmask;
436 #else
437  digitalWrite(_dc, HIGH);
438  digitalWrite(_cs, LOW);
439 #endif
440 
441  spiwrite(color >> 8);
442  spiwrite(color);
443 
444 #if defined(USE_FAST_PINIO)
445  *csport |= cspinmask;
446 #else
447  digitalWrite(_cs, HIGH);
448 #endif
449 
450  if (hwSPI) spi_end();
451 }
452 
453 void Adafruit_ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color)
454 {
455 
456  if ((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
457 
458  if (hwSPI) spi_begin();
459  setAddrWindow(x,y,x+1,y+1);
460 
461 #if defined(USE_FAST_PINIO)
462  *dcport |= dcpinmask;
463  *csport &= ~cspinmask;
464 #else
465  digitalWrite(_dc, HIGH);
466  digitalWrite(_cs, LOW);
467 #endif
468 
469  spiwrite(color >> 8);
470  spiwrite(color);
471 
472 #if defined(USE_FAST_PINIO)
473  *csport |= cspinmask;
474 #else
475  digitalWrite(_cs, HIGH);
476 #endif
477 
478  if (hwSPI) spi_end();
479 }
480 
481 
482 void Adafruit_ILI9341::drawFastVLine(int16_t x, int16_t y, int16_t h,
483  uint16_t color)
484 {
485 
486  // Rudimentary clipping
487  if ((x >= _width) || (y >= _height)) return;
488 
489  if ((y+h-1) >= _height)
490  h = _height-y;
491 
492  if (hwSPI) spi_begin();
493  setAddrWindow(x, y, x, y+h-1);
494 
495  uint8_t hi = color >> 8, lo = color;
496 
497 #if defined(USE_FAST_PINIO)
498  *dcport |= dcpinmask;
499  *csport &= ~cspinmask;
500 #else
501  digitalWrite(_dc, HIGH);
502  digitalWrite(_cs, LOW);
503 #endif
504 
505  while (h--)
506  {
507  spiwrite(hi);
508  spiwrite(lo);
509  }
510 
511 #if defined(USE_FAST_PINIO)
512  *csport |= cspinmask;
513 #else
514  digitalWrite(_cs, HIGH);
515 #endif
516 
517  if (hwSPI) spi_end();
518 }
519 
520 
521 void Adafruit_ILI9341::drawFastHLine(int16_t x, int16_t y, int16_t w,
522  uint16_t color)
523 {
524 
525  // Rudimentary clipping
526  if ((x >= _width) || (y >= _height)) return;
527  if ((x+w-1) >= _width) w = _width-x;
528  if (hwSPI) spi_begin();
529  setAddrWindow(x, y, x+w-1, y);
530 
531  uint8_t hi = color >> 8, lo = color;
532 #if defined(USE_FAST_PINIO)
533  *dcport |= dcpinmask;
534  *csport &= ~cspinmask;
535 #else
536  digitalWrite(_dc, HIGH);
537  digitalWrite(_cs, LOW);
538 #endif
539  while (w--)
540  {
541  spiwrite(hi);
542  spiwrite(lo);
543  }
544 #if defined(USE_FAST_PINIO)
545  *csport |= cspinmask;
546 #else
547  digitalWrite(_cs, HIGH);
548 #endif
549  if (hwSPI) spi_end();
550 }
551 
552 void Adafruit_ILI9341::fillScreen(uint16_t color)
553 {
554  fillRect(0, 0, _width, _height, color);
555 }
556 
557 // fill a rectangle
558 void Adafruit_ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
559  uint16_t color)
560 {
561 
562  // rudimentary clipping (drawChar w/big text requires this)
563  if ((x >= _width) || (y >= _height)) return;
564  if ((x + w - 1) >= _width) w = _width - x;
565  if ((y + h - 1) >= _height) h = _height - y;
566 
567  if (hwSPI) spi_begin();
568  setAddrWindow(x, y, x+w-1, y+h-1);
569 
570  uint8_t hi = color >> 8, lo = color;
571 
572 #if defined(USE_FAST_PINIO)
573  *dcport |= dcpinmask;
574  *csport &= ~cspinmask;
575 #else
576  digitalWrite(_dc, HIGH);
577  digitalWrite(_cs, LOW);
578 #endif
579 
580  for (y=h; y>0; y--)
581  {
582  for (x=w; x>0; x--)
583  {
584  spiwrite(hi);
585  spiwrite(lo);
586  }
587  }
588 #if defined(USE_FAST_PINIO)
589  *csport |= cspinmask;
590 #else
591  digitalWrite(_cs, HIGH);
592 #endif
593 
594  if (hwSPI) spi_end();
595 }
596 
597 
598 // Pass 8-bit (each) R,G,B, get back 16-bit packed color
599 uint16_t Adafruit_ILI9341::color565(uint8_t r, uint8_t g, uint8_t b)
600 {
601  return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
602 }
603 
604 
605 #define MADCTL_MY 0x80
606 #define MADCTL_MX 0x40
607 #define MADCTL_MV 0x20
608 #define MADCTL_ML 0x10
609 #define MADCTL_RGB 0x00
610 #define MADCTL_BGR 0x08
611 #define MADCTL_MH 0x04
612 
614 {
615 
616  if (hwSPI) spi_begin();
618  rotation = m % 4; // can't be higher than 3
619  switch (rotation)
620  {
621  case 0:
625  break;
626  case 1:
630  break;
631  case 2:
635  break;
636  case 3:
640  break;
641  }
642  if (hwSPI) spi_end();
643 }
644 
645 
647 {
648  if (hwSPI) spi_begin();
650  if (hwSPI) spi_end();
651 }
652 
653 
654 ////////// stuff not actively being used, but kept for posterity
655 
656 
658 {
659  uint8_t r = 0;
660 
661  if (hwSPI)
662  {
663 #if defined (__AVR__)
664 #ifndef SPI_HAS_TRANSACTION
665  uint8_t backupSPCR = SPCR;
666  SPCR = mySPCR;
667 #endif
668  SPDR = 0x00;
669  while (!(SPSR & _BV(SPIF)));
670  r = SPDR;
671 
672 #ifndef SPI_HAS_TRANSACTION
673  SPCR = backupSPCR;
674 #endif
675 #else
676  r = SPI.transfer(0x00);
677 #endif
678 
679  }
680  else
681  {
682 
683  for (uint8_t i=0; i<8; i++)
684  {
685  digitalWrite(_sclk, LOW);
686  digitalWrite(_sclk, HIGH);
687  r <<= 1;
688  if (digitalRead(_miso))
689  r |= 0x1;
690  }
691  }
692  //Serial.print("read: 0x"); Serial.print(r, HEX);
693 
694  return r;
695 }
696 
698 {
699  digitalWrite(_dc, HIGH);
700  digitalWrite(_cs, LOW);
701  uint8_t r = spiread();
702  digitalWrite(_cs, HIGH);
703 
704  return r;
705 }
706 
707 
708 uint8_t Adafruit_ILI9341::readcommand8(uint8_t c, uint8_t index)
709 {
710  if (hwSPI) spi_begin();
711  digitalWrite(_dc, LOW); // command
712  digitalWrite(_cs, LOW);
713  spiwrite(0xD9); // woo sekret command?
714  digitalWrite(_dc, HIGH); // data
715  spiwrite(0x10 + index);
716  digitalWrite(_cs, HIGH);
717 
718  digitalWrite(_dc, LOW);
719  digitalWrite(_sclk, LOW);
720  digitalWrite(_cs, LOW);
721  spiwrite(c);
722 
723  digitalWrite(_dc, HIGH);
724  uint8_t r = spiread();
725  digitalWrite(_cs, HIGH);
726  if (hwSPI) spi_end();
727  return r;
728 }
729 
730 
731 
732 /*
733 
734  uint16_t Adafruit_ILI9341::readcommand16(uint8_t c) {
735  digitalWrite(_dc, LOW);
736  if (_cs)
737  digitalWrite(_cs, LOW);
738 
739  spiwrite(c);
740  pinMode(_sid, INPUT); // input!
741  uint16_t r = spiread();
742  r <<= 8;
743  r |= spiread();
744  if (_cs)
745  digitalWrite(_cs, HIGH);
746 
747  pinMode(_sid, OUTPUT); // back to output
748  return r;
749  }
750 
751  uint32_t Adafruit_ILI9341::readcommand32(uint8_t c) {
752  digitalWrite(_dc, LOW);
753  if (_cs)
754  digitalWrite(_cs, LOW);
755  spiwrite(c);
756  pinMode(_sid, INPUT); // input!
757 
758  dummyclock();
759  dummyclock();
760 
761  uint32_t r = spiread();
762  r <<= 8;
763  r |= spiread();
764  r <<= 8;
765  r |= spiread();
766  r <<= 8;
767  r |= spiread();
768  if (_cs)
769  digitalWrite(_cs, HIGH);
770 
771  pinMode(_sid, OUTPUT); // back to output
772  return r;
773  }
774 
775  */
uint8_t readdata(void)
#define ILI9341_PWCTR1
#define ILI9341_MADCTL
#define DELAY
#define ILI9341_SLPOUT
void writecommand(uint8_t c)
void spiwrite(uint8_t)
#define ILI9341_GAMMASET
void drawPixel(int16_t x, int16_t y, uint16_t color)
Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST, int8_t _MISO)
void pushColor(uint16_t color)
uint16_t color565(uint8_t r, uint8_t g, uint8_t b)
#define ILI9341_RAMWR
uint8_t rotation
Definition: Adafruit_GFX.h:99
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
#define ILI9341_DISPON
#define spi_begin()
#define ILI9341_PWCTR2
#define ILI9341_FRMCTR1
#define ILI9341_PASET
#define MADCTL_BGR
#define ILI9341_GMCTRP1
#define ILI9341_VMCTR1
#define ILI9341_INVON
uint8_t readcommand8(uint8_t reg, uint8_t index=0)
#define ILI9341_TFTHEIGHT
#define ILI9341_INVOFF
#define ILI9341_GMCTRN1
void setRotation(uint8_t r)
int16_t _height
Definition: Adafruit_GFX.h:94
uint8_t spiread(void)
#define MADCTL_MV
#define ILI9341_PIXFMT
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
#define ILI9341_VMCTR2
#define ILI9341_DFUNCTR
void writedata(uint8_t d)
#define spi_end()
#define MADCTL_MX
static int index
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
#define ILI9341_TFTWIDTH
#define MADCTL_MY
#define ILI9341_CASET
void fillScreen(uint16_t color)
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
static int i
Definition: DC2430A.ino:184
void commandList(uint8_t *addr)
void invertDisplay(boolean i)
#define pgm_read_byte(addr)
int16_t _width
Definition: Adafruit_GFX.h:94