mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-07-30 18:57:30 +02:00
Add 8 bit parallel TFT support for ESP32
Add interface driver macro Add 8 bit parallel support Add 8 bit parallel read support Add ILI9481, ILI9488 and HX8357D drivers Update version and ReadMe Update Create_Font processing sketch Add slightly narrower alternative font 8
This commit is contained in:
@ -338,6 +338,8 @@ uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
|||||||
uint16_t b = (((fgB * alpha) + (bgB * (255 - alpha))) >> 9);
|
uint16_t b = (((fgB * alpha) + (bgB * (255 - alpha))) >> 9);
|
||||||
|
|
||||||
// Combine RGB565 colours into 16 bits
|
// Combine RGB565 colours into 16 bits
|
||||||
|
//return ((r&0x18) << 11) | ((g&0x30) << 5) | ((b&0x18) << 0); // 2 bit greyscale
|
||||||
|
//return ((r&0x1E) << 11) | ((g&0x3C) << 5) | ((b&0x1E) << 0); // 4 bit greyscale
|
||||||
return (r << 11) | (g << 5) | (b << 0);
|
return (r << 11) | (g << 5) | (b << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +421,10 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
|||||||
uint8_t pbuffer[gWidth[gNum]];
|
uint8_t pbuffer[gWidth[gNum]];
|
||||||
|
|
||||||
uint16_t xs = 0;
|
uint16_t xs = 0;
|
||||||
uint16_t dl = 0;
|
uint32_t dl = 0;
|
||||||
|
|
||||||
|
int16_t cy = cursor_y + gFont.maxAscent - gdY[gNum];
|
||||||
|
int16_t cx = cursor_x + gdX[gNum];
|
||||||
|
|
||||||
for (int y = 0; y < gHeight[gNum]; y++)
|
for (int y = 0; y < gHeight[gNum]; y++)
|
||||||
{
|
{
|
||||||
@ -431,24 +436,27 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
|||||||
{
|
{
|
||||||
if (pixel != 0xFF)
|
if (pixel != 0xFF)
|
||||||
{
|
{
|
||||||
if (dl) { drawFastHLine( xs, y + cursor_y + gFont.maxAscent - gdY[gNum], dl, fg); dl = 0; }
|
if (dl) {
|
||||||
drawPixel(x + cursor_x + gdX[gNum], y + cursor_y + gFont.maxAscent - gdY[gNum], alphaBlend(pixel, fg, bg));
|
if (dl==1) drawPixel(xs, y + cy, fg);
|
||||||
|
else drawFastHLine( xs, y + cy, dl, fg);
|
||||||
|
dl = 0;
|
||||||
|
}
|
||||||
|
drawPixel(x + cx, y + cy, alphaBlend(pixel, fg, bg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dl==0) xs = x + cursor_x + gdX[gNum];
|
if (dl==0) xs = x + cx;
|
||||||
dl++;
|
dl++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dl) { drawFastHLine( xs, y + cursor_y + gFont.maxAscent - gdY[gNum], dl, fg); dl = 0; }
|
if (dl) { drawFastHLine( xs, y + cy, dl, fg); dl = 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dl) { drawFastHLine( xs, y + cursor_y + gFont.maxAscent - gdY[gNum], dl, fg); dl = 0; }
|
if (dl) { drawFastHLine( xs, y + cy, dl, fg); dl = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cursor_x += gxAdvance[gNum];
|
cursor_x += gxAdvance[gNum];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
247
Fonts/Font72x53rle.c
Normal file
247
Fonts/Font72x53rle.c
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
// Font 8
|
||||||
|
//
|
||||||
|
// This font has been 8 bit Run Length Encoded to save FLASH space
|
||||||
|
//
|
||||||
|
// It is a Arial 75 pixel height font intended to display large numbers
|
||||||
|
// Width for numerals reduced from 55 to 53 (to fit in 160 pixel screens)
|
||||||
|
// This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 0 : - .
|
||||||
|
// All other characters print as a space
|
||||||
|
|
||||||
|
#include <pgmspace.h>
|
||||||
|
|
||||||
|
|
||||||
|
PROGMEM const unsigned char widtbl_f72[96] = // character width table
|
||||||
|
{
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 32 - 39
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 40 - 47
|
||||||
|
53, 53, 53, 53, 53, 53, 53, 53, // char 48 - 55
|
||||||
|
53, 53, 29, 29, 29, 29, 29, 29, // char 56 - 63
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 64 - 71
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 72 - 79
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 80 - 87
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 88 - 95
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 96 - 103
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 104 - 111
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, // char 112 - 119
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29 // char 120 - 127
|
||||||
|
};
|
||||||
|
|
||||||
|
// Row format, MSB left
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_20[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
||||||
|
0x7E
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_2D[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
||||||
|
0x36, 0x91, 0x0A, 0x91, 0x0A, 0x91, 0x0A, 0x91,
|
||||||
|
0x0A, 0x91, 0x0A, 0x91, 0x0A, 0x91, 0x7F, 0x7F,
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x07
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_2E[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x48, 0x88,
|
||||||
|
0x13, 0x88, 0x13, 0x88, 0x13, 0x88, 0x13, 0x88,
|
||||||
|
0x13, 0x88, 0x13, 0x88, 0x13, 0x88, 0x13, 0x88,
|
||||||
|
0x44
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_30[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x68, 0x8A, 0x26, 0x90, 0x21, 0x94, 0x1D, 0x98, 0x1A, 0x9A, 0x18, 0x9C, 0x16, 0x9E, 0x14,
|
||||||
|
0xA0, 0x13, 0x8C, 0x06, 0x8C, 0x12, 0x8B, 0x0A, 0x8B, 0x10, 0x8A, 0x0E, 0x89, 0x10, 0x89, 0x10,
|
||||||
|
0x89, 0x0F, 0x88, 0x12, 0x88, 0x0E, 0x89, 0x12, 0x89, 0x0D, 0x88, 0x14, 0x88, 0x0C, 0x89, 0x14,
|
||||||
|
0x88, 0x0C, 0x88, 0x16, 0x88, 0x0B, 0x88, 0x16, 0x88, 0x0B, 0x88, 0x16, 0x88, 0x0A, 0x88, 0x18,
|
||||||
|
0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18,
|
||||||
|
0x88, 0x09, 0x88, 0x18, 0x88, 0x08, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A,
|
||||||
|
0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A,
|
||||||
|
0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A,
|
||||||
|
0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A,
|
||||||
|
0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A,
|
||||||
|
0x88, 0x07, 0x88, 0x1A, 0x88, 0x08, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18,
|
||||||
|
0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x0A, 0x88, 0x16,
|
||||||
|
0x88, 0x0B, 0x88, 0x16, 0x88, 0x0B, 0x88, 0x16, 0x88, 0x0B, 0x89, 0x14, 0x89, 0x0C, 0x88, 0x14,
|
||||||
|
0x88, 0x0D, 0x89, 0x12, 0x89, 0x0E, 0x88, 0x12, 0x88, 0x0F, 0x89, 0x10, 0x89, 0x0F, 0x8A, 0x0E,
|
||||||
|
0x8A, 0x10, 0x8B, 0x0A, 0x8B, 0x12, 0x8C, 0x06, 0x8C, 0x13, 0xA0, 0x14, 0x9E, 0x16, 0x9C, 0x18,
|
||||||
|
0x9A, 0x1A, 0x98, 0x1D, 0x94, 0x21, 0x90, 0x26, 0x8A, 0x49
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_31[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x70, 0x85, 0x2D, 0x86, 0x2D, 0x86, 0x2C, 0x87, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x89, 0x29,
|
||||||
|
0x8A, 0x28, 0x8B, 0x27, 0x8C, 0x25, 0x8E, 0x24, 0x8F, 0x23, 0x90, 0x22, 0x91, 0x20, 0x93, 0x1E,
|
||||||
|
0x95, 0x1C, 0x8D, 0x00, 0x88, 0x1B, 0x8C, 0x02, 0x88, 0x1B, 0x8B, 0x03, 0x88, 0x1B, 0x8A, 0x04,
|
||||||
|
0x88, 0x1B, 0x88, 0x06, 0x88, 0x1B, 0x87, 0x07, 0x88, 0x1B, 0x85, 0x09, 0x88, 0x1B, 0x83, 0x0B,
|
||||||
|
0x88, 0x1B, 0x81, 0x0D, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x7B
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_32[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x67, 0x8A, 0x25, 0x92, 0x1F, 0x96, 0x1B, 0x9A, 0x18, 0x9C, 0x16, 0x9E, 0x14, 0xA0, 0x12,
|
||||||
|
0xA2, 0x10, 0x8E, 0x07, 0x8D, 0x0F, 0x8B, 0x0C, 0x8C, 0x0D, 0x8A, 0x10, 0x8A, 0x0D, 0x89, 0x12,
|
||||||
|
0x8A, 0x0B, 0x89, 0x14, 0x89, 0x0B, 0x89, 0x14, 0x89, 0x0B, 0x88, 0x16, 0x89, 0x0A, 0x88, 0x16,
|
||||||
|
0x89, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x09, 0x88, 0x18, 0x88, 0x0D, 0x84, 0x18,
|
||||||
|
0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x89, 0x2A, 0x88, 0x2A, 0x89, 0x2A, 0x89, 0x29,
|
||||||
|
0x89, 0x2A, 0x89, 0x29, 0x89, 0x29, 0x8A, 0x28, 0x8A, 0x28, 0x8B, 0x27, 0x8B, 0x27, 0x8B, 0x27,
|
||||||
|
0x8B, 0x27, 0x8B, 0x27, 0x8C, 0x26, 0x8C, 0x26, 0x8C, 0x26, 0x8C, 0x26, 0x8C, 0x25, 0x8C, 0x26,
|
||||||
|
0x8C, 0x26, 0x8C, 0x26, 0x8C, 0x26, 0x8C, 0x25, 0x8D, 0x25, 0x8D, 0x25, 0x8C, 0x26, 0x8C, 0x26,
|
||||||
|
0x8C, 0x27, 0x8B, 0x27, 0x8B, 0x27, 0x8A, 0x28, 0x8A, 0x29, 0x89, 0x29, 0x8A, 0x29, 0x89, 0x29,
|
||||||
|
0x89, 0x2A, 0xAA, 0x08, 0xAB, 0x08, 0xAB, 0x08, 0xAB, 0x07, 0xAC, 0x07, 0xAC, 0x07, 0xAC, 0x07,
|
||||||
|
0xAC, 0x07, 0xAC, 0x6E
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_33[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x67, 0x89, 0x27, 0x90, 0x21, 0x94, 0x1D, 0x97, 0x1B, 0x9A, 0x18, 0x9C, 0x16, 0x9E, 0x14,
|
||||||
|
0xA0, 0x13, 0x8C, 0x06, 0x8C, 0x12, 0x8B, 0x0A, 0x8B, 0x10, 0x8A, 0x0E, 0x89, 0x10, 0x89, 0x10,
|
||||||
|
0x89, 0x0F, 0x88, 0x12, 0x88, 0x0E, 0x89, 0x12, 0x89, 0x0D, 0x88, 0x14, 0x88, 0x0D, 0x88, 0x14,
|
||||||
|
0x88, 0x0C, 0x89, 0x14, 0x88, 0x0C, 0x88, 0x15, 0x88, 0x10, 0x84, 0x15, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2A, 0x89, 0x29, 0x89, 0x29, 0x89, 0x28, 0x8B, 0x26, 0x8C, 0x21,
|
||||||
|
0x91, 0x22, 0x8F, 0x24, 0x8D, 0x26, 0x8F, 0x23, 0x92, 0x21, 0x94, 0x1F, 0x95, 0x1E, 0x81, 0x07,
|
||||||
|
0x8C, 0x29, 0x8B, 0x2A, 0x8A, 0x2A, 0x89, 0x2B, 0x89, 0x2B, 0x89, 0x2A, 0x89, 0x2B, 0x88, 0x2B,
|
||||||
|
0x89, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x0B, 0x84, 0x1A,
|
||||||
|
0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x89, 0x18, 0x89, 0x07, 0x89, 0x18, 0x88, 0x09, 0x88, 0x18,
|
||||||
|
0x88, 0x09, 0x89, 0x16, 0x89, 0x09, 0x89, 0x15, 0x89, 0x0B, 0x89, 0x14, 0x89, 0x0B, 0x8A, 0x12,
|
||||||
|
0x89, 0x0D, 0x8A, 0x10, 0x8A, 0x0D, 0x8B, 0x0D, 0x8B, 0x0F, 0x8D, 0x07, 0x8D, 0x11, 0xA2, 0x12,
|
||||||
|
0xA0, 0x14, 0x9D, 0x17, 0x9B, 0x19, 0x99, 0x1C, 0x95, 0x20, 0x91, 0x26, 0x89, 0x4A
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_34[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x2A, 0x86, 0x2C, 0x87, 0x2B, 0x88, 0x2A, 0x89, 0x2A, 0x89, 0x29, 0x8A, 0x28, 0x8B,
|
||||||
|
0x27, 0x8C, 0x26, 0x8D, 0x26, 0x8D, 0x25, 0x8E, 0x24, 0x8F, 0x23, 0x90, 0x23, 0x90, 0x22, 0x91,
|
||||||
|
0x21, 0x92, 0x20, 0x93, 0x20, 0x93, 0x1F, 0x8A, 0x00, 0x88, 0x1E, 0x8A, 0x01, 0x88, 0x1D, 0x8A,
|
||||||
|
0x02, 0x88, 0x1C, 0x8B, 0x02, 0x88, 0x1C, 0x8A, 0x03, 0x88, 0x1B, 0x8A, 0x04, 0x88, 0x1A, 0x8A,
|
||||||
|
0x05, 0x88, 0x19, 0x8A, 0x06, 0x88, 0x19, 0x8A, 0x06, 0x88, 0x18, 0x8A, 0x07, 0x88, 0x17, 0x8A,
|
||||||
|
0x08, 0x88, 0x16, 0x8A, 0x09, 0x88, 0x16, 0x8A, 0x09, 0x88, 0x15, 0x8A, 0x0A, 0x88, 0x14, 0x8A,
|
||||||
|
0x0B, 0x88, 0x13, 0x8A, 0x0C, 0x88, 0x13, 0x8A, 0x0C, 0x88, 0x12, 0x8A, 0x0D, 0x88, 0x11, 0x8A,
|
||||||
|
0x0E, 0x88, 0x10, 0x8A, 0x0F, 0x88, 0x0F, 0x8B, 0x0F, 0x88, 0x0F, 0x8A, 0x10, 0x88, 0x0E, 0x8A,
|
||||||
|
0x11, 0x88, 0x0D, 0x8A, 0x12, 0x88, 0x0C, 0x8A, 0x13, 0x88, 0x0C, 0xAF, 0x04, 0xAF, 0x04, 0xAF,
|
||||||
|
0x04, 0xAF, 0x04, 0xAF, 0x04, 0xAF, 0x04, 0xAF, 0x04, 0xAF, 0x04, 0xAF, 0x23, 0x88, 0x2B, 0x88,
|
||||||
|
0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88,
|
||||||
|
0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x75
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_35[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x14, 0xA0, 0x13, 0xA0, 0x12, 0xA1, 0x12, 0xA1, 0x12, 0xA1, 0x12, 0xA1, 0x12, 0xA1,
|
||||||
|
0x11, 0xA2, 0x11, 0xA2, 0x11, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x89, 0x2A, 0x88, 0x2B, 0x88,
|
||||||
|
0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x89, 0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x89,
|
||||||
|
0x06, 0x88, 0x1A, 0x89, 0x03, 0x8E, 0x17, 0x88, 0x02, 0x92, 0x15, 0x88, 0x00, 0x96, 0x13, 0xA1,
|
||||||
|
0x11, 0xA3, 0x10, 0xA4, 0x0F, 0xA5, 0x0E, 0x8F, 0x07, 0x8E, 0x0D, 0x8C, 0x0D, 0x8C, 0x0B, 0x8B,
|
||||||
|
0x11, 0x8A, 0x0B, 0x8A, 0x13, 0x8A, 0x0A, 0x89, 0x15, 0x89, 0x0E, 0x84, 0x17, 0x89, 0x2A, 0x89,
|
||||||
|
0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x89, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88,
|
||||||
|
0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x0B, 0x84, 0x1A, 0x88, 0x07, 0x88, 0x19, 0x88,
|
||||||
|
0x08, 0x89, 0x18, 0x88, 0x08, 0x89, 0x18, 0x88, 0x09, 0x88, 0x17, 0x89, 0x09, 0x89, 0x16, 0x88,
|
||||||
|
0x0A, 0x89, 0x15, 0x89, 0x0B, 0x89, 0x13, 0x89, 0x0C, 0x8A, 0x11, 0x8A, 0x0C, 0x8B, 0x0F, 0x8A,
|
||||||
|
0x0E, 0x8B, 0x0D, 0x8A, 0x10, 0x8D, 0x07, 0x8D, 0x10, 0xA2, 0x12, 0xA0, 0x14, 0x9E, 0x17, 0x9B,
|
||||||
|
0x19, 0x98, 0x1D, 0x95, 0x20, 0x90, 0x26, 0x8A, 0x4A
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_36[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x6A, 0x89, 0x26, 0x90, 0x21, 0x95, 0x1C, 0x98, 0x1A, 0x9A, 0x18, 0x9C, 0x16, 0x9E, 0x14,
|
||||||
|
0xA0, 0x12, 0x8D, 0x06, 0x8D, 0x10, 0x8B, 0x0B, 0x8B, 0x10, 0x8A, 0x0E, 0x8A, 0x0E, 0x89, 0x11,
|
||||||
|
0x89, 0x0D, 0x8A, 0x12, 0x89, 0x0C, 0x89, 0x13, 0x89, 0x0C, 0x88, 0x15, 0x88, 0x0B, 0x89, 0x15,
|
||||||
|
0x89, 0x0A, 0x88, 0x16, 0x89, 0x09, 0x89, 0x17, 0x88, 0x09, 0x88, 0x18, 0x84, 0x0D, 0x88, 0x2B,
|
||||||
|
0x87, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x0A, 0x88, 0x17, 0x87, 0x08, 0x8E, 0x14,
|
||||||
|
0x87, 0x06, 0x92, 0x11, 0x88, 0x04, 0x96, 0x0F, 0x88, 0x03, 0x98, 0x0E, 0x88, 0x02, 0x9A, 0x0D,
|
||||||
|
0x88, 0x01, 0x9C, 0x0C, 0x88, 0x00, 0x9E, 0x0B, 0x92, 0x07, 0x8E, 0x0A, 0x90, 0x0C, 0x8C, 0x09,
|
||||||
|
0x8E, 0x10, 0x8A, 0x09, 0x8D, 0x12, 0x8A, 0x08, 0x8C, 0x14, 0x89, 0x08, 0x8B, 0x16, 0x89, 0x07,
|
||||||
|
0x8A, 0x17, 0x89, 0x07, 0x89, 0x19, 0x88, 0x07, 0x89, 0x19, 0x88, 0x07, 0x89, 0x19, 0x89, 0x06,
|
||||||
|
0x88, 0x1B, 0x88, 0x06, 0x88, 0x1B, 0x88, 0x06, 0x88, 0x1B, 0x88, 0x06, 0x88, 0x1B, 0x88, 0x07,
|
||||||
|
0x87, 0x1B, 0x88, 0x07, 0x87, 0x1B, 0x88, 0x07, 0x87, 0x1B, 0x88, 0x07, 0x87, 0x1B, 0x88, 0x07,
|
||||||
|
0x88, 0x1A, 0x88, 0x08, 0x87, 0x19, 0x89, 0x08, 0x87, 0x19, 0x88, 0x09, 0x88, 0x18, 0x88, 0x09,
|
||||||
|
0x88, 0x17, 0x89, 0x0A, 0x88, 0x16, 0x88, 0x0B, 0x88, 0x15, 0x89, 0x0C, 0x88, 0x14, 0x89, 0x0C,
|
||||||
|
0x89, 0x12, 0x89, 0x0E, 0x89, 0x10, 0x8A, 0x0E, 0x8B, 0x0C, 0x8B, 0x10, 0x8C, 0x07, 0x8D, 0x12,
|
||||||
|
0xA1, 0x13, 0x9F, 0x15, 0x9D, 0x17, 0x9B, 0x1A, 0x97, 0x1D, 0x95, 0x21, 0x8F, 0x27, 0x89, 0x49
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_37[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x0D, 0xAB, 0x08, 0xAB, 0x08, 0xAB, 0x08, 0xAB, 0x08, 0xAB, 0x08, 0xAB, 0x08, 0xAB,
|
||||||
|
0x08, 0xAB, 0x08, 0xAA, 0x2C, 0x86, 0x2C, 0x86, 0x2C, 0x87, 0x2B, 0x87, 0x2B, 0x87, 0x2B, 0x87,
|
||||||
|
0x2C, 0x87, 0x2B, 0x87, 0x2B, 0x87, 0x2C, 0x87, 0x2B, 0x87, 0x2B, 0x88, 0x2B, 0x87, 0x2B, 0x87,
|
||||||
|
0x2B, 0x88, 0x2B, 0x87, 0x2B, 0x88, 0x2B, 0x87, 0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2A, 0x88,
|
||||||
|
0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88,
|
||||||
|
0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88,
|
||||||
|
0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88,
|
||||||
|
0x2B, 0x88, 0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2A, 0x89,
|
||||||
|
0x2A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x7F, 0x06
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_38[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x68, 0x89, 0x26, 0x91, 0x20, 0x95, 0x1C, 0x99, 0x19, 0x9B, 0x17, 0x9D, 0x15, 0x9F, 0x13,
|
||||||
|
0xA1, 0x11, 0x8D, 0x07, 0x8C, 0x11, 0x8B, 0x0B, 0x8B, 0x0F, 0x8A, 0x0F, 0x8A, 0x0E, 0x89, 0x11,
|
||||||
|
0x89, 0x0E, 0x88, 0x13, 0x88, 0x0D, 0x89, 0x13, 0x89, 0x0C, 0x88, 0x15, 0x88, 0x0C, 0x88, 0x15,
|
||||||
|
0x88, 0x0C, 0x88, 0x15, 0x88, 0x0C, 0x88, 0x15, 0x88, 0x0C, 0x88, 0x15, 0x88, 0x0C, 0x88, 0x15,
|
||||||
|
0x88, 0x0C, 0x88, 0x15, 0x88, 0x0D, 0x88, 0x13, 0x88, 0x0E, 0x88, 0x13, 0x88, 0x0E, 0x89, 0x11,
|
||||||
|
0x89, 0x0F, 0x89, 0x0F, 0x89, 0x11, 0x89, 0x0D, 0x89, 0x13, 0x8B, 0x07, 0x8C, 0x14, 0x9D, 0x17,
|
||||||
|
0x9B, 0x1A, 0x97, 0x1E, 0x93, 0x1E, 0x96, 0x1B, 0x9A, 0x18, 0x9D, 0x15, 0x9F, 0x13, 0x8C, 0x07,
|
||||||
|
0x8C, 0x11, 0x8A, 0x0C, 0x8B, 0x0F, 0x8A, 0x0F, 0x8A, 0x0D, 0x8A, 0x11, 0x89, 0x0D, 0x89, 0x13,
|
||||||
|
0x89, 0x0B, 0x89, 0x15, 0x88, 0x0B, 0x89, 0x15, 0x89, 0x0A, 0x88, 0x17, 0x88, 0x0A, 0x88, 0x17,
|
||||||
|
0x88, 0x09, 0x88, 0x19, 0x88, 0x08, 0x88, 0x19, 0x88, 0x08, 0x88, 0x19, 0x88, 0x08, 0x88, 0x19,
|
||||||
|
0x88, 0x08, 0x88, 0x19, 0x88, 0x08, 0x88, 0x19, 0x88, 0x08, 0x88, 0x19, 0x88, 0x08, 0x88, 0x19,
|
||||||
|
0x88, 0x08, 0x88, 0x19, 0x88, 0x08, 0x89, 0x17, 0x89, 0x09, 0x88, 0x17, 0x88, 0x0A, 0x89, 0x15,
|
||||||
|
0x89, 0x0A, 0x89, 0x15, 0x89, 0x0B, 0x89, 0x13, 0x89, 0x0C, 0x8A, 0x11, 0x8A, 0x0D, 0x8A, 0x0F,
|
||||||
|
0x8A, 0x0E, 0x8C, 0x0C, 0x8B, 0x0F, 0x8D, 0x07, 0x8D, 0x11, 0xA1, 0x13, 0x9F, 0x15, 0x9D, 0x17,
|
||||||
|
0x9B, 0x19, 0x99, 0x1C, 0x95, 0x20, 0x91, 0x26, 0x89, 0x4A
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_39[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x68, 0x88, 0x27, 0x90, 0x21, 0x94, 0x1E, 0x97, 0x1A, 0x9A, 0x18, 0x9C, 0x16, 0x9E, 0x14,
|
||||||
|
0xA0, 0x12, 0x8E, 0x07, 0x8B, 0x11, 0x8C, 0x0B, 0x8A, 0x0F, 0x8B, 0x0F, 0x88, 0x0F, 0x8A, 0x11,
|
||||||
|
0x88, 0x0D, 0x8A, 0x13, 0x88, 0x0C, 0x89, 0x14, 0x88, 0x0B, 0x89, 0x16, 0x87, 0x0B, 0x89, 0x17,
|
||||||
|
0x87, 0x0A, 0x88, 0x18, 0x87, 0x0A, 0x88, 0x18, 0x87, 0x09, 0x89, 0x19, 0x87, 0x08, 0x88, 0x1A,
|
||||||
|
0x87, 0x08, 0x88, 0x1A, 0x87, 0x08, 0x88, 0x1A, 0x87, 0x08, 0x88, 0x1A, 0x87, 0x08, 0x88, 0x1A,
|
||||||
|
0x87, 0x08, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A, 0x88, 0x07, 0x88, 0x1A,
|
||||||
|
0x88, 0x07, 0x89, 0x18, 0x89, 0x08, 0x88, 0x18, 0x89, 0x08, 0x88, 0x18, 0x89, 0x08, 0x89, 0x16,
|
||||||
|
0x8A, 0x08, 0x89, 0x16, 0x8A, 0x09, 0x89, 0x14, 0x8B, 0x09, 0x8A, 0x12, 0x8C, 0x0A, 0x8A, 0x10,
|
||||||
|
0x8D, 0x0A, 0x8C, 0x0C, 0x8F, 0x0B, 0x8E, 0x07, 0x91, 0x0C, 0x9D, 0x00, 0x88, 0x0D, 0x9B, 0x01,
|
||||||
|
0x88, 0x0E, 0x99, 0x02, 0x88, 0x0F, 0x97, 0x03, 0x88, 0x10, 0x95, 0x04, 0x88, 0x11, 0x92, 0x06,
|
||||||
|
0x87, 0x14, 0x8E, 0x08, 0x87, 0x17, 0x88, 0x0A, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B, 0x88, 0x2B,
|
||||||
|
0x87, 0x2B, 0x88, 0x0E, 0x84, 0x17, 0x88, 0x0A, 0x88, 0x17, 0x88, 0x0A, 0x89, 0x15, 0x88, 0x0B,
|
||||||
|
0x89, 0x15, 0x88, 0x0C, 0x88, 0x14, 0x89, 0x0C, 0x89, 0x13, 0x88, 0x0D, 0x89, 0x12, 0x89, 0x0E,
|
||||||
|
0x89, 0x10, 0x89, 0x0F, 0x8A, 0x0E, 0x8A, 0x0F, 0x8B, 0x0B, 0x8B, 0x11, 0x8C, 0x07, 0x8C, 0x13,
|
||||||
|
0x9F, 0x14, 0x9E, 0x16, 0x9C, 0x18, 0x9A, 0x1B, 0x97, 0x1D, 0x94, 0x21, 0x90, 0x26, 0x89, 0x4C
|
||||||
|
};
|
||||||
|
|
||||||
|
PROGMEM const unsigned char chr_f72_3A[] =
|
||||||
|
{
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x23, 0x88, 0x13,
|
||||||
|
0x88, 0x13, 0x88, 0x13, 0x88, 0x13, 0x88, 0x13,
|
||||||
|
0x88, 0x13, 0x88, 0x13, 0x88, 0x13, 0x88, 0x7F,
|
||||||
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x33, 0x88,
|
||||||
|
0x13, 0x88, 0x13, 0x88, 0x13, 0x88, 0x13, 0x88,
|
||||||
|
0x13, 0x88, 0x13, 0x88, 0x13, 0x88, 0x13, 0x88,
|
||||||
|
0x44
|
||||||
|
};
|
||||||
|
PROGMEM const unsigned char * const chrtbl_f72[96] = // character pointer table
|
||||||
|
{
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_2D, chr_f72_2E, chr_f72_20,
|
||||||
|
chr_f72_30, chr_f72_31, chr_f72_32, chr_f72_33, chr_f72_34, chr_f72_35, chr_f72_36, chr_f72_37,
|
||||||
|
chr_f72_38, chr_f72_39, chr_f72_3A, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20,
|
||||||
|
chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20, chr_f72_20
|
||||||
|
};
|
10
Fonts/Font72x53rle.h
Normal file
10
Fonts/Font72x53rle.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <Fonts/Font72x53rle.c>
|
||||||
|
|
||||||
|
#define nr_chrs_f72 96
|
||||||
|
#define chr_hgt_f72 75
|
||||||
|
#define baseline_f72 73
|
||||||
|
#define data_size_f72 8
|
||||||
|
#define firstchr_f72 32
|
||||||
|
|
||||||
|
extern const unsigned char widtbl_f72[96];
|
||||||
|
extern const unsigned char* const chrtbl_f72[96];
|
20
README.md
20
README.md
@ -1,4 +1,5 @@
|
|||||||
# TFT_eSPI
|
# TFT_eSPI
|
||||||
|
Update 10th March 2018: Added support for 8 bit parallel interface TFTs when used with ESP32.
|
||||||
|
|
||||||
Update 24th February 2018: Added new smooth (antialiased) fonts. See Smooth Font examples and Tools folder for the font generator.
|
Update 24th February 2018: Added new smooth (antialiased) fonts. See Smooth Font examples and Tools folder for the font generator.
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ Configuration of the library font selections, pins used to interface with the TF
|
|||||||
|
|
||||||
I have made some changes that will be uploaded soon that improves sprite and image rendering performance by up to 3x faster on the ESP8266. These updates are currently being tested/debugged.
|
I have made some changes that will be uploaded soon that improves sprite and image rendering performance by up to 3x faster on the ESP8266. These updates are currently being tested/debugged.
|
||||||
|
|
||||||
**2. Anti-aliased fonts**
|
**2. Anti-aliased fonts - done 24/2/18**
|
||||||
|
|
||||||
I have been experimenting with anti-aliased font files in "vlw" format generated by the free [Processing IDE](https://processing.org/). This IDE can be used to generate font files from your computer's font set and include **any** Unicode characters. This means Greek, Japanese and any other UTF-16 glyphs can be used.
|
I have been experimenting with anti-aliased font files in "vlw" format generated by the free [Processing IDE](https://processing.org/). This IDE can be used to generate font files from your computer's font set and include **any** Unicode characters. This means Greek, Japanese and any other UTF-16 glyphs can be used.
|
||||||
|
|
||||||
@ -51,3 +52,20 @@ Here is another screenshot, showing the anti-aliased Hiragana character Unicode
|
|||||||

|

|
||||||
|
|
||||||
Currently these are generated from a sketch, but when I have the Alpha blending sorted for colour backgrounds the plan is to build the rendering code into the TFT_eSPI library. Watch this space " " for updates!
|
Currently these are generated from a sketch, but when I have the Alpha blending sorted for colour backgrounds the plan is to build the rendering code into the TFT_eSPI library. Watch this space " " for updates!
|
||||||
|
|
||||||
|
**3. Add support 4 8 bit "UNO" style TFTs with ESP32 - done 10/3/18**
|
||||||
|
|
||||||
|
The ESP32 board I have been using for testing has the following pinout:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
UNO style boards with a Wemos R32(ESP32) label are also available at low cost with the same pin-out.
|
||||||
|
|
||||||
|
Unfortunately the typical UNO/mcufriend TFT display board maps LCD_RD, LCD_CS and LCD_RST signals to the ESP32 pins 35, 34 and 36 which are input only. To solve this I linked in the 3 spare pins IO15, IO33 and IO32 by adding wires to the bottom of the board as follows:
|
||||||
|
|
||||||
|
IO15 wired to IO35
|
||||||
|
IO33 wired to IO34
|
||||||
|
IO32 wired to IO36
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
86
TFT_Drivers/HX8357D_Defines.h
Normal file
86
TFT_Drivers/HX8357D_Defines.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// Change the width and height if required (defined in portrait mode)
|
||||||
|
// or use the constructor to over-ride defaults
|
||||||
|
#define TFT_WIDTH 320
|
||||||
|
#define TFT_HEIGHT 480
|
||||||
|
|
||||||
|
|
||||||
|
// Delay between some initialisation commands
|
||||||
|
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||||
|
|
||||||
|
|
||||||
|
// Generic commands used by TFT_eSPar.cpp
|
||||||
|
#define TFT_NOP 0x00
|
||||||
|
#define TFT_SWRST 0x01
|
||||||
|
|
||||||
|
#define TFT_SLPIN 0x10
|
||||||
|
#define TFT_SLPOUT 0x11
|
||||||
|
|
||||||
|
#define TFT_INVOFF 0x20
|
||||||
|
#define TFT_INVON 0x21
|
||||||
|
|
||||||
|
#define TFT_DISPOFF 0x28
|
||||||
|
#define TFT_DISPON 0x29
|
||||||
|
|
||||||
|
#define TFT_CASET 0x2A
|
||||||
|
#define TFT_PASET 0x2B
|
||||||
|
#define TFT_RAMWR 0x2C
|
||||||
|
|
||||||
|
#define TFT_RAMRD 0x2E
|
||||||
|
|
||||||
|
#define TFT_MADCTL 0x36
|
||||||
|
|
||||||
|
#define TFT_MAD_MY 0x80
|
||||||
|
#define TFT_MAD_MX 0x40
|
||||||
|
#define TFT_MAD_MV 0x20
|
||||||
|
#define TFT_MAD_ML 0x10
|
||||||
|
#define TFT_MAD_RGB 0x00
|
||||||
|
#define TFT_MAD_BGR 0x08
|
||||||
|
#define TFT_MAD_MH 0x04
|
||||||
|
#define TFT_MAD_SS 0x02
|
||||||
|
#define TFT_MAD_GS 0x01
|
||||||
|
|
||||||
|
#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read
|
||||||
|
|
||||||
|
|
||||||
|
#define HX8357_NOP 0x00
|
||||||
|
#define HX8357_SWRESET 0x01
|
||||||
|
#define HX8357_RDDID 0x04
|
||||||
|
#define HX8357_RDDST 0x09
|
||||||
|
|
||||||
|
#define HX8357_RDPOWMODE 0x0A
|
||||||
|
#define HX8357_RDMADCTL 0x0B
|
||||||
|
#define HX8357_RDCOLMOD 0x0C
|
||||||
|
#define HX8357_RDDIM 0x0D
|
||||||
|
#define HX8357_RDDSDR 0x0F
|
||||||
|
|
||||||
|
#define HX8357_SLPIN 0x10
|
||||||
|
#define HX8357_SLPOUT 0x11
|
||||||
|
|
||||||
|
#define HX8357_INVOFF 0x20
|
||||||
|
#define HX8357_INVON 0x21
|
||||||
|
#define HX8357_DISPOFF 0x28
|
||||||
|
#define HX8357_DISPON 0x29
|
||||||
|
|
||||||
|
#define HX8357_CASET 0x2A
|
||||||
|
#define HX8357_PASET 0x2B
|
||||||
|
#define HX8357_RAMWR 0x2C
|
||||||
|
#define HX8357_RAMRD 0x2E
|
||||||
|
|
||||||
|
#define HX8357_TEON 0x35
|
||||||
|
#define HX8357_TEARLINE 0x44
|
||||||
|
#define HX8357_MADCTL 0x36
|
||||||
|
#define HX8357_COLMOD 0x3A
|
||||||
|
|
||||||
|
#define HX8357_SETOSC 0xB0
|
||||||
|
#define HX8357_SETPWR1 0xB1
|
||||||
|
#define HX8357_SETRGB 0xB3
|
||||||
|
#define HX8357D_SETCOM 0xB6
|
||||||
|
|
||||||
|
#define HX8357D_SETCYC 0xB4
|
||||||
|
#define HX8357D_SETC 0xB9
|
||||||
|
|
||||||
|
#define HX8357D_SETSTBA 0xC0
|
||||||
|
|
||||||
|
#define HX8357_SETPANEL 0xCC
|
||||||
|
|
||||||
|
#define HX8357D_SETGAMMA 0xE0
|
118
TFT_Drivers/HX8357D_Init.h
Normal file
118
TFT_Drivers/HX8357D_Init.h
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
|
||||||
|
// This is the command sequence that initialises the HX8357D driver
|
||||||
|
//
|
||||||
|
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||||
|
//
|
||||||
|
// See ST7735_Setup.h file for an alternative format
|
||||||
|
|
||||||
|
|
||||||
|
// Configure HX8357D display
|
||||||
|
|
||||||
|
// setextc
|
||||||
|
writecommand(HX8357D_SETC);
|
||||||
|
writedata(0xFF);
|
||||||
|
writedata(0x83);
|
||||||
|
writedata(0x57);
|
||||||
|
delay(300);
|
||||||
|
|
||||||
|
// setRGB which also enables SDO
|
||||||
|
writecommand(HX8357_SETRGB);
|
||||||
|
writedata(0x80); //enable SDO pin!
|
||||||
|
// writedata(0x00); //disable SDO pin!
|
||||||
|
writedata(0x0);
|
||||||
|
writedata(0x06);
|
||||||
|
writedata(0x06);
|
||||||
|
|
||||||
|
writecommand(HX8357D_SETCOM);
|
||||||
|
writedata(0x25); // -1.52V
|
||||||
|
|
||||||
|
writecommand(HX8357_SETOSC);
|
||||||
|
writedata(0x68); // Normal mode 70Hz, Idle mode 55 Hz
|
||||||
|
|
||||||
|
writecommand(HX8357_SETPANEL); //Set Panel
|
||||||
|
writedata(0x05); // BGR, Gate direction swapped
|
||||||
|
|
||||||
|
writecommand(HX8357_SETPWR1);
|
||||||
|
writedata(0x00); // Not deep standby
|
||||||
|
writedata(0x15); //BT
|
||||||
|
writedata(0x1C); //VSPR
|
||||||
|
writedata(0x1C); //VSNR
|
||||||
|
writedata(0x83); //AP
|
||||||
|
writedata(0xAA); //FS
|
||||||
|
|
||||||
|
writecommand(HX8357D_SETSTBA);
|
||||||
|
writedata(0x50); //OPON normal
|
||||||
|
writedata(0x50); //OPON idle
|
||||||
|
writedata(0x01); //STBA
|
||||||
|
writedata(0x3C); //STBA
|
||||||
|
writedata(0x1E); //STBA
|
||||||
|
writedata(0x08); //GEN
|
||||||
|
|
||||||
|
writecommand(HX8357D_SETCYC);
|
||||||
|
writedata(0x02); //NW 0x02
|
||||||
|
writedata(0x40); //RTN
|
||||||
|
writedata(0x00); //DIV
|
||||||
|
writedata(0x2A); //DUM
|
||||||
|
writedata(0x2A); //DUM
|
||||||
|
writedata(0x0D); //GDON
|
||||||
|
writedata(0x78); //GDOFF
|
||||||
|
|
||||||
|
writecommand(HX8357D_SETGAMMA);
|
||||||
|
writedata(0x02);
|
||||||
|
writedata(0x0A);
|
||||||
|
writedata(0x11);
|
||||||
|
writedata(0x1d);
|
||||||
|
writedata(0x23);
|
||||||
|
writedata(0x35);
|
||||||
|
writedata(0x41);
|
||||||
|
writedata(0x4b);
|
||||||
|
writedata(0x4b);
|
||||||
|
writedata(0x42);
|
||||||
|
writedata(0x3A);
|
||||||
|
writedata(0x27);
|
||||||
|
writedata(0x1B);
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x09);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x02);
|
||||||
|
writedata(0x0A);
|
||||||
|
writedata(0x11);
|
||||||
|
writedata(0x1d);
|
||||||
|
writedata(0x23);
|
||||||
|
writedata(0x35);
|
||||||
|
writedata(0x41);
|
||||||
|
writedata(0x4b);
|
||||||
|
writedata(0x4b);
|
||||||
|
writedata(0x42);
|
||||||
|
writedata(0x3A);
|
||||||
|
writedata(0x27);
|
||||||
|
writedata(0x1B);
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x09);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x01);
|
||||||
|
|
||||||
|
writecommand(HX8357_COLMOD);
|
||||||
|
writedata(0x55); // 16 bit
|
||||||
|
|
||||||
|
writecommand(HX8357_MADCTL);
|
||||||
|
writedata(0xC0);
|
||||||
|
|
||||||
|
writecommand(HX8357_TEON); // TE off
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(HX8357_TEARLINE); // tear line
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x02);
|
||||||
|
|
||||||
|
writecommand(HX8357_SLPOUT); //Exit Sleep
|
||||||
|
delay(150);
|
||||||
|
|
||||||
|
writecommand(HX8357_DISPON); // display on
|
||||||
|
delay(50);
|
||||||
|
|
||||||
|
// End of HX8357D display configuration
|
||||||
|
|
||||||
|
|
||||||
|
|
26
TFT_Drivers/HX8357D_Rotation.h
Normal file
26
TFT_Drivers/HX8357D_Rotation.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// This is the command sequence that rotates the ILI9481 driver coordinate frame
|
||||||
|
|
||||||
|
writecommand(TFT_MADCTL);
|
||||||
|
rotation = m % 4;
|
||||||
|
switch (rotation) {
|
||||||
|
case 0: // Portrait
|
||||||
|
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB);
|
||||||
|
_width = TFT_WIDTH;
|
||||||
|
_height = TFT_HEIGHT;
|
||||||
|
break;
|
||||||
|
case 1: // Landscape (Portrait + 90)
|
||||||
|
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_RGB);
|
||||||
|
_width = TFT_HEIGHT;
|
||||||
|
_height = TFT_WIDTH;
|
||||||
|
break;
|
||||||
|
case 2: // Inverter portrait
|
||||||
|
writedata(TFT_MAD_RGB);
|
||||||
|
_width = TFT_WIDTH;
|
||||||
|
_height = TFT_HEIGHT;
|
||||||
|
break;
|
||||||
|
case 3: // Inverted landscape
|
||||||
|
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_RGB);
|
||||||
|
_width = TFT_HEIGHT;
|
||||||
|
_height = TFT_WIDTH;
|
||||||
|
break;
|
||||||
|
}
|
42
TFT_Drivers/ILI9481_Defines.h
Normal file
42
TFT_Drivers/ILI9481_Defines.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Change the width and height if required (defined in portrait mode)
|
||||||
|
// or use the constructor to over-ride defaults
|
||||||
|
#define TFT_WIDTH 320
|
||||||
|
#define TFT_HEIGHT 480
|
||||||
|
|
||||||
|
|
||||||
|
// Delay between some initialisation commands
|
||||||
|
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||||
|
|
||||||
|
|
||||||
|
// Generic commands used by TFT_eSPI.cpp
|
||||||
|
#define TFT_NOP 0x00
|
||||||
|
#define TFT_SWRST 0x01
|
||||||
|
|
||||||
|
#define TFT_SLPIN 0x10
|
||||||
|
#define TFT_SLPOUT 0x11
|
||||||
|
|
||||||
|
#define TFT_INVOFF 0x20
|
||||||
|
#define TFT_INVON 0x21
|
||||||
|
|
||||||
|
#define TFT_DISPOFF 0x28
|
||||||
|
#define TFT_DISPON 0x29
|
||||||
|
|
||||||
|
#define TFT_CASET 0x2A
|
||||||
|
#define TFT_PASET 0x2B
|
||||||
|
#define TFT_RAMWR 0x2C
|
||||||
|
|
||||||
|
#define TFT_RAMRD 0x2E
|
||||||
|
|
||||||
|
#define TFT_MADCTL 0x36
|
||||||
|
|
||||||
|
#define TFT_MAD_MY 0x80
|
||||||
|
#define TFT_MAD_MX 0x40
|
||||||
|
#define TFT_MAD_MV 0x20
|
||||||
|
#define TFT_MAD_ML 0x10
|
||||||
|
#define TFT_MAD_RGB 0x00
|
||||||
|
#define TFT_MAD_BGR 0x08
|
||||||
|
#define TFT_MAD_MH 0x04
|
||||||
|
#define TFT_MAD_SS 0x02
|
||||||
|
#define TFT_MAD_GS 0x01
|
||||||
|
|
||||||
|
#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read
|
77
TFT_Drivers/ILI9481_Init.h
Normal file
77
TFT_Drivers/ILI9481_Init.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
// This is the command sequence that initialises the ILI9481 driver
|
||||||
|
//
|
||||||
|
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||||
|
//
|
||||||
|
// See ST7735_Setup.h file for an alternative format
|
||||||
|
|
||||||
|
|
||||||
|
// Configure ILI9481 display
|
||||||
|
|
||||||
|
writecommand(TFT_SLPOUT);
|
||||||
|
delay(20);
|
||||||
|
|
||||||
|
writecommand(0xD0);
|
||||||
|
writedata(0x07);
|
||||||
|
writedata(0x42);
|
||||||
|
writedata(0x18);
|
||||||
|
|
||||||
|
writecommand(0xD1);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x07);
|
||||||
|
writedata(0x10);
|
||||||
|
|
||||||
|
writecommand(0xD2);
|
||||||
|
writedata(0x01);
|
||||||
|
writedata(0x02);
|
||||||
|
|
||||||
|
writecommand(0xC0);
|
||||||
|
writedata(0x10);
|
||||||
|
writedata(0x3B);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x02);
|
||||||
|
writedata(0x11);
|
||||||
|
|
||||||
|
writecommand(0xC5);
|
||||||
|
writedata(0x03);
|
||||||
|
|
||||||
|
writecommand(0xC8);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x32);
|
||||||
|
writedata(0x36);
|
||||||
|
writedata(0x45);
|
||||||
|
writedata(0x06);
|
||||||
|
writedata(0x16);
|
||||||
|
writedata(0x37);
|
||||||
|
writedata(0x75);
|
||||||
|
writedata(0x77);
|
||||||
|
writedata(0x54);
|
||||||
|
writedata(0x0C);
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(TFT_MADCTL);
|
||||||
|
writedata(0x0A);
|
||||||
|
|
||||||
|
writecommand(0x3A);
|
||||||
|
writedata(0x55);
|
||||||
|
|
||||||
|
writecommand(TFT_CASET);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x01);
|
||||||
|
writedata(0x3F);
|
||||||
|
|
||||||
|
writecommand(TFT_PASET);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x01);
|
||||||
|
writedata(0xDF);
|
||||||
|
|
||||||
|
delay(120);
|
||||||
|
writecommand(TFT_DISPON);
|
||||||
|
|
||||||
|
delay(25);
|
||||||
|
// End of ILI9481 display configuration
|
||||||
|
|
||||||
|
|
||||||
|
|
27
TFT_Drivers/ILI9481_Rotation.h
Normal file
27
TFT_Drivers/ILI9481_Rotation.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// This is the command sequence that rotates the ILI9481 driver coordinate frame
|
||||||
|
|
||||||
|
writecommand(TFT_MADCTL);
|
||||||
|
rotation = m % 4;
|
||||||
|
switch (rotation) {
|
||||||
|
case 0: // Portrait
|
||||||
|
writedata(TFT_MAD_BGR | TFT_MAD_SS);
|
||||||
|
_width = TFT_WIDTH;
|
||||||
|
_height = TFT_HEIGHT;
|
||||||
|
break;
|
||||||
|
case 1: // Landscape (Portrait + 90)
|
||||||
|
writedata(TFT_MAD_MV | TFT_MAD_BGR);
|
||||||
|
_width = TFT_HEIGHT;
|
||||||
|
_height = TFT_WIDTH;
|
||||||
|
break;
|
||||||
|
case 2: // Inverter portrait
|
||||||
|
writedata(TFT_MAD_BGR | TFT_MAD_GS);
|
||||||
|
_width = TFT_WIDTH;
|
||||||
|
_height = TFT_HEIGHT;
|
||||||
|
break;
|
||||||
|
case 3: // Inverted landscape
|
||||||
|
writedata(TFT_MAD_MV | TFT_MAD_BGR | TFT_MAD_SS | TFT_MAD_GS);
|
||||||
|
_width = TFT_HEIGHT;
|
||||||
|
_height = TFT_WIDTH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
42
TFT_Drivers/ILI9488_Defines.h
Normal file
42
TFT_Drivers/ILI9488_Defines.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Change the width and height if required (defined in portrait mode)
|
||||||
|
// or use the constructor to over-ride defaults
|
||||||
|
#define TFT_WIDTH 320
|
||||||
|
#define TFT_HEIGHT 480
|
||||||
|
|
||||||
|
|
||||||
|
// Delay between some initialisation commands
|
||||||
|
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||||
|
|
||||||
|
|
||||||
|
// Generic commands used by TFT_eSPI.cpp
|
||||||
|
#define TFT_NOP 0x00
|
||||||
|
#define TFT_SWRST 0x01
|
||||||
|
|
||||||
|
#define TFT_SLPIN 0x10
|
||||||
|
#define TFT_SLPOUT 0x11
|
||||||
|
|
||||||
|
#define TFT_INVOFF 0x20
|
||||||
|
#define TFT_INVON 0x21
|
||||||
|
|
||||||
|
#define TFT_DISPOFF 0x28
|
||||||
|
#define TFT_DISPON 0x29
|
||||||
|
|
||||||
|
#define TFT_CASET 0x2A
|
||||||
|
#define TFT_PASET 0x2B
|
||||||
|
#define TFT_RAMWR 0x2C
|
||||||
|
|
||||||
|
#define TFT_RAMRD 0x2E
|
||||||
|
|
||||||
|
#define TFT_MADCTL 0x36
|
||||||
|
|
||||||
|
#define TFT_MAD_MY 0x80
|
||||||
|
#define TFT_MAD_MX 0x40
|
||||||
|
#define TFT_MAD_MV 0x20
|
||||||
|
#define TFT_MAD_ML 0x10
|
||||||
|
#define TFT_MAD_RGB 0x00
|
||||||
|
#define TFT_MAD_BGR 0x08
|
||||||
|
#define TFT_MAD_MH 0x04
|
||||||
|
#define TFT_MAD_SS 0x02
|
||||||
|
#define TFT_MAD_GS 0x01
|
||||||
|
|
||||||
|
#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read
|
97
TFT_Drivers/ILI9488_Init.h
Normal file
97
TFT_Drivers/ILI9488_Init.h
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
|
||||||
|
// This is the command sequence that initialises the ILI9488 driver
|
||||||
|
//
|
||||||
|
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||||
|
//
|
||||||
|
// See ST7735_Setup.h file for an alternative format
|
||||||
|
|
||||||
|
|
||||||
|
// Configure ILI9488 display
|
||||||
|
|
||||||
|
writecommand(0x3A); // Pixel Interface Format (16 bit colour)
|
||||||
|
writedata(0x55);
|
||||||
|
|
||||||
|
writecommand(0xB0); // Interface Mode Control
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(0xB1); // Frame Rate Control
|
||||||
|
writedata(0xB0);
|
||||||
|
writedata(0x11);
|
||||||
|
|
||||||
|
writecommand(0xB4); // Display Inversion Control
|
||||||
|
writedata(0x02);
|
||||||
|
|
||||||
|
writecommand(0xB6); // Display Function Control
|
||||||
|
writedata(0x02);
|
||||||
|
writedata(0x02);
|
||||||
|
writedata(0x3B);
|
||||||
|
|
||||||
|
writecommand(0xB7); // Entry Mode Set
|
||||||
|
writedata(0xC6);
|
||||||
|
|
||||||
|
writecommand(0XC0); // Power Control 1
|
||||||
|
writedata(0x10);
|
||||||
|
writedata(0x10);
|
||||||
|
|
||||||
|
writecommand(0xC1); // Power Control 2
|
||||||
|
writedata(0x41);
|
||||||
|
|
||||||
|
writecommand(0xC5); // VCOM Control
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x22);
|
||||||
|
writedata(0x80);
|
||||||
|
writedata(0x40);
|
||||||
|
|
||||||
|
writecommand(0xE0); // Positive Gamma Control
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x09);
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x16);
|
||||||
|
writedata(0x0A);
|
||||||
|
writedata(0x3F);
|
||||||
|
writedata(0x78);
|
||||||
|
writedata(0x4C);
|
||||||
|
writedata(0x09);
|
||||||
|
writedata(0x0A);
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x16);
|
||||||
|
writedata(0x1A);
|
||||||
|
writedata(0x0F);
|
||||||
|
|
||||||
|
writecommand(0XE1); // Negative Gamma Control
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x16);
|
||||||
|
writedata(0x19);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x0F);
|
||||||
|
writedata(0x05);
|
||||||
|
writedata(0x32);
|
||||||
|
writedata(0x45);
|
||||||
|
writedata(0x46);
|
||||||
|
writedata(0x04);
|
||||||
|
writedata(0x0E);
|
||||||
|
writedata(0x0D);
|
||||||
|
writedata(0x35);
|
||||||
|
writedata(0x37);
|
||||||
|
writedata(0x0F);
|
||||||
|
|
||||||
|
writecommand(0xF7); // Adjust Control 3
|
||||||
|
writedata(0xA9);
|
||||||
|
writedata(0x51);
|
||||||
|
writedata(0x2C);
|
||||||
|
writedata(0x02);
|
||||||
|
|
||||||
|
writecommand(TFT_MADCTL); // Memory Access Control
|
||||||
|
writedata(0x48); // MX, BGR
|
||||||
|
|
||||||
|
writecommand(TFT_SLPOUT); //Exit Sleep
|
||||||
|
delay(120);
|
||||||
|
|
||||||
|
writecommand(TFT_DISPON); //Display on
|
||||||
|
delay(25);
|
||||||
|
|
||||||
|
// End of ILI9488 display configuration
|
||||||
|
|
||||||
|
|
||||||
|
|
27
TFT_Drivers/ILI9488_Rotation.h
Normal file
27
TFT_Drivers/ILI9488_Rotation.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// This is the command sequence that rotates the ILI9488 driver coordinate frame
|
||||||
|
|
||||||
|
writecommand(TFT_MADCTL);
|
||||||
|
rotation = m % 4;
|
||||||
|
switch (rotation) {
|
||||||
|
case 0: // Portrait
|
||||||
|
writedata(TFT_MAD_MX | TFT_MAD_BGR);
|
||||||
|
_width = TFT_WIDTH;
|
||||||
|
_height = TFT_HEIGHT;
|
||||||
|
break;
|
||||||
|
case 1: // Landscape (Portrait + 90)
|
||||||
|
writedata(TFT_MAD_MV | TFT_MAD_BGR);
|
||||||
|
_width = TFT_HEIGHT;
|
||||||
|
_height = TFT_WIDTH;
|
||||||
|
break;
|
||||||
|
case 2: // Inverter portrait
|
||||||
|
writedata(TFT_MAD_MY | TFT_MAD_BGR);
|
||||||
|
_width = TFT_WIDTH;
|
||||||
|
_height = TFT_HEIGHT;
|
||||||
|
break;
|
||||||
|
case 3: // Inverted landscape
|
||||||
|
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR);
|
||||||
|
_width = TFT_HEIGHT;
|
||||||
|
_height = TFT_WIDTH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
611
TFT_eSPI.cpp
611
TFT_eSPI.cpp
File diff suppressed because it is too large
Load Diff
88
TFT_eSPI.h
88
TFT_eSPI.h
@ -65,6 +65,12 @@
|
|||||||
#ifndef LOAD_RLE
|
#ifndef LOAD_RLE
|
||||||
#define LOAD_RLE
|
#define LOAD_RLE
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined LOAD_FONT8N
|
||||||
|
#define LOAD_FONT8
|
||||||
|
#include <Fonts/Font72x53rle.h>
|
||||||
|
#ifndef LOAD_RLE
|
||||||
|
#define LOAD_RLE
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
@ -89,10 +95,13 @@
|
|||||||
#define DC_C digitalWrite(TFT_DC, LOW)
|
#define DC_C digitalWrite(TFT_DC, LOW)
|
||||||
#define DC_D digitalWrite(TFT_DC, HIGH)
|
#define DC_D digitalWrite(TFT_DC, HIGH)
|
||||||
#elif defined (ESP32)
|
#elif defined (ESP32)
|
||||||
//#define DC_C digitalWrite(TFT_DC, HIGH); GPIO.out_w1tc = (1 << TFT_DC)//digitalWrite(TFT_DC, LOW)
|
#if defined (ESP32_PARALLEL)
|
||||||
//#define DC_D digitalWrite(TFT_DC, LOW); GPIO.out_w1ts = (1 << TFT_DC)//digitalWrite(TFT_DC, HIGH)
|
#define DC_C GPIO.out_w1tc = (1 << TFT_DC) // Too fast for ST7735
|
||||||
#define DC_C GPIO.out_w1ts = (1 << TFT_DC); GPIO.out_w1ts = (1 << TFT_DC); GPIO.out_w1tc = (1 << TFT_DC)
|
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)
|
||||||
#define DC_D GPIO.out_w1tc = (1 << TFT_DC); GPIO.out_w1ts = (1 << TFT_DC)
|
#else
|
||||||
|
#define DC_C GPIO.out_w1ts = (1 << TFT_DC); GPIO.out_w1tc = (1 << TFT_DC)
|
||||||
|
#define DC_D GPIO.out_w1tc = (1 << TFT_DC); GPIO.out_w1ts = (1 << TFT_DC)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define DC_C GPOC=dcpinmask
|
#define DC_C GPOC=dcpinmask
|
||||||
#define DC_D GPOS=dcpinmask
|
#define DC_D GPOS=dcpinmask
|
||||||
@ -110,10 +119,13 @@
|
|||||||
#define CS_L digitalWrite(TFT_CS, LOW)
|
#define CS_L digitalWrite(TFT_CS, LOW)
|
||||||
#define CS_H digitalWrite(TFT_CS, HIGH)
|
#define CS_H digitalWrite(TFT_CS, HIGH)
|
||||||
#elif defined (ESP32)
|
#elif defined (ESP32)
|
||||||
//#define CS_L digitalWrite(TFT_CS, HIGH); GPIO.out_w1tc = (1 << TFT_CS)//digitalWrite(TFT_CS, LOW)
|
#if defined (ESP32_PARALLEL)
|
||||||
//#define CS_H digitalWrite(TFT_CS, LOW); GPIO.out_w1ts = (1 << TFT_CS)//digitalWrite(TFT_CS, HIGH)
|
#define CS_L // The TFT CS is set permanently low during init()
|
||||||
#define CS_L GPIO.out_w1ts = (1 << TFT_CS);GPIO.out_w1tc = (1 << TFT_CS)
|
#define CS_H
|
||||||
#define CS_H GPIO.out_w1tc = (1 << TFT_CS);GPIO.out_w1ts = (1 << TFT_CS)
|
#else
|
||||||
|
#define CS_L GPIO.out_w1ts = (1 << TFT_CS);GPIO.out_w1tc = (1 << TFT_CS)
|
||||||
|
#define CS_H GPIO.out_w1tc = (1 << TFT_CS);GPIO.out_w1ts = (1 << TFT_CS)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define CS_L GPOC=cspinmask
|
#define CS_L GPOC=cspinmask
|
||||||
#define CS_H GPOS=cspinmask
|
#define CS_H GPOS=cspinmask
|
||||||
@ -133,15 +145,66 @@
|
|||||||
#ifdef TFT_WR
|
#ifdef TFT_WR
|
||||||
#if defined (ESP32)
|
#if defined (ESP32)
|
||||||
#define WR_L GPIO.out_w1tc = (1 << TFT_WR)
|
#define WR_L GPIO.out_w1tc = (1 << TFT_WR)
|
||||||
//digitalWrite(TFT_WR, LOW)
|
//#define WR_L digitalWrite(TFT_WR, LOW)
|
||||||
#define WR_H GPIO.out_w1ts = (1 << TFT_WR)
|
#define WR_H GPIO.out_w1ts = (1 << TFT_WR)
|
||||||
//digitalWrite(TFT_WR, HIGH)
|
//#define WR_H digitalWrite(TFT_WR, HIGH)
|
||||||
#else
|
#else
|
||||||
#define WR_L GPOC=wrpinmask
|
#define WR_L GPOC=wrpinmask
|
||||||
#define WR_H GPOS=wrpinmask
|
#define WR_H GPOS=wrpinmask
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ESP32_PARALLEL
|
||||||
|
|
||||||
|
#define dir_mask ((1 << TFT_D0) | (1 << TFT_D1) | (1 << TFT_D2) | (1 << TFT_D3) | (1 << TFT_D4) | (1 << TFT_D5) | (1 << TFT_D6) | (1 << TFT_D7))
|
||||||
|
|
||||||
|
#define clr_mask (dir_mask | (1 << TFT_WR))
|
||||||
|
|
||||||
|
#define set_mask(C) xset_mask[C] // 63fps Sprite rendering test 33% faster, graphicstest only 1.8% faster than shifting in real time
|
||||||
|
|
||||||
|
// Real-time shifting alternative to above to save 1KByte RAM, 47 fps Sprite rendering test
|
||||||
|
//#define set_mask(C) ((C&0x80)>>7)<<TFT_D7 | ((C&0x40)>>6)<<TFT_D6 | ((C&0x20)>>5)<<TFT_D5 | ((C&0x10)>>4)<<TFT_D4 | \
|
||||||
|
((C&0x08)>>3)<<TFT_D3 | ((C&0x04)>>2)<<TFT_D2 | ((C&0x02)>>1)<<TFT_D1 | ((C&0x01)>>0)<<TFT_D0
|
||||||
|
|
||||||
|
#define transfer8(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t)C); WR_H
|
||||||
|
|
||||||
|
#define transfer16(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t)(C >> 8)); WR_H; \
|
||||||
|
GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t)(C >> 0)); WR_H
|
||||||
|
|
||||||
|
// 16 bit transfer with swapped bytes
|
||||||
|
#define transwap16(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) (C >> 0)); WR_H; \
|
||||||
|
GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) (C >> 8)); WR_H
|
||||||
|
|
||||||
|
#define transfer32(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) (C >> 24)); WR_H; \
|
||||||
|
GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) (C >> 16)); WR_H; \
|
||||||
|
GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) (C >> 8)); WR_H; \
|
||||||
|
GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) (C >> 0)); WR_H
|
||||||
|
|
||||||
|
#ifdef TFT_RD
|
||||||
|
#if defined (ESP32)
|
||||||
|
#define RD_L GPIO.out_w1tc = (1 << TFT_RD)
|
||||||
|
//#define RD_L digitalWrite(TFT_WR, LOW)
|
||||||
|
#define RD_H GPIO.out_w1ts = (1 << TFT_RD)
|
||||||
|
//#define RD_H digitalWrite(TFT_WR, HIGH)
|
||||||
|
#else
|
||||||
|
//#define RD_L GPOC=rdpinmask
|
||||||
|
//#define RD_H GPOS=rdpinmask
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (SEND_16_BITS)
|
||||||
|
#define transfer8(C) SPI.transfer(0); SPI.transfer(C)
|
||||||
|
#define transfer16(C) SPI.write16(C)
|
||||||
|
#define transfer32(C) SPI.write32(C)
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define transfer8(C) SPI.transfer(C)
|
||||||
|
#define transfer16(C) SPI.write16(C)
|
||||||
|
#define transfer32(C) SPI.write32(C)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LOAD_GFXFF
|
#ifdef LOAD_GFXFF
|
||||||
// We can include all the free fonts and they will only be built into
|
// We can include all the free fonts and they will only be built into
|
||||||
// the sketch if they are used
|
// the sketch if they are used
|
||||||
@ -402,6 +465,7 @@ class TFT_eSPI : public Print {
|
|||||||
spiwrite(uint8_t),
|
spiwrite(uint8_t),
|
||||||
writecommand(uint8_t c),
|
writecommand(uint8_t c),
|
||||||
writedata(uint8_t d),
|
writedata(uint8_t d),
|
||||||
|
|
||||||
commandList(const uint8_t *addr);
|
commandList(const uint8_t *addr);
|
||||||
|
|
||||||
uint8_t readcommand8(uint8_t cmd_function, uint8_t index);
|
uint8_t readcommand8(uint8_t cmd_function, uint8_t index);
|
||||||
@ -497,6 +561,10 @@ class TFT_eSPI : public Print {
|
|||||||
|
|
||||||
uint32_t cspinmask, dcpinmask, wrpinmask;
|
uint32_t cspinmask, dcpinmask, wrpinmask;
|
||||||
|
|
||||||
|
#if defined(ESP32_PARALLEL)
|
||||||
|
uint32_t xclr_mask, xdir_mask, xset_mask[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t lastColor = 0xFFFF;
|
uint32_t lastColor = 0xFFFF;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// This is a Processing sketch, see https://processing.org/ to download the IDE
|
||||||
|
|
||||||
// Select the character range in the user configure section starting at line 100
|
// Select the character range in the user configure section starting at line 100
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -107,7 +109,7 @@ String fontType = ".ttf"; //SPIFFS does not accept underscore in file
|
|||||||
//String fontType = ".otf";
|
//String fontType = ".otf";
|
||||||
|
|
||||||
// Use font number instead of name, -1 means use name above, or a value >=0 means use system font number from list.
|
// Use font number instead of name, -1 means use name above, or a value >=0 means use system font number from list.
|
||||||
int fontNumber = -1; // << Use [Number] in brackets from the fonts listed in console window
|
int fontNumber = 22; // << Use [Number] in brackets from the fonts listed in console window
|
||||||
|
|
||||||
// Define the font size in points for the created font file
|
// Define the font size in points for the created font file
|
||||||
int fontSize = 28;
|
int fontSize = 28;
|
||||||
@ -310,7 +312,7 @@ static final int[] specificUnicodes = {
|
|||||||
//*/
|
//*/
|
||||||
|
|
||||||
// More characters, change next line to //* to use
|
// More characters, change next line to //* to use
|
||||||
/*
|
//*
|
||||||
0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x010C, 0x010D,
|
0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x010C, 0x010D,
|
||||||
0x010E, 0x010F, 0x0110, 0x0111, 0x0118, 0x0119, 0x011A, 0x011B,
|
0x010E, 0x010F, 0x0110, 0x0111, 0x0118, 0x0119, 0x011A, 0x011B,
|
||||||
|
|
||||||
@ -413,8 +415,12 @@ void setup() {
|
|||||||
charset[index] = Character.toChars(specificUnicodes[i])[0];
|
charset[index] = Character.toChars(specificUnicodes[i])[0];
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make font smooth
|
||||||
|
boolean smooth = true;
|
||||||
|
|
||||||
// Create the font in memory
|
// Create the font in memory
|
||||||
myFont = createFont(fontName+fontType, 32, true, charset);
|
myFont = createFont(fontName+fontType, displayFontSize, smooth, charset);
|
||||||
|
|
||||||
// Print a few characters to the sketch window
|
// Print a few characters to the sketch window
|
||||||
fill(0, 0, 0);
|
fill(0, 0, 0);
|
||||||
@ -455,9 +461,9 @@ void setup() {
|
|||||||
// creating font
|
// creating font
|
||||||
PFont font;
|
PFont font;
|
||||||
|
|
||||||
font = createFont(fontName+fontType, fontSize, true, charset);
|
font = createFont(fontName+fontType, fontSize, smooth, charset);
|
||||||
|
|
||||||
println("Created font " + fontName + ".vlw");
|
println("Created font " + fontName + str(fontSize) + ".vlw");
|
||||||
|
|
||||||
// creating file
|
// creating file
|
||||||
try {
|
try {
|
34
User_Setup.h
34
User_Setup.h
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
// If this file is edited correctly then all the library example sketches should
|
// If this file is edited correctly then all the library example sketches should
|
||||||
// run without the need to make any more changes for a particular hardware setup!
|
// run without the need to make any more changes for a particular hardware setup!
|
||||||
|
// Note that some sketches are designed for a particular TFT pixel width/height
|
||||||
|
|
||||||
// ##################################################################################
|
// ##################################################################################
|
||||||
//
|
//
|
||||||
@ -19,6 +20,9 @@
|
|||||||
//#define ILI9163_DRIVER
|
//#define ILI9163_DRIVER
|
||||||
//#define S6D02A1_DRIVER
|
//#define S6D02A1_DRIVER
|
||||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||||
|
//#define HX8357D_DRIVER
|
||||||
|
//#define ILI9481_DRIVER
|
||||||
|
//#define ILI9488_DRIVER
|
||||||
|
|
||||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||||
//#define M5STACK
|
//#define M5STACK
|
||||||
@ -134,6 +138,35 @@
|
|||||||
|
|
||||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||||
|
|
||||||
|
// ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ######
|
||||||
|
|
||||||
|
// The library supports 8 bit parallel TFTs with the ESP32, the pin
|
||||||
|
// selection below is compatible with ESP32 boards in UNO format.
|
||||||
|
// Wemos D32 boards need to be modified, see diagram in Tools folder.
|
||||||
|
// Only ILI9481 and ILI9341 based displays have been tested!
|
||||||
|
|
||||||
|
// Parallel bus is only supported on ESP32
|
||||||
|
// Uncomment line below to use ESP32 Parallel interface instead of SPI
|
||||||
|
|
||||||
|
//#define ESP32_PARALLEL
|
||||||
|
|
||||||
|
// The ESP32 and TFT the pins used for testing are:
|
||||||
|
//#define TFT_CS 33 // Chip select control pin (library pulls permanently low
|
||||||
|
//#define TFT_DC 15 // Data Command control pin - use a pin in the range 0-31
|
||||||
|
//#define TFT_RST 32 // Reset pin, toggles on startup
|
||||||
|
|
||||||
|
//#define TFT_WR 4 // Write strobe control pin - use a pin in the range 0-31
|
||||||
|
//#define TFT_RD 2 // Read strobe control pin - use a pin in the range 0-31
|
||||||
|
|
||||||
|
//#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus
|
||||||
|
//#define TFT_D1 13 // so a single register write sets/clears all bits.
|
||||||
|
//#define TFT_D2 26 // Pins can be randomly assigned, this does not affect
|
||||||
|
//#define TFT_D3 25 // TFT screen update performance.
|
||||||
|
//#define TFT_D4 17
|
||||||
|
//#define TFT_D5 16
|
||||||
|
//#define TFT_D6 27
|
||||||
|
//#define TFT_D7 14
|
||||||
|
|
||||||
// ##################################################################################
|
// ##################################################################################
|
||||||
//
|
//
|
||||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||||
@ -166,6 +199,7 @@
|
|||||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
|
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
|
||||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||||
|
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||||
|
|
||||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
|
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
|
||||||
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
|
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
|
||||||
//#include <User_Setups/Setup12_M5Stack.h> // Setup file for the ESP32 based M5Stack
|
//#include <User_Setups/Setup12_M5Stack.h> // Setup file for the ESP32 based M5Stack
|
||||||
|
//#include <User_Setups/Setup13_ILI9481_Parallel.h> // Setup file for the ESP32 with parallel bus TFT
|
||||||
|
//#include <User_Setups/Setup14_ILI9341_Parallel.h> // Setup file for the ESP32 with parallel bus TFT
|
||||||
|
//#include <User_Setups/Setup15_HX8357D.h> // Setup file configured for HX8357D (untested)
|
||||||
|
//#include <User_Setups/Setup16_ILI9488_Parallel.h> // Setup file for the ESP32 with parallel bus TFT
|
||||||
|
|
||||||
//#include <User_Setups/Setup99.h>
|
//#include <User_Setups/Setup99.h>
|
||||||
|
|
||||||
@ -62,6 +66,12 @@
|
|||||||
#include <TFT_Drivers/S6D02A1_Defines.h>
|
#include <TFT_Drivers/S6D02A1_Defines.h>
|
||||||
#elif defined (RPI_ILI9486_DRIVER)
|
#elif defined (RPI_ILI9486_DRIVER)
|
||||||
#include <TFT_Drivers/RPI_ILI9486_Defines.h>
|
#include <TFT_Drivers/RPI_ILI9486_Defines.h>
|
||||||
|
#elif defined (ILI9481_DRIVER)
|
||||||
|
#include <TFT_Drivers/ILI9481_Defines.h>
|
||||||
|
#elif defined (ILI9488_DRIVER)
|
||||||
|
#include <TFT_Drivers/ILI9488_Defines.h>
|
||||||
|
#elif defined (HX8357D_DRIVER)
|
||||||
|
#include "TFT_Drivers/HX8357D_Defines.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// These are the pins for all ESP8266 boards
|
// These are the pins for all ESP8266 boards
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "0.18.21",
|
"version": "0.19.10",
|
||||||
"keywords": "tft, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486",
|
"keywords": "tft, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486",
|
||||||
"description": "A TFT SPI graphics library for ESP8266 and ESP32",
|
"description": "A TFT SPI graphics library for ESP8266 and ESP32",
|
||||||
"repository":
|
"repository":
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=0.18.21
|
version=0.19.10
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=A fast TFT library for ESP8266 processors and the Arduino IDE
|
sentence=A fast TFT library for ESP8266 processors and the Arduino IDE
|
||||||
|
Reference in New Issue
Block a user