Arduino  1.8.10
Arduino_LCD.cpp
[詳解]
1 /***************************************************
2  This is a library for the Adafruit 1.8" SPI display.
3  This library works with the Adafruit 1.8" TFT Breakout w/SD card
4  ----> http://www.adafruit.com/products/358
5  as well as Adafruit raw 1.8" TFT display
6  ----> http://www.adafruit.com/products/618
7 
8  Check out the links above for our tutorials and wiring diagrams
9  These displays use SPI to communicate, 4 or 5 pins are required to
10  interface (RST is optional)
11  Adafruit invests time and resources providing this open source code,
12  please support Adafruit and open-source hardware by purchasing
13  products from Adafruit!
14 
15  Written by Limor Fried/Ladyada for Adafruit Industries.
16  MIT license, all text above must be included in any redistribution
17  ****************************************************/
18 
19 #include "Arduino_LCD.h"
20 //#include <avr/pgmspace.h>
21 #include <limits.h>
22 //#include "pins_arduino.h"
23 #include "wiring_private.h"
24 #include <SPI.h>
25 
26 
27 // Constructor when using software SPI. All output pins are configurable.
28 Arduino_LCD::Arduino_LCD(uint8_t cs, uint8_t rs, uint8_t sid, uint8_t sclk,
30 {
31  _cs = cs;
32  _rs = rs;
33  _sid = sid;
34  _sclk = sclk;
35  _rst = rst;
36  hwSPI = false;
37 }
38 
39 
40 // Constructor when using hardware SPI. Faster, but must use SPI pins
41 // specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
42 Arduino_LCD::Arduino_LCD(uint8_t cs, uint8_t rs, uint8_t rst) :
44  _cs = cs;
45  _rs = rs;
46  _rst = rst;
47  hwSPI = true;
48  _sid = _sclk = 0;
49 }
50 
51 
52 inline void Arduino_LCD::spiwrite(uint8_t c) {
53 
54  //Serial.println(c, HEX);
55 
56 /* if (hwSPI) {
57  SPDR = c;
58  while(!(SPSR & _BV(SPIF)));
59  } else {
60  // Fast SPI bitbang swiped from LPD8806 library
61  for(uint8_t bit = 0x80; bit; bit >>= 1) {
62  if(c & bit) *dataport |= datapinmask;
63  else *dataport &= ~datapinmask;
64  *clkport |= clkpinmask;
65  *clkport &= ~clkpinmask;
66  }
67  }
68 */
69 SPI.transfer(c);
70 }
71 
72 
73 void Arduino_LCD::writecommand(uint8_t c) {
74 // *rsport &= ~rspinmask;
75 // *csport &= ~cspinmask;
76 digitalWrite(_rs, LOW);
77 digitalWrite(_cs, LOW);
78 
79  //Serial.print("C ");
80  spiwrite(c);
81 //SPI.transfer(c);
82 // *csport |= cspinmask;
83 digitalWrite(_cs, HIGH);
84 }
85 
86 
87 void Arduino_LCD::writedata(uint8_t c) {
88 // *rsport &= ~rspinmask;
89 // *csport &= ~cspinmask;
90 digitalWrite(_rs, HIGH);
91 digitalWrite(_cs, LOW);
92 
93  //Serial.print("D ");
94  spiwrite(c);
95 //SPI.transfer(c);
96 // *csport |= cspinmask;
97 digitalWrite(_cs, HIGH);
98 }
99 
100 
101 // Rather than a bazillion writecommand() and writedata() calls, screen
102 // initialization commands and arguments are organized in these tables
103 // stored in PROGMEM. The table may look bulky, but that's mostly the
104 // formatting -- storage-wise this is hundreds of bytes more compact
105 // than the equivalent code. Companion function follows.
106 #define DELAY 0x80
107 //PROGMEM static prog_uchar
108 /*uint8_t
109  Bcmd[] = { // Initialization commands for 7735B screens
110  18, // 18 commands in list:
111  ILI9163C_SWRESET, DELAY, // 1: Software reset, no args, w/delay
112  50, // 50 ms delay
113  ILI9163C_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
114  255, // 255 = 500 ms delay
115  ILI9163C_COLMOD , 1+DELAY, // 3: Set color mode, 1 arg + delay: // I THINK THERE WAS SOMETHING HERE BECAUSE THE COMMAND IS CALLED 3A on Adafruits
116  0x05, // 16-bit color
117  10, // 10 ms delay
118  ILI9163C_FRMCTR1, 3+DELAY, // 4: Frame rate control, 3 args + delay:
119  0x00, // fastest refresh
120  0x06, // 6 lines front porch
121  0x03, // 3 lines back porch
122  10, // 10 ms delay
123  ILI9163C_MADCTL , 1 , // 5: Memory access ctrl (directions), 1 arg:
124  0x08, // Row addr/col addr, bottom to top refresh
125  ILI9163C_DISSET5, 2 , // 6: Display settings #5, 2 args, no delay:
126  0x15, // 1 clk cycle nonoverlap, 2 cycle gate
127  // rise, 3 cycle osc equalize
128  0x02, // Fix on VTL
129  ILI9163C_INVCTR , 1 , // 7: Display inversion control, 1 arg:
130  0x0, // Line inversion
131  ILI9163C_PWCTR1 , 2+DELAY, // 8: Power control, 2 args + delay:
132  0x02, // GVDD = 4.7V
133  0x70, // 1.0uA
134  10, // 10 ms delay
135  ILI9163C_PWCTR2 , 1 , // 9: Power control, 1 arg, no delay:
136  0x05, // VGH = 14.7V, VGL = -7.35V
137  ILI9163C_PWCTR3 , 2 , // 10: Power control, 2 args, no delay:
138  0x01, // Opamp current small
139  0x02, // Boost frequency
140  ILI9163C_VMCTR1 , 2+DELAY, // 11: Power control, 2 args + delay:
141  0x3C, // VCOMH = 4V
142  0x38, // VCOML = -1.1V
143  10, // 10 ms delay
144  ILI9163C_PWCTR6 , 2 , // 12: Power control, 2 args, no delay:
145  0x11, 0x15,
146  ILI9163C_GMCTRP1,16 , // 13: Magical unicorn dust, 16 args, no delay:
147  0x09, 0x16, 0x09, 0x20, // (seriously though, not sure what
148  0x21, 0x1B, 0x13, 0x19, // these config values represent)
149  0x17, 0x15, 0x1E, 0x2B,
150  0x04, 0x05, 0x02, 0x0E,
151  ILI9163C_GMCTRN1,16+DELAY, // 14: Sparkles and rainbows, 16 args + delay:
152  0x0B, 0x14, 0x08, 0x1E, // (ditto)
153  0x22, 0x1D, 0x18, 0x1E,
154  0x1B, 0x1A, 0x24, 0x2B,
155  0x06, 0x06, 0x02, 0x0F,
156  10, // 10 ms delay
157  ILI9163C_CASET , 4 , // 15: Column addr set, 4 args, no delay:
158  0x00, 0x02, // XSTART = 2
159  0x00, 0x81, // XEND = 129
160  ILI9163C_RASET , 4 , // 16: Row addr set, 4 args, no delay:
161  0x00, 0x02, // XSTART = 1
162  0x00, 0x81, // XEND = 160
163  ILI9163C_NORON , DELAY, // 17: Normal display on, no args, w/delay
164  10, // 10 ms delay
165  ILI9163C_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
166  255 }, // 255 = 500 ms delay
167 */
168 uint8_t
169  Bcmd[] = { // Initialization commands for 7735B screens
170  19, // 19 commands in list:
171  ILI9163C_SWRESET, DELAY, // 1: Software reset, no args, w/delay
172  50, // 50 ms delay
173  0x11 , DELAY, // 2: Out of sleep mode, no args, w/delay
174  100, // 255 = 500 ms delay
175  0x26 , 1, // 3: Set default gamma
176  0x04, // 16-bit color
177  0xb1, 2, // 4: Frame Rate
178  0x0b,
179  0x14,
180  0xc0, 2, // 5: VRH1[4:0] & VC[2:0]
181  0x08,
182  0x00,
183  0xc1, 1, // 6: BT[2:0]
184  0x05,
185  0xc5, 2, // 7: VMH[6:0] & VML[6:0]
186  0x41,
187  0x30,
188  0xc7, 1, // 8: LCD Driving control
189  0xc1,
190  0xEC, 1, // 9: Set pumping color freq
191  0x1b,
192  0x3a , 1 + DELAY, // 10: Set color format
193  0x55, // 16-bit color
194  100,
195  0x2a, 4, // 11: Set Column Address
196  0x00,
197  0x00,
198  0x00,
199  0x7f,
200  0x2b, 4, // 12: Set Page Address
201  0x00,
202  0x00,
203  0x00,
204  0x9f,
205  0x36, 1, // 12+1: Set Scanning Direction
206  0xc8,
207  0xb7, 1, // 14: Set Source Output Direciton
208  0x00,
209  0xf2, 1, // 15: Enable Gamma bit
210  0x01,
211  0xe0, 15 + DELAY, // 16: magic
212  0x28, 0x24, 0x22, 0x31,
213  0x2b, 0x0e, 0x53, 0xa5,
214  0x42, 0x16, 0x18, 0x12,
215  0x1a, 0x14, 0x03,
216  50,
217  0xe1, 15 + DELAY, // 17: more magic
218  0x17, 0x1b, 0x1d, 0x0e,
219  0x14, 0x11, 0x2c, 0xa5,
220  0x3d, 0x09, 0x27, 0x2d,
221  0x25, 0x2b, 0x3c,
222  50,
223  ILI9163C_NORON , DELAY, // 18: Normal display on, no args, w/delay
224  10, // 10 ms delay
225  ILI9163C_DISPON , DELAY, // 19: Main screen turn on, no args w/delay
226  100 }, // 100 ms delay
227 Rcmd1[] = { // Init for 7735R, part 1 (red or green tab)
228  15, // 15 commands in list:
229  ILI9163C_SWRESET, DELAY, // 1: Software reset, 0 args, w/delay
230  150, // 150 ms delay
231  ILI9163C_SLPOUT , DELAY, // 2: Out of sleep mode, 0 args, w/delay
232  255, // 500 ms delay
233  ILI9163C_FRMCTR1, 3 , // 3: Frame rate ctrl - normal mode, 3 args:
234  0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
235  ILI9163C_FRMCTR2, 3 , // 4: Frame rate control - idle mode, 3 args:
236  0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
237  ILI9163C_FRMCTR3, 6 , // 5: Frame rate ctrl - partial mode, 6 args:
238  0x01, 0x2C, 0x2D, // Dot inversion mode
239  0x01, 0x2C, 0x2D, // Line inversion mode
240  ILI9163C_INVCTR , 1 , // 6: Display inversion ctrl, 1 arg, no delay:
241  0x07, // No inversion
242  ILI9163C_PWCTR1 , 3 , // 7: Power control, 3 args, no delay:
243  0xA2,
244  0x02, // -4.6V
245  0x84, // AUTO mode
246  ILI9163C_PWCTR2 , 1 , // 8: Power control, 1 arg, no delay:
247  0xC5, // VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD
248  ILI9163C_PWCTR3 , 2 , // 9: Power control, 2 args, no delay:
249  0x0A, // Opamp current small
250  0x00, // Boost frequency
251  ILI9163C_PWCTR4 , 2 , // 10: Power control, 2 args, no delay:
252  0x8A, // BCLK/2, Opamp current small & Medium low
253  0x2A,
254  ILI9163C_PWCTR5 , 2 , // 11: Power control, 2 args, no delay:
255  0x8A, 0xEE,
256  ILI9163C_VMCTR1 , 1 , // 12: Power control, 1 arg, no delay:
257  0x0E,
258  ILI9163C_INVOFF , 0 , // 13: Don't invert display, no args, no delay
259  ILI9163C_MADCTL , 1 , // 14: Memory access control (directions), 1 arg:
260  0xC8, // row addr/col addr, bottom to top refresh
261  ILI9163C_COLMOD , 1 , // 15: set color mode, 1 arg, no delay:
262  0x05 }, // 16-bit color
263 
264  Rcmd2green[] = { // Init for 7735R, part 2 (green tab only)
265  2, // 2 commands in list:
266  ILI9163C_CASET , 4 , // 1: Column addr set, 4 args, no delay:
267  0x00, 0x02, // XSTART = 0
268  0x00, 0x7F+0x02, // XEND = 127
269  ILI9163C_RASET , 4 , // 2: Row addr set, 4 args, no delay:
270  0x00, 0x01, // XSTART = 0
271  0x00, 0x9F+0x01 }, // XEND = 159
272  Rcmd2red[] = { // Init for 7735R, part 2 (red tab only)
273  2, // 2 commands in list:
274  ILI9163C_CASET , 4 , // 1: Column addr set, 4 args, no delay:
275  0x00, 0x00, // XSTART = 0
276  0x00, 0x7F, // XEND = 127
277  ILI9163C_RASET , 4 , // 2: Row addr set, 4 args, no delay:
278  0x00, 0x00, // XSTART = 0
279  0x00, 0x9F }, // XEND = 159
280 
281  Rcmd3[] = { // Init for 7735R, part 3 (red or green tab)
282  4, // 4 commands in list:
283  ILI9163C_GMCTRP1, 16 , // 1: Magical unicorn dust, 16 args, no delay:
284  0x02, 0x1c, 0x07, 0x12,
285  0x37, 0x32, 0x29, 0x2d,
286  0x29, 0x25, 0x2B, 0x39,
287  0x00, 0x01, 0x03, 0x10,
288  ILI9163C_GMCTRN1, 16 , // 2: Sparkles and rainbows, 16 args, no delay:
289  0x03, 0x1d, 0x07, 0x06,
290  0x2E, 0x2C, 0x29, 0x2D,
291  0x2E, 0x2E, 0x37, 0x3F,
292  0x00, 0x00, 0x02, 0x10,
293  ILI9163C_NORON , DELAY, // 3: Normal display on, no args, w/delay
294  10, // 10 ms delay
295  ILI9163C_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
296  100 }; // 100 ms delay
297 
298 
299 // Companion code to the above tables. Reads and issues
300 // a series of LCD commands stored in PROGMEM byte array.
301 //void Arduino_LCD::commandList(prog_uchar *addr) {
302 void Arduino_LCD::commandList(uint8_t *addr) {
303 
304  uint8_t numCommands, numArgs;
305  uint16_t ms;
306 
307  numCommands = *addr++; // Number of commands to follow
308  while(numCommands--) { // For each command...
309  writecommand(*addr++); // Read, issue command
310  numArgs = *addr++; // Number of args to follow
311  ms = numArgs & DELAY; // If hibit set, delay follows args
312  numArgs &= ~DELAY; // Mask out delay bit
313  while(numArgs--) { // For each argument...
314  writedata(*addr++); // Read, issue argument
315  }
316 
317  if(ms) {
318  ms = *addr++; // Read post-command delay time (ms)
319  if(ms == 255) ms = 500; // If 255, delay for 500 ms
320  delay(ms);
321  }
322  }
323 }
324 
325 
326 // Initialization code common to both 'B' and 'R' type displays
327 //void Arduino_LCD::commonInit(prog_uchar *cmdList) {
328 void Arduino_LCD::commonInit(uint8_t *cmdList) {
329 
330  colstart = rowstart = 0; // May be overridden in init func
331 
332  pinMode(_rs, OUTPUT);
333  pinMode(_cs, OUTPUT);
334 /*
335  csport = portOutputRegister(digitalPinToPort(_cs));
336  cspinmask = digitalPinToBitMask(_cs);
337  rsport = portOutputRegister(digitalPinToPort(_rs));
338  rspinmask = digitalPinToBitMask(_rs);
339 */
340 
341 // if(hwSPI) { // Using hardware SPI
342  SPI.begin();
343  SPI.setClockDivider(21); // 4 MHz (half speed)
344 // SPI.setClockDivider(SPI_CLOCK_DIV4); // 4 MHz (half speed)
345 // SPI.setBitOrder(MSBFIRST);
346 // there is no setBitOrder on the SPI library for the Due
348 /*
349  } else {
350  pinMode(_sclk, OUTPUT);
351  pinMode(_sid , OUTPUT);
352  clkport = portOutputRegister(digitalPinToPort(_sclk));
353  clkpinmask = digitalPinToBitMask(_sclk);
354  dataport = portOutputRegister(digitalPinToPort(_sid));
355  datapinmask = digitalPinToBitMask(_sid);
356  *clkport &= ~clkpinmask;
357  *dataport &= ~datapinmask;
358  }
359 */
360 
361  // toggle RST low to reset; CS low so it'll listen to us
362 // *csport &= ~cspinmask;
363  digitalWrite(_cs, LOW);
364  if (_rst) {
365  pinMode(_rst, OUTPUT);
366  digitalWrite(_rst, HIGH);
367  delay(500);
368  digitalWrite(_rst, LOW);
369  delay(500);
370  digitalWrite(_rst, HIGH);
371  delay(500);
372  }
373 
374  if(cmdList) commandList(cmdList);
375 }
376 
377 
378 // Initialization for ST7735B screens
379 void Arduino_LCD::initB(void) {
380  commonInit(Bcmd);
381  commandList(Rcmd3);
382 }
383 
384 
385 // Initialization for ST7735R screens (green or red tabs)
386 void Arduino_LCD::initR(uint8_t options) {
387  commonInit(Rcmd1);
388  if(options == INITR_GREENTAB) {
389  commandList(Rcmd2green);
390  colstart = 2;
391  rowstart = 1;
392  } else {
393  // colstart, rowstart left at default '0' values
394  commandList(Rcmd2red);
395  }
396  commandList(Rcmd3);
397 }
398 
399 
400 void Arduino_LCD::setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1,
401  uint8_t y1) {
402 
403  writecommand(ILI9163C_CASET); // Column addr set
404  writedata(0x00);
405  writedata(x0+colstart); // XSTART
406  writedata(0x00);
407  writedata(x1+colstart); // XEND
408 
409  writecommand(ILI9163C_RASET); // Row addr set
410  writedata(0x00);
411  writedata(y0+rowstart); // YSTART
412  writedata(0x00);
413  writedata(y1+rowstart); // YEND
414 
415  writecommand(ILI9163C_RAMWR); // write to RAM
416 }
417 
418 
420 
421  uint8_t x, y, hi = color >> 8, lo = color;
422 
423  setAddrWindow(0, 0, _width-1, _height-1);
424 
425 // *rsport |= rspinmask;
426 // *csport &= ~cspinmask;
427 digitalWrite(_rs, HIGH);
428  digitalWrite(_cs, LOW);
429 
430  for(y=_height; y>0; y--) {
431  for(x=_width; x>0; x--) {
432 //SPI.transfer(hi);
433 //SPI.transfer(lo);
434  spiwrite(hi);
435  spiwrite(lo);
436  }
437  }
438 
439 // *csport |= cspinmask;
440  digitalWrite(_cs, HIGH);
441 }
442 
443 
445 // *rsport |= rspinmask;
446 // *csport &= ~cspinmask;
447 digitalWrite(_rs, HIGH);
448  digitalWrite(_cs, LOW);
449 
450  spiwrite(color >> 8);
451  spiwrite(color);
452 //SPI.transfer(color>>8);
453 //SPI.transfer(color);
454 
455 // *csport |= cspinmask;
456  digitalWrite(_cs, HIGH);
457 }
458 
459 
460 void Arduino_LCD::drawPixel(int16_t x, int16_t y, uint16_t color) {
461 
462  if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
463 
464  setAddrWindow(x,y,x+1,y+1);
465 
466 // *rsport |= rspinmask;
467 // *csport &= ~cspinmask;
468 digitalWrite(_rs, HIGH);
469  digitalWrite(_cs, LOW);
470 
471  spiwrite(color >> 8);
472  spiwrite(color);
473 //SPI.transfer(color>>8);
474 //SPI.transfer(color);
475 
476 // *csport |= cspinmask;
477  digitalWrite(_cs, HIGH);
478 }
479 
480 
481 void Arduino_LCD::drawFastVLine(int16_t x, int16_t y, int16_t h,
482  uint16_t color) {
483 
484  // Rudimentary clipping
485  if((x >= _width) || (y >= _height)) return;
486  if((y+h-1) >= _height) h = _height-y;
487  setAddrWindow(x, y, x, y+h-1);
488 
489  uint8_t hi = color >> 8, lo = color;
490 // *rsport |= rspinmask;
491 // *csport &= ~cspinmask;
492 digitalWrite(_rs, HIGH);
493  digitalWrite(_cs, LOW);
494  while (h--) {
495  spiwrite(hi);
496  spiwrite(lo);
497 //SPI.transfer(hi);
498 //SPI.transfer(lo);
499  }
500 // *csport |= cspinmask;
501  digitalWrite(_cs, HIGH);
502 }
503 
504 
505 void Arduino_LCD::drawFastHLine(int16_t x, int16_t y, int16_t w,
506  uint16_t color) {
507 
508  // Rudimentary clipping
509  if((x >= _width) || (y >= _height)) return;
510  if((x+w-1) >= _width) w = _width-x;
511  setAddrWindow(x, y, x+w-1, y);
512 
513  uint8_t hi = color >> 8, lo = color;
514 // *rsport |= rspinmask;
515 // *csport &= ~cspinmask;
516 digitalWrite(_rs, HIGH);
517  digitalWrite(_cs, LOW);
518  while (w--) {
519  spiwrite(hi);
520  spiwrite(lo);
521 //SPI.transfer(hi);
522 //SPI.transfer(lo);
523  }
524 // *csport |= cspinmask;
525  digitalWrite(_cs, HIGH);
526 }
527 
528 
529 // fill a rectangle
530 void Arduino_LCD::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
531  uint16_t color) {
532 
533  // rudimentary clipping (drawChar w/big text requires this)
534  if((x >= _width) || (y >= _height)) return;
535  if((x + w - 1) >= _width) w = _width - x;
536  if((y + h - 1) >= _height) h = _height - y;
537 
538  setAddrWindow(x, y, x+w-1, y+h-1);
539 
540  uint8_t hi = color >> 8, lo = color;
541 // *rsport |= rspinmask;
542 // *csport &= ~cspinmask;
543 digitalWrite(_rs, HIGH);
544 digitalWrite(_cs, LOW);
545  for(y=h; y>0; y--) {
546  for(x=w; x>0; x--) {
547  spiwrite(hi);
548  spiwrite(lo);
549 //SPI.transfer(hi);
550 //SPI.transfer(lo);
551  }
552  }
553 
554 // *csport |= cspinmask;
555 digitalWrite(_cs, HIGH);
556 }
557 
558 
559 // Pass 8-bit (each) R,G,B, get back 16-bit packed color
560 uint16_t Arduino_LCD::Color565(uint8_t r, uint8_t g, uint8_t b) {
561  return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
562 }
563 
564 
565 #define MADCTL_MY 0x80
566 #define MADCTL_MX 0x40
567 #define MADCTL_MV 0x20
568 #define MADCTL_ML 0x10
569 #define MADCTL_RGB 0x08
570 #define MADCTL_MH 0x04
571 
573 
574  writecommand(ILI9163C_MADCTL);
575  rotation = m % 4; // can't be higher than 3
576  switch (rotation) {
577  case 0:
578  writedata(MADCTL_MX | MADCTL_MY | MADCTL_RGB);
581  break;
582  case 1:
583  writedata(MADCTL_MY | MADCTL_MV | MADCTL_RGB);
586  break;
587  case 2:
588  writedata(MADCTL_RGB);
591  break;
592  case 3:
593  writedata(MADCTL_MX | MADCTL_MV | MADCTL_RGB);
596  break;
597  }
598 }
599 
600 
602  writecommand(i ? ILI9163C_INVON : ILI9163C_INVOFF);
603 }
604 
605 /*
606  18, // there are 17 commands
607  ILI9163C_SWRESET, DELAY, // 1: Software reset, no args, w/delay
608  50, // 50 ms delay
609 
610  0x11, //Exit Sleep
611  DELAY,50,
612 
613  0x26, //Set Default Gamma
614  0x104,
615 
616  //0xF2, //E0h & E1h Enable/Disable
617  //0x100,
618 
619  0xB1,
620  0x10C,
621  0x114,
622 
623  0xC0, //Set VRH1[4:0] & VC[2:0] for VCI1 & GVDD
624  0x10C,
625  0x105,
626 
627  0xC1, //Set BT[2:0] for AVDD & VCL & VGH & VGL
628  0x102,
629 
630  0xC5, //Set VMH[6:0] & VML[6:0] for VOMH & VCOML
631  0x129,
632  0x143,
633 
634  0xC7,
635  0x140,
636 
637  0x3a, //Set Color Format
638  0x105,
639 
640  0x2A, //Set Column Address
641  0x100,
642  0x100,
643  0x100,
644  0x17F,
645 
646  0x2B, //Set Page Address
647  0x100,
648  0x100,
649  0x100,
650  0x19F,
651 
652  0x36, //Set Scanning Direction, RGB
653  0x1C0,
654 
655  0xB7, //Set Source Output Direction
656  0x100,
657 
658  0xf2, //Enable Gamma bit
659  0x101,
660 
661  0xE0,
662  0x136,//p1
663  0x129,//p2
664  0x112,//p3
665  0x122,//p4
666  0x11C,//p5
667  0x115,//p6
668  0x142,//p7
669  0x1B7,//p8
670  0x12F,//p9
671  0x113,//p10
672  0x112,//p11
673  0x10A,//p12
674  0x111,//p13
675  0x10B,//p14
676  0x106,//p15
677 
678  0xE1,
679  0x109,//p1
680  0x116,//p2
681  0x12D,//p3
682  0x10D,//p4
683  0x113,//p5
684  0x115,//p6
685  0x140,//p7
686  0x148,//p8
687  0x153,//p9
688  0x10C,//p10
689  0x11D,//p11
690  0x125,//p12
691  0x12E,//p13
692  0x134,//p14
693  0x139,//p15
694 
695  0x33, // scroll setup
696  0x100,
697  0x100,
698  0x100,
699  0x1C1,
700  0x100,
701  0x100,
702 
703  0x29, // Display On
704  0x2C}, // write gram
705 
706 */
707 
#define ILI9163C_PWCTR4
Definition: Arduino_LCD.h:70
#define INITR_GREENTAB
Definition: Arduino_LCD.h:32
Arduino_LCD(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST)
Definition: Arduino_LCD.cpp:28
#define MADCTL_MV
void fillScreen(uint16_t color)
void invertDisplay(boolean i)
#define ILI9163C_INVOFF
Definition: Arduino_LCD.h:48
uint8_t Bcmd[]
void pinMode(uint8_t, uint8_t)
uint8_t i
#define ILI9163C_GMCTRN1
Definition: Arduino_LCD.h:82
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
void initR(uint8_t options=INITR_GREENTAB)
uint16_t Color565(uint8_t r, uint8_t g, uint8_t b)
#define ILI9163C_PWCTR1
Definition: Arduino_LCD.h:67
void drawPixel(int16_t x, int16_t y, uint16_t color)
void delay(unsigned long)
Definition: wiring.c:106
#define ILI9163C_INVON
Definition: Arduino_LCD.h:49
#define ILI9163C_FRMCTR3
Definition: Arduino_LCD.h:63
#define SPI_MODE0
Definition: SPI.h:54
uint8_t Rcmd2red[]
#define ILI9163C_MADCTL
Definition: Arduino_LCD.h:59
static void setClockDivider(uint8_t clockDiv)
Definition: SPI.h:302
m
Definition: wiring.c:53
#define ILI9163C_FRMCTR1
Definition: Arduino_LCD.h:61
#define ILI9163C_COLMOD
Definition: Arduino_LCD.h:58
#define ILI9163C_INVCTR
Definition: Arduino_LCD.h:64
void initB(void)
void digitalWrite(uint8_t, uint8_t)
uint8_t Rcmd3[]
#define ILI9163C_DISPON
Definition: Arduino_LCD.h:51
SPIClass SPI
Definition: SPI.cpp:16
#define ILI9163C_NORON
Definition: Arduino_LCD.h:46
static void begin()
Definition: SPI.cpp:26
#define MADCTL_MY
#define ILI9163C_SLPOUT
Definition: Arduino_LCD.h:44
void setRotation(uint8_t r)
uint8_t Rcmd2green[]
#define DELAY
void pushColor(uint16_t color)
uint8_t Rcmd1[]
static void setDataMode(uint8_t dataMode)
Definition: SPI.h:297
int16_t _height
Definition: Adafruit_GFX.h:170
#define MADCTL_MX
uint16_t color
Definition: Adafruit_GFX.h:39
int16_t _width
Definition: Adafruit_GFX.h:170
#define ILI9163C_SWRESET
Definition: Arduino_LCD.h:39
#define LOW
Definition: Arduino.h:41
#define ILI9163C_FRMCTR2
Definition: Arduino_LCD.h:62
#define HIGH
Definition: Arduino.h:40
uint8_t rotation
Definition: Adafruit_GFX.h:175
#define ILI9163C_VMCTR1
Definition: Arduino_LCD.h:72
#define ILI9163C_CASET
Definition: Arduino_LCD.h:52
#define ILI9163C_PWCTR2
Definition: Arduino_LCD.h:68
#define MADCTL_RGB
#define ILI9163C_TFTWIDTH
Definition: Arduino_LCD.h:35
#define OUTPUT
Definition: Arduino.h:44
#define ILI9163C_GMCTRP1
Definition: Arduino_LCD.h:81
#define ILI9163C_TFTHEIGHT
Definition: Arduino_LCD.h:36
#define ILI9163C_PWCTR3
Definition: Arduino_LCD.h:69
#define ILI9163C_PWCTR5
Definition: Arduino_LCD.h:71
#define ILI9163C_RASET
Definition: Arduino_LCD.h:53
#define ILI9163C_RAMWR
Definition: Arduino_LCD.h:54
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
static uint8_t transfer(uint8_t data)
Definition: SPI.h:208
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)