M5StickC  0.2.0
TFT_eSPI クラス

#include <In_eSPI.h>

TFT_eSPI の継承関係図
M5Display TFT_eSprite

クラス

struct  fontMetrics
 

公開メンバ関数

 TFT_eSPI (int16_t _W=TFT_WIDTH, int16_t _H=TFT_HEIGHT)
 
void init (uint8_t tc=TAB_COLOUR)
 
void begin (uint8_t tc=TAB_COLOUR)
 
virtual void drawPixel (int32_t x, int32_t y, uint32_t color)
 
virtual void drawChar (int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size)
 
virtual void drawLine (int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
 
virtual void drawFastVLine (int32_t x, int32_t y, int32_t h, uint32_t color)
 
virtual void drawFastHLine (int32_t x, int32_t y, int32_t w, uint32_t color)
 
virtual void fillRect (int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
 
virtual int16_t drawChar (uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
 
virtual int16_t drawChar (uint16_t uniCode, int32_t x, int32_t y)
 
virtual int16_t height (void)
 
virtual int16_t width (void)
 
void setWindow (int32_t xs, int32_t ys, int32_t xe, int32_t ye)
 
void pushColor (uint16_t color)
 
void pushColor (uint16_t color, uint32_t len)
 
void pushColors (uint16_t *data, uint32_t len, bool swap=true)
 
void pushColors (uint8_t *data, uint32_t len)
 
void fillScreen (uint32_t color)
 
void drawRect (int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
 
void drawRoundRect (int32_t x0, int32_t y0, int32_t w, int32_t h, int32_t radius, uint32_t color)
 
void fillRoundRect (int32_t x0, int32_t y0, int32_t w, int32_t h, int32_t radius, uint32_t color)
 
void setRotation (uint8_t r)
 
void invertDisplay (boolean i)
 
void drawCircle (int32_t x0, int32_t y0, int32_t r, uint32_t color)
 
void drawCircleHelper (int32_t x0, int32_t y0, int32_t r, uint8_t cornername, uint32_t color)
 
void fillCircle (int32_t x0, int32_t y0, int32_t r, uint32_t color)
 
void fillCircleHelper (int32_t x0, int32_t y0, int32_t r, uint8_t cornername, int32_t delta, uint32_t color)
 
void drawEllipse (int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color)
 
void fillEllipse (int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color)
 
void drawTriangle (int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color)
 
void fillTriangle (int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color)
 
void drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 
void drawXBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 
void drawXBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor, uint16_t bgcolor)
 
void setBitmapColor (uint16_t fgcolor, uint16_t bgcolor)
 
void setPivot (int16_t x, int16_t y)
 
void setCursor (int16_t x, int16_t y)
 
void setCursor (int16_t x, int16_t y, uint8_t font)
 
void setTextColor (uint16_t color)
 
void setTextColor (uint16_t fgcolor, uint16_t bgcolor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (boolean wrapX, boolean wrapY=false)
 
void setTextDatum (uint8_t datum)
 
void setTextPadding (uint16_t x_width)
 
void setFreeFont (const GFXfont *f=NULL)
 
void setTextFont (uint8_t font)
 
void spiwrite (uint8_t)
 
void writecommand (uint8_t c)
 
void writedata (uint8_t d)
 
void commandList (const uint8_t *addr)
 
uint8_t readcommand8 (uint8_t cmd_function, uint8_t index=0)
 
uint16_t readcommand16 (uint8_t cmd_function, uint8_t index=0)
 
uint32_t readcommand32 (uint8_t cmd_function, uint8_t index=0)
 
uint16_t readPixel (int32_t x0, int32_t y0)
 
void setCallback (getColorCallback getCol)
 
void readRect (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
 
void pushRect (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data, uint16_t transparent)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, const uint16_t *data, uint16_t transparent)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, const uint16_t *data)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data, bool bpp8=true)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data, uint8_t transparent, bool bpp8=true)
 
void setSwapBytes (bool swap)
 
bool getSwapBytes (void)
 
void readRectRGB (int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data)
 
uint8_t getRotation (void)
 
uint8_t getTextDatum (void)
 
uint8_t color16to8 (uint16_t color565)
 
int16_t getCursorX (void)
 
int16_t getCursorY (void)
 
int16_t getPivotX (void)
 
int16_t getPivotY (void)
 
uint16_t fontsLoaded (void)
 
uint16_t color565 (uint8_t red, uint8_t green, uint8_t blue)
 
uint16_t color8to16 (uint8_t color332)
 
int16_t drawNumber (long long_num, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawNumber (long long_num, int32_t poX, int32_t poY)
 
int16_t drawFloat (float floatNumber, uint8_t decimal, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawFloat (float floatNumber, uint8_t decimal, int32_t poX, int32_t poY)
 
int16_t drawString (const char *string, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawString (const char *string, int32_t poX, int32_t poY)
 
int16_t drawCentreString (const char *string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t drawRightString (const char *string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t drawString (const String &string, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawString (const String &string, int32_t poX, int32_t poY)
 
int16_t drawCentreString (const String &string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t drawRightString (const String &string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t textWidth (const char *string, uint8_t font)
 
int16_t textWidth (const char *string)
 
int16_t textWidth (const String &string, uint8_t font)
 
int16_t textWidth (const String &string)
 
int16_t fontHeight (int16_t font)
 
int16_t fontHeight (void)
 
void setAddrWindow (int32_t xs, int32_t ys, int32_t w, int32_t h)
 
void startWrite (void)
 
void writeColor (uint16_t color, uint32_t len)
 
void endWrite (void)
 
uint16_t decodeUTF8 (uint8_t *buf, uint16_t *index, uint16_t remaining)
 
uint16_t decodeUTF8 (uint8_t c)
 
size_t write (uint8_t)
 
void setAttribute (uint8_t id=0, uint8_t a=0)
 
uint8_t getAttribute (uint8_t id=0)
 
void getSetup (setup_t &tft_settings)
 
void loadFont (String fontName, fs::FS &ffs)
 
void loadFont (String fontName, bool flash=true)
 
void unloadFont (void)
 
bool getUnicodeIndex (uint16_t unicode, uint16_t *index)
 
uint16_t alphaBlend (uint8_t alpha, uint16_t fgc, uint16_t bgc)
 
virtual void drawGlyph (uint16_t code)
 
void showFont (uint32_t td)
 

静的公開メンバ関数

static SPIClass & getSPIinstance (void)
 

公開変数類

int32_t cursor_x
 
int32_t cursor_y
 
int32_t padX
 
uint32_t textcolor
 
uint32_t textbgcolor
 
uint32_t bitmap_fg
 
uint32_t bitmap_bg
 
uint8_t textfont
 
uint8_t textsize
 
uint8_t textdatum
 
uint8_t rotation
 
int16_t _xpivot
 
int16_t _ypivot
 
uint8_t decoderState = 0
 
uint16_t decoderBuffer
 
fontMetrics gFont = { 0, 0, 0, 0, 0, 0, 0 }
 
uint16_t * gUnicode = NULL
 
uint8_t * gHeight = NULL
 
uint8_t * gWidth = NULL
 
uint8_t * gxAdvance = NULL
 
int16_t * gdY = NULL
 
int8_t * gdX = NULL
 
uint32_t * gBitmap = NULL
 
bool fontLoaded = false
 
fs::File fontFile
 

限定公開変数類

int32_t win_xe
 
int32_t win_ye
 
int32_t _init_width
 
int32_t _init_height
 
int32_t _width
 
int32_t _height
 
int32_t addr_row
 
int32_t addr_col
 
uint32_t fontsloaded
 
uint8_t glyph_ab
 
uint8_t glyph_bb
 
bool isDigits
 
bool textwrapX
 
bool textwrapY
 
bool _swapBytes
 
bool locked
 
bool inTransaction
 
bool _booted
 
bool _cp437
 
bool _utf8
 
uint32_t _lastColor
 
GFXfont * gfxFont
 

詳解

In_eSPI.h668 行目に定義があります。

構築子と解体子

◆ TFT_eSPI()

TFT_eSPI::TFT_eSPI ( int16_t  _W = TFT_WIDTH,
int16_t  _H = TFT_HEIGHT 
)

In_eSPI.cpp142 行目に定義があります。

143 {
144 
145 // The control pins are deliberately set to the inactive state (CS high) as setup()
146 // might call and initialise other SPI peripherals which would could cause conflicts
147 // if CS is floating or undefined.
148 #ifdef TFT_CS
149  digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
150  pinMode(TFT_CS, OUTPUT);
151 #endif
152 
153 // Configure chip select for touchscreen controller if present
154 #ifdef TOUCH_CS
155  digitalWrite(TOUCH_CS, HIGH); // Chip select high (inactive)
156  pinMode(TOUCH_CS, OUTPUT);
157 #endif
158 
159 #ifdef TFT_WR
160  digitalWrite(TFT_WR, HIGH); // Set write strobe high (inactive)
161  pinMode(TFT_WR, OUTPUT);
162 #endif
163 
164 #ifdef TFT_DC
165  digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
166  pinMode(TFT_DC, OUTPUT);
167 #endif
168 
169 #ifdef TFT_RST
170  if (TFT_RST >= 0) {
171  digitalWrite(TFT_RST, HIGH); // Set high, do not share pin with another SPI device
172  pinMode(TFT_RST, OUTPUT);
173  }
174 #endif
175 
176 #ifdef ESP32_PARALLEL
177 
178  // Create a bit set lookup table for data bus - wastes 1kbyte of RAM but speeds things up dramatically
179  for (int32_t c = 0; c<256; c++)
180  {
181  xset_mask[c] = 0;
182  if ( c & 0x01 ) xset_mask[c] |= (1 << TFT_D0);
183  if ( c & 0x02 ) xset_mask[c] |= (1 << TFT_D1);
184  if ( c & 0x04 ) xset_mask[c] |= (1 << TFT_D2);
185  if ( c & 0x08 ) xset_mask[c] |= (1 << TFT_D3);
186  if ( c & 0x10 ) xset_mask[c] |= (1 << TFT_D4);
187  if ( c & 0x20 ) xset_mask[c] |= (1 << TFT_D5);
188  if ( c & 0x40 ) xset_mask[c] |= (1 << TFT_D6);
189  if ( c & 0x80 ) xset_mask[c] |= (1 << TFT_D7);
190  }
191 
192  // Make sure read is high before we set the bus to output
193  digitalWrite(TFT_RD, HIGH);
194  pinMode(TFT_RD, OUTPUT);
195 
196  GPIO.out_w1ts = set_mask(255); // Set data bus to 0xFF
197 
198  // Set TFT data bus lines to output
199  busDir(dir_mask, OUTPUT);
200 
201 #endif
202 
203  _init_width = _width = w; // Set by specific xxxxx_Defines.h file or by users sketch
204  _init_height = _height = h; // Set by specific xxxxx_Defines.h file or by users sketch
205  rotation = 0;
206  cursor_y = cursor_x = 0;
207  textfont = 1;
208  textsize = 1;
209  textcolor = bitmap_fg = 0xFFFF; // White
210  textbgcolor = bitmap_bg = 0x0000; // Black
211  padX = 0; // No padding
212  isDigits = false; // No bounding box adjustment
213  textwrapX = true; // Wrap text at end of line when using print stream
214  textwrapY = false; // Wrap text at bottom of screen when using print stream
215  textdatum = TL_DATUM; // Top Left text alignment is default
216  fontsloaded = 0;
217 
218  _swapBytes = false; // Do not swap colour bytes by default
219 
220  locked = true; // ESP32 transaction mutex lock flags
221  inTransaction = false;
222 
223  _booted = true;
224  _cp437 = true;
225  _utf8 = true;
226 
227  addr_row = 0xFFFF;
228  addr_col = 0xFFFF;
229 
230  _xpivot = 0;
231  _ypivot = 0;
232 
233  cspinmask = 0;
234  dcpinmask = 0;
235  wrpinmask = 0;
236  sclkpinmask = 0;
237 
238 #ifdef LOAD_GLCD
239  fontsloaded = 0x0002; // Bit 1 set
240 #endif
241 
242 #ifdef LOAD_FONT2
243  fontsloaded |= 0x0004; // Bit 2 set
244 #endif
245 
246 #ifdef LOAD_FONT4
247  fontsloaded |= 0x0010; // Bit 4 set
248 #endif
249 
250 #ifdef LOAD_FONT6
251  fontsloaded |= 0x0040; // Bit 6 set
252 #endif
253 
254 #ifdef LOAD_FONT7
255  fontsloaded |= 0x0080; // Bit 7 set
256 #endif
257 
258 #ifdef LOAD_FONT8
259  fontsloaded |= 0x0100; // Bit 8 set
260 #endif
261 
262 #ifdef LOAD_FONT8N
263  fontsloaded |= 0x0200; // Bit 9 set
264 #endif
265 
266 #ifdef SMOOTH_FONT
267  fontsloaded |= 0x8000; // Bit 15 set
268 #endif
269 }

関数詳解

◆ alphaBlend()

uint16_t TFT_eSPI::alphaBlend ( uint8_t  alpha,
uint16_t  fgc,
uint16_t  bgc 
)

In_eSPI.cpp5789 行目に定義があります。

5790 {
5791  // For speed use fixed point maths and rounding to permit a power of 2 division
5792  uint16_t fgR = ((fgc >> 10) & 0x3E) + 1;
5793  uint16_t fgG = ((fgc >> 4) & 0x7E) + 1;
5794  uint16_t fgB = ((fgc << 1) & 0x3E) + 1;
5795 
5796  uint16_t bgR = ((bgc >> 10) & 0x3E) + 1;
5797  uint16_t bgG = ((bgc >> 4) & 0x7E) + 1;
5798  uint16_t bgB = ((bgc << 1) & 0x3E) + 1;
5799 
5800  // Shift right 1 to drop rounding bit and shift right 8 to divide by 256
5801  uint16_t r = (((fgR * alpha) + (bgR * (255 - alpha))) >> 9);
5802  uint16_t g = (((fgG * alpha) + (bgG * (255 - alpha))) >> 9);
5803  uint16_t b = (((fgB * alpha) + (bgB * (255 - alpha))) >> 9);
5804 
5805  // Combine RGB565 colours into 16 bits
5806  //return ((r&0x18) << 11) | ((g&0x30) << 5) | ((b&0x18) << 0); // 2 bit greyscale
5807  //return ((r&0x1E) << 11) | ((g&0x3C) << 5) | ((b&0x1E) << 0); // 4 bit greyscale
5808  return (r << 11) | (g << 5) | (b << 0);
5809 }

◆ begin()

void TFT_eSPI::begin ( uint8_t  tc = TAB_COLOUR)

In_eSPI.cpp276 行目に定義があります。

277 {
278  init(tc);
279 }

◆ color16to8()

uint8_t TFT_eSPI::color16to8 ( uint16_t  color565)

In_eSPI.cpp3934 行目に定義があります。

3935 {
3936  return ((c & 0xE000)>>8) | ((c & 0x0700)>>6) | ((c & 0x0018)>>3);
3937 }

◆ color565()

uint16_t TFT_eSPI::color565 ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

In_eSPI.cpp3924 行目に定義があります。

3925 {
3926  return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
3927 }

◆ color8to16()

uint16_t TFT_eSPI::color8to16 ( uint8_t  color332)

In_eSPI.cpp3944 行目に定義があります。

3945 {
3946  uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
3947  uint16_t color16 = 0;
3948 
3949  // =====Green===== ===============Red==============
3950  color16 = (color & 0x1C)<<6 | (color & 0xC0)<<5 | (color & 0xE0)<<8;
3951  // =====Green===== =======Blue======
3952  color16 |= (color & 0x1C)<<3 | blue[color & 0x03];
3953 
3954  return color16;
3955 }

◆ commandList()

void TFT_eSPI::commandList ( const uint8_t *  addr)

In_eSPI.cpp526 行目に定義があります。

527 {
528  uint8_t numCommands;
529  uint8_t numArgs;
530  uint8_t ms;
531 
532  numCommands = pgm_read_byte(addr++); // Number of commands to follow
533 
534  while (numCommands--) // For each command...
535  {
536  writecommand(pgm_read_byte(addr++)); // Read, issue command
537  numArgs = pgm_read_byte(addr++); // Number of args to follow
538  ms = numArgs & TFT_INIT_DELAY; // If hibit set, delay follows args
539  numArgs &= ~TFT_INIT_DELAY; // Mask out delay bit
540 
541  while (numArgs--) // For each argument...
542  {
543  writedata(pgm_read_byte(addr++)); // Read, issue argument
544  }
545 
546  if (ms)
547  {
548  ms = pgm_read_byte(addr++); // Read post-command delay time (ms)
549  delay( (ms==255 ? 500 : ms) );
550  }
551  }
552 
553 }

◆ decodeUTF8() [1/2]

uint16_t TFT_eSPI::decodeUTF8 ( uint8_t *  buf,
uint16_t *  index,
uint16_t  remaining 
)

In_eSPI.cpp4074 行目に定義があります。

4075 {
4076  uint16_t c = buf[(*index)++];
4077  //Serial.print("Byte from string = 0x"); Serial.println(c, HEX);
4078 
4079 #ifdef DECODE_UTF8
4080  // 7 bit Unicode
4081  if ((c & 0x80) == 0x00) return c;
4082 
4083  // 11 bit Unicode
4084  if (((c & 0xE0) == 0xC0) && (remaining > 1))
4085  return ((c & 0x1F)<<6) | (buf[(*index)++]&0x3F);
4086 
4087  // 16 bit Unicode
4088  if (((c & 0xF0) == 0xE0) && (remaining > 2))
4089  {
4090  c = ((c & 0x0F)<<12) | ((buf[(*index)++]&0x3F)<<6);
4091  return c | ((buf[(*index)++]&0x3F));
4092  }
4093 
4094  // 21 bit Unicode not supported so fall-back to extended ASCII
4095  // if ((c & 0xF8) == 0xF0) return c;
4096 #endif
4097 
4098  return c; // fall-back to extended ASCII
4099 }

◆ decodeUTF8() [2/2]

uint16_t TFT_eSPI::decodeUTF8 ( uint8_t  c)

In_eSPI.cpp4018 行目に定義があります。

4019 {
4020 #ifdef DECODE_UTF8
4021  // 7 bit Unicode Code Point
4022  if ((c & 0x80) == 0x00) {
4023  decoderState = 0;
4024  return (uint16_t)c;
4025  }
4026 
4027  if (decoderState == 0)
4028  {
4029  // 11 bit Unicode Code Point
4030  if ((c & 0xE0) == 0xC0)
4031  {
4032  decoderBuffer = ((c & 0x1F)<<6);
4033  decoderState = 1;
4034  return 0;
4035  }
4036 
4037  // 16 bit Unicode Code Point
4038  if ((c & 0xF0) == 0xE0)
4039  {
4040  decoderBuffer = ((c & 0x0F)<<12);
4041  decoderState = 2;
4042  return 0;
4043  }
4044  // 21 bit Unicode Code Point not supported so fall-back to extended ASCII
4045  // if ((c & 0xF8) == 0xF0) return (uint16_t)c;
4046  }
4047  else
4048  {
4049  if (decoderState == 2)
4050  {
4051  decoderBuffer |= ((c & 0x3F)<<6);
4052  decoderState--;
4053  return 0;
4054  }
4055  else
4056  {
4057  decoderBuffer |= (c & 0x3F);
4058  decoderState = 0;
4059  return decoderBuffer;
4060  }
4061  }
4062 
4063  decoderState = 0;
4064 #endif
4065 
4066  return (uint16_t)c; // fall-back to extended ASCII
4067 }

◆ drawBitmap()

void TFT_eSPI::drawBitmap ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
int16_t  w,
int16_t  h,
uint16_t  color 
)

In_eSPI.cpp2071 行目に定義があります。

2072 {
2073  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
2074  inTransaction = true;
2075 
2076  int32_t i, j, byteWidth = (w + 7) / 8;
2077 
2078  for (j = 0; j < h; j++) {
2079  for (i = 0; i < w; i++ ) {
2080  if (pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) {
2081  drawPixel(x + i, y + j, color);
2082  }
2083  }
2084  }
2085 
2086  inTransaction = false;
2087  spi_end(); // Does nothing if Sprite class uses this function
2088 }

◆ drawCentreString() [1/2]

int16_t TFT_eSPI::drawCentreString ( const char *  string,
int32_t  dX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4803 行目に定義があります。

4804 {
4805  uint8_t tempdatum = textdatum;
4806  int32_t sumX = 0;
4807  textdatum = TC_DATUM;
4808  sumX = drawString(string, dX, poY, font);
4809  textdatum = tempdatum;
4810  return sumX;
4811 }

◆ drawCentreString() [2/2]

int16_t TFT_eSPI::drawCentreString ( const String &  string,
int32_t  dX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4795 行目に定義があります。

4796 {
4797  int16_t len = string.length() + 2;
4798  char buffer[len];
4799  string.toCharArray(buffer, len);
4800  return drawCentreString(buffer, dX, poY, font);
4801 }

◆ drawChar() [1/3]

void TFT_eSPI::drawChar ( int32_t  x,
int32_t  y,
uint16_t  c,
uint32_t  color,
uint32_t  bg,
uint8_t  size 
)

In_eSPI.cpp2476 行目に定義があります。

2477 {
2478  if ((x >= _width) || // Clip right
2479  (y >= _height) || // Clip bottom
2480  ((x + 6 * size - 1) < 0) || // Clip left
2481  ((y + 8 * size - 1) < 0)) // Clip top
2482  return;
2483 
2484  if (c < 32) return;
2485 #ifdef LOAD_GLCD
2486 //>>>>>>>>>>>>>>>>>>
2487 #ifdef LOAD_GFXFF
2488  if(!gfxFont) { // 'Classic' built-in font
2489 #endif
2490 //>>>>>>>>>>>>>>>>>>
2491 
2492  boolean fillbg = (bg != color);
2493 
2494  if ((size==1) && fillbg)
2495  {
2496  uint8_t column[6];
2497  uint8_t mask = 0x1;
2498  spi_begin();
2499 
2500  setWindow(x, y, x+5, y+8);
2501 
2502  for (int8_t i = 0; i < 5; i++ ) column[i] = pgm_read_byte(font + (c * 5) + i);
2503  column[5] = 0;
2504 
2505 #if defined (ESP8266) && !defined (ILI9488_DRIVER)
2506  color = (color >> 8) | (color << 8);
2507  bg = (bg >> 8) | (bg << 8);
2508 
2509  for (int8_t j = 0; j < 8; j++) {
2510  for (int8_t k = 0; k < 5; k++ ) {
2511  if (column[k] & mask) {
2512  SPI1W0 = color;
2513  }
2514  else {
2515  SPI1W0 = bg;
2516  }
2517  SPI1CMD |= SPIBUSY;
2518  while(SPI1CMD & SPIBUSY) {}
2519  }
2520 
2521  mask <<= 1;
2522 
2523  SPI1W0 = bg;
2524  SPI1CMD |= SPIBUSY;
2525  while(SPI1CMD & SPIBUSY) {}
2526  }
2527 #else // for ESP32 or ILI9488
2528 
2529  for (int8_t j = 0; j < 8; j++) {
2530  for (int8_t k = 0; k < 5; k++ ) {
2531  if (column[k] & mask) {tft_Write_16(color);}
2532  else {tft_Write_16(bg);}
2533  }
2534  mask <<= 1;
2535  tft_Write_16(bg);
2536  }
2537 
2538 #endif
2539 
2540  spi_end();
2541  }
2542  else
2543  {
2544  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
2545  inTransaction = true;
2546  for (int8_t i = 0; i < 6; i++ ) {
2547  uint8_t line;
2548  if (i == 5)
2549  line = 0x0;
2550  else
2551  line = pgm_read_byte(font + (c * 5) + i);
2552 
2553  if (size == 1) // default size
2554  {
2555  for (int8_t j = 0; j < 8; j++) {
2556  if (line & 0x1) drawPixel(x + i, y + j, color);
2557  line >>= 1;
2558  }
2559  }
2560  else { // big size
2561  for (int8_t j = 0; j < 8; j++) {
2562  if (line & 0x1) fillRect(x + (i * size), y + (j * size), size, size, color);
2563  else if (fillbg) fillRect(x + i * size, y + j * size, size, size, bg);
2564  line >>= 1;
2565  }
2566  }
2567  }
2568  inTransaction = false;
2569  spi_end(); // Does nothing if Sprite class uses this function
2570  }
2571 
2572 //>>>>>>>>>>>>>>>>>>>>>>>>>>>
2573 #ifdef LOAD_GFXFF
2574  } else { // Custom font
2575 #endif
2576 //>>>>>>>>>>>>>>>>>>>>>>>>>>>
2577 #endif // LOAD_GLCD
2578 
2579 #ifdef LOAD_GFXFF
2580  // Filter out bad characters not present in font
2581  if ((c >= pgm_read_word(&gfxFont->first)) && (c <= pgm_read_word(&gfxFont->last )))
2582  {
2583  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
2584  inTransaction = true;
2585 //>>>>>>>>>>>>>>>>>>>>>>>>>>>
2586 
2587  c -= pgm_read_word(&gfxFont->first);
2588  GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c]);
2589  uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
2590 
2591  uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
2592  uint8_t w = pgm_read_byte(&glyph->width),
2593  h = pgm_read_byte(&glyph->height);
2594  //xa = pgm_read_byte(&glyph->xAdvance);
2595  int8_t xo = pgm_read_byte(&glyph->xOffset),
2596  yo = pgm_read_byte(&glyph->yOffset);
2597  uint8_t xx, yy, bits=0, bit=0;
2598  int16_t xo16 = 0, yo16 = 0;
2599 
2600  if(size > 1) {
2601  xo16 = xo;
2602  yo16 = yo;
2603  }
2604 
2605 // Here we have 3 versions of the same function just for evaluation purposes
2606 // Comment out the next two #defines to revert to the slower Adafruit implementation
2607 
2608 // If FAST_LINE is defined then the free fonts are rendered using horizontal lines
2609 // this makes rendering fonts 2-5 times faster. Particularly good for large fonts.
2610 // This is an elegant solution since it still uses generic functions present in the
2611 // stock library.
2612 
2613 // If FAST_SHIFT is defined then a slightly faster (at least for AVR processors)
2614 // shifting bit mask is used
2615 
2616 // Free fonts don't look good when the size multiplier is >1 so we could remove
2617 // code if this is not wanted and speed things up
2618 
2619 #define FAST_HLINE
2620 #define FAST_SHIFT
2621 //FIXED_SIZE is an option in User_Setup.h that only works with FAST_LINE enabled
2622 
2623 #ifdef FIXED_SIZE
2624  x+=xo; // Save 88 bytes of FLASH
2625  y+=yo;
2626 #endif
2627 
2628 #ifdef FAST_HLINE
2629 
2630  #ifdef FAST_SHIFT
2631  uint16_t hpc = 0; // Horizontal foreground pixel count
2632  for(yy=0; yy<h; yy++) {
2633  for(xx=0; xx<w; xx++) {
2634  if(bit == 0) {
2635  bits = pgm_read_byte(&bitmap[bo++]);
2636  bit = 0x80;
2637  }
2638  if(bits & bit) hpc++;
2639  else {
2640  if (hpc) {
2641 #ifndef FIXED_SIZE
2642  if(size == 1) drawFastHLine(x+xo+xx-hpc, y+yo+yy, hpc, color);
2643  else fillRect(x+(xo16+xx-hpc)*size, y+(yo16+yy)*size, size*hpc, size, color);
2644 #else
2645  drawFastHLine(x+xx-hpc, y+yy, hpc, color);
2646 #endif
2647  hpc=0;
2648  }
2649  }
2650  bit >>= 1;
2651  }
2652  // Draw pixels for this line as we are about to increment yy
2653  if (hpc) {
2654 #ifndef FIXED_SIZE
2655  if(size == 1) drawFastHLine(x+xo+xx-hpc, y+yo+yy, hpc, color);
2656  else fillRect(x+(xo16+xx-hpc)*size, y+(yo16+yy)*size, size*hpc, size, color);
2657 #else
2658  drawFastHLine(x+xx-hpc, y+yy, hpc, color);
2659 #endif
2660  hpc=0;
2661  }
2662  }
2663  #else
2664  uint16_t hpc = 0; // Horizontal foreground pixel count
2665  for(yy=0; yy<h; yy++) {
2666  for(xx=0; xx<w; xx++) {
2667  if(!(bit++ & 7)) {
2668  bits = pgm_read_byte(&bitmap[bo++]);
2669  }
2670  if(bits & 0x80) hpc++;
2671  else {
2672  if (hpc) {
2673  if(size == 1) drawFastHLine(x+xo+xx-hpc, y+yo+yy, hpc, color);
2674  else fillRect(x+(xo16+xx-hpc)*size, y+(yo16+yy)*size, size*hpc, size, color);
2675  hpc=0;
2676  }
2677  }
2678  bits <<= 1;
2679  }
2680  // Draw pixels for this line as we are about to increment yy
2681  if (hpc) {
2682  if(size == 1) drawFastHLine(x+xo+xx-hpc, y+yo+yy, hpc, color);
2683  else fillRect(x+(xo16+xx-hpc)*size, y+(yo16+yy)*size, size*hpc, size, color);
2684  hpc=0;
2685  }
2686  }
2687  #endif
2688 
2689 #else
2690  for(yy=0; yy<h; yy++) {
2691  for(xx=0; xx<w; xx++) {
2692  if(!(bit++ & 7)) {
2693  bits = pgm_read_byte(&bitmap[bo++]);
2694  }
2695  if(bits & 0x80) {
2696  if(size == 1) {
2697  drawPixel(x+xo+xx, y+yo+yy, color);
2698  } else {
2699  fillRect(x+(xo16+xx)*size, y+(yo16+yy)*size, size, size, color);
2700  }
2701  }
2702  bits <<= 1;
2703  }
2704  }
2705 #endif
2706  inTransaction = false;
2707  spi_end(); // Does nothing if Sprite class uses this function
2708  }
2709 #endif
2710 
2711 
2712 #ifdef LOAD_GLCD
2713  #ifdef LOAD_GFXFF
2714  } // End classic vs custom font
2715  #endif
2716 #endif
2717 
2718 }

◆ drawChar() [2/3]

int16_t TFT_eSPI::drawChar ( uint16_t  uniCode,
int32_t  x,
int32_t  y 
)

In_eSPI.cpp4253 行目に定義があります。

4254 {
4255  return drawChar(uniCode, x, y, textfont);
4256 }

◆ drawChar() [3/3]

int16_t TFT_eSPI::drawChar ( uint16_t  uniCode,
int32_t  x,
int32_t  y,
uint8_t  font 
)
virtual

TFT_eSpriteで再実装されています。

In_eSPI.cpp4259 行目に定義があります。

4260 {
4261  if (!uniCode) return 0;
4262 
4263  if (font==1)
4264  {
4265 #ifdef LOAD_GLCD
4266  #ifndef LOAD_GFXFF
4267  drawChar(x, y, uniCode, textcolor, textbgcolor, textsize);
4268  return 6 * textsize;
4269  #endif
4270 #else
4271  #ifndef LOAD_GFXFF
4272  return 0;
4273  #endif
4274 #endif
4275 
4276 #ifdef LOAD_GFXFF
4277  drawChar(x, y, uniCode, textcolor, textbgcolor, textsize);
4278  if(!gfxFont) { // 'Classic' built-in font
4279  #ifdef LOAD_GLCD
4280  return 6 * textsize;
4281  #else
4282  return 0;
4283  #endif
4284  }
4285  else
4286  {
4287  if((uniCode >= pgm_read_word(&gfxFont->first)) && (uniCode <= pgm_read_word(&gfxFont->last) ))
4288  {
4289  uint16_t c2 = uniCode - pgm_read_word(&gfxFont->first);
4290  GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c2]);
4291  return pgm_read_byte(&glyph->xAdvance) * textsize;
4292  }
4293  else
4294  {
4295  return 0;
4296  }
4297  }
4298 #endif
4299  }
4300 
4301  if ((font>1) && (font<9) && ((uniCode < 32) || (uniCode > 127))) return 0;
4302 
4303  int32_t width = 0;
4304  int32_t height = 0;
4305  uint32_t flash_address = 0;
4306  uniCode -= 32;
4307 
4308 #ifdef LOAD_FONT2
4309  if (font == 2)
4310  {
4311  flash_address = pgm_read_dword(&chrtbl_f16[uniCode]);
4312  width = pgm_read_byte(widtbl_f16 + uniCode);
4313  height = chr_hgt_f16;
4314  }
4315  #ifdef LOAD_RLE
4316  else
4317  #endif
4318 #endif
4319 
4320 #ifdef LOAD_RLE
4321  {
4322  if ((font>2) && (font<9))
4323  {
4324  flash_address = pgm_read_dword( (const void*)(pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *)) );
4325  width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[font].widthtbl ) ) + uniCode );
4326  height= pgm_read_byte( &fontdata[font].height );
4327  }
4328  }
4329 #endif
4330 
4331  int32_t w = width;
4332  int32_t pX = 0;
4333  int32_t pY = y;
4334  uint8_t line = 0;
4335 
4336 #ifdef LOAD_FONT2 // chop out code if we do not need it
4337  if (font == 2) {
4338  w = w + 6; // Should be + 7 but we need to compensate for width increment
4339  w = w / 8;
4340  if (x + width * textsize >= (int16_t)_width) return width * textsize ;
4341 
4342  if (textcolor == textbgcolor || textsize != 1) {
4343  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
4344  inTransaction = true;
4345 
4346  for (int32_t i = 0; i < height; i++)
4347  {
4349 
4350  for (int32_t k = 0; k < w; k++)
4351  {
4352  line = pgm_read_byte((uint8_t *)flash_address + w * i + k);
4353  if (line) {
4354  if (textsize == 1) {
4355  pX = x + k * 8;
4356  if (line & 0x80) drawPixel(pX, pY, textcolor);
4357  if (line & 0x40) drawPixel(pX + 1, pY, textcolor);
4358  if (line & 0x20) drawPixel(pX + 2, pY, textcolor);
4359  if (line & 0x10) drawPixel(pX + 3, pY, textcolor);
4360  if (line & 0x08) drawPixel(pX + 4, pY, textcolor);
4361  if (line & 0x04) drawPixel(pX + 5, pY, textcolor);
4362  if (line & 0x02) drawPixel(pX + 6, pY, textcolor);
4363  if (line & 0x01) drawPixel(pX + 7, pY, textcolor);
4364  }
4365  else {
4366  pX = x + k * 8 * textsize;
4367  if (line & 0x80) fillRect(pX, pY, textsize, textsize, textcolor);
4368  if (line & 0x40) fillRect(pX + textsize, pY, textsize, textsize, textcolor);
4369  if (line & 0x20) fillRect(pX + 2 * textsize, pY, textsize, textsize, textcolor);
4370  if (line & 0x10) fillRect(pX + 3 * textsize, pY, textsize, textsize, textcolor);
4371  if (line & 0x08) fillRect(pX + 4 * textsize, pY, textsize, textsize, textcolor);
4372  if (line & 0x04) fillRect(pX + 5 * textsize, pY, textsize, textsize, textcolor);
4373  if (line & 0x02) fillRect(pX + 6 * textsize, pY, textsize, textsize, textcolor);
4374  if (line & 0x01) fillRect(pX + 7 * textsize, pY, textsize, textsize, textcolor);
4375  }
4376  }
4377  }
4378  pY += textsize;
4379  }
4380 
4381  inTransaction = false;
4382  spi_end();
4383  }
4384  else
4385  // Faster drawing of characters and background using block write
4386  {
4387  spi_begin();
4388 
4389  setWindow(x, y, x + width - 1, y + height - 1);
4390 
4391  uint8_t mask;
4392  for (int32_t i = 0; i < height; i++)
4393  {
4394  pX = width;
4395  for (int32_t k = 0; k < w; k++)
4396  {
4397  line = pgm_read_byte((uint8_t *) (flash_address + w * i + k) );
4398  mask = 0x80;
4399  while (mask && pX) {
4400  if (line & mask) {tft_Write_16(textcolor);}
4401  else {tft_Write_16(textbgcolor);}
4402  pX--;
4403  mask = mask >> 1;
4404  }
4405  }
4406  if (pX) {tft_Write_16(textbgcolor);}
4407  }
4408 
4409  spi_end();
4410  }
4411  }
4412 
4413  #ifdef LOAD_RLE
4414  else
4415  #endif
4416 #endif //FONT2
4417 
4418 #ifdef LOAD_RLE //674 bytes of code
4419  // Font is not 2 and hence is RLE encoded
4420  {
4421  spi_begin();
4422  inTransaction = true;
4423 
4424  w *= height; // Now w is total number of pixels in the character
4425  if ((textsize != 1) || (textcolor == textbgcolor)) {
4427  int32_t px = 0, py = pY; // To hold character block start and end column and row values
4428  int32_t pc = 0; // Pixel count
4429  uint8_t np = textsize * textsize; // Number of pixels in a drawn pixel
4430 
4431  uint8_t tnp = 0; // Temporary copy of np for while loop
4432  uint8_t ts = textsize - 1; // Temporary copy of textsize
4433  // 16 bit pixel count so maximum font size is equivalent to 180x180 pixels in area
4434  // w is total number of pixels to plot to fill character block
4435  while (pc < w)
4436  {
4437  line = pgm_read_byte((uint8_t *)flash_address);
4438  flash_address++;
4439  if (line & 0x80) {
4440  line &= 0x7F;
4441  line++;
4442  if (ts) {
4443  px = x + textsize * (pc % width); // Keep these px and py calculations outside the loop as they are slow
4444  py = y + textsize * (pc / width);
4445  }
4446  else {
4447  px = x + pc % width; // Keep these px and py calculations outside the loop as they are slow
4448  py = y + pc / width;
4449  }
4450  while (line--) { // In this case the while(line--) is faster
4451  pc++; // This is faster than putting pc+=line before while()?
4452  setWindow(px, py, px + ts, py + ts);
4453 
4454  if (ts) {
4455  tnp = np;
4456  while (tnp--) {tft_Write_16(textcolor);}
4457  }
4458  else {tft_Write_16(textcolor);}
4459  px += textsize;
4460 
4461  if (px >= (x + width * textsize))
4462  {
4463  px = x;
4464  py += textsize;
4465  }
4466  }
4467  }
4468  else {
4469  line++;
4470  pc += line;
4471  }
4472  }
4473  }
4474  else // Text colour != background && textsize = 1
4475  // so use faster drawing of characters and background using block write
4476  {
4477  setWindow(x, y, x + width - 1, y + height - 1);
4478 
4479 #ifdef RPI_WRITE_STROBE
4480  uint8_t textcolorBin[] = { (uint8_t) (textcolor >> 8), (uint8_t) textcolor };
4481  uint8_t textbgcolorBin[] = { (uint8_t) (textbgcolor >> 8), (uint8_t) textbgcolor };
4482 #endif
4483 
4484  // Maximum font size is equivalent to 180x180 pixels in area
4485  while (w > 0)
4486  {
4487  line = pgm_read_byte((uint8_t *)flash_address++); // 8 bytes smaller when incrementing here
4488  if (line & 0x80) {
4489  line &= 0x7F;
4490  line++; w -= line;
4491 #ifdef RPI_WRITE_STROBE
4492  spi.writePattern(&textcolorBin[0], 2, 1); line--;
4493  while(line--) {WR_L; WR_H;}
4494 #else
4495  #ifdef ESP32_PARALLEL
4496  while (line--) {tft_Write_16(textcolor);}
4497  #else
4498  writeBlock(textcolor,line);
4499  #endif
4500 #endif
4501  }
4502  else {
4503  line++; w -= line;
4504 #ifdef RPI_WRITE_STROBE
4505  spi.writePattern(&textbgcolorBin[0], 2, 1); line--;
4506  while(line--) {WR_L; WR_H;}
4507 #else
4508  #ifdef ESP32_PARALLEL
4509  while (line--) {tft_Write_16(textbgcolor);}
4510  #else
4511  writeBlock(textbgcolor,line);
4512  #endif
4513 #endif
4514  }
4515  }
4516  }
4517  inTransaction = false;
4518  spi_end();
4519  }
4520  // End of RLE font rendering
4521 #endif
4522  return width * textsize; // x +
4523 }

◆ drawCircle()

void TFT_eSPI::drawCircle ( int32_t  x0,
int32_t  y0,
int32_t  r,
uint32_t  color 
)

In_eSPI.cpp1617 行目に定義があります。

1618 {
1619  int32_t x = 0;
1620  int32_t dx = 1;
1621  int32_t dy = r+r;
1622  int32_t p = -(r>>1);
1623 
1624  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1625  inTransaction = true;
1626 
1627  // These are ordered to minimise coordinate changes in x or y
1628  // drawPixel can then send fewer bounding box commands
1629  drawPixel(x0 + r, y0, color);
1630  drawPixel(x0 - r, y0, color);
1631  drawPixel(x0, y0 - r, color);
1632  drawPixel(x0, y0 + r, color);
1633 
1634  while(x<r){
1635 
1636  if(p>=0) {
1637  dy-=2;
1638  p-=dy;
1639  r--;
1640  }
1641 
1642  dx+=2;
1643  p+=dx;
1644 
1645  x++;
1646 
1647  // These are ordered to minimise coordinate changes in x or y
1648  // drawPixel can then send fewer bounding box commands
1649  drawPixel(x0 + x, y0 + r, color);
1650  drawPixel(x0 - x, y0 + r, color);
1651  drawPixel(x0 - x, y0 - r, color);
1652  drawPixel(x0 + x, y0 - r, color);
1653 
1654  drawPixel(x0 + r, y0 + x, color);
1655  drawPixel(x0 - r, y0 + x, color);
1656  drawPixel(x0 - r, y0 - x, color);
1657  drawPixel(x0 + r, y0 - x, color);
1658  }
1659 
1660  inTransaction = false;
1661  spi_end(); // Does nothing if Sprite class uses this function
1662 }

◆ drawCircleHelper()

void TFT_eSPI::drawCircleHelper ( int32_t  x0,
int32_t  y0,
int32_t  r,
uint8_t  cornername,
uint32_t  color 
)

In_eSPI.cpp1669 行目に定義があります。

1670 {
1671  int32_t f = 1 - r;
1672  int32_t ddF_x = 1;
1673  int32_t ddF_y = -2 * r;
1674  int32_t x = 0;
1675 
1676  while (x < r) {
1677  if (f >= 0) {
1678  r--;
1679  ddF_y += 2;
1680  f += ddF_y;
1681  }
1682  x++;
1683  ddF_x += 2;
1684  f += ddF_x;
1685  if (cornername & 0x4) {
1686  drawPixel(x0 + x, y0 + r, color);
1687  drawPixel(x0 + r, y0 + x, color);
1688  }
1689  if (cornername & 0x2) {
1690  drawPixel(x0 + x, y0 - r, color);
1691  drawPixel(x0 + r, y0 - x, color);
1692  }
1693  if (cornername & 0x8) {
1694  drawPixel(x0 - r, y0 + x, color);
1695  drawPixel(x0 - x, y0 + r, color);
1696  }
1697  if (cornername & 0x1) {
1698  drawPixel(x0 - r, y0 - x, color);
1699  drawPixel(x0 - x, y0 - r, color);
1700  }
1701  }
1702 }

◆ drawEllipse()

void TFT_eSPI::drawEllipse ( int16_t  x0,
int16_t  y0,
int32_t  rx,
int32_t  ry,
uint16_t  color 
)

In_eSPI.cpp1788 行目に定義があります。

1789 {
1790  if (rx<2) return;
1791  if (ry<2) return;
1792  int32_t x, y;
1793  int32_t rx2 = rx * rx;
1794  int32_t ry2 = ry * ry;
1795  int32_t fx2 = 4 * rx2;
1796  int32_t fy2 = 4 * ry2;
1797  int32_t s;
1798 
1799  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1800  inTransaction = true;
1801 
1802  for (x = 0, y = ry, s = 2*ry2+rx2*(1-2*ry); ry2*x <= rx2*y; x++)
1803  {
1804  // These are ordered to minimise coordinate changes in x or y
1805  // drawPixel can then send fewer bounding box commands
1806  drawPixel(x0 + x, y0 + y, color);
1807  drawPixel(x0 - x, y0 + y, color);
1808  drawPixel(x0 - x, y0 - y, color);
1809  drawPixel(x0 + x, y0 - y, color);
1810  if (s >= 0)
1811  {
1812  s += fx2 * (1 - y);
1813  y--;
1814  }
1815  s += ry2 * ((4 * x) + 6);
1816  }
1817 
1818  for (x = rx, y = 0, s = 2*rx2+ry2*(1-2*rx); rx2*y <= ry2*x; y++)
1819  {
1820  // These are ordered to minimise coordinate changes in x or y
1821  // drawPixel can then send fewer bounding box commands
1822  drawPixel(x0 + x, y0 + y, color);
1823  drawPixel(x0 - x, y0 + y, color);
1824  drawPixel(x0 - x, y0 - y, color);
1825  drawPixel(x0 + x, y0 - y, color);
1826  if (s >= 0)
1827  {
1828  s += fy2 * (1 - x);
1829  x--;
1830  }
1831  s += rx2 * ((4 * y) + 6);
1832  }
1833 
1834  inTransaction = false;
1835  spi_end(); // Does nothing if Sprite class uses this function
1836 }

◆ drawFastHLine()

void TFT_eSPI::drawFastHLine ( int32_t  x,
int32_t  y,
int32_t  w,
uint32_t  color 
)

In_eSPI.cpp3810 行目に定義があります。

3811 {
3812  // Clipping
3813  if ((y < 0) || (x >= _width) || (y >= _height)) return;
3814 
3815  if (x < 0) { w += x; x = 0; }
3816 
3817  if ((x + w) > _width) w = _width - x;
3818 
3819  if (w < 1) return;
3820 
3821  spi_begin();
3822 
3823  setWindow(x, y, x + w - 1, y);
3824 
3825 #ifdef RPI_WRITE_STROBE
3826  #if defined (ESP8266)
3827  SPI1W0 = (color >> 8) | (color << 8);
3828  SPI1CMD |= SPIBUSY;
3829  while(SPI1CMD & SPIBUSY) {}
3830  #else
3831  tft_Write_16(color);
3832  #endif
3833  w--;
3834  while(w--) {WR_L; WR_H;}
3835 #else
3836  #ifdef ESP32_PARALLEL
3837  while (w--) {tft_Write_16(color);}
3838  #else
3839  writeBlock(color, w);
3840  #endif
3841 #endif
3842 
3843  spi_end();
3844 }

◆ drawFastVLine()

void TFT_eSPI::drawFastVLine ( int32_t  x,
int32_t  y,
int32_t  h,
uint32_t  color 
)

In_eSPI.cpp3746 行目に定義があります。

3747 {
3748  // Clipping
3749  if ((x < 0) || (x >= _width) || (y >= _height)) return;
3750 
3751  if (y < 0) { h += y; y = 0; }
3752 
3753  if ((y + h) > _height) h = _height - y;
3754 
3755  if (h < 1) return;
3756 
3757  spi_begin();
3758 
3759  setWindow(x, y, x, y + h - 1);
3760 
3761 #ifdef RPI_WRITE_STROBE
3762  #if defined (ESP8266)
3763  SPI1W0 = (color >> 8) | (color << 8);
3764  SPI1CMD |= SPIBUSY;
3765  while(SPI1CMD & SPIBUSY) {}
3766  #else
3767  tft_Write_16(color);
3768  #endif
3769  h--;
3770  while(h--) {WR_L; WR_H;}
3771 #else
3772  #ifdef ESP32_PARALLEL
3773  while (h--) {tft_Write_16(color);}
3774  #else
3775  writeBlock(color, h);
3776  #endif
3777 #endif
3778 
3779  spi_end();
3780 }

◆ drawFloat() [1/2]

int16_t TFT_eSPI::drawFloat ( float  floatNumber,
uint8_t  decimal,
int32_t  poX,
int32_t  poY 
)

In_eSPI.cpp4864 行目に定義があります。

4865 {
4866  return drawFloat(floatNumber, dp, poX, poY, textfont);
4867 }

◆ drawFloat() [2/2]

int16_t TFT_eSPI::drawFloat ( float  floatNumber,
uint8_t  decimal,
int32_t  poX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4869 行目に定義があります。

4870 {
4871  isDigits = true;
4872  char str[14]; // Array to contain decimal string
4873  uint8_t ptr = 0; // Initialise pointer for array
4874  int8_t digits = 1; // Count the digits to avoid array overflow
4875  float rounding = 0.5; // Round up down delta
4876 
4877  if (dp > 7) dp = 7; // Limit the size of decimal portion
4878 
4879  // Adjust the rounding value
4880  for (uint8_t i = 0; i < dp; ++i) rounding /= 10.0;
4881 
4882  if (floatNumber < -rounding) // add sign, avoid adding - sign to 0.0!
4883  {
4884  str[ptr++] = '-'; // Negative number
4885  str[ptr] = 0; // Put a null in the array as a precaution
4886  digits = 0; // Set digits to 0 to compensate so pointer value can be used later
4887  floatNumber = -floatNumber; // Make positive
4888  }
4889 
4890  floatNumber += rounding; // Round up or down
4891 
4892  // For error put ... in string and return (all TFT_eSPI library fonts contain . character)
4893  if (floatNumber >= 2147483647) {
4894  strcpy(str, "...");
4895  return drawString(str, poX, poY, font);
4896  }
4897  // No chance of overflow from here on
4898 
4899  // Get integer part
4900  uint32_t temp = (uint32_t)floatNumber;
4901 
4902  // Put integer part into array
4903  ltoa(temp, str + ptr, 10);
4904 
4905  // Find out where the null is to get the digit count loaded
4906  while ((uint8_t)str[ptr] != 0) ptr++; // Move the pointer along
4907  digits += ptr; // Count the digits
4908 
4909  str[ptr++] = '.'; // Add decimal point
4910  str[ptr] = '0'; // Add a dummy zero
4911  str[ptr + 1] = 0; // Add a null but don't increment pointer so it can be overwritten
4912 
4913  // Get the decimal portion
4914  floatNumber = floatNumber - temp;
4915 
4916  // Get decimal digits one by one and put in array
4917  // Limit digit count so we don't get a false sense of resolution
4918  uint8_t i = 0;
4919  while ((i < dp) && (digits < 9)) // while (i < dp) for no limit but array size must be increased
4920  {
4921  i++;
4922  floatNumber *= 10; // for the next decimal
4923  temp = floatNumber; // get the decimal
4924  ltoa(temp, str + ptr, 10);
4925  ptr++; digits++; // Increment pointer and digits count
4926  floatNumber -= temp; // Remove that digit
4927  }
4928 
4929  // Finally we can plot the string and return pixel length
4930  return drawString(str, poX, poY, font);
4931 }

◆ drawGlyph()

void TFT_eSPI::drawGlyph ( uint16_t  code)
virtual

TFT_eSpriteで再実装されています。

In_eSPI.cpp5850 行目に定義があります。

5851 {
5852  if (code < 0x21)
5853  {
5854  if (code == 0x20) {
5856  return;
5857  }
5858 
5859  if (code == '\n') {
5860  cursor_x = 0;
5861  cursor_y += gFont.yAdvance;
5862  if (cursor_y >= _height) cursor_y = 0;
5863  return;
5864  }
5865  }
5866 
5867  uint16_t gNum = 0;
5868  bool found = getUnicodeIndex(code, &gNum);
5869 
5870  uint16_t fg = textcolor;
5871  uint16_t bg = textbgcolor;
5872 
5873  if (found)
5874  {
5875 
5876  if (textwrapX && (cursor_x + gWidth[gNum] + gdX[gNum] > _width))
5877  {
5878  cursor_y += gFont.yAdvance;
5879  cursor_x = 0;
5880  }
5881  if (textwrapY && ((cursor_y + gFont.yAdvance) >= _height)) cursor_y = 0;
5882  if (cursor_x == 0) cursor_x -= gdX[gNum];
5883 
5884  fontFile.seek(gBitmap[gNum], fs::SeekSet); // This is taking >30ms for a significant position shift
5885 
5886  uint8_t pbuffer[gWidth[gNum]];
5887 
5888  int16_t xs = 0;
5889  uint32_t dl = 0;
5890 
5891  int16_t cy = cursor_y + gFont.maxAscent - gdY[gNum];
5892  int16_t cx = cursor_x + gdX[gNum];
5893 
5894  startWrite(); // Avoid slow ESP32 transaction overhead for every pixel
5895 
5896  for (int y = 0; y < gHeight[gNum]; y++)
5897  {
5898  if (spiffs)
5899  {
5900  fontFile.read(pbuffer, gWidth[gNum]);
5901  //Serial.println("SPIFFS");
5902  }
5903  else
5904  {
5905  endWrite(); // Release SPI for SD card transaction
5906  fontFile.read(pbuffer, gWidth[gNum]);
5907  startWrite(); // Re-start SPI for TFT transaction
5908  //Serial.println("Not SPIFFS");
5909  }
5910 
5911  for (int x = 0; x < gWidth[gNum]; x++)
5912  {
5913  uint8_t pixel = pbuffer[x]; //<//
5914  if (pixel)
5915  {
5916  if (pixel != 0xFF)
5917  {
5918  if (dl) {
5919  if (dl==1) drawPixel(xs, y + cy, fg);
5920  else drawFastHLine( xs, y + cy, dl, fg);
5921  dl = 0;
5922  }
5923  if (getColor) bg = getColor(x + cx, y + cy);
5924  drawPixel(x + cx, y + cy, alphaBlend(pixel, fg, bg));
5925  }
5926  else
5927  {
5928  if (dl==0) xs = x + cx;
5929  dl++;
5930  }
5931  }
5932  else
5933  {
5934  if (dl) { drawFastHLine( xs, y + cy, dl, fg); dl = 0; }
5935  }
5936  }
5937  if (dl) { drawFastHLine( xs, y + cy, dl, fg); dl = 0; }
5938  }
5939 
5940  cursor_x += gxAdvance[gNum];
5941  endWrite();
5942  }
5943  else
5944  {
5945  // Not a Unicode in font so draw a rectangle and move on cursor
5947  cursor_x += gFont.spaceWidth + 1;
5948  }
5949 }

◆ drawLine()

void TFT_eSPI::drawLine ( int32_t  x0,
int32_t  y0,
int32_t  x1,
int32_t  y1,
uint32_t  color 
)

In_eSPI.cpp3618 行目に定義があります。

3619 {
3620 
3621  boolean steep = abs(y1 - y0) > abs(x1 - x0);
3622 
3623  if (steep) {
3624  swap_coord(x0, y0);
3625  swap_coord(x1, y1);
3626  }
3627 
3628  if (x0 > x1) {
3629  swap_coord(x0, x1);
3630  swap_coord(y0, y1);
3631  }
3632 
3633  if (x1 < 0) return;
3634 
3635  int16_t dx, dy;
3636  dx = x1 - x0;
3637  dy = abs(y1 - y0);
3638 
3639  int16_t err = dx / 2;
3640  int8_t ystep = (y0 < y1) ? 1 : (-1);
3641 
3642  spi_begin();
3643 
3644  int16_t swapped_color = (color >> 8) | (color << 8);
3645 
3646  if (steep) // y increments every iteration (y0 is x-axis, and x0 is y-axis)
3647  {
3648  if (x1 >= (int32_t)_height) x1 = _height - 1;
3649 
3650  for (; x0 <= x1; x0++) {
3651  if ((x0 >= 0) && (y0 >= 0) && (y0 < _width)) break;
3652  err -= dy;
3653  if (err < 0) {
3654  err += dx;
3655  y0 += ystep;
3656  }
3657  }
3658 
3659  if (x0 > x1) {spi_end(); return;}
3660 
3661  setWindow(y0, x0, y0, _height);
3662  SPI1W0 = swapped_color;
3663  for (; x0 <= x1; x0++) {
3664  while(SPI1CMD & SPIBUSY) {}
3665  SPI1CMD |= SPIBUSY;
3666 
3667  err -= dy;
3668  if (err < 0) {
3669  y0 += ystep;
3670  if ((y0 < 0) || (y0 >= _width)) break;
3671  err += dx;
3672  while(SPI1CMD & SPIBUSY) {}
3673  setWindow(y0, x0+1, y0, _height);
3674  SPI1W0 = swapped_color;
3675  }
3676  }
3677  }
3678  else // x increments every iteration (x0 is x-axis, and y0 is y-axis)
3679  {
3680  if (x1 >= _width) x1 = _width - 1;
3681 
3682  for (; x0 <= x1; x0++) {
3683  if ((x0 >= 0) && (y0 >= 0) && (y0 < (int32_t)_height)) break;
3684  err -= dy;
3685  if (err < 0) {
3686  err += dx;
3687  y0 += ystep;
3688  }
3689  }
3690 
3691  if (x0 > x1) {spi_end(); return;}
3692 
3693  setWindow(x0, y0, _width, y0);
3694  SPI1W0 = swapped_color;
3695  for (; x0 <= x1; x0++) {
3696  while(SPI1CMD & SPIBUSY) {}
3697  SPI1CMD |= SPIBUSY;
3698 
3699  err -= dy;
3700  if (err < 0) {
3701  y0 += ystep;
3702  if ((y0 < 0) || (y0 >= (int32_t)_height)) break;
3703  err += dx;
3704  while(SPI1CMD & SPIBUSY) {}
3705  setWindow(x0+1, y0, _width, y0);
3706  SPI1W0 = swapped_color;
3707  }
3708  }
3709  }
3710 
3711  while(SPI1CMD & SPIBUSY) {}
3712 
3713  spi_end();
3714 }

◆ drawNumber() [1/2]

int16_t TFT_eSPI::drawNumber ( long  long_num,
int32_t  poX,
int32_t  poY 
)

In_eSPI.cpp4841 行目に定義があります。

4842 {
4843  isDigits = true; // Eliminate jiggle in monospaced fonts
4844  char str[12];
4845  ltoa(long_num, str, 10);
4846  return drawString(str, poX, poY, textfont);
4847 }

◆ drawNumber() [2/2]

int16_t TFT_eSPI::drawNumber ( long  long_num,
int32_t  poX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4849 行目に定義があります。

4850 {
4851  isDigits = true; // Eliminate jiggle in monospaced fonts
4852  char str[12];
4853  ltoa(long_num, str, 10);
4854  return drawString(str, poX, poY, font);
4855 }

◆ drawPixel()

void TFT_eSPI::drawPixel ( int32_t  x,
int32_t  y,
uint32_t  color 
)
virtual

TFT_eSpriteで再実装されています。

In_eSPI.cpp3283 行目に定義があります。

3284 {
3285  // Range checking
3286  if ((x < 0) || (y < 0) ||(x >= _width) || (y >= _height)) return;
3287 
3288  spi_begin();
3289 
3290 #ifdef CGRAM_OFFSET
3291  x+=colstart;
3292  y+=rowstart;
3293 #endif
3294 
3295  DC_C;
3296 
3297  // No need to send x if it has not changed (speeds things up)
3298  if (addr_col != x) {
3299 
3301 
3302  DC_D;
3303 
3304 #if defined (RPI_ILI9486_DRIVER)
3305  uint8_t xb[] = { 0, (uint8_t) (x>>8), 0, (uint8_t) (x>>0), 0, (uint8_t) (x>>8), 0, (uint8_t) (x>>0), };
3306  spi.writePattern(&xb[0], 8, 1);
3307 #else
3308  tft_Write_32(SPI_32(x, x));
3309 #endif
3310 
3311  DC_C;
3312 
3313  addr_col = x;
3314  }
3315 
3316  // No need to send y if it has not changed (speeds things up)
3317  if (addr_row != y) {
3318 
3320 
3321  DC_D;
3322 
3323 #if defined (RPI_ILI9486_DRIVER)
3324  uint8_t yb[] = { 0, (uint8_t) (y>>8), 0, (uint8_t) (y>>0), 0, (uint8_t) (y>>8), 0, (uint8_t) (y>>0), };
3325  spi.writePattern(&yb[0], 8, 1);
3326 #else
3327  tft_Write_32(SPI_32(y, y));
3328 #endif
3329 
3330  DC_C;
3331 
3332  addr_row = y;
3333  }
3334 
3335 
3337 
3338  DC_D;
3339 
3340  tft_Write_16(color);
3341 
3342  spi_end();
3343 }

◆ drawRect()

void TFT_eSPI::drawRect ( int32_t  x,
int32_t  y,
int32_t  w,
int32_t  h,
uint32_t  color 
)

In_eSPI.cpp1903 行目に定義があります。

1904 {
1905  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1906  inTransaction = true;
1907 
1908  drawFastHLine(x, y, w, color);
1909  drawFastHLine(x, y + h - 1, w, color);
1910  // Avoid drawing corner pixels twice
1911  drawFastVLine(x, y+1, h-2, color);
1912  drawFastVLine(x + w - 1, y+1, h-2, color);
1913 
1914  inTransaction = false;
1915  spi_end(); // Does nothing if Sprite class uses this function
1916 }

◆ drawRightString() [1/2]

int16_t TFT_eSPI::drawRightString ( const char *  string,
int32_t  dX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4826 行目に定義があります。

4827 {
4828  uint8_t tempdatum = textdatum;
4829  int16_t sumX = 0;
4830  textdatum = TR_DATUM;
4831  sumX = drawString(string, dX, poY, font);
4832  textdatum = tempdatum;
4833  return sumX;
4834 }

◆ drawRightString() [2/2]

int16_t TFT_eSPI::drawRightString ( const String &  string,
int32_t  dX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4818 行目に定義があります。

4819 {
4820  int16_t len = string.length() + 2;
4821  char buffer[len];
4822  string.toCharArray(buffer, len);
4823  return drawRightString(buffer, dX, poY, font);
4824 }

◆ drawRoundRect()

void TFT_eSPI::drawRoundRect ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
int32_t  radius,
uint32_t  color 
)

In_eSPI.cpp1924 行目に定義があります。

1925 {
1926  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1927  inTransaction = true;
1928 
1929  // smarter version
1930  drawFastHLine(x + r , y , w - r - r, color); // Top
1931  drawFastHLine(x + r , y + h - 1, w - r - r, color); // Bottom
1932  drawFastVLine(x , y + r , h - r - r, color); // Left
1933  drawFastVLine(x + w - 1, y + r , h - r - r, color); // Right
1934  // draw four corners
1935  drawCircleHelper(x + r , y + r , r, 1, color);
1936  drawCircleHelper(x + w - r - 1, y + r , r, 2, color);
1937  drawCircleHelper(x + w - r - 1, y + h - r - 1, r, 4, color);
1938  drawCircleHelper(x + r , y + h - r - 1, r, 8, color);
1939 
1940  inTransaction = false;
1941  spi_end(); // Does nothing if Sprite class uses this function
1942 }

◆ drawString() [1/4]

int16_t TFT_eSPI::drawString ( const char *  string,
int32_t  poX,
int32_t  poY 
)

In_eSPI.cpp4548 行目に定義があります。

4549 {
4550  return drawString(string, poX, poY, textfont);
4551 }

◆ drawString() [2/4]

int16_t TFT_eSPI::drawString ( const char *  string,
int32_t  poX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4554 行目に定義があります。

4555 {
4556  int16_t sumX = 0;
4557  uint8_t padding = 1, baseline = 0;
4558  uint16_t cwidth = textWidth(string, font); // Find the pixel width of the string in the font
4559  uint16_t cheight = 8 * textsize;
4560 
4561 #ifdef LOAD_GFXFF
4562  #ifdef SMOOTH_FONT
4563  bool freeFont = (font == 1 && gfxFont && !fontLoaded);
4564  #else
4565  bool freeFont = (font == 1 && gfxFont);
4566  #endif
4567 
4568  if (freeFont) {
4569  cheight = glyph_ab * textsize;
4570  poY += cheight; // Adjust for baseline datum of free fonts
4571  baseline = cheight;
4572  padding =101; // Different padding method used for Free Fonts
4573 
4574  // We need to make an adjustment for the bottom of the string (eg 'y' character)
4575  if ((textdatum == BL_DATUM) || (textdatum == BC_DATUM) || (textdatum == BR_DATUM)) {
4576  cheight += glyph_bb * textsize;
4577  }
4578  }
4579 #endif
4580 
4581 
4582  // If it is not font 1 (GLCD or free font) get the baseline and pixel height of the font
4583 #ifdef SMOOTH_FONT
4584  if(fontLoaded) {
4585  baseline = gFont.maxAscent;
4586  cheight = fontHeight();
4587  }
4588  else
4589 #endif
4590  if (font!=1) {
4591  baseline = pgm_read_byte( &fontdata[font].baseline ) * textsize;
4592  cheight = fontHeight(font);
4593  }
4594 
4595  if (textdatum || padX)
4596  {
4597 
4598  switch(textdatum) {
4599  case TC_DATUM:
4600  poX -= cwidth/2;
4601  padding += 1;
4602  break;
4603  case TR_DATUM:
4604  poX -= cwidth;
4605  padding += 2;
4606  break;
4607  case ML_DATUM:
4608  poY -= cheight/2;
4609  //padding += 0;
4610  break;
4611  case MC_DATUM:
4612  poX -= cwidth/2;
4613  poY -= cheight/2;
4614  padding += 1;
4615  break;
4616  case MR_DATUM:
4617  poX -= cwidth;
4618  poY -= cheight/2;
4619  padding += 2;
4620  break;
4621  case BL_DATUM:
4622  poY -= cheight;
4623  //padding += 0;
4624  break;
4625  case BC_DATUM:
4626  poX -= cwidth/2;
4627  poY -= cheight;
4628  padding += 1;
4629  break;
4630  case BR_DATUM:
4631  poX -= cwidth;
4632  poY -= cheight;
4633  padding += 2;
4634  break;
4635  case L_BASELINE:
4636  poY -= baseline;
4637  //padding += 0;
4638  break;
4639  case C_BASELINE:
4640  poX -= cwidth/2;
4641  poY -= baseline;
4642  padding += 1;
4643  break;
4644  case R_BASELINE:
4645  poX -= cwidth;
4646  poY -= baseline;
4647  padding += 2;
4648  break;
4649  }
4650  // Check coordinates are OK, adjust if not
4651  if (poX < 0) poX = 0;
4652  if (poX+cwidth > width()) poX = width() - cwidth;
4653  if (poY < 0) poY = 0;
4654  if (poY+cheight-baseline> height()) poY = height() - cheight;
4655  }
4656 
4657 
4658  int8_t xo = 0;
4659 #ifdef LOAD_GFXFF
4660  if (freeFont && (textcolor!=textbgcolor))
4661  {
4662  cheight = (glyph_ab + glyph_bb) * textsize;
4663  // Get the offset for the first character only to allow for negative offsets
4664  uint16_t c2 = 0;
4665  uint16_t len = strlen(string);
4666  uint16_t n = 0;
4667 
4668  while (n < len && c2 == 0) c2 = decodeUTF8((uint8_t*)string, &n, len - n);
4669 
4670  if((c2 >= pgm_read_word(&gfxFont->first)) && (c2 <= pgm_read_word(&gfxFont->last) ))
4671  {
4672  c2 -= pgm_read_word(&gfxFont->first);
4673  GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c2]);
4674  xo = pgm_read_byte(&glyph->xOffset) * textsize;
4675  // Adjust for negative xOffset
4676  if (xo > 0) xo = 0;
4677  else cwidth -= xo;
4678  // Add 1 pixel of padding all round
4679  //cheight +=2;
4680  //fillRect(poX+xo-1, poY - 1 - glyph_ab * textsize, cwidth+2, cheight, textbgcolor);
4681  fillRect(poX+xo, poY - glyph_ab * textsize, cwidth, cheight, textbgcolor);
4682  }
4683  padding -=100;
4684  }
4685 #endif
4686 
4687  uint16_t len = strlen(string);
4688  uint16_t n = 0;
4689 
4690 #ifdef SMOOTH_FONT
4691  if(fontLoaded)
4692  {
4693  if (textcolor!=textbgcolor) fillRect(poX, poY, cwidth, cheight, textbgcolor);
4694  //drawLine(poX - 5, poY, poX + 5, poY, TFT_GREEN);
4695  //drawLine(poX, poY - 5, poX, poY + 5, TFT_GREEN);
4696  //fontFile = SPIFFS.open( _gFontFilename, "r");
4697  if(!fontFile) return 0;
4698 
4699  setCursor(poX, poY);
4700 
4701  while (n < len)
4702  {
4703  uint16_t uniCode = decodeUTF8((uint8_t*)string, &n, len - n);
4704  drawGlyph(uniCode);
4705  }
4706  sumX += cwidth;
4707  //fontFile.close();
4708  }
4709  else
4710 #endif
4711  {
4712  while (n < len)
4713  {
4714  uint16_t uniCode = decodeUTF8((uint8_t*)string, &n, len - n);
4715  sumX += drawChar(uniCode, poX+sumX, poY, font);
4716  }
4717  }
4718 
4719 //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv DEBUG vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
4720 // Switch on debugging for the padding areas
4721 //#define PADDING_DEBUG
4722 
4723 #ifndef PADDING_DEBUG
4724 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DEBUG ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4725 
4726  if((padX>cwidth) && (textcolor!=textbgcolor))
4727  {
4728  int16_t padXc = poX+cwidth+xo;
4729 #ifdef LOAD_GFXFF
4730  if (freeFont)
4731  {
4732  poX +=xo; // Adjust for negative offset start character
4733  poY -= glyph_ab * textsize;
4734  sumX += poX;
4735  }
4736 #endif
4737  switch(padding) {
4738  case 1:
4739  fillRect(padXc,poY,padX-cwidth,cheight, textbgcolor);
4740  break;
4741  case 2:
4742  fillRect(padXc,poY,(padX-cwidth)>>1,cheight, textbgcolor);
4743  padXc = (padX-cwidth)>>1;
4744  if (padXc>poX) padXc = poX;
4745  fillRect(poX - padXc,poY,(padX-cwidth)>>1,cheight, textbgcolor);
4746  break;
4747  case 3:
4748  if (padXc>padX) padXc = padX;
4749  fillRect(poX + cwidth - padXc,poY,padXc-cwidth,cheight, textbgcolor);
4750  break;
4751  }
4752  }
4753 
4754 
4755 #else
4756 
4757 //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv DEBUG vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
4758 // This is debug code to show text (green box) and blanked (white box) areas
4759 // It shows that the padding areas are being correctly sized and positioned
4760 
4761  if((padX>sumX) && (textcolor!=textbgcolor))
4762  {
4763  int16_t padXc = poX+sumX; // Maximum left side padding
4764 #ifdef LOAD_GFXFF
4765  if ((font == 1) && (gfxFont)) poY -= glyph_ab;
4766 #endif
4767  drawRect(poX,poY,sumX,cheight, TFT_GREEN);
4768  switch(padding) {
4769  case 1:
4770  drawRect(padXc,poY,padX-sumX,cheight, TFT_WHITE);
4771  break;
4772  case 2:
4773  drawRect(padXc,poY,(padX-sumX)>>1, cheight, TFT_WHITE);
4774  padXc = (padX-sumX)>>1;
4775  if (padXc>poX) padXc = poX;
4776  drawRect(poX - padXc,poY,(padX-sumX)>>1,cheight, TFT_WHITE);
4777  break;
4778  case 3:
4779  if (padXc>padX) padXc = padX;
4780  drawRect(poX + sumX - padXc,poY,padXc-sumX,cheight, TFT_WHITE);
4781  break;
4782  }
4783  }
4784 #endif
4785 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DEBUG ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4786 
4787 return sumX;
4788 }

◆ drawString() [3/4]

int16_t TFT_eSPI::drawString ( const String &  string,
int32_t  poX,
int32_t  poY 
)

In_eSPI.cpp4531 行目に定義があります。

4532 {
4533  int16_t len = string.length() + 2;
4534  char buffer[len];
4535  string.toCharArray(buffer, len);
4536  return drawString(buffer, poX, poY, textfont);
4537 }

◆ drawString() [4/4]

int16_t TFT_eSPI::drawString ( const String &  string,
int32_t  poX,
int32_t  poY,
uint8_t  font 
)

In_eSPI.cpp4539 行目に定義があります。

4540 {
4541  int16_t len = string.length() + 2;
4542  char buffer[len];
4543  string.toCharArray(buffer, len);
4544  return drawString(buffer, poX, poY, font);
4545 }

◆ drawTriangle()

void TFT_eSPI::drawTriangle ( int32_t  x0,
int32_t  y0,
int32_t  x1,
int32_t  y1,
int32_t  x2,
int32_t  y2,
uint32_t  color 
)

In_eSPI.cpp1972 行目に定義があります。

1973 {
1974  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1975  inTransaction = true;
1976 
1977  drawLine(x0, y0, x1, y1, color);
1978  drawLine(x1, y1, x2, y2, color);
1979  drawLine(x2, y2, x0, y0, color);
1980 
1981  inTransaction = false;
1982  spi_end(); // Does nothing if Sprite class uses this function
1983 }

◆ drawXBitmap() [1/2]

void TFT_eSPI::drawXBitmap ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
int16_t  w,
int16_t  h,
uint16_t  color 
)

In_eSPI.cpp2095 行目に定義があります。

2096 {
2097  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
2098  inTransaction = true;
2099 
2100  int32_t i, j, byteWidth = (w + 7) / 8;
2101 
2102  for (j = 0; j < h; j++) {
2103  for (i = 0; i < w; i++ ) {
2104  if (pgm_read_byte(bitmap + j * byteWidth + i / 8) & (1 << (i & 7))) {
2105  drawPixel(x + i, y + j, color);
2106  }
2107  }
2108  }
2109 
2110  inTransaction = false;
2111  spi_end(); // Does nothing if Sprite class uses this function
2112 }

◆ drawXBitmap() [2/2]

void TFT_eSPI::drawXBitmap ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
int16_t  w,
int16_t  h,
uint16_t  fgcolor,
uint16_t  bgcolor 
)

In_eSPI.cpp2119 行目に定義があります。

2120 {
2121  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
2122  inTransaction = true;
2123 
2124  int32_t i, j, byteWidth = (w + 7) / 8;
2125 
2126  for (j = 0; j < h; j++) {
2127  for (i = 0; i < w; i++ ) {
2128  if (pgm_read_byte(bitmap + j * byteWidth + i / 8) & (1 << (i & 7)))
2129  drawPixel(x + i, y + j, color);
2130  else drawPixel(x + i, y + j, bgcolor);
2131  }
2132  }
2133 
2134  inTransaction = false;
2135  spi_end(); // Does nothing if Sprite class uses this function
2136 }

◆ endWrite()

void TFT_eSPI::endWrite ( void  )

In_eSPI.cpp3399 行目に定義があります。

3400 {
3401  inTransaction = false;
3402  spi_end();
3403 }

◆ fillCircle()

void TFT_eSPI::fillCircle ( int32_t  x0,
int32_t  y0,
int32_t  r,
uint32_t  color 
)

In_eSPI.cpp1710 行目に定義があります。

1711 {
1712  int32_t x = 0;
1713  int32_t dx = 1;
1714  int32_t dy = r+r;
1715  int32_t p = -(r>>1);
1716 
1717  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1718  inTransaction = true;
1719 
1720  drawFastHLine(x0 - r, y0, dy+1, color);
1721 
1722  while(x<r){
1723 
1724  if(p>=0) {
1725  dy-=2;
1726  p-=dy;
1727  r--;
1728  }
1729 
1730  dx+=2;
1731  p+=dx;
1732 
1733  x++;
1734 
1735  drawFastHLine(x0 - r, y0 + x, 2 * r+1, color);
1736  drawFastHLine(x0 - r, y0 - x, 2 * r+1, color);
1737  drawFastHLine(x0 - x, y0 + r, 2 * x+1, color);
1738  drawFastHLine(x0 - x, y0 - r, 2 * x+1, color);
1739 
1740  }
1741 
1742  inTransaction = false;
1743  spi_end(); // Does nothing if Sprite class uses this function
1744 }

◆ fillCircleHelper()

void TFT_eSPI::fillCircleHelper ( int32_t  x0,
int32_t  y0,
int32_t  r,
uint8_t  cornername,
int32_t  delta,
uint32_t  color 
)

In_eSPI.cpp1752 行目に定義があります。

1753 {
1754  int32_t f = 1 - r;
1755  int32_t ddF_x = 1;
1756  int32_t ddF_y = -r - r;
1757  int32_t y = 0;
1758 
1759  delta++;
1760  while (y < r) {
1761  if (f >= 0) {
1762  r--;
1763  ddF_y += 2;
1764  f += ddF_y;
1765  }
1766  y++;
1767  //x++;
1768  ddF_x += 2;
1769  f += ddF_x;
1770 
1771  if (cornername & 0x1)
1772  {
1773  drawFastHLine(x0 - r, y0 + y, r + r + delta, color);
1774  drawFastHLine(x0 - y, y0 + r, y + y + delta, color);
1775  }
1776  if (cornername & 0x2) {
1777  drawFastHLine(x0 - r, y0 - y, r + r + delta, color); // 11995, 1090
1778  drawFastHLine(x0 - y, y0 - r, y + y + delta, color);
1779  }
1780  }
1781 }

◆ fillEllipse()

void TFT_eSPI::fillEllipse ( int16_t  x0,
int16_t  y0,
int32_t  rx,
int32_t  ry,
uint16_t  color 
)

In_eSPI.cpp1843 行目に定義があります。

1844 {
1845  if (rx<2) return;
1846  if (ry<2) return;
1847  int32_t x, y;
1848  int32_t rx2 = rx * rx;
1849  int32_t ry2 = ry * ry;
1850  int32_t fx2 = 4 * rx2;
1851  int32_t fy2 = 4 * ry2;
1852  int32_t s;
1853 
1854  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1855  inTransaction = true;
1856 
1857  for (x = 0, y = ry, s = 2*ry2+rx2*(1-2*ry); ry2*x <= rx2*y; x++)
1858  {
1859  drawFastHLine(x0 - x, y0 - y, x + x + 1, color);
1860  drawFastHLine(x0 - x, y0 + y, x + x + 1, color);
1861 
1862  if (s >= 0)
1863  {
1864  s += fx2 * (1 - y);
1865  y--;
1866  }
1867  s += ry2 * ((4 * x) + 6);
1868  }
1869 
1870  for (x = rx, y = 0, s = 2*rx2+ry2*(1-2*rx); rx2*y <= ry2*x; y++)
1871  {
1872  drawFastHLine(x0 - x, y0 - y, x + x + 1, color);
1873  drawFastHLine(x0 - x, y0 + y, x + x + 1, color);
1874 
1875  if (s >= 0)
1876  {
1877  s += fy2 * (1 - x);
1878  x--;
1879  }
1880  s += rx2 * ((4 * y) + 6);
1881  }
1882 
1883  inTransaction = false;
1884  spi_end(); // Does nothing if Sprite class uses this function
1885 }

◆ fillRect()

void TFT_eSPI::fillRect ( int32_t  x,
int32_t  y,
int32_t  w,
int32_t  h,
uint32_t  color 
)

In_eSPI.cpp3876 行目に定義があります。

3877 {
3878 
3879  // Clipping
3880  if ((x >= _width) || (y >= _height)) return;
3881 
3882  if (x < 0) { w += x; x = 0; }
3883  if (y < 0) { h += y; y = 0; }
3884 
3885  if ((x + w) > _width) w = _width - x;
3886  if ((y + h) > _height) h = _height - y;
3887 
3888  if ((w < 1) || (h < 1)) return;
3889 
3890  spi_begin();
3891 
3892  setWindow(x, y, x + w - 1, y + h - 1);
3893 
3894  uint32_t n = (uint32_t)w * (uint32_t)h;
3895 
3896 #ifdef RPI_WRITE_STROBE
3897  tft_Write_16(color);
3898  while(n--) {WR_L; WR_H;}
3899 #else
3900  #ifdef ESP32_PARALLEL
3901  if (color>>8 == (uint8_t)color)
3902  {
3903  tft_Write_8(color);
3904  n--; WR_L; WR_H;
3905  while (n) {WR_L; WR_H; n--; WR_L; WR_H;}
3906  }
3907  else
3908  {
3909  while (n--) {tft_Write_16(color);}
3910  }
3911  #else
3912  writeBlock(color, n);
3913  #endif
3914 #endif
3915 
3916  spi_end();
3917 }

◆ fillRoundRect()

void TFT_eSPI::fillRoundRect ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
int32_t  radius,
uint32_t  color 
)

In_eSPI.cpp1950 行目に定義があります。

1951 {
1952  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
1953  inTransaction = true;
1954 
1955  // smarter version
1956  fillRect(x, y + r, w, h - r - r, color);
1957 
1958  // draw four corners
1959  fillCircleHelper(x + r, y + h - r - 1, r, 1, w - r - r - 1, color);
1960  fillCircleHelper(x + r , y + r, r, 2, w - r - r - 1, color);
1961 
1962  inTransaction = false;
1963  spi_end(); // Does nothing if Sprite class uses this function
1964 }

◆ fillScreen()

void TFT_eSPI::fillScreen ( uint32_t  color)

In_eSPI.cpp1892 行目に定義があります。

1893 {
1894  fillRect(0, 0, _width, _height, color);
1895 }

◆ fillTriangle()

void TFT_eSPI::fillTriangle ( int32_t  x0,
int32_t  y0,
int32_t  x1,
int32_t  y1,
int32_t  x2,
int32_t  y2,
uint32_t  color 
)

In_eSPI.cpp1991 行目に定義があります。

1992 {
1993  int32_t a, b, y, last;
1994 
1995  // Sort coordinates by Y order (y2 >= y1 >= y0)
1996  if (y0 > y1) {
1997  swap_coord(y0, y1); swap_coord(x0, x1);
1998  }
1999  if (y1 > y2) {
2000  swap_coord(y2, y1); swap_coord(x2, x1);
2001  }
2002  if (y0 > y1) {
2003  swap_coord(y0, y1); swap_coord(x0, x1);
2004  }
2005 
2006  if (y0 == y2) { // Handle awkward all-on-same-line case as its own thing
2007  a = b = x0;
2008  if (x1 < a) a = x1;
2009  else if (x1 > b) b = x1;
2010  if (x2 < a) a = x2;
2011  else if (x2 > b) b = x2;
2012  drawFastHLine(a, y0, b - a + 1, color);
2013  return;
2014  }
2015 
2016  //spi_begin(); // Sprite class can use this function, avoiding spi_begin()
2017  inTransaction = true;
2018 
2019  int32_t
2020  dx01 = x1 - x0,
2021  dy01 = y1 - y0,
2022  dx02 = x2 - x0,
2023  dy02 = y2 - y0,
2024  dx12 = x2 - x1,
2025  dy12 = y2 - y1,
2026  sa = 0,
2027  sb = 0;
2028 
2029  // For upper part of triangle, find scanline crossings for segments
2030  // 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1
2031  // is included here (and second loop will be skipped, avoiding a /0
2032  // error there), otherwise scanline y1 is skipped here and handled
2033  // in the second loop...which also avoids a /0 error here if y0=y1
2034  // (flat-topped triangle).
2035  if (y1 == y2) last = y1; // Include y1 scanline
2036  else last = y1 - 1; // Skip it
2037 
2038  for (y = y0; y <= last; y++) {
2039  a = x0 + sa / dy01;
2040  b = x0 + sb / dy02;
2041  sa += dx01;
2042  sb += dx02;
2043 
2044  if (a > b) swap_coord(a, b);
2045  drawFastHLine(a, y, b - a + 1, color);
2046  }
2047 
2048  // For lower part of triangle, find scanline crossings for segments
2049  // 0-2 and 1-2. This loop is skipped if y1=y2.
2050  sa = dx12 * (y - y1);
2051  sb = dx02 * (y - y0);
2052  for (; y <= y2; y++) {
2053  a = x1 + sa / dy12;
2054  b = x0 + sb / dy02;
2055  sa += dx12;
2056  sb += dx02;
2057 
2058  if (a > b) swap_coord(a, b);
2059  drawFastHLine(a, y, b - a + 1, color);
2060  }
2061 
2062  inTransaction = false;
2063  spi_end(); // Does nothing if Sprite class uses this function
2064 }

◆ fontHeight() [1/2]

int16_t TFT_eSPI::fontHeight ( int16_t  font)

In_eSPI.cpp2449 行目に定義があります。

2450 {
2451 #ifdef SMOOTH_FONT
2452  if(fontLoaded) return gFont.yAdvance;
2453 #endif
2454 
2455 #ifdef LOAD_GFXFF
2456  if (font==1)
2457  {
2458  if(gfxFont) // New font
2459  {
2460  return pgm_read_byte(&gfxFont->yAdvance) * textsize;
2461  }
2462  }
2463 #endif
2464  return pgm_read_byte( &fontdata[font].height ) * textsize;
2465 }

◆ fontHeight() [2/2]

int16_t TFT_eSPI::fontHeight ( void  )

In_eSPI.cpp2467 行目に定義があります。

2468 {
2469  return fontHeight(textfont);
2470 }

◆ fontsLoaded()

uint16_t TFT_eSPI::fontsLoaded ( void  )

In_eSPI.cpp2439 行目に定義があります。

2440 {
2441  return fontsloaded;
2442 }

◆ getAttribute()

uint8_t TFT_eSPI::getAttribute ( uint8_t  id = 0)

In_eSPI.cpp3997 行目に定義があります。

3997  {
3998  switch (attr_id) {
3999  case 1: // ON/OFF control of full CP437 character set
4000  return _cp437;
4001  break;
4002  case 2: // ON/OFF control of UTF-8 decoding
4003  return _utf8;
4004  break;
4005  //case 3: // TBD future feature control
4006  // return _tbd;
4007  // break;
4008  }
4009 
4010  return false;
4011 }

◆ getCursorX()

int16_t TFT_eSPI::getCursorX ( void  )

In_eSPI.cpp2166 行目に定義があります。

2167 {
2168  return cursor_x;
2169 }

◆ getCursorY()

int16_t TFT_eSPI::getCursorY ( void  )

In_eSPI.cpp2175 行目に定義があります。

2176 {
2177  return cursor_y;
2178 }

◆ getPivotX()

int16_t TFT_eSPI::getPivotX ( void  )

In_eSPI.cpp2230 行目に定義があります。

2231 {
2232  return _xpivot;
2233 }

◆ getPivotY()

int16_t TFT_eSPI::getPivotY ( void  )

In_eSPI.cpp2240 行目に定義があります。

2241 {
2242  return _ypivot;
2243 }

◆ getRotation()

uint8_t TFT_eSPI::getRotation ( void  )

In_eSPI.cpp2293 行目に定義があります。

2294 {
2295  return rotation;
2296 }

◆ getSetup()

void TFT_eSPI::getSetup ( setup_t tft_settings)

In_eSPI.cpp5266 行目に定義があります。

5267 {
5268 // tft_settings.version is set in header file
5269 
5270 #if defined (ESP8266)
5271  tft_settings.esp = 8266;
5272 #elif defined (ESP32)
5273  tft_settings.esp = 32;
5274 #else
5275  tft_settings.esp = -1;
5276 #endif
5277 
5278 #if defined (SUPPORT_TRANSACTIONS)
5279  tft_settings.trans = true;
5280 #else
5281  tft_settings.trans = false;
5282 #endif
5283 
5284 #if defined (ESP32_PARALLEL)
5285  tft_settings.serial = false;
5286  tft_settings.tft_spi_freq = 0;
5287 #else
5288  tft_settings.serial = true;
5289  tft_settings.tft_spi_freq = SPI_FREQUENCY/100000;
5290  #ifdef SPI_READ_FREQUENCY
5291  tft_settings.tft_rd_freq = SPI_READ_FREQUENCY/100000;
5292  #endif
5293 #endif
5294 
5295 #if defined(TFT_SPI_OVERLAP)
5296  tft_settings.overlap = true;
5297 #else
5298  tft_settings.overlap = false;
5299 #endif
5300 
5301  tft_settings.tft_driver = TFT_DRIVER;
5302  tft_settings.tft_width = _init_width;
5303  tft_settings.tft_height = _init_height;
5304 
5305 #ifdef CGRAM_OFFSET
5306  tft_settings.r0_x_offset = colstart;
5307  tft_settings.r0_y_offset = rowstart;
5308  tft_settings.r1_x_offset = 0;
5309  tft_settings.r1_y_offset = 0;
5310  tft_settings.r2_x_offset = 0;
5311  tft_settings.r2_y_offset = 0;
5312  tft_settings.r3_x_offset = 0;
5313  tft_settings.r3_y_offset = 0;
5314 #else
5315  tft_settings.r0_x_offset = 0;
5316  tft_settings.r0_y_offset = 0;
5317  tft_settings.r1_x_offset = 0;
5318  tft_settings.r1_y_offset = 0;
5319  tft_settings.r2_x_offset = 0;
5320  tft_settings.r2_y_offset = 0;
5321  tft_settings.r3_x_offset = 0;
5322  tft_settings.r3_y_offset = 0;
5323 #endif
5324 
5325 #if defined (TFT_MOSI)
5326  tft_settings.pin_tft_mosi = TFT_MOSI;
5327 #else
5328  tft_settings.pin_tft_mosi = -1;
5329 #endif
5330 
5331 #if defined (TFT_MISO)
5332  tft_settings.pin_tft_miso = TFT_MISO;
5333 #else
5334  tft_settings.pin_tft_miso = -1;
5335 #endif
5336 
5337 #if defined (TFT_SCLK)
5338  tft_settings.pin_tft_clk = TFT_SCLK;
5339 #else
5340  tft_settings.pin_tft_clk = -1;
5341 #endif
5342 
5343 #if defined (TFT_CS)
5344  tft_settings.pin_tft_cs = TFT_CS;
5345 #else
5346  tft_settings.pin_tft_cs = -1;
5347 #endif
5348 
5349 #if defined (TFT_DC)
5350  tft_settings.pin_tft_dc = TFT_DC;
5351 #else
5352  tft_settings.pin_tft_dc = -1;
5353 #endif
5354 
5355 #if defined (TFT_RD)
5356  tft_settings.pin_tft_rd = TFT_RD;
5357 #else
5358  tft_settings.pin_tft_rd = -1;
5359 #endif
5360 
5361 #if defined (TFT_WR)
5362  tft_settings.pin_tft_wr = TFT_WR;
5363 #else
5364  tft_settings.pin_tft_wr = -1;
5365 #endif
5366 
5367 #if defined (TFT_RST)
5368  tft_settings.pin_tft_rst = TFT_RST;
5369 #else
5370  tft_settings.pin_tft_rst = -1;
5371 #endif
5372 
5373 #if defined (ESP32_PARALLEL)
5374  tft_settings.pin_tft_d0 = TFT_D0;
5375  tft_settings.pin_tft_d1 = TFT_D1;
5376  tft_settings.pin_tft_d2 = TFT_D2;
5377  tft_settings.pin_tft_d3 = TFT_D3;
5378  tft_settings.pin_tft_d4 = TFT_D4;
5379  tft_settings.pin_tft_d5 = TFT_D5;
5380  tft_settings.pin_tft_d6 = TFT_D6;
5381  tft_settings.pin_tft_d7 = TFT_D7;
5382 #else
5383  tft_settings.pin_tft_d0 = -1;
5384  tft_settings.pin_tft_d1 = -1;
5385  tft_settings.pin_tft_d2 = -1;
5386  tft_settings.pin_tft_d3 = -1;
5387  tft_settings.pin_tft_d4 = -1;
5388  tft_settings.pin_tft_d5 = -1;
5389  tft_settings.pin_tft_d6 = -1;
5390  tft_settings.pin_tft_d7 = -1;
5391 #endif
5392 
5393 #if defined (TOUCH_CS)
5394  tft_settings.pin_tch_cs = TOUCH_CS;
5395  tft_settings.tch_spi_freq = SPI_TOUCH_FREQUENCY/100000;
5396 #else
5397  tft_settings.pin_tch_cs = -1;
5398  tft_settings.tch_spi_freq = 0;
5399 #endif
5400 }

◆ getSPIinstance()

SPIClass & TFT_eSPI::getSPIinstance ( void  )
static

In_eSPI.cpp5255 行目に定義があります。

5256 {
5257  return spi;
5258 }

◆ getSwapBytes()

bool TFT_eSPI::getSwapBytes ( void  )

In_eSPI.cpp1547 行目に定義があります。

1548 {
1549  return _swapBytes;
1550 }

◆ getTextDatum()

uint8_t TFT_eSPI::getTextDatum ( void  )

In_eSPI.cpp2302 行目に定義があります。

2303 {
2304  return textdatum;
2305 }

◆ getUnicodeIndex()

bool TFT_eSPI::getUnicodeIndex ( uint16_t  unicode,
uint16_t *  index 
)

In_eSPI.cpp5831 行目に定義があります。

5832 {
5833  for (uint16_t i = 0; i < gFont.gCount; i++)
5834  {
5835  if (gUnicode[i] == unicode)
5836  {
5837  *index = i;
5838  return true;
5839  }
5840  }
5841  return false;
5842 }

◆ height()

int16_t TFT_eSPI::height ( void  )

In_eSPI.cpp2323 行目に定義があります。

2324 {
2325  return _height;
2326 }

◆ init()

void TFT_eSPI::init ( uint8_t  tc = TAB_COLOUR)

In_eSPI.cpp286 行目に定義があります。

287 {
288  if (_booted)
289  {
290 #if !defined (ESP32)
291  #if defined (TFT_CS) && (TFT_CS >= 0)
292  cspinmask = (uint32_t) digitalPinToBitMask(TFT_CS);
293  #endif
294 
295  #if defined (TFT_DC) && (TFT_DC >= 0)
296  dcpinmask = (uint32_t) digitalPinToBitMask(TFT_DC);
297  #endif
298 
299  #if defined (TFT_WR) && (TFT_WR >= 0)
300  wrpinmask = (uint32_t) digitalPinToBitMask(TFT_WR);
301  #endif
302 
303  #if defined (TFT_SCLK) && (TFT_SCLK >= 0)
304  sclkpinmask = (uint32_t) digitalPinToBitMask(TFT_SCLK);
305  #endif
306 
307  #ifdef TFT_SPI_OVERLAP
308  // Overlap mode SD0=MISO, SD1=MOSI, CLK=SCLK must use D3 as CS
309  // pins(int8_t sck, int8_t miso, int8_t mosi, int8_t ss);
310  //spi.pins( 6, 7, 8, 0);
311  spi.pins(6, 7, 8, 0);
312  #endif
313 
314  spi.begin(); // This will set HMISO to input
315 
316 #else
317  #if !defined(ESP32_PARALLEL)
318  #if defined (TFT_MOSI) && !defined (TFT_SPI_OVERLAP)
319  spi.begin(TFT_SCLK, TFT_MISO, TFT_MOSI, -1);
320  #else
321  spi.begin();
322  #endif
323  #endif
324 #endif
325 
326  inTransaction = false;
327  locked = true;
328 
329  // SUPPORT_TRANSACTIONS is mandatory for ESP32 so the hal mutex is toggled
330  // so the code here is for ESP8266 only
331 #if !defined (SUPPORT_TRANSACTIONS) && defined (ESP8266)
332  spi.setBitOrder(MSBFIRST);
333  spi.setDataMode(TFT_SPI_MODE);
334  spi.setFrequency(SPI_FREQUENCY);
335 #endif
336 
337 #if defined(ESP32_PARALLEL)
338  digitalWrite(TFT_CS, LOW); // Chip select low permanently
339  pinMode(TFT_CS, OUTPUT);
340 #else
341  #ifdef TFT_CS
342  // Set to output once again in case D6 (MISO) is used for CS
343  digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
344  pinMode(TFT_CS, OUTPUT);
345  #else
346  spi.setHwCs(1); // Use hardware SS toggling
347  #endif
348 #endif
349 
350  // Set to output once again in case D6 (MISO) is used for DC
351 #ifdef TFT_DC
352  digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
353  pinMode(TFT_DC, OUTPUT);
354 #endif
355 
356  _booted = false;
357  spi_end();
358  } // end of: if just _booted
359 
360  // Toggle RST low to reset
361  spi_begin();
362 
363 #ifdef TFT_RST
364 #ifdef M5STACK
365  pinMode(TFT_RST, INPUT_PULLDOWN);
366  delay(1);
367  bool lcd_version = digitalRead(TFT_RST);
368  pinMode(TFT_RST, OUTPUT);
369 #endif
370  if (TFT_RST >= 0) {
371  digitalWrite(TFT_RST, HIGH);
372  delay(5);
373  digitalWrite(TFT_RST, LOW);
374  delay(20);
375  digitalWrite(TFT_RST, HIGH);
376  }
377  else writecommand(TFT_SWRST); // Software reset
378 #else
379  writecommand(TFT_SWRST); // Software reset
380 #endif
381 
382  spi_end();
383 
384  delay(150); // Wait for reset to complete
385 
386  spi_begin();
387 
388  tc = tc; // Supress warning
389 
390  // This loads the driver specific initialisation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
391 #if defined (ILI9341_DRIVER)
392  #include "ILI9341_Init.h"
393 
394 #elif defined (ST7735_DRIVER)
395  tabcolor = tc;
396  #include "ST7735_Init.h"
397 
398 #elif defined (ILI9163_DRIVER)
399  #include "TFT_Drivers/ILI9163_Init.h"
400 
401 #elif defined (S6D02A1_DRIVER)
402  #include "TFT_Drivers/S6D02A1_Init.h"
403 
404 #elif defined (RPI_ILI9486_DRIVER)
405  #include "TFT_Drivers/ILI9486_Init.h"
406 
407 #elif defined (ILI9486_DRIVER)
408  #include "TFT_Drivers/ILI9486_Init.h"
409 
410 #elif defined (ILI9481_DRIVER)
411  #include "TFT_Drivers/ILI9481_Init.h"
412 
413 #elif defined (ILI9488_DRIVER)
414  #include "TFT_Drivers/ILI9488_Init.h"
415 
416 #elif defined (HX8357D_DRIVER)
417  #include "TFT_Drivers/HX8357D_Init.h"
418 
419 #elif defined (ST7789_DRIVER)
420  #include "TFT_Drivers/ST7789_Init.h"
421 
422 #elif defined (R61581_DRIVER)
423  #include "TFT_Drivers/R61581_Init.h"
424 
425 #elif defined (RM68140_DRIVER)
426  #include "TFT_Drivers/RM68140_Init.h"
427 
428 #elif defined (ST7789_2_DRIVER)
429  #include "TFT_Drivers/ST7789_2_Init.h"
430 
431 #endif
432 
433 #ifdef M5STACK
434  if (lcd_version) writecommand(TFT_INVON);
435 #endif
436 
437 #ifdef TFT_INVERSION_ON
439 #endif
440 
441 #ifdef TFT_INVERSION_OFF
443 #endif
444 
445  spi_end();
446 
448 
449 #if defined (TFT_BL) && defined (TFT_BACKLIGHT_ON)
450  digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
451  pinMode(TFT_BL, OUTPUT);
452 #else
453 // #if defined (TFT_BL) && defined (M5STACK)
454 // // Turn on the back-light LED
455 // digitalWrite(TFT_BL, HIGH);
456 // pinMode(TFT_BL, OUTPUT);
457 // #endif
458 #endif
459 }

◆ invertDisplay()

void TFT_eSPI::invertDisplay ( boolean  i)

In_eSPI.cpp3962 行目に定義があります。

3963 {
3964  spi_begin();
3965  // Send the command twice as otherwise it does not always work!
3968  spi_end();
3969 }

◆ loadFont() [1/2]

void TFT_eSPI::loadFont ( String  fontName,
bool  flash = true 
)

In_eSPI.cpp5434 行目に定義があります。

5435 {
5436  /*
5437  The vlw font format does not appear to be documented anywhere, so some reverse
5438  engineering has been applied!
5439 
5440  Header of vlw file comprises 6 uint32_t parameters (24 bytes total):
5441  1. The gCount (number of character glyphs)
5442  2. A version number (0xB = 11 for the one I am using)
5443  3. The font size (in points, not pixels)
5444  4. Deprecated mboxY parameter (typically set to 0)
5445  5. Ascent in pixels from baseline to top of "d"
5446  6. Descent in pixels from baseline to bottom of "p"
5447 
5448  Next are gCount sets of values for each glyph, each set comprises 7 int32t parameters (28 bytes):
5449  1. Glyph Unicode stored as a 32 bit value
5450  2. Height of bitmap bounding box
5451  3. Width of bitmap bounding box
5452  4. gxAdvance for cursor (setWidth in Processing)
5453  5. dY = distance from cursor baseline to top of glyph bitmap (signed value +ve = up)
5454  6. dX = distance from cursor to left side of glyph bitmap (signed value -ve = left)
5455  7. padding value, typically 0
5456 
5457  The bitmaps start next at 24 + (28 * gCount) bytes from the start of the file.
5458  Each pixel is 1 byte, an 8 bit Alpha value which represents the transparency from
5459  0xFF foreground colour, 0x00 background. The sketch uses a linear interpolation
5460  between the foreground and background RGB component colours. e.g.
5461  pixelRed = ((fgRed * alpha) + (bgRed * (255 - alpha))/255
5462  To gain a performance advantage fixed point arithmetic is used with rounding and
5463  division by 256 (shift right 8 bits is faster).
5464 
5465  After the bitmaps is:
5466  1 byte for font name string length (excludes null)
5467  a zero terminated character string giving the font name
5468  1 byte for Postscript name string length
5469  a zero/one terminated character string giving the font name
5470  last byte is 0 for non-anti-aliased and 1 for anti-aliased (smoothed)
5471 
5472  Then the font name seen by Java when it's created
5473  Then the postscript name of the font
5474  Then a boolean to tell if smoothing is on or not.
5475 
5476  Glyph bitmap example is:
5477  // Cursor coordinate positions for this and next character are marked by 'C'
5478  // C<------- gxAdvance ------->C gxAdvance is how far to move cursor for next glyph cursor position
5479  // | |
5480  // | | ascent is top of "d", descent is bottom of "p"
5481  // +-- gdX --+ ascent
5482  // | +-- gWidth--+ | gdX is offset to left edge of glyph bitmap
5483  // | + x@.........@x + | gdX may be negative e.g. italic "y" tail extending to left of
5484  // | | @@.........@@ | | cursor position, plot top left corner of bitmap at (cursorX + gdX)
5485  // | | @@.........@@ gdY | gWidth and gHeight are glyph bitmap dimensions
5486  // | | .@@@.....@@@@ | |
5487  // | gHeight ....@@@@@..@@ + + <-- baseline
5488  // | | ...........@@ |
5489  // | | ...........@@ | gdY is the offset to the top edge of the bitmap
5490  // | | .@@.......@@. descent plot top edge of bitmap at (cursorY + yAdvance - gdY)
5491  // | + x..@@@@@@@..x | x marks the corner pixels of the bitmap
5492  // | |
5493  // +---------------------------+ yAdvance is y delta for the next line, font size or (ascent + descent)
5494  // some fonts can overlay in y direction so may need a user adjust value
5495 
5496  */
5497 
5498  spiffs = flash;
5499 
5500  if(spiffs) fontFS = SPIFFS;
5501 
5502  unloadFont();
5503 
5504  // Avoid a crash on the ESP32 if the file does not exist
5505  if (fontFS.exists("/" + fontName + ".vlw") == false) {
5506  Serial.println("Font file " + fontName + " not found!");
5507  return;
5508  }
5509 
5510  fontFile = fontFS.open( "/" + fontName + ".vlw", "r");
5511 
5512  if(!fontFile) return;
5513 
5514  fontFile.seek(0, fs::SeekSet);
5515 
5516  gFont.gCount = (uint16_t)readInt32(); // glyph count in file
5517  readInt32(); // vlw encoder version - discard
5518  gFont.yAdvance = (uint16_t)readInt32(); // Font size in points, not pixels
5519  readInt32(); // discard
5520  gFont.ascent = (uint16_t)readInt32(); // top of "d"
5521  gFont.descent = (uint16_t)readInt32(); // bottom of "p"
5522 
5523  // These next gFont values might be updated when the Metrics are fetched
5524  gFont.maxAscent = gFont.ascent; // Determined from metrics
5525  gFont.maxDescent = gFont.descent; // Determined from metrics
5527  gFont.spaceWidth = gFont.yAdvance / 4; // Guess at space width
5528 
5529  fontLoaded = true;
5530 
5531  // Fetch the metrics for each glyph
5532  loadMetrics(gFont.gCount);
5533 
5534  //fontFile.close();
5535 }

◆ loadFont() [2/2]

void TFT_eSPI::loadFont ( String  fontName,
fs::FS &  ffs 
)

In_eSPI.cpp5425 行目に定義があります。

5426 {
5427  fontFS = ffs;
5428  loadFont(fontName, false);
5429 }

◆ pushColor() [1/2]

void TFT_eSPI::pushColor ( uint16_t  color)

In_eSPI.cpp3352 行目に定義があります。

3353 {
3354  spi_begin();
3355 
3356  tft_Write_16(color);
3357 
3358  spi_end();
3359 }

◆ pushColor() [2/2]

void TFT_eSPI::pushColor ( uint16_t  color,
uint32_t  len 
)

In_eSPI.cpp3366 行目に定義があります。

3367 {
3368  spi_begin();
3369 
3370 #ifdef RPI_WRITE_STROBE
3371  uint8_t colorBin[] = { (uint8_t) (color >> 8), (uint8_t) color };
3372  if(len) spi.writePattern(&colorBin[0], 2, 1); len--;
3373  while(len--) {WR_L; WR_H;}
3374 #else
3375  #if defined (ESP32_PARALLEL)
3376  while (len--) {tft_Write_16(color);}
3377  #else
3378  writeBlock(color, len);
3379  #endif
3380 #endif
3381 
3382  spi_end();
3383 }

◆ pushColors() [1/2]

void TFT_eSPI::pushColors ( uint16_t *  data,
uint32_t  len,
bool  swap = true 
)

In_eSPI.cpp3461 行目に定義があります。

3462 {
3463  spi_begin();
3464 
3465 #if defined (ESP32) || defined (ILI9488_DRIVER)
3466  #if defined (ESP32_PARALLEL) || defined (ILI9488_DRIVER)
3467  if (swap) while ( len-- ) {tft_Write_16(*data); data++;}
3468  else while ( len-- ) {tft_Write_16S(*data); data++;}
3469  #else
3470  if (swap) spi.writePixels(data,len<<1);
3471  else spi.writeBytes((uint8_t*)data,len<<1);
3472  #endif
3473 #else
3474 
3475  uint32_t color[8];
3476 
3477  SPI1U1 = (255 << SPILMOSI) | (255 << SPILMISO);
3478 
3479 
3480  while(len>15)
3481  {
3482 
3483  if (swap)
3484  {
3485  uint32_t i = 0;
3486  while(i<8)
3487  {
3488  color[i] = (*data >> 8) | (uint16_t)(*data << 8);
3489  data++;
3490  color[i] |= ((*data >> 8) | (*data << 8)) << 16;
3491  data++;
3492  i++;
3493  }
3494  }
3495  else
3496  {
3497  memcpy(color,data,32);
3498  data+=16;
3499  }
3500 
3501  len -= 16;
3502 
3503  // ESP8266 wait time here at 40MHz SPI is ~5.45us
3504  while(SPI1CMD & SPIBUSY) {}
3505  SPI1W0 = color[0];
3506  SPI1W1 = color[1];
3507  SPI1W2 = color[2];
3508  SPI1W3 = color[3];
3509  SPI1W4 = color[4];
3510  SPI1W5 = color[5];
3511  SPI1W6 = color[6];
3512  SPI1W7 = color[7];
3513  SPI1CMD |= SPIBUSY;
3514  }
3515 
3516  if(len)
3517  {
3518  uint32_t bits = (len*16-1); // bits left to shift - 1
3519  if (swap)
3520  {
3521  uint16_t* ptr = (uint16_t*)color;
3522  while(len--)
3523  {
3524  *ptr++ = (*(data) >> 8) | (uint16_t)(*(data) << 8);
3525  data++;
3526  }
3527  }
3528  else
3529  {
3530  memcpy(color,data,len<<1);
3531  }
3532  while(SPI1CMD & SPIBUSY) {}
3533  SPI1U1 = (bits << SPILMOSI) | (bits << SPILMISO);
3534  SPI1W0 = color[0];
3535  SPI1W1 = color[1];
3536  SPI1W2 = color[2];
3537  SPI1W3 = color[3];
3538  SPI1W4 = color[4];
3539  SPI1W5 = color[5];
3540  SPI1W6 = color[6];
3541  SPI1W7 = color[7];
3542  SPI1CMD |= SPIBUSY;
3543  }
3544 
3545  while(SPI1CMD & SPIBUSY) {}
3546 
3547 #endif
3548 
3549  spi_end();
3550 }

◆ pushColors() [2/2]

void TFT_eSPI::pushColors ( uint8_t *  data,
uint32_t  len 
)

In_eSPI.cpp3430 行目に定義があります。

3431 {
3432  spi_begin();
3433 
3434 #if defined (RPI_WRITE_STROBE)
3435  while ( len >=64 ) {spi.writePattern(data, 64, 1); data += 64; len -= 64; }
3436  if (len) spi.writePattern(data, len, 1);
3437 #else
3438  #ifdef ESP32_PARALLEL
3439  while (len--) {tft_Write_8(*data); data++;}
3440  #elif defined (ILI9488_DRIVER)
3441  uint16_t color;
3442  while (len>1) {color = (*data++); color |= ((*data++)<<8); tft_Write_16(color); len-=2;}
3443  #else
3444  #if (SPI_FREQUENCY == 80000000)
3445  while ( len >=64 ) {spi.writePattern(data, 64, 1); data += 64; len -= 64; }
3446  if (len) spi.writePattern(data, len, 1);
3447  #else
3448  spi.writeBytes(data, len);
3449  #endif
3450  #endif
3451 #endif
3452 
3453  spi_end();
3454 }

◆ pushImage() [1/6]

void TFT_eSPI::pushImage ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
const uint16_t *  data 
)

In_eSPI.cpp1143 行目に定義があります。

1144 {
1145 #ifdef ESP32
1146  pushImage(x, y, w, h, (uint16_t*)data);
1147 #else
1148  // Partitioned memory FLASH processor
1149  if ((x >= _width) || (y >= _height)) return;
1150 
1151  int32_t dx = 0;
1152  int32_t dy = 0;
1153  int32_t dw = w;
1154  int32_t dh = h;
1155 
1156  if (x < 0) { dw += x; dx = -x; x = 0; }
1157  if (y < 0) { dh += y; dy = -y; y = 0; }
1158 
1159  if ((x + dw) > _width ) dw = _width - x;
1160  if ((y + dh) > _height) dh = _height - y;
1161 
1162  if (dw < 1 || dh < 1) return;
1163 
1164  spi_begin();
1165  inTransaction = true;
1166 
1167  data += dx + dy * w;
1168 
1169  uint16_t buffer[64];
1170  uint16_t* pix_buffer = buffer;
1171 
1172  setWindow(x, y, x + dw - 1, y + dh - 1);
1173 
1174  // Work out the number whole buffers to send
1175  uint16_t nb = (dw * dh) / 64;
1176 
1177  // Fill and send "nb" buffers to TFT
1178  for (int32_t i = 0; i < nb; i++) {
1179  for (int32_t j = 0; j < 64; j++) {
1180  pix_buffer[j] = pgm_read_word(&data[i * 64 + j]);
1181  }
1182  pushColors(pix_buffer, 64, _swapBytes);
1183  }
1184 
1185  // Work out number of pixels not yet sent
1186  uint16_t np = (dw * dh) % 64;
1187 
1188  // Send any partial buffer left over
1189  if (np) {
1190  for (int32_t i = 0; i < np; i++)
1191  {
1192  pix_buffer[i] = pgm_read_word(&data[nb * 64 + i]);
1193  }
1194  pushColors(pix_buffer, np, _swapBytes);
1195  }
1196 
1197  inTransaction = false;
1198  spi_end();
1199 #endif // if ESP32 else ESP8266 check
1200 }

◆ pushImage() [2/6]

void TFT_eSPI::pushImage ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
const uint16_t *  data,
uint16_t  transparent 
)

In_eSPI.cpp1207 行目に定義があります。

1208 {
1209 #ifdef ESP32
1210  pushImage(x, y, w, h, (uint16_t*) data, transp);
1211 #else
1212  // Partitioned memory FLASH processor
1213  if ((x >= _width) || (y >= (int32_t)_height)) return;
1214 
1215  int32_t dx = 0;
1216  int32_t dy = 0;
1217  int32_t dw = w;
1218  int32_t dh = h;
1219 
1220  if (x < 0) { dw += x; dx = -x; x = 0; }
1221  if (y < 0) { dh += y; dy = -y; y = 0; }
1222 
1223  if ((x + dw) > _width ) dw = _width - x;
1224  if ((y + dh) > _height) dh = _height - y;
1225 
1226  if (dw < 1 || dh < 1) return;
1227 
1228  spi_begin();
1229  inTransaction = true;
1230 
1231  data += dx + dy * w;
1232 
1233  int32_t xe = x + dw - 1, ye = y + dh - 1;
1234 
1235  uint16_t lineBuf[dw];
1236 
1237  if (!_swapBytes) transp = transp >> 8 | transp << 8;
1238 
1239  while (dh--)
1240  {
1241  int32_t len = dw;
1242  uint16_t* ptr = (uint16_t*)data;
1243  int32_t px = x;
1244  boolean move = true;
1245 
1246  uint16_t np = 0;
1247 
1248  while (len--)
1249  {
1250  uint16_t color = pgm_read_word(ptr);
1251  if (transp != color)
1252  {
1253  if (move) { move = false; setWindow(px, y, xe, ye); }
1254  lineBuf[np] = color;
1255  np++;
1256  }
1257  else
1258  {
1259  move = true;
1260  if (np)
1261  {
1262  pushColors(lineBuf, np, _swapBytes);
1263  np = 0;
1264  }
1265  }
1266  px++;
1267  ptr++;
1268  }
1269  if (np) pushColors(lineBuf, np, _swapBytes);
1270 
1271  y++;
1272  data += w;
1273  }
1274 
1275  inTransaction = false;
1276  spi_end();
1277 #endif // if ESP32 else ESP8266 check
1278 }

◆ pushImage() [3/6]

void TFT_eSPI::pushImage ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint16_t *  data 
)

In_eSPI.cpp1032 行目に定義があります。

1033 {
1034 
1035  if ((x >= _width) || (y >= _height)) return;
1036 
1037  int32_t dx = 0;
1038  int32_t dy = 0;
1039  int32_t dw = w;
1040  int32_t dh = h;
1041 
1042  if (x < 0) { dw += x; dx = -x; x = 0; }
1043  if (y < 0) { dh += y; dy = -y; y = 0; }
1044 
1045  if ((x + dw) > _width ) dw = _width - x;
1046  if ((y + dh) > _height) dh = _height - y;
1047 
1048  if (dw < 1 || dh < 1) return;
1049 
1050  spi_begin();
1051  inTransaction = true;
1052 
1053  setWindow(x, y, x + dw - 1, y + dh - 1);
1054 
1055  data += dx + dy * w;
1056 
1057  while (dh--)
1058  {
1059  pushColors(data, dw, _swapBytes);
1060  data += w;
1061  }
1062 
1063  inTransaction = false;
1064  spi_end();
1065 }

◆ pushImage() [4/6]

void TFT_eSPI::pushImage ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint16_t *  data,
uint16_t  transparent 
)

In_eSPI.cpp1071 行目に定義があります。

1072 {
1073 
1074  if ((x >= _width) || (y >= _height)) return;
1075 
1076  int32_t dx = 0;
1077  int32_t dy = 0;
1078  int32_t dw = w;
1079  int32_t dh = h;
1080 
1081  if (x < 0) { dw += x; dx = -x; x = 0; }
1082  if (y < 0) { dh += y; dy = -y; y = 0; }
1083 
1084  if ((x + dw) > _width ) dw = _width - x;
1085  if ((y + dh) > _height) dh = _height - y;
1086 
1087  if (dw < 1 || dh < 1) return;
1088 
1089  spi_begin();
1090  inTransaction = true;
1091 
1092  data += dx + dy * w;
1093 
1094  int32_t xe = x + dw - 1, ye = y + dh - 1;
1095 
1096  uint16_t lineBuf[dw];
1097 
1098  if (!_swapBytes) transp = transp >> 8 | transp << 8;
1099 
1100  while (dh--)
1101  {
1102  int32_t len = dw;
1103  uint16_t* ptr = data;
1104  int32_t px = x;
1105  boolean move = true;
1106  uint16_t np = 0;
1107 
1108  while (len--)
1109  {
1110  if (transp != *ptr)
1111  {
1112  if (move) { move = false; setWindow(px, y, xe, ye); }
1113  lineBuf[np] = *ptr;
1114  np++;
1115  }
1116  else
1117  {
1118  move = true;
1119  if (np)
1120  {
1121  pushColors((uint16_t*)lineBuf, np, _swapBytes);
1122  np = 0;
1123  }
1124  }
1125  px++;
1126  ptr++;
1127  }
1128  if (np) pushColors((uint16_t*)lineBuf, np, _swapBytes);
1129 
1130  y++;
1131  data += w;
1132  }
1133 
1134  inTransaction = false;
1135  spi_end();
1136 }

◆ pushImage() [5/6]

void TFT_eSPI::pushImage ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint8_t *  data,
bool  bpp8 = true 
)

In_eSPI.cpp1285 行目に定義があります。

1286 {
1287  if ((x >= _width) || (y >= (int32_t)_height)) return;
1288 
1289  int32_t dx = 0;
1290  int32_t dy = 0;
1291  int32_t dw = w;
1292  int32_t dh = h;
1293 
1294  if (x < 0) { dw += x; dx = -x; x = 0; }
1295  if (y < 0) { dh += y; dy = -y; y = 0; }
1296 
1297  if ((x + dw) > _width ) dw = _width - x;
1298  if ((y + dh) > _height) dh = _height - y;
1299 
1300  if (dw < 1 || dh < 1) return;
1301 
1302  spi_begin();
1303  inTransaction = true;
1304 
1305  setWindow(x, y, x + dw - 1, y + dh - 1); // Sets CS low and sent RAMWR
1306 
1307  // Line buffer makes plotting faster
1308  uint16_t lineBuf[dw];
1309 
1310  if (bpp8)
1311  {
1312  uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
1313 
1314  _lastColor = -1; // Set to illegal value
1315 
1316  // Used to store last shifted colour
1317  uint8_t msbColor = 0;
1318  uint8_t lsbColor = 0;
1319 
1320  data += dx + dy * w;
1321  while (dh--)
1322  {
1323  uint32_t len = dw;
1324  uint8_t* ptr = data;
1325  uint8_t* linePtr = (uint8_t*)lineBuf;
1326 
1327  while(len--)
1328  {
1329  uint32_t color = *ptr++;
1330 
1331  // Shifts are slow so check if colour has changed first
1332  if (color != _lastColor) {
1333  // =====Green===== ===============Red==============
1334  msbColor = (color & 0x1C)>>2 | (color & 0xC0)>>3 | (color & 0xE0);
1335  // =====Green===== =======Blue======
1336  lsbColor = (color & 0x1C)<<3 | blue[color & 0x03];
1337  _lastColor = color;
1338  }
1339 
1340  *linePtr++ = msbColor;
1341  *linePtr++ = lsbColor;
1342  }
1343 
1344  pushColors(lineBuf, dw, false);
1345 
1346  data += w;
1347  }
1348  }
1349  else
1350  {
1351  while (dh--)
1352  {
1353  w = (w+7) & 0xFFF8;
1354 
1355  int32_t len = dw;
1356  uint8_t* ptr = data;
1357  uint8_t* linePtr = (uint8_t*)lineBuf;
1358  uint8_t bits = 8;
1359  while(len>0)
1360  {
1361  if (len < 8) bits = len;
1362  uint32_t xp = dx;
1363  for (uint16_t i = 0; i < bits; i++)
1364  {
1365  uint8_t col = (ptr[(xp + dy * w)>>3] << (xp & 0x7)) & 0x80;
1366  if (col) {*linePtr++ = bitmap_fg>>8; *linePtr++ = (uint8_t) bitmap_fg;}
1367  else {*linePtr++ = bitmap_bg>>8; *linePtr++ = (uint8_t) bitmap_bg;}
1368  //if (col) drawPixel((dw-len)+xp,h-dh,bitmap_fg);
1369  //else drawPixel((dw-len)+xp,h-dh,bitmap_bg);
1370  xp++;
1371  }
1372  ptr++;
1373  len -= 8;
1374  }
1375 
1376  pushColors(lineBuf, dw, false);
1377 
1378  dy++;
1379  }
1380  }
1381 
1382  inTransaction = false;
1383  spi_end();
1384 }

◆ pushImage() [6/6]

void TFT_eSPI::pushImage ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint8_t *  data,
uint8_t  transparent,
bool  bpp8 = true 
)

In_eSPI.cpp1391 行目に定義があります。

1392 {
1393  if ((x >= _width) || (y >= _height)) return;
1394 
1395  int32_t dx = 0;
1396  int32_t dy = 0;
1397  int32_t dw = w;
1398  int32_t dh = h;
1399 
1400  if (x < 0) { dw += x; dx = -x; x = 0; }
1401  if (y < 0) { dh += y; dy = -y; y = 0; }
1402 
1403  if ((x + dw) > _width ) dw = _width - x;
1404  if ((y + dh) > _height) dh = _height - y;
1405 
1406  if (dw < 1 || dh < 1) return;
1407 
1408  spi_begin();
1409  inTransaction = true;
1410 
1411  int32_t xe = x + dw - 1, ye = y + dh - 1;
1412 
1413  // Line buffer makes plotting faster
1414  uint16_t lineBuf[dw];
1415 
1416  if (bpp8)
1417  {
1418  data += dx + dy * w;
1419 
1420  uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
1421 
1422  _lastColor = -1; // Set to illegal value
1423 
1424  // Used to store last shifted colour
1425  uint8_t msbColor = 0;
1426  uint8_t lsbColor = 0;
1427 
1428  //int32_t spx = x, spy = y;
1429 
1430  while (dh--)
1431  {
1432  int32_t len = dw;
1433  uint8_t* ptr = data;
1434  uint8_t* linePtr = (uint8_t*)lineBuf;
1435 
1436  int32_t px = x;
1437  boolean move = true;
1438  uint16_t np = 0;
1439 
1440  while (len--)
1441  {
1442  if (transp != *ptr)
1443  {
1444  if (move) { move = false; setWindow(px, y, xe, ye);}
1445  uint8_t color = *ptr;
1446 
1447  // Shifts are slow so check if colour has changed first
1448  if (color != _lastColor) {
1449  // =====Green===== ===============Red==============
1450  msbColor = (color & 0x1C)>>2 | (color & 0xC0)>>3 | (color & 0xE0);
1451  // =====Green===== =======Blue======
1452  lsbColor = (color & 0x1C)<<3 | blue[color & 0x03];
1453  _lastColor = color;
1454  }
1455  *linePtr++ = msbColor;
1456  *linePtr++ = lsbColor;
1457  np++;
1458  }
1459  else
1460  {
1461  move = true;
1462  if (np)
1463  {
1464  pushColors(lineBuf, np, false);
1465  linePtr = (uint8_t*)lineBuf;
1466  np = 0;
1467  }
1468  }
1469  px++;
1470  ptr++;
1471  }
1472 
1473  if (np) pushColors(lineBuf, np, false);
1474 
1475  y++;
1476  data += w;
1477  }
1478  }
1479  else
1480  {
1481  w = (w+7) & 0xFFF8;
1482  while (dh--)
1483  {
1484  int32_t px = x;
1485  boolean move = true;
1486  uint16_t np = 0;
1487  int32_t len = dw;
1488  uint8_t* ptr = data;
1489  uint8_t bits = 8;
1490  while(len>0)
1491  {
1492  if (len < 8) bits = len;
1493  uint32_t xp = dx;
1494  uint32_t yp = (dy * w)>>3;
1495  for (uint16_t i = 0; i < bits; i++)
1496  {
1497  //uint8_t col = (ptr[(xp + dy * w)>>3] << (xp & 0x7)) & 0x80;
1498  if ((ptr[(xp>>3) + yp] << (xp & 0x7)) & 0x80)
1499  {
1500  if (move)
1501  {
1502  move = false;
1503  setWindow(px, y, xe, ye);
1504  }
1505  np++;
1506  }
1507  else
1508  {
1509  if (np)
1510  {
1511  pushColor(bitmap_fg, np);
1512  np = 0;
1513  move = true;
1514  }
1515  }
1516  px++;
1517  xp++;
1518  }
1519  ptr++;
1520  len -= 8;
1521  }
1522  if (np) pushColor(bitmap_fg, np);
1523  y++;
1524  dy++;
1525  }
1526  }
1527 
1528  inTransaction = false;
1529  spi_end();
1530 }

◆ pushRect()

void TFT_eSPI::pushRect ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint16_t *  data 
)

In_eSPI.cpp1020 行目に定義があります。

1021 {
1022  // Function deprecated, remains for backwards compatibility
1023  // pushImage() is better as it will crop partly off-screen image blocks
1024  pushImage(x, y, w, h, data);
1025 }

◆ readcommand16()

uint16_t TFT_eSPI::readcommand16 ( uint8_t  cmd_function,
uint8_t  index = 0 
)

In_eSPI.cpp653 行目に定義があります。

654 {
655  uint32_t reg;
656 
657  reg = (readcommand8(cmd_function, index + 0) << 8);
658  reg |= (readcommand8(cmd_function, index + 1) << 0);
659 
660  return reg;
661 }

◆ readcommand32()

uint32_t TFT_eSPI::readcommand32 ( uint8_t  cmd_function,
uint8_t  index = 0 
)

In_eSPI.cpp668 行目に定義があります。

669 {
670  uint32_t reg;
671 
672  reg = (readcommand8(cmd_function, index + 0) << 24);
673  reg |= (readcommand8(cmd_function, index + 1) << 16);
674  reg |= (readcommand8(cmd_function, index + 2) << 8);
675  reg |= (readcommand8(cmd_function, index + 3) << 0);
676 
677  return reg;
678 }

◆ readcommand8()

uint8_t TFT_eSPI::readcommand8 ( uint8_t  cmd_function,
uint8_t  index = 0 
)

In_eSPI.cpp607 行目に定義があります。

608 {
609  uint8_t reg = 0;
610 #ifdef ESP32_PARALLEL
611 
612  writecommand(cmd_function); // Sets DC and CS high
613 
614  busDir(dir_mask, INPUT);
615 
616  CS_L;
617 
618  // Read nth parameter (assumes caller discards 1st parameter or points index to 2nd)
619  while(index--) reg = readByte();
620 
621  busDir(dir_mask, OUTPUT);
622 
623  CS_H;
624 
625 #else
626  // for ILI9341 Interface II i.e. IM [3:0] = "1101"
627  spi_begin_read();
628  index = 0x10 + (index & 0x0F);
629 
630  DC_C;
631  tft_Write_8(0xD9);
632  DC_D;
633  tft_Write_8(index);
634 
635  CS_H; // Some displays seem to need CS to be pulsed here, or is just a delay needed?
636  CS_L;
637 
638  DC_C;
639  tft_Write_8(cmd_function);
640  DC_D;
641  reg = tft_Read_8();
642 
643  spi_end_read();
644 #endif
645  return reg;
646 }

◆ readPixel()

uint16_t TFT_eSPI::readPixel ( int32_t  x0,
int32_t  y0 
)

In_eSPI.cpp685 行目に定義があります。

686 {
687 #if defined(ESP32_PARALLEL)
688 
689  readAddrWindow(x0, y0, 1, 1); // Sets CS low
690 
691  // Set masked pins D0- D7 to input
692  busDir(dir_mask, INPUT);
693 
694  // Dummy read to throw away don't care value
695  readByte();
696 
697  // Fetch the 16 bit BRG pixel
698  //uint16_t rgb = (readByte() << 8) | readByte();
699 
700  #if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) // Read 3 bytes
701 
702  // Read window pixel 24 bit RGB values and fill in LS bits
703  uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
704 
705  CS_H;
706 
707  // Set masked pins D0- D7 to output
708  busDir(dir_mask, OUTPUT);
709 
710  return rgb;
711 
712  #else // ILI9481 16 bit read
713 
714  // Fetch the 16 bit BRG pixel
715  uint16_t bgr = (readByte() << 8) | readByte();
716 
717  CS_H;
718 
719  // Set masked pins D0- D7 to output
720  busDir(dir_mask, OUTPUT);
721 
722  // Swap Red and Blue (could check MADCTL setting to see if this is needed)
723  return (bgr>>11) | (bgr<<11) | (bgr & 0x7E0);
724  #endif
725 
726 #else // Not ESP32_PARALLEL
727 
728  // This function can get called during antialiased font rendering
729  // so a transaction may be in progress
730  bool wasInTransaction = inTransaction;
731  if (inTransaction) { inTransaction= false; spi_end();}
732 
733  spi_begin_read();
734 
735  readAddrWindow(x0, y0, 1, 1); // Sets CS low
736 
737  #ifdef TFT_SDA_READ
738  begin_SDA_Read();
739  #endif
740 
741  // Dummy read to throw away don't care value
742  tft_Read_8();
743 
744  //#if !defined (ILI9488_DRIVER)
745 
746  // Read the 3 RGB bytes, colour is actually only in the top 6 bits of each byte
747  // as the TFT stores colours as 18 bits
748  uint8_t r = tft_Read_8();
749  uint8_t g = tft_Read_8();
750  uint8_t b = tft_Read_8();
751 /*
752  #else
753 
754  // The 6 colour bits are in MS 6 bits of each byte, but the ILI9488 needs an extra clock pulse
755  // so bits appear shifted right 1 bit, so mask the middle 6 bits then shift 1 place left
756  uint8_t r = (tft_Read_8()&0x7E)<<1;
757  uint8_t g = (tft_Read_8()&0x7E)<<1;
758  uint8_t b = (tft_Read_8()&0x7E)<<1;
759 
760  #endif
761 */
762  CS_H;
763 
764  #ifdef TFT_SDA_READ
765  end_SDA_Read();
766  #endif
767 
768  spi_end_read();
769 
770  // Reinstate the transaction if one was in progress
771  if(wasInTransaction) { spi_begin(); inTransaction = true; }
772 
773  return color565(r, g, b);
774 
775 #endif
776 }

◆ readRect()

void TFT_eSPI::readRect ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint16_t *  data 
)

In_eSPI.cpp858 行目に定義があります。

859 {
860  if ((x > _width) || (y > _height) || (w == 0) || (h == 0)) return;
861 
862 #if defined(ESP32_PARALLEL)
863 
864  readAddrWindow(x, y, w, h); // Sets CS low
865 
866  // Set masked pins D0- D7 to input
867  busDir(dir_mask, INPUT);
868 
869  // Dummy read to throw away don't care value
870  readByte();
871 
872  // Total pixel count
873  uint32_t len = w * h;
874 
875 #if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) // Read 3 bytes
876  // Fetch the 24 bit RGB value
877  while (len--) {
878  // Assemble the RGB 16 bit colour
879  uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
880 
881  // Swapped byte order for compatibility with pushRect()
882  *data++ = (rgb<<8) | (rgb>>8);
883  }
884 #else // ILI9481 reads as 16 bits
885  // Fetch the 16 bit BRG pixels
886  while (len--) {
887  // Read the BRG 16 bit colour
888  uint16_t bgr = (readByte() << 8) | readByte();
889 
890  // Swap Red and Blue (could check MADCTL setting to see if this is needed)
891  uint16_t rgb = (bgr>>11) | (bgr<<11) | (bgr & 0x7E0);
892 
893  // Swapped byte order for compatibility with pushRect()
894  *data++ = (rgb<<8) | (rgb>>8);
895  }
896 #endif
897  CS_H;
898 
899  // Set masked pins D0- D7 to output
900  busDir(dir_mask, OUTPUT);
901 
902 #else // Not ESP32_PARALLEL
903 
904  spi_begin_read();
905 
906  readAddrWindow(x, y, w, h); // Sets CS low
907 
908  #ifdef TFT_SDA_READ
909  begin_SDA_Read();
910  #endif
911 
912  // Dummy read to throw away don't care value
913  tft_Read_8();
914 
915  // Read window pixel 24 bit RGB values
916  uint32_t len = w * h;
917  while (len--) {
918 
919  #if !defined (ILI9488_DRIVER)
920 
921  // Read the 3 RGB bytes, colour is actually only in the top 6 bits of each byte
922  // as the TFT stores colours as 18 bits
923  uint8_t r = tft_Read_8();
924  uint8_t g = tft_Read_8();
925  uint8_t b = tft_Read_8();
926 
927  #else
928 
929  // The 6 colour bits are in LS 6 bits of each byte but we do not include the extra clock pulse
930  // so we use a trick and mask the middle 6 bits of the byte, then only shift 1 place left
931  uint8_t r = (tft_Read_8()&0x7E)<<1;
932  uint8_t g = (tft_Read_8()&0x7E)<<1;
933  uint8_t b = (tft_Read_8()&0x7E)<<1;
934 
935  #endif
936 
937  // Swapped colour byte order for compatibility with pushRect()
938  *data++ = (r & 0xF8) | (g & 0xE0) >> 5 | (b & 0xF8) << 5 | (g & 0x1C) << 11;
939  }
940 
941  CS_H;
942 
943  #ifdef TFT_SDA_READ
944  end_SDA_Read();
945  #endif
946 
947  spi_end_read();
948 
949 #endif
950 }

◆ readRectRGB()

void TFT_eSPI::readRectRGB ( int32_t  x0,
int32_t  y0,
int32_t  w,
int32_t  h,
uint8_t *  data 
)

In_eSPI.cpp1557 行目に定義があります。

1558 {
1559 #if defined(ESP32_PARALLEL)
1560 
1561  // ESP32 parallel bus supported yet
1562 
1563 #else // Not ESP32_PARALLEL
1564 
1565  spi_begin_read();
1566 
1567  readAddrWindow(x0, y0, w, h); // Sets CS low
1568 
1569  #ifdef TFT_SDA_READ
1570  begin_SDA_Read();
1571  #endif
1572 
1573  // Dummy read to throw away don't care value
1574  tft_Read_8();
1575 
1576  // Read window pixel 24 bit RGB values, buffer must be set in sketch to 3 * w * h
1577  uint32_t len = w * h;
1578  while (len--) {
1579 
1580  #if !defined (ILI9488_DRIVER)
1581 
1582  // Read the 3 RGB bytes, colour is actually only in the top 6 bits of each byte
1583  // as the TFT stores colours as 18 bits
1584  *data++ = tft_Read_8();
1585  *data++ = tft_Read_8();
1586  *data++ = tft_Read_8();
1587 
1588  #else
1589 
1590  // The 6 colour bits are in MS 6 bits of each byte, but the ILI9488 needs an extra clock pulse
1591  // so bits appear shifted right 1 bit, so mask the middle 6 bits then shift 1 place left
1592  *data++ = (tft_Read_8()&0x7E)<<1;
1593  *data++ = (tft_Read_8()&0x7E)<<1;
1594  *data++ = (tft_Read_8()&0x7E)<<1;
1595 
1596  #endif
1597 
1598  }
1599 
1600  CS_H;
1601 
1602  #ifdef TFT_SDA_READ
1603  end_SDA_Read();
1604  #endif
1605 
1606  spi_end_read();
1607 
1608 #endif
1609 }

◆ setAddrWindow()

void TFT_eSPI::setAddrWindow ( int32_t  xs,
int32_t  ys,
int32_t  w,
int32_t  h 
)

In_eSPI.cpp2726 行目に定義があります。

2727 {
2728  spi_begin();
2729 
2730  setWindow(x0, y0, x0 + w - 1, y0 + h - 1);
2731 
2732  spi_end();
2733 }

◆ setAttribute()

void TFT_eSPI::setAttribute ( uint8_t  id = 0,
uint8_t  a = 0 
)

In_eSPI.cpp3976 行目に定義があります。

3976  {
3977  switch (attr_id) {
3978  break;
3979  case 1:
3980  _cp437 = param;
3981  break;
3982  case 2:
3983  _utf8 = param;
3984  decoderState = 0;
3985  break;
3986  //case 3: // TBD future feature control
3987  // _tbd = param;
3988  // break;
3989  }
3990 }

◆ setBitmapColor()

void TFT_eSPI::setBitmapColor ( uint16_t  fgcolor,
uint16_t  bgcolor 
)

In_eSPI.cpp2250 行目に定義があります。

2251 {
2252  if (c == b) b = ~c;
2253  bitmap_fg = c;
2254  bitmap_bg = b;
2255 }

◆ setCallback()

void TFT_eSPI::setCallback ( getColorCallback  getCol)

In_eSPI.cpp778 行目に定義があります。

779 {
780  getColor = getCol;
781 }

◆ setCursor() [1/2]

void TFT_eSPI::setCursor ( int16_t  x,
int16_t  y 
)

In_eSPI.cpp2143 行目に定義があります。

2144 {
2145  cursor_x = x;
2146  cursor_y = y;
2147 }

◆ setCursor() [2/2]

void TFT_eSPI::setCursor ( int16_t  x,
int16_t  y,
uint8_t  font 
)

In_eSPI.cpp2154 行目に定義があります。

2155 {
2156  textfont = font;
2157  cursor_x = x;
2158  cursor_y = y;
2159 }

◆ setFreeFont()

void TFT_eSPI::setFreeFont ( const GFXfont *  f = NULL)

In_eSPI.cpp4941 行目に定義があります。

4942 {
4943  if (f == nullptr) // Fix issue #400 (ESP32 crash)
4944  {
4945  setTextFont(1); // Use GLCD font
4946  return;
4947  }
4948 
4949  textfont = 1;
4950  gfxFont = (GFXfont *)f;
4951 
4952  glyph_ab = 0;
4953  glyph_bb = 0;
4954  uint16_t numChars = pgm_read_word(&gfxFont->last) - pgm_read_word(&gfxFont->first);
4955 
4956  // Find the biggest above and below baseline offsets
4957  for (uint8_t c = 0; c < numChars; c++)
4958  {
4959  GFXglyph *glyph1 = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c]);
4960  int8_t ab = -pgm_read_byte(&glyph1->yOffset);
4961  if (ab > glyph_ab) glyph_ab = ab;
4962  int8_t bb = pgm_read_byte(&glyph1->height) - ab;
4963  if (bb > glyph_bb) glyph_bb = bb;
4964  }
4965 }

◆ setPivot()

void TFT_eSPI::setPivot ( int16_t  x,
int16_t  y 
)

In_eSPI.cpp2219 行目に定義があります。

2220 {
2221  _xpivot = x;
2222  _ypivot = y;
2223 }

◆ setRotation()

void TFT_eSPI::setRotation ( uint8_t  r)

In_eSPI.cpp466 行目に定義があります。

467 {
468 
469  spi_begin();
470 
471  // This loads the driver specific rotation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
472 #if defined (ILI9341_DRIVER)
473  #include "ILI9341_Rotation.h"
474 
475 #elif defined (ST7735_DRIVER)
476  #include "ST7735_Rotation.h"
477 
478 #elif defined (ILI9163_DRIVER)
479  #include "TFT_Drivers/ILI9163_Rotation.h"
480 
481 #elif defined (S6D02A1_DRIVER)
482  #include "TFT_Drivers/S6D02A1_Rotation.h"
483 
484 #elif defined (RPI_ILI9486_DRIVER)
485  #include "TFT_Drivers/ILI9486_Rotation.h"
486 
487 #elif defined (ILI9486_DRIVER)
488  #include "TFT_Drivers/ILI9486_Rotation.h"
489 
490 #elif defined (ILI9481_DRIVER)
491  #include "TFT_Drivers/ILI9481_Rotation.h"
492 
493 #elif defined (ILI9488_DRIVER)
494  #include "TFT_Drivers/ILI9488_Rotation.h"
495 
496 #elif defined (HX8357D_DRIVER)
497  #include "TFT_Drivers/HX8357D_Rotation.h"
498 
499 #elif defined (ST7789_DRIVER)
500  #include "TFT_Drivers/ST7789_Rotation.h"
501 
502 #elif defined (R61581_DRIVER)
503  #include "TFT_Drivers/R61581_Rotation.h"
504 
505 #elif defined (RM68140_DRIVER)
506  #include "TFT_Drivers/RM68140_Rotation.h"
507 
508 #elif defined (ST7789_2_DRIVER)
509  #include "TFT_Drivers/ST7789_2_Rotation.h"
510 
511 #endif
512 
513  delayMicroseconds(10);
514 
515  spi_end();
516 
517  addr_row = 0xFFFF;
518  addr_col = 0xFFFF;
519 }

◆ setSwapBytes()

void TFT_eSPI::setSwapBytes ( bool  swap)

In_eSPI.cpp1537 行目に定義があります。

1538 {
1539  _swapBytes = swap;
1540 }

◆ setTextColor() [1/2]

void TFT_eSPI::setTextColor ( uint16_t  color)

In_eSPI.cpp2196 行目に定義があります。

2197 {
2198  // For 'transparent' background, we'll set the bg
2199  // to the same as fg instead of using a flag
2200  textcolor = textbgcolor = c;
2201 }

◆ setTextColor() [2/2]

void TFT_eSPI::setTextColor ( uint16_t  fgcolor,
uint16_t  bgcolor 
)

In_eSPI.cpp2208 行目に定義があります。

2209 {
2210  textcolor = c;
2211  textbgcolor = b;
2212 }

◆ setTextDatum()

void TFT_eSPI::setTextDatum ( uint8_t  datum)

In_eSPI.cpp2273 行目に定義があります。

2274 {
2275  textdatum = d;
2276 }

◆ setTextFont()

void TFT_eSPI::setTextFont ( uint8_t  font)

In_eSPI.cpp4972 行目に定義があります。

4973 {
4974  textfont = (f > 0) ? f : 1; // Don't allow font 0
4975  gfxFont = NULL;
4976 }

◆ setTextPadding()

void TFT_eSPI::setTextPadding ( uint16_t  x_width)

In_eSPI.cpp2283 行目に定義があります。

2284 {
2285  padX = x_width;
2286 }

◆ setTextSize()

void TFT_eSPI::setTextSize ( uint8_t  size)

In_eSPI.cpp2185 行目に定義があります。

2186 {
2187  if (s>7) s = 7; // Limit the maximum size multiplier so byte variables can be used for rendering
2188  textsize = (s > 0) ? s : 1; // Don't allow font size 0
2189 }

◆ setTextWrap()

void TFT_eSPI::setTextWrap ( boolean  wrapX,
boolean  wrapY = false 
)

In_eSPI.cpp2262 行目に定義があります。

2263 {
2264  textwrapX = wrapX;
2265  textwrapY = wrapY;
2266 }

◆ setWindow()

void TFT_eSPI::setWindow ( int32_t  xs,
int32_t  ys,
int32_t  xe,
int32_t  ye 
)

In_eSPI.cpp2935 行目に定義があります。

2936 {
2937  //spi_begin(); // Must be called before setWimdow
2938 
2939  addr_col = 0xFFFF;
2940  addr_row = 0xFFFF;
2941 
2942 #ifdef CGRAM_OFFSET
2943  x0+=colstart;
2944  x1+=colstart;
2945  y0+=rowstart;
2946  y1+=rowstart;
2947 #endif
2948 
2949  DC_C;
2950 
2952 
2953  DC_D;
2954 
2955 #if defined (RPI_ILI9486_DRIVER)
2956  uint8_t xb[] = { 0, (uint8_t) (x0>>8), 0, (uint8_t) (x0>>0), 0, (uint8_t) (x1>>8), 0, (uint8_t) (x1>>0), };
2957  spi.writePattern(&xb[0], 8, 1);
2958 #else
2959  tft_Write_32(SPI_32(x0, x1));
2960 #endif
2961 
2962  DC_C;
2963 
2964  // Row addr set
2966 
2967  DC_D;
2968 
2969 #if defined (RPI_ILI9486_DRIVER)
2970  uint8_t yb[] = { 0, (uint8_t) (y0>>8), 0, (uint8_t) (y0>>0), 0, (uint8_t) (y1>>8), 0, (uint8_t) (y1>>0), };
2971  spi.writePattern(&yb[0], 8, 1);
2972 #else
2973  tft_Write_32(SPI_32(y0, y1));
2974 #endif
2975 
2976  DC_C;
2977 
2978  // write to RAM
2980 
2981  DC_D;
2982 
2983  //spi_end();
2984 }

◆ showFont()

void TFT_eSPI::showFont ( uint32_t  td)

In_eSPI.cpp5955 行目に定義があります。

5956 {
5957  if(!fontLoaded) return;
5958 
5959  if(!fontFile)
5960  {
5961  fontLoaded = false;
5962  return;
5963  }
5964 
5965  int16_t cursorX = width(); // Force start of new page to initialise cursor
5966  int16_t cursorY = height();// for the first character
5967  uint32_t timeDelay = 0; // No delay before first page
5968 
5970 
5971  for (uint16_t i = 0; i < gFont.gCount; i++)
5972  {
5973  // Check if this will need a new screen
5974  if (cursorX + gdX[i] + gWidth[i] >= width()) {
5975  cursorX = -gdX[i];
5976 
5977  cursorY += gFont.yAdvance;
5978  if (cursorY + gFont.maxAscent + gFont.descent >= height()) {
5979  cursorX = -gdX[i];
5980  cursorY = 0;
5981  delay(timeDelay);
5982  timeDelay = td;
5984  }
5985  }
5986 
5987  setCursor(cursorX, cursorY);
5988  drawGlyph(gUnicode[i]);
5989  cursorX += gxAdvance[i];
5990  //cursorX += printToSprite( cursorX, cursorY, i );
5991  yield();
5992  }
5993 
5994  delay(timeDelay);
5996  //fontFile.close();
5997 
5998 }

◆ spiwrite()

void TFT_eSPI::spiwrite ( uint8_t  c)

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

561 {
562  tft_Write_8(c);
563 }

◆ startWrite()

void TFT_eSPI::startWrite ( void  )

In_eSPI.cpp3389 行目に定義があります。

3390 {
3391  spi_begin();
3392  inTransaction = true;
3393 }

◆ textWidth() [1/4]

int16_t TFT_eSPI::textWidth ( const char *  string)

In_eSPI.cpp2349 行目に定義があります。

2350 {
2351  return textWidth(string, textfont);
2352 }

◆ textWidth() [2/4]

int16_t TFT_eSPI::textWidth ( const char *  string,
uint8_t  font 
)

In_eSPI.cpp2354 行目に定義があります。

2355 {
2356  int32_t str_width = 0;
2357  uint16_t uniCode = 0;
2358 
2359 #ifdef SMOOTH_FONT
2360  if(fontLoaded)
2361  {
2362  while (*string)
2363  {
2364  uniCode = decodeUTF8(*string++);
2365  if (uniCode)
2366  {
2367  if (uniCode == 0x20) str_width += gFont.spaceWidth;
2368  else
2369  {
2370  uint16_t gNum = 0;
2371  bool found = getUnicodeIndex(uniCode, &gNum);
2372  if (found)
2373  {
2374  if(str_width == 0 && gdX[gNum] < 0) str_width -= gdX[gNum];
2375  if (*string || isDigits) str_width += gxAdvance[gNum];
2376  else str_width += (gdX[gNum] + gWidth[gNum]);
2377  }
2378  else str_width += gFont.spaceWidth + 1;
2379  }
2380  }
2381  }
2382  isDigits = false;
2383  return str_width;
2384  }
2385 #endif
2386 
2387  if (font>1 && font<9)
2388  {
2389  char *widthtable = (char *)pgm_read_dword( &(fontdata[font].widthtbl ) ) - 32; //subtract the 32 outside the loop
2390 
2391  while (*string)
2392  {
2393  uniCode = *(string++);
2394  if (uniCode > 31 && uniCode < 128)
2395  str_width += pgm_read_byte( widthtable + uniCode); // Normally we need to subtract 32 from uniCode
2396  else str_width += pgm_read_byte( widthtable + 32); // Set illegal character = space width
2397  }
2398 
2399  }
2400  else
2401  {
2402 
2403 #ifdef LOAD_GFXFF
2404  if(gfxFont) // New font
2405  {
2406  while (*string)
2407  {
2408  uniCode = decodeUTF8(*string++);
2409  if ((uniCode >= pgm_read_word(&gfxFont->first)) && (uniCode <= pgm_read_word(&gfxFont->last )))
2410  {
2411  uniCode -= pgm_read_word(&gfxFont->first);
2412  GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[uniCode]);
2413  // If this is not the last character or is a digit then use xAdvance
2414  if (*string || isDigits) str_width += pgm_read_byte(&glyph->xAdvance);
2415  // Else use the offset plus width since this can be bigger than xAdvance
2416  else str_width += ((int8_t)pgm_read_byte(&glyph->xOffset) + pgm_read_byte(&glyph->width));
2417  }
2418  }
2419  }
2420  else
2421 #endif
2422  {
2423 #ifdef LOAD_GLCD
2424  while (*string++) str_width += 6;
2425 #endif
2426  }
2427  }
2428  isDigits = false;
2429  return str_width * textsize;
2430 }

◆ textWidth() [3/4]

int16_t TFT_eSPI::textWidth ( const String &  string)

In_eSPI.cpp2333 行目に定義があります。

2334 {
2335  int16_t len = string.length() + 2;
2336  char buffer[len];
2337  string.toCharArray(buffer, len);
2338  return textWidth(buffer, textfont);
2339 }

◆ textWidth() [4/4]

int16_t TFT_eSPI::textWidth ( const String &  string,
uint8_t  font 
)

In_eSPI.cpp2341 行目に定義があります。

2342 {
2343  int16_t len = string.length() + 2;
2344  char buffer[len];
2345  string.toCharArray(buffer, len);
2346  return textWidth(buffer, font);
2347 }

◆ unloadFont()

void TFT_eSPI::unloadFont ( void  )

In_eSPI.cpp5643 行目に定義があります。

5644 {
5645  if (gUnicode)
5646  {
5647  free(gUnicode);
5648  gUnicode = NULL;
5649  }
5650 
5651  if (gHeight)
5652  {
5653  free(gHeight);
5654  gHeight = NULL;
5655  }
5656 
5657  if (gWidth)
5658  {
5659  free(gWidth);
5660  gWidth = NULL;
5661  }
5662 
5663  if (gxAdvance)
5664  {
5665  free(gxAdvance);
5666  gxAdvance = NULL;
5667  }
5668 
5669  if (gdY)
5670  {
5671  free(gdY);
5672  gdY = NULL;
5673  }
5674 
5675  if (gdX)
5676  {
5677  free(gdX);
5678  gdX = NULL;
5679  }
5680 
5681  if (gBitmap)
5682  {
5683  free(gBitmap);
5684  gBitmap = NULL;
5685  }
5686 
5687  if(fontFile) fontFile.close();
5688  fontLoaded = false;
5689 }

◆ width()

int16_t TFT_eSPI::width ( void  )

In_eSPI.cpp2313 行目に定義があります。

2314 {
2315  return _width;
2316 }

◆ write()

size_t TFT_eSPI::write ( uint8_t  utf8)

In_eSPI.cpp4106 行目に定義があります。

4107 {
4108  if (utf8 == '\r') return 1;
4109 
4110  uint16_t uniCode = utf8;
4111 
4112  if (_utf8) uniCode = decodeUTF8(utf8);
4113 
4114  if (uniCode == 0) return 1;
4115 
4116 #ifdef SMOOTH_FONT
4117  if(fontLoaded)
4118  {
4119  //Serial.print("UniCode="); Serial.println(uniCode);
4120  //Serial.print("UTF8 ="); Serial.println(utf8);
4121 
4122  //fontFile = SPIFFS.open( _gFontFilename, "r" );
4123 
4124  //if(!fontFile)
4125  //{
4126  // fontLoaded = false;
4127  // return 1;
4128  //}
4129 
4130  drawGlyph(uniCode);
4131 
4132  //fontFile.close();
4133  return 1;
4134  }
4135 #endif
4136 
4137  if (uniCode == '\n') uniCode+=22; // Make it a valid space character to stop errors
4138  else if (uniCode < 32) return 1;
4139 
4140  uint16_t width = 0;
4141  uint16_t height = 0;
4142 
4143 //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv DEBUG vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
4144  //Serial.print((uint8_t) uniCode); // Debug line sends all printed TFT text to serial port
4145  //Serial.println(uniCode, HEX); // Debug line sends all printed TFT text to serial port
4146  //delay(5); // Debug optional wait for serial port to flush through
4147 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DEBUG ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4148 
4149 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
4150 #ifdef LOAD_GFXFF
4151  if(!gfxFont) {
4152 #endif
4153 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
4154 
4155 #ifdef LOAD_FONT2
4156  if (textfont == 2)
4157  {
4158  if (uniCode > 127) return 1;
4159 
4160  width = pgm_read_byte(widtbl_f16 + uniCode-32);
4161  height = chr_hgt_f16;
4162  // Font 2 is rendered in whole byte widths so we must allow for this
4163  width = (width + 6) / 8; // Width in whole bytes for font 2, should be + 7 but must allow for font width change
4164  width = width * 8; // Width converted back to pixels
4165  }
4166  #ifdef LOAD_RLE
4167  else
4168  #endif
4169 #endif
4170 
4171 #ifdef LOAD_RLE
4172  {
4173  if ((textfont>2) && (textfont<9))
4174  {
4175  if (uniCode > 127) return 1;
4176  // Uses the fontinfo struct array to avoid lots of 'if' or 'switch' statements
4177  width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[textfont].widthtbl ) ) + uniCode-32 );
4178  height= pgm_read_byte( &fontdata[textfont].height );
4179  }
4180  }
4181 #endif
4182 
4183 #ifdef LOAD_GLCD
4184  if (textfont==1)
4185  {
4186  width = 6;
4187  height = 8;
4188  }
4189 #else
4190  if (textfont==1) return 1;
4191 #endif
4192 
4193  height = height * textsize;
4194 
4195  if (utf8 == '\n') {
4196  cursor_y += height;
4197  cursor_x = 0;
4198  }
4199  else
4200  {
4201  if (textwrapX && (cursor_x + width * textsize > _width))
4202  {
4203  cursor_y += height;
4204  cursor_x = 0;
4205  }
4206  if (textwrapY && (cursor_y >= (int32_t)_height)) cursor_y = 0;
4207  cursor_x += drawChar(uniCode, cursor_x, cursor_y, textfont);
4208  }
4209 
4210 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
4211 #ifdef LOAD_GFXFF
4212  } // Custom GFX font
4213  else
4214  {
4215  if(utf8 == '\n') {
4216  cursor_x = 0;
4217  cursor_y += (int16_t)textsize *
4218  (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
4219  } else {
4220  if (uniCode > pgm_read_word(&gfxFont->last )) return 1;
4221  if (uniCode < pgm_read_word(&gfxFont->first)) return 1;
4222 
4223  uint16_t c2 = uniCode - pgm_read_word(&gfxFont->first);
4224  GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c2]);
4225  uint8_t w = pgm_read_byte(&glyph->width),
4226  h = pgm_read_byte(&glyph->height);
4227  if((w > 0) && (h > 0)) { // Is there an associated bitmap?
4228  int16_t xo = (int8_t)pgm_read_byte(&glyph->xOffset);
4229  if(textwrapX && ((cursor_x + textsize * (xo + w)) > _width)) {
4230  // Drawing character would go off right edge; wrap to new line
4231  cursor_x = 0;
4232  cursor_y += (int16_t)textsize *
4233  (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
4234  }
4235  if (textwrapY && (cursor_y >= (int32_t)_height)) cursor_y = 0;
4237  }
4238  cursor_x += pgm_read_byte(&glyph->xAdvance) * (int16_t)textsize;
4239  }
4240  }
4241 #endif // LOAD_GFXFF
4242 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
4243 
4244  return 1;
4245 }

◆ writeColor()

void TFT_eSPI::writeColor ( uint16_t  color,
uint32_t  len 
)

In_eSPI.cpp3409 行目に定義があります。

3410 {
3411 #ifdef RPI_WRITE_STROBE
3412  uint8_t colorBin[] = { (uint8_t) (color >> 8), (uint8_t) color };
3413  if(len) spi.writePattern(&colorBin[0], 2, 1); len--;
3414  while(len--) {WR_L; WR_H;}
3415 #else
3416  #if defined (ESP32_PARALLEL)
3417  while (len--) {tft_Write_16(color);}
3418  #else
3419  writeBlock(color, len);
3420  #endif
3421 #endif
3422 }

◆ writecommand()

void TFT_eSPI::writecommand ( uint8_t  c)

In_eSPI.cpp570 行目に定義があります。

571 {
572  spi_begin(); // CS_L;
573 
574  DC_C;
575 
576  tft_Write_8(c);
577 
578  DC_D;
579 
580  spi_end(); // CS_H;
581 
582 }

◆ writedata()

void TFT_eSPI::writedata ( uint8_t  d)

In_eSPI.cpp589 行目に定義があります。

590 {
591  spi_begin(); // CS_L;
592 
593  DC_D; // Play safe, but should already be in data mode
594 
595  tft_Write_8(d);
596 
597  CS_L; // Allow more hold time for low VDI rail
598 
599  spi_end(); // CS_H;
600 }

メンバ詳解

◆ _booted

bool TFT_eSPI::_booted
protected

In_eSPI.h903 行目に定義があります。

◆ _cp437

bool TFT_eSPI::_cp437
protected

In_eSPI.h904 行目に定義があります。

◆ _height

int32_t TFT_eSPI::_height
protected

In_eSPI.h890 行目に定義があります。

◆ _init_height

int32_t TFT_eSPI::_init_height
protected

In_eSPI.h889 行目に定義があります。

◆ _init_width

int32_t TFT_eSPI::_init_width
protected

In_eSPI.h889 行目に定義があります。

◆ _lastColor

uint32_t TFT_eSPI::_lastColor
protected

In_eSPI.h907 行目に定義があります。

◆ _swapBytes

bool TFT_eSPI::_swapBytes
protected

In_eSPI.h900 行目に定義があります。

◆ _utf8

bool TFT_eSPI::_utf8
protected

In_eSPI.h905 行目に定義があります。

◆ _width

int32_t TFT_eSPI::_width
protected

In_eSPI.h890 行目に定義があります。

◆ _xpivot

int16_t TFT_eSPI::_xpivot

In_eSPI.h854 行目に定義があります。

◆ _ypivot

int16_t TFT_eSPI::_ypivot

In_eSPI.h855 行目に定義があります。

◆ addr_col

int32_t TFT_eSPI::addr_col
protected

In_eSPI.h891 行目に定義があります。

◆ addr_row

int32_t TFT_eSPI::addr_row
protected

In_eSPI.h891 行目に定義があります。

◆ bitmap_bg

uint32_t TFT_eSPI::bitmap_bg

In_eSPI.h847 行目に定義があります。

◆ bitmap_fg

uint32_t TFT_eSPI::bitmap_fg

In_eSPI.h847 行目に定義があります。

◆ cursor_x

int32_t TFT_eSPI::cursor_x

In_eSPI.h844 行目に定義があります。

◆ cursor_y

int32_t TFT_eSPI::cursor_y

In_eSPI.h844 行目に定義があります。

◆ decoderBuffer

uint16_t TFT_eSPI::decoderBuffer

In_eSPI.h858 行目に定義があります。

◆ decoderState

uint8_t TFT_eSPI::decoderState = 0

In_eSPI.h857 行目に定義があります。

◆ fontFile

fs::File TFT_eSPI::fontFile

In_eSPI.h962 行目に定義があります。

◆ fontLoaded

bool TFT_eSPI::fontLoaded = false

In_eSPI.h961 行目に定義があります。

◆ fontsloaded

uint32_t TFT_eSPI::fontsloaded
protected

In_eSPI.h893 行目に定義があります。

◆ gBitmap

uint32_t* TFT_eSPI::gBitmap = NULL

In_eSPI.h959 行目に定義があります。

◆ gdX

int8_t* TFT_eSPI::gdX = NULL

In_eSPI.h958 行目に定義があります。

◆ gdY

int16_t* TFT_eSPI::gdY = NULL

In_eSPI.h957 行目に定義があります。

◆ gFont

fontMetrics TFT_eSPI::gFont = { 0, 0, 0, 0, 0, 0, 0 }

In_eSPI.h950 行目に定義があります。

◆ gfxFont

GFXfont* TFT_eSPI::gfxFont
protected

In_eSPI.h910 行目に定義があります。

◆ gHeight

uint8_t* TFT_eSPI::gHeight = NULL

In_eSPI.h954 行目に定義があります。

◆ glyph_ab

uint8_t TFT_eSPI::glyph_ab
protected

In_eSPI.h895 行目に定義があります。

◆ glyph_bb

uint8_t TFT_eSPI::glyph_bb
protected

In_eSPI.h896 行目に定義があります。

◆ gUnicode

uint16_t* TFT_eSPI::gUnicode = NULL

In_eSPI.h953 行目に定義があります。

◆ gWidth

uint8_t* TFT_eSPI::gWidth = NULL

In_eSPI.h955 行目に定義があります。

◆ gxAdvance

uint8_t* TFT_eSPI::gxAdvance = NULL

In_eSPI.h956 行目に定義があります。

◆ inTransaction

bool TFT_eSPI::inTransaction
protected

In_eSPI.h901 行目に定義があります。

◆ isDigits

bool TFT_eSPI::isDigits
protected

In_eSPI.h898 行目に定義があります。

◆ locked

bool TFT_eSPI::locked
protected

In_eSPI.h901 行目に定義があります。

◆ padX

int32_t TFT_eSPI::padX

In_eSPI.h844 行目に定義があります。

◆ rotation

uint8_t TFT_eSPI::rotation

In_eSPI.h852 行目に定義があります。

◆ textbgcolor

uint32_t TFT_eSPI::textbgcolor

In_eSPI.h845 行目に定義があります。

◆ textcolor

uint32_t TFT_eSPI::textcolor

In_eSPI.h845 行目に定義があります。

◆ textdatum

uint8_t TFT_eSPI::textdatum

In_eSPI.h851 行目に定義があります。

◆ textfont

uint8_t TFT_eSPI::textfont

In_eSPI.h849 行目に定義があります。

◆ textsize

uint8_t TFT_eSPI::textsize

In_eSPI.h850 行目に定義があります。

◆ textwrapX

bool TFT_eSPI::textwrapX
protected

In_eSPI.h899 行目に定義があります。

◆ textwrapY

bool TFT_eSPI::textwrapY
protected

In_eSPI.h899 行目に定義があります。

◆ win_xe

int32_t TFT_eSPI::win_xe
protected

In_eSPI.h887 行目に定義があります。

◆ win_ye

int32_t TFT_eSPI::win_ye
protected

In_eSPI.h887 行目に定義があります。


このクラス詳解は次のファイルから抽出されました:
TFT_eSPI::textcolor
uint32_t textcolor
Definition: In_eSPI.h:845
CS_L
#define CS_L
Definition: In_eSPI.h:222
TFT_eSPI::drawFastHLine
virtual void drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color)
Definition: In_eSPI.cpp:3810
TFT_INVON
#define TFT_INVON
Definition: ST7735_Defines.h:140
TFT_eSPI::pushImage
void pushImage(int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
Definition: In_eSPI.cpp:1032
setup_t::r3_x_offset
uint8_t r3_x_offset
Definition: In_eSPI.h:574
setup_t::tch_spi_freq
int16_t tch_spi_freq
Definition: In_eSPI.h:600
TFT_eSPI::isDigits
bool isDigits
Definition: In_eSPI.h:898
TFT_eSPI::drawFloat
int16_t drawFloat(float floatNumber, uint8_t decimal, int32_t poX, int32_t poY, uint8_t font)
Definition: In_eSPI.cpp:4869
TFT_eSPI::cursor_y
int32_t cursor_y
Definition: In_eSPI.h:844
setup_t::tft_spi_freq
int16_t tft_spi_freq
Definition: In_eSPI.h:598
chrtbl_f16
const PROGMEM unsigned char *const chrtbl_f16[96]
Definition: Font16.c:620
SPI_TOUCH_FREQUENCY
#define SPI_TOUCH_FREQUENCY
Definition: In_eSPI_Setup.h:273
TFT_eSPI::readcommand8
uint8_t readcommand8(uint8_t cmd_function, uint8_t index=0)
Definition: In_eSPI.cpp:607
TFT_eSPI::fontMetrics::spaceWidth
uint16_t spaceWidth
Definition: In_eSPI.h:943
TFT_eSPI::drawChar
virtual void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size)
Definition: In_eSPI.cpp:2476
TFT_eSPI::fontMetrics::gCount
uint16_t gCount
Definition: In_eSPI.h:941
setup_t::esp
int16_t esp
Definition: In_eSPI.h:551
TFT_eSPI::decoderState
uint8_t decoderState
Definition: In_eSPI.h:857
setup_t::pin_tft_d6
int8_t pin_tft_d6
Definition: In_eSPI.h:593
setup_t::pin_tft_mosi
int8_t pin_tft_mosi
Definition: In_eSPI.h:577
TFT_eSPI::gWidth
uint8_t * gWidth
Definition: In_eSPI.h:955
TFT_WHITE
#define TFT_WHITE
Definition: In_eSPI.h:527
TFT_eSPI::drawString
int16_t drawString(const char *string, int32_t poX, int32_t poY, uint8_t font)
Definition: In_eSPI.cpp:4554
TFT_eSPI::width
virtual int16_t width(void)
Definition: In_eSPI.cpp:2313
TFT_eSPI::glyph_ab
uint8_t glyph_ab
Definition: In_eSPI.h:895
setup_t::r1_x_offset
uint8_t r1_x_offset
Definition: In_eSPI.h:570
SPI_FREQUENCY
#define SPI_FREQUENCY
Definition: In_eSPI_Setup.h:265
TFT_eSPI::alphaBlend
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
Definition: In_eSPI.cpp:5789
ST7735_Init.h
setup_t::pin_tft_d3
int8_t pin_tft_d3
Definition: In_eSPI.h:590
setup_t::tft_width
uint16_t tft_width
Definition: In_eSPI.h:565
TFT_eSPI::fillScreen
void fillScreen(uint32_t color)
Definition: In_eSPI.cpp:1892
TFT_eSPI::decodeUTF8
uint16_t decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
Definition: In_eSPI.cpp:4074
setup_t::pin_tft_d0
int8_t pin_tft_d0
Definition: In_eSPI.h:587
TFT_eSPI::init
void init(uint8_t tc=TAB_COLOUR)
Definition: In_eSPI.cpp:286
setup_t::pin_tft_d5
int8_t pin_tft_d5
Definition: In_eSPI.h:592
TFT_PASET
#define TFT_PASET
Definition: ST7735_Defines.h:124
setup_t::pin_tch_cs
int8_t pin_tch_cs
Definition: In_eSPI.h:596
TFT_eSPI::color565
uint16_t color565(uint8_t red, uint8_t green, uint8_t blue)
Definition: In_eSPI.cpp:3924
TFT_eSPI::height
virtual int16_t height(void)
Definition: In_eSPI.cpp:2323
tft_Write_16S
#define tft_Write_16S(C)
Definition: In_eSPI.h:375
TL_DATUM
#define TL_DATUM
Definition: In_eSPI.h:494
TFT_DC
#define TFT_DC
Definition: In_eSPI_Setup.h:190
BR_DATUM
#define BR_DATUM
Definition: In_eSPI.h:505
TFT_eSPI::locked
bool locked
Definition: In_eSPI.h:901
BL_DATUM
#define BL_DATUM
Definition: In_eSPI.h:503
TFT_eSPI::gBitmap
uint32_t * gBitmap
Definition: In_eSPI.h:959
TFT_eSPI::fontMetrics::maxAscent
uint16_t maxAscent
Definition: In_eSPI.h:946
TFT_eSPI::startWrite
void startWrite(void)
Definition: In_eSPI.cpp:3389
spi
SPIClass & spi
Definition: In_eSPI.cpp:28
TFT_eSPI::textWidth
int16_t textWidth(const char *string, uint8_t font)
Definition: In_eSPI.cpp:2354
TFT_eSPI::setCursor
void setCursor(int16_t x, int16_t y)
Definition: In_eSPI.cpp:2143
tft_Write_32
#define tft_Write_32(C)
Definition: In_eSPI.h:382
setup_t::pin_tft_d4
int8_t pin_tft_d4
Definition: In_eSPI.h:591
TFT_DRIVER
#define TFT_DRIVER
Definition: In_eSPI_Setup.h:33
TFT_eSPI::fontMetrics::yAdvance
uint16_t yAdvance
Definition: In_eSPI.h:942
TFT_INIT_DELAY
#define TFT_INIT_DELAY
Definition: ST7735_Defines.h:116
TFT_eSPI::_height
int32_t _height
Definition: In_eSPI.h:890
SPI_READ_FREQUENCY
#define SPI_READ_FREQUENCY
Definition: In_eSPI_Setup.h:270
TFT_eSPI::loadFont
void loadFont(String fontName, fs::FS &ffs)
Definition: In_eSPI.cpp:5425
setup_t::pin_tft_clk
int8_t pin_tft_clk
Definition: In_eSPI.h:579
BC_DATUM
#define BC_DATUM
Definition: In_eSPI.h:504
TFT_eSPI::fillCircleHelper
void fillCircleHelper(int32_t x0, int32_t y0, int32_t r, uint8_t cornername, int32_t delta, uint32_t color)
Definition: In_eSPI.cpp:1752
ST7735_Rotation.h
busDir
void busDir(uint32_t mask, uint8_t mode)
TFT_eSPI::writedata
void writedata(uint8_t d)
Definition: In_eSPI.cpp:589
setup_t::pin_tft_cs
int8_t pin_tft_cs
Definition: In_eSPI.h:580
TFT_eSPI::fontLoaded
bool fontLoaded
Definition: In_eSPI.h:961
TFT_eSPI::_ypivot
int16_t _ypivot
Definition: In_eSPI.h:855
TC_DATUM
#define TC_DATUM
Definition: In_eSPI.h:495
TFT_eSPI::bitmap_bg
uint32_t bitmap_bg
Definition: In_eSPI.h:847
ML_DATUM
#define ML_DATUM
Definition: In_eSPI.h:497
setup_t::pin_tft_rd
int8_t pin_tft_rd
Definition: In_eSPI.h:583
TFT_eSPI::gxAdvance
uint8_t * gxAdvance
Definition: In_eSPI.h:956
TFT_eSPI::_utf8
bool _utf8
Definition: In_eSPI.h:905
setup_t::tft_height
uint16_t tft_height
Definition: In_eSPI.h:566
L_BASELINE
#define L_BASELINE
Definition: In_eSPI.h:506
TFT_eSPI::fillRect
virtual void fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
Definition: In_eSPI.cpp:3876
writeBlock
void writeBlock(uint16_t color, uint32_t repeat)
Definition: In_eSPI.cpp:5206
TFT_eSPI::textsize
uint8_t textsize
Definition: In_eSPI.h:850
TFT_eSPI::_init_height
int32_t _init_height
Definition: In_eSPI.h:889
TFT_eSPI::fontFile
fs::File fontFile
Definition: In_eSPI.h:962
MC_DATUM
#define MC_DATUM
Definition: In_eSPI.h:499
setup_t::tft_rd_freq
int16_t tft_rd_freq
Definition: In_eSPI.h:599
TFT_eSPI::inTransaction
bool inTransaction
Definition: In_eSPI.h:901
TFT_eSPI::textbgcolor
uint32_t textbgcolor
Definition: In_eSPI.h:845
TFT_eSPI::drawLine
virtual void drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
Definition: In_eSPI.cpp:3618
TFT_eSPI::drawCentreString
int16_t drawCentreString(const char *string, int32_t dX, int32_t poY, uint8_t font)
Definition: In_eSPI.cpp:4803
setup_t::r3_y_offset
uint8_t r3_y_offset
Definition: In_eSPI.h:575
TFT_eSPI::_lastColor
uint32_t _lastColor
Definition: In_eSPI.h:907
TFT_eSPI::pushColor
void pushColor(uint16_t color)
Definition: In_eSPI.cpp:3352
tft_Write_16
#define tft_Write_16(C)
Definition: In_eSPI.h:368
widtbl_f16
const PROGMEM unsigned char widtbl_f16[96]
Definition: Font16.c:15
TFT_eSPI::gFont
fontMetrics gFont
Definition: In_eSPI.h:950
TFT_eSPI::gHeight
uint8_t * gHeight
Definition: In_eSPI.h:954
TFT_MISO
#define TFT_MISO
Definition: In_eSPI.h:405
TFT_eSPI::drawCircleHelper
void drawCircleHelper(int32_t x0, int32_t y0, int32_t r, uint8_t cornername, uint32_t color)
Definition: In_eSPI.cpp:1669
setup_t::pin_tft_wr
int8_t pin_tft_wr
Definition: In_eSPI.h:584
DC_C
#define DC_C
Definition: In_eSPI.h:168
TR_DATUM
#define TR_DATUM
Definition: In_eSPI.h:496
TFT_eSPI::_width
int32_t _width
Definition: In_eSPI.h:890
CS_H
#define CS_H
Definition: In_eSPI.h:223
TFT_eSPI::textdatum
uint8_t textdatum
Definition: In_eSPI.h:851
TFT_eSPI::fontsloaded
uint32_t fontsloaded
Definition: In_eSPI.h:893
readByte
uint8_t readByte(void)
Definition: In_eSPI.cpp:788
TFT_eSPI::addr_row
int32_t addr_row
Definition: In_eSPI.h:891
TFT_eSPI::endWrite
void endWrite(void)
Definition: In_eSPI.cpp:3399
chr_hgt_f16
#define chr_hgt_f16
Definition: Font16.h:4
DC_D
#define DC_D
Definition: In_eSPI.h:169
TFT_eSPI::drawGlyph
virtual void drawGlyph(uint16_t code)
Definition: In_eSPI.cpp:5850
TFT_eSPI::textfont
uint8_t textfont
Definition: In_eSPI.h:849
setup_t::r0_x_offset
uint8_t r0_x_offset
Definition: In_eSPI.h:568
TFT_eSPI::writecommand
void writecommand(uint8_t c)
Definition: In_eSPI.cpp:570
setup_t::tft_driver
uint16_t tft_driver
Definition: In_eSPI.h:564
TFT_SWRST
#define TFT_SWRST
Definition: ST7735_Defines.h:121
tft_Read_8
#define tft_Read_8()
Definition: In_eSPI.h:400
TFT_INVOFF
#define TFT_INVOFF
Definition: ST7735_Defines.h:139
TFT_eSPI::gdX
int8_t * gdX
Definition: In_eSPI.h:958
tft_Write_8
#define tft_Write_8(C)
Definition: In_eSPI.h:361
setup_t::pin_tft_d2
int8_t pin_tft_d2
Definition: In_eSPI.h:589
TFT_SPI_MODE
#define TFT_SPI_MODE
Definition: In_eSPI.h:43
TFT_eSPI::fontMetrics::ascent
int16_t ascent
Definition: In_eSPI.h:944
TFT_CS
#define TFT_CS
Definition: In_eSPI_Setup.h:189
setup_t::pin_tft_miso
int8_t pin_tft_miso
Definition: In_eSPI.h:578
TFT_eSPI::glyph_bb
uint8_t glyph_bb
Definition: In_eSPI.h:896
TFT_eSPI::cursor_x
int32_t cursor_x
Definition: In_eSPI.h:844
TFT_eSPI::_booted
bool _booted
Definition: In_eSPI.h:903
setup_t::pin_tft_dc
int8_t pin_tft_dc
Definition: In_eSPI.h:582
R_BASELINE
#define R_BASELINE
Definition: In_eSPI.h:508
TFT_eSPI::drawRect
void drawRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
Definition: In_eSPI.cpp:1903
TFT_GREEN
#define TFT_GREEN
Definition: In_eSPI.h:522
TFT_eSPI::gfxFont
GFXfont * gfxFont
Definition: In_eSPI.h:910
TFT_eSPI::addr_col
int32_t addr_col
Definition: In_eSPI.h:891
TFT_MOSI
#define TFT_MOSI
Definition: In_eSPI_Setup.h:187
setup_t::pin_tft_d1
int8_t pin_tft_d1
Definition: In_eSPI.h:588
TFT_eSPI::setTextFont
void setTextFont(uint8_t font)
Definition: In_eSPI.cpp:4972
TFT_eSPI::fontMetrics::maxDescent
uint16_t maxDescent
Definition: In_eSPI.h:947
TFT_eSPI::_swapBytes
bool _swapBytes
Definition: In_eSPI.h:900
TFT_eSPI::textwrapY
bool textwrapY
Definition: In_eSPI.h:899
TFT_eSPI::pushColors
void pushColors(uint16_t *data, uint32_t len, bool swap=true)
Definition: In_eSPI.cpp:3461
C_BASELINE
#define C_BASELINE
Definition: In_eSPI.h:507
TFT_eSPI::fontHeight
int16_t fontHeight(void)
Definition: In_eSPI.cpp:2467
setup_t::r1_y_offset
uint8_t r1_y_offset
Definition: In_eSPI.h:571
setup_t::pin_tft_rst
int8_t pin_tft_rst
Definition: In_eSPI.h:585
TFT_eSPI::textwrapX
bool textwrapX
Definition: In_eSPI.h:899
TFT_CASET
#define TFT_CASET
Definition: ST7735_Defines.h:123
TFT_eSPI::getUnicodeIndex
bool getUnicodeIndex(uint16_t unicode, uint16_t *index)
Definition: In_eSPI.cpp:5831
fontdata
const PROGMEM fontinfo fontdata[]
Definition: In_eSPI.h:619
TFT_SCLK
#define TFT_SCLK
Definition: In_eSPI_Setup.h:188
TFT_RST
#define TFT_RST
Definition: In_eSPI_Setup.h:191
TFT_eSPI::fontMetrics::descent
int16_t descent
Definition: In_eSPI.h:945
setup_t::pin_tft_d7
int8_t pin_tft_d7
Definition: In_eSPI.h:594
TFT_eSPI::setRotation
void setRotation(uint8_t r)
Definition: In_eSPI.cpp:466
BitBucket::data
uint8_t * data
Definition: qrcode.c:171
setup_t::overlap
uint8_t overlap
Definition: In_eSPI.h:554
TFT_eSPI::_init_width
int32_t _init_width
Definition: In_eSPI.h:889
TFT_eSPI::drawRightString
int16_t drawRightString(const char *string, int32_t dX, int32_t poY, uint8_t font)
Definition: In_eSPI.cpp:4826
TFT_eSPI::rotation
uint8_t rotation
Definition: In_eSPI.h:852
TFT_eSPI::gdY
int16_t * gdY
Definition: In_eSPI.h:957
setup_t::serial
uint8_t serial
Definition: In_eSPI.h:553
TFT_eSPI::decoderBuffer
uint16_t decoderBuffer
Definition: In_eSPI.h:858
TFT_eSPI::_cp437
bool _cp437
Definition: In_eSPI.h:904
TFT_eSPI::drawFastVLine
virtual void drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color)
Definition: In_eSPI.cpp:3746
TFT_eSPI::_xpivot
int16_t _xpivot
Definition: In_eSPI.h:854
TFT_eSPI::bitmap_fg
uint32_t bitmap_fg
Definition: In_eSPI.h:847
setup_t::r2_x_offset
uint8_t r2_x_offset
Definition: In_eSPI.h:572
setup_t::r0_y_offset
uint8_t r0_y_offset
Definition: In_eSPI.h:569
TFT_eSPI::gUnicode
uint16_t * gUnicode
Definition: In_eSPI.h:953
setup_t::r2_y_offset
uint8_t r2_y_offset
Definition: In_eSPI.h:573
TFT_eSPI::drawPixel
virtual void drawPixel(int32_t x, int32_t y, uint32_t color)
Definition: In_eSPI.cpp:3283
SPI_32
#define SPI_32(H, L)
Definition: In_eSPI.h:275
TFT_eSPI::padX
int32_t padX
Definition: In_eSPI.h:844
TFT_eSPI::unloadFont
void unloadFont(void)
Definition: In_eSPI.cpp:5643
MR_DATUM
#define MR_DATUM
Definition: In_eSPI.h:501
TFT_eSPI::setWindow
void setWindow(int32_t xs, int32_t ys, int32_t xe, int32_t ye)
Definition: In_eSPI.cpp:2935
setup_t::trans
uint8_t trans
Definition: In_eSPI.h:552
TFT_RAMWR
#define TFT_RAMWR
Definition: ST7735_Defines.h:125