Arduino  1.8.10
Arduino_LCD クラス

#include <Arduino_LCD.h>

Arduino_LCD の継承関係図
Adafruit_GFX Print Print RobotControl

公開メンバ関数

 Arduino_LCD (uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST)
 
 Arduino_LCD (uint8_t CS, uint8_t RS, uint8_t RST)
 
void initB (void)
 
void initR (uint8_t options=INITR_GREENTAB)
 
void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
 
void pushColor (uint16_t color)
 
void fillScreen (uint16_t color)
 
void drawPixel (int16_t x, int16_t y, uint16_t color)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void setRotation (uint8_t r)
 
void invertDisplay (boolean i)
 
uint16_t Color565 (uint8_t r, uint8_t g, uint8_t b)
 
- 基底クラス Adafruit_GFX に属する継承公開メンバ関数
 Adafruit_GFX (int16_t w, int16_t h)
 
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillScreen (uint16_t color)
 
virtual void invertDisplay (boolean i)
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t c)
 
void setTextColor (uint16_t c, uint16_t bg)
 
void setTextSize (uint8_t s)
 
void setTextWrap (boolean w)
 
void setRotation (uint8_t r)
 
virtual void write (uint8_t)
 
int16_t height (void)
 
int16_t width (void)
 
uint8_t getRotation (void)
 
virtual uint16_t newColor (uint8_t red, uint8_t green, uint8_t blue)
 
void background (uint8_t red, uint8_t green, uint8_t blue)
 
void background (color c)
 
void fill (uint8_t red, uint8_t green, uint8_t blue)
 
void fill (color c)
 
void noFill ()
 
void stroke (uint8_t red, uint8_t green, uint8_t blue)
 
void stroke (color c)
 
void noStroke ()
 
void text (const char *text, int16_t x, int16_t y)
 
void text (int value, uint8_t posX, uint8_t posY)
 
void text (long value, uint8_t posX, uint8_t posY)
 
void text (char value, uint8_t posX, uint8_t posY)
 
void textWrap (const char *text, int16_t x, int16_t y)
 
void textSize (uint8_t size)
 
void circle (int16_t x, int16_t y, int16_t r)
 
void point (int16_t x, int16_t y)
 
void line (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
 
void quad (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, int16_t x4, int16_t y4)
 
void rect (int16_t x, int16_t y, int16_t width, int16_t height)
 
void rect (int16_t x, int16_t y, int16_t width, int16_t height, int16_t radius)
 
void triangle (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3)
 
 Adafruit_GFX (int16_t w, int16_t h)
 
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillScreen (uint16_t color)
 
virtual void invertDisplay (boolean i)
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t c)
 
void setTextColor (uint16_t c, uint16_t bg)
 
void setTextSize (uint8_t s)
 
void setTextWrap (boolean w)
 
void setRotation (uint8_t r)
 
virtual void write (uint8_t)
 
int16_t height (void)
 
int16_t width (void)
 
uint8_t getRotation (void)
 
virtual uint16_t newColor (uint8_t red, uint8_t green, uint8_t blue)
 
void background (uint8_t red, uint8_t green, uint8_t blue)
 
void background (color c)
 
void fill (uint8_t red, uint8_t green, uint8_t blue)
 
void fill (color c)
 
void noFill ()
 
void stroke (uint8_t red, uint8_t green, uint8_t blue)
 
void stroke (color c)
 
void noStroke ()
 
void text (const char *text, int16_t x, int16_t y)
 
void textWrap (const char *text, int16_t x, int16_t y)
 
void textSize (uint8_t size)
 
void circle (int16_t x, int16_t y, int16_t r)
 
void point (int16_t x, int16_t y)
 
void line (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
 
void quad (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, int16_t x4, int16_t y4)
 
void rect (int16_t x, int16_t y, int16_t width, int16_t height)
 
void rect (int16_t x, int16_t y, int16_t width, int16_t height, int16_t radius)
 
void triangle (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3)
 
- 基底クラス Print に属する継承公開メンバ関数
 Print ()
 
int getWriteError ()
 
void clearWriteError ()
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
size_t write (const char *buffer, size_t size)
 
virtual int availableForWrite ()
 
size_t print (const __FlashStringHelper *)
 
size_t print (const String &)
 
size_t print (const char[])
 
size_t print (char)
 
size_t print (unsigned char, int=DEC)
 
size_t print (int, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t print (double, int=2)
 
size_t print (const Printable &)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const String &s)
 
size_t println (const char[])
 
size_t println (char)
 
size_t println (unsigned char, int=DEC)
 
size_t println (int, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (double, int=2)
 
size_t println (const Printable &)
 
size_t println (void)
 
virtual void flush ()
 

その他の継承メンバ

- 基底クラス Print に属する継承限定公開メンバ関数
void setWriteError (int err=1)
 
- 基底クラス Adafruit_GFX に属する継承限定公開変数類
const int16_t WIDTH
 
const int16_t HEIGHT
 
int16_t _width
 
int16_t _height
 
int16_t cursor_x
 
int16_t cursor_y
 
uint16_t textcolor
 
uint16_t textbgcolor
 
uint8_t textsize
 
uint8_t rotation
 
boolean wrap
 
color strokeColor
 
bool useStroke
 
color fillColor
 
bool useFill
 
int16_t WIDTH
 
int16_t HEIGHT
 

詳解

Arduino_LCD.h95 行目に定義があります。

構築子と解体子

◆ Arduino_LCD() [1/2]

Arduino_LCD::Arduino_LCD ( uint8_t  CS,
uint8_t  RS,
uint8_t  SID,
uint8_t  SCLK,
uint8_t  RST 
)

Arduino_LCD.cpp28 行目に定義があります。

30 {
31  _cs = cs;
32  _rs = rs;
33  _sid = sid;
34  _sclk = sclk;
35  _rst = rst;
36  hwSPI = false;
37 }
Adafruit_GFX(int16_t w, int16_t h)
#define ILI9163C_TFTWIDTH
Definition: Arduino_LCD.h:35
#define ILI9163C_TFTHEIGHT
Definition: Arduino_LCD.h:36

◆ Arduino_LCD() [2/2]

Arduino_LCD::Arduino_LCD ( uint8_t  CS,
uint8_t  RS,
uint8_t  RST 
)

Arduino_LCD.cpp42 行目に定義があります。

42  :
44  _cs = cs;
45  _rs = rs;
46  _rst = rst;
47  hwSPI = true;
48  _sid = _sclk = 0;
49 }
Adafruit_GFX(int16_t w, int16_t h)
#define ILI9163C_TFTWIDTH
Definition: Arduino_LCD.h:35
#define ILI9163C_TFTHEIGHT
Definition: Arduino_LCD.h:36

関数詳解

◆ Color565()

uint16_t Arduino_LCD::Color565 ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Arduino_LCD.cpp560 行目に定義があります。

560  {
561  return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
562 }

◆ drawFastHLine()

void Arduino_LCD::drawFastHLine ( int16_t  x,
int16_t  y,
int16_t  w,
uint16_t  color 
)

Arduino_LCD.cpp505 行目に定義があります。

506  {
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 }
void digitalWrite(uint8_t, uint8_t)
int16_t _height
Definition: Adafruit_GFX.h:170
uint16_t color
Definition: Adafruit_GFX.h:39
int16_t _width
Definition: Adafruit_GFX.h:170
#define LOW
Definition: Arduino.h:41
#define HIGH
Definition: Arduino.h:40
void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)

◆ drawFastVLine()

void Arduino_LCD::drawFastVLine ( int16_t  x,
int16_t  y,
int16_t  h,
uint16_t  color 
)

Arduino_LCD.cpp481 行目に定義があります。

482  {
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 }
void digitalWrite(uint8_t, uint8_t)
int16_t _height
Definition: Adafruit_GFX.h:170
uint16_t color
Definition: Adafruit_GFX.h:39
int16_t _width
Definition: Adafruit_GFX.h:170
#define LOW
Definition: Arduino.h:41
#define HIGH
Definition: Arduino.h:40
void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)

◆ drawPixel()

void Arduino_LCD::drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)
virtual

Adafruit_GFXを実装しています。

Arduino_LCD.cpp460 行目に定義があります。

460  {
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 }
void digitalWrite(uint8_t, uint8_t)
int16_t _height
Definition: Adafruit_GFX.h:170
uint16_t color
Definition: Adafruit_GFX.h:39
int16_t _width
Definition: Adafruit_GFX.h:170
#define LOW
Definition: Arduino.h:41
#define HIGH
Definition: Arduino.h:40
void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)

◆ fillRect()

void Arduino_LCD::fillRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t  color 
)

Arduino_LCD.cpp530 行目に定義があります。

531  {
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 }
void digitalWrite(uint8_t, uint8_t)
int16_t _height
Definition: Adafruit_GFX.h:170
uint16_t color
Definition: Adafruit_GFX.h:39
int16_t _width
Definition: Adafruit_GFX.h:170
#define LOW
Definition: Arduino.h:41
#define HIGH
Definition: Arduino.h:40
void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)

◆ fillScreen()

void Arduino_LCD::fillScreen ( uint16_t  color)

Arduino_LCD.cpp419 行目に定義があります。

419  {
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 }
void digitalWrite(uint8_t, uint8_t)
int16_t _height
Definition: Adafruit_GFX.h:170
uint16_t color
Definition: Adafruit_GFX.h:39
int16_t _width
Definition: Adafruit_GFX.h:170
#define LOW
Definition: Arduino.h:41
#define HIGH
Definition: Arduino.h:40
void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)

◆ initB()

void Arduino_LCD::initB ( void  )

Arduino_LCD.cpp379 行目に定義があります。

379  {
380  commonInit(Bcmd);
381  commandList(Rcmd3);
382 }
uint8_t Bcmd[]
uint8_t Rcmd3[]

◆ initR()

void Arduino_LCD::initR ( uint8_t  options = INITR_GREENTAB)

Arduino_LCD.cpp386 行目に定義があります。

386  {
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 }
#define INITR_GREENTAB
Definition: Arduino_LCD.h:32
uint8_t Rcmd2red[]
uint8_t Rcmd3[]
uint8_t Rcmd2green[]
uint8_t Rcmd1[]

◆ invertDisplay()

void Arduino_LCD::invertDisplay ( boolean  i)

Arduino_LCD.cpp601 行目に定義があります。

601  {
602  writecommand(i ? ILI9163C_INVON : ILI9163C_INVOFF);
603 }
#define ILI9163C_INVOFF
Definition: Arduino_LCD.h:48
uint8_t i
#define ILI9163C_INVON
Definition: Arduino_LCD.h:49

◆ pushColor()

void Arduino_LCD::pushColor ( uint16_t  color)

Arduino_LCD.cpp444 行目に定義があります。

444  {
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 }
void digitalWrite(uint8_t, uint8_t)
uint16_t color
Definition: Adafruit_GFX.h:39
#define LOW
Definition: Arduino.h:41
#define HIGH
Definition: Arduino.h:40

◆ setAddrWindow()

void Arduino_LCD::setAddrWindow ( uint8_t  x0,
uint8_t  y0,
uint8_t  x1,
uint8_t  y1 
)

Arduino_LCD.cpp400 行目に定義があります。

401  {
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 }
#define ILI9163C_CASET
Definition: Arduino_LCD.h:52
#define ILI9163C_RASET
Definition: Arduino_LCD.h:53
#define ILI9163C_RAMWR
Definition: Arduino_LCD.h:54

◆ setRotation()

void Arduino_LCD::setRotation ( uint8_t  r)

Arduino_LCD.cpp572 行目に定義があります。

572  {
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 }
#define MADCTL_MV
#define ILI9163C_MADCTL
Definition: Arduino_LCD.h:59
m
Definition: wiring.c:53
#define MADCTL_MY
int16_t _height
Definition: Adafruit_GFX.h:170
#define MADCTL_MX
int16_t _width
Definition: Adafruit_GFX.h:170
uint8_t rotation
Definition: Adafruit_GFX.h:175
#define MADCTL_RGB
#define ILI9163C_TFTWIDTH
Definition: Arduino_LCD.h:35
#define ILI9163C_TFTHEIGHT
Definition: Arduino_LCD.h:36

このクラス詳解は次のファイルから抽出されました: