Merge remote-tracking branch 'refs/remotes/Bodmer/master'
This commit is contained in:
commit
272d4c1ab7
|
|
@ -8,9 +8,18 @@
|
|||
|
||||
/***************************************************************************************
|
||||
** Function name: loadFont
|
||||
** Description: loads parameters from a new font vlw file stored in SPIFFS
|
||||
** Description: loads parameters from a new font vlw file
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSPI::loadFont(String fontName)
|
||||
void TFT_eSPI::loadFont(String fontName, fs::FS &ffs)
|
||||
{
|
||||
fontFS = ffs;
|
||||
loadFont(fontName, false);
|
||||
}
|
||||
/***************************************************************************************
|
||||
** Function name: loadFont
|
||||
** Description: loads parameters from a new font vlw file
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
{
|
||||
/*
|
||||
The vlw font format does not appear to be documented anywhere, so some reverse
|
||||
|
|
@ -74,11 +83,19 @@ void TFT_eSPI::loadFont(String fontName)
|
|||
|
||||
*/
|
||||
|
||||
unloadFont();
|
||||
|
||||
_gFontFilename = "/" + fontName + ".vlw";
|
||||
spiffs = flash;
|
||||
|
||||
fontFile = SPIFFS.open( _gFontFilename, "r");
|
||||
if(spiffs) fontFS = SPIFFS;
|
||||
|
||||
unloadFont();
|
||||
|
||||
// Avoid a crash on the ESP32 if the file does not exist
|
||||
if (fontFS.exists("/" + fontName + ".vlw") == false) {
|
||||
Serial.println("Font file " + fontName + " not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
fontFile = fontFS.open( "/" + fontName + ".vlw", "r");
|
||||
|
||||
if(!fontFile) return;
|
||||
|
||||
|
|
@ -91,7 +108,7 @@ void TFT_eSPI::loadFont(String fontName)
|
|||
gFont.ascent = (uint16_t)readInt32(); // top of "d"
|
||||
gFont.descent = (uint16_t)readInt32(); // bottom of "p"
|
||||
|
||||
// These next gFont values will be updated when the Metrics are fetched
|
||||
// These next gFont values might be updated when the Metrics are fetched
|
||||
gFont.maxAscent = gFont.ascent; // Determined from metrics
|
||||
gFont.maxDescent = gFont.descent; // Determined from metrics
|
||||
gFont.yAdvance = gFont.ascent + gFont.descent;
|
||||
|
|
@ -116,13 +133,28 @@ void TFT_eSPI::loadMetrics(uint16_t gCount)
|
|||
uint32_t headerPtr = 24;
|
||||
uint32_t bitmapPtr = 24 + gCount * 28;
|
||||
|
||||
gUnicode = (uint16_t*)malloc( gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)malloc( gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)malloc( gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)malloc( gCount ); // xAdvance - to move x cursor
|
||||
gdY = (int8_t*)malloc( gCount ); // offset from bitmap top edge from lowest point in any character
|
||||
gdX = (int8_t*)malloc( gCount ); // offset for bitmap left edge relative to cursor X
|
||||
gBitmap = (uint32_t*)malloc( gCount * 4); // seek pointer to glyph bitmap in SPIFFS file
|
||||
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||
if ( psramFound() )
|
||||
{
|
||||
gUnicode = (uint16_t*)ps_malloc( gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)ps_malloc( gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)ps_malloc( gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)ps_malloc( gCount ); // xAdvance - to move x cursor
|
||||
gdY = (int16_t*)ps_malloc( gCount * 2); // offset from bitmap top edge from lowest point in any character
|
||||
gdX = (int8_t*)ps_malloc( gCount ); // offset for bitmap left edge relative to cursor X
|
||||
gBitmap = (uint32_t*)ps_malloc( gCount * 4); // seek pointer to glyph bitmap in the file
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
gUnicode = (uint16_t*)malloc( gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)malloc( gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)malloc( gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)malloc( gCount ); // xAdvance - to move x cursor
|
||||
gdY = (int16_t*)malloc( gCount * 2); // offset from bitmap top edge from lowest point in any character
|
||||
gdX = (int8_t*)malloc( gCount ); // offset for bitmap left edge relative to cursor X
|
||||
gBitmap = (uint32_t*)malloc( gCount * 4); // seek pointer to glyph bitmap in the file
|
||||
}
|
||||
|
||||
#ifdef SHOW_ASCENT_DESCENT
|
||||
Serial.print("ascent = "); Serial.println(gFont.ascent);
|
||||
|
|
@ -137,15 +169,23 @@ void TFT_eSPI::loadMetrics(uint16_t gCount)
|
|||
gHeight[gNum] = (uint8_t)readInt32(); // Height of glyph
|
||||
gWidth[gNum] = (uint8_t)readInt32(); // Width of glyph
|
||||
gxAdvance[gNum] = (uint8_t)readInt32(); // xAdvance - to move x cursor
|
||||
gdY[gNum] = (int8_t)readInt32(); // y delta from baseline
|
||||
gdY[gNum] = (int16_t)readInt32(); // y delta from baseline
|
||||
gdX[gNum] = (int8_t)readInt32(); // x delta from cursor
|
||||
readInt32(); // ignored
|
||||
|
||||
// Different glyph sets have different ascent values not always based on "d", so get maximum glyph ascent
|
||||
//Serial.print("Unicode = 0x"); Serial.print(gUnicode[gNum], HEX); Serial.print(", gHeight = "); Serial.println(gHeight[gNum]);
|
||||
//Serial.print("Unicode = 0x"); Serial.print(gUnicode[gNum], HEX); Serial.print(", gWidth = "); Serial.println(gWidth[gNum]);
|
||||
//Serial.print("Unicode = 0x"); Serial.print(gUnicode[gNum], HEX); Serial.print(", gxAdvance = "); Serial.println(gxAdvance[gNum]);
|
||||
//Serial.print("Unicode = 0x"); Serial.print(gUnicode[gNum], HEX); Serial.print(", gdY = "); Serial.println(gdY[gNum]);
|
||||
|
||||
// Different glyph sets have different ascent values not always based on "d", so we could get
|
||||
// the maximum glyph ascent by checking all characters. BUT this method can generate bad values
|
||||
// for non-existant glyphs, so we will reply on processing for the value and disable this code for now...
|
||||
/*
|
||||
if (gdY[gNum] > gFont.maxAscent)
|
||||
{
|
||||
// Avoid UTF coding values and characters that tend to give duff values
|
||||
if (((gUnicode[gNum] > 0x20) && (gUnicode[gNum] < 0xA0) && (gUnicode[gNum] != 0x7F)) || (gUnicode[gNum] > 0xFF))
|
||||
// Try to avoid UTF coding values and characters that tend to give duff values
|
||||
if (((gUnicode[gNum] > 0x20) && (gUnicode[gNum] < 0x7F)) || (gUnicode[gNum] > 0xA0))
|
||||
{
|
||||
gFont.maxAscent = gdY[gNum];
|
||||
#ifdef SHOW_ASCENT_DESCENT
|
||||
|
|
@ -153,6 +193,7 @@ void TFT_eSPI::loadMetrics(uint16_t gCount)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Different glyph sets have different descent values not always based on "p", so get maximum glyph descent
|
||||
if (((int16_t)gHeight[gNum] - (int16_t)gdY[gNum]) > gFont.maxDescent)
|
||||
|
|
@ -240,6 +281,7 @@ void TFT_eSPI::unloadFont( void )
|
|||
** Function name: decodeUTF8
|
||||
** Description: Line buffer UTF-8 decoder with fall-back to extended ASCII
|
||||
*************************************************************************************x*/
|
||||
/* Function moved to TFT_eSPI.cpp
|
||||
#define DECODE_UTF8
|
||||
uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
||||
{
|
||||
|
|
@ -267,20 +309,26 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
|||
|
||||
return c; // fall-back to extended ASCII
|
||||
}
|
||||
*/
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: decodeUTF8
|
||||
** Description: Serial UTF-8 decoder with fall-back to extended ASCII
|
||||
*************************************************************************************x*/
|
||||
/* Function moved to TFT_eSPI.cpp
|
||||
uint16_t TFT_eSPI::decodeUTF8(uint8_t c)
|
||||
{
|
||||
|
||||
#ifdef DECODE_UTF8
|
||||
|
||||
// 7 bit Unicode
|
||||
if ((c & 0x80) == 0x00) {
|
||||
decoderState = 0;
|
||||
return (uint16_t)c;
|
||||
}
|
||||
|
||||
if (decoderState == 0)
|
||||
{
|
||||
// 7 bit Unicode
|
||||
if ((c & 0x80) == 0x00) return (uint16_t)c;
|
||||
|
||||
// 11 bit Unicode
|
||||
if ((c & 0xE0) == 0xC0)
|
||||
{
|
||||
|
|
@ -316,8 +364,10 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t c)
|
|||
}
|
||||
#endif
|
||||
|
||||
decoderState = 0;
|
||||
return (uint16_t)c; // fall-back to extended ASCII
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
|
@ -424,15 +474,29 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
|||
|
||||
uint8_t pbuffer[gWidth[gNum]];
|
||||
|
||||
uint16_t xs = 0;
|
||||
int16_t xs = 0;
|
||||
uint32_t dl = 0;
|
||||
|
||||
int16_t cy = cursor_y + gFont.maxAscent - gdY[gNum];
|
||||
int16_t cx = cursor_x + gdX[gNum];
|
||||
|
||||
startWrite(); // Avoid slow ESP32 transaction overhead for every pixel
|
||||
|
||||
for (int y = 0; y < gHeight[gNum]; y++)
|
||||
{
|
||||
fontFile.read(pbuffer, gWidth[gNum]); //<//
|
||||
if (spiffs)
|
||||
{
|
||||
fontFile.read(pbuffer, gWidth[gNum]);
|
||||
//Serial.println("SPIFFS");
|
||||
}
|
||||
else
|
||||
{
|
||||
endWrite(); // Release SPI for SD card transaction
|
||||
fontFile.read(pbuffer, gWidth[gNum]);
|
||||
startWrite(); // Re-start SPI for TFT transaction
|
||||
//Serial.println("Not SPIFFS");
|
||||
}
|
||||
|
||||
for (int x = 0; x < gWidth[gNum]; x++)
|
||||
{
|
||||
uint8_t pixel = pbuffer[x]; //<//
|
||||
|
|
@ -462,6 +526,7 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
|||
}
|
||||
|
||||
cursor_x += gxAdvance[gNum];
|
||||
endWrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -469,7 +534,6 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
|||
drawRect(cursor_x, cursor_y + gFont.maxAscent - gFont.ascent, gFont.spaceWidth, gFont.ascent, fg);
|
||||
cursor_x += gFont.spaceWidth + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
|
|
@ -479,7 +543,6 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
|||
void TFT_eSPI::showFont(uint32_t td)
|
||||
{
|
||||
if(!fontLoaded) return;
|
||||
// fontFile = SPIFFS.open( _gFontFilename, "r" );
|
||||
|
||||
if(!fontFile)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,21 +4,18 @@
|
|||
public:
|
||||
|
||||
// These are for the new antialiased fonts
|
||||
void loadFont(String fontName);
|
||||
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 decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining);
|
||||
uint16_t decodeUTF8(uint8_t c);
|
||||
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
|
||||
void drawGlyph(uint16_t code);
|
||||
virtual void drawGlyph(uint16_t code);
|
||||
|
||||
void showFont(uint32_t td);
|
||||
|
||||
fs::File fontFile;
|
||||
|
||||
// This is for the whole font
|
||||
// This is for the whole font
|
||||
typedef struct
|
||||
{
|
||||
uint16_t gCount; // Total number of characters
|
||||
|
|
@ -37,18 +34,17 @@ fontMetrics gFont = { 0, 0, 0, 0, 0, 0, 0 };
|
|||
uint8_t* gHeight = NULL; //cheight
|
||||
uint8_t* gWidth = NULL; //cwidth
|
||||
uint8_t* gxAdvance = NULL; //setWidth
|
||||
int8_t* gdY = NULL; //topExtent
|
||||
int16_t* gdY = NULL; //topExtent
|
||||
int8_t* gdX = NULL; //leftExtent
|
||||
uint32_t* gBitmap = NULL; //file pointer to greyscale bitmap
|
||||
|
||||
String _gFontFilename;
|
||||
|
||||
uint8_t decoderState = 0; // UTF8 decoder state
|
||||
uint16_t decoderBuffer; // Unicode code-point buffer
|
||||
|
||||
bool fontLoaded = false; // Flags when a anti-aliased font is loaded
|
||||
fs::File fontFile;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void loadMetrics(uint16_t gCount);
|
||||
uint32_t readInt32(void);
|
||||
|
||||
fs::FS &fontFS = SPIFFS;
|
||||
bool spiffs = true;
|
||||
|
|
@ -33,6 +33,9 @@ TFT_eSprite::TFT_eSprite(TFT_eSPI *tft)
|
|||
_xptr = 0; // pushColor coordinate
|
||||
_yptr = 0;
|
||||
|
||||
_xpivot = 0;
|
||||
_ypivot = 0;
|
||||
|
||||
this->cursor_y = this->cursor_x = 0; // Text cursor position
|
||||
}
|
||||
|
||||
|
|
@ -62,33 +65,61 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
|||
_sh = h;
|
||||
_scolor = TFT_BLACK;
|
||||
|
||||
_xpivot = w/2;
|
||||
_ypivot = h/2;
|
||||
|
||||
_img8 = (uint8_t*) callocSprite(w, h, frames);
|
||||
_img8_1 = _img8;
|
||||
_img8_2 = _img8;
|
||||
_img = (uint16_t*) _img8;
|
||||
|
||||
// This is to make it clear what pointer size is expected to be used
|
||||
// but casting in the user sketch is needed due to the use of void*
|
||||
if (_bpp == 1)
|
||||
{
|
||||
w = (w+7) & 0xFFF8;
|
||||
_img8_2 = _img8 + ( (w>>3) * h + 1 );
|
||||
}
|
||||
|
||||
if (_img8)
|
||||
{
|
||||
_created = true;
|
||||
return _img8;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: callocSprite
|
||||
** Description: Allocate a memory area for the Sprite and return pointer
|
||||
*************************************************************************************x*/
|
||||
|
||||
void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
{
|
||||
// Add one extra "off screen" pixel to point out-of-bounds setWindow() coordinates
|
||||
// this means push/writeColor functions do not need additional bounds checks and
|
||||
// hence will run faster in normal circumstances.
|
||||
uint8_t* ptr8 = NULL;
|
||||
|
||||
if (_bpp == 16)
|
||||
{
|
||||
_img8_1 = ( uint8_t*) calloc(w * h + 1, sizeof(uint16_t));
|
||||
_img8_2 = _img8_1;
|
||||
_img = (uint16_t*) _img8_1;
|
||||
|
||||
if (_img)
|
||||
{
|
||||
_created = true;
|
||||
return _img;
|
||||
}
|
||||
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||
if ( psramFound() ) ptr8 = ( uint8_t*) ps_calloc(w * h + 1, sizeof(uint16_t));
|
||||
else
|
||||
#endif
|
||||
ptr8 = ( uint8_t*) calloc(w * h + 1, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
else if (_bpp == 8)
|
||||
{
|
||||
_img8_1 = ( uint8_t*) calloc(w * h + 1, sizeof(uint8_t));
|
||||
|
||||
if (_img8_1)
|
||||
{
|
||||
_img8 = _img8_1;
|
||||
_img8_2 = _img8_1;
|
||||
_created = true;
|
||||
return _img8;
|
||||
}
|
||||
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||
if ( psramFound() ) ptr8 = ( uint8_t*) ps_calloc(w * h + 1, sizeof(uint8_t));
|
||||
else
|
||||
#endif
|
||||
ptr8 = ( uint8_t*) calloc(w * h + 1, sizeof(uint8_t));
|
||||
}
|
||||
|
||||
else // Must be 1 bpp
|
||||
|
|
@ -103,18 +134,14 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
|||
|
||||
if (frames > 2) frames = 2; // Currently restricted to 2 frame buffers
|
||||
if (frames < 1) frames = 1;
|
||||
_img8 = ( uint8_t*) calloc(frames * (w>>3) * h + frames, sizeof(uint8_t)); // extra pixel added
|
||||
|
||||
if (_img8)
|
||||
{
|
||||
_created = true;
|
||||
_img8_1 = _img8;
|
||||
_img8_2 = _img8 + ( (w>>3) * h + 1 );
|
||||
return _img8_1;
|
||||
}
|
||||
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||
if ( psramFound() ) ptr8 = ( uint8_t*) ps_calloc(frames * (w>>3) * h + frames, sizeof(uint8_t));
|
||||
else
|
||||
#endif
|
||||
ptr8 = ( uint8_t*) calloc(frames * (w>>3) * h + frames, sizeof(uint8_t));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
return ptr8;
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
|
|
@ -137,8 +164,8 @@ void* TFT_eSprite::frameBuffer(int8_t f)
|
|||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: setDepth
|
||||
** Description: Set bits per pixel for colour (8 or 16)
|
||||
** Function name: setColorDepth
|
||||
** Description: Set bits per pixel for colour (1, 8 or 16)
|
||||
*************************************************************************************x*/
|
||||
|
||||
void* TFT_eSprite::setColorDepth(int8_t b)
|
||||
|
|
@ -161,6 +188,19 @@ void* TFT_eSprite::setColorDepth(int8_t b)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: getColorDepth
|
||||
** Description: Get bits per pixel for colour (1, 8 or 16)
|
||||
*************************************************************************************x*/
|
||||
|
||||
int8_t TFT_eSprite::getColorDepth(void)
|
||||
{
|
||||
if (_created) return _bpp;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: setBitmapColor
|
||||
** Description: Set the foreground foreground and background colour
|
||||
|
|
@ -187,6 +227,235 @@ void TFT_eSprite::deleteSprite(void)
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: setPivot
|
||||
** Description: Set the pivot point in this Sprite
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSprite::setPivot(int16_t x, int16_t y)
|
||||
{
|
||||
_xpivot = x;
|
||||
_ypivot = y;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: getPivotX
|
||||
** Description: Get the x pivot position
|
||||
***************************************************************************************/
|
||||
int16_t TFT_eSprite::getPivotX(void)
|
||||
{
|
||||
return _xpivot;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: getPivotY
|
||||
** Description: Get the y pivot position
|
||||
***************************************************************************************/
|
||||
int16_t TFT_eSprite::getPivotY(void)
|
||||
{
|
||||
return _ypivot;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushRotated
|
||||
** Description: Push a rotated copy of the Sprite to TFT screen
|
||||
*************************************************************************************x*/
|
||||
bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
|
||||
{
|
||||
if ( !_created ) return false;
|
||||
|
||||
// Trig values for the rotation
|
||||
float radAngle = -angle * 0.0174532925; // Convert degrees to radians
|
||||
float sinra = sin(radAngle);
|
||||
float cosra = cos(radAngle);
|
||||
|
||||
// Bounding box parameters
|
||||
int16_t min_x;
|
||||
int16_t min_y;
|
||||
int16_t max_x;
|
||||
int16_t max_y;
|
||||
|
||||
// Get the bounding box of this rotated source Sprite relative to Sprite pivot
|
||||
getRotatedBounds(sinra, cosra, width(), height(), _xpivot, _ypivot, &min_x, &min_y, &max_x, &max_y);
|
||||
|
||||
// Move bounding box so source Sprite pivot coincides with TFT pivot
|
||||
min_x += _tft->_xpivot;
|
||||
max_x += _tft->_xpivot;
|
||||
min_y += _tft->_ypivot;
|
||||
max_y += _tft->_ypivot;
|
||||
|
||||
// Test only to show bounding box on TFT
|
||||
// _tft->drawRect(min_x, min_y, max_x - min_x + 1, max_y - min_y + 1, TFT_GREEN);
|
||||
|
||||
// Return if bounding box is outside of TFT area
|
||||
if (min_x > _tft->width()) return true;
|
||||
if (min_y > _tft->height()) return true;
|
||||
if (max_x < 0) return true;
|
||||
if (max_y < 0) return true;
|
||||
|
||||
// Clip bounding box to be within TFT area
|
||||
if (min_x < 0) min_x = 0;
|
||||
if (min_y < 0) min_y = 0;
|
||||
if (max_x > _tft->width()) max_x = _tft->width();
|
||||
if (max_y > _tft->height()) max_y = _tft->height();
|
||||
|
||||
_tft->startWrite(); // ESP32: avoid transaction overhead for every tft pixel
|
||||
|
||||
// Scan destination bounding box and fetch transformed pixels from source Sprite
|
||||
for (int32_t x = min_x; x <= max_x; x++) {
|
||||
int32_t xt = x - _tft->_xpivot;
|
||||
float cxt = cosra * xt + _xpivot;
|
||||
float sxt = sinra * xt + _ypivot;
|
||||
bool column_drawn = false;
|
||||
for (int32_t y = min_y; y <= max_y; y++) {
|
||||
int32_t yt = y - _tft->_ypivot;
|
||||
int32_t xs = (int32_t)round(cxt - sinra * yt);
|
||||
// Do not calculate ys unless xs is in bounds
|
||||
if (xs >= 0 && xs < width())
|
||||
{
|
||||
int32_t ys = (int32_t)round(sxt + cosra * yt);
|
||||
// Check if ys is in bounds
|
||||
if (ys >= 0 && ys < height()) {
|
||||
int32_t rp = readPixel(xs, ys);
|
||||
if (rp != transp) _tft->drawPixel(x, y, rp);
|
||||
column_drawn = true;
|
||||
}
|
||||
}
|
||||
else if (column_drawn) y = max_y; // Skip remaining column pixels
|
||||
}
|
||||
}
|
||||
|
||||
_tft->endWrite(); // ESP32: end transaction
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushRotated
|
||||
** Description: Push a rotated copy of the Sprite to another Sprite
|
||||
*************************************************************************************x*/
|
||||
bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
|
||||
{
|
||||
if ( !_created ) return false; // Check this Sprite is created
|
||||
if ( !spr->_created ) return false; // Ckeck destination Sprite is created
|
||||
|
||||
// Trig values for the rotation
|
||||
float radAngle = -angle * 0.0174532925; // Convert degrees to radians
|
||||
float sinra = sin(radAngle);
|
||||
float cosra = cos(radAngle);
|
||||
|
||||
// Bounding box parameters
|
||||
int16_t min_x;
|
||||
int16_t min_y;
|
||||
int16_t max_x;
|
||||
int16_t max_y;
|
||||
|
||||
// Get the bounding box of this rotated source Sprite
|
||||
getRotatedBounds(sinra, cosra, width(), height(), _xpivot, _ypivot, &min_x, &min_y, &max_x, &max_y);
|
||||
|
||||
// Move bounding box so source Sprite pivot coincides with destination Sprite pivot
|
||||
min_x += spr->_xpivot;
|
||||
max_x += spr->_xpivot;
|
||||
min_y += spr->_ypivot;
|
||||
max_y += spr->_ypivot;
|
||||
|
||||
// Test only to show bounding box
|
||||
// spr->fillSprite(TFT_BLACK);
|
||||
// spr->drawRect(min_x, min_y, max_x - min_x + 1, max_y - min_y + 1, TFT_GREEN);
|
||||
|
||||
// Return if bounding box is completely outside of destination Sprite
|
||||
if (min_x > spr->width()) return true;
|
||||
if (min_y > spr->height()) return true;
|
||||
if (max_x < 0) return true;
|
||||
if (max_y < 0) return true;
|
||||
|
||||
// Clip bounding box if it is partially within destination Sprite
|
||||
if (min_x < 0) min_x = 0;
|
||||
if (min_y < 0) min_y = 0;
|
||||
if (max_x > spr->width()) max_x = spr->width();
|
||||
if (max_y > spr->height()) max_y = spr->height();
|
||||
|
||||
// Scan destination bounding box and fetch transformed pixels from source Sprite
|
||||
for (int32_t x = min_x; x <= max_x; x++)
|
||||
{
|
||||
int32_t xt = x - spr->_xpivot;
|
||||
float cxt = cosra * xt + _xpivot;
|
||||
float sxt = sinra * xt + _ypivot;
|
||||
bool column_drawn = false;
|
||||
for (int32_t y = min_y; y <= max_y; y++)
|
||||
{
|
||||
int32_t yt = y - spr->_ypivot;
|
||||
int32_t xs = (int32_t)round(cxt - sinra * yt);
|
||||
// Do not calculate ys unless xs is in bounds
|
||||
if (xs >= 0 && xs < width())
|
||||
{
|
||||
int32_t ys = (int32_t)round(sxt + cosra * yt);
|
||||
// Check if ys is in bounds
|
||||
if (ys >= 0 && ys < height())
|
||||
{
|
||||
int32_t rp = readPixel(xs, ys);
|
||||
if (rp != transp) spr->drawPixel(x, y, rp);
|
||||
column_drawn = true;
|
||||
}
|
||||
}
|
||||
else if (column_drawn) y = max_y; // Skip the remaining pixels below the Sprite
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: rotatedBounds
|
||||
** Description: Get bounding box of a rotated Sprite wrt pivot
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSprite::getRotatedBounds(float sina, float cosa, int16_t w, int16_t h, int16_t xp, int16_t yp,
|
||||
int16_t *min_x, int16_t *min_y, int16_t *max_x, int16_t *max_y)
|
||||
{
|
||||
w -= xp; // w is now right edge coordinate relative to xp
|
||||
h -= yp; // h is now bottom edge coordinate relative to yp
|
||||
|
||||
// Calculate new corner coordinates
|
||||
int16_t x0 = -xp * cosa - yp * sina;
|
||||
int16_t y0 = xp * sina - yp * cosa;
|
||||
|
||||
int16_t x1 = w * cosa - yp * sina;
|
||||
int16_t y1 = -w * sina - yp * cosa;
|
||||
|
||||
int16_t x2 = h * sina + w * cosa;
|
||||
int16_t y2 = h * cosa - w * sina;
|
||||
|
||||
int16_t x3 = h * sina - xp * cosa;
|
||||
int16_t y3 = h * cosa + xp * sina;
|
||||
|
||||
// Find bounding box extremes, enlarge box to accomodate rounding errors
|
||||
*min_x = x0-2;
|
||||
if (x1 < *min_x) *min_x = x1-2;
|
||||
if (x2 < *min_x) *min_x = x2-2;
|
||||
if (x3 < *min_x) *min_x = x3-2;
|
||||
|
||||
*max_x = x0+2;
|
||||
if (x1 > *max_x) *max_x = x1+2;
|
||||
if (x2 > *max_x) *max_x = x2+2;
|
||||
if (x3 > *max_x) *max_x = x3+2;
|
||||
|
||||
*min_y = y0-2;
|
||||
if (y1 < *min_y) *min_y = y1-2;
|
||||
if (y2 < *min_y) *min_y = y2-2;
|
||||
if (y3 < *min_y) *min_y = y3-2;
|
||||
|
||||
*max_y = y0+2;
|
||||
if (y1 > *max_y) *max_y = y1+2;
|
||||
if (y2 > *max_y) *max_y = y2+2;
|
||||
if (y3 > *max_y) *max_y = y3+2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushSprite
|
||||
** Description: Push the sprite to the TFT at x, y
|
||||
|
|
@ -198,7 +467,6 @@ void TFT_eSprite::pushSprite(int32_t x, int32_t y)
|
|||
if (_bpp == 16) _tft->pushImage(x, y, _iwidth, _iheight, _img );
|
||||
|
||||
else _tft->pushImage(x, y, _dwidth, _dheight, _img8, (bool)(_bpp == 8));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -275,33 +543,54 @@ uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y)
|
|||
** Function name: pushImage
|
||||
** Description: push 565 colour image into a defined area of a sprite
|
||||
*************************************************************************************x*/
|
||||
// TODO Need to add more area boundary checks
|
||||
void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, uint16_t *data)
|
||||
void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data)
|
||||
{
|
||||
if ((x >= _iwidth) || (y >= _iheight) || (w == 0) || (h == 0) || !_created) return;
|
||||
if ((x + w < 0) || (y + h < 0)) return;
|
||||
|
||||
if (_bpp == 16)
|
||||
int32_t xo = 0;
|
||||
int32_t yo = 0;
|
||||
|
||||
int32_t xs = x;
|
||||
int32_t ys = y;
|
||||
|
||||
uint32_t ws = w;
|
||||
uint32_t hs = h;
|
||||
|
||||
if (x < 0) { xo = -x; xs = 0; }
|
||||
if (y < 0) { yo = -y; ys = 0; }
|
||||
|
||||
if (xs + w >= _iwidth) ws = _iwidth - xs;
|
||||
if (ys + h >= _iheight) hs = _iheight - ys;
|
||||
|
||||
if (_bpp == 16) // Plot a 16 bpp image into a 16 bpp Sprite
|
||||
{
|
||||
for (uint32_t yp = y; yp < y + h; yp++)
|
||||
for (uint32_t yp = yo; yp < yo + hs; yp++)
|
||||
{
|
||||
for (uint32_t xp = x; xp < x + w; xp++)
|
||||
x = xs;
|
||||
for (uint32_t xp = xo; xp < xo + ws; xp++)
|
||||
{
|
||||
uint16_t color = *data++;
|
||||
uint16_t color = data[xp + yp * w];
|
||||
if(!_iswapBytes) color = color<<8 | color>>8;
|
||||
_img[xp + yp * _iwidth] = color;
|
||||
_img[x + ys * _iwidth] = color;
|
||||
x++;
|
||||
}
|
||||
ys++;
|
||||
}
|
||||
}
|
||||
else if (_bpp == 8)
|
||||
else if (_bpp == 8) // Plot a 16 bpp image into a 8 bpp Sprite
|
||||
{
|
||||
for (uint32_t yp = y; yp < y + h; yp++)
|
||||
for (uint32_t yp = yo; yp < yo + hs; yp++)
|
||||
{
|
||||
for (uint32_t xp = x; xp < x + w; xp++)
|
||||
x = xs;
|
||||
for (uint32_t xp = xo; xp < xo + ws; xp++)
|
||||
{
|
||||
uint16_t color = *data++;
|
||||
uint16_t color = data[xp + yp * w];
|
||||
if(_iswapBytes) color = color<<8 | color>>8;
|
||||
_img8[xp + yp * _iwidth] = (uint8_t)((color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3);
|
||||
_img8[x + ys * _iwidth] = (uint8_t)((color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3);
|
||||
x++;
|
||||
}
|
||||
ys++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -325,18 +614,17 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, uint1
|
|||
x = y;
|
||||
y = _dheight - tx - 1;
|
||||
}
|
||||
|
||||
uint8_t* pdata = (uint8_t*) data;
|
||||
// Plot a 1bpp image into a 1bpp Sprite
|
||||
uint8_t* pdata = (uint8_t* ) data;
|
||||
uint32_t ww = (w+7) & 0xFFF8;
|
||||
for (int32_t yp = 0; yp<h; yp++)
|
||||
{
|
||||
for (int32_t xp = 0; xp<ww; xp+=8)
|
||||
uint32_t yw = (yp * ww)>>3;
|
||||
uint32_t yyp = y + yp;
|
||||
for (int32_t xp = 0; xp<w; xp++)
|
||||
{
|
||||
uint8_t pbyte = *pdata++;
|
||||
for (uint8_t xc = 0; xc < 8; xc++)
|
||||
{
|
||||
if (xp+xc<w) drawPixel(x+xp+xc, y+yp, (pbyte<<xc) & 0x80);
|
||||
}
|
||||
uint16_t readPixel = (pdata[(xp>>3) + yw] & (0x80 >> (xp & 0x7)) );
|
||||
drawPixel(x+xp, yyp, readPixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -347,34 +635,59 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, uint1
|
|||
** Function name: pushImage
|
||||
** Description: push 565 colour FLASH (PROGMEM) image into a defined area
|
||||
*************************************************************************************x*/
|
||||
// TODO Need to add more area boundary checks
|
||||
void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, const uint16_t *data)
|
||||
void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data)
|
||||
{
|
||||
#ifdef ESP32
|
||||
pushImage(x, y, w, h, (uint16_t*) data);
|
||||
#else
|
||||
// Partitioned memory FLASH processor
|
||||
if ((x >= _iwidth) || (y >= _iheight) || (w == 0) || (h == 0) || !_created) return;
|
||||
if ((x + w < 0) || (y + h < 0)) return;
|
||||
|
||||
if (_bpp == 16)
|
||||
int32_t xo = 0;
|
||||
int32_t yo = 0;
|
||||
|
||||
int32_t xs = x;
|
||||
int32_t ys = y;
|
||||
|
||||
uint32_t ws = w;
|
||||
uint32_t hs = h;
|
||||
|
||||
if (x < 0) { xo = -x; xs = 0; }
|
||||
if (y < 0) { yo = -y; ys = 0; }
|
||||
|
||||
if (xs + w >= _iwidth) ws = _iwidth - xs;
|
||||
if (ys + h >= _iheight) hs = _iheight - ys;
|
||||
|
||||
if (_bpp == 16) // Plot a 16 bpp image into a 16 bpp Sprite
|
||||
{
|
||||
for (uint32_t yp = y; yp < y + h; yp++)
|
||||
for (uint32_t yp = yo; yp < yo + hs; yp++)
|
||||
{
|
||||
for (uint32_t xp = x; xp < x + w; xp++)
|
||||
x = xs;
|
||||
for (uint32_t xp = xo; xp < xo + ws; xp++)
|
||||
{
|
||||
uint16_t color = pgm_read_word(data++);
|
||||
uint16_t color = pgm_read_word(data + xp + yp * w);
|
||||
if(!_iswapBytes) color = color<<8 | color>>8;
|
||||
_img[xp + yp * _iwidth] = color;
|
||||
_img[x + ys * _iwidth] = color;
|
||||
x++;
|
||||
}
|
||||
ys++;
|
||||
}
|
||||
}
|
||||
|
||||
else if (_bpp == 8)
|
||||
else if (_bpp == 8) // Plot a 16 bpp image into a 8 bpp Sprite
|
||||
{
|
||||
for (uint32_t yp = y; yp < y + h; yp++)
|
||||
for (uint32_t yp = yo; yp < yo + hs; yp++)
|
||||
{
|
||||
for (uint32_t xp = x; xp < x + w; xp++)
|
||||
x = xs;
|
||||
for (uint32_t xp = xo; xp < xo + ws; xp++)
|
||||
{
|
||||
uint16_t color = pgm_read_word(data++);
|
||||
uint16_t color = pgm_read_word(data + xp + yp * w);
|
||||
if(_iswapBytes) color = color<<8 | color>>8;
|
||||
_img8[xp + yp * _iwidth] = (uint8_t)((color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3);
|
||||
_img8[x + ys * _iwidth] = (uint8_t)((color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3);
|
||||
x++;
|
||||
}
|
||||
ys++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +711,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, const
|
|||
x = y;
|
||||
y = _dheight - tx - 1;
|
||||
}
|
||||
|
||||
// Plot a 1bpp image into a 1bpp Sprite
|
||||
const uint8_t* pdata = (const uint8_t* ) data;
|
||||
uint32_t ww = (w+7) & 0xFFF8;
|
||||
for (int32_t yp = 0; yp<h; yp++)
|
||||
|
|
@ -413,6 +726,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, const
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // if ESP32 else ESP8266 check
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -563,7 +877,7 @@ void TFT_eSprite::writeColor(uint16_t color)
|
|||
** Function name: setScrollRect
|
||||
** Description: Set scroll area within the sprite and the gap fill colour
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSprite::setScrollRect(int32_t x, int32_t y, uint32_t w, uint32_t h, uint16_t color)
|
||||
void TFT_eSprite::setScrollRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t color)
|
||||
{
|
||||
if ((x >= _iwidth) || (y >= _iheight) || !_created ) return;
|
||||
|
||||
|
|
@ -643,7 +957,21 @@ void TFT_eSprite::scroll(int16_t dx, int16_t dy)
|
|||
fyp += iw;
|
||||
}
|
||||
}
|
||||
else return; // TODO add scroll for 1 bpp
|
||||
else if (_bpp == 1)
|
||||
{
|
||||
if (dx > 0) { tx += w; fx += w; } // Start from right edge
|
||||
while (h--)
|
||||
{ // move pixels one by one
|
||||
for (uint16_t xp = 0; xp < w; xp++)
|
||||
{
|
||||
if (dx <= 0) drawPixel(tx + xp, ty, readPixel(fx + xp, fy));
|
||||
if (dx > 0) drawPixel(tx - xp, ty, readPixel(fx - xp, fy));
|
||||
}
|
||||
if (dy <= 0) { ty++; fy++; }
|
||||
else { ty--; fy--; }
|
||||
}
|
||||
}
|
||||
else return; // Not 1, 8 or 16 bpp
|
||||
|
||||
// Fill the gap left by the scrolling
|
||||
if (dx > 0) fillRect(_sx, _sy, dx, _sh, _scolor);
|
||||
|
|
@ -704,7 +1032,7 @@ int16_t TFT_eSprite::width(void)
|
|||
|
||||
if (_rotation == 1 || _rotation == 3) return _dheight;
|
||||
|
||||
return _bitwidth;
|
||||
return _dwidth;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -731,6 +1059,8 @@ int16_t TFT_eSprite::height(void)
|
|||
// Does nothing for 8 and 16 bpp sprites. TODO allow rotation of these sprites
|
||||
void TFT_eSprite::setRotation(uint8_t rotation)
|
||||
{
|
||||
if (_bpp != 1) return;
|
||||
|
||||
_rotation = rotation;
|
||||
if (rotation == 0 && _iwidth > _iheight) swap_coord(_iwidth, _iheight);
|
||||
if (rotation == 1 && _iwidth < _iheight) swap_coord(_iwidth, _iheight);
|
||||
|
|
@ -754,23 +1084,25 @@ uint8_t TFT_eSprite::getRotation(void)
|
|||
** Function name: drawPixel
|
||||
** Description: push a single pixel at an arbitrary position
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSprite::drawPixel(uint32_t x, uint32_t y, uint32_t color)
|
||||
void TFT_eSprite::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
{
|
||||
// x and y are unsigned so that -ve coordinates turn into large positive ones
|
||||
// this make bounds checking a bit faster
|
||||
if ((x >= _iwidth) || (y >= _iheight) || !_created) return;
|
||||
// Range checking
|
||||
if ((x < 0) || (y < 0) || !_created) return;
|
||||
|
||||
if (_bpp == 16)
|
||||
{
|
||||
if ((x >= _iwidth) || (y >= _iheight)) return;
|
||||
color = (color >> 8) | (color << 8);
|
||||
_img[x+y*_iwidth] = (uint16_t) color;
|
||||
}
|
||||
else if (_bpp == 8)
|
||||
{
|
||||
if ((x >= _iwidth) || (y >= _iheight)) return;
|
||||
_img8[x+y*_iwidth] = (uint8_t)((color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3);
|
||||
}
|
||||
else // 1 bpp
|
||||
{
|
||||
if ((x >= _dwidth) || (y >= _dheight)) return;
|
||||
if (_rotation == 1)
|
||||
{
|
||||
uint16_t tx = x;
|
||||
|
|
@ -932,11 +1264,14 @@ void TFT_eSprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t
|
|||
{
|
||||
if (!_created ) return;
|
||||
|
||||
if ((x >= _iwidth) || (y >= _iheight)) return;
|
||||
|
||||
if (x < 0) { w += x; x = 0; }
|
||||
if (y < 0) { h += y; y = 0; }
|
||||
|
||||
if ((x < 0) || (y < 0) || (x >= _iwidth) || (y >= _iheight)) return;
|
||||
if ((x + w) > _iwidth) w = _iwidth - x;
|
||||
if ((y + h) > _iheight) h = _iheight - y;
|
||||
|
||||
if ((w < 1) || (h < 1)) return;
|
||||
|
||||
int32_t yp = _iwidth * y + x;
|
||||
|
|
@ -982,13 +1317,16 @@ void TFT_eSprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t
|
|||
*************************************************************************************x*/
|
||||
size_t TFT_eSprite::write(uint8_t utf8)
|
||||
{
|
||||
uint16_t uniCode = decodeUTF8(utf8);
|
||||
|
||||
if (!uniCode) return 1;
|
||||
|
||||
if (utf8 == '\r') return 1;
|
||||
|
||||
#ifdef SMOOTH_FONT
|
||||
if(this->fontLoaded)
|
||||
{
|
||||
uint16_t unicode = decodeUTF8(utf8);
|
||||
if (unicode < 32 && utf8 != '\n') return 0;
|
||||
if (uniCode < 32 && utf8 != '\n') return 1;
|
||||
|
||||
//fontFile = SPIFFS.open( _gFontFilename, "r" );
|
||||
//fontFile = SPIFFS.open( this->_gFontFilename, "r" );
|
||||
|
|
@ -996,22 +1334,21 @@ size_t TFT_eSprite::write(uint8_t utf8)
|
|||
//if(!fontFile)
|
||||
//{
|
||||
// fontLoaded = false;
|
||||
// return 0;
|
||||
// return 1;
|
||||
//}
|
||||
//Serial.print("Decoded Unicode = 0x");Serial.println(unicode,HEX);
|
||||
|
||||
drawGlyph(unicode);
|
||||
drawGlyph(uniCode);
|
||||
|
||||
//fontFile.close();
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!_created ) return 0;
|
||||
if (!_created ) return 1;
|
||||
|
||||
|
||||
uint8_t uniCode = utf8; // Work with a copy
|
||||
if (utf8 == '\n') uniCode+=22; // Make it a valid space character to stop errors
|
||||
else if (utf8 < 32) return 0;
|
||||
if (uniCode == '\n') uniCode+=22; // Make it a valid space character to stop errors
|
||||
else if (uniCode < 32) return 1;
|
||||
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
|
|
@ -1031,8 +1368,8 @@ size_t TFT_eSprite::write(uint8_t utf8)
|
|||
#ifdef LOAD_FONT2
|
||||
if (textfont == 2)
|
||||
{
|
||||
if (utf8 > 127) return 0;
|
||||
// This is 20us faster than using the fontdata structure (0.443ms per character instead of 0.465ms)
|
||||
if (utf8 > 127) return 1;
|
||||
|
||||
width = pgm_read_byte(widtbl_f16 + uniCode-32);
|
||||
height = chr_hgt_f16;
|
||||
// Font 2 is rendered in whole byte widths so we must allow for this
|
||||
|
|
@ -1048,9 +1385,8 @@ size_t TFT_eSprite::write(uint8_t utf8)
|
|||
{
|
||||
if ((textfont>2) && (textfont<9))
|
||||
{
|
||||
if (utf8 > 127) return 0;
|
||||
if (utf8 > 127) return 1;
|
||||
// Uses the fontinfo struct array to avoid lots of 'if' or 'switch' statements
|
||||
// A tad slower than above but this is not significant and is more convenient for the RLE fonts
|
||||
width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[textfont].widthtbl ) ) + uniCode-32 );
|
||||
height= pgm_read_byte( &fontdata[textfont].height );
|
||||
}
|
||||
|
|
@ -1064,7 +1400,7 @@ size_t TFT_eSprite::write(uint8_t utf8)
|
|||
height = 8;
|
||||
}
|
||||
#else
|
||||
if (textfont==1) return 0;
|
||||
if (textfont==1) return 1;
|
||||
#endif
|
||||
|
||||
height = height * textsize;
|
||||
|
|
@ -1090,15 +1426,14 @@ size_t TFT_eSprite::write(uint8_t utf8)
|
|||
} // Custom GFX font
|
||||
else
|
||||
{
|
||||
|
||||
if(utf8 == '\n') {
|
||||
this->cursor_x = 0;
|
||||
this->cursor_y += (int16_t)textsize * (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
} else {
|
||||
if (uniCode > (uint8_t)pgm_read_byte(&gfxFont->last )) return 0;
|
||||
if (uniCode < (uint8_t)pgm_read_byte(&gfxFont->first)) return 0;
|
||||
if (uniCode > pgm_read_word(&gfxFont->last )) return 1;
|
||||
if (uniCode < pgm_read_word(&gfxFont->first)) return 1;
|
||||
|
||||
uint8_t c2 = uniCode - pgm_read_byte(&gfxFont->first);
|
||||
uint8_t c2 = uniCode - pgm_read_word(&gfxFont->first);
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c2]);
|
||||
uint8_t w = pgm_read_byte(&glyph->width),
|
||||
h = pgm_read_byte(&glyph->height);
|
||||
|
|
@ -1126,7 +1461,7 @@ size_t TFT_eSprite::write(uint8_t utf8)
|
|||
** Function name: drawChar
|
||||
** Description: draw a single character in the Adafruit GLCD or freefont
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSprite::drawChar(int32_t x, int32_t y, unsigned char c, uint32_t color, uint32_t bg, uint8_t size)
|
||||
void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size)
|
||||
{
|
||||
if (!_created ) return;
|
||||
|
||||
|
|
@ -1136,6 +1471,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, unsigned char c, uint32_t color
|
|||
((y + 8 * size - 1) < 0)) // Clip top
|
||||
return;
|
||||
|
||||
if (c < 32) return;
|
||||
#ifdef LOAD_GLCD
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
#ifdef LOAD_GFXFF
|
||||
|
|
@ -1204,15 +1540,15 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, unsigned char c, uint32_t color
|
|||
|
||||
#ifdef LOAD_GFXFF
|
||||
// Filter out bad characters not present in font
|
||||
if ((c >= (uint8_t)pgm_read_byte(&gfxFont->first)) && (c <= (uint8_t)pgm_read_byte(&gfxFont->last )))
|
||||
if ((c >= pgm_read_word(&gfxFont->first)) && (c <= pgm_read_word(&gfxFont->last )))
|
||||
{
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
c -= pgm_read_byte(&gfxFont->first);
|
||||
c -= pgm_read_word(&gfxFont->first);
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c]);
|
||||
uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
|
||||
|
||||
uint16_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
uint8_t w = pgm_read_byte(&glyph->width),
|
||||
h = pgm_read_byte(&glyph->height);
|
||||
//xa = pgm_read_byte(&glyph->xAdvance);
|
||||
|
|
@ -1267,15 +1603,19 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, unsigned char c, uint32_t color
|
|||
** Function name: drawChar
|
||||
** Description: draw a unicode onto the screen
|
||||
*************************************************************************************x*/
|
||||
int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y)
|
||||
// Any UTF-8 decoding must be done before calling drawChar()
|
||||
int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y)
|
||||
{
|
||||
return drawChar(uniCode, x, y, textfont);
|
||||
}
|
||||
|
||||
int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y, int font)
|
||||
// Any UTF-8 decoding must be done before calling drawChar()
|
||||
int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
|
||||
{
|
||||
if (!_created ) return 0;
|
||||
|
||||
if (!uniCode) return 0;
|
||||
|
||||
if (font==1)
|
||||
{
|
||||
#ifdef LOAD_GLCD
|
||||
|
|
@ -1300,9 +1640,9 @@ int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y, int font)
|
|||
}
|
||||
else
|
||||
{
|
||||
if((uniCode >= pgm_read_byte(&gfxFont->first)) && (uniCode <= pgm_read_byte(&gfxFont->last) ))
|
||||
if((uniCode >= pgm_read_word(&gfxFont->first)) && (uniCode <= pgm_read_word(&gfxFont->last) ))
|
||||
{
|
||||
uint8_t c2 = uniCode - pgm_read_byte(&gfxFont->first);
|
||||
uint16_t c2 = uniCode - pgm_read_word(&gfxFont->first);
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c2]);
|
||||
return pgm_read_byte(&glyph->xAdvance) * textsize;
|
||||
}
|
||||
|
|
@ -1316,8 +1656,8 @@ int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y, int font)
|
|||
|
||||
if ((font>1) && (font<9) && ((uniCode < 32) || (uniCode > 127))) return 0;
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int32_t width = 0;
|
||||
int32_t height = 0;
|
||||
uint32_t flash_address = 0;
|
||||
uniCode -= 32;
|
||||
|
||||
|
|
@ -1346,9 +1686,9 @@ int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y, int font)
|
|||
}
|
||||
#endif
|
||||
|
||||
int w = width;
|
||||
int pX = 0;
|
||||
int pY = y;
|
||||
int32_t w = width;
|
||||
int32_t pX = 0;
|
||||
int32_t pY = y;
|
||||
uint8_t line = 0;
|
||||
|
||||
#ifdef LOAD_FONT2 // chop out code if we do not need it
|
||||
|
|
@ -1357,11 +1697,11 @@ int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y, int font)
|
|||
w = w / 8;
|
||||
if (x + width * textsize >= _iwidth) return width * textsize ;
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
for (int32_t i = 0; i < height; i++)
|
||||
{
|
||||
if (textcolor != textbgcolor) fillRect(x, pY, width * textsize, textsize, textbgcolor);
|
||||
|
||||
for (int k = 0; k < w; k++)
|
||||
for (int32_t k = 0; k < w; k++)
|
||||
{
|
||||
line = pgm_read_byte((uint8_t *)flash_address + w * i + k);
|
||||
if (line) {
|
||||
|
|
@ -1407,8 +1747,8 @@ int16_t TFT_eSprite::drawChar(unsigned int uniCode, int x, int y, int font)
|
|||
int16_t color = textcolor;
|
||||
if (_bpp == 16) color = (textcolor >> 8) | (textcolor << 8);
|
||||
else if (_bpp == 8) color = ((textcolor & 0xE000)>>8 | (textcolor & 0x0700)>>6 | (textcolor & 0x0018)>>3);
|
||||
int px = 0, py = pY; // To hold character block start and end column and row values
|
||||
int pc = 0; // Pixel count
|
||||
int32_t px = 0, py = pY; // To hold character block start and end column and row values
|
||||
int32_t pc = 0; // Pixel count
|
||||
uint8_t np = textsize * textsize; // Number of pixels in a drawn pixel
|
||||
uint8_t tnp = 0; // Temporary copy of np for while loop
|
||||
uint8_t ts = textsize - 1; // Temporary copy of textsize
|
||||
|
|
@ -1473,10 +1813,10 @@ void TFT_eSprite::drawGlyph(uint16_t code)
|
|||
if (code == '\n') {
|
||||
if (_created)
|
||||
{
|
||||
this->cursor_x = 0;
|
||||
this->cursor_y += this->gFont.yAdvance;
|
||||
if (this->cursor_y >= _height) this->cursor_y = 0;
|
||||
return;
|
||||
this->cursor_x = 0;
|
||||
this->cursor_y += this->gFont.yAdvance;
|
||||
if (this->cursor_y >= _height) this->cursor_y = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1511,13 +1851,13 @@ void TFT_eSprite::drawGlyph(uint16_t code)
|
|||
|
||||
uint8_t pbuffer[this->gWidth[gNum]];
|
||||
|
||||
uint16_t xs = 0;
|
||||
int16_t xs = 0;
|
||||
uint16_t dl = 0;
|
||||
|
||||
for (int y = 0; y < this->gHeight[gNum]; y++)
|
||||
for (int32_t y = 0; y < this->gHeight[gNum]; y++)
|
||||
{
|
||||
this->fontFile.read(pbuffer, this->gWidth[gNum]);
|
||||
for (int x = 0; x < this->gWidth[gNum]; x++)
|
||||
for (int32_t x = 0; x < this->gWidth[gNum]; x++)
|
||||
{
|
||||
uint8_t pixel = pbuffer[x];
|
||||
if (pixel)
|
||||
|
|
@ -1525,7 +1865,8 @@ void TFT_eSprite::drawGlyph(uint16_t code)
|
|||
if (pixel != 0xFF)
|
||||
{
|
||||
if (dl) { drawFastHLine( xs, y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], dl, fg); dl = 0; }
|
||||
if (pixel>127) drawPixel(x + this->cursor_x + this->gdX[gNum], y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], alphaBlend(pixel, fg, bg));
|
||||
if (_bpp != 1) drawPixel(x + this->cursor_x + this->gdX[gNum], y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], alphaBlend(pixel, fg, bg));
|
||||
else if (pixel>127) drawPixel(x + this->cursor_x + this->gdX[gNum], y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], fg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1565,7 +1906,7 @@ void TFT_eSprite::drawGlyph(uint16_t code)
|
|||
void TFT_eSprite::printToSprite(String string)
|
||||
{
|
||||
if(!this->fontLoaded) return;
|
||||
int16_t len = string.length();
|
||||
uint16_t len = string.length();
|
||||
char cbuffer[len + 1]; // Add 1 for the null
|
||||
string.toCharArray(cbuffer, len + 1); // Add 1 for the null, otherwise characters get dropped
|
||||
printToSprite(cbuffer, len);
|
||||
|
|
@ -1577,7 +1918,7 @@ void TFT_eSprite::printToSprite(String string)
|
|||
** Function name: printToSprite
|
||||
** Description: Write a string to the sprite cursor position
|
||||
*************************************************************************************x*/
|
||||
void TFT_eSprite::printToSprite(char *cbuffer, int len) //String string)
|
||||
void TFT_eSprite::printToSprite(char *cbuffer, uint16_t len) //String string)
|
||||
{
|
||||
if(!this->fontLoaded) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,19 +22,20 @@ class TFT_eSprite : public TFT_eSPI {
|
|||
// Select the frame buffer for graphics
|
||||
void* frameBuffer(int8_t f);
|
||||
|
||||
// Set the colour depth to 8 or 16 bits. Can be used to change depth an existing
|
||||
// Set or get the colour depth to 8 or 16 bits. Can be used to change depth an existing
|
||||
// sprite, but clears it to black, returns a new pointer if sprite is re-created.
|
||||
void* setColorDepth(int8_t b);
|
||||
int8_t getColorDepth(void);
|
||||
|
||||
void setBitmapColor(uint16_t c, uint16_t b);
|
||||
|
||||
void drawPixel(uint32_t x, uint32_t y, uint32_t color);
|
||||
void drawPixel(int32_t x, int32_t y, uint32_t color);
|
||||
|
||||
void drawChar(int32_t x, int32_t y, unsigned char c, uint32_t color, uint32_t bg, uint8_t size),
|
||||
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size),
|
||||
|
||||
fillSprite(uint32_t color),
|
||||
|
||||
// Define a window to push 16 bit colour pixels into is a raster order
|
||||
// Define a window to push 16 bit colour pixels into in a raster order
|
||||
// Colours are converted to 8 bit if depth is set to 8
|
||||
setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1),
|
||||
pushColor(uint32_t color),
|
||||
|
|
@ -44,7 +45,7 @@ class TFT_eSprite : public TFT_eSPI {
|
|||
|
||||
// Set the scroll zone, top left corner at x,y with defined width and height
|
||||
// The colour (optional, black is default) is used to fill the gap after the scroll
|
||||
setScrollRect(int32_t x, int32_t y, uint32_t w, uint32_t h, uint16_t color = TFT_BLACK),
|
||||
setScrollRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t color = TFT_BLACK),
|
||||
// Scroll the defined zone dx,dy pixels. Negative values left,up, positive right,down
|
||||
// dy is optional (default is then no up/down scroll).
|
||||
// The sprite coordinate frame does not move because pixels are moved
|
||||
|
|
@ -59,15 +60,29 @@ class TFT_eSprite : public TFT_eSPI {
|
|||
// Set the sprite text cursor position for print class (does not change the TFT screen cursor)
|
||||
//setCursor(int16_t x, int16_t y);
|
||||
|
||||
// Set the rotation of the Sprite (for 1bpp Sprites only)
|
||||
void setRotation(uint8_t rotation);
|
||||
uint8_t getRotation(void);
|
||||
|
||||
// Push a rotated copy of Sprite to TFT with optional transparent colour
|
||||
bool pushRotated(int16_t angle, int32_t transp = -1);
|
||||
// Push a rotated copy of Sprite to another different Sprite with optional transparent colour
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp = -1);
|
||||
// Set and get the pivot point for this Sprite
|
||||
void setPivot(int16_t x, int16_t y);
|
||||
int16_t getPivotX(void),
|
||||
getPivotY(void);
|
||||
|
||||
// Get the bounding box for a rotated copy of this Sprite
|
||||
void getRotatedBounds(float sina, float cosa, int16_t w, int16_t h, int16_t xp, int16_t yp,
|
||||
int16_t *min_x, int16_t *min_y, int16_t *max_x, int16_t *max_y);
|
||||
|
||||
// Read the colour of a pixel at x,y and return value in 565 format
|
||||
uint16_t readPixel(int32_t x0, int32_t y0);
|
||||
|
||||
// Write an image (colour bitmap) to the sprite
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, uint16_t *data);
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, const 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, const uint16_t *data);
|
||||
|
||||
// Swap the byte order for pushImage() - corrects different image endianness
|
||||
void setSwapBytes(bool swap);
|
||||
|
|
@ -78,8 +93,8 @@ class TFT_eSprite : public TFT_eSPI {
|
|||
void pushSprite(int32_t x, int32_t y);
|
||||
void pushSprite(int32_t x, int32_t y, uint16_t transparent);
|
||||
|
||||
int16_t drawChar(unsigned int uniCode, int x, int y, int font),
|
||||
drawChar(unsigned int uniCode, int x, int y);
|
||||
int16_t drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font),
|
||||
drawChar(uint16_t uniCode, int32_t x, int32_t y);
|
||||
|
||||
// Return the width and height of the sprite
|
||||
int16_t width(void),
|
||||
|
|
@ -91,22 +106,28 @@ class TFT_eSprite : public TFT_eSPI {
|
|||
// Functions associated with anti-aliased fonts
|
||||
void drawGlyph(uint16_t code);
|
||||
void printToSprite(String string);
|
||||
void printToSprite(char *cbuffer, int len);
|
||||
void printToSprite(char *cbuffer, uint16_t len);
|
||||
int16_t printToSprite(int16_t x, int16_t y, uint16_t index);
|
||||
|
||||
private:
|
||||
|
||||
TFT_eSPI *_tft;
|
||||
|
||||
// Reserve memory for the Sprite and return a pointer
|
||||
void* callocSprite(int16_t width, int16_t height, uint8_t frames = 1);
|
||||
|
||||
protected:
|
||||
|
||||
uint8_t _bpp;
|
||||
uint8_t _bpp; // bits per pixel (1, 8 or 16)
|
||||
uint16_t *_img; // pointer to 16 bit sprite
|
||||
uint8_t *_img8; // pointer to 8 bit sprite
|
||||
uint8_t *_img8_1; // pointer to frame 1
|
||||
uint8_t *_img8_2; // pointer to frame 2
|
||||
|
||||
bool _created; // created and bits per pixel depth flags
|
||||
int16_t _xpivot; // x pivot point coordinate
|
||||
int16_t _ypivot; // y pivot point coordinate
|
||||
|
||||
bool _created; // A Sprite has been created and memory reserved
|
||||
bool _gFont = false;
|
||||
|
||||
// int32_t _icursor_x, _icursor_y;
|
||||
|
|
|
|||
|
|
@ -12,34 +12,42 @@
|
|||
|
||||
/***************************************************************************************
|
||||
** Function name: getTouchRaw
|
||||
** Description: read raw touch position. Return false if not pressed.
|
||||
** Description: read raw touch position. Always returns true.
|
||||
***************************************************************************************/
|
||||
uint8_t TFT_eSPI::getTouchRaw(uint16_t *x, uint16_t *y){
|
||||
uint16_t tmp;
|
||||
CS_H;
|
||||
|
||||
spi_begin_touch();
|
||||
|
||||
T_CS_L;
|
||||
|
||||
// Start bit + YP sample request for x position
|
||||
tmp = SPI.transfer(0xd0);
|
||||
tmp = SPI.transfer(0);
|
||||
// Start YP sample request for x position, read 4 times and keep last sample
|
||||
spi.transfer(0xd0); // Start new YP conversion
|
||||
spi.transfer(0); // Read first 8 bits
|
||||
spi.transfer(0xd0); // Read last 8 bits and start new YP conversion
|
||||
spi.transfer(0); // Read first 8 bits
|
||||
spi.transfer(0xd0); // Read last 8 bits and start new YP conversion
|
||||
spi.transfer(0); // Read first 8 bits
|
||||
spi.transfer(0xd0); // Read last 8 bits and start new YP conversion
|
||||
|
||||
tmp = spi.transfer(0); // Read first 8 bits
|
||||
tmp = tmp <<5;
|
||||
tmp |= 0x1f & (SPI.transfer(0)>>3);
|
||||
tmp |= 0x1f & (spi.transfer(0x90)>>3); // Read last 8 bits and start new XP conversion
|
||||
|
||||
*x = tmp;
|
||||
|
||||
// Start bit + XP sample request for y position
|
||||
SPI.transfer(0x90);
|
||||
tmp = SPI.transfer(0);
|
||||
// Start XP sample request for y position, read 4 times and keep last sample
|
||||
spi.transfer(0); // Read first 8 bits
|
||||
spi.transfer(0x90); // Read last 8 bits and start new XP conversion
|
||||
spi.transfer(0); // Read first 8 bits
|
||||
spi.transfer(0x90); // Read last 8 bits and start new XP conversion
|
||||
spi.transfer(0); // Read first 8 bits
|
||||
spi.transfer(0x90); // Read last 8 bits and start new XP conversion
|
||||
|
||||
tmp = spi.transfer(0); // Read first 8 bits
|
||||
tmp = tmp <<5;
|
||||
tmp |= 0x1f & (SPI.transfer(0)>>3);
|
||||
tmp |= 0x1f & (spi.transfer(0)>>3); // Read last 8 bits
|
||||
|
||||
*y = tmp;
|
||||
|
||||
T_CS_H;
|
||||
|
||||
spi_end_touch();
|
||||
|
||||
return true;
|
||||
|
|
@ -50,19 +58,14 @@ uint8_t TFT_eSPI::getTouchRaw(uint16_t *x, uint16_t *y){
|
|||
** Description: read raw pressure on touchpad and return Z value.
|
||||
***************************************************************************************/
|
||||
uint16_t TFT_eSPI::getTouchRawZ(void){
|
||||
CS_H;
|
||||
|
||||
spi_begin_touch();
|
||||
|
||||
T_CS_L;
|
||||
|
||||
// Z sample request
|
||||
int16_t tz = 0xFFF;
|
||||
SPI.transfer(0xb1);
|
||||
tz += SPI.transfer16(0xc1) >> 3;
|
||||
tz -= SPI.transfer16(0x91) >> 3;
|
||||
|
||||
T_CS_H;
|
||||
spi.transfer(0xb0); // Start new Z1 conversion
|
||||
tz += spi.transfer16(0xc0) >> 3; // Read Z1 and start Z2 conversion
|
||||
tz -= spi.transfer16(0x00) >> 3; // Read Z2
|
||||
|
||||
spi_end_touch();
|
||||
|
||||
|
|
@ -73,11 +76,11 @@ uint16_t TFT_eSPI::getTouchRawZ(void){
|
|||
** Function name: validTouch
|
||||
** Description: read validated position. Return false if not pressed.
|
||||
***************************************************************************************/
|
||||
#define _RAWERR 10 // Deadband in position samples
|
||||
#define _RAWERR 20 // Deadband error allowed in successive position samples
|
||||
uint8_t TFT_eSPI::validTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
||||
uint16_t x_tmp, y_tmp, x_tmp2, y_tmp2;
|
||||
|
||||
// Wait until pressure stops increasing
|
||||
// Wait until pressure stops increasing to debounce pressure
|
||||
uint16_t z1 = 1;
|
||||
uint16_t z2 = 0;
|
||||
while (z1 > z2)
|
||||
|
|
@ -120,7 +123,7 @@ uint8_t TFT_eSPI::validTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
|||
***************************************************************************************/
|
||||
#define Z_THRESHOLD 350 // Touch pressure threshold for validating touches
|
||||
uint8_t TFT_eSPI::getTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
||||
uint16_t x_tmp, y_tmp, xx, yy;
|
||||
uint16_t x_tmp, y_tmp;
|
||||
|
||||
if (threshold<20) threshold = 20;
|
||||
if (_pressTime > millis()) threshold=20;
|
||||
|
|
@ -136,6 +139,25 @@ uint8_t TFT_eSPI::getTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
|||
|
||||
_pressTime = millis() + 50;
|
||||
|
||||
convertRawXY(&x_tmp, &y_tmp);
|
||||
|
||||
if (x_tmp >= _width || y_tmp >= _height) return valid;
|
||||
|
||||
_pressX = x_tmp;
|
||||
_pressY = y_tmp;
|
||||
*x = _pressX;
|
||||
*y = _pressY;
|
||||
return valid;
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: convertRawXY
|
||||
** Description: convert raw touch x,y values to screen coordinates
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::convertRawXY(uint16_t *x, uint16_t *y)
|
||||
{
|
||||
uint16_t x_tmp = *x, y_tmp = *y, xx, yy;
|
||||
|
||||
if(!touchCalibration_rotate){
|
||||
xx=(x_tmp-touchCalibration_x0)*_width/touchCalibration_x1;
|
||||
yy=(y_tmp-touchCalibration_y0)*_height/touchCalibration_y1;
|
||||
|
|
@ -151,14 +173,8 @@ uint8_t TFT_eSPI::getTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
|||
if(touchCalibration_invert_y)
|
||||
yy = _height - yy;
|
||||
}
|
||||
|
||||
if (xx >= _width || yy >= _height) return valid;
|
||||
|
||||
_pressX = xx;
|
||||
_pressY = yy;
|
||||
*x = _pressX;
|
||||
*y = _pressY;
|
||||
return valid;
|
||||
*x = xx;
|
||||
*y = yy;
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
|
|
|
|||
|
|
@ -2,23 +2,32 @@
|
|||
// This is part of the TFT_eSPI class and is associated with the Touch Screen handlers
|
||||
|
||||
public:
|
||||
|
||||
// Get raw x,y ADC values from touch controller
|
||||
uint8_t getTouchRaw(uint16_t *x, uint16_t *y);
|
||||
// Get raw z (i.e. pressure) ADC value from touch controller
|
||||
uint16_t getTouchRawZ(void);
|
||||
// Convert raw x,y values to calibrated and correctly rotated screen coordinates
|
||||
void convertRawXY(uint16_t *x, uint16_t *y);
|
||||
// Get the screen touch coordinates, returns true if screen has been touched
|
||||
// if the touch cordinates are off screen then x and y are not updated
|
||||
uint8_t getTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);
|
||||
|
||||
// Run screen calibration and test, report calibration values to the serial port
|
||||
void calibrateTouch(uint16_t *data, uint32_t color_fg, uint32_t color_bg, uint8_t size);
|
||||
// Set the screen calibration values
|
||||
void setTouch(uint16_t *data);
|
||||
|
||||
private:
|
||||
|
||||
// Handlers for the SPI settings and clock speed change
|
||||
inline void spi_begin_touch() __attribute__((always_inline));
|
||||
inline void spi_end_touch() __attribute__((always_inline));
|
||||
|
||||
// These are associated with the Touch Screen handlers
|
||||
// Private function to validate a touch, allow settle time and reduce spurious coordinates
|
||||
uint8_t validTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);
|
||||
|
||||
// Initialise with example calibration values so processor does not crash if setTouch() not called in setup()
|
||||
uint16_t touchCalibration_x0 = 300, touchCalibration_x1 = 3600, touchCalibration_y0 = 300, touchCalibration_y1 = 3600;
|
||||
uint8_t touchCalibration_rotate = 1, touchCalibration_invert_x = 2, touchCalibration_invert_y = 0;
|
||||
uint32_t _pressTime;
|
||||
uint16_t _pressX, _pressY;
|
||||
|
||||
uint32_t _pressTime; // Press and hold time-out
|
||||
uint16_t _pressX, _pressY; // For future use (last sampled calibrated coordinates)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#ifdef LOAD_GFXFF
|
||||
|
||||
typedef struct { // Data stored PER GLYPH
|
||||
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
|
||||
uint32_t bitmapOffset; // Pointer into GFXfont->bitmap
|
||||
uint8_t width, height; // Bitmap dimensions in pixels
|
||||
uint8_t xAdvance; // Distance to advance cursor (x axis)
|
||||
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
|
||||
|
|
@ -21,7 +21,7 @@ typedef struct { // Data stored PER GLYPH
|
|||
typedef struct { // Data stored for FONT AS A WHOLE:
|
||||
uint8_t *bitmap; // Glyph bitmaps, concatenated
|
||||
GFXglyph *glyph; // Glyph array
|
||||
uint8_t first, last; // ASCII extents
|
||||
uint16_t first, last; // ASCII extents
|
||||
uint8_t yAdvance; // Newline distance (y axis)
|
||||
} GFXfont;
|
||||
|
||||
|
|
|
|||
32
README.md
32
README.md
|
|
@ -1,11 +1,33 @@
|
|||
|
||||
# News
|
||||
|
||||
1. Sprites can now by pushed to the screen (or another Sprite) with a rotation angle. The new function is pushRotated(). Three new examples (Rotate_Sprite_1/2/3) have been added to show how the functions can be used to rotate text, images and to draw animated dials with moving needles.
|
||||
|
||||
2. A new TFT_eFEX support library has been created which includes extra functions such as drawing a BMP or Jpeg to the screen. This library will simplify the examples. It will be expanded at a future date to include meters, dials and GUI elements like progress bars, graphs and animated buttons:
|
||||
https://github.com/Bodmer/TFT_eFEX
|
||||
|
||||
3. androdlang has published a really nice companion library to extend the graphics capabilities of TFT_eSPI, you can find this here:
|
||||
https://github.com/androdlang/TFTShape
|
||||
|
||||
4. I have created a user updateable graphics extension library template that can be used to create your own graphics extensions. The Library contains examples and is commented so it should be clear what you need to do to add functions. You can find it here:
|
||||
https://github.com/Bodmer/TFT_eFX
|
||||
|
||||
5. The capability to read from an ST7789V TFT with a single bidirectional SDA pin has been added. At the moment this **ONLY** works with an ESP32. It is enabled with a #define TFT_SDA_READ in the setup file.
|
||||
|
||||
6. ST7789V displays are manufactured in two variants that have the red and blue pixels swapped, this is catered for by a new option in the setup file:
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
# TFT_eSPI
|
||||
|
||||
An Arduino IDE compatible graphics and fonts library for ESP8266 and ESP32 processors with drivers for ILI9341, ILI9163, ST7735, S6D02A1, ILI9481, ILI9486, ILI9488, HX8357D and ST7789 based TFT displays that support SPI.
|
||||
An Arduino IDE compatible graphics and fonts library for ESP8266 and ESP32 processors with drivers for ILI9341, ILI9163, ST7735, S6D02A1, ILI9481, ILI9486, ILI9488, HX8357D and ST7789 based TFT displays that support SPI. The library can be loaded using the Arduino IDE's Library Manager.
|
||||
|
||||
8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with an ESP32.
|
||||
|
||||
The library supports TFT displays designed for the Raspberry Pi that are based on a ILI9486 driver chip with a 480 x 320 pixel screen. This display must be of the Waveshare design and use a 16 bit serial interface based on the 74HC04, 74HC4040 and 2 x 74HC4094 logic chips. A modification to these displays is possible (see mod image in Tools folder) to make many graphics functions much faster (e.g. 23ms to clear the screen, 1.2ms to draw a 72 pixel high numeral).
|
||||
|
||||
Some displays permit the internal TFT screen RAM to be read. The library supports reading from ILI9341, ST7789 and ILI9488 SPI displays for the ESP32 and ESP8266. The 8 bit parallel displays used with the ESP32 can usually can be read too. The TFT_Screen_Capture example allows full screens to be captured and sent to a PC, this is handy to create program documentation.
|
||||
|
||||
Support has been added recently for Waveshare 2 and 3 colour ePaper displays using full frame buffers. This addition is currently relatively immature and thus only one example has been provided. Further examples will be added soon.
|
||||
|
||||
The library includes a "Sprite" class, this enables flicker free updates of complex graphics. Direct writes to the TFT with graphics functions are still available, so existing sketches do not need to be changed.
|
||||
|
|
@ -18,17 +40,19 @@ Drawing graphics into a sprite is very fast, for those familiar with the Adafrui
|
|||
|
||||
Sprites can be plotted to the TFT with one colour being specified as "transparent", see Transparent_Sprite_Demo example.
|
||||
|
||||
If an ESP32 board has SPIRAM (i.e. PSRAM) fitted then Sprites will use the PSRAM memory and large full screen buffer Sprites can be created. Full screen Sprites take longer to render (~45ms for a 320 x 240 16 bit Sprite), so bear that in mind.
|
||||
|
||||
The XPT2046 touch screen controller is supported. The SPI bus for the touch controller is shared with the TFT and only an additional chip select line is needed.
|
||||
|
||||
The Button class from Adafruit_GFX is incorporated, with the enhancement that the button labels can be in any font.
|
||||
|
||||
The library supports SPI overlap on the ESP8266 so the TFT screen can share MOSI, MISO and SCLK pins with the program FLASH, this frees up GPIO pins for other uses.
|
||||
|
||||
The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-alased (smooth) font files in vlw format stored in SPIFFS are supported and in the case any 16 bit Unicode character can be included and rendered, this means many language specific characters can be rendered to the screen.
|
||||
The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-alased (smooth) font files in vlw format stored in SPIFFS are supported. Any 16 bit Unicode character can be included and rendered, this means many language specific characters can be rendered to the screen.
|
||||
|
||||
The library is based on the Adafruit GFX and Adafruit driver libraries and the aim is to retain compatibility. Significant additions have been made to the library to boost the speed for ESP8266/ESP32 processors (it is typically 3 to 10 times faster) and to add new features. The new graphics functions include different size proportional fonts and formatting features. There are lots of example sketches to demonstrate the different features and included functions.
|
||||
|
||||
Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder, or by selecting a configuration in the library "User_Setup_Selet,h" file. Fonts and features can easily be disabled by commenting out lines.
|
||||
Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder, or by selecting your own configuration in the "User_Setup_Selet,h" file. Fonts and features can easily be enabled/disabled by commenting out lines.
|
||||
|
||||
|
||||
# Anti-aliased Fonts
|
||||
|
|
@ -69,6 +93,8 @@ IO32 wired to IO36
|
|||
|
||||

|
||||
|
||||
If the display board is fitted with a resistance based touch screen then this can be used by performing the modifications described here and the fork of the Adafruit library:
|
||||
https://github.com/s60sc/Adafruit_TouchScreen
|
||||
|
||||
# ePaper displays
|
||||
|
||||
|
|
|
|||
|
|
@ -121,10 +121,4 @@
|
|||
|
||||
writecommand(ILI9341_DISPON); //Display on
|
||||
|
||||
#ifdef M5STACK
|
||||
// Turn on the back-light LED
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
// This is the command sequence that initialises the R61581 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
// Configure R61581 display
|
||||
|
||||
writecommand(TFT_SLPOUT);
|
||||
delay(20);
|
||||
|
||||
writecommand(0xB0);
|
||||
writedata(0x00);
|
||||
|
||||
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(0x12);
|
||||
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 R61581 display configuration
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
// This is the command sequence that rotates the R61581 driver coordinate frame
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
rotation = m % 4;
|
||||
switch (rotation) {
|
||||
case 0: // Portrait
|
||||
writedata(TFT_MAD_BGR | TFT_MAD_MX);
|
||||
_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_MX | TFT_MAD_GS);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -9,13 +9,15 @@
|
|||
|
||||
|
||||
// Enumerate the different configurations
|
||||
#define INITR_GREENTAB 0x0
|
||||
#define INITR_REDTAB 0x1
|
||||
#define INITR_BLACKTAB 0x2
|
||||
#define INITR_GREENTAB2 0x3 // Use if you get random pixels on two edges of green tab display
|
||||
#define INITR_GREENTAB3 0x4 // Use if you get random pixels on edge(s) of 128x128 screen
|
||||
#define INITR_GREENTAB128 0x5 // Use if you only get part of 128x128 screen in rotation 0 & 1
|
||||
#define INITB 0xB
|
||||
#define INITR_GREENTAB 0x0
|
||||
#define INITR_REDTAB 0x1
|
||||
#define INITR_BLACKTAB 0x2 // Display with no offsets
|
||||
#define INITR_GREENTAB2 0x3 // Use if you get random pixels on two edges of green tab display
|
||||
#define INITR_GREENTAB3 0x4 // Use if you get random pixels on edge(s) of 128x128 screen
|
||||
#define INITR_GREENTAB128 0x5 // Use if you only get part of 128x128 screen in rotation 0 & 1
|
||||
#define INITR_GREENTAB160x80 0x6 // Use if you only get part of 128x128 screen in rotation 0 & 1
|
||||
#define INITR_REDTAB160x80 0x7 // Added for https://www.aliexpress.com/item/ShengYang-1pcs-IPS-0-96-inch-7P-SPI-HD-65K-Full-Color-OLED-Module-ST7735-Drive/32918394604.html
|
||||
#define INITB 0xB
|
||||
|
||||
|
||||
// Setup the tab color that will be used by the library setRotation() and setup command list
|
||||
|
|
@ -38,6 +40,14 @@
|
|||
#define TAB_COLOUR INITR_GREENTAB128
|
||||
#define CGRAM_OFFSET
|
||||
|
||||
#elif defined (ST7735_GREENTAB160x80)
|
||||
#define TAB_COLOUR INITR_GREENTAB160x80
|
||||
#define CGRAM_OFFSET
|
||||
|
||||
#elif defined (ST7735_REDTAB160x80)
|
||||
#define TAB_COLOUR INITR_REDTAB160x80
|
||||
#define CGRAM_OFFSET
|
||||
|
||||
#elif defined (ST7735_REDTAB)
|
||||
#define TAB_COLOUR INITR_REDTAB
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,19 @@
|
|||
colstart = 0;
|
||||
rowstart = 32;
|
||||
}
|
||||
else if (tabcolor == INITR_GREENTAB160x80)
|
||||
{
|
||||
commandList(Rcmd2green);
|
||||
writecommand(TFT_INVON);
|
||||
colstart = 26;
|
||||
rowstart = 1;
|
||||
}
|
||||
else if (tabcolor == INITR_REDTAB160x80)
|
||||
{
|
||||
commandList(Rcmd2green);
|
||||
colstart = 24;
|
||||
rowstart = 0;
|
||||
}
|
||||
else if (tabcolor == INITR_REDTAB)
|
||||
{
|
||||
commandList(Rcmd2red);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@
|
|||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_BGR);
|
||||
colstart = 0;
|
||||
rowstart = 32;
|
||||
} else if(tabcolor == INITR_GREENTAB160x80) {
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_BGR);
|
||||
colstart = 26;
|
||||
rowstart = 1;
|
||||
} else if(tabcolor == INITR_REDTAB160x80) {
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_BGR);
|
||||
colstart = 24;
|
||||
rowstart = 0;
|
||||
} else if(tabcolor == INITB) {
|
||||
writedata(TFT_MAD_MX | TFT_MAD_RGB);
|
||||
} else {
|
||||
|
|
@ -43,6 +51,14 @@
|
|||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
colstart = 32;
|
||||
rowstart = 0;
|
||||
} else if(tabcolor == INITR_GREENTAB160x80) {
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
colstart = 1;
|
||||
rowstart = 26;
|
||||
} else if(tabcolor == INITR_REDTAB160x80) {
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
colstart = 0;
|
||||
rowstart = 24;
|
||||
} else if(tabcolor == INITB) {
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB);
|
||||
} else {
|
||||
|
|
@ -66,6 +82,14 @@
|
|||
writedata(TFT_MAD_BGR);
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
} else if(tabcolor == INITR_GREENTAB160x80) {
|
||||
writedata(TFT_MAD_BGR);
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
} else if(tabcolor == INITR_REDTAB160x80) {
|
||||
writedata(TFT_MAD_BGR);
|
||||
colstart = 24;
|
||||
rowstart = 0;
|
||||
} else if(tabcolor == INITB) {
|
||||
writedata(TFT_MAD_MY | TFT_MAD_RGB);
|
||||
} else {
|
||||
|
|
@ -89,6 +113,14 @@
|
|||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
} else if(tabcolor == INITR_GREENTAB160x80) {
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
colstart = 1;
|
||||
rowstart = 26;
|
||||
} else if(tabcolor == INITR_REDTAB160x80) {
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
colstart = 0;
|
||||
rowstart = 24;
|
||||
} else if(tabcolor == INITB) {
|
||||
writedata(TFT_MAD_MV | TFT_MAD_RGB);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
// Change the width and height if required (defined in portrait mode)
|
||||
// or use the constructor to over-ride defaults
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#if (TFT_HEIGHT == 240) && (TFT_WIDTH == 240)
|
||||
#define CGRAM_OFFSET
|
||||
#endif
|
||||
|
||||
// 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_NORON 0x13
|
||||
|
||||
#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_COLMOD 0x3A
|
||||
|
||||
// Flags for TFT_MADCTL
|
||||
#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
|
||||
|
||||
#ifdef TFT_RGB_ORDER
|
||||
#if (TFT_RGB_ORDER == 1)
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
|
||||
#else
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#endif
|
||||
#else
|
||||
#ifdef CGRAM_OFFSET
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#else
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read
|
||||
|
||||
#define ST_CMD_DELAY 0x80 // special signifier for command lists
|
||||
#define ST7789_240x240_XSTART 0
|
||||
#define ST7789_240x240_YSTART 0
|
||||
|
||||
// ST7789 specific commands used in init
|
||||
#define ST7789_NOP 0x00
|
||||
#define ST7789_SWRESET 0x01
|
||||
#define ST7789_RDDID 0x04
|
||||
#define ST7789_RDDST 0x09
|
||||
|
||||
#define ST7789_RDDPM 0x0A // Read display power mode
|
||||
#define ST7789_RDD_MADCTL 0x0B // Read display MADCTL
|
||||
#define ST7789_RDD_COLMOD 0x0C // Read display pixel format
|
||||
#define ST7789_RDDIM 0x0D // Read display image mode
|
||||
#define ST7789_RDDSM 0x0E // Read display signal mode
|
||||
#define ST7789_RDDSR 0x0F // Read display self-diagnostic result (ST7789V)
|
||||
|
||||
#define ST7789_SLPIN 0x10
|
||||
#define ST7789_SLPOUT 0x11
|
||||
#define ST7789_PTLON 0x12
|
||||
#define ST7789_NORON 0x13
|
||||
|
||||
#define ST7789_INVOFF 0x20
|
||||
#define ST7789_INVON 0x21
|
||||
#define ST7789_GAMSET 0x26 // Gamma set
|
||||
#define ST7789_DISPOFF 0x28
|
||||
#define ST7789_DISPON 0x29
|
||||
#define ST7789_CASET 0x2A
|
||||
#define ST7789_RASET 0x2B
|
||||
#define ST7789_RAMWR 0x2C
|
||||
#define ST7789_RGBSET 0x2D // Color setting for 4096, 64K and 262K colors
|
||||
#define ST7789_RAMRD 0x2E
|
||||
|
||||
#define ST7789_PTLAR 0x30
|
||||
#define ST7789_VSCRDEF 0x33 // Vertical scrolling definition (ST7789V)
|
||||
#define ST7789_TEOFF 0x34 // Tearing effect line off
|
||||
#define ST7789_TEON 0x35 // Tearing effect line on
|
||||
#define ST7789_MADCTL 0x36 // Memory data access control
|
||||
#define ST7789_IDMOFF 0x38 // Idle mode off
|
||||
#define ST7789_IDMON 0x39 // Idle mode on
|
||||
#define ST7789_RAMWRC 0x3C // Memory write continue (ST7789V)
|
||||
#define ST7789_RAMRDC 0x3E // Memory read continue (ST7789V)
|
||||
#define ST7789_COLMOD 0x3A
|
||||
|
||||
#define ST7789_RAMCTRL 0xB0 // RAM control
|
||||
#define ST7789_RGBCTRL 0xB1 // RGB control
|
||||
#define ST7789_PORCTRL 0xB2 // Porch control
|
||||
#define ST7789_FRCTRL1 0xB3 // Frame rate control
|
||||
#define ST7789_PARCTRL 0xB5 // Partial mode control
|
||||
#define ST7789_GCTRL 0xB7 // Gate control
|
||||
#define ST7789_GTADJ 0xB8 // Gate on timing adjustment
|
||||
#define ST7789_DGMEN 0xBA // Digital gamma enable
|
||||
#define ST7789_VCOMS 0xBB // VCOMS setting
|
||||
#define ST7789_LCMCTRL 0xC0 // LCM control
|
||||
#define ST7789_IDSET 0xC1 // ID setting
|
||||
#define ST7789_VDVVRHEN 0xC2 // VDV and VRH command enable
|
||||
#define ST7789_VRHS 0xC3 // VRH set
|
||||
#define ST7789_VDVSET 0xC4 // VDV setting
|
||||
#define ST7789_VCMOFSET 0xC5 // VCOMS offset set
|
||||
#define ST7789_FRCTR2 0xC6 // FR Control 2
|
||||
#define ST7789_CABCCTRL 0xC7 // CABC control
|
||||
#define ST7789_REGSEL1 0xC8 // Register value section 1
|
||||
#define ST7789_REGSEL2 0xCA // Register value section 2
|
||||
#define ST7789_PWMFRSEL 0xCC // PWM frequency selection
|
||||
#define ST7789_PWCTRL1 0xD0 // Power control 1
|
||||
#define ST7789_VAPVANEN 0xD2 // Enable VAP/VAN signal output
|
||||
#define ST7789_CMD2EN 0xDF // Command 2 enable
|
||||
#define ST7789_PVGAMCTRL 0xE0 // Positive voltage gamma control
|
||||
#define ST7789_NVGAMCTRL 0xE1 // Negative voltage gamma control
|
||||
#define ST7789_DGMLUTR 0xE2 // Digital gamma look-up table for red
|
||||
#define ST7789_DGMLUTB 0xE3 // Digital gamma look-up table for blue
|
||||
#define ST7789_GATECTRL 0xE4 // Gate control
|
||||
#define ST7789_SPI2EN 0xE7 // SPI2 enable
|
||||
#define ST7789_PWCTRL2 0xE8 // Power control 2
|
||||
#define ST7789_EQCTRL 0xE9 // Equalize time control
|
||||
#define ST7789_PROMCTRL 0xEC // Program control
|
||||
#define ST7789_PROMEN 0xFA // Program mode enable
|
||||
#define ST7789_NVMSET 0xFC // NVM setting
|
||||
#define ST7789_PROMACT 0xFE // Program action
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
// This is the command sequence that initialises the ST7789 driver
|
||||
|
||||
// Configure ST7789 display
|
||||
|
||||
{
|
||||
static const uint8_t PROGMEM
|
||||
st7789[] = {
|
||||
8,
|
||||
TFT_SLPOUT, TFT_INIT_DELAY, 255,
|
||||
TFT_COLMOD, 1+TFT_INIT_DELAY, 0x55, 10,
|
||||
TFT_MADCTL, 1, 0x00,
|
||||
TFT_CASET, 4, 0x00, 0x00, 0x00, 0xF0,
|
||||
TFT_PASET, 4, 0x00, 0x00, 0x00, 0xF0,
|
||||
TFT_INVON, TFT_INIT_DELAY, 10,
|
||||
TFT_NORON, TFT_INIT_DELAY, 10,
|
||||
TFT_DISPON, TFT_INIT_DELAY, 255
|
||||
};
|
||||
|
||||
commandList(st7789);
|
||||
}
|
||||
// End of ST7789 display configuration
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
// This is the command sequence that rotates the ST7789 driver coordinate frame
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
rotation = m % 4;
|
||||
switch (rotation) {
|
||||
case 0: // Portrait
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
writedata(TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
break;
|
||||
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
break;
|
||||
|
||||
case 2: // Inverter portrait
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 80;
|
||||
#endif
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 80;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1,9 +1,15 @@
|
|||
// Change the width and height if required (defined in portrait mode)
|
||||
// or use the constructor to over-ride defaults
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
#if (TFT_HEIGHT == 240) && (TFT_WIDTH == 240)
|
||||
#define CGRAM_OFFSET
|
||||
#endif
|
||||
|
||||
// Delay between some initialisation commands
|
||||
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||
|
|
@ -15,25 +21,20 @@
|
|||
|
||||
#define TFT_SLPIN 0x10
|
||||
#define TFT_SLPOUT 0x11
|
||||
|
||||
#define TFT_NORON 0x13
|
||||
|
||||
#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_COLMOD 0x3A
|
||||
|
||||
// Flags for TFT_MADCTL
|
||||
#define TFT_MAD_MY 0x80
|
||||
#define TFT_MAD_MX 0x40
|
||||
#define TFT_MAD_MV 0x20
|
||||
|
|
@ -44,6 +45,95 @@
|
|||
#define TFT_MAD_SS 0x02
|
||||
#define TFT_MAD_GS 0x01
|
||||
|
||||
#ifdef TFT_RGB_ORDER
|
||||
#if (TFT_RGB_ORDER == 1)
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
|
||||
#else
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#endif
|
||||
#else
|
||||
#ifdef CGRAM_OFFSET
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#else
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read
|
||||
|
||||
// ST7789 specific commands used in init
|
||||
#define ST7789_NOP 0x00
|
||||
#define ST7789_SWRESET 0x01
|
||||
#define ST7789_RDDID 0x04
|
||||
#define ST7789_RDDST 0x09
|
||||
|
||||
#define ST7789_RDDPM 0x0A // Read display power mode
|
||||
#define ST7789_RDD_MADCTL 0x0B // Read display MADCTL
|
||||
#define ST7789_RDD_COLMOD 0x0C // Read display pixel format
|
||||
#define ST7789_RDDIM 0x0D // Read display image mode
|
||||
#define ST7789_RDDSM 0x0E // Read display signal mode
|
||||
#define ST7789_RDDSR 0x0F // Read display self-diagnostic result (ST7789V)
|
||||
|
||||
#define ST7789_SLPIN 0x10
|
||||
#define ST7789_SLPOUT 0x11
|
||||
#define ST7789_PTLON 0x12
|
||||
#define ST7789_NORON 0x13
|
||||
|
||||
#define ST7789_INVOFF 0x20
|
||||
#define ST7789_INVON 0x21
|
||||
#define ST7789_GAMSET 0x26 // Gamma set
|
||||
#define ST7789_DISPOFF 0x28
|
||||
#define ST7789_DISPON 0x29
|
||||
#define ST7789_CASET 0x2A
|
||||
#define ST7789_RASET 0x2B
|
||||
#define ST7789_RAMWR 0x2C
|
||||
#define ST7789_RGBSET 0x2D // Color setting for 4096, 64K and 262K colors
|
||||
#define ST7789_RAMRD 0x2E
|
||||
|
||||
#define ST7789_PTLAR 0x30
|
||||
#define ST7789_VSCRDEF 0x33 // Vertical scrolling definition (ST7789V)
|
||||
#define ST7789_TEOFF 0x34 // Tearing effect line off
|
||||
#define ST7789_TEON 0x35 // Tearing effect line on
|
||||
#define ST7789_MADCTL 0x36 // Memory data access control
|
||||
#define ST7789_IDMOFF 0x38 // Idle mode off
|
||||
#define ST7789_IDMON 0x39 // Idle mode on
|
||||
#define ST7789_RAMWRC 0x3C // Memory write continue (ST7789V)
|
||||
#define ST7789_RAMRDC 0x3E // Memory read continue (ST7789V)
|
||||
#define ST7789_COLMOD 0x3A
|
||||
|
||||
#define ST7789_RAMCTRL 0xB0 // RAM control
|
||||
#define ST7789_RGBCTRL 0xB1 // RGB control
|
||||
#define ST7789_PORCTRL 0xB2 // Porch control
|
||||
#define ST7789_FRCTRL1 0xB3 // Frame rate control
|
||||
#define ST7789_PARCTRL 0xB5 // Partial mode control
|
||||
#define ST7789_GCTRL 0xB7 // Gate control
|
||||
#define ST7789_GTADJ 0xB8 // Gate on timing adjustment
|
||||
#define ST7789_DGMEN 0xBA // Digital gamma enable
|
||||
#define ST7789_VCOMS 0xBB // VCOMS setting
|
||||
#define ST7789_LCMCTRL 0xC0 // LCM control
|
||||
#define ST7789_IDSET 0xC1 // ID setting
|
||||
#define ST7789_VDVVRHEN 0xC2 // VDV and VRH command enable
|
||||
#define ST7789_VRHS 0xC3 // VRH set
|
||||
#define ST7789_VDVSET 0xC4 // VDV setting
|
||||
#define ST7789_VCMOFSET 0xC5 // VCOMS offset set
|
||||
#define ST7789_FRCTR2 0xC6 // FR Control 2
|
||||
#define ST7789_CABCCTRL 0xC7 // CABC control
|
||||
#define ST7789_REGSEL1 0xC8 // Register value section 1
|
||||
#define ST7789_REGSEL2 0xCA // Register value section 2
|
||||
#define ST7789_PWMFRSEL 0xCC // PWM frequency selection
|
||||
#define ST7789_PWCTRL1 0xD0 // Power control 1
|
||||
#define ST7789_VAPVANEN 0xD2 // Enable VAP/VAN signal output
|
||||
#define ST7789_CMD2EN 0xDF // Command 2 enable
|
||||
#define ST7789_PVGAMCTRL 0xE0 // Positive voltage gamma control
|
||||
#define ST7789_NVGAMCTRL 0xE1 // Negative voltage gamma control
|
||||
#define ST7789_DGMLUTR 0xE2 // Digital gamma look-up table for red
|
||||
#define ST7789_DGMLUTB 0xE3 // Digital gamma look-up table for blue
|
||||
#define ST7789_GATECTRL 0xE4 // Gate control
|
||||
#define ST7789_SPI2EN 0xE7 // SPI2 enable
|
||||
#define ST7789_PWCTRL2 0xE8 // Power control 2
|
||||
#define ST7789_EQCTRL 0xE9 // Equalize time control
|
||||
#define ST7789_PROMCTRL 0xEC // Program control
|
||||
#define ST7789_PROMEN 0xFA // Program mode enable
|
||||
#define ST7789_NVMSET 0xFC // NVM setting
|
||||
#define ST7789_PROMACT 0xFE // Program action
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,124 @@
|
|||
|
||||
// This is the command sequence that initialises the ST7789 driver
|
||||
|
||||
// Configure ST7789 display
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
{
|
||||
static const uint8_t PROGMEM
|
||||
st7789[] = {
|
||||
9,
|
||||
TFT_SWRST, TFT_INIT_DELAY, 150,
|
||||
TFT_SLPOUT, TFT_INIT_DELAY, 255,
|
||||
TFT_COLMOD, 1+TFT_INIT_DELAY, 0x55, 10,
|
||||
TFT_MADCTL, 1, TFT_MAD_RGB,
|
||||
TFT_CASET, 4, 0x00, 0x00, 0x00, 0xF0,
|
||||
TFT_PASET, 4, 0x00, 0x00, 0x00, 0xF0,
|
||||
TFT_INVON, TFT_INIT_DELAY, 10,
|
||||
TFT_NORON, TFT_INIT_DELAY, 10,
|
||||
TFT_DISPON, TFT_INIT_DELAY, 255
|
||||
};
|
||||
writecommand(ST7789_SLPOUT); // Sleep out
|
||||
delay(120);
|
||||
|
||||
commandList(st7789);
|
||||
writecommand(ST7789_NORON); // Normal display mode on
|
||||
|
||||
//------------------------------display and color format setting--------------------------------//
|
||||
writecommand(ST7789_MADCTL);
|
||||
//writedata(0x00);
|
||||
writedata(TFT_MAD_COLOR_ORDER);
|
||||
|
||||
// JLX240 display datasheet
|
||||
writecommand(0xB6);
|
||||
writedata(0x0A);
|
||||
writedata(0x82);
|
||||
|
||||
writecommand(ST7789_COLMOD);
|
||||
writedata(0x55);
|
||||
delay(10);
|
||||
|
||||
//--------------------------------ST7789V Frame rate setting----------------------------------//
|
||||
writecommand(ST7789_PORCTRL);
|
||||
writedata(0x0c);
|
||||
writedata(0x0c);
|
||||
writedata(0x00);
|
||||
writedata(0x33);
|
||||
writedata(0x33);
|
||||
|
||||
writecommand(ST7789_GCTRL); // Voltages: VGH / VGL
|
||||
writedata(0x35);
|
||||
|
||||
//---------------------------------ST7789V Power setting--------------------------------------//
|
||||
writecommand(ST7789_VCOMS);
|
||||
writedata(0x28); // JLX240 display datasheet
|
||||
|
||||
writecommand(ST7789_LCMCTRL);
|
||||
writedata(0x0C);
|
||||
|
||||
writecommand(ST7789_VDVVRHEN);
|
||||
writedata(0x01);
|
||||
writedata(0xFF);
|
||||
|
||||
writecommand(ST7789_VRHS); // voltage VRHS
|
||||
writedata(0x10);
|
||||
|
||||
writecommand(ST7789_VDVSET);
|
||||
writedata(0x20);
|
||||
|
||||
writecommand(ST7789_FRCTR2);
|
||||
writedata(0x0f);
|
||||
|
||||
writecommand(ST7789_PWCTRL1);
|
||||
writedata(0xa4);
|
||||
writedata(0xa1);
|
||||
|
||||
//--------------------------------ST7789V gamma setting---------------------------------------//
|
||||
writecommand(ST7789_PVGAMCTRL);
|
||||
writedata(0xd0);
|
||||
writedata(0x00);
|
||||
writedata(0x02);
|
||||
writedata(0x07);
|
||||
writedata(0x0a);
|
||||
writedata(0x28);
|
||||
writedata(0x32);
|
||||
writedata(0x44);
|
||||
writedata(0x42);
|
||||
writedata(0x06);
|
||||
writedata(0x0e);
|
||||
writedata(0x12);
|
||||
writedata(0x14);
|
||||
writedata(0x17);
|
||||
|
||||
writecommand(ST7789_NVGAMCTRL);
|
||||
writedata(0xd0);
|
||||
writedata(0x00);
|
||||
writedata(0x02);
|
||||
writedata(0x07);
|
||||
writedata(0x0a);
|
||||
writedata(0x28);
|
||||
writedata(0x31);
|
||||
writedata(0x54);
|
||||
writedata(0x47);
|
||||
writedata(0x0e);
|
||||
writedata(0x1c);
|
||||
writedata(0x17);
|
||||
writedata(0x1b);
|
||||
writedata(0x1e);
|
||||
|
||||
writecommand(ST7789_INVON);
|
||||
|
||||
writecommand(ST7789_CASET); // Column address set
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0xE5); // 239
|
||||
|
||||
writecommand(ST7789_RASET); // Row address set
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0x3F); // 319
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
spi_end();
|
||||
delay(120);
|
||||
spi_begin();
|
||||
|
||||
writecommand(ST7789_DISPON); //Display on
|
||||
delay(120);
|
||||
|
||||
#ifdef TFT_BL
|
||||
// Turn on the back-light LED
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
#endif
|
||||
}
|
||||
// End of ST7789 display configuration
|
||||
|
||||
|
|
|
|||
|
|
@ -3,32 +3,46 @@
|
|||
writecommand(TFT_MADCTL);
|
||||
rotation = m % 4;
|
||||
switch (rotation) {
|
||||
case 0: // Portrait
|
||||
writedata(TFT_MAD_RGB);
|
||||
case 0: // Portrait
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
writedata(TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
break;
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_RGB);
|
||||
break;
|
||||
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
colstart = 0;
|
||||
rowstart = 0;
|
||||
break;
|
||||
case 2: // Inverter portrait
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
break;
|
||||
|
||||
case 2: // Inverter portrait
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 0;
|
||||
rowstart = 80;
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_RGB);
|
||||
#endif
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
#ifdef CGRAM_OFFSET
|
||||
colstart = 80;
|
||||
rowstart = 0;
|
||||
#endif
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
colstart = 80;
|
||||
rowstart = 0;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
1555
TFT_eSPI.cpp
1555
TFT_eSPI.cpp
File diff suppressed because it is too large
Load Diff
322
TFT_eSPI.h
322
TFT_eSPI.h
|
|
@ -15,6 +15,8 @@
|
|||
#ifndef _TFT_eSPIH_
|
||||
#define _TFT_eSPIH_
|
||||
|
||||
#define TFT_ESPI_VERSION "1.4.5"
|
||||
|
||||
//#define ESP32 //Just used to test ESP32 options
|
||||
|
||||
// Include header file that defines the fonts loaded, the TFT drivers
|
||||
|
|
@ -35,7 +37,7 @@
|
|||
#define SPI_READ_FREQUENCY SPI_FREQUENCY
|
||||
#endif
|
||||
|
||||
#ifdef ST7789_DRIVER
|
||||
#if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER)
|
||||
#define TFT_SPI_MODE SPI_MODE3
|
||||
#else
|
||||
#define TFT_SPI_MODE SPI_MODE0
|
||||
|
|
@ -103,6 +105,15 @@
|
|||
|
||||
#include <SPI.h>
|
||||
|
||||
#ifdef ESP32
|
||||
#include "soc/spi_reg.h"
|
||||
#ifdef USE_HSPI_PORT
|
||||
#define SPI_PORT HSPI
|
||||
#else
|
||||
#define SPI_PORT VSPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SMOOTH_FONT
|
||||
// Call up the SPIFFS FLASH filing system for the anti-aliased fonts
|
||||
#define FS_NO_GLOBALS
|
||||
|
|
@ -117,7 +128,7 @@
|
|||
#define DC_C // No macro allocated so it generates no code
|
||||
#define DC_D // No macro allocated so it generates no code
|
||||
#else
|
||||
#if defined (ESP8266) && defined (D0_USED_FOR_DC)
|
||||
#if defined (ESP8266) && (TFT_DC == 16)
|
||||
#define DC_C digitalWrite(TFT_DC, LOW)
|
||||
#define DC_D digitalWrite(TFT_DC, HIGH)
|
||||
#elif defined (ESP32)
|
||||
|
|
@ -127,16 +138,26 @@
|
|||
|
||||
#else
|
||||
#if TFT_DC >= 32
|
||||
#define DC_C GPIO.out1_w1ts.val = (1 << (TFT_DC - 32)); \
|
||||
GPIO.out1_w1tc.val = (1 << (TFT_DC - 32))
|
||||
#define DC_D GPIO.out1_w1tc.val = (1 << (TFT_DC - 32)); \
|
||||
GPIO.out1_w1ts.val = (1 << (TFT_DC - 32))
|
||||
#ifdef RPI_ILI9486_DRIVER // RPi display needs a slower DC change
|
||||
#define DC_C GPIO.out1_w1ts.val = (1 << (TFT_DC - 32)); \
|
||||
GPIO.out1_w1tc.val = (1 << (TFT_DC - 32))
|
||||
#define DC_D GPIO.out1_w1tc.val = (1 << (TFT_DC - 32)); \
|
||||
GPIO.out1_w1ts.val = (1 << (TFT_DC - 32))
|
||||
#else
|
||||
#define DC_C GPIO.out1_w1tc.val = (1 << (TFT_DC - 32))//;GPIO.out1_w1tc.val = (1 << (TFT_DC - 32))
|
||||
#define DC_D GPIO.out1_w1ts.val = (1 << (TFT_DC - 32))//;GPIO.out1_w1ts.val = (1 << (TFT_DC - 32))
|
||||
#endif
|
||||
#else
|
||||
#if TFT_DC >= 0
|
||||
#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)
|
||||
#ifdef RPI_ILI9486_DRIVER // RPi display needs a slower DC change
|
||||
#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)
|
||||
#else
|
||||
#define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
|
||||
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
|
||||
#endif
|
||||
#else
|
||||
#define DC_C
|
||||
#define DC_D
|
||||
|
|
@ -151,13 +172,20 @@
|
|||
|
||||
#if defined (TFT_SPI_OVERLAP)
|
||||
#undef TFT_CS
|
||||
#define SPI1U_WRITE (SPIUMOSI | SPIUSSE | SPIUCSSETUP | SPIUCSHOLD)
|
||||
#define SPI1U_READ (SPIUMOSI | SPIUSSE | SPIUCSSETUP | SPIUCSHOLD | SPIUDUPLEX)
|
||||
#else
|
||||
#ifdef ESP8266
|
||||
#define SPI1U_WRITE (SPIUMOSI | SPIUSSE)
|
||||
#define SPI1U_READ (SPIUMOSI | SPIUSSE | SPIUDUPLEX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef TFT_CS
|
||||
#define CS_L // No macro allocated so it generates no code
|
||||
#define CS_H // No macro allocated so it generates no code
|
||||
#else
|
||||
#if defined (ESP8266) && defined (D0_USED_FOR_CS)
|
||||
#if defined (ESP8266) && (TFT_CS == 16)
|
||||
#define CS_L digitalWrite(TFT_CS, LOW)
|
||||
#define CS_H digitalWrite(TFT_CS, HIGH)
|
||||
#elif defined (ESP32)
|
||||
|
|
@ -166,14 +194,24 @@
|
|||
#define CS_H
|
||||
#else
|
||||
#if TFT_CS >= 32
|
||||
#define CS_L GPIO.out1_w1ts.val = (1 << (TFT_CS - 32)); \
|
||||
GPIO.out1_w1tc.val = (1 << (TFT_CS - 32))
|
||||
#define CS_H GPIO.out1_w1tc.val = (1 << (TFT_CS - 32)); \
|
||||
GPIO.out1_w1ts.val = (1 << (TFT_CS - 32))
|
||||
#ifdef RPI_ILI9486_DRIVER // RPi display needs a slower CS change
|
||||
#define CS_L GPIO.out1_w1ts.val = (1 << (TFT_CS - 32)); \
|
||||
GPIO.out1_w1tc.val = (1 << (TFT_CS - 32))
|
||||
#define CS_H GPIO.out1_w1tc.val = (1 << (TFT_CS - 32)); \
|
||||
GPIO.out1_w1ts.val = (1 << (TFT_CS - 32))
|
||||
#else
|
||||
#define CS_L GPIO.out1_w1tc.val = (1 << (TFT_CS - 32)); GPIO.out1_w1tc.val = (1 << (TFT_CS - 32))
|
||||
#define CS_H GPIO.out1_w1ts.val = (1 << (TFT_CS - 32))//;GPIO.out1_w1ts.val = (1 << (TFT_CS - 32))
|
||||
#endif
|
||||
#else
|
||||
#if TFT_CS >= 0
|
||||
#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)
|
||||
#ifdef RPI_ILI9486_DRIVER // RPi display needs a slower CS change
|
||||
#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)
|
||||
#else
|
||||
#define CS_L GPIO.out_w1tc = (1 << TFT_CS);GPIO.out_w1tc = (1 << TFT_CS)
|
||||
#define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
|
||||
#endif
|
||||
#else
|
||||
#define CS_L
|
||||
#define CS_H
|
||||
|
|
@ -186,6 +224,26 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// Use single register write for CS_L and DC_C if pins are both in range 0-31
|
||||
#ifdef ESP32
|
||||
#ifdef TFT_CS
|
||||
#if (TFT_CS >= 0) && (TFT_CS < 32) && (TFT_DC >= 0) && (TFT_DC < 32)
|
||||
#ifdef RPI_ILI9486_DRIVER // RPi display needs a slower CD and DC change
|
||||
#define CS_L_DC_C GPIO.out_w1tc = ((1 << TFT_CS) | (1 << TFT_DC)); \
|
||||
GPIO.out_w1tc = ((1 << TFT_CS) | (1 << TFT_DC))
|
||||
#else
|
||||
#define CS_L_DC_C GPIO.out_w1tc = ((1 << TFT_CS) | (1 << TFT_DC)); GPIO.out_w1tc = ((1 << TFT_CS) | (1 << TFT_DC))
|
||||
#endif
|
||||
#else
|
||||
#define CS_L_DC_C CS_L; DC_C
|
||||
#endif
|
||||
#else
|
||||
#define CS_L_DC_C CS_L; DC_C
|
||||
#endif
|
||||
#else // ESP8266
|
||||
#define CS_L_DC_C CS_L; DC_C
|
||||
#endif
|
||||
|
||||
// chip select signal for touchscreen
|
||||
#ifndef TOUCH_CS
|
||||
#define T_CS_L // No macro allocated so it generates no code
|
||||
|
|
@ -206,6 +264,20 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
// Concatenate two 16 bit values for the SPI 32 bit register write
|
||||
#define SPI_32(H,L) ( (H)<<16 | (L) )
|
||||
#define COL_32(H,L) ( (H)<<16 | (L) )
|
||||
#else
|
||||
#if defined (ESP32_PARALLEL) || defined (ILI9488_DRIVER)
|
||||
#define SPI_32(H,L) ( (H)<<16 | (L) )
|
||||
#else
|
||||
#define SPI_32(H,L) ( ((H)<<8 | (H)>>8) | (((L)<<8 | (L)>>8)<<16 ) )
|
||||
#endif
|
||||
// Swap byte order for concatenated 16 bit colors
|
||||
// AB CD -> DCBA for 32 bit register write
|
||||
#define COL_32(H,L) ( ((H)<<8 | (H)>>8) | (((L)<<8 | (L)>>8)<<16 ) )
|
||||
#endif
|
||||
|
||||
#if defined (ESP32) && defined (ESP32_PARALLEL)
|
||||
// Mask for the 8 data bits to set pin directions
|
||||
|
|
@ -230,7 +302,7 @@
|
|||
#define tft_Write_16(C) WR_L;GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t)(C >> 0)); WR_H
|
||||
#else
|
||||
#define tft_Write_16(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
|
||||
GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t)(C >> 0)); WR_H
|
||||
#endif
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
|
|
@ -253,34 +325,89 @@
|
|||
#elif defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) SPI.transfer(C)
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
#define tft_Write_16(C) SPI.transfer((C & 0xF800)>>8); \
|
||||
SPI.transfer((C & 0x07E0)>>3); \
|
||||
SPI.transfer((C & 0x001F)<<3)
|
||||
#define tft_Write_16(C) spi.transfer((C & 0xF800)>>8); \
|
||||
spi.transfer((C & 0x07E0)>>3); \
|
||||
spi.transfer((C & 0x001F)<<3)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
#define tft_Write_16S(C) SPI.transfer(C & 0xF8); \
|
||||
SPI.transfer((C & 0xE0)>>11 | (C & 0x07)<<5); \
|
||||
SPI.transfer((C & 0x1F00)>>5)
|
||||
#define tft_Write_16S(C) spi.transfer(C & 0xF8); \
|
||||
spi.transfer((C & 0xE0)>>11 | (C & 0x07)<<5); \
|
||||
spi.transfer((C & 0x1F00)>>5)
|
||||
// Write 32 bits to TFT
|
||||
#define tft_Write_32(C) SPI.write32(C)
|
||||
#define tft_Write_32(C) spi.write32(C)
|
||||
|
||||
#elif defined (RPI_ILI9486_DRIVER)
|
||||
|
||||
#define tft_Write_8(C) SPI.transfer(0); SPI.transfer(C)
|
||||
#define tft_Write_16(C) SPI.write16(C)
|
||||
#define tft_Write_32(C) SPI.write32(C)
|
||||
#define tft_Write_8(C) spi.transfer(0); spi.transfer(C)
|
||||
#define tft_Write_16(C) spi.write16(C)
|
||||
#define tft_Write_16S(C) spi.write16(C<<8 | C>>8)
|
||||
#define tft_Write_32(C) spi.write32(C)
|
||||
|
||||
#else
|
||||
#elif defined ESP8266
|
||||
|
||||
#define tft_Write_8(C) SPI.transfer(C)
|
||||
#define tft_Write_16(C) SPI.write16(C)
|
||||
#define tft_Write_32(C) SPI.write32(C)
|
||||
#define tft_Write_8(C) spi.write(C)
|
||||
#define tft_Write_16(C) spi.write16(C)
|
||||
#define tft_Write_32(C) spi.write32(C)
|
||||
|
||||
#else // ESP32 using SPI with 16 bit color display
|
||||
|
||||
// ESP32 low level SPI writes for 8, 16 and 32 bit values
|
||||
// to avoid the function call overhead
|
||||
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), 8-1); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), C); \
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_PORT), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||
|
||||
// Write 16 bits with corrected endianess for 16 bit colours
|
||||
#define tft_Write_16(C) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), 16-1); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), C<<8 | C>>8); \
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_PORT), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||
|
||||
// Write 16 bits
|
||||
#define tft_Write_16S(C) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), 16-1); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), C); \
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_PORT), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||
|
||||
// Write 32 bits
|
||||
#define tft_Write_32(C) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), 32-1); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), C); \
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_PORT), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined (ESP32_PARALLEL)
|
||||
|
||||
// Read from display using SPI or software SPI
|
||||
#if defined (ESP8266) && defined (TFT_SDA_READ)
|
||||
// Use a bit banged function call for ESP8266 and bi-directional SDA pin
|
||||
#define SCLK_L GPOC=sclkpinmask
|
||||
#define SCLK_H GPOS=sclkpinmask
|
||||
#else
|
||||
// Use a SPI read transfer
|
||||
#define tft_Read_8() spi.transfer(0)
|
||||
#endif
|
||||
|
||||
// Make sure TFT_MISO is defined if not used to avoid an error message
|
||||
#ifndef TFT_MISO
|
||||
#define TFT_MISO -1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LOAD_GFXFF
|
||||
// We can include all the free fonts and they will only be built into
|
||||
// the sketch if they are used
|
||||
|
|
@ -406,6 +533,7 @@ template <typename T> static inline void
|
|||
swap_coord(T& a, T& b) { T t = a; a = b; b = t; }
|
||||
|
||||
#ifndef min
|
||||
// Return minimum of two numbers, may already be defined
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
|
@ -413,11 +541,20 @@ swap_coord(T& a, T& b) { T t = a; a = b; b = t; }
|
|||
// by calling getSetup(), zero impact on code size unless used, mainly for diagnostics
|
||||
typedef struct
|
||||
{
|
||||
String version = TFT_ESPI_VERSION;
|
||||
int16_t esp;
|
||||
uint8_t trans;
|
||||
uint8_t serial;
|
||||
uint8_t overlap;
|
||||
|
||||
#if defined (ESP32)
|
||||
#if defined (USE_HSPI_PORT)
|
||||
uint8_t port = HSPI;
|
||||
#else
|
||||
uint8_t port = VSPI;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint16_t tft_driver; // Hexadecimal code
|
||||
uint16_t tft_width; // Rotation 0 width and height
|
||||
uint16_t tft_height;
|
||||
|
|
@ -453,6 +590,7 @@ int8_t pin_tft_d7;
|
|||
int8_t pin_tch_cs;
|
||||
|
||||
int16_t tft_spi_freq;
|
||||
int16_t tft_rd_freq;
|
||||
int16_t tch_spi_freq;
|
||||
} setup_t;
|
||||
|
||||
|
|
@ -529,20 +667,20 @@ class TFT_eSPI : public Print {
|
|||
void init(uint8_t tc = TAB_COLOUR), begin(uint8_t tc = TAB_COLOUR); // Same - begin included for backwards compatibility
|
||||
|
||||
// These are virtual so the TFT_eSprite class can override them with sprite specific functions
|
||||
virtual void drawPixel(uint32_t x, uint32_t y, uint32_t color),
|
||||
drawChar(int32_t x, int32_t y, unsigned char c, uint32_t color, uint32_t bg, uint8_t size),
|
||||
virtual void drawPixel(int32_t x, int32_t y, uint32_t color),
|
||||
drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size),
|
||||
drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color),
|
||||
drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color),
|
||||
drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color),
|
||||
fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color);
|
||||
|
||||
virtual int16_t drawChar(unsigned int uniCode, int x, int y, int font),
|
||||
drawChar(unsigned int uniCode, int x, int y),
|
||||
virtual int16_t drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font),
|
||||
drawChar(uint16_t uniCode, int32_t x, int32_t y),
|
||||
height(void),
|
||||
width(void);
|
||||
|
||||
// The TFT_eSprite class inherits the following functions
|
||||
void setWindow(int16_t x0, int16_t y0, int16_t x1, int16_t y1),
|
||||
void setWindow(int32_t xs, int32_t ys, int32_t xe, int32_t ye),
|
||||
pushColor(uint16_t color),
|
||||
pushColor(uint16_t color, uint32_t len),
|
||||
pushColors(uint16_t *data, uint32_t len, bool swap = true), // With byte swap option
|
||||
|
|
@ -562,8 +700,8 @@ class TFT_eSPI : public Print {
|
|||
fillCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color),
|
||||
fillCircleHelper(int32_t x0, int32_t y0, int32_t r, uint8_t cornername, int32_t delta, uint32_t color),
|
||||
|
||||
drawEllipse(int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint16_t color),
|
||||
fillEllipse(int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint16_t color),
|
||||
drawEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color),
|
||||
fillEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color),
|
||||
|
||||
drawTriangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color),
|
||||
fillTriangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color),
|
||||
|
|
@ -572,7 +710,7 @@ class TFT_eSPI : public Print {
|
|||
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color),
|
||||
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor, uint16_t bgcolor),
|
||||
setBitmapColor(uint16_t fgcolor, uint16_t bgcolor), // For 1bpp sprites
|
||||
|
||||
setPivot(int16_t x, int16_t y),
|
||||
setCursor(int16_t x, int16_t y),
|
||||
setCursor(int16_t x, int16_t y, uint8_t font),
|
||||
setTextColor(uint16_t color),
|
||||
|
|
@ -596,30 +734,30 @@ class TFT_eSPI : public Print {
|
|||
|
||||
commandList(const uint8_t *addr);
|
||||
|
||||
uint8_t readcommand8(uint8_t cmd_function, uint8_t index);
|
||||
uint16_t readcommand16(uint8_t cmd_function, uint8_t index);
|
||||
uint32_t readcommand32(uint8_t cmd_function, uint8_t index);
|
||||
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);
|
||||
|
||||
// Read the colour of a pixel at x,y and return value in 565 format
|
||||
uint16_t readPixel(int32_t x0, int32_t y0);
|
||||
|
||||
// The next functions can be used as a pair to copy screen blocks (or horizontal/vertical lines) to another location
|
||||
// Read a block of pixels to a data buffer, buffer is 16 bit and the array size must be at least w * h
|
||||
void readRect(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h, uint16_t *data);
|
||||
void readRect(int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data);
|
||||
// Write a block of pixels to the screen
|
||||
void pushRect(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h, uint16_t *data);
|
||||
void pushRect(int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data);
|
||||
|
||||
// These are used to render images or sprites stored in RAM arrays
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, uint16_t *data);
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, uint16_t *data, uint16_t transparent);
|
||||
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);
|
||||
|
||||
// These are used to render images stored in FLASH (PROGMEM)
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, const uint16_t *data, uint16_t transparent);
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, const uint16_t *data);
|
||||
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);
|
||||
|
||||
// These are used by pushSprite for 1 and 8 bit colours
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, uint8_t *data, bool bpp8 = true);
|
||||
void pushImage(int32_t x0, int32_t y0, uint32_t w, uint32_t h, uint8_t *data, uint8_t transparent, bool bpp8 = true);
|
||||
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);
|
||||
|
||||
// Swap the byte order for pushImage() - corrects endianness
|
||||
void setSwapBytes(bool swap);
|
||||
|
|
@ -637,41 +775,64 @@ class TFT_eSPI : public Print {
|
|||
int16_t getCursorX(void),
|
||||
getCursorY(void);
|
||||
|
||||
int16_t getPivotX(void),
|
||||
getPivotY(void);
|
||||
|
||||
uint16_t fontsLoaded(void),
|
||||
color565(uint8_t red, uint8_t green, uint8_t blue), // Convert 8 bit red, green and blue to 16 bits
|
||||
color8to16(uint8_t color332); // Convert 8 bit colour to 16 bits
|
||||
|
||||
int16_t drawNumber(long long_num,int poX, int poY, int font),
|
||||
drawNumber(long long_num,int poX, int poY),
|
||||
drawFloat(float floatNumber,int decimal,int poX, int poY, int font),
|
||||
drawFloat(float floatNumber,int decimal,int poX, int poY),
|
||||
int16_t drawNumber(long long_num, int32_t poX, int32_t poY, uint8_t font),
|
||||
drawNumber(long long_num, int32_t poX, int32_t poY),
|
||||
drawFloat(float floatNumber, uint8_t decimal, int32_t poX, int32_t poY, uint8_t font),
|
||||
drawFloat(float floatNumber, uint8_t decimal, int32_t poX, int32_t poY),
|
||||
|
||||
// Handle char arrays
|
||||
drawString(const char *string, int poX, int poY, int font),
|
||||
drawString(const char *string, int poX, int poY),
|
||||
drawCentreString(const char *string, int dX, int poY, int font), // Deprecated, use setTextDatum() and drawString()
|
||||
drawRightString(const char *string, int dX, int poY, int font), // Deprecated, use setTextDatum() and drawString()
|
||||
drawString(const char *string, int32_t poX, int32_t poY, uint8_t font),
|
||||
drawString(const char *string, int32_t poX, int32_t poY),
|
||||
drawCentreString(const char *string, int32_t dX, int32_t poY, uint8_t font), // Deprecated, use setTextDatum() and drawString()
|
||||
drawRightString(const char *string, int32_t dX, int32_t poY, uint8_t font), // Deprecated, use setTextDatum() and drawString()
|
||||
|
||||
// Handle String type
|
||||
drawString(const String& string, int poX, int poY, int font),
|
||||
drawString(const String& string, int poX, int poY),
|
||||
drawCentreString(const String& string, int dX, int poY, int font), // Deprecated, use setTextDatum() and drawString()
|
||||
drawRightString(const String& string, int dX, int poY, int font); // Deprecated, use setTextDatum() and drawString()
|
||||
drawString(const String& string, int32_t poX, int32_t poY, uint8_t font),
|
||||
drawString(const String& string, int32_t poX, int32_t poY),
|
||||
drawCentreString(const String& string, int32_t dX, int32_t poY, uint8_t font), // Deprecated, use setTextDatum() and drawString()
|
||||
drawRightString(const String& string, int32_t dX, int32_t poY, uint8_t font); // Deprecated, use setTextDatum() and drawString()
|
||||
|
||||
int16_t textWidth(const char *string, int font),
|
||||
int16_t textWidth(const char *string, uint8_t font),
|
||||
textWidth(const char *string),
|
||||
textWidth(const String& string, int font),
|
||||
textWidth(const String& string, uint8_t font),
|
||||
textWidth(const String& string),
|
||||
fontHeight(int16_t font),
|
||||
fontHeight(void);
|
||||
|
||||
void setAddrWindow(int32_t xs, int32_t ys, int32_t xe, int32_t ye);
|
||||
void setAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h);
|
||||
|
||||
// Compatibility additions
|
||||
void startWrite(void); // Begin SPI transaction
|
||||
void writeColor(uint16_t color, uint32_t len); // Write colours without transaction overhead
|
||||
void endWrite(void); // End SPI transaction
|
||||
|
||||
uint16_t decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining);
|
||||
uint16_t decodeUTF8(uint8_t c);
|
||||
size_t write(uint8_t);
|
||||
|
||||
#ifdef TFT_SDA_READ
|
||||
#if defined (ESP8266) && defined (TFT_SDA_READ)
|
||||
uint8_t tft_Read_8(void);
|
||||
#endif
|
||||
void begin_SDA_Read(void);
|
||||
void end_SDA_Read(void);
|
||||
#endif
|
||||
|
||||
// Set or get an arbitrary library attribute or configuration option
|
||||
void setAttribute(uint8_t id = 0, uint8_t a = 0);
|
||||
uint8_t getAttribute(uint8_t id = 0);
|
||||
|
||||
void getSetup(setup_t& tft_settings); // Sketch provides the instance to populate
|
||||
|
||||
static SPIClass& getSPIinstance(void);
|
||||
|
||||
int32_t cursor_x, cursor_y, padX;
|
||||
uint32_t textcolor, textbgcolor;
|
||||
|
||||
|
|
@ -682,6 +843,12 @@ class TFT_eSPI : public Print {
|
|||
textdatum, // Text reference datum
|
||||
rotation; // Display rotation (0-3)
|
||||
|
||||
int16_t _xpivot; // x pivot point coordinate
|
||||
int16_t _ypivot; // x pivot point coordinate
|
||||
|
||||
uint8_t decoderState = 0; // UTF8 decoder state
|
||||
uint16_t decoderBuffer; // Unicode code-point buffer
|
||||
|
||||
private:
|
||||
|
||||
inline void spi_begin() __attribute__((always_inline));
|
||||
|
|
@ -690,14 +857,14 @@ class TFT_eSPI : public Print {
|
|||
inline void spi_begin_read() __attribute__((always_inline));
|
||||
inline void spi_end_read() __attribute__((always_inline));
|
||||
|
||||
void readAddrWindow(int32_t xs, int32_t ys, int32_t xe, int32_t ye);
|
||||
void readAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h);
|
||||
|
||||
uint8_t tabcolor,
|
||||
colstart = 0, rowstart = 0; // some ST7735 displays need this changed
|
||||
|
||||
volatile uint32_t *dcport, *csport;
|
||||
|
||||
uint32_t cspinmask, dcpinmask, wrpinmask;
|
||||
uint32_t cspinmask, dcpinmask, wrpinmask, sclkpinmask;
|
||||
|
||||
#if defined(ESP32_PARALLEL)
|
||||
uint32_t xclr_mask, xdir_mask, xset_mask[256];
|
||||
|
|
@ -710,22 +877,25 @@ class TFT_eSPI : public Print {
|
|||
|
||||
int32_t win_xe, win_ye;
|
||||
|
||||
uint32_t _init_width, _init_height; // Display w/h as input, used by setRotation()
|
||||
uint32_t _width, _height; // Display w/h as modified by current rotation
|
||||
uint32_t addr_row, addr_col;
|
||||
int32_t _init_width, _init_height; // Display w/h as input, used by setRotation()
|
||||
int32_t _width, _height; // Display w/h as modified by current rotation
|
||||
int32_t addr_row, addr_col;
|
||||
|
||||
uint32_t fontsloaded;
|
||||
|
||||
uint8_t glyph_ab, // glyph height above baseline
|
||||
glyph_bb; // glyph height below baseline
|
||||
uint8_t glyph_ab, // glyph delta Y (height) above baseline
|
||||
glyph_bb; // glyph delta Y (height) below baseline
|
||||
|
||||
bool isDigits; // adjust bounding box for numbers to reduce visual jiggling
|
||||
bool textwrapX, textwrapY; // If set, 'wrap' text at right and optionally bottom edge of display
|
||||
bool _swapBytes; // Swap the byte order for TFT pushImage()
|
||||
bool locked, inTransaction; // Transaction and mutex lock flags for ESP32
|
||||
|
||||
bool _booted;
|
||||
bool _booted; // init() or begin() has already run once
|
||||
bool _cp437; // If set, use correct CP437 charset (default is ON)
|
||||
bool _utf8; // If set, use UTF-8 decoder in print stream 'write()' function (default ON)
|
||||
|
||||
uint32_t _lastColor;
|
||||
uint32_t _lastColor; // Buffered value of last colour used
|
||||
|
||||
#ifdef LOAD_GFXFF
|
||||
GFXfont *gfxFont;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// 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 font, size and character ranges in the user configuration section
|
||||
// of this sketch, which starts at line 120. Instructions start at line 50.
|
||||
|
||||
|
||||
/*
|
||||
Software License Agreement (FreeBSD License)
|
||||
|
|
@ -36,47 +38,61 @@ Software License Agreement (FreeBSD License)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// This is a processing sketch to create font files for the TFT_eSPI library:
|
||||
|
||||
// https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
// Coded by Bodmer January 2018
|
||||
// Coded by Bodmer January 2018, updated 10/2/19
|
||||
// Version 0.8
|
||||
|
||||
// See comments below in code for specifying the font parameters
|
||||
// (point size, unicode blocks to include etc). Ranges of characers or
|
||||
// specific individual unicodes can be included in the created font file/
|
||||
// >>>>>>>>>>>>>>>>>>>> INSTRUCTIONS <<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
// See comments below in code for specifying the font parameters (point size,
|
||||
// unicode blocks to include etc). Ranges of characters (glyphs) and specific
|
||||
// individual glyphs can be included in the created "*.vlw" font file.
|
||||
|
||||
// Created fonts are saved in the sketches "FontFiles" folder. Press Ctrl+K to
|
||||
// see that folder.
|
||||
// see that folder location.
|
||||
|
||||
// 16 bit unicodes in the range 0x0000 - 0xFFFF are supported.
|
||||
// 16 bit Unicode point codes in the range 0x0000 - 0xFFFF are supported.
|
||||
// Codes 0-31 are control codes such as "tab" and "carraige return" etc.
|
||||
// and 32 is a "space", these should NOT be included.
|
||||
|
||||
// The sketch will convert True Type (a .ttf or .otf file) file stored in the
|
||||
// sketches "Data" folder as well as your computers system fonts.
|
||||
// sketches "Data" folder as well as your computers' system fonts.
|
||||
|
||||
// To maximise rendering performance only include the characters you will use.
|
||||
// Characters at the start of the file will render faster than those at the end.
|
||||
// To maximise rendering performance and the memory consumed only include the characters
|
||||
// you will use. Characters at the start of the file will render faster than those at
|
||||
// the end due to the buffering and file seeking overhead.
|
||||
|
||||
// The inclusion of "non-existant" characters in a font may give unpredicatable results
|
||||
// when rendering with the TFT_eSPI library. The Processing sketch window that pops up
|
||||
// to show the font characters will print "boxes" (also known as Tofu!) for non existant
|
||||
// characters.
|
||||
|
||||
// Once created the files must be loaded into the ESP32 or ESP8266 SPIFFS memory
|
||||
// using the Arduino IDE plugin detailed here:
|
||||
// https://github.com/esp8266/arduino-esp8266fs-plugin
|
||||
// https://github.com/me-no-dev/arduino-esp32fs-plugin
|
||||
|
||||
// The sketch list all the available PC fonts to the console, you may need to increase
|
||||
// console line count (in preferences.txt) to stop some fonts scrolling out of view.
|
||||
// When the sketch is run it will generate a file called "System_Font_List.txt" in the
|
||||
// sketch "FontFiles" folder, press Ctrl+K to see it. Open the file in a text editor to
|
||||
// view it. This list provides the font reference number needed below to locate that
|
||||
// font on your system.
|
||||
|
||||
// The sketch also lists all the available system fonts to the console, you can increase
|
||||
// the console line count (in preferences.txt) to stop some fonts scrolling out of view.
|
||||
// See link in File>Preferences to locate "preferences.txt" file. You must close
|
||||
// Processing then edit the file lines. If Processing is not closed first then the
|
||||
// edits will be overwritten by defaults! Edit "preferences.txt" as follows for
|
||||
// 1000 lines, then save, then run Processing again:
|
||||
// 3000 lines, then save, then run Processing again:
|
||||
|
||||
// console.length=3000; // Line 4 in file
|
||||
// console.scrollback.lines=3000; // Line 7 in file
|
||||
|
||||
/*
|
||||
console.length=1000 // Line 4 in file
|
||||
console.scrollback.lines=1000 // Line 7 in file
|
||||
*/
|
||||
|
||||
// Useful links:
|
||||
/*
|
||||
/*
|
||||
|
||||
https://en.wikipedia.org/wiki/Unicode_font
|
||||
|
||||
|
|
@ -86,33 +102,39 @@ Software License Agreement (FreeBSD License)
|
|||
http://savannah.gnu.org/projects/freefont/
|
||||
|
||||
http://www.google.com/get/noto/
|
||||
|
||||
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
https://github.com/esp8266/arduino-esp8266fs-plugin
|
||||
https://github.com/me-no-dev/arduino-esp32fs-plugin
|
||||
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
>>>>>>>>>>>>>>>>>>>> END OF INSTRUCTIONS <<<<<<<<<<<<<<<<<<<< */
|
||||
|
||||
import java.awt.Desktop;
|
||||
|
||||
import java.awt.Desktop; // Required to allow sketch to open file windows
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// >>>>>>>>>> USER CONFIGURED PARAMETERS START HERE <<<<<<<<<<
|
||||
|
||||
// Use font number or name, -1 for fontNumber means use fontName below, a value >=0 means use system font number from list.
|
||||
// When the sketch is run it will generate a file called "systemFontList.txt" in the sketch folder, press Ctrl+K to see it.
|
||||
// Open the "systemFontList.txt" in a text editor to view the font files and reference numbers for your system.
|
||||
|
||||
// Use font name for ttf files placed in the "Data" folder or the font number seen in IDE Console for system fonts
|
||||
int fontNumber = -1; // << Use [Number] in brackets from the fonts listed.
|
||||
|
||||
// OR use font name for ttf files placed in the "Data" folder or the font number seen in IDE Console for system fonts
|
||||
// the font numbers are listed when the sketch is run.
|
||||
// | 1 2 | Maximum filename size for SPIFFS is 32 including leading /
|
||||
// | 1 2 | Maximum filename size for SPIFFS is 31 including leading /
|
||||
// 1234567890123456789012345 and added point size and .vlw extension, so max is 25
|
||||
String fontName = "Final-Frontier"; //Manually crop the filename length later after creation if needed
|
||||
|
||||
String fontType = ".ttf"; //SPIFFS does not accept underscore in filename!
|
||||
String fontName = "Final-Frontier"; // Manually crop the filename length later after creation if needed
|
||||
// Note: SPIFFS does NOT accept underscore in a filename!
|
||||
String fontType = ".ttf";
|
||||
//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.
|
||||
int fontNumber = -1; // << Use [Number] in brackets from the fonts listed in console window
|
||||
|
||||
// Define the font size in points for the created font file
|
||||
int fontSize = 28;
|
||||
// Define the font size in points for the TFT_eSPI font file
|
||||
int fontSize = 20;
|
||||
|
||||
// Font size to use in the Processing sketch display window that pops up (can be different to above)
|
||||
int displayFontSize = 28;
|
||||
|
|
@ -125,7 +147,7 @@ int displayFontSize = 28;
|
|||
static final int[] unicodeBlocks = {
|
||||
// The list below has been created from the table here: https://en.wikipedia.org/wiki/Unicode_block
|
||||
// Remove // at start of lines below to include that unicode block, different code ranges can also be specified by
|
||||
// editting the start and end of range values. Multiple lines from the list below can be included, limited only by
|
||||
// editting the start and end-of-range values. Multiple lines from the list below can be included, limited only by
|
||||
// the final font file size!
|
||||
|
||||
// Block range, //Block name, Code points, Assigned characters, Scripts
|
||||
|
|
@ -298,20 +320,20 @@ static final int[] unicodeBlocks = {
|
|||
//0x0061, 0x007A, //Example custom range (Lower case a-z)
|
||||
};
|
||||
|
||||
// Here we specify specific individual Unicodes to be included (appended at end of selected range)
|
||||
// Here we specify particular individual Unicodes to be included (appended at end of selected range)
|
||||
static final int[] specificUnicodes = {
|
||||
|
||||
// Commonly used codes, add or remove // in next line
|
||||
// 0x00A3, 0x00B0, 0x00B5, 0x03A9, 0x20AC, // £ ° µ Ω €
|
||||
|
||||
// Numbers and characters for showing time, change next line to //* to use
|
||||
/*
|
||||
/*
|
||||
0x002B, 0x002D, 0x002E, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, // - + . 0 1 2 3 4
|
||||
0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x0061, 0x006D, // 5 6 7 8 9 : a m
|
||||
0x0070, // p
|
||||
//*/
|
||||
//*/
|
||||
|
||||
// More characters, change next line to //* to use
|
||||
// More characters for TFT_eSPI test sketches, change next line to //* to use
|
||||
/*
|
||||
0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x010C, 0x010D,
|
||||
0x010E, 0x010F, 0x0110, 0x0111, 0x0118, 0x0119, 0x011A, 0x011B,
|
||||
|
|
@ -337,8 +359,8 @@ static final int[] specificUnicodes = {
|
|||
//*/
|
||||
};
|
||||
|
||||
|
||||
// >>>>>>>>>> USER CONFIGURED PARAMETERS END HERE <<<<<<<<<<
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Variable to hold the inclusive Unicode range (16 bit values only for this sketch)
|
||||
|
|
@ -347,7 +369,10 @@ int lastUnicode = 0;
|
|||
|
||||
PFont myFont;
|
||||
|
||||
PrintWriter logOutput;
|
||||
|
||||
void setup() {
|
||||
logOutput = createWriter("FontFiles/System_Font_List.txt");
|
||||
|
||||
size(1000, 800);
|
||||
|
||||
|
|
@ -355,6 +380,15 @@ void setup() {
|
|||
String[] fontList = PFont.list();
|
||||
printArray(fontList);
|
||||
|
||||
// Save font list to file
|
||||
for (int x = 0; x < fontList.length; x++)
|
||||
{
|
||||
logOutput.print("[" + x + "] ");
|
||||
logOutput.println(fontList[x]);
|
||||
}
|
||||
logOutput.flush(); // Writes the remaining data to the file
|
||||
logOutput.close(); // Finishes the file
|
||||
|
||||
// Set the fontName from the array number or the defined fontName
|
||||
if (fontNumber >= 0)
|
||||
{
|
||||
|
|
@ -410,19 +444,19 @@ void setup() {
|
|||
}
|
||||
}
|
||||
|
||||
// loading the range specified
|
||||
// loading the specific point codes
|
||||
for (int i = 0; i < specificUnicodes.length; i++) {
|
||||
charset[index] = Character.toChars(specificUnicodes[i])[0];
|
||||
index++;
|
||||
}
|
||||
|
||||
// Make font smooth
|
||||
|
||||
// Make font smooth (anti-aliased)
|
||||
boolean smooth = true;
|
||||
|
||||
// Create the font in memory
|
||||
myFont = createFont(fontName+fontType, displayFontSize, smooth, charset);
|
||||
|
||||
// Print a few characters to the sketch window
|
||||
// Print characters to the sketch window
|
||||
fill(0, 0, 0);
|
||||
textFont(myFont);
|
||||
|
||||
|
|
@ -444,10 +478,10 @@ void setup() {
|
|||
int unicode = charset[index];
|
||||
float cwidth = textWidth((char)unicode) + 2;
|
||||
if ( (x + cwidth) > (width - gapx) ) break;
|
||||
|
||||
// Draw the letter to the screen
|
||||
|
||||
// Draw the glyph to the screen
|
||||
text(new String(Character.toChars(unicode)), x, y);
|
||||
|
||||
|
||||
// Move cursor
|
||||
x += cwidth;
|
||||
// Increment the counter
|
||||
|
|
@ -458,12 +492,12 @@ void setup() {
|
|||
}
|
||||
|
||||
|
||||
// creating font
|
||||
// creating font to save as a file
|
||||
PFont font;
|
||||
|
||||
font = createFont(fontName+fontType, fontSize, smooth, charset);
|
||||
|
||||
println("Created font " + fontName + str(fontSize) + ".vlw");
|
||||
println("Created font " + fontName + str(fontSize) + ".vlw");
|
||||
|
||||
// creating file
|
||||
try {
|
||||
|
|
@ -486,4 +520,4 @@ void setup() {
|
|||
catch(IOException e) {
|
||||
println("Doh! Failed to create the file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
135
User_Setup.h
135
User_Setup.h
|
|
@ -8,31 +8,51 @@
|
|||
// 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
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
// Section 1. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define ST7735_DRIVER // Define additional parameters below for this display
|
||||
//#define ILI9163_DRIVER // Define additional parameters below for this display
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
//#define HX8357D_DRIVER
|
||||
//#define ILI9481_DRIVER
|
||||
//#define ILI9486_DRIVER
|
||||
//#define ILI9488_DRIVER
|
||||
//#define ST7789_DRIVER
|
||||
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
|
||||
//#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
|
||||
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
|
||||
//#define R61581_DRIVER
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
// Some displays support SPI reads via the MISO pin, other displays have a single
|
||||
// bi-directional SDA pin and the library will try to read this via the MOSI line.
|
||||
// To use the SDA line for reading data from the TFT uncomment the following line:
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
// #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 display only
|
||||
|
||||
// For ST7789 ONLY, define the colour order IF the blue and red are swapped on your display
|
||||
// Try ONE option at a time to find the correct colour order for your display
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
// For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below
|
||||
|
||||
// #define M5STACK
|
||||
|
||||
// For ST7789, ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
// #define TFT_WIDTH 80
|
||||
// #define TFT_WIDTH 128
|
||||
// #define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
|
||||
// #define TFT_HEIGHT 160
|
||||
// #define TFT_HEIGHT 128
|
||||
// #define TFT_HEIGHT 240 // ST7789 240 x 240
|
||||
// #define TFT_HEIGHT 320 // ST7789 240 x 320
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
|
|
@ -41,17 +61,33 @@
|
|||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
// #define ST7735_INITB
|
||||
// #define ST7735_GREENTAB
|
||||
// #define ST7735_GREENTAB2
|
||||
// #define ST7735_GREENTAB3
|
||||
// #define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
// #define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset)
|
||||
// #define ST7735_REDTAB
|
||||
// #define ST7735_BLACKTAB
|
||||
// #define ST7735_REDTAB160x80 // For 160 x 80 display with 24 pixel offset
|
||||
|
||||
// If colours are inverted (white shows as black) then uncomment one of the next
|
||||
// 2 lines try both options, one of the options should correct the inversion.
|
||||
|
||||
// #define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
||||
// If a backlight control signal is available then define the TFT_BL pin in Section 2
|
||||
// below. The backlight will be turned ON when tft.begin() is called, but the library
|
||||
// needs to know if the LEDs are ON with the pin HIGH or LOW. If the LEDs are to be
|
||||
// driven with a PWM signal or turned OFF/ON then this must be handled by the user
|
||||
// sketch. e.g. with digitalWrite(TFT_BL, LOW);
|
||||
|
||||
// #define TFT_BACKLIGHT_ON HIGH // HIGH or LOW are options
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
// Section 2. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
|
@ -79,7 +115,6 @@
|
|||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
|
|
@ -92,7 +127,9 @@
|
|||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin)
|
||||
|
||||
//#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
|
|
@ -105,14 +142,15 @@
|
|||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
|
|
@ -122,11 +160,17 @@
|
|||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TFT_BL 32 // LED back-light (only for ST7789 with backlight control pin)
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
|
|
@ -134,11 +178,7 @@
|
|||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
//#define TFT_BL 32 // LED back-light (required for M5Stack)
|
||||
|
||||
// ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ######
|
||||
|
||||
|
|
@ -154,11 +194,11 @@
|
|||
|
||||
// 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_DC 15 // Data Command control pin - must 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_WR 4 // Write strobe control pin - must use a pin in the range 0-31
|
||||
//#define TFT_RD 2 // Read strobe control pin
|
||||
|
||||
//#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.
|
||||
|
|
@ -169,20 +209,6 @@
|
|||
//#define TFT_D6 27
|
||||
//#define TFT_D7 14
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
|
|
@ -208,16 +234,10 @@
|
|||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
// Section 4. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
|
@ -236,11 +256,16 @@
|
|||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000 // Optional reduced SPI frequency for reading TFT
|
||||
// Optional reduced SPI frequency for reading TFT
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default.
|
||||
// If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam)
|
||||
// then uncomment the following line:
|
||||
//#define USE_HSPI_PORT
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
|
|
@ -252,4 +277,4 @@
|
|||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
//#define SUPPORT_TRANSACTIONS
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -25,24 +25,31 @@
|
|||
//#include <User_Setups/Setup2_ST7735.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup3_ILI9163.h> // Setup file configured for my ILI9163
|
||||
//#include <User_Setups/Setup4_S6D02A1.h> // Setup file configured for my S6D02A1
|
||||
//#include <User_Setups/Setup5_RPi_ILI9486.h> // Setup file configured for my stock RPi TFT
|
||||
//#include <User_Setups/Setup6_RPi_Wr_ILI9486.h> // Setup file configured for my modified RPi TFT
|
||||
//#include <User_Setups/Setup7_ST7735_128x128.h> // Setup file configured for my ST7735 128x128 display
|
||||
//#include <User_Setups/Setup8_ILI9163_128x128.h> // Setup file configured for my ILI9163 128x128 display
|
||||
//#include <User_Setups/Setup9_ST7735_Overlap.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for ESP8266 and RPi TFT with touch
|
||||
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for ESP32 and RPi TFT with touch
|
||||
//#include <User_Setups/Setup5_RPi_ILI9486.h> // Setup file configured for my stock RPi TFT
|
||||
//#include <User_Setups/Setup6_RPi_Wr_ILI9486.h> // Setup file configured for my modified RPi TFT
|
||||
//#include <User_Setups/Setup7_ST7735_128x128.h> // Setup file configured for my ST7735 128x128 display
|
||||
//#include <User_Setups/Setup8_ILI9163_128x128.h> // Setup file configured for my ILI9163 128x128 display
|
||||
//#include <User_Setups/Setup9_ST7735_Overlap.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for ESP8266 and RPi TFT with touch
|
||||
|
||||
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for ESP32 and RPi TFT with touch
|
||||
//#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/Setup17_ePaper.h> // Setup file for any Waveshare ePaper display
|
||||
//#include <User_Setups/Setup18_ST7789.h> // Setup file configured for HX8357D (untested)
|
||||
//#include <User_Setups/Setup18_ST7789.h> // Setup file configured for ST7789
|
||||
|
||||
//#include <User_Setups/Setup20_ILI9488.h> // Setup file for ESP8266 and ILI9488 SPI bus TFT
|
||||
//#include <User_Setups/Setup21_ILI9488.h> // Setup file for ESP32 and ILI9488 SPI bus TFT
|
||||
|
||||
//#include <User_Setups/Setup22_TTGO_T4.h> // Setup file for ESP32 and TTGO T4 (BTC) ILI9341 SPI bus TFT
|
||||
//#include <User_Setups/Setup23_TTGO_TM.h> // Setup file for ESP32 and TTGO TM ST7789 SPI bus TFT
|
||||
//#include <User_Setups/Setup24_ST7789.h> // Setup file configured for ST7789 240 x 240
|
||||
|
||||
//#include <User_Setups/Setup43_ST7735.h> // Setup file configured for my ST7735S 80x160
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h>
|
||||
|
||||
|
||||
|
|
@ -58,6 +65,11 @@
|
|||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Identical looking TFT displays may have a different colour ordering in the 16 bit colour
|
||||
#define TFT_BGR 0 // Colour order Blue-Green-Red
|
||||
#define TFT_RGB 1 // Colour order Red-Green-Blue
|
||||
|
||||
|
||||
// Load the right driver definition - do not tinker here !
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
|
|
@ -92,6 +104,12 @@
|
|||
#elif defined (ST7789_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_Defines.h"
|
||||
#define TFT_DRIVER 0x7789
|
||||
#elif defined (R61581_DRIVER)
|
||||
#include "TFT_Drivers/R61581_Defines.h"
|
||||
#define TFT_DRIVER 0x6158
|
||||
#elif defined (ST7789_2_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_2_Defines.h"
|
||||
#define TFT_DRIVER 0x778B
|
||||
#elif defined (XYZZY_DRIVER) // <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||
#include "TFT_Drivers/XYZZY_Defines.h"
|
||||
#define TFT_DRIVER 0x0000
|
||||
|
|
@ -99,6 +117,7 @@
|
|||
#define TFT_DRIVER 0x0000
|
||||
#endif
|
||||
|
||||
|
||||
// These are the pins for all ESP8266 boards
|
||||
// Name GPIO Function
|
||||
#define PIN_D0 16 // WAKE
|
||||
|
|
|
|||
|
|
@ -1,86 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -90,75 +11,6 @@
|
|||
|
||||
#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -166,53 +18,14 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
#define SPI_FREQUENCY 16000000
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
#define SPI_FREQUENCY 20000000
|
||||
// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,117 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
//#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
//#define TFT_DC PIN_D3 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MOSI 23
|
||||
|
|
@ -123,43 +13,6 @@
|
|||
|
||||
#define TOUCH_CS 22 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 21 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -167,53 +20,11 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
#define SPI_FREQUENCY 20000000
|
||||
// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,131 +1,11 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
|
||||
#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
//#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
//#define TFT_DC PIN_D3 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
|
|
@ -134,31 +14,6 @@
|
|||
#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -166,53 +21,9 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
#define SPI_FREQUENCY 27000000
|
||||
|
|
|
|||
|
|
@ -1,37 +1,17 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Parallel bus is only supported on ESP32
|
||||
// Use ESP32 Parallel interface instead of SPI
|
||||
#define ESP32_PARALLEL
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
|
||||
#define ILI9481_DRIVER
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// ESP32 pins used
|
||||
// ESP32 pins used for UNO format board
|
||||
#define TFT_CS 33 // Chip select control pin
|
||||
#define TFT_DC 15 // Data Command control pin - use a pin in the range 0-31
|
||||
#define TFT_DC 15 // Data Command control pin - must use a pin in the range 0-31
|
||||
#define TFT_RST 32 // Reset pin
|
||||
|
||||
#define TFT_WR 4 // Write strobe control pin - use a pin in the range 0-31
|
||||
#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31
|
||||
#define TFT_RD 2
|
||||
|
||||
#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus
|
||||
|
|
@ -44,48 +24,12 @@
|
|||
#define TFT_D7 14
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +1,17 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Parallel bus is only supported on ESP32
|
||||
// Use ESP32 Parallel interface instead of SPI
|
||||
#define ESP32_PARALLEL
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
|
||||
#define ILI9341_DRIVER
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// ESP32 pins used for the parallel interface TFT
|
||||
#define TFT_CS 33 // Chip select control pin
|
||||
#define TFT_DC 15 // Data Command control pin - use a pin in the range 0-31
|
||||
#define TFT_DC 15 // Data Command control pin - must use a pin in the range 0-31
|
||||
#define TFT_RST 32 // Reset pin
|
||||
|
||||
#define TFT_WR 4 // Write strobe control pin - use a pin in the range 0-31
|
||||
#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31
|
||||
#define TFT_RD 2
|
||||
|
||||
#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus
|
||||
|
|
@ -44,48 +24,12 @@
|
|||
#define TFT_D7 14
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,87 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
#define HX8357D_DRIVER
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -89,77 +9,6 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -167,53 +16,16 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,37 +1,17 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Parallel bus is only supported on ESP32
|
||||
// Use ESP32 Parallel interface instead of SPI
|
||||
#define ESP32_PARALLEL
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
|
||||
#define ILI9488_DRIVER
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// ESP32 pins used
|
||||
#define TFT_CS 33 // Chip select control pin
|
||||
#define TFT_DC 15 // Data Command control pin - use a pin in the range 0-31
|
||||
#define TFT_DC 15 // Data Command control pin - must use a pin in the range 0-31
|
||||
#define TFT_RST 32 // Reset pin
|
||||
|
||||
#define TFT_WR 4 // Write strobe control pin - use a pin in the range 0-31
|
||||
#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31
|
||||
#define TFT_RD 2
|
||||
|
||||
#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus
|
||||
|
|
@ -44,48 +24,12 @@
|
|||
#define TFT_D7 14
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
#define EPD_DRIVER // ePaper driver
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// READ THIS READ THIS READ THIS READ THIS READ THIS READ THIS
|
||||
// Install the ePaper library for your own display size and type
|
||||
|
|
@ -48,47 +29,12 @@
|
|||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 below, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
#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
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -1,198 +1,26 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// Note that some sketches are designed for a particular TFT pixel width/height
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
//#define HX8357D_DRIVER
|
||||
//#define ILI9481_DRIVER
|
||||
//#define ILI9488_DRIVER
|
||||
#define ST7789_DRIVER
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
// #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 display only
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
// If colours are inverted (white shows as black) then uncomment one of the next
|
||||
// 2 lines try both options, one of the options should correct the inversion.
|
||||
// #define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
// For ST7789 ONLY, define the colour order IF the blue and red are swapped on your display
|
||||
// Try ONE option at a time to find the correct colour order for your display
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
// My ST7789 display has TCT_CS wired permananently low so the pin is not defined here
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
//#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#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)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -200,53 +28,17 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
//#define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,164 +1,13 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -166,53 +15,19 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,87 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
#define ILI9488_DRIVER
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -89,77 +9,6 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -167,53 +16,17 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,165 +1,16 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
#define ILI9488_DRIVER
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
//#define TFT_INVERSION_OFF
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
//#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
//#define TFT_DC PIN_D3 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MISO 19 // (leave TFT SDO disconnected if other SPI devices share MISO)
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_CS 15 // Chip select control pin
|
||||
#define TFT_DC 2 // Data Command control pin
|
||||
#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -167,53 +18,17 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
// Optional reduced SPI frequency for reading TFT
|
||||
#define SPI_READ_FREQUENCY 16000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
// Setup for the TTGO T4 ("Bitcoin Tracker") ESP32 board with 2.2" ILI9341 display
|
||||
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
#define ILI9341_DRIVER
|
||||
|
||||
#define TFT_MISO 12
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
|
||||
#define TFT_CS 27
|
||||
#define TFT_DC 26
|
||||
#define TFT_RST 5
|
||||
|
||||
#define LOAD_GLCD
|
||||
#define LOAD_FONT2
|
||||
#define LOAD_FONT4
|
||||
#define LOAD_FONT6
|
||||
#define LOAD_FONT7
|
||||
#define LOAD_FONT8
|
||||
#define LOAD_GFXFF
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
//#define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000 // Maximum for ILI9341
|
||||
|
||||
|
||||
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
// Setup for the TTGO TM (Music) ESP32 board with 2.4" ST7789V display
|
||||
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
#define ST7789_DRIVER
|
||||
|
||||
#define TFT_SDA_READ // Read from display, it only provides an SDA pin
|
||||
|
||||
#define TFT_MISO 19 // Must be defined even though it is not used
|
||||
#define TFT_MOSI 23 // Connected to display SDA line
|
||||
#define TFT_SCLK 18
|
||||
|
||||
#define TFT_CS 05
|
||||
#define TFT_DC 16
|
||||
#define TFT_RST 17
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define LOAD_GLCD
|
||||
#define LOAD_FONT2
|
||||
#define LOAD_FONT4
|
||||
#define LOAD_FONT6
|
||||
#define LOAD_FONT7
|
||||
#define LOAD_FONT8
|
||||
#define LOAD_GFXFF
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 40000000 // This display also seems to work reliably at 80MHz
|
||||
#define SPI_FREQUENCY 80000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
// ST7789 240 x 240 display with no chip select line
|
||||
|
||||
#define ST7789_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
//#define TFT_INVERSION_ON
|
||||
//#define TFT_INVERSION_OFF
|
||||
|
||||
// DSTIKE stepup
|
||||
//#define TFT_DC 23
|
||||
//#define TFT_RST 32
|
||||
//#define TFT_MOSI 26
|
||||
//#define TFT_SCLK 27
|
||||
|
||||
// Generic ESP32 setup
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS -1 // Not connected
|
||||
//#define TFT_DC 2
|
||||
//#define TFT_RST 4 // Connect reset to ensure display initialises
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS -1 // Define as not used
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_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 SMOOTH_FONT
|
||||
|
||||
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
@ -1,164 +1,21 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -169,50 +26,14 @@
|
|||
//#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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,86 +1,11 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -88,77 +13,6 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -169,50 +23,14 @@
|
|||
//#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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
// Setup for ESP32 and ST7735 80 x 160 TFT
|
||||
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
#define ST7735_DRIVER
|
||||
|
||||
|
||||
#define TFT_WIDTH 80
|
||||
#define TFT_HEIGHT 160
|
||||
|
||||
|
||||
#define ST7735_GREENTAB160x80
|
||||
|
||||
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_CS 15 // Chip select control pin
|
||||
#define TFT_DC 2 // Data Command control pin
|
||||
#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_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 SMOOTH_FONT
|
||||
|
||||
|
||||
//#define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
|
|
@ -1,86 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -88,77 +9,6 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -169,50 +19,14 @@
|
|||
//#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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
// #define SPI_FREQUENCY 40000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,164 +1,14 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -166,53 +16,14 @@
|
|||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
#define SPI_FREQUENCY 20000000
|
||||
// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,86 +1,7 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -88,131 +9,23 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
#define SPI_FREQUENCY 20000000
|
||||
// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,86 +1,14 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -88,77 +16,6 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -169,50 +26,14 @@
|
|||
//#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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,86 +1,11 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
|
|
@ -88,77 +13,6 @@
|
|||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -169,50 +23,13 @@
|
|||
//#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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -1,103 +1,14 @@
|
|||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||
// setups and then easily select which setup file is used by the compiler.
|
||||
//
|
||||
// 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!
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for ESP8266 NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (RS/AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// The DC (Data Command) pin may be labeled AO or RS (Register Select)
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
//#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
//#define TFT_DC PIN_D3 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
||||
// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ######
|
||||
|
||||
// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact
|
||||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
#define TFT_CS PIN_D3
|
||||
|
|
@ -108,57 +19,6 @@
|
|||
// In ESP8266 overlap mode the following must be defined
|
||||
#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
// For ESP32 Dev board (only tested with ILI9341 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
|
|
@ -169,50 +29,13 @@
|
|||
//#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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
|
||||
// fast and the TFT driver will not keep up and display corruption appears.
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display 27 MHz works OK.
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
// Transaction support is required if other SPI devices are connected.
|
||||
|
||||
// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex)
|
||||
// so changing it here has no effect
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
|
|||
|
|
@ -6,27 +6,53 @@
|
|||
//
|
||||
// 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!
|
||||
// Note that some sketches are designed for a particular TFT pixel width/height
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
// Section 1. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define ST7735_DRIVER // Define additional parameters below for this display
|
||||
//#define ILI9163_DRIVER // Define additional parameters below for this display
|
||||
//#define S6D02A1_DRIVER
|
||||
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
|
||||
//#define HX8357D_DRIVER
|
||||
//#define ILI9481_DRIVER
|
||||
//#define ILI9486_DRIVER
|
||||
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
|
||||
//#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
|
||||
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
|
||||
//#define R61581_DRIVER
|
||||
|
||||
// For M5Stack ESP32 module with integrated display ONLY, remove // in line below
|
||||
//#define M5STACK
|
||||
// Some displays support SPI reads via the MISO pin, other displays have a single
|
||||
// bi-directional SDA pin and the library will try to read this via the MOSI line.
|
||||
// To use the SDA line for reading data from the TFT uncomment the following line:
|
||||
|
||||
// For ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
//#define TFT_WIDTH 128
|
||||
//#define TFT_HEIGHT 160
|
||||
//#define TFT_HEIGHT 128
|
||||
// #define TFT_SDA_READ // This option if for ESP32 ONLY, tested with ST7789 display only
|
||||
|
||||
// For ST7789 ONLY, define the colour order IF the blue and red are swapped on your display
|
||||
// Try ONE option at a time to find the correct colour order for your display
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
// For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below
|
||||
|
||||
// #define M5STACK
|
||||
|
||||
// For ST7789, ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation
|
||||
// #define TFT_WIDTH 80
|
||||
// #define TFT_WIDTH 128
|
||||
// #define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
|
||||
// #define TFT_HEIGHT 160
|
||||
// #define TFT_HEIGHT 128
|
||||
// #define TFT_HEIGHT 240 // ST7789 240 x 240
|
||||
// #define TFT_HEIGHT 320 // ST7789 240 x 320
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
|
|
@ -35,17 +61,33 @@
|
|||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// this User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_GREENTAB3
|
||||
//#define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
// #define ST7735_INITB
|
||||
// #define ST7735_GREENTAB
|
||||
// #define ST7735_GREENTAB2
|
||||
// #define ST7735_GREENTAB3
|
||||
// #define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
// #define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset)
|
||||
// #define ST7735_REDTAB
|
||||
// #define ST7735_BLACKTAB
|
||||
// #define ST7735_REDTAB160x80 // For 160 x 80 display with 24 pixel offset
|
||||
|
||||
// If colours are inverted (white shows as black) then uncomment one of the next
|
||||
// 2 lines try both options, one of the options should correct the inversion.
|
||||
|
||||
// #define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
||||
// If a backlight control signal is available then define the TFT_BL pin in Section 2
|
||||
// below. The backlight will be turned ON when tft.begin() is called, but the library
|
||||
// needs to know if the LEDs are ON with the pin HIGH or LOW. If the LEDs are to be
|
||||
// driven with a PWM signal or turned OFF/ON then this must be handled by the user
|
||||
// sketch. e.g. with digitalWrite(TFT_BL, LOW);
|
||||
|
||||
// #define TFT_BACKLIGHT_ON HIGH // HIGH or LOW are options
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
// Section 2. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
|
@ -73,7 +115,6 @@
|
|||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
|
|
@ -86,9 +127,11 @@
|
|||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
//#define TOUCH_CS PIN_D1 // Chip select pin (T_CS) of touch screen
|
||||
//#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin)
|
||||
|
||||
//#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
|
|
@ -99,14 +142,15 @@
|
|||
// but saves pins for other functions.
|
||||
// Use NodeMCU SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3
|
||||
//#define TFT_CS PIN_D3
|
||||
//#define TFT_DC PIN_D5 // Data Command control pin
|
||||
//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// In ESP8266 overlap mode the following must be defined
|
||||
//#define TFT_SPI_OVERLAP
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######
|
||||
|
||||
|
|
@ -116,14 +160,16 @@
|
|||
//#define TFT_MISO 19
|
||||
//#define TFT_MOSI 23
|
||||
//#define TFT_SCLK 18
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 22 // Chip select pin (T_CS) of touch screen
|
||||
//#define TFT_BL 32 // LED back-light (only for ST7789 with backlight control pin)
|
||||
|
||||
//#define TFT_WR 21 // Write strobe for modified Raspberry Pi TFT only
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
// For the M5Stack module use these #define lines
|
||||
//#define TFT_MISO 19
|
||||
|
|
@ -132,23 +178,37 @@
|
|||
//#define TFT_CS 14 // Chip select control pin
|
||||
//#define TFT_DC 27 // Data Command control pin
|
||||
//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL 32 // LED back-light
|
||||
//#define TFT_BL 32 // LED back-light (required for M5Stack)
|
||||
|
||||
// ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ######
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||
//
|
||||
// ##################################################################################
|
||||
// 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!
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
// 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 - must 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 - must use a pin in the range 0-31
|
||||
//#define TFT_RD 2 // Read strobe control pin
|
||||
|
||||
//#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
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
|
|
@ -165,25 +225,19 @@
|
|||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#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_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
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Not used
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
// Section 4. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
|
|
@ -200,12 +254,18 @@
|
|||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 53400000
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
// Optional reduced SPI frequency for reading TFT
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default.
|
||||
// If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam)
|
||||
// then uncomment the following line to use the HSPI port:
|
||||
//#define USE_HSPI_PORT
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. When commented out the code size will be smaller and sketches will
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@
|
|||
^^^^
|
||||
*/
|
||||
|
||||
// When font files are placed in the Custom folder then they must also be #included here:
|
||||
// When font files are placed in the Custom folder (TFT_eSPI\Fonts\Custom) then they must
|
||||
// also be #included here:
|
||||
|
||||
// The comment added is a shorthand reference but this is not essential
|
||||
// The CF_OL24 etc are a shorthand reference, but this is not essential to use the fonts
|
||||
|
||||
#ifdef LOAD_GFXFF
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
// We need this header file to use FLASH as storage with PROGMEM directive:
|
||||
#include <pgmspace.h>
|
||||
|
||||
// Icon width and height
|
||||
const uint16_t alertWidth = 32;
|
||||
const uint16_t alertHeight = 32;
|
||||
|
||||
// The icon file can be created with the "UTFT ImageConverter 565" bitmap to .c file creation utility, more can be pasted in here
|
||||
const unsigned short alert[1024] PROGMEM={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0840,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1080,0xAC66,0xEDE8,0xFE69,0xC4C6,0x2901,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBCC6,0xFE68,0xFE68,0xFE6A,0xFE68,0xEDE8,0x18A1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8344,0xFE48,0xFE8C,0xFFDD,0xFFFF,0xFEF0,0xFE48,0xB466,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1880,0xEDC7,0xFE48,0xFF99,0xFFBC,0xFF9B,0xFFBD,0xFE6A,0xFE48,0x5A23,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9BE5,0xFE28,0xFED0,0xFFBC,0xFF7A,0xFF9A,0xFF9B,0xFF35,0xFE28,0xBCA6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3962,0xFE28,0xFE28,0xFF9A,0xFF79,0xFF9A,0xFF9B,0xFF9A,0xFFBD,0xFE6B,0xFE28,0x72E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB465,0xFE28,0xFEF2,0xFF7A,0xFF79,0xFF7A,0xFF9A,0xFF7A,0xFF7A,0xFF78,0xFE28,0xDD67,0x0860,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5A22,0xFE07,0xFE29,0xFF9B,0xFF37,0xFF58,0xFF79,0xFF79,0xFF79,0xFF58,0xFF9B,0xFEAE,0xFE07,0x93A4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC4A5,0xFE07,0xFF15,0xFF37,0xFF36,0xAD11,0x2965,0x2965,0xCDF4,0xFF37,0xFF37,0xFF79,0xFE07,0xFE07,0x2901,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7B03,0xFDE7,0xFE4B,0xFF79,0xFEF4,0xFF15,0xB552,0x2945,0x2945,0xDE55,0xFF16,0xFF15,0xFF58,0xFED1,0xFDE7,0xAC25,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0840,0xDD26,0xFDE7,0xFF57,0xFED3,0xFED2,0xFEF4,0xBD93,0x2124,0x2124,0xDE75,0xFF14,0xFED3,0xFED3,0xFF7A,0xFE08,0xFDE7,0x49A2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9BA4,0xFDC6,0xFE6E,0xFF36,0xFE90,0xFEB1,0xFED3,0xC592,0x2124,0x2124,0xE675,0xFED3,0xFEB2,0xFEB1,0xFEF3,0xFEF3,0xFDC6,0xBC45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 12, 416 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3141,0xF5C6,0xF5C7,0xFF58,0xFE90,0xFE6F,0xFE8F,0xFEB1,0xCDB2,0x2104,0x2104,0xF6B4,0xFEB1,0xFE90,0xFE8F,0xFE90,0xFF58,0xFE0A,0xF5C6,0x72A3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 13, 448 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xABE4,0xF5A6,0xFEB1,0xFED3,0xFE4E,0xFE6E,0xFE6F,0xFE90,0xD5F2,0x18E3,0x18E3,0xFED4,0xFE90,0xFE6F,0xFE6F,0xFE6E,0xFE91,0xFF36,0xF5A6,0xCCA5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 14, 480 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x5202,0xF5A6,0xF5C7,0xFF58,0xFE4D,0xFE4D,0xFE4D,0xFE4E,0xFE6F,0xDE11,0x18C3,0x18C3,0xFED3,0xFE6F,0xFE6E,0xFE4E,0xFE4D,0xFE4D,0xFF16,0xFE2C,0xF5A6,0x9363,0x0000,0x0000,0x0000,0x0000,0x0000, // row 15, 512 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0xBC44,0xF585,0xFED3,0xFE6F,0xFE2C,0xFE2C,0xFE2D,0xFE4D,0xFE4E,0xE630,0x10A2,0x2104,0xFED1,0xFE4E,0xFE4D,0xFE4D,0xFE2D,0xFE2C,0xFE4D,0xFF37,0xF586,0xF585,0x28E1,0x0000,0x0000,0x0000,0x0000, // row 16, 544 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x7282,0xF565,0xF5EA,0xFF16,0xFE0B,0xFE0B,0xFE0B,0xFE2C,0xFE2C,0xFE4D,0xF670,0x1082,0x2924,0xFEB0,0xFE2D,0xFE2C,0xFE2C,0xFE2C,0xFE0B,0xFE0B,0xFEB2,0xFE6F,0xF565,0xA383,0x0000,0x0000,0x0000,0x0000, // row 17, 576 pixels
|
||||
0x0000,0x0000,0x0000,0x0840,0xD4C4,0xF565,0xFEF5,0xFE0C,0xFDE9,0xFDEA,0xFE0A,0xFE0B,0xFE0B,0xFE2C,0xFE8F,0x0861,0x2964,0xFE8F,0xFE2C,0xFE0B,0xFE0B,0xFE0B,0xFE0A,0xFDEA,0xFE0B,0xFF37,0xF586,0xF565,0x4181,0x0000,0x0000,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x0000,0x0000,0x9343,0xF545,0xF60C,0xFED3,0xFDC8,0xFDC8,0xFDC9,0xFDE9,0xFDEA,0xFDEA,0xFE0B,0xFE8E,0x0861,0x3184,0xFE6D,0xFE0B,0xFE0A,0xFDEA,0xFDEA,0xFDE9,0xFDC9,0xFDC9,0xFE4E,0xFEB2,0xF545,0xB3E3,0x0000,0x0000,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x0000,0x28E0,0xF544,0xF545,0xFF17,0xFDC8,0xFDA7,0xFDA7,0xFDC8,0xFDC8,0xFDC9,0xFDC9,0xFDE9,0xFE6C,0x10A2,0x39C4,0xFE4C,0xFDEA,0xFDE9,0xFDC9,0xFDC9,0xFDC8,0xFDC8,0xFDA7,0xFDA8,0xFF16,0xF588,0xF544,0x6222,0x0000,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x0000,0xA383,0xF524,0xF64E,0xFE4E,0xFD86,0xFD86,0xFD87,0xFDA7,0xFDA7,0xFDA8,0xFDC8,0xFDC8,0xFE2A,0xA469,0xB4EA,0xFE2A,0xFDC9,0xFDC8,0xFDC8,0xFDA8,0xFDA7,0xFDA7,0xFD87,0xFD86,0xFDEA,0xFED3,0xF524,0xC443,0x0000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x51C1,0xF504,0xF546,0xFF16,0xF565,0xFD65,0xFD65,0xFD86,0xFD86,0xFD86,0xFDA7,0xFDA7,0xFDA7,0xFDE8,0xFE6A,0xFE4A,0xFDE8,0xFDA7,0xFDA7,0xFDA7,0xFDA7,0xFD86,0xFD86,0xFD86,0xFD65,0xFD65,0xFEB2,0xF5CA,0xF504,0x8AE2,0x0000, // row 22, 736 pixels
|
||||
0x0000,0xB3A2,0xED03,0xFE92,0xFDC9,0xF543,0xF544,0xFD44,0xFD65,0xFD65,0xFD65,0xFD86,0xFD86,0xFD86,0xFDA7,0xFDC7,0xFDC7,0xFDA7,0xFD86,0xFD86,0xFD86,0xFD86,0xFD65,0xFD65,0xFD65,0xFD44,0xF544,0xFD86,0xFEF5,0xED03,0xE4C3,0x1880, // row 23, 768 pixels
|
||||
0x7241,0xECE3,0xF567,0xFED3,0xF523,0xF523,0xF523,0xF543,0xF544,0xF544,0xFD65,0xFD65,0xFD65,0xFD65,0xD4E6,0x39C5,0x39A5,0xD4E6,0xFD86,0xFD65,0xFD65,0xFD65,0xFD65,0xF544,0xF544,0xF543,0xF523,0xF523,0xFE2E,0xF5EC,0xECE3,0x9B42, // row 24, 800 pixels
|
||||
0xD443,0xECE3,0xFED4,0xF565,0xF502,0xF502,0xF522,0xF523,0xF523,0xF543,0xF544,0xF544,0xF544,0xFD65,0x8B64,0x18C3,0x18C3,0x8344,0xFD85,0xFD44,0xF544,0xF544,0xF544,0xF543,0xF523,0xF523,0xF522,0xF502,0xF523,0xFEF5,0xED04,0xECE3, // row 25, 832 pixels
|
||||
0xECC3,0xF5AB,0xFE6F,0xF501,0xF4E1,0xF501,0xF502,0xF502,0xF522,0xF522,0xF523,0xF523,0xF523,0xFD84,0xC504,0x20E1,0x18E1,0xC4E4,0xFD84,0xF543,0xF523,0xF523,0xF523,0xF522,0xF522,0xF502,0xF502,0xF501,0xF501,0xFDC9,0xF62F,0xECC3, // row 26, 864 pixels
|
||||
0xECC2,0xFE92,0xF523,0xF4E0,0xF4E0,0xF4E1,0xF4E1,0xF501,0xF501,0xF502,0xF502,0xF522,0xF522,0xF543,0xFDE3,0xFEA5,0xF6A4,0xFE04,0xF543,0xF522,0xF522,0xF522,0xF502,0xF502,0xF501,0xF501,0xF4E1,0xF4E1,0xF4E0,0xF4E1,0xFED4,0xECC2, // row 27, 896 pixels
|
||||
0xECA2,0xF5EC,0xF4E0,0xF4C0,0xF4E0,0xF4E0,0xF4E0,0xF4E1,0xF4E1,0xF501,0xF501,0xF501,0xF502,0xF502,0xF542,0xFDA2,0xFDA2,0xF542,0xF502,0xF502,0xF502,0xF501,0xF501,0xF501,0xF4E1,0xF4E1,0xF4E0,0xF4E0,0xF4E0,0xF4C0,0xF5A9,0xECA2, // row 28, 928 pixels
|
||||
0xECA2,0xECA2,0xECC2,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4E1,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xECC2,0xECC3,0xECA2, // row 29, 960 pixels
|
||||
0x8AC1,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0x9B01, // row 30, 992 pixels
|
||||
0x0000,0x1880,0x51A0,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x61E0,0x28E0,0x0000}; // row 31, 1024 pixels
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// We need this header file to use FLASH as storage with PROGMEM directive:
|
||||
#include <pgmspace.h>
|
||||
|
||||
// Icon width and height
|
||||
const uint16_t closeWidth = 32;
|
||||
const uint16_t closeHeight = 32;
|
||||
|
||||
// The icon file can be created with the "UTFT ImageConverter 565" bitmap to .c file creation utility, more can be pasted in here
|
||||
const unsigned short closeX[1024] PROGMEM={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x30C3,0x4124,0x61C7,0x61C7,0x4124,0x30E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x48E3,0xA249,0xEB8E,0xFCB2,0xFD14,0xFD75,0xFD96,0xFD34,0xFCF3,0xEBEF,0xA28A,0x4904,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x58E3,0xC228,0xFC10,0xFD34,0xFE18,0xFE59,0xFE79,0xFE9A,0xFE9A,0xFE9A,0xFE9A,0xFE59,0xFD75,0xFC51,0xC28A,0x5904,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2041,0x8945,0xF34D,0xFD34,0xFDB6,0xFD75,0xFD55,0xFD55,0xFD96,0xFDD7,0xFDF7,0xFDF7,0xFDB6,0xFDB6,0xFDD7,0xFDF7,0xFD75,0xF38E,0x8965,0x2041,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x4082,0xE208,0xF410,0xFD34,0xFC92,0xFBEF,0xFBAE,0xFBEF,0xFC71,0xFD14,0xFD75,0xFDB6,0xFD75,0xFD14,0xFC92,0xFC51,0xFC71,0xFCF3,0xFD75,0xFC30,0xEA28,0x40A2,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x3861,0xE1E7,0xF451,0xFC92,0xFB4D,0xFA49,0xFA49,0xFAEB,0xFBAE,0xFC71,0xFD34,0xFDB6,0xFE18,0xFDB6,0xFD34,0xFC71,0xFBAE,0xFB0C,0xFAEB,0xFBAE,0xFCD3,0xFC71,0xE208,0x4082,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x1020,0xD986,0xF430,0xFC30,0xFA28,0xF924,0xF965,0xFA8A,0xFB0C,0xFBAE,0xFC51,0xFD14,0xFD75,0xFDB6,0xFD75,0xFD14,0xFC51,0xFC71,0xFBEF,0xFA28,0xF9C7,0xFA8A,0xFC51,0xF430,0xD9A6,0x1020,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x78A2,0xEB6D,0xFC30,0xF9C7,0xF861,0xF8A2,0xFA08,0xFEDB,0xFD55,0xFB4D,0xFC10,0xFC92,0xFD14,0xFD34,0xFD14,0xFC92,0xFCB2,0xFF7D,0xFF7D,0xFB2C,0xF945,0xF8E3,0xF9E7,0xFC30,0xEB8E,0x78C3,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x3841,0xD9E7,0xF492,0xF208,0xF041,0xF800,0xF945,0xFE9A,0xFFFF,0xFFFF,0xFD75,0xFB8E,0xFC10,0xFC51,0xFC71,0xFC51,0xFCB2,0xFF7D,0xFFFF,0xFFFF,0xFF3C,0xFA8A,0xF882,0xF841,0xFA08,0xFC92,0xDA08,0x3841,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x88A2,0xEBCF,0xF2EB,0xF061,0xF000,0xF8E3,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD75,0xFB4D,0xFBAE,0xFBAE,0xFC71,0xFF7D,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFEFB,0xFA28,0xF800,0xF061,0xF2EB,0xEBEF,0x90C3,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x2820,0xD1C7,0xF410,0xE945,0xE800,0xF000,0xFE9A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD34,0xFAEB,0xFBCF,0xFF5D,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF1C,0xF986,0xF000,0xF145,0xF410,0xD1E7,0x2820,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x6841,0xDB2C,0xEACB,0xE041,0xE800,0xF000,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD14,0xFF1C,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFBCF,0xF082,0xF000,0xE841,0xEACB,0xE34D,0x7061,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x9861,0xE3CF,0xE186,0xE000,0xE800,0xE800,0xF145,0xFEDB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE986,0xEBCF,0xA082,0x0000, // row 12, 416 pixels
|
||||
0x0800,0xB8A2,0xE3AE,0xD8A2,0xD800,0xE000,0xE800,0xE800,0xF145,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE000,0xE0A2,0xEBAE,0xC0C3,0x0800, // row 13, 448 pixels
|
||||
0x1800,0xC124,0xE30C,0xD020,0xD800,0xE000,0xE000,0xE800,0xE800,0xF145,0xFEDB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE000,0xE000,0xD820,0xE30C,0xC124,0x1800, // row 14, 480 pixels
|
||||
0x2800,0xC165,0xDAAA,0xC800,0xD000,0xD800,0xE000,0xE000,0xE800,0xE800,0xF124,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB6D,0xF000,0xF000,0xE800,0xE800,0xE000,0xE000,0xD800,0xD000,0xDAAA,0xC165,0x2800, // row 15, 512 pixels
|
||||
0x2000,0xB924,0xD269,0xC800,0xD000,0xD000,0xD800,0xE000,0xE000,0xE800,0xE924,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF36D,0xE800,0xE800,0xE800,0xE000,0xE000,0xD800,0xD000,0xD000,0xDA69,0xC145,0x2800, // row 16, 544 pixels
|
||||
0x1000,0xB0A2,0xD28A,0xC000,0xC800,0xD000,0xD000,0xD800,0xD800,0xE165,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF3AE,0xE000,0xE000,0xD800,0xD800,0xD000,0xD000,0xC800,0xD28A,0xB8C3,0x1000, // row 17, 576 pixels
|
||||
0x0000,0xA800,0xD2AA,0xB800,0xC000,0xC800,0xC800,0xD000,0xD965,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBAE,0xD800,0xD800,0xD000,0xC800,0xC800,0xC000,0xD2AA,0xB020,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x8000,0xCA69,0xB841,0xB800,0xC000,0xC800,0xD186,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBCF,0xD000,0xC800,0xC800,0xC000,0xC041,0xCA69,0x8000,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x4800,0xC1C7,0xB8E3,0xB800,0xB800,0xC000,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBEF,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xE410,0xC841,0xC000,0xB800,0xC0E3,0xC1C7,0x4800,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x1000,0xB061,0xC1E7,0xB000,0xB000,0xB800,0xD269,0xFFBE,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xE38E,0xD000,0xD965,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xDB0C,0xC020,0xB800,0xB000,0xC1E7,0xB061,0x1000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x0000,0x6000,0xB9C7,0xB061,0xB000,0xB000,0xB800,0xCA49,0xFF9E,0xFFFF,0xFFFF,0xFFFF,0xE38E,0xC800,0xC800,0xC800,0xD186,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xDB0C,0xB800,0xB800,0xB000,0xB061,0xC1C7,0x6000,0x0000,0x0000, // row 22, 736 pixels
|
||||
0x0000,0x0000,0x1800,0xB041,0xB986,0xA800,0xA800,0xB000,0xB000,0xCA49,0xFF7D,0xFFFF,0xDB8E,0xC000,0xC000,0xC000,0xC000,0xC000,0xC986,0xF6DB,0xFFFF,0xFFFF,0xD30C,0xB800,0xB000,0xB000,0xA800,0xB986,0xB041,0x1800,0x0000,0x0000, // row 23, 768 pixels
|
||||
0x0000,0x0000,0x0000,0x5800,0xB0E3,0xA8C3,0xA800,0xA800,0xA800,0xB000,0xCACB,0xD38E,0xB000,0xB800,0xB800,0xB800,0xB800,0xB800,0xB800,0xC145,0xF6DB,0xD34D,0xB000,0xB000,0xA800,0xA800,0xB0C3,0xB0E3,0x5800,0x0000,0x0000,0x0000, // row 24, 800 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x6000,0xB124,0xA882,0xA000,0xA800,0xA800,0xA800,0xA800,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xA800,0xA800,0xA800,0xA800,0xA882,0xB124,0x6000,0x0000,0x0000,0x0000,0x0000, // row 25, 832 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x6000,0xB104,0xA882,0xA000,0xA000,0xA000,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA000,0xA000,0xA882,0xB104,0x6000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 26, 864 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6000,0xB0A2,0xA8C3,0xA020,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA020,0xA8C3,0xB0A2,0x6000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 27, 896 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4800,0xA800,0xB0C3,0xA0A2,0x9800,0x9800,0x9800,0x9800,0xA000,0xA000,0xA000,0x9800,0x9800,0x9800,0xA082,0xB0E3,0xA800,0x4800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 28, 928 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5800,0xA800,0xB0A2,0xA8E3,0xA0A2,0xA041,0x9800,0x9800,0xA041,0xA0A2,0xA8E3,0xB0A2,0xA800,0x5800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 29, 960 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3000,0x6000,0x8800,0xA000,0xA800,0xA800,0xA000,0x8800,0x6000,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 30, 992 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; // row 31, 1024 pixels
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
// Code partly derived from ILI9341_Due library example
|
||||
|
||||
// Draws the 3 icons across the middle of the screen and pauses.
|
||||
// Then draws 300 icons at random locations, clears screen and repeats
|
||||
//
|
||||
// This demonstrates drawing icons from FLASH
|
||||
|
||||
// Icons are stored in tabs, e.g. Alert.h etc
|
||||
// more than one icon can be in a header file.
|
||||
|
||||
// Original sketch header follow:
|
||||
/*
|
||||
This sketch demonstrates loading images from arrays stored in program (FLASH) memory.
|
||||
|
||||
This sketch does not use/need any fonts at all...
|
||||
|
||||
Arrays containing FLASH images can be created with UTFT library tool:
|
||||
(libraries\UTFT\Tools\ImageConverter565.exe)
|
||||
Convert to .c format then copy into a new tab
|
||||
|
||||
The number and size of icons is limited by available FLASH memory. The icon array will
|
||||
use width x height x 2 bytes of FLASH, i.e. 32 x 32 icon uses ~2048 bytes
|
||||
|
||||
*/
|
||||
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
|
||||
#include <SPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
|
||||
|
||||
// Include the header files that contain the icons
|
||||
#include "Alert.h"
|
||||
#include "Close.h"
|
||||
#include "Info.h"
|
||||
|
||||
long count = 0; // Loop count
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
tft.init();
|
||||
tft.setRotation(1); // landscape
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
// Draw the icons
|
||||
drawIcon(info, (tft.width() - infoWidth)/2 - 50, (tft.height() - infoHeight)/2, infoWidth, infoHeight);
|
||||
drawIcon(alert, (tft.width() - alertWidth)/2, (tft.height() - alertHeight)/2, alertWidth, alertHeight);
|
||||
drawIcon(closeX, (tft.width() - closeWidth)/2 + 50, (tft.height() - closeHeight)/2, closeWidth, closeHeight);
|
||||
|
||||
// Pause here to admire the icons!
|
||||
delay(4000);
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Loop filling and clearing screen
|
||||
drawIcon(info, random(tft.width() - infoWidth), random(tft.height() - infoHeight), infoWidth, infoHeight);
|
||||
drawIcon(alert, random(tft.width() - alertWidth), random(tft.height() - alertHeight), alertWidth, alertHeight);
|
||||
drawIcon(closeX, random(tft.width() - closeWidth), random(tft.height() - closeHeight), alertWidth, closeHeight);
|
||||
|
||||
// Clear screen after 100 x 3 = 300 icons drawn
|
||||
if (100 == count++) {
|
||||
count = 1;
|
||||
tft.setRotation(2 * random(2)); // Rotate randomly to clear display left>right or right>left to reduce monotony!
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(1);
|
||||
Serial.println(millis());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//====================================================================================
|
||||
// This is the function to draw the icon stored as an array in program memory (FLASH)
|
||||
//====================================================================================
|
||||
|
||||
// To speed up rendering we use a 64 pixel buffer
|
||||
#define BUFF_SIZE 64
|
||||
|
||||
// Draw array "icon" of defined width and height at coordinate x,y
|
||||
// Maximum icon size is 255x255 pixels to avoid integer overflow
|
||||
|
||||
void drawIcon(const unsigned short* icon, int16_t x, int16_t y, uint16_t width, uint16_t height) {
|
||||
|
||||
uint16_t pix_buffer[BUFF_SIZE]; // Pixel buffer (16 bits per pixel)
|
||||
|
||||
// Set up a window the right size to stream pixels into
|
||||
tft.setAddrWindow(x, y, x + width - 1, y + height - 1);
|
||||
|
||||
// Work out the number whole buffers to send
|
||||
uint16_t nb = ((uint16_t)height * width) / BUFF_SIZE;
|
||||
|
||||
// Fill and send "nb" buffers to TFT
|
||||
for (int i = 0; i < nb; i++) {
|
||||
for (int j = 0; j < BUFF_SIZE; j++) {
|
||||
pix_buffer[j] = pgm_read_word(&icon[i * BUFF_SIZE + j]);
|
||||
}
|
||||
tft.pushColors(pix_buffer, BUFF_SIZE);
|
||||
}
|
||||
|
||||
// Work out number of pixels not yet sent
|
||||
uint16_t np = ((uint16_t)height * width) % BUFF_SIZE;
|
||||
|
||||
// Send any partial buffer left over
|
||||
if (np) {
|
||||
for (int i = 0; i < np; i++) pix_buffer[i] = pgm_read_word(&icon[nb * BUFF_SIZE + i]);
|
||||
tft.pushColors(pix_buffer, np);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// We need this header file to use FLASH as storage with PROGMEM directive:
|
||||
#include <pgmspace.h>
|
||||
|
||||
// Icon width and height
|
||||
const uint16_t infoWidth = 32;
|
||||
const uint16_t infoHeight = 32;
|
||||
|
||||
// The icon file can be created with the "UTFT ImageConverter 565" bitmap to .c file creation utility, more can be pasted in here
|
||||
const unsigned short info[1024] PROGMEM={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0861,0x4A69,0x8C71,0xA514,0xBDF7,0xBDF7,0xA514,0x8C71,0x4A69,0x0861,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x39E7,0x9CF3,0xEF7D,0xF79E,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xF79E,0xEF7D,0x9CF3,0x39E7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2965,0x9492,0xF79E,0xFFDF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFDF,0xF79E,0x9492,0x2965,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x630C,0xEF7D,0xFFDF,0xFFFF,0xFFFF,0xFFFF,0xD75F,0xB6BF,0x9E5F,0x963F,0x963F,0x9E5F,0xB6BF,0xD75F,0xFFFF,0xFFFF,0xFFFF,0xFFDF,0xEF7D,0x630C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x73AE,0xEF7D,0xFFDF,0xFFFF,0xFFDF,0xBEDF,0x7DBF,0x7DBF,0x7DDF,0x7DDF,0x7DDF,0x7DDF,0x7DDF,0x7DBF,0x759F,0x7DBE,0xBEBF,0xFFDF,0xFFFF,0xFFDF,0xEF7D,0x73AE,0x0000,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x630C,0xEF7D,0xFFFF,0xFFFF,0xE77F,0x7DBE,0x759E,0x759F,0x7DBF,0x7DDF,0x7DDF,0x85FF,0x7DDF,0x7DDF,0x7DBF,0x759F,0x759E,0x6D7E,0x7DBE,0xDF7F,0xFFFF,0xFFFF,0xEF7D,0x630C,0x0000,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x31A6,0xEF5D,0xFFDF,0xFFFF,0xCF1E,0x6D7E,0x6D7E,0x759E,0x759F,0x7DBF,0x7DDF,0x8E1F,0xBEDF,0xC6FF,0x8DFF,0x75BF,0x759F,0x759E,0x6D7E,0x655E,0x655D,0xCF1E,0xFFFF,0xFFDF,0xEF5D,0x31A6,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x0000,0x94B2,0xF7BE,0xFFFF,0xDF5E,0x655D,0x655D,0x6D7E,0x6D7E,0x759E,0x75BF,0x759F,0xEFBF,0xFFFF,0xFFFF,0xEFBF,0x759F,0x759E,0x6D7E,0x6D7E,0x655D,0x653D,0x653D,0xDF5E,0xFFFF,0xF7BE,0x94B2,0x0000,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x4228,0xEF7D,0xFFFF,0xF7BF,0x6D5D,0x653D,0x655D,0x6D5E,0x6D7E,0x759E,0x759E,0x85DF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8DFE,0x6D7E,0x6D7E,0x6D5E,0x655D,0x653D,0x5D1D,0x6D5D,0xF7BF,0xFFFF,0xEF7D,0x4228,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x0000,0xA534,0xFFDF,0xFFDF,0xA65D,0x5D1D,0x5D1D,0x653D,0x655E,0x6D7E,0x6D7E,0x6D7E,0x651E,0xE77F,0xFFFF,0xFFFF,0xF7BF,0x5CFE,0x6D7E,0x6D7E,0x655E,0x653D,0x5D1D,0x5D1D,0x54FC,0xA65D,0xFFDF,0xFFDF,0xA534,0x0000,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x18E3,0xEF5D,0xFFFF,0xEF9E,0x5CFC,0x54FC,0x5D1D,0x5D3D,0x653D,0x655E,0x6D7E,0x6D7E,0x653E,0x6D3E,0xB67E,0xBEBE,0x755E,0x5D1E,0x6D5E,0x655E,0x653D,0x5D3D,0x5D1D,0x54FC,0x54DC,0x54FC,0xEF9E,0xFFFF,0xEF5D,0x18E3,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x630C,0xEF7D,0xFFDF,0xB69D,0x54DC,0x54FC,0x5CFC,0x5D1D,0x653D,0x653D,0x655E,0x6D5E,0x655E,0x5CFE,0x4C9D,0x4C7D,0x54DD,0x653E,0x655E,0x653D,0x653D,0x5D1D,0x5CFC,0x54FC,0x54DC,0x4CBC,0xB69D,0xFFDF,0xEF7D,0x630C,0x0000, // row 12, 416 pixels
|
||||
0x0000,0x94B2,0xF7BE,0xFFDF,0x85BC,0x4CBC,0x54DC,0x54FC,0x5CFD,0x5D1D,0x5D3D,0x653D,0x655D,0x653D,0x85DE,0xC6FE,0xC6FE,0x85BE,0x653D,0x653D,0x5D3D,0x5D1D,0x5CFD,0x54FC,0x54DC,0x4CBC,0x4CBB,0x85BC,0xFFDF,0xF7BE,0x94B2,0x0000, // row 13, 448 pixels
|
||||
0x0000,0xB5B6,0xFFDF,0xF7BE,0x651C,0x4CBB,0x4CBC,0x54DC,0x54FC,0x5CFC,0x5D1D,0x5D1D,0x653D,0x5D1D,0xE77E,0xFFDF,0xFFDF,0xEF9E,0x5CFD,0x5D1D,0x5D1D,0x5CFC,0x54FC,0x54DC,0x4CBC,0x4CBB,0x449B,0x651B,0xF7BE,0xFFDF,0xB5B6,0x0000, // row 14, 480 pixels
|
||||
0x0000,0xC638,0xFFDF,0xF7BE,0x54DB,0x449B,0x4CBB,0x4CBC,0x54DC,0x54FC,0x54FC,0x5D1D,0x5D1D,0x7D7D,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x7D7D,0x5CFD,0x54FC,0x54FC,0x54DC,0x4CBC,0x4CBB,0x449B,0x447B,0x54BB,0xF7BE,0xFFDF,0xC638,0x0000, // row 15, 512 pixels
|
||||
0x0000,0xC638,0xFFDF,0xF79E,0x4CBB,0x449B,0x449B,0x4CBB,0x4CBC,0x54DC,0x54DC,0x54FC,0x54DC,0x753C,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x753C,0x54DC,0x54DC,0x54DC,0x4CBC,0x4CBB,0x449B,0x449B,0x3C7B,0x4C9B,0xF79E,0xFFDF,0xC638,0x0000, // row 16, 544 pixels
|
||||
0x0000,0xB5B6,0xFFDF,0xF7BE,0x5CFB,0x3C7B,0x447B,0x449B,0x4CBB,0x4CBC,0x4CBC,0x4CDC,0x4CBC,0x6D1C,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x6CFC,0x4CBC,0x4CBC,0x4CBC,0x4CBB,0x449B,0x447B,0x3C7B,0x3C5A,0x54DB,0xF7BE,0xFFDF,0xB5B6,0x0000, // row 17, 576 pixels
|
||||
0x0000,0x94B2,0xF7BE,0xF7BE,0x755B,0x3C5A,0x3C7B,0x447B,0x449B,0x449B,0x4CBB,0x4CBB,0x4C9B,0x6CFB,0xF79E,0xF79E,0xF79E,0xF79E,0x64FB,0x449B,0x4CBB,0x449B,0x449B,0x447B,0x3C7B,0x3C5A,0x3C5A,0x753B,0xF7BE,0xF7BE,0x9CD3,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x6B4D,0xEF7D,0xF7BE,0xA61C,0x3C5A,0x3C5A,0x3C7B,0x447B,0x447B,0x449B,0x449B,0x447B,0x64DB,0xF79E,0xF79E,0xF79E,0xF79E,0x64DB,0x447B,0x449B,0x447B,0x447B,0x3C7B,0x3C5A,0x3C5A,0x343A,0xA61C,0xF7BE,0xEF7D,0x6B4D,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x2124,0xE71C,0xFFDF,0xDF3D,0x3C5A,0x343A,0x3C5A,0x3C5A,0x3C7B,0x3C7B,0x447B,0x3C5B,0x64BA,0xF79E,0xF79E,0xF79E,0xF79E,0x64BA,0x3C5B,0x3C7B,0x3C7B,0x3C5A,0x3C5A,0x343A,0x343A,0x343A,0xDF3D,0xFFDF,0xE71C,0x2124,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x0000,0xAD75,0xF7BE,0xF79E,0x859B,0x343A,0x343A,0x345A,0x3C5A,0x3C5A,0x3C5A,0x3C5A,0x5C9A,0xEF7D,0xEF7D,0xEF7D,0xEF7D,0x5C9A,0x3C3A,0x3C5A,0x3C5A,0x345A,0x343A,0x343A,0x341A,0x859B,0xF79E,0xF7BE,0xAD75,0x0000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x0000,0x528A,0xE71C,0xFFDF,0xDF3D,0x3C5A,0x343A,0x343A,0x343A,0x343A,0x3C5A,0x343A,0x4C5A,0xEF7D,0xEF7D,0xEF7D,0xEF7D,0x4C59,0x343A,0x343A,0x343A,0x343A,0x343A,0x341A,0x3C5A,0xDF3D,0xFFDF,0xE71C,0x528A,0x0000,0x0000, // row 22, 736 pixels
|
||||
0x0000,0x0000,0x0000,0x9CD3,0xF79E,0xF7BE,0xBE7C,0x3419,0x341A,0x341A,0x343A,0x343A,0x341A,0x2B99,0xC69C,0xEF7D,0xEF7D,0xD6DC,0x2398,0x341A,0x343A,0x341A,0x341A,0x2C19,0x2C19,0xBE7C,0xF7BE,0xF79E,0x9CD3,0x0000,0x0000,0x0000, // row 23, 768 pixels
|
||||
0x0000,0x0000,0x0000,0x39E7,0xDEDB,0xFFDF,0xF79E,0x9DFB,0x2C19,0x2C19,0x2C1A,0x341A,0x341A,0x2BB9,0x2B57,0x6459,0x74B9,0x2337,0x2BB9,0x341A,0x2C1A,0x2C19,0x2C19,0x2C19,0x9DFB,0xF79E,0xFFDF,0xDEDB,0x39E7,0x0000,0x0000,0x0000, // row 24, 800 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x632C,0xDEFB,0xFFDF,0xEF7D,0xB65C,0x3C39,0x2BF9,0x2C19,0x2C19,0x2BF9,0x2398,0x1B58,0x1B37,0x2398,0x2BF9,0x2C19,0x2BF9,0x2BF9,0x3439,0xB65C,0xEF7D,0xFFDF,0xDEFB,0x632C,0x0000,0x0000,0x0000,0x0000, // row 25, 832 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x73AE,0xDEFB,0xF7BE,0xF79E,0xDF1C,0x7D5A,0x2BF9,0x2BF9,0x2BF9,0x2BF9,0x23D9,0x23D9,0x2BF9,0x2BF9,0x2BF9,0x2BF9,0x7D5A,0xDF1C,0xF79E,0xF7BE,0xDEFB,0x73AE,0x0000,0x0000,0x0000,0x0000,0x0000, // row 26, 864 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x632C,0xDEDB,0xF79E,0xFFDF,0xEF7D,0xD6FC,0x9DFB,0x5CDA,0x4C9A,0x3419,0x3419,0x4C9A,0x5CDA,0x9DFB,0xD6FC,0xEF7D,0xFFDF,0xF79E,0xDEDB,0x632C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 27, 896 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4208,0x94B2,0xDEFB,0xF7BE,0xFFDF,0xF7BE,0xF79E,0xEF7D,0xEF5D,0xEF5D,0xEF7D,0xF79E,0xF7BE,0xFFDF,0xF7BE,0xDEFB,0x94B2,0x4208,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 28, 928 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x528A,0xA534,0xDEDB,0xE73C,0xF79E,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0xF79E,0xE73C,0xDEDB,0xA534,0x528A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 29, 960 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x18C3,0x5AEB,0x8C71,0xAD55,0xBDD7,0xBDD7,0xAD55,0x8C71,0x5AEB,0x18C3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 30, 992 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; // row 31, 1024 pixels
|
||||
|
|
@ -107,13 +107,17 @@ void midline() {
|
|||
// If the ball is not on the line then don't redraw the line
|
||||
if ((ball_x<dashline_x-ball_w) && (ball_x > dashline_x+dashline_w)) return;
|
||||
|
||||
tft.startWrite();
|
||||
|
||||
// Quick way to draw a dashed line
|
||||
tft.setAddrWindow(dashline_x,0,dashline_x+dashline_w-1,h);
|
||||
tft.setAddrWindow(dashline_x, 0, dashline_w, h);
|
||||
|
||||
for(int16_t i = 0; i < dashline_n; i+=2) {
|
||||
tft.pushColor(WHITE, dashline_w*dashline_h); // push dash pixels
|
||||
tft.pushColor(BLACK, dashline_w*dashline_h); // push gap pixels
|
||||
}
|
||||
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
void lpaddle() {
|
||||
|
|
|
|||
|
|
@ -308,21 +308,23 @@ uint32_t testHaD()
|
|||
0x0a, 0x2b, 0x0b, 0x41, 0x0a, 0x29, 0x0b, 0x43, 0x0a, 0x27, 0x0a, 0x46, 0x0a, 0x25, 0x0a, 0x49,
|
||||
0x09, 0x23, 0x08, 0x4e, 0x08, 0x96, 0x12
|
||||
};
|
||||
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
uint32_t start = micros_start();
|
||||
|
||||
|
||||
tft.startWrite();
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
tft.setAddrWindow(0, 0, tft.width()-1, tft.height()-1);
|
||||
tft.setAddrWindow(0, 0, tft.width(), tft.height());
|
||||
|
||||
uint16_t cnt = 0;
|
||||
uint16_t color = tft.color565((i << 4) | i, (i << 4) | i, (i << 4) | i);
|
||||
uint16_t curcolor = 0;
|
||||
|
||||
const uint8_t *cmp = &HaD_128x160[0];
|
||||
|
||||
tft.startWrite();
|
||||
while (cmp < &HaD_128x160[sizeof(HaD_128x160)])
|
||||
{
|
||||
cnt = pgm_read_byte(cmp++);
|
||||
|
|
@ -333,8 +335,11 @@ uint32_t testHaD()
|
|||
|
||||
curcolor ^= color;
|
||||
}
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
tft.endWrite();
|
||||
|
||||
uint32_t t = micros() - start;
|
||||
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
|
@ -405,7 +410,7 @@ uint32_t testPixels()
|
|||
int32_t h = tft.height();
|
||||
|
||||
uint32_t start = micros_start();
|
||||
|
||||
tft.startWrite();
|
||||
for (uint16_t y = 0; y < h; y++)
|
||||
{
|
||||
for (uint16_t x = 0; x < w; x++)
|
||||
|
|
@ -413,7 +418,7 @@ uint32_t testPixels()
|
|||
tft.drawPixel(x, y, tft.color565(x<<3, y<<3, x*y));
|
||||
}
|
||||
}
|
||||
|
||||
tft.endWrite();
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,106 +0,0 @@
|
|||
// Icons are stored in tabs ^ e.g. Alert.h etc above this line
|
||||
// more than one icon can be in a header file
|
||||
|
||||
/*
|
||||
This sketch demonstrates loading images from arrays stored in program (FLASH) memory.
|
||||
|
||||
Works with TFT_eSPI library here:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
This sketch does not use/need any fonts at all...
|
||||
|
||||
Code derived from ILI9341_due example
|
||||
|
||||
Make sure all the display driver and pin comnenctions are correct by
|
||||
editting the User_Setup.h file in the TFT_eSPI library folder.
|
||||
|
||||
#########################################################################
|
||||
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
// Include the header files that contain the icons
|
||||
#include "Alert.h"
|
||||
#include "Close.h"
|
||||
#include "Info.h"
|
||||
|
||||
long count = 0; // Loop count
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
tft.begin();
|
||||
tft.setRotation(1); // landscape
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
// Draw the icons
|
||||
drawIcon(info, 100, 100, infoWidth, infoHeight);
|
||||
drawIcon(alert, 140, 100, alertWidth, alertHeight);
|
||||
drawIcon(closeX, 180, 100, closeWidth, closeHeight);
|
||||
|
||||
// Pause here to admire the icons!
|
||||
delay(2000);
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Loop filling and clearing screen
|
||||
drawIcon(info, random(tft.width() - infoWidth), random(tft.height() - infoHeight), infoWidth, infoHeight);
|
||||
drawIcon(alert, random(tft.width() - alertWidth), random(tft.height() - alertHeight), alertWidth, alertHeight);
|
||||
drawIcon(closeX, random(tft.width() - closeWidth), random(tft.height() - closeHeight), alertWidth, closeHeight);
|
||||
|
||||
// Clear screen after 100 x 3 = 300 icons drawn
|
||||
if (100 == count++) {
|
||||
count = 1;
|
||||
tft.setRotation(2 * random(2)); // Rotate randomly to clear display left>right or right>left to reduce monotony!
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(1);
|
||||
//Serial.println(millis());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//====================================================================================
|
||||
// This is the function to draw the icon stored as an array in program memory (FLASH)
|
||||
//====================================================================================
|
||||
|
||||
// To speed up rendering we use a 64 pixel buffer
|
||||
#define BUFF_SIZE 64
|
||||
|
||||
// Draw array "icon" of defined width and height at coordinate x,y
|
||||
// Maximum icon size is 255x255 pixels to avoid integer overflow
|
||||
|
||||
void drawIcon(const unsigned short* icon, int16_t x, int16_t y, uint16_t width, uint16_t height) {
|
||||
|
||||
uint16_t pix_buffer[BUFF_SIZE]; // Pixel buffer (16 bits per pixel)
|
||||
|
||||
// Set up a window the right size to stream pixels into
|
||||
tft.setWindow(x, y, x + width - 1, y + height - 1);
|
||||
|
||||
// Work out the number whole buffers to send
|
||||
uint16_t nb = ((uint16_t)height * width) / BUFF_SIZE;
|
||||
|
||||
// Fill and send "nb" buffers to TFT
|
||||
for (int i = 0; i < nb; i++) {
|
||||
for (int j = 0; j < BUFF_SIZE; j++) {
|
||||
pix_buffer[j] = pgm_read_word(&icon[i * BUFF_SIZE + j]);
|
||||
}
|
||||
tft.pushColors(pix_buffer, BUFF_SIZE);
|
||||
}
|
||||
|
||||
// Work out number of pixels not yet sent
|
||||
uint16_t np = ((uint16_t)height * width) % BUFF_SIZE;
|
||||
|
||||
// Send any partial buffer left over
|
||||
if (np) {
|
||||
for (int i = 0; i < np; i++) pix_buffer[i] = pgm_read_word(&icon[nb * BUFF_SIZE + i]);
|
||||
tft.pushColors(pix_buffer, np);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
#define ILI9341_GREY 0x7BEF
|
||||
#define TFT_GREY 0x7BEF
|
||||
|
||||
unsigned long runTime = 0;
|
||||
|
||||
|
|
@ -16,8 +16,9 @@ uint16_t x0 = 0, x1 = 0, yy0 = 0, yy1 = 0;
|
|||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(250000);
|
||||
//randomSeed(analogRead(A0));
|
||||
|
||||
Serial.println();
|
||||
// Setup the LCD
|
||||
tft.init();
|
||||
tft.setRotation(3);
|
||||
|
|
@ -27,7 +28,8 @@ void loop()
|
|||
{
|
||||
runTime = millis();
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.startWrite();
|
||||
for (int px = 1; px < 320; px++)
|
||||
{
|
||||
for (int py = 0; py < 240; py++)
|
||||
|
|
@ -49,6 +51,9 @@ void loop()
|
|||
yield();tft.drawPixel(px, py, color);
|
||||
}
|
||||
}
|
||||
tft.endWrite();
|
||||
|
||||
Serial.println(millis()-runTime);
|
||||
while(1) yield();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,13 +108,17 @@ void midline() {
|
|||
// If the ball is not on the line then don't redraw the line
|
||||
if ((ball_x<dashline_x-ball_w) && (ball_x > dashline_x+dashline_w)) return;
|
||||
|
||||
tft.startWrite();
|
||||
|
||||
// Quick way to draw a dashed line
|
||||
tft.setWindow(dashline_x,0,dashline_x+dashline_w-1,h);
|
||||
tft.setAddrWindow(dashline_x, 0, dashline_w, h);
|
||||
|
||||
for(int16_t i = 0; i < dashline_n; i+=2) {
|
||||
tft.pushColor(WHITE, dashline_w*dashline_h); // push dash pixels
|
||||
tft.pushColor(BLACK, dashline_w*dashline_h); // push gap pixels
|
||||
}
|
||||
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
void lpaddle() {
|
||||
|
|
|
|||
|
|
@ -1,188 +0,0 @@
|
|||
/*
|
||||
This sketch has been written to test the Processing screenshot client.
|
||||
|
||||
It has been created to work with the TFT_eSPI library here:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
It sends screenshots to a PC running a Processing client sketch.
|
||||
|
||||
The Processing IDE that will run the client sketch can be downloaded
|
||||
here: https://processing.org/
|
||||
|
||||
The Processing sketch needed is contained within a tab attached to this
|
||||
Arduino sketch. Cut and copy that tab into the Processing IDE and run.
|
||||
|
||||
This sketch uses the GLCD, 2, 4, 6 fonts only.
|
||||
|
||||
Make sure all the display driver and pin comnenctions are correct by
|
||||
editting the User_Setup.h file in the TFT_eSPI library folder.
|
||||
|
||||
Maximum recommended SPI clock rate is 27MHz when reading pixels, 40MHz
|
||||
seems to be OK with ILI9341 displays but this is above the manufacturers
|
||||
specifed maximum clock rate.
|
||||
|
||||
#########################################################################
|
||||
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
// Created by: Bodmer 5/3/17
|
||||
// Updated by: Bodmer 10/3/17
|
||||
// Version: 0.06
|
||||
|
||||
// MIT licence applies, all text above must be included in derivative works
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
#include <SPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library with default width and height
|
||||
|
||||
unsigned long targetTime = 0;
|
||||
byte red = 31;
|
||||
byte green = 0;
|
||||
byte blue = 0;
|
||||
byte state = 0;
|
||||
unsigned int colour = red << 11; // Colour order is RGB 5+6+5 bits each
|
||||
|
||||
void setup(void) {
|
||||
Serial.begin(921600);
|
||||
|
||||
tft.init();
|
||||
tft.setRotation(0);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
randomSeed(analogRead(A0));
|
||||
|
||||
targetTime = millis() + 1000;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
if (targetTime < millis()) {
|
||||
targetTime = millis() + 1500; // Wait a minimum of 1.5s
|
||||
|
||||
tft.setRotation(random(4));
|
||||
rainbow_fill(); // Fill the screen with rainbow colours
|
||||
|
||||
tft.setTextColor(TFT_BLACK); // Text background is not defined so it is transparent
|
||||
tft.setTextDatum(TC_DATUM); // Top Centre datum
|
||||
int xpos = tft.width()/2; // Centre of screen
|
||||
|
||||
tft.setTextFont(0); // Select font 0 which is the Adafruit font
|
||||
tft.drawString("Original Adafruit font!", xpos, 5);
|
||||
|
||||
// The new larger fonts do not need to use the .setCursor call, coords are embedded
|
||||
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
|
||||
|
||||
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
|
||||
tft.drawString("Font size 2", xpos, 14, 2); // Draw text centre at position xpos, 14 using font 2
|
||||
tft.drawString("Font size 4", xpos, 30, 4); // Draw text centre at position xpos, 30 using font 4
|
||||
tft.drawString("12.34", xpos, 54, 6); // Draw text centre at position xpos, 54 using font 6
|
||||
|
||||
tft.drawString("12.34 is in font size 6", xpos, 92, 2); // Draw text centre at position xpos, 92 using font 2
|
||||
// Note the x position is the top of the font!
|
||||
|
||||
// draw a floating point number
|
||||
float pi = 3.1415926; // Value to print
|
||||
int precision = 3; // Number of digits after decimal point
|
||||
|
||||
int ypos = 110; // y position
|
||||
|
||||
tft.setTextDatum(TR_DATUM); // Top Right datum so text butts neatly to xpos (right justified)
|
||||
|
||||
tft.drawFloat(pi, precision, xpos, ypos, 2); // Draw rounded number and return new xpos delta for next print position
|
||||
|
||||
tft.setTextDatum(TL_DATUM); // Top Left datum so text butts neatly to xpos (left justified)
|
||||
|
||||
tft.drawString(" is pi", xpos, ypos, 2);
|
||||
|
||||
tft.setTextSize(1); // We are using a font size multiplier of 1
|
||||
tft.setTextDatum(TC_DATUM); // Top Centre datum
|
||||
tft.setTextColor(TFT_BLACK); // Set text colour to black, no background (so transparent)
|
||||
|
||||
tft.drawString("Transparent...", xpos, 125, 4); // Font 4
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set text colour to white and background to black
|
||||
tft.drawString("White on black", xpos, 150, 4); // Font 4
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK); // This time we will use green text on a black background
|
||||
|
||||
tft.setTextFont(2); // Select font 2, now we do not need to specify the font in drawString()
|
||||
|
||||
// An easier way to position text and blank old text is to set the datum and use width padding
|
||||
tft.setTextDatum(BC_DATUM); // Bottom centre for text datum
|
||||
tft.setTextPadding(tft.width() + 1); // Pad text to full screen width + 1 spare for +/-1 position rounding
|
||||
|
||||
tft.drawString("Ode to a Small Lump of Green Putty", xpos, 230 - 32);
|
||||
tft.drawString("I Found in My Armpit One Midsummer", xpos, 230 - 16);
|
||||
tft.drawString("Morning", xpos, 230);
|
||||
|
||||
tft.setTextDatum(TL_DATUM); // Reset to top left for text datum
|
||||
tft.setTextPadding(0); // Reset text padding to 0 pixels
|
||||
|
||||
// Now call the screen server to send a copy of the TFT screen to the PC running the Processing client sketch
|
||||
screenServer();
|
||||
}
|
||||
}
|
||||
|
||||
// Fill screen with a rainbow pattern
|
||||
void rainbow_fill()
|
||||
{
|
||||
// The colours and state are not initialised so the start colour changes each time the funtion is called
|
||||
int rotation = tft.getRotation();
|
||||
tft.setRotation(random(4));
|
||||
for (int i = tft.height() - 1; i >= 0; i--) {
|
||||
// This is a "state machine" that ramps up/down the colour brightnesses in sequence
|
||||
switch (state) {
|
||||
case 0:
|
||||
green ++;
|
||||
if (green == 64) {
|
||||
green = 63;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
red--;
|
||||
if (red == 255) {
|
||||
red = 0;
|
||||
state = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
blue ++;
|
||||
if (blue == 32) {
|
||||
blue = 31;
|
||||
state = 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
green --;
|
||||
if (green == 255) {
|
||||
green = 0;
|
||||
state = 4;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
red ++;
|
||||
if (red == 32) {
|
||||
red = 31;
|
||||
state = 5;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
blue --;
|
||||
if (blue == 255) {
|
||||
blue = 0;
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
colour = red << 11 | green << 5 | blue;
|
||||
// Draw a line 1 pixel wide in the selected colour
|
||||
tft.drawFastHLine(0, i, tft.width(), colour); // in this example tft.width() returns the pixel width of the display
|
||||
}
|
||||
tft.setRotation(rotation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -336,10 +336,10 @@ uint32_t testHaD()
|
|||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
uint32_t start = micros_start();
|
||||
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
tft.setWindow(0, 0, 240-1, 320-1);
|
||||
tft.setAddrWindow(0, 0, 240, 320);
|
||||
|
||||
uint16_t cnt = 0;
|
||||
uint16_t color = tft.color565((i << 4) | i, (i << 4) | i, (i << 4) | i);
|
||||
|
|
@ -347,6 +347,7 @@ uint32_t testHaD()
|
|||
|
||||
const uint8_t *cmp = &HaD_240x320[0];
|
||||
|
||||
tft.startWrite();
|
||||
while (cmp < &HaD_240x320[sizeof(HaD_240x320)])
|
||||
{
|
||||
cnt = pgm_read_byte(cmp++);
|
||||
|
|
@ -354,6 +355,7 @@ uint32_t testHaD()
|
|||
tft.pushColor(curcolor, cnt); // PDQ_GFX has count
|
||||
curcolor ^= color;
|
||||
}
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
uint32_t t = micros() - start;
|
||||
|
|
@ -432,7 +434,7 @@ uint32_t testPixels()
|
|||
int32_t h = tft.height();
|
||||
|
||||
uint32_t start = micros_start();
|
||||
|
||||
tft.startWrite();
|
||||
for (uint16_t y = 0; y < h; y++)
|
||||
{
|
||||
for (uint16_t x = 0; x < w; x++)
|
||||
|
|
@ -440,7 +442,7 @@ uint32_t testPixels()
|
|||
tft.drawPixel(x, y, tft.color565(x<<3, y<<3, x*y));
|
||||
}
|
||||
}
|
||||
|
||||
tft.endWrite();
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,224 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
*/
|
||||
|
||||
// Created by http://oleddisplay.squix.ch/ Consider a donation
|
||||
// In case of problems make sure that you are using the font file with the correct version!
|
||||
|
||||
// Bodmer fix: End character is 0x7D not 0x7E, so bug in last line of the file corrected
|
||||
// this avoids screen corruption if ~ is printer
|
||||
|
||||
const uint8_t ArialRoundedMTBold_14Bitmaps[] PROGMEM = {
|
||||
|
||||
// Bitmap Data:
|
||||
0x00, // ' '
|
||||
0xFF,0xF8,0xF0, // '!'
|
||||
0xDE,0xF6, // '"'
|
||||
0x12,0x32,0x36,0xFF,0xFF,0x24,0xFF,0xFF,0x4C,0x48, // '#'
|
||||
0x10,0x61,0xF6,0xAD,0x7A,0x1E,0x0E,0xD7,0xAF,0x5B,0xE1,0x02,0x04,0x00, // '$'
|
||||
0x60,0x92,0x22,0x44,0x49,0x07,0x60,0x0B,0x82,0x48,0xC9,0x11,0x24,0x18, // '%'
|
||||
0x3C,0x19,0x82,0x60,0xF0,0x39,0x33,0x6C,0x73,0x1C,0xFF,0x8E,0x30, // '&'
|
||||
0xFC, // '''
|
||||
0x32,0x64,0xCC,0xCC,0xC4,0x62,0x30, // '('
|
||||
0xC4,0x62,0x33,0x33,0x32,0x64,0xC0, // ')'
|
||||
0x21,0x2A,0xE5,0x28, // '*'
|
||||
0x18,0x18,0x18,0xFF,0xFF,0x18,0x18, // '+'
|
||||
0xF6, // ','
|
||||
0xFF, // '-'
|
||||
0xF0, // '.'
|
||||
0x33,0x32,0x66,0x4C,0xCC, // '/'
|
||||
0x38,0xFB,0x9E,0x3C,0x78,0xF1,0xF6,0x7C,0x70, // '0'
|
||||
0x19,0xDF,0xB1,0x8C,0x63,0x18,0xC0, // '1'
|
||||
0x38,0xFF,0x1E,0x30,0xC3,0x0C,0x30,0xFF,0xFC, // '2'
|
||||
0x79,0x9B,0x10,0x63,0xC7,0x81,0xC3,0xC6,0xF0, // '3'
|
||||
0x06,0x0E,0x1E,0x16,0x26,0x46,0xFF,0xFF,0x06,0x06, // '4'
|
||||
0x7E,0xFD,0x06,0x0F,0xD8,0xC1,0xC3,0xCC,0xF0, // '5'
|
||||
0x38,0xDB,0x1E,0x0F,0xD8,0xF1,0xE3,0x66,0x78, // '6'
|
||||
0xFF,0xFC,0x30,0x41,0x82,0x0C,0x18,0x30,0xC0, // '7'
|
||||
0x38,0xDB,0x1F,0x63,0x98,0xF1,0xE3,0xC6,0xF8, // '8'
|
||||
0x3C,0x66,0xC3,0xC3,0xE7,0x3F,0x03,0xC3,0x66,0x3C, // '9'
|
||||
0xF0,0x3C, // ':'
|
||||
0xF0,0x3D,0x80, // ';'
|
||||
0x02,0x1D,0xF7,0x0E,0x0F,0x83,0x81, // '<'
|
||||
0xFF,0xFC,0x07,0xFF,0xE0, // '='
|
||||
0x81,0xC1,0xF0,0x70,0xEF,0xB8,0x40, // '>'
|
||||
0x3C,0xFF,0x1E,0x30,0xC7,0x0C,0x00,0x30,0x60, // '?'
|
||||
0x0F,0x83,0x06,0x60,0x24,0xED,0x99,0x9B,0x19,0xB1,0xBB,0x12,0xBF,0xE4,0xDC,0x40,0x13,0x06,0x0F,0xC0, // '@'
|
||||
0x1C,0x0E,0x05,0x06,0xC3,0x63,0x19,0xFC,0xFE,0xC1,0xE0,0xC0, // 'A'
|
||||
0xFC,0xFE,0xC7,0xC6,0xFE,0xFE,0xC3,0xC3,0xFF,0xFE, // 'B'
|
||||
0x3E,0x3F,0xB8,0xF8,0x3C,0x06,0x03,0x06,0xC7,0x7F,0x0F,0x00, // 'C'
|
||||
0xFE,0x7F,0xB0,0xF8,0x3C,0x1E,0x0F,0x07,0x87,0xFF,0x7F,0x00, // 'D'
|
||||
0xFE,0xFF,0xC0,0xC0,0xFE,0xFE,0xC0,0xC0,0xFF,0xFF, // 'E'
|
||||
0xFF,0xFF,0x06,0x0F,0xDF,0xB0,0x60,0xC1,0x80, // 'F'
|
||||
0x1E,0x3F,0x98,0xF8,0x2C,0x06,0x3F,0x1E,0xC3,0x7F,0x9F,0x00, // 'G'
|
||||
0xC1,0xE0,0xF0,0x78,0x3F,0xFF,0xFF,0x07,0x83,0xC1,0xE0,0xC0, // 'H'
|
||||
0xFF,0xFF,0xF0, // 'I'
|
||||
0x06,0x0C,0x18,0x30,0x60,0xF1,0xF3,0x7E,0x78, // 'J'
|
||||
0xC3,0x63,0xB3,0x9B,0x8F,0x87,0x63,0x19,0x8E,0xC3,0x60,0xC0, // 'K'
|
||||
0xC1,0x83,0x06,0x0C,0x18,0x30,0x60,0xFF,0xFC, // 'L'
|
||||
0xE1,0xFC,0xFF,0x3F,0xCF,0xD2,0xF7,0xBD,0xEF,0x7B,0xCC,0xF3,0x30, // 'M'
|
||||
0xC1,0xF0,0xFC,0x7E,0x3D,0x9E,0x6F,0x3F,0x8F,0xC3,0xE0,0xC0, // 'N'
|
||||
0x1E,0x1F,0xE6,0x1B,0x03,0xC0,0xF0,0x3C,0x0D,0x86,0x7F,0x87,0x80, // 'O'
|
||||
0xFE,0xFF,0xC3,0xC3,0xFF,0xFE,0xC0,0xC0,0xC0,0xC0, // 'P'
|
||||
0x1E,0x0F,0xF1,0x87,0x60,0x6C,0x0D,0x81,0xB1,0x33,0x7C,0x7F,0x83,0xD8,0x01,0x80, // 'Q'
|
||||
0xFE,0xFF,0xC3,0xC3,0xFE,0xFC,0xCE,0xC6,0xC3,0xC3, // 'R'
|
||||
0x7C,0xFE,0xC7,0xC2,0x7C,0x0F,0xC3,0xC3,0x7E,0x3C, // 'S'
|
||||
0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, // 'T'
|
||||
0xC1,0xE0,0xF0,0x78,0x3C,0x1E,0x0F,0x07,0xC7,0x7F,0x1F,0x00, // 'U'
|
||||
0xC1,0xE0,0xD8,0xCC,0x66,0x31,0xB0,0xD8,0x6C,0x1C,0x0E,0x00, // 'V'
|
||||
0xC7,0x1E,0x38,0xF1,0x46,0xDB,0x66,0xDB,0x36,0xD9,0xA2,0xC7,0x1C,0x38,0xE1,0x83,0x00, // 'W'
|
||||
0xC3,0x66,0x7E,0x3C,0x18,0x3C,0x7E,0x66,0xC3,0xC3, // 'X'
|
||||
0xC3,0xC3,0x66,0x3E,0x3C,0x18,0x18,0x18,0x18,0x18, // 'Y'
|
||||
0x7F,0x3F,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFF,0xFF,0xC0, // 'Z'
|
||||
0xFF,0xCC,0xCC,0xCC,0xCC,0xCF,0xF0, // '['
|
||||
0xCC,0x44,0x66,0x22,0x33, // '\'
|
||||
0xFF,0x33,0x33,0x33,0x33,0x3F,0xF0, // ']'
|
||||
0x30,0xE7,0x9A,0xCF,0x30, // '^'
|
||||
0xFE, // '_'
|
||||
0xD0, // '`'
|
||||
0x7D,0x8C,0x7F,0x3C,0x79,0xDD,0x80, // 'a'
|
||||
0xC1,0x83,0x06,0xEF,0xF8,0xF1,0xE3,0xFF,0xB8, // 'b'
|
||||
0x3C,0xFF,0x1E,0x0C,0x6F,0xCF,0x00, // 'c'
|
||||
0x06,0x0C,0x1B,0xBF,0xF8,0xF1,0xE3,0xFE,0xEC, // 'd'
|
||||
0x3C,0xCF,0x1F,0xFC,0x0C,0xCF,0x00, // 'e'
|
||||
0x3B,0x19,0xF6,0x31,0x8C,0x63,0x00, // 'f'
|
||||
0x77,0xFF,0x1E,0x3C,0x7F,0xDD,0xE3,0xC6,0xF8, // 'g'
|
||||
0xC1,0x83,0x06,0xEF,0xF8,0xF1,0xE3,0xC7,0x8C, // 'h'
|
||||
0xF3,0xFF,0xF0, // 'i'
|
||||
0x33,0x03,0x33,0x33,0x33,0x3F,0xE0, // 'j'
|
||||
0xC1,0x83,0x06,0x6D,0x9E,0x3E,0x66,0xCD,0x8C, // 'k'
|
||||
0xFF,0xFF,0xF0, // 'l'
|
||||
0xD9,0xDF,0xFF,0x31,0xE6,0x3C,0xC7,0x98,0xF3,0x18, // 'm'
|
||||
0xDD,0xFF,0x1E,0x3C,0x78,0xF1,0x80, // 'n'
|
||||
0x38,0xFB,0x1E,0x3C,0x6F,0x8E,0x00, // 'o'
|
||||
0xDD,0xFF,0x1E,0x3C,0x7F,0xF7,0x60,0xC1,0x80, // 'p'
|
||||
0x77,0xFF,0x1E,0x3C,0x7F,0xDD,0x83,0x06,0x0C, // 'q'
|
||||
0xDF,0xF1,0x8C,0x63,0x00, // 'r'
|
||||
0x7B,0x3E,0x1E,0x0F,0x37,0x80, // 's'
|
||||
0x63,0x19,0xF6,0x31,0x8C,0x79,0xC0, // 't'
|
||||
0xC7,0x8F,0x1E,0x3C,0x7F,0xDD,0x80, // 'u'
|
||||
0xC7,0x8D,0x93,0x62,0x87,0x04,0x00, // 'v'
|
||||
0xC4,0x79,0xCD,0x29,0x35,0x67,0xBC,0x63,0x0C,0x60, // 'w'
|
||||
0xC6,0xD9,0xF1,0xC7,0xCD,0xB1,0x80, // 'x'
|
||||
0xC7,0x8D,0x93,0x62,0xC7,0x06,0x18,0xF1,0xC0, // 'y'
|
||||
0xFE,0x18,0x61,0x86,0x1F,0xFF,0x80, // 'z'
|
||||
0x19,0xCC,0x63,0x3B,0x8E,0x31,0x8C,0x71,0x80, // '{'
|
||||
0xFF,0xFF,0xFF,0xC0, // '|'
|
||||
0xC7,0x18,0xC6,0x38,0xEE,0x63,0x19,0xCC,0x00 // '}'
|
||||
};
|
||||
const GFXglyph ArialRoundedMTBold_14Glyphs[] PROGMEM = {
|
||||
// bitmapOffset, width, height, xAdvance, xOffset, yOffset
|
||||
{ 0, 1, 1, 5, 0, 0 }, // ' '
|
||||
{ 1, 2, 10, 6, 1, -10 }, // '!'
|
||||
{ 4, 5, 3, 8, 1, -10 }, // '"'
|
||||
{ 6, 8, 10, 9, 0, -10 }, // '#'
|
||||
{ 16, 7, 15, 9, 1, -12 }, // '$'
|
||||
{ 30, 11, 10, 13, 0, -10 }, // '%'
|
||||
{ 44, 10, 10, 12, 1, -10 }, // '&'
|
||||
{ 57, 2, 3, 4, 1, -10 }, // '''
|
||||
{ 58, 4, 13, 6, 1, -10 }, // '('
|
||||
{ 65, 4, 13, 6, 0, -10 }, // ')'
|
||||
{ 72, 5, 6, 7, 1, -11 }, // '*'
|
||||
{ 76, 8, 7, 9, 0, -9 }, // '+'
|
||||
{ 83, 2, 4, 5, 1, -2 }, // ','
|
||||
{ 84, 4, 2, 6, 0, -5 }, // '-'
|
||||
{ 85, 2, 2, 5, 1, -2 }, // '.'
|
||||
{ 86, 4, 10, 5, 0, -10 }, // '/'
|
||||
{ 91, 7, 10, 9, 1, -10 }, // '0'
|
||||
{ 100, 5, 10, 9, 1, -10 }, // '1'
|
||||
{ 107, 7, 10, 9, 1, -10 }, // '2'
|
||||
{ 116, 7, 10, 9, 1, -10 }, // '3'
|
||||
{ 125, 8, 10, 9, 0, -10 }, // '4'
|
||||
{ 135, 7, 10, 9, 1, -10 }, // '5'
|
||||
{ 144, 7, 10, 9, 1, -10 }, // '6'
|
||||
{ 153, 7, 10, 9, 1, -10 }, // '7'
|
||||
{ 162, 7, 10, 9, 1, -10 }, // '8'
|
||||
{ 171, 8, 10, 9, 0, -10 }, // '9'
|
||||
{ 181, 2, 7, 5, 1, -7 }, // ':'
|
||||
{ 183, 2, 9, 5, 1, -7 }, // ';'
|
||||
{ 186, 7, 8, 9, 1, -9 }, // '<'
|
||||
{ 193, 7, 5, 9, 1, -7 }, // '='
|
||||
{ 198, 7, 8, 9, 1, -9 }, // '>'
|
||||
{ 205, 7, 10, 9, 1, -10 }, // '?'
|
||||
{ 214, 12, 13, 15, 1, -10 }, // '@'
|
||||
{ 234, 9, 10, 11, 1, -10 }, // 'A'
|
||||
{ 246, 8, 10, 11, 1, -10 }, // 'B'
|
||||
{ 256, 9, 10, 11, 1, -10 }, // 'C'
|
||||
{ 268, 9, 10, 11, 1, -10 }, // 'D'
|
||||
{ 280, 8, 10, 10, 1, -10 }, // 'E'
|
||||
{ 290, 7, 10, 9, 1, -10 }, // 'F'
|
||||
{ 299, 9, 10, 12, 1, -10 }, // 'G'
|
||||
{ 311, 9, 10, 12, 1, -10 }, // 'H'
|
||||
{ 323, 2, 10, 5, 1, -10 }, // 'I'
|
||||
{ 326, 7, 10, 9, 0, -10 }, // 'J'
|
||||
{ 335, 9, 10, 11, 1, -10 }, // 'K'
|
||||
{ 347, 7, 10, 9, 1, -10 }, // 'L'
|
||||
{ 356, 10, 10, 13, 1, -10 }, // 'M'
|
||||
{ 369, 9, 10, 12, 1, -10 }, // 'N'
|
||||
{ 381, 10, 10, 12, 1, -10 }, // 'O'
|
||||
{ 394, 8, 10, 10, 1, -10 }, // 'P'
|
||||
{ 404, 11, 11, 12, 1, -10 }, // 'Q'
|
||||
{ 420, 8, 10, 11, 1, -10 }, // 'R'
|
||||
{ 430, 8, 10, 10, 1, -10 }, // 'S'
|
||||
{ 440, 8, 10, 10, 0, -10 }, // 'T'
|
||||
{ 450, 9, 10, 12, 1, -10 }, // 'U'
|
||||
{ 462, 9, 10, 11, 0, -10 }, // 'V'
|
||||
{ 474, 13, 10, 14, 0, -10 }, // 'W'
|
||||
{ 491, 8, 10, 9, 0, -10 }, // 'X'
|
||||
{ 501, 8, 10, 10, 0, -10 }, // 'Y'
|
||||
{ 511, 9, 10, 10, 0, -10 }, // 'Z'
|
||||
{ 523, 4, 13, 6, 1, -10 }, // '['
|
||||
{ 530, 4, 10, 5, 0, -10 }, // '\'
|
||||
{ 535, 4, 13, 6, 0, -10 }, // ']'
|
||||
{ 542, 6, 6, 9, 1, -10 }, // '^'
|
||||
{ 547, 7, 1, 8, 0, 1 }, // '_'
|
||||
{ 548, 2, 2, 6, 1, -10 }, // '`'
|
||||
{ 549, 7, 7, 9, 1, -7 }, // 'a'
|
||||
{ 556, 7, 10, 10, 1, -10 }, // 'b'
|
||||
{ 565, 7, 7, 9, 1, -7 }, // 'c'
|
||||
{ 572, 7, 10, 10, 1, -10 }, // 'd'
|
||||
{ 581, 7, 7, 9, 1, -7 }, // 'e'
|
||||
{ 588, 5, 10, 6, 0, -10 }, // 'f'
|
||||
{ 595, 7, 10, 10, 1, -7 }, // 'g'
|
||||
{ 604, 7, 10, 9, 1, -10 }, // 'h'
|
||||
{ 613, 2, 10, 5, 1, -10 }, // 'i'
|
||||
{ 616, 4, 13, 5, -1, -10 }, // 'j'
|
||||
{ 623, 7, 10, 9, 1, -10 }, // 'k'
|
||||
{ 632, 2, 10, 5, 1, -10 }, // 'l'
|
||||
{ 635, 11, 7, 13, 1, -7 }, // 'm'
|
||||
{ 645, 7, 7, 9, 1, -7 }, // 'n'
|
||||
{ 652, 7, 7, 9, 1, -7 }, // 'o'
|
||||
{ 659, 7, 10, 10, 1, -7 }, // 'p'
|
||||
{ 668, 7, 10, 10, 1, -7 }, // 'q'
|
||||
{ 677, 5, 7, 7, 1, -7 }, // 'r'
|
||||
{ 682, 6, 7, 9, 1, -7 }, // 's'
|
||||
{ 688, 5, 10, 6, 0, -10 }, // 't'
|
||||
{ 695, 7, 7, 9, 1, -7 }, // 'u'
|
||||
{ 702, 7, 7, 9, 0, -7 }, // 'v'
|
||||
{ 709, 11, 7, 12, 0, -7 }, // 'w'
|
||||
{ 719, 7, 7, 8, 0, -7 }, // 'x'
|
||||
{ 726, 7, 10, 9, 0, -7 }, // 'y'
|
||||
{ 735, 7, 7, 8, 0, -7 }, // 'z'
|
||||
{ 742, 5, 13, 6, 0, -10 }, // '{'
|
||||
{ 751, 2, 13, 5, 1, -10 }, // '|'
|
||||
{ 755, 5, 13, 6, 1, -10 } // '}' character 0x7D
|
||||
};
|
||||
const GFXfont ArialRoundedMTBold_14 PROGMEM = { // Last character bug fixed 0x7E to 0x7D
|
||||
(uint8_t *)ArialRoundedMTBold_14Bitmaps,(GFXglyph *)ArialRoundedMTBold_14Glyphs,0x20, 0x7D, 17};
|
||||
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
*/
|
||||
|
||||
// Created by http://oleddisplay.squix.ch/ Consider a donation
|
||||
// In case of problems make sure that you are using the font file with the correct version!
|
||||
|
||||
// Bodmer fix: End character is 0x7D not 0x7E, so bug in last line of the file corrected
|
||||
// this avoids screen corruption if ~ is printed
|
||||
|
||||
// Bodmer change: '`' changed to tiny degree symbol (typically this character is on top left key of a QWERTY keyboard)
|
||||
|
||||
const uint8_t ArialRoundedMTBold_36Bitmaps[] PROGMEM = {
|
||||
|
||||
// Bitmap Data:
|
||||
0x00, // ' '
|
||||
0x77,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0x39,0xCE,0x73,0x00,0x00,0x3B,0xFF,0xFB,0x80, // '!'
|
||||
0xFC,0xFF,0xF3,0xFF,0xCF,0xFF,0x3F,0xFC,0xFF,0xF3,0xFF,0xCF,0xDE,0x1E,0x78,0x78, // '"'
|
||||
0x01,0x83,0x80,0x78,0x70,0x0F,0x0E,0x01,0xC3,0xC0,0x78,0x78,0x0F,0x0F,0x01,0xE1,0xE3,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0x07,0x87,0x80,0xF0,0xE0,0x1E,0x3C,0x07,0x87,0x80,0xF0,0xF0,0x7F,0xFF,0xDF,0xFF,0xFF,0xFF,0xFF,0xBF,0xFF,0xE3,0xC3,0xC0,0x78,0x78,0x0F,0x0E,0x01,0xC3,0xC0,0x78,0x78,0x07,0x06,0x00, // '#'
|
||||
0x00,0x60,0x00,0x0C,0x00,0x01,0x80,0x00,0x30,0x00,0x7F,0xE0,0x3F,0xFE,0x0F,0xFF,0xE1,0xF3,0x7E,0x7C,0x67,0xCF,0x0C,0x79,0xE1,0x8F,0x3C,0x30,0xC7,0xC6,0x00,0xFE,0xC0,0x0F,0xF8,0x00,0xFF,0xE0,0x0F,0xFF,0x00,0x7F,0xF0,0x01,0xFF,0x00,0x37,0xE0,0x06,0x3E,0xE0,0xC3,0xFC,0x18,0x7F,0xC3,0x0F,0xF8,0x61,0xEF,0x8C,0x79,0xFD,0x9F,0x1F,0xFF,0xC1,0xFF,0xF0,0x0F,0xFC,0x00,0x38,0x00,0x03,0x00,0x00,0x60,0x00,0x0C,0x00,0x01,0x80,0x00,0x30,0x00,0x06,0x00, // '$'
|
||||
0x1F,0x00,0x06,0x03,0xFC,0x00,0x70,0x1C,0x70,0x03,0x01,0xC1,0x80,0x38,0x0E,0x0E,0x03,0x80,0x70,0x70,0x1C,0x03,0x83,0x81,0xC0,0x1C,0x1C,0x0C,0x00,0xE0,0xE0,0xE0,0x07,0x07,0x0E,0x00,0x1C,0x70,0x70,0x00,0xFF,0x87,0x00,0x03,0xF8,0x30,0x00,0x00,0x03,0x87,0xF0,0x00,0x38,0x7F,0xC0,0x01,0xC3,0x8E,0x00,0x1C,0x38,0x38,0x00,0xC1,0xC1,0xC0,0x0E,0x0E,0x0E,0x00,0xE0,0x70,0x70,0x07,0x03,0x83,0x80,0x70,0x1C,0x1C,0x07,0x00,0xE0,0xE0,0x38,0x03,0x8E,0x03,0x80,0x0F,0xE0,0x1C,0x00,0x3E,0x00,0xC0,0x00,0x00, // '%'
|
||||
0x00,0xFC,0x00,0x01,0xFF,0x80,0x01,0xFF,0xE0,0x01,0xF0,0xF0,0x00,0xF0,0x3C,0x00,0x78,0x1E,0x00,0x3C,0x0F,0x00,0x1F,0x0F,0x80,0x0F,0xDF,0x80,0x03,0xFF,0x80,0x00,0xFF,0x80,0x00,0xFF,0x00,0x00,0xFF,0xC1,0x81,0xFF,0xF0,0xE1,0xF9,0xF8,0xF8,0xF8,0x7E,0x78,0xF8,0x1F,0xFC,0x7C,0x07,0xFC,0x3E,0x01,0xFE,0x1F,0x00,0x7F,0x0F,0xC0,0x3F,0xC3,0xF0,0x7F,0xF1,0xFF,0xFF,0xFC,0x7F,0xFF,0x3F,0x0F,0xFE,0x0F,0x01,0xFC,0x03,0x80, // '&'
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xDE,0x78, // '''
|
||||
0x03,0x81,0xC1,0xC1,0xE0,0xF0,0xF0,0xF8,0x78,0x3C,0x3E,0x1F,0x0F,0x0F,0x87,0xC3,0xE1,0xF0,0xF8,0x7C,0x3E,0x1F,0x0F,0x83,0xC1,0xF0,0xF8,0x3C,0x1E,0x0F,0x83,0xC0,0xF0,0x78,0x1C,0x07,0x01,0x80, // '('
|
||||
0xE0,0x70,0x1C,0x0F,0x03,0x81,0xE0,0xF8,0x3C,0x1E,0x0F,0x87,0xC1,0xE0,0xF8,0x7C,0x3E,0x1F,0x0F,0x87,0xC3,0xE1,0xF0,0xF8,0x78,0x7C,0x3E,0x1E,0x0F,0x0F,0x87,0x83,0x83,0xC1,0xC1,0xC0,0xE0,0x00, // ')'
|
||||
0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x0E,0x38,0xFF,0x77,0xDF,0xFF,0x07,0xF0,0x07,0xC0,0x1D,0xC0,0x3B,0xC0,0xE3,0x83,0xC7,0x83,0x06,0x00, // '*'
|
||||
0x01,0xF0,0x00,0x3E,0x00,0x07,0xC0,0x00,0xF8,0x00,0x1F,0x00,0x03,0xE0,0x00,0x7C,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x1F,0x00,0x03,0xE0,0x00,0x7C,0x00,0x0F,0x80,0x01,0xF0,0x00,0x3E,0x00, // '+'
|
||||
0x7B,0xEF,0xFF,0x7C,0x71,0xCE,0x7B,0xCE,0x00, // ','
|
||||
0x7F,0xDF,0xFF,0xFF,0xBF,0xE0, // '-'
|
||||
0x77,0xFF,0xF7,0x00, // '.'
|
||||
0x03,0x81,0xC1,0xE0,0xF0,0x70,0x78,0x3C,0x1E,0x0E,0x07,0x07,0x83,0xC1,0xC0,0xE0,0xF0,0x78,0x38,0x1C,0x1E,0x0F,0x07,0x03,0x83,0xC1,0xE0,0xE0,0x70,0x00, // '/'
|
||||
0x03,0xF0,0x03,0xFF,0x01,0xFF,0xE0,0xFF,0xFC,0x3E,0x1F,0x1F,0x03,0xE7,0xC0,0xF9,0xE0,0x1E,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xF7,0x80,0x79,0xF0,0x3E,0x7C,0x0F,0x8F,0x87,0xC3,0xFF,0xF0,0x7F,0xF8,0x0F,0xFC,0x00,0xFC,0x00, // '0'
|
||||
0x00,0x30,0x03,0xC0,0x3E,0x03,0xF0,0x3F,0x83,0xFC,0x7F,0xEF,0xDF,0xFC,0xFF,0xC7,0xD8,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x00,0xF8,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x00,0xF8,0x03,0x80, // '1'
|
||||
0x03,0xF8,0x03,0xFF,0x83,0xFF,0xF0,0xFF,0xFE,0x7E,0x1F,0x9F,0x03,0xFF,0x80,0x7F,0xE0,0x1F,0xF0,0x07,0xD8,0x01,0xF0,0x00,0xF8,0x00,0x7E,0x00,0x1F,0x00,0x1F,0x80,0x0F,0xC0,0x07,0xE0,0x03,0xF0,0x01,0xF8,0x00,0xFC,0x00,0x7E,0x00,0x3F,0x00,0x1F,0x80,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0xF0, // '2'
|
||||
0x03,0xF0,0x07,0xFF,0x03,0xFF,0xE1,0xF0,0xFC,0x78,0x1F,0x1E,0x03,0xE7,0x00,0xF8,0x80,0x3E,0x00,0x1F,0x00,0x0F,0xC0,0x7F,0xE0,0x1F,0xF0,0x07,0xFE,0x01,0xFF,0xC0,0x01,0xF8,0x00,0x3F,0x00,0x07,0xD8,0x01,0xFF,0x00,0x7F,0xE0,0x1F,0xF8,0x0F,0x9F,0x07,0xE7,0xFF,0xF0,0xFF,0xF8,0x1F,0xFC,0x01,0xFC,0x00, // '3'
|
||||
0x00,0x0F,0x00,0x00,0xFC,0x00,0x07,0xE0,0x00,0x7F,0x00,0x07,0xF8,0x00,0x7F,0xC0,0x03,0xFE,0x00,0x3D,0xF0,0x03,0xCF,0x80,0x3C,0x7C,0x03,0xE3,0xE0,0x1E,0x1F,0x01,0xE0,0xF8,0x1E,0x07,0xC1,0xF0,0x3E,0x0F,0x01,0xF0,0xFF,0xFF,0xF7,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xE0,0x00,0xF8,0x00,0x07,0xC0,0x00,0x3E,0x00,0x01,0xF0,0x00,0x0F,0x80,0x00,0x38,0x00, // '4'
|
||||
0x1F,0xFF,0x8F,0xFF,0xE3,0xFF,0xF8,0xFF,0xFC,0x3C,0x00,0x0F,0x00,0x07,0xC0,0x01,0xF0,0x00,0x78,0x00,0x1E,0x7E,0x07,0xFF,0xE1,0xFF,0xFC,0xFF,0xFF,0xBF,0x07,0xE7,0x80,0xFC,0x80,0x1F,0x00,0x07,0xC0,0x01,0xF6,0x00,0x7F,0xC0,0x1F,0xF0,0x0F,0xBE,0x03,0xE7,0xC1,0xF1,0xFF,0xF8,0x1F,0xFC,0x01,0xFC,0x00, // '5'
|
||||
0x03,0xF8,0x01,0xFF,0x81,0xFF,0xF0,0x7C,0x7C,0x3C,0x0F,0x9F,0x03,0xE7,0x80,0x71,0xE0,0x00,0xF8,0x00,0x3E,0x3E,0x0F,0xBF,0xE3,0xFF,0xFC,0xFE,0x1F,0xBF,0x03,0xEF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xF7,0x80,0x7D,0xF0,0x1F,0x7C,0x0F,0x8F,0x87,0xE3,0xFF,0xF0,0x7F,0xFC,0x0F,0xFC,0x00,0xFC,0x00, // '6'
|
||||
0x7F,0xFF,0xBF,0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0x00,0x0F,0x80,0x07,0xC0,0x01,0xE0,0x00,0xF8,0x00,0x7C,0x00,0x1E,0x00,0x0F,0x80,0x03,0xC0,0x01,0xF0,0x00,0x78,0x00,0x3E,0x00,0x0F,0x80,0x07,0xC0,0x01,0xF0,0x00,0x7C,0x00,0x3F,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x01,0xC0,0x00, // '7'
|
||||
0x03,0xF8,0x01,0xFF,0xC0,0x7F,0xFC,0x1F,0x0F,0xC7,0xC0,0xFC,0xF8,0x0F,0x9F,0x01,0xF3,0xE0,0x3E,0x7C,0x07,0xCF,0x80,0xF0,0xF8,0x7E,0x0F,0xFF,0x80,0xFF,0xE0,0x7F,0xFE,0x1F,0x83,0xF3,0xE0,0x3E,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x0F,0xFC,0x01,0xFF,0x80,0x3E,0xF8,0x0F,0x9F,0x83,0xF1,0xFF,0xFC,0x1F,0xFF,0x00,0x7F,0x00, // '8'
|
||||
0x03,0xF0,0x03,0xFF,0x03,0xFF,0xE0,0xFF,0xFC,0x7E,0x1F,0x1F,0x03,0xEF,0x80,0xFB,0xE0,0x1E,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0x7C,0x0F,0xDF,0x87,0xF3,0xFF,0xFC,0x7F,0xDF,0x07,0xC7,0xC0,0x01,0xF0,0x00,0x78,0xE0,0x1E,0x78,0x0F,0x9F,0x03,0xC3,0xE3,0xE0,0xFF,0xF8,0x1F,0xF8,0x01,0xF8,0x00, // '9'
|
||||
0x77,0xFF,0xF7,0x00,0x00,0x00,0x00,0x00,0x01,0xDF,0xFF,0xDC, // ':'
|
||||
0x77,0xFF,0xF7,0x00,0x00,0x00,0x00,0x00,0x01,0xDE,0xFF,0xFE,0x73,0x9B,0xDC,0xC0, // ';'
|
||||
0x00,0x00,0x40,0x00,0x70,0x00,0xFC,0x00,0xFF,0x00,0xFF,0xC1,0xFF,0xE1,0xFF,0xC1,0xFF,0xC0,0xFF,0x80,0x3F,0x80,0x0F,0xE0,0x03,0xFE,0x00,0x7F,0xF0,0x07,0xFF,0x00,0x7F,0xF8,0x03,0xFF,0x00,0x3F,0xC0,0x03,0xF0,0x00,0x1C,0x00,0x01, // '<'
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0, // '='
|
||||
0x80,0x00,0x38,0x00,0x0F,0xC0,0x03,0xFC,0x00,0xFF,0xC0,0x1F,0xFE,0x00,0xFF,0xE0,0x0F,0xFE,0x00,0x7F,0xC0,0x07,0xF0,0x01,0xFC,0x01,0xFF,0x03,0xFF,0x83,0xFF,0x87,0xFF,0x83,0xFF,0x00,0xFF,0x00,0x3F,0x00,0x0E,0x00,0x02,0x00,0x00, // '>'
|
||||
0x03,0xF8,0x03,0xFF,0x83,0xFF,0xF0,0xFF,0xFE,0x7E,0x1F,0xBF,0x03,0xFF,0x80,0x7F,0xE0,0x1F,0x70,0x07,0xC8,0x03,0xE0,0x01,0xF8,0x00,0xFC,0x00,0x7E,0x00,0x3F,0x00,0x0F,0x80,0x03,0xC0,0x01,0xF0,0x00,0x78,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x1F,0x00,0x07,0xC0,0x01,0xF0,0x00,0x38,0x00, // '?'
|
||||
0x00,0x07,0xFE,0x00,0x00,0x0F,0xFF,0xF0,0x00,0x0F,0xFF,0xFE,0x00,0x07,0xE0,0x0F,0xE0,0x07,0xC0,0x00,0x7C,0x03,0xE0,0x00,0x0F,0x00,0xE0,0x00,0x01,0xE0,0x70,0x1F,0x9F,0x3C,0x3C,0x1F,0xF7,0xC7,0x0E,0x0F,0xFF,0xE1,0xC7,0x07,0xE3,0xF8,0x39,0xC3,0xE0,0x7E,0x0E,0x70,0xF8,0x0F,0x83,0xB8,0x7C,0x03,0xE0,0xEE,0x1F,0x00,0xF0,0x3B,0x8F,0x80,0x3C,0x0E,0xE3,0xE0,0x1F,0x07,0xB8,0xF8,0x07,0xC1,0xCE,0x3E,0x01,0xE0,0xF3,0x8F,0x80,0xF8,0x78,0xE3,0xE0,0x3E,0x1E,0x1C,0x7C,0x1F,0x9F,0x07,0x1F,0xFF,0xFF,0x81,0xC3,0xFF,0xFF,0xC0,0x38,0x7F,0xBF,0xE0,0x0F,0x07,0x87,0xE0,0x01,0xE0,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3E,0x07,0xC0,0x00,0x1F,0x00,0xFE,0x00,0x3F,0x80,0x1F,0xFF,0xFF,0x80,0x00,0xFF,0xFF,0x80,0x00,0x07,0xFF,0x00,0x00, // '@'
|
||||
0x00,0x3C,0x00,0x00,0x7E,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x01,0xFF,0x00,0x01,0xFF,0x80,0x01,0xEF,0x80,0x03,0xE7,0xC0,0x03,0xE7,0xC0,0x07,0xC7,0xC0,0x07,0xC3,0xE0,0x07,0xC3,0xE0,0x0F,0x81,0xF0,0x0F,0x81,0xF0,0x1F,0x81,0xF8,0x1F,0x00,0xF8,0x1F,0xFF,0xF8,0x3F,0xFF,0xFC,0x3F,0xFF,0xFC,0x7F,0xFF,0xFE,0x7C,0x00,0x7E,0x7C,0x00,0x3E,0xFC,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x1F,0x70,0x00,0x0E, // 'A'
|
||||
0x7F,0xFF,0x07,0xFF,0xFC,0x3F,0xFF,0xF1,0xFF,0xFF,0xCF,0x80,0x7F,0x7C,0x01,0xFB,0xE0,0x07,0xDF,0x00,0x3E,0xF8,0x01,0xF7,0xC0,0x1F,0x3E,0x01,0xF9,0xFF,0xFF,0x8F,0xFF,0xF0,0x7F,0xFF,0xE3,0xFF,0xFF,0x9F,0x00,0x7E,0xF8,0x01,0xFF,0xC0,0x07,0xFE,0x00,0x3F,0xF0,0x01,0xFF,0x80,0x1F,0xFC,0x01,0xFB,0xFF,0xFF,0xDF,0xFF,0xFC,0xFF,0xFF,0xC3,0xFF,0xF8,0x00, // 'B'
|
||||
0x00,0xFF,0x00,0x07,0xFF,0x80,0x3F,0xFF,0xC0,0xFF,0xFF,0xC3,0xF8,0x1F,0xC7,0xE0,0x1F,0x9F,0x80,0x1F,0x3E,0x00,0x1F,0x7C,0x00,0x3D,0xF0,0x00,0x33,0xE0,0x00,0x07,0xC0,0x00,0x0F,0x80,0x00,0x1F,0x00,0x00,0x3E,0x00,0x00,0x7C,0x00,0x04,0xF8,0x00,0x1C,0xF8,0x00,0x7D,0xF0,0x00,0xFB,0xF0,0x03,0xE3,0xF0,0x0F,0xC7,0xF0,0x3F,0x07,0xFF,0xFE,0x07,0xFF,0xF8,0x03,0xFF,0xC0,0x01,0xFE,0x00, // 'C'
|
||||
0x7F,0xFE,0x03,0xFF,0xFE,0x0F,0xFF,0xFC,0x3F,0xFF,0xF8,0xF8,0x07,0xF3,0xE0,0x07,0xEF,0x80,0x1F,0xBE,0x00,0x3E,0xF8,0x00,0xFF,0xE0,0x01,0xFF,0x80,0x07,0xFE,0x00,0x1F,0xF8,0x00,0x7F,0xE0,0x01,0xFF,0x80,0x07,0xFE,0x00,0x1F,0xF8,0x00,0x7F,0xE0,0x03,0xFF,0x80,0x0F,0xBE,0x00,0x7E,0xF8,0x01,0xFB,0xE0,0x1F,0xCF,0xFF,0xFE,0x3F,0xFF,0xF0,0xFF,0xFF,0x81,0xFF,0xF8,0x00, // 'D'
|
||||
0x7F,0xFF,0xEF,0xFF,0xFE,0xFF,0xFF,0xEF,0xFF,0xFE,0xF8,0x00,0x0F,0x80,0x00,0xF8,0x00,0x0F,0x80,0x00,0xF8,0x00,0x0F,0x80,0x00,0xFF,0xFF,0xCF,0xFF,0xFC,0xFF,0xFF,0xCF,0xFF,0xFC,0xF8,0x00,0x0F,0x80,0x00,0xF8,0x00,0x0F,0x80,0x00,0xF8,0x00,0x0F,0x80,0x00,0xF8,0x00,0x0F,0x80,0x00,0xFF,0xFF,0xEF,0xFF,0xFF,0xFF,0xFF,0xF7,0xFF,0xFE, // 'E'
|
||||
0x7F,0xFF,0xBF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xFF,0xF8,0xFF,0xFF,0x3F,0xFF,0xCF,0xFF,0xE3,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x1C,0x00,0x00, // 'F'
|
||||
0x00,0x7F,0x80,0x03,0xFF,0xF0,0x07,0xFF,0xF8,0x1F,0xFF,0xFC,0x1F,0xC1,0xFE,0x3F,0x00,0x7E,0x7E,0x00,0x3E,0x7C,0x00,0x3E,0x7C,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0xF8,0x07,0xFE,0xF8,0x0F,0xFF,0xF8,0x0F,0xFF,0xF8,0x07,0xFF,0xF8,0x00,0x1F,0x7C,0x00,0x1F,0x7C,0x00,0x1F,0x7E,0x00,0x1F,0x3F,0x00,0x3F,0x1F,0xC0,0xFF,0x1F,0xFF,0xFE,0x07,0xFF,0xFC,0x03,0xFF,0xF0,0x00,0x7F,0x80, // 'G'
|
||||
0x70,0x00,0x77,0xC0,0x07,0xFE,0x00,0x3F,0xF0,0x01,0xFF,0x80,0x0F,0xFC,0x00,0x7F,0xE0,0x03,0xFF,0x00,0x1F,0xF8,0x00,0xFF,0xC0,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x03,0xFF,0x00,0x1F,0xF8,0x00,0xFF,0xC0,0x07,0xFE,0x00,0x3F,0xF0,0x01,0xFF,0x80,0x0F,0xFC,0x00,0x7F,0xE0,0x03,0xFF,0x00,0x1F,0xF8,0x00,0xFB,0x80,0x03,0x80, // 'H'
|
||||
0x77,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0x80, // 'I'
|
||||
0x00,0x07,0x00,0x07,0xC0,0x03,0xE0,0x01,0xF0,0x00,0xF8,0x00,0x7C,0x00,0x3E,0x00,0x1F,0x00,0x0F,0x80,0x07,0xC0,0x03,0xE0,0x01,0xF0,0x00,0xF8,0x00,0x7C,0x00,0x3E,0x00,0x1F,0x70,0x0F,0xFC,0x07,0xFE,0x03,0xFF,0x01,0xFF,0xC1,0xFB,0xF1,0xF9,0xFF,0xFC,0x7F,0xFC,0x1F,0xFC,0x03,0xF8,0x00, // 'J'
|
||||
0x70,0x00,0xE3,0xE0,0x07,0xCF,0x80,0x3F,0x3E,0x01,0xFC,0xF8,0x0F,0xE3,0xE0,0x7F,0x0F,0x83,0xF8,0x3E,0x1F,0xC0,0xF8,0xFE,0x03,0xE7,0xF0,0x0F,0xBF,0x80,0x3F,0xFF,0x00,0xFF,0xFC,0x03,0xFF,0xF8,0x0F,0xFB,0xF0,0x3F,0xCF,0xE0,0xFE,0x1F,0x83,0xE0,0x3F,0x0F,0x80,0xFE,0x3E,0x01,0xF8,0xF8,0x03,0xF3,0xE0,0x0F,0xEF,0x80,0x1F,0xBE,0x00,0x3F,0xF8,0x00,0xFD,0xC0,0x01,0xE0, // 'K'
|
||||
0x70,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0xFF,0xFB,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0xE0, // 'L'
|
||||
0x7E,0x00,0x3F,0x7F,0x80,0x3F,0xFF,0xE0,0x1F,0xFF,0xF0,0x1F,0xFF,0xF8,0x0F,0xFF,0xFC,0x07,0xFF,0xFF,0x07,0xFF,0xFF,0x83,0xFF,0xFB,0xC1,0xEF,0xFD,0xE0,0xF7,0xFE,0xF8,0xFB,0xFF,0x7C,0x7D,0xFF,0x9E,0x3C,0xFF,0xCF,0x1E,0x7F,0xE7,0xDF,0x3F,0xF3,0xEF,0x9F,0xF8,0xF7,0x8F,0xFC,0x7B,0xC7,0xFE,0x3F,0xE3,0xFF,0x1F,0xF1,0xFF,0x87,0xF0,0xFF,0xC3,0xF8,0x7F,0xE1,0xFC,0x3F,0xF0,0x7C,0x1F,0xF8,0x3E,0x0F,0xB8,0x0E,0x03,0x80, // 'M'
|
||||
0x78,0x00,0x3B,0xF0,0x01,0xFF,0xC0,0x07,0xFF,0x80,0x1F,0xFF,0x00,0x7F,0xFE,0x01,0xFF,0xF8,0x07,0xFF,0xF0,0x1F,0xFF,0xE0,0x7F,0xEF,0x81,0xFF,0x9F,0x07,0xFE,0x7E,0x1F,0xF8,0xF8,0x7F,0xE1,0xF1,0xFF,0x87,0xE7,0xFE,0x0F,0x9F,0xF8,0x1F,0x7F,0xE0,0x7F,0xFF,0x80,0xFF,0xFE,0x01,0xFF,0xF8,0x07,0xFF,0xE0,0x0F,0xFF,0x80,0x1F,0xFE,0x00,0x7F,0xF8,0x00,0xFD,0xC0,0x01,0xE0, // 'N'
|
||||
0x00,0xFF,0x00,0x01,0xFF,0xF0,0x03,0xFF,0xFE,0x03,0xFF,0xFF,0x83,0xFC,0x1F,0xE1,0xF8,0x03,0xF1,0xF8,0x00,0xFC,0xF8,0x00,0x3E,0x7C,0x00,0x1F,0x7C,0x00,0x07,0xFE,0x00,0x03,0xFF,0x00,0x01,0xFF,0x80,0x00,0xFF,0xC0,0x00,0x7F,0xE0,0x00,0x3F,0xF0,0x00,0x1F,0xFC,0x00,0x0F,0xBE,0x00,0x0F,0x9F,0x00,0x07,0xCF,0xC0,0x07,0xE3,0xF0,0x07,0xE0,0xFE,0x0F,0xF0,0x7F,0xFF,0xF0,0x1F,0xFF,0xF0,0x03,0xFF,0xE0,0x00,0x3F,0xC0,0x00, // 'O'
|
||||
0x7F,0xFC,0x1F,0xFF,0xE3,0xFF,0xFE,0x7F,0xFF,0xEF,0x80,0xFD,0xF0,0x0F,0xFE,0x00,0xFF,0xC0,0x1F,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x1F,0xFC,0x07,0xEF,0xFF,0xFD,0xFF,0xFF,0x3F,0xFF,0xC7,0xFF,0xE0,0xF8,0x00,0x1F,0x00,0x03,0xE0,0x00,0x7C,0x00,0x0F,0x80,0x01,0xF0,0x00,0x3E,0x00,0x07,0xC0,0x00,0xF8,0x00,0x0E,0x00,0x00, // 'P'
|
||||
0x00,0xFF,0x00,0x00,0xFF,0xF8,0x00,0xFF,0xFF,0x80,0x7F,0xFF,0xF0,0x3F,0xC1,0xFE,0x0F,0xC0,0x1F,0x87,0xE0,0x03,0xF1,0xF0,0x00,0x7C,0x7C,0x00,0x1F,0x3E,0x00,0x03,0xEF,0x80,0x00,0xFB,0xE0,0x00,0x3E,0xF8,0x00,0x0F,0xBE,0x00,0x03,0xEF,0x80,0x00,0xFB,0xE0,0x00,0x3E,0xF8,0x00,0x0F,0x9F,0x07,0x07,0xC7,0xC1,0xF1,0xF1,0xF8,0x3F,0xFC,0x3F,0x03,0xFE,0x07,0xF0,0x7F,0x81,0xFF,0xFF,0xC0,0x1F,0xFF,0xF8,0x03,0xFF,0xFF,0x80,0x1F,0xE3,0xF0,0x00,0x00,0x7C,0x00,0x00,0x07, // 'Q'
|
||||
0x7F,0xFF,0x07,0xFF,0xFE,0x3F,0xFF,0xF9,0xFF,0xFF,0xEF,0x80,0x3F,0xFC,0x00,0xFF,0xE0,0x03,0xFF,0x00,0x1F,0xF8,0x00,0xFF,0xC0,0x0F,0xFE,0x00,0xFD,0xFF,0xFF,0xEF,0xFF,0xFE,0x7F,0xFF,0xC3,0xFF,0xF8,0x1F,0x07,0xE0,0xF8,0x1F,0x87,0xC0,0x7E,0x3E,0x01,0xF9,0xF0,0x0F,0xCF,0x80,0x3F,0x7C,0x00,0xFF,0xE0,0x07,0xFF,0x00,0x1F,0xF8,0x00,0xFB,0x80,0x03,0xC0, // 'R'
|
||||
0x03,0xF8,0x01,0xFF,0xF0,0x3F,0xFF,0x87,0xFF,0xFC,0x7E,0x0F,0xCF,0xC0,0x7E,0xF8,0x03,0xEF,0x80,0x1E,0xFC,0x00,0xCF,0xF0,0x00,0x7F,0xF0,0x03,0xFF,0xE0,0x1F,0xFF,0x80,0x7F,0xFC,0x00,0x7F,0xE0,0x00,0x7F,0x60,0x03,0xFF,0x00,0x1F,0xF0,0x01,0xFF,0x80,0x1F,0xFC,0x03,0xFF,0xE0,0x7E,0x7F,0xFF,0xC3,0xFF,0xFC,0x0F,0xFF,0x00,0x3F,0xC0, // 'S'
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x0F,0x80,0x00,0x7C,0x00,0x03,0xE0,0x00,0x1F,0x00,0x00,0xF8,0x00,0x07,0xC0,0x00,0x3E,0x00,0x01,0xF0,0x00,0x0F,0x80,0x00,0x7C,0x00,0x03,0xE0,0x00,0x1F,0x00,0x00,0xF8,0x00,0x07,0xC0,0x00,0x3E,0x00,0x01,0xF0,0x00,0x0F,0x80,0x00,0x7C,0x00,0x03,0xE0,0x00,0x1F,0x00,0x00,0xF8,0x00,0x03,0x80,0x00, // 'T'
|
||||
0x70,0x00,0x77,0xC0,0x07,0xFE,0x00,0x3F,0xF0,0x01,0xFF,0x80,0x0F,0xFC,0x00,0x7F,0xE0,0x03,0xFF,0x00,0x1F,0xF8,0x00,0xFF,0xC0,0x07,0xFE,0x00,0x3F,0xF0,0x01,0xFF,0x80,0x0F,0xFC,0x00,0x7F,0xE0,0x03,0xFF,0x00,0x1F,0xF8,0x00,0xFF,0xC0,0x07,0xFE,0x00,0x3F,0xF8,0x03,0xF7,0xC0,0x1F,0x3F,0x83,0xF8,0xFF,0xFF,0x83,0xFF,0xF8,0x0F,0xFF,0x80,0x1F,0xF0,0x00, // 'U'
|
||||
0x70,0x00,0x1D,0xF0,0x00,0x7F,0xE0,0x00,0xFF,0xE0,0x03,0xF7,0xC0,0x07,0xCF,0x80,0x0F,0x9F,0x80,0x3F,0x1F,0x00,0x7C,0x3F,0x00,0xF8,0x7E,0x03,0xE0,0x7C,0x07,0xC0,0xFC,0x0F,0x80,0xF8,0x3E,0x01,0xF0,0x7C,0x03,0xF0,0xF8,0x03,0xE3,0xE0,0x07,0xC7,0xC0,0x07,0xDF,0x00,0x0F,0xBE,0x00,0x1F,0x7C,0x00,0x1F,0xF0,0x00,0x3F,0xE0,0x00,0x7F,0x80,0x00,0x7F,0x00,0x00,0xFE,0x00,0x00,0x70,0x00, // 'V'
|
||||
0x70,0x03,0xC0,0x0E,0xF8,0x07,0xE0,0x1F,0xF8,0x07,0xE0,0x1F,0xF8,0x0F,0xF0,0x1F,0xF8,0x0F,0xF0,0x1F,0x7C,0x0F,0xF0,0x3E,0x7C,0x0F,0xF0,0x3E,0x7C,0x1F,0xF8,0x3E,0x7C,0x1E,0x78,0x3E,0x3E,0x1E,0x78,0x7C,0x3E,0x1E,0x78,0x7C,0x3E,0x3E,0x7C,0x7C,0x3E,0x3C,0x3C,0x7C,0x1E,0x3C,0x3C,0x78,0x1F,0x7C,0x3E,0xF8,0x1F,0x78,0x1E,0xF8,0x1F,0x78,0x1E,0xF8,0x0F,0x78,0x1E,0xF0,0x0F,0xF8,0x1F,0xF0,0x0F,0xF0,0x0F,0xF0,0x0F,0xF0,0x0F,0xF0,0x07,0xF0,0x0F,0xE0,0x07,0xF0,0x0F,0xE0,0x07,0xE0,0x07,0xE0,0x03,0xE0,0x07,0xC0,0x03,0xC0,0x03,0xC0, // 'W'
|
||||
0x38,0x00,0x73,0xE0,0x07,0x9F,0x00,0x7E,0xFC,0x07,0xE3,0xF0,0x3F,0x1F,0x83,0xF0,0x7E,0x3F,0x01,0xF9,0xF8,0x0F,0xDF,0x80,0x3F,0xF8,0x00,0xFF,0xC0,0x07,0xFC,0x00,0x1F,0xC0,0x00,0xFE,0x00,0x0F,0xF8,0x00,0xFF,0xE0,0x07,0xFF,0x80,0x7E,0xFC,0x07,0xE3,0xF0,0x7F,0x1F,0xC3,0xF0,0x7E,0x3F,0x01,0xFB,0xF0,0x07,0xFF,0x80,0x3F,0xF8,0x00,0xFB,0x80,0x03,0x80, // 'X'
|
||||
0x70,0x00,0x77,0xC0,0x07,0xFF,0x00,0x3E,0xF8,0x03,0xF7,0xE0,0x3F,0x1F,0x01,0xF0,0xFC,0x1F,0x83,0xF0,0xF8,0x0F,0x8F,0x80,0x7E,0xFC,0x01,0xF7,0xC0,0x07,0xFC,0x00,0x3F,0xE0,0x00,0xFE,0x00,0x03,0xE0,0x00,0x1F,0x00,0x00,0xF8,0x00,0x07,0xC0,0x00,0x3E,0x00,0x01,0xF0,0x00,0x0F,0x80,0x00,0x7C,0x00,0x03,0xE0,0x00,0x1F,0x00,0x00,0xF8,0x00,0x03,0x80,0x00, // 'Y'
|
||||
0x3F,0xFF,0xF8,0x7F,0xFF,0xF9,0xFF,0xFF,0xF1,0xFF,0xFF,0xE0,0x00,0x1F,0x80,0x00,0x7F,0x00,0x01,0xFC,0x00,0x07,0xF0,0x00,0x0F,0xC0,0x00,0x3F,0x00,0x00,0xFC,0x00,0x03,0xF0,0x00,0x0F,0xE0,0x00,0x3F,0x80,0x00,0x7E,0x00,0x01,0xF8,0x00,0x07,0xE0,0x00,0x1F,0x80,0x00,0x7F,0x00,0x01,0xFC,0x00,0x07,0xF0,0x00,0x0F,0xC0,0x00,0x3F,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xF8, // 'Z'
|
||||
0x7F,0xFF,0xFF,0xFF,0xFF,0xF8,0x3E,0x0F,0x83,0xE0,0xF8,0x3E,0x0F,0x83,0xE0,0xF8,0x3E,0x0F,0x83,0xE0,0xF8,0x3E,0x0F,0x83,0xE0,0xF8,0x3E,0x0F,0x83,0xE0,0xF8,0x3E,0x0F,0x83,0xE0,0xF8,0x3F,0xFF,0xFF,0xFF,0x7F,0xC0, // '['
|
||||
0x70,0x3C,0x07,0x01,0xE0,0x78,0x1E,0x03,0x80,0xF0,0x3C,0x0F,0x01,0xC0,0x78,0x1E,0x07,0x80,0xE0,0x3C,0x0F,0x03,0xC0,0x70,0x1E,0x07,0x81,0xE0,0x38,0x0F,0x03,0xC0,0x60, // '\'
|
||||
0xFF,0xBF,0xFF,0xFF,0xFF,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0x80, // ']'
|
||||
0x03,0xE0,0x01,0xF0,0x01,0xFC,0x00,0xFE,0x00,0x7F,0x80,0x7B,0xC0,0x3D,0xF0,0x3E,0xF8,0x1E,0x3C,0x1F,0x1F,0x0F,0x07,0x8F,0x83,0xE7,0xC1,0xF7,0xC0,0x7C, // '^'
|
||||
0xFF,0xFF,0xFF,0xFF,0xF0, // '_'
|
||||
0x0E,0x1B,0x11,0x1B,0x0E, // '`' Changed into a degree symbol
|
||||
0x03,0xFC,0x03,0xFF,0xE0,0xFF,0xFE,0x3F,0x07,0xC7,0xC0,0x7C,0xF0,0x0F,0x9C,0x01,0xF0,0x00,0xFE,0x01,0xFF,0xC3,0xFF,0xF8,0xFF,0x9F,0x3F,0x03,0xEF,0x80,0x7D,0xF0,0x0F,0xBE,0x03,0xF7,0xE1,0xFE,0x7F,0xFF,0xE7,0xFE,0x7C,0x3E,0x07,0x00, // 'a'
|
||||
0x70,0x00,0x1F,0x00,0x03,0xE0,0x00,0x7C,0x00,0x0F,0x80,0x01,0xF0,0x00,0x3E,0x00,0x07,0xC7,0xE0,0xF9,0xFF,0x1F,0x7F,0xF3,0xFF,0xFF,0x7F,0x87,0xEF,0xE0,0x7D,0xF8,0x0F,0xFF,0x00,0xFF,0xC0,0x1F,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x0F,0xFE,0x03,0xFF,0xC0,0x7D,0xFE,0x1F,0xBF,0xFF,0xE7,0xDF,0xFC,0xF9,0xFF,0x0E,0x1F,0x80, // 'b'
|
||||
0x03,0xF8,0x03,0xFF,0x81,0xFF,0xF0,0xFF,0xFE,0x7F,0x0F,0xDF,0x01,0xFF,0xC0,0x3F,0xE0,0x04,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x07,0xFC,0x03,0xDF,0x01,0xF7,0xF0,0xFC,0xFF,0xFE,0x1F,0xFF,0x83,0xFF,0x80,0x3F,0x80, // 'c'
|
||||
0x00,0x01,0xC0,0x00,0x7C,0x00,0x0F,0x80,0x01,0xF0,0x00,0x3E,0x00,0x07,0xC0,0x00,0xF8,0x3F,0x1F,0x1F,0xF3,0xE7,0xFF,0x7D,0xFF,0xFF,0xBF,0x0F,0xF7,0xC0,0xFF,0xF8,0x0F,0xFE,0x01,0xFF,0xC0,0x1F,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x1F,0xFE,0x03,0xF7,0xC0,0x7E,0xFC,0x3F,0xCF,0xFF,0xF9,0xFF,0xDF,0x1F,0xF3,0xE0,0xF8,0x38, // 'd'
|
||||
0x03,0xF8,0x03,0xFF,0x81,0xFF,0xF0,0xF8,0x7E,0x7C,0x07,0x9F,0x01,0xFF,0x80,0x7F,0xE0,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xE0,0x00,0xF8,0x00,0x1F,0x00,0x77,0xC0,0x3C,0xFC,0x3F,0x1F,0xFF,0x83,0xFF,0xC0,0x3F,0x80, // 'e'
|
||||
0x01,0xF8,0x0F,0xF8,0x1F,0xF8,0x7F,0xE0,0xF8,0x01,0xF0,0x03,0xE0,0x3F,0xF8,0x7F,0xF9,0xFF,0xF1,0xFF,0xC0,0x7C,0x00,0xF8,0x01,0xF0,0x03,0xE0,0x07,0xC0,0x0F,0x80,0x1F,0x00,0x3E,0x00,0x7C,0x00,0xF8,0x01,0xF0,0x03,0xE0,0x07,0xC0,0x0F,0x80,0x0E,0x00, // 'f'
|
||||
0x07,0xE1,0xC3,0xFE,0x7C,0xFF,0xEF,0xBF,0xFF,0xF7,0xE1,0xFE,0xF8,0x0F,0xFF,0x01,0xFF,0xC0,0x1F,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x0F,0xFC,0x01,0xFF,0xC0,0x7E,0xF8,0x0F,0xDF,0x87,0xF9,0xFF,0xFF,0x3F,0xFB,0xE3,0xFE,0x7C,0x1F,0x8F,0x80,0x01,0xF7,0x00,0x7E,0xF0,0x0F,0x9F,0x83,0xF3,0xFF,0xFC,0x1F,0xFF,0x00,0xFF,0x80, // 'g'
|
||||
0x70,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE0,0x00,0xF8,0x00,0x3E,0x00,0x0F,0x80,0x03,0xE3,0xF0,0xF9,0xFF,0x3E,0xFF,0xEF,0xFF,0xFB,0xF8,0x3F,0xFC,0x0F,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xDC,0x00,0xE0, // 'h'
|
||||
0x77,0xFF,0xF7,0x00,0x0E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0x80, // 'i'
|
||||
0x03,0x81,0xF0,0x7C,0x1F,0x03,0x80,0x00,0x00,0x0E,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xC1,0xF0,0x7C,0x1F,0x07,0xFF,0xFF,0xFB,0xFE,0x7E,0x00, // 'j'
|
||||
0x70,0x00,0x7C,0x00,0x3E,0x00,0x1F,0x00,0x0F,0x80,0x07,0xC0,0x03,0xE0,0x01,0xF0,0x1C,0xF8,0x1E,0x7C,0x1F,0x3E,0x1F,0x9F,0x1F,0x8F,0x9F,0x07,0xDF,0x03,0xFF,0x81,0xFF,0xE0,0xFF,0xF0,0x7F,0x7C,0x3F,0x1F,0x1F,0x0F,0x8F,0x83,0xE7,0xC1,0xFB,0xE0,0x7D,0xF0,0x1F,0xF8,0x0F,0xB8,0x03,0x80, // 'k'
|
||||
0x77,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0x80, // 'l'
|
||||
0x70,0xFC,0x0F,0x8F,0x3F,0xE3,0xFC,0xFF,0xFF,0x7F,0xEF,0xFF,0xFF,0xFE,0xFE,0x1F,0xE3,0xFF,0xC0,0xFC,0x1F,0xF8,0x0F,0x81,0xFF,0x80,0xF8,0x1F,0xF8,0x0F,0x81,0xFF,0x80,0xF8,0x1F,0xF8,0x0F,0x81,0xFF,0x80,0xF8,0x1F,0xF8,0x0F,0x81,0xFF,0x80,0xF8,0x1F,0xF8,0x0F,0x81,0xFF,0x80,0xF8,0x1F,0xF8,0x0F,0x81,0xFF,0x80,0xF8,0x1F,0x70,0x07,0x00,0xE0, // 'm'
|
||||
0x70,0xFC,0x3C,0x7F,0xCF,0xBF,0xFB,0xFF,0xFE,0xFE,0x0F,0xFF,0x03,0xFF,0xC0,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xF7,0x00,0x38, // 'n'
|
||||
0x01,0xF8,0x00,0xFF,0xF0,0x1F,0xFF,0x83,0xFF,0xFC,0x7F,0x0F,0xE7,0xC0,0x3E,0xFC,0x03,0xFF,0x80,0x1F,0xF8,0x01,0xFF,0x80,0x1F,0xF8,0x01,0xFF,0x80,0x1F,0xFC,0x03,0xF7,0xC0,0x3E,0x7F,0x0F,0xE3,0xFF,0xFC,0x1F,0xFF,0x80,0xFF,0xF0,0x01,0xF8,0x00, // 'o'
|
||||
0x70,0xFC,0x1F,0x3F,0xE3,0xEF,0xFE,0x7F,0xFF,0xCF,0xF0,0xFD,0xF8,0x0F,0xBF,0x01,0xFF,0xC0,0x1F,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x0F,0xFC,0x01,0xFF,0xC0,0x7F,0xF8,0x0F,0xBF,0xC3,0xF7,0xFF,0xFC,0xFB,0xFF,0x9F,0x3F,0xE3,0xE3,0xF0,0x7C,0x00,0x0F,0x80,0x01,0xF0,0x00,0x3E,0x00,0x07,0xC0,0x00,0xF8,0x00,0x0E,0x00,0x00, // 'p'
|
||||
0x07,0xE1,0xC3,0xFE,0x7C,0xFF,0xEF,0x9F,0xFF,0xF7,0xE1,0xFE,0xF8,0x0F,0xFF,0x01,0xFF,0xC0,0x1F,0xF8,0x03,0xFF,0x00,0x7F,0xE0,0x0F,0xFC,0x01,0xFF,0xC0,0x7E,0xF8,0x0F,0xDF,0x87,0xF9,0xFF,0xFF,0x3F,0xFB,0xE3,0xFE,0x7C,0x1F,0x0F,0x80,0x01,0xF0,0x00,0x3E,0x00,0x07,0xC0,0x00,0xF8,0x00,0x1F,0x00,0x03,0xE0,0x00,0x38, // 'q'
|
||||
0x71,0xE7,0xDF,0xFF,0xFF,0xFF,0xFF,0xE1,0x7E,0x03,0xF0,0x1F,0x00,0xF8,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x00,0xF8,0x07,0xC0,0x1C,0x00, // 'r'
|
||||
0x0F,0xF0,0x1F,0xFE,0x1F,0xFF,0x8F,0x87,0xEF,0x81,0xF7,0xC0,0x7B,0xF0,0x00,0xFF,0x80,0x3F,0xF8,0x0F,0xFF,0x00,0xFF,0xC0,0x0F,0xF6,0x01,0xFF,0x80,0x7F,0xE0,0x3F,0xF8,0x3E,0x7F,0xFF,0x1F,0xFF,0x03,0xFC,0x00, // 's'
|
||||
0x0E,0x00,0xF8,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x0F,0xFC,0xFF,0xF7,0xFF,0x9F,0xF8,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x00,0xF8,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7F,0xE3,0xFF,0x0F,0xF8,0x3F,0x80, // 't'
|
||||
0x70,0x03,0xBE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFE,0x01,0xFF,0x80,0x7F,0xE0,0x1F,0xF8,0x07,0xFF,0x03,0xFF,0xE3,0xFD,0xFF,0xFF,0x7F,0xF7,0xCF,0xF8,0xF0,0xF8,0x38, // 'u'
|
||||
0x70,0x03,0xBC,0x00,0xFF,0x80,0x7F,0xE0,0x1F,0x7C,0x07,0x9F,0x03,0xE3,0xC0,0xF0,0xF8,0x7C,0x3E,0x1E,0x07,0x87,0x81,0xF3,0xE0,0x3C,0xF0,0x0F,0x3C,0x01,0xFE,0x00,0x7F,0x80,0x1F,0xE0,0x03,0xF0,0x00,0xFC,0x00,0x1E,0x00, // 'v'
|
||||
0x70,0x0F,0x00,0xEF,0x00,0xF0,0x0F,0xF8,0x1F,0x81,0xFF,0x81,0xF8,0x1F,0x78,0x1F,0x81,0xE7,0x83,0xFC,0x1E,0x7C,0x3F,0xC3,0xE3,0xC3,0xFC,0x3C,0x3C,0x79,0xE3,0xC3,0xE7,0x9E,0x7C,0x1E,0x79,0xE7,0x81,0xE7,0x0E,0x78,0x0E,0xF0,0xF7,0x00,0xFF,0x0F,0xF0,0x0F,0xE0,0x7F,0x00,0x7E,0x07,0xE0,0x07,0xE0,0x7E,0x00,0x7C,0x03,0xE0,0x03,0xC0,0x3C,0x00, // 'w'
|
||||
0x70,0x07,0x3C,0x07,0xBF,0x07,0xEF,0xC7,0xE3,0xE3,0xE0,0xFB,0xE0,0x7F,0xE0,0x1F,0xF0,0x07,0xF0,0x03,0xF8,0x03,0xFE,0x01,0xFF,0x01,0xF7,0xC1,0xF1,0xF1,0xF8,0xFC,0xF8,0x3E,0xF8,0x0F,0xFC,0x07,0xDC,0x01,0xC0, // 'x'
|
||||
0x38,0x01,0xCF,0x80,0x3D,0xF0,0x0F,0xBE,0x01,0xF3,0xE0,0x3C,0x7C,0x0F,0x87,0x81,0xE0,0xF8,0x7C,0x1F,0x0F,0x81,0xE1,0xE0,0x3E,0x7C,0x03,0xCF,0x00,0x7D,0xE0,0x07,0xFC,0x00,0xFF,0x00,0x1F,0xE0,0x01,0xF8,0x00,0x3F,0x00,0x07,0xE0,0x00,0xF8,0x00,0x1F,0x00,0x07,0xC0,0x1F,0xF8,0x07,0xFE,0x00,0x7F,0xC0,0x07,0xE0,0x00, // 'y'
|
||||
0x7F,0xFF,0x1F,0xFF,0xE7,0xFF,0xF9,0xFF,0xFE,0x00,0x3F,0x00,0x1F,0x80,0x07,0xC0,0x03,0xE0,0x01,0xF0,0x00,0xF8,0x00,0x7E,0x00,0x3F,0x00,0x1F,0x80,0x0F,0xC0,0x07,0xE0,0x03,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xF7,0xFF,0xF8, // 'z'
|
||||
0x01,0xF0,0x1F,0xC1,0xFE,0x1F,0xE0,0xFC,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x01,0xF8,0x0F,0x81,0xFC,0x1F,0xC0,0xF8,0x07,0xF0,0x1F,0xC0,0x3E,0x01,0xF8,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x00,0xFC,0x07,0xF8,0x1F,0xE0,0x7F,0x01,0xF0, // '{'
|
||||
0x6F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x60, // '|'
|
||||
0x7C,0x07,0xF0,0x3F,0xC0,0xFF,0x01,0xF8,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x00,0xFC,0x03,0xE0,0x1F,0xC0,0x7F,0x00,0xF8,0x1F,0xC1,0xFC,0x0F,0x80,0xFC,0x07,0xC0,0x3E,0x01,0xF0,0x0F,0x80,0x7C,0x03,0xE0,0x1F,0x01,0xF8,0x3F,0xC3,0xFC,0x1F,0xC0,0x7C,0x00 // '}'
|
||||
};
|
||||
const GFXglyph ArialRoundedMTBold_36Glyphs[] PROGMEM = {
|
||||
// bitmapOffset, width, height, xAdvance, xOffset, yOffset
|
||||
{ 0, 1, 1, 10, 0, 0 }, // ' '
|
||||
{ 1, 5, 26, 13, 4, -26 }, // '!'
|
||||
{ 18, 14, 9, 18, 2, -26 }, // '"'
|
||||
{ 34, 19, 26, 21, 0, -26 }, // '#'
|
||||
{ 96, 19, 37, 22, 1, -30 }, // '$'
|
||||
{ 184, 29, 27, 32, 1, -26 }, // '%'
|
||||
{ 282, 25, 26, 28, 2, -26 }, // '&'
|
||||
{ 364, 6, 9, 10, 1, -26 }, // '''
|
||||
{ 371, 9, 33, 14, 2, -26 }, // '('
|
||||
{ 409, 9, 33, 14, 2, -26 }, // ')'
|
||||
{ 447, 15, 14, 17, 0, -28 }, // '*'
|
||||
{ 474, 19, 18, 22, 1, -22 }, // '+'
|
||||
{ 517, 6, 11, 12, 3, -5 }, // ','
|
||||
{ 526, 11, 4, 13, 1, -11 }, // '-'
|
||||
{ 532, 5, 5, 12, 3, -5 }, // '.'
|
||||
{ 536, 9, 26, 11, 1, -26 }, // '/'
|
||||
{ 566, 18, 26, 22, 2, -26 }, // '0'
|
||||
{ 625, 13, 26, 22, 2, -26 }, // '1'
|
||||
{ 668, 18, 26, 22, 2, -26 }, // '2'
|
||||
{ 727, 18, 26, 22, 2, -26 }, // '3'
|
||||
{ 786, 21, 26, 22, 0, -26 }, // '4'
|
||||
{ 855, 18, 26, 22, 2, -26 }, // '5'
|
||||
{ 914, 18, 26, 22, 2, -26 }, // '6'
|
||||
{ 973, 18, 26, 22, 3, -26 }, // '7'
|
||||
{ 1032, 19, 26, 22, 1, -26 }, // '8'
|
||||
{ 1094, 18, 26, 22, 1, -26 }, // '9'
|
||||
{ 1153, 5, 19, 12, 3, -19 }, // ':'
|
||||
{ 1165, 5, 25, 12, 3, -19 }, // ';'
|
||||
{ 1181, 18, 20, 22, 1, -23 }, // '<'
|
||||
{ 1226, 18, 13, 22, 2, -19 }, // '='
|
||||
{ 1256, 18, 20, 22, 1, -23 }, // '>'
|
||||
{ 1301, 18, 26, 22, 1, -26 }, // '?'
|
||||
{ 1360, 34, 33, 36, 1, -26 }, // '@'
|
||||
{ 1501, 24, 26, 27, 1, -26 }, // 'A'
|
||||
{ 1579, 21, 26, 27, 3, -26 }, // 'B'
|
||||
{ 1648, 23, 26, 28, 2, -26 }, // 'C'
|
||||
{ 1723, 22, 26, 28, 3, -26 }, // 'D'
|
||||
{ 1795, 20, 26, 25, 3, -26 }, // 'E'
|
||||
{ 1860, 18, 26, 23, 3, -26 }, // 'F'
|
||||
{ 1919, 24, 26, 30, 2, -26 }, // 'G'
|
||||
{ 1997, 21, 26, 28, 3, -26 }, // 'H'
|
||||
{ 2066, 5, 26, 12, 3, -26 }, // 'I'
|
||||
{ 2083, 17, 26, 22, 1, -26 }, // 'J'
|
||||
{ 2139, 22, 26, 28, 3, -26 }, // 'K'
|
||||
{ 2211, 18, 26, 23, 3, -26 }, // 'L'
|
||||
{ 2270, 25, 26, 31, 3, -26 }, // 'M'
|
||||
{ 2352, 22, 26, 28, 3, -26 }, // 'N'
|
||||
{ 2424, 25, 26, 30, 2, -26 }, // 'O'
|
||||
{ 2506, 19, 26, 25, 3, -26 }, // 'P'
|
||||
{ 2568, 26, 28, 30, 2, -26 }, // 'Q'
|
||||
{ 2659, 21, 26, 27, 3, -26 }, // 'R'
|
||||
{ 2728, 20, 26, 25, 2, -26 }, // 'S'
|
||||
{ 2793, 21, 26, 24, 1, -26 }, // 'T'
|
||||
{ 2862, 21, 26, 28, 3, -26 }, // 'U'
|
||||
{ 2931, 23, 26, 26, 1, -26 }, // 'V'
|
||||
{ 3006, 32, 26, 35, 1, -26 }, // 'W'
|
||||
{ 3110, 21, 26, 23, 0, -26 }, // 'X'
|
||||
{ 3179, 21, 26, 24, 1, -26 }, // 'Y'
|
||||
{ 3248, 23, 26, 24, 0, -26 }, // 'Z'
|
||||
{ 3323, 10, 33, 14, 2, -26 }, // '['
|
||||
{ 3365, 10, 26, 11, 0, -26 }, // '\'
|
||||
{ 3398, 10, 33, 14, 0, -26 }, // ']'
|
||||
{ 3440, 17, 14, 22, 2, -26 }, // '^'
|
||||
{ 3470, 18, 2, 19, 0, 3 }, // '_'
|
||||
{ 3475, 8, 5, 10, 0, -26 }, // '`' Changed to degree symbol
|
||||
{ 3480, 19, 19, 22, 1, -19 }, // 'a'
|
||||
{ 3526, 19, 26, 24, 2, -26 }, // 'b'
|
||||
{ 3588, 18, 19, 22, 1, -19 }, // 'c'
|
||||
{ 3631, 19, 26, 24, 1, -26 }, // 'd'
|
||||
{ 3693, 18, 19, 22, 2, -19 }, // 'e'
|
||||
{ 3736, 15, 26, 13, -1, -26 }, // 'f'
|
||||
{ 3785, 19, 26, 24, 1, -19 }, // 'g'
|
||||
{ 3847, 18, 26, 23, 2, -26 }, // 'h'
|
||||
{ 3906, 5, 26, 11, 2, -26 }, // 'i'
|
||||
{ 3923, 10, 33, 11, -3, -26 }, // 'j'
|
||||
{ 3965, 17, 26, 22, 3, -26 }, // 'k'
|
||||
{ 4021, 5, 26, 11, 2, -26 }, // 'l'
|
||||
{ 4038, 28, 19, 33, 2, -19 }, // 'm'
|
||||
{ 4105, 18, 19, 23, 2, -19 }, // 'n'
|
||||
{ 4148, 20, 19, 23, 1, -19 }, // 'o'
|
||||
{ 4196, 19, 26, 24, 2, -19 }, // 'p'
|
||||
{ 4258, 19, 26, 24, 1, -19 }, // 'q'
|
||||
{ 4320, 13, 19, 17, 2, -19 }, // 'r'
|
||||
{ 4351, 17, 19, 21, 1, -19 }, // 's'
|
||||
{ 4392, 13, 26, 14, 0, -26 }, // 't'
|
||||
{ 4435, 18, 19, 23, 2, -19 }, // 'u'
|
||||
{ 4478, 18, 19, 21, 1, -19 }, // 'v'
|
||||
{ 4521, 28, 19, 30, 1, -19 }, // 'w'
|
||||
{ 4588, 17, 19, 20, 1, -19 }, // 'x'
|
||||
{ 4629, 19, 26, 21, 0, -19 }, // 'y'
|
||||
{ 4691, 18, 19, 20, 1, -19 }, // 'z'
|
||||
{ 4734, 13, 33, 15, 1, -26 }, // '{'
|
||||
{ 4788, 4, 33, 11, 3, -26 }, // '|'
|
||||
{ 4805, 13, 33, 15, 0, -26 } // '}' character 0x7D
|
||||
};
|
||||
const GFXfont ArialRoundedMTBold_36 PROGMEM = { // Last character bug fixed 0x7E to 0x7D
|
||||
(uint8_t *)ArialRoundedMTBold_36Bitmaps,(GFXglyph *)ArialRoundedMTBold_36Glyphs,0x20, 0x7D, 43};
|
||||
|
||||
|
|
@ -1,342 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
|
||||
Adapted by Bodmer to use the faster TFT_eSPI library:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
Bodmer: Functions no longer needed weeded out, Jpeg decoder functions added
|
||||
Bodmer: drawBMP() updated to buffer in and out pixels and use screen CGRAM rotation for faster bottom up drawing (now ~2x faster)
|
||||
*/
|
||||
|
||||
#include "GfxUi.h"
|
||||
|
||||
GfxUi::GfxUi(TFT_eSPI *tft) {
|
||||
_tft = tft;
|
||||
}
|
||||
|
||||
void GfxUi::drawProgressBar(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint8_t percentage, uint16_t frameColor, uint16_t barColor) {
|
||||
if (percentage == 0) {
|
||||
_tft->fillRoundRect(x0, y0, w, h, 3, TFT_BLACK);
|
||||
}
|
||||
uint8_t margin = 2;
|
||||
uint16_t barHeight = h - 2 * margin;
|
||||
uint16_t barWidth = w - 2 * margin;
|
||||
_tft->drawRoundRect(x0, y0, w, h, 3, frameColor);
|
||||
_tft->fillRect(x0 + margin, y0 + margin, barWidth * percentage / 100.0, barHeight, barColor);
|
||||
}
|
||||
|
||||
// This drawBMP function contains code from:
|
||||
// https://github.com/adafruit/Adafruit_ILI9341/blob/master/examples/spitftbitmap/spitftbitmap.ino
|
||||
// Here is Bodmer's version: this uses the ILI9341 CGRAM coordinate rotation features inside the display and
|
||||
// buffers both file and TFT pixel blocks, it typically runs about 2x faster for bottom up encoded BMP images
|
||||
|
||||
//void GfxUi::drawBMP(String filename, uint8_t x, uint16_t y, boolean flip) { // Alernative for caller control of flip
|
||||
void GfxUi::drawBmp(String filename, uint8_t x, uint16_t y) {
|
||||
// Flips the TFT internal SGRAM coords to draw bottom up BMP images faster, in this application it can be fixed
|
||||
boolean flip = 1;
|
||||
|
||||
if ((x >= _tft->width()) || (y >= _tft->height())) return;
|
||||
|
||||
fs::File bmpFile;
|
||||
int16_t bmpWidth, bmpHeight; // Image W+H in pixels
|
||||
uint32_t bmpImageoffset; // Start address of image data in file
|
||||
uint32_t rowSize; // Not always = bmpWidth; may have padding
|
||||
uint8_t sdbuffer[3 * BUFFPIXEL]; // file read pixel buffer (8 bits each R+G+B per pixel)
|
||||
uint16_t tftbuffer[BUFFPIXEL]; // TFT pixel out buffer (16-bit per pixel)
|
||||
uint8_t rgb_ptr = sizeof(sdbuffer); // read 24 bit RGB pixel data buffer pointer (8 bit so BUFF_SIZE must be less than 86)
|
||||
boolean goodBmp = false; // Flag set to true on valid header parse
|
||||
int16_t w, h, row, col; // to store width, height, row and column
|
||||
uint8_t rotation; // to restore rotation
|
||||
uint8_t tft_ptr = 0; // TFT 16 bit 565 format pixel data buffer pointer
|
||||
|
||||
// Check file exists and open it
|
||||
Serial.println(filename);
|
||||
if ( !(bmpFile = SPIFFS.open(filename, "r")) ) {
|
||||
Serial.println(F(" File not found")); // Can comment out if not needed
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse BMP header to get the information we need
|
||||
if (read16(bmpFile) == 0x4D42) { // BMP file start signature check
|
||||
read32(bmpFile); // Dummy read to throw away and move on
|
||||
read32(bmpFile); // Read & ignore creator bytes
|
||||
bmpImageoffset = read32(bmpFile); // Start of image data
|
||||
read32(bmpFile); // Dummy read to throw away and move on
|
||||
bmpWidth = read32(bmpFile); // Image width
|
||||
bmpHeight = read32(bmpFile); // Image height
|
||||
|
||||
// Only proceed if we pass a bitmap file check
|
||||
// Number of image planes -- must be '1', depth 24 and 0 (uncompressed format)
|
||||
if ((read16(bmpFile) == 1) && (read16(bmpFile) == 24) && (read32(bmpFile) == 0)) {
|
||||
goodBmp = true; // Supported BMP format
|
||||
// BMP rows are padded (if needed) to 4-byte boundary
|
||||
rowSize = (bmpWidth * 3 + 3) & ~3;
|
||||
// Crop area to be loaded
|
||||
w = bmpWidth;
|
||||
h = bmpHeight;
|
||||
|
||||
// We might need to alter rotation to avoid tedious file pointer manipulation
|
||||
// Save the current value so we can restore it later
|
||||
rotation = _tft->getRotation();
|
||||
// Use TFT SGRAM coord rotation if flip is set for 25% faster rendering (new rotations 4-7 supported by library)
|
||||
if (flip) _tft->setRotation((rotation + (flip<<2)) % 8); // Value 0-3 mapped to 4-7
|
||||
|
||||
// Calculate new y plot coordinate if we are flipping
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
if (flip) y = _tft->height() - y - h; break;
|
||||
case 1:
|
||||
y = _tft->height() - y - h; break;
|
||||
break;
|
||||
case 2:
|
||||
if (flip) y = _tft->height() - y - h; break;
|
||||
break;
|
||||
case 3:
|
||||
y = _tft->height() - y - h; break;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set TFT address window to image bounds
|
||||
// Currently, image will not draw or will be corrputed if it does not fit
|
||||
// TODO -> efficient clipping, but I don't need it to be idiot proof ;-)
|
||||
_tft->setAddrWindow(x, y, x + w - 1, y + h - 1);
|
||||
|
||||
// Finally we are ready to send rows of pixels, writing like this avoids slow 32 bit multiply in 8 bit processors
|
||||
for (uint32_t pos = bmpImageoffset; pos < bmpImageoffset + h * rowSize ; pos += rowSize) {
|
||||
// Seek if we need to on boundaries and arrange to dump buffer and start again
|
||||
if (bmpFile.position() != pos) {
|
||||
bmpFile.seek(pos, fs::SeekSet);
|
||||
rgb_ptr = sizeof(sdbuffer);
|
||||
//Serial.println("Seeking in file >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
}
|
||||
|
||||
// Fill the pixel buffer and plot
|
||||
for (col = 0; col < w; col++) { // For each column...
|
||||
// Time to read more pixel data?
|
||||
if (rgb_ptr >= sizeof(sdbuffer)) {
|
||||
// Push tft buffer to the display
|
||||
if (tft_ptr) {
|
||||
// Here we are sending a uint16_t array to the function
|
||||
_tft->pushColors(tftbuffer, tft_ptr);
|
||||
tft_ptr = 0; // tft_ptr and rgb_ptr are not always in sync...
|
||||
}
|
||||
// Finally reading bytes from SD Card
|
||||
bmpFile.read(sdbuffer, sizeof(sdbuffer));
|
||||
rgb_ptr = 0; // Set buffer index to start
|
||||
}
|
||||
// Convert pixel from BMP 8+8+8 format to TFT compatible 16 bit word
|
||||
// Blue 5 bits, green 6 bits and red 5 bits (16 bits total)
|
||||
// Is is a long line but it is faster than calling a library fn for this
|
||||
tftbuffer[tft_ptr] = (sdbuffer[rgb_ptr++] >> 3) ;
|
||||
tftbuffer[tft_ptr] |= ((sdbuffer[rgb_ptr++] & 0xFC) << 3);
|
||||
tftbuffer[tft_ptr] |= ((sdbuffer[rgb_ptr++] & 0xF8) << 8);
|
||||
tft_ptr++;
|
||||
} // Next row
|
||||
} // All rows done
|
||||
|
||||
// Write any partially full buffer to TFT
|
||||
if (tft_ptr) _tft->pushColors(tftbuffer, tft_ptr);
|
||||
|
||||
} // End of bitmap access
|
||||
} // End of bitmap file check
|
||||
|
||||
bmpFile.close();
|
||||
|
||||
if(!goodBmp) {
|
||||
Serial.print(F("BMP format not recognised. File:"));
|
||||
Serial.println(filename);
|
||||
}
|
||||
else
|
||||
_tft->setRotation(rotation); // Put back original rotation
|
||||
}
|
||||
|
||||
// These read 16- and 32-bit types from the SD card file.
|
||||
// BMP data is stored little-endian, Arduino is little-endian too.
|
||||
// May need to reverse subscript order if porting elsewhere.
|
||||
|
||||
uint16_t GfxUi::read16(fs::File &f) {
|
||||
uint16_t result;
|
||||
((uint8_t *)&result)[0] = f.read(); // LSB
|
||||
((uint8_t *)&result)[1] = f.read(); // MSB
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t GfxUi::read32(fs::File &f) {
|
||||
uint32_t result;
|
||||
((uint8_t *)&result)[0] = f.read(); // LSB
|
||||
((uint8_t *)&result)[1] = f.read();
|
||||
((uint8_t *)&result)[2] = f.read();
|
||||
((uint8_t *)&result)[3] = f.read(); // MSB
|
||||
return result;
|
||||
}
|
||||
|
||||
/*====================================================================================
|
||||
This sketch support functions to render the Jpeg images.
|
||||
|
||||
Created by Bodmer 15th Jan 2017
|
||||
==================================================================================*/
|
||||
|
||||
// Return the minimum of two values a and b
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#define USE_SPI_BUFFER // Comment out to use slower 16 bit pushColor()
|
||||
|
||||
//====================================================================================
|
||||
// Opens the image file and prime the Jpeg decoder
|
||||
//====================================================================================
|
||||
void GfxUi::drawJpeg(const char *filename, int xpos, int ypos) {
|
||||
|
||||
Serial.println("===========================");
|
||||
Serial.print("Drawing file: "); Serial.println(filename);
|
||||
Serial.println("===========================");
|
||||
|
||||
// Open the named file (the Jpeg decoder library will close it after rendering image)
|
||||
fs::File jpegFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
|
||||
// File jpegFile = SD.open( filename, FILE_READ); // or, file handle reference for SD library
|
||||
|
||||
if ( !jpegFile ) {
|
||||
Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Use one of the three following methods to initialise the decoder:
|
||||
//boolean decoded = JpegDec.decodeFsFile(jpegFile); // Pass a SPIFFS file handle to the decoder,
|
||||
//boolean decoded = JpegDec.decodeSdFile(jpegFile); // or pass the SD file handle to the decoder,
|
||||
boolean decoded = JpegDec.decodeFsFile(filename); // or pass the filename (leading / distinguishes SPIFFS files)
|
||||
// Note: the filename can be a String or character array type
|
||||
if (decoded) {
|
||||
// print information about the image to the serial port
|
||||
jpegInfo();
|
||||
|
||||
// render the image onto the screen at given coordinates
|
||||
jpegRender(xpos, ypos);
|
||||
}
|
||||
else {
|
||||
Serial.println("Jpeg file format not supported!");
|
||||
}
|
||||
}
|
||||
|
||||
//====================================================================================
|
||||
// Decode and render the Jpeg image onto the TFT screen
|
||||
//====================================================================================
|
||||
void GfxUi::jpegRender(int xpos, int ypos) {
|
||||
|
||||
// retrieve infomration about the image
|
||||
uint16_t *pImg;
|
||||
uint16_t mcu_w = JpegDec.MCUWidth;
|
||||
uint16_t mcu_h = JpegDec.MCUHeight;
|
||||
uint32_t max_x = JpegDec.width;
|
||||
uint32_t max_y = JpegDec.height;
|
||||
|
||||
// Jpeg images are draw as a set of image block (tiles) called Minimum Coding Units (MCUs)
|
||||
// Typically these MCUs are 16x16 pixel blocks
|
||||
// Determine the width and height of the right and bottom edge image blocks
|
||||
uint32_t min_w = minimum(mcu_w, max_x % mcu_w);
|
||||
uint32_t min_h = minimum(mcu_h, max_y % mcu_h);
|
||||
|
||||
// save the current image block size
|
||||
uint32_t win_w = mcu_w;
|
||||
uint32_t win_h = mcu_h;
|
||||
|
||||
// record the current time so we can measure how long it takes to draw an image
|
||||
uint32_t drawTime = millis();
|
||||
|
||||
// save the coordinate of the right and bottom edges to assist image cropping
|
||||
// to the screen size
|
||||
max_x += xpos;
|
||||
max_y += ypos;
|
||||
|
||||
// read each MCU block until there are no more
|
||||
#ifdef USE_SPI_BUFFER
|
||||
while( JpegDec.readSwappedBytes()){ // Swap byte order so the SPI buffer can be used
|
||||
#else
|
||||
while ( JpegDec.read()) { // Normal byte order read
|
||||
#endif
|
||||
// save a pointer to the image block
|
||||
pImg = JpegDec.pImage;
|
||||
|
||||
// calculate where the image block should be drawn on the screen
|
||||
int mcu_x = JpegDec.MCUx * mcu_w + xpos;
|
||||
int mcu_y = JpegDec.MCUy * mcu_h + ypos;
|
||||
|
||||
// check if the image block size needs to be changed for the right edge
|
||||
if (mcu_x + mcu_w <= max_x) win_w = mcu_w;
|
||||
else win_w = min_w;
|
||||
|
||||
// check if the image block size needs to be changed for the bottom edge
|
||||
if (mcu_y + mcu_h <= max_y) win_h = mcu_h;
|
||||
else win_h = min_h;
|
||||
|
||||
// copy pixels into a contiguous block
|
||||
if (win_w != mcu_w)
|
||||
{
|
||||
uint16_t *cImg;
|
||||
int p = 0;
|
||||
cImg = pImg + win_w;
|
||||
for (int h = 1; h < win_h; h++)
|
||||
{
|
||||
p += mcu_w;
|
||||
for (int w = 0; w < win_w; w++)
|
||||
{
|
||||
*cImg = *(pImg + w + p);
|
||||
cImg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw image MCU block only if it will fit on the screen
|
||||
if ( ( mcu_x + win_w) <= _tft->width() && ( mcu_y + win_h) <= _tft->height())
|
||||
{
|
||||
_tft->pushImage(mcu_x, mcu_y, win_w, win_h, pImg);
|
||||
}
|
||||
|
||||
else if ( ( mcu_y + win_h) >= _tft->height()) JpegDec.abort();
|
||||
|
||||
}
|
||||
|
||||
// calculate how long it took to draw the image
|
||||
drawTime = millis() - drawTime; // Calculate the time it took
|
||||
|
||||
// print the results to the serial port
|
||||
Serial.print ("Total render time was : "); Serial.print(drawTime); Serial.println(" ms");
|
||||
Serial.println("=====================================");
|
||||
|
||||
}
|
||||
|
||||
//====================================================================================
|
||||
// Print information decoded from the Jpeg image
|
||||
//====================================================================================
|
||||
void GfxUi::jpegInfo() {
|
||||
|
||||
Serial.println("===============");
|
||||
Serial.println("JPEG image info");
|
||||
Serial.println("===============");
|
||||
Serial.print ("Width :"); Serial.println(JpegDec.width);
|
||||
Serial.print ("Height :"); Serial.println(JpegDec.height);
|
||||
Serial.print ("Components :"); Serial.println(JpegDec.comps);
|
||||
Serial.print ("MCU / row :"); Serial.println(JpegDec.MCUSPerRow);
|
||||
Serial.print ("MCU / col :"); Serial.println(JpegDec.MCUSPerCol);
|
||||
Serial.print ("Scan type :"); Serial.println(JpegDec.scanType);
|
||||
Serial.print ("MCU width :"); Serial.println(JpegDec.MCUWidth);
|
||||
Serial.print ("MCU height :"); Serial.println(JpegDec.MCUHeight);
|
||||
Serial.println("===============");
|
||||
Serial.println("");
|
||||
|
||||
}
|
||||
//====================================================================================
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
See more at http://blog.squix.ch
|
||||
|
||||
Adapted by Bodmer to use the faster TFT_eSPI library:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
#define FS_NO_GLOBALS // Avoid conflict with SD library File type definition
|
||||
#include <FS.h>
|
||||
|
||||
// JPEG decoder library
|
||||
#include <JPEGDecoder.h>
|
||||
|
||||
#ifndef _GFX_UI_H
|
||||
#define _GFX_UI_H
|
||||
|
||||
// Maximum of 85 for BUFFPIXEL as 3 x this value is stored in an 8 bit variable!
|
||||
// 32 is an efficient size for SPIFFS due to SPI hardware pipeline buffer size
|
||||
// A larger value of 80 is better for SD cards
|
||||
#define BUFFPIXEL 32
|
||||
|
||||
class GfxUi {
|
||||
public:
|
||||
GfxUi(TFT_eSPI * tft);
|
||||
void drawBmp(String filename, uint8_t x, uint16_t y);
|
||||
void drawProgressBar(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t percentage, uint16_t frameColor, uint16_t barColor);
|
||||
void jpegInfo();
|
||||
void drawJpeg(const char *filename, int xpos, int ypos);
|
||||
void jpegRender(int xpos, int ypos);
|
||||
|
||||
private:
|
||||
TFT_eSPI * _tft;
|
||||
uint16_t read16(fs::File &f);
|
||||
uint32_t read32(fs::File &f);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*====================================================================================
|
||||
This sketch contains support functions for the ESP6266 SPIFFS filing system
|
||||
|
||||
Created by Bodmer 15th Jan 2017
|
||||
==================================================================================*/
|
||||
|
||||
//====================================================================================
|
||||
// Print a SPIFFS directory list (root directory)
|
||||
//====================================================================================
|
||||
|
||||
void listFiles(void) {
|
||||
Serial.println();
|
||||
Serial.println("SPIFFS files found:");
|
||||
|
||||
fs::Dir dir = SPIFFS.openDir("/"); // Root directory
|
||||
String line = "=====================================";
|
||||
uint32_t totalBytes = 0;
|
||||
|
||||
Serial.println(line);
|
||||
Serial.println(" File name Size");
|
||||
Serial.println(line);
|
||||
|
||||
while (dir.next()) {
|
||||
String fileName = dir.fileName();
|
||||
Serial.print(fileName);
|
||||
int spaces = 25 - fileName.length(); // Tabulate nicely
|
||||
while (spaces--) Serial.print(" ");
|
||||
fs::File f = dir.openFile("r");
|
||||
Serial.print(f.size()); Serial.println(" bytes");
|
||||
totalBytes += f.size();
|
||||
}
|
||||
Serial.println(); Serial.print("Total = ");
|
||||
int spaces = 25 - 8; // Tabulate nicely
|
||||
while (spaces--) Serial.print(" ");
|
||||
Serial.print(totalBytes); Serial.println(" bytes");
|
||||
|
||||
Serial.println(line);
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
||||
//====================================================================================
|
||||
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
*/
|
||||
|
||||
#include "WebResource.h"
|
||||
|
||||
WebResource::WebResource(){
|
||||
|
||||
}
|
||||
|
||||
void WebResource::downloadFile(String url, String filename) {
|
||||
downloadFile(url, filename, nullptr);
|
||||
}
|
||||
|
||||
void WebResource::downloadFile(String url, String filename, ProgressCallback progressCallback) {
|
||||
|
||||
if (SPIFFS.exists(filename) == true) {
|
||||
Serial.println("Found " + filename);
|
||||
return;
|
||||
}
|
||||
else Serial.println("Downloading " + filename + " from " + url);
|
||||
|
||||
// wait for WiFi connection
|
||||
if((_wifiMulti.run() == WL_CONNECTED)) {
|
||||
HTTPClient http;
|
||||
|
||||
Serial.print("[HTTP] begin...\n");
|
||||
|
||||
// configure server and url
|
||||
http.begin(url);
|
||||
|
||||
Serial.print("[HTTP] GET...\n");
|
||||
// start connection and send HTTP header
|
||||
int httpCode = http.GET();
|
||||
if(httpCode > 0) {
|
||||
//SPIFFS.remove(filename);
|
||||
fs::File f = SPIFFS.open(filename, "w+");
|
||||
if (!f) {
|
||||
Serial.println("file open failed");
|
||||
return;
|
||||
}
|
||||
// HTTP header has been send and Server response header has been handled
|
||||
Serial.printf("[HTTP] GET... code: %d\n", httpCode);
|
||||
|
||||
// file found at server
|
||||
if(httpCode == HTTP_CODE_OK) {
|
||||
|
||||
// get length of document (is -1 when Server sends no Content-Length header)
|
||||
int total = http.getSize();
|
||||
int len = total;
|
||||
progressCallback(filename, 0,total);
|
||||
// create buffer for read
|
||||
uint8_t buff[128] = { 0 };
|
||||
|
||||
// get tcp stream
|
||||
WiFiClient * stream = http.getStreamPtr();
|
||||
|
||||
// read all data from server
|
||||
while(http.connected() && (len > 0 || len == -1)) {
|
||||
// get available data size
|
||||
size_t size = stream->available();
|
||||
|
||||
if(size) {
|
||||
// read up to 128 byte
|
||||
int c = stream->readBytes(buff, ((size > sizeof(buff)) ? sizeof(buff) : size));
|
||||
|
||||
// write it to Serial
|
||||
f.write(buff, c);
|
||||
|
||||
if(len > 0) {
|
||||
len -= c;
|
||||
}
|
||||
progressCallback(filename, total - len,total);
|
||||
}
|
||||
delay(1);
|
||||
}
|
||||
|
||||
Serial.println();
|
||||
Serial.print("[HTTP] connection closed or file end.\n");
|
||||
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
|
||||
}
|
||||
|
||||
http.end();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
*/
|
||||
|
||||
#define FS_NO_GLOBALS // Avoid conflict with SD library File type definition
|
||||
#include <FS.h>
|
||||
#include <Arduino.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WiFiMulti.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
|
||||
#ifndef _WEBRESOURCE_H
|
||||
#define _WEBRESOURCE_H
|
||||
|
||||
typedef void (*ProgressCallback)(String fileName, int16_t bytesDownloaded, int16_t bytesTotal);
|
||||
|
||||
class WebResource {
|
||||
public:
|
||||
WebResource();
|
||||
void downloadFile(String url, String filename, ProgressCallback progressCallback);
|
||||
void downloadFile(String url, String filename);
|
||||
|
||||
|
||||
private:
|
||||
ESP8266WiFiMulti _wifiMulti;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
|
||||
Adapted by Bodmer to use the faster TFT_ILI9341_ESP library:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
Version 9
|
||||
*/
|
||||
|
||||
// ***************************************************************************************
|
||||
// WARNING - READ THIS
|
||||
//
|
||||
// 3M Flash Size MUST be allocated to SPIFFS using the IDE Tools menu option or else the
|
||||
// ESP8266 may crash or do strange things (due to lack of error checks in SPIFFS library?)
|
||||
// ***************************************************************************************
|
||||
//
|
||||
// Setup
|
||||
const int UPDATE_INTERVAL_SECS = 10 * 60; // Update every 10 minutes
|
||||
|
||||
// Pins for the TFT interface are defined in the User_Config.h file inside the TFT_eSPI library
|
||||
|
||||
// TimeClient settings
|
||||
const float UTC_OFFSET = 1;
|
||||
|
||||
// Wunderground Settings, EDIT to suit your Wunderground key and location
|
||||
const boolean IS_METRIC = true; // Temperature only? Wind speed units appear to stay in mph. To do: investigate <<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//const String WUNDERGRROUND_API_KEY = "WUNDERGROUND KEY HERE";
|
||||
const String WUNDERGRROUND_API_KEY = "1c265fajf48s0a82"; // Random key example showing how the above line should look
|
||||
|
||||
// For language codes see https://www.wunderground.com/weather/api/d/docs?d=language-support&_ga=1.55148395.1951311424.1484425551
|
||||
const String WUNDERGRROUND_LANGUAGE = "EN"; // Language EN = English
|
||||
|
||||
// For a list of countries, states and cities see https://www.wunderground.com/about/faq/international_cities.asp
|
||||
const String WUNDERGROUND_COUNTRY = "Peru"; // UK, US etc
|
||||
const String WUNDERGROUND_CITY = "Base_Naval"; // City, "London", "FL/Boca_Raton" for Boca Raton in Florida (State/City) etc. Use underscore_for spaces)
|
||||
|
||||
// Windspeed conversion, use 1 pair of #defines. To do: investigate a more convenient method <<<<<<<<<<<<<<<<<<<<<
|
||||
//#define WIND_SPEED_SCALING 1.0 // mph
|
||||
//#define WIND_SPEED_UNITS " mph"
|
||||
|
||||
//#define WIND_SPEED_SCALING 0.868976 // mph to knots
|
||||
//#define WIND_SPEED_UNITS " kn"
|
||||
|
||||
#define WIND_SPEED_SCALING 1.60934 // mph to kph
|
||||
#define WIND_SPEED_UNITS " kph"
|
||||
|
||||
//Thingspeak Settings - not used, no need to populate this at the moment
|
||||
const String THINGSPEAK_CHANNEL_ID = "CHANNEL_ID_HERE";
|
||||
const String THINGSPEAK_API_READ_KEY = "API_READ_KEY_HERE";
|
||||
|
||||
// List, so that the downloader knows what to fetch
|
||||
String wundergroundIcons [] = {"chanceflurries","chancerain","chancesleet","chancesnow","clear","cloudy","flurries","fog","hazy","mostlycloudy","mostlysunny","partlycloudy","partlysunny","rain","sleet","snow","sunny","tstorms","unknown"};
|
||||
|
||||
/***************************
|
||||
* End Settings
|
||||
**************************/
|
||||
|
|
@ -1,595 +0,0 @@
|
|||
/**The MIT License (MIT)
|
||||
Copyright (c) 2015 by Daniel Eichhorn
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYBR_DATUM HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
See more at http://blog.squix.ch
|
||||
|
||||
Adapted by Bodmer to use the faster TFT_eSPI library:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
Plus:
|
||||
Minor changes to text placement and auto-blanking out old text with background colour padding
|
||||
Moon phase text added
|
||||
Forecast text lines are automatically split onto two lines at a central space (some are long!)
|
||||
Time is printed with colons aligned to tidy display
|
||||
Min and max forecast temperatures spaced out
|
||||
The ` character has been changed to a degree symbol in the 36 point font
|
||||
New smart WU splash startup screen and updated progress messages
|
||||
Display does not need to be blanked between updates
|
||||
Icons nudged about slightly to add wind direction + speed
|
||||
Barometric pressure added
|
||||
*/
|
||||
|
||||
#define SERIAL_MESSAGES
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <SPI.h>
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
// Additional UI functions
|
||||
#include "GfxUi.h"
|
||||
|
||||
// Fonts created by http://oleddisplay.squix.ch/
|
||||
#include "ArialRoundedMTBold_14.h"
|
||||
#include "ArialRoundedMTBold_36.h"
|
||||
|
||||
// Download helper
|
||||
#include "WebResource.h"
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <DNSServer.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
|
||||
// Helps with connecting to internet
|
||||
#include <WiFiManager.h>
|
||||
|
||||
// check settings.h for adapting to your needs
|
||||
#include "settings.h"
|
||||
#include <JsonListener.h>
|
||||
#include <WundergroundClient.h>
|
||||
#include "TimeClient.h"
|
||||
|
||||
// HOSTNAME for OTA update
|
||||
#define HOSTNAME "ESP8266-OTA-"
|
||||
|
||||
/*****************************
|
||||
Important: see settings.h to configure your settings!!!
|
||||
* ***************************/
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
boolean booted = true;
|
||||
|
||||
GfxUi ui = GfxUi(&tft);
|
||||
|
||||
WebResource webResource;
|
||||
TimeClient timeClient(UTC_OFFSET);
|
||||
|
||||
// Set to false, if you prefere imperial/inches, Fahrenheit
|
||||
WundergroundClient wunderground(IS_METRIC);
|
||||
|
||||
//declaring prototypes
|
||||
void configModeCallback (WiFiManager *myWiFiManager);
|
||||
void downloadCallback(String filename, int16_t bytesDownloaded, int16_t bytesTotal);
|
||||
ProgressCallback _downloadCallback = downloadCallback;
|
||||
void downloadResources();
|
||||
void updateData();
|
||||
void drawProgress(uint8_t percentage, String text);
|
||||
void drawTime();
|
||||
void drawCurrentWeather();
|
||||
void drawForecast();
|
||||
void drawForecastDetail(uint16_t x, uint16_t y, uint8_t dayIndex);
|
||||
String getMeteoconIcon(String iconText);
|
||||
void drawAstronomy();
|
||||
void drawSeparator(uint16_t y);
|
||||
|
||||
long lastDownloadUpdate = millis();
|
||||
|
||||
void setup() {
|
||||
#ifdef SERIAL_MESSAGES
|
||||
Serial.begin(250000);
|
||||
#endif
|
||||
tft.begin();
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_DARKGREY, TFT_BLACK);
|
||||
tft.drawString("Original by: blog.squix.org", 120, 240);
|
||||
tft.drawString("Adapted by: Bodmer", 120, 260);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
|
||||
SPIFFS.begin();
|
||||
//listFiles();
|
||||
//Uncomment if you want to erase SPIFFS and update all internet resources, this takes some time!
|
||||
//tft.drawString("Formatting SPIFFS, so wait!", 120, 200); SPIFFS.format();
|
||||
|
||||
if (SPIFFS.exists("/WU.jpg") == true) ui.drawJpeg("/WU.jpg", 0, 10);
|
||||
if (SPIFFS.exists("/Earth.jpg") == true) ui.drawJpeg("/Earth.jpg", 0, 320-56); // Image is 56 pixels high
|
||||
delay(1000);
|
||||
tft.drawString("Connecting to WiFi", 120, 200);
|
||||
tft.setTextPadding(240); // Pad next drawString() text to full width to over-write old text
|
||||
|
||||
//WiFiManager
|
||||
//Local intialization. Once its business is done, there is no need to keep it around
|
||||
WiFiManager wifiManager;
|
||||
// Uncomment for testing wifi manager
|
||||
//wifiManager.resetSettings();
|
||||
wifiManager.setAPCallback(configModeCallback);
|
||||
|
||||
//or use this for auto generated name ESP + ChipID
|
||||
wifiManager.autoConnect();
|
||||
|
||||
//Manual Wifi
|
||||
//WiFi.begin(WIFI_SSID, WIFI_PWD);
|
||||
|
||||
// OTA Setup
|
||||
String hostname(HOSTNAME);
|
||||
hostname += String(ESP.getChipId(), HEX);
|
||||
WiFi.hostname(hostname);
|
||||
ArduinoOTA.setHostname((const char *)hostname.c_str());
|
||||
ArduinoOTA.begin();
|
||||
|
||||
// download images from the net. If images already exist don't download
|
||||
tft.drawString("Downloading to SPIFFS...", 120, 200);
|
||||
tft.drawString(" ", 120, 240); // Clear line
|
||||
tft.drawString(" ", 120, 260); // Clear line
|
||||
downloadResources();
|
||||
//listFiles();
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextPadding(240); // Pad next drawString() text to full width to over-write old text
|
||||
tft.drawString(" ", 120, 200); // Clear line above using set padding width
|
||||
tft.drawString("Fetching weather data...", 120, 200);
|
||||
//delay(500);
|
||||
|
||||
// load the weather information
|
||||
updateData();
|
||||
}
|
||||
|
||||
long lastDrew = 0;
|
||||
void loop() {
|
||||
// Handle OTA update requests
|
||||
ArduinoOTA.handle();
|
||||
|
||||
// Check if we should update the clock
|
||||
if (millis() - lastDrew > 30000 && wunderground.getSeconds() == "00") {
|
||||
drawTime();
|
||||
lastDrew = millis();
|
||||
}
|
||||
|
||||
// Check if we should update weather information
|
||||
if (millis() - lastDownloadUpdate > 1000 * UPDATE_INTERVAL_SECS) {
|
||||
updateData();
|
||||
lastDownloadUpdate = millis();
|
||||
}
|
||||
}
|
||||
|
||||
// Called if WiFi has not been configured yet
|
||||
void configModeCallback (WiFiManager *myWiFiManager) {
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
tft.setTextColor(TFT_ORANGE);
|
||||
tft.drawString("Wifi Manager", 120, 28);
|
||||
tft.drawString("Please connect to AP", 120, 42);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.drawString(myWiFiManager->getConfigPortalSSID(), 120, 56);
|
||||
tft.setTextColor(TFT_ORANGE);
|
||||
tft.drawString("To setup Wifi Configuration", 120, 70);
|
||||
}
|
||||
|
||||
// callback called during download of files. Updates progress bar
|
||||
void downloadCallback(String filename, int16_t bytesDownloaded, int16_t bytesTotal) {
|
||||
Serial.println(String(bytesDownloaded) + " / " + String(bytesTotal));
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.setTextPadding(240);
|
||||
|
||||
int percentage = 100 * bytesDownloaded / bytesTotal;
|
||||
if (percentage == 0) {
|
||||
tft.drawString(filename, 120, 220);
|
||||
}
|
||||
if (percentage % 5 == 0) {
|
||||
tft.setTextDatum(TC_DATUM);
|
||||
tft.setTextPadding(tft.textWidth(" 888% "));
|
||||
tft.drawString(String(percentage) + "%", 120, 245);
|
||||
ui.drawProgressBar(10, 225, 240 - 20, 15, percentage, TFT_WHITE, TFT_BLUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Download the bitmaps
|
||||
void downloadResources() {
|
||||
// tft.fillScreen(TFT_BLACK);
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
char id[5];
|
||||
|
||||
// Download WU graphic jpeg first and display it, then the Earth view
|
||||
webResource.downloadFile((String)"http://i.imgur.com/njl1pMj.jpg", (String)"/WU.jpg", _downloadCallback);
|
||||
if (SPIFFS.exists("/WU.jpg") == true) ui.drawJpeg("/WU.jpg", 0, 10);
|
||||
|
||||
webResource.downloadFile((String)"http://i.imgur.com/v4eTLCC.jpg", (String)"/Earth.jpg", _downloadCallback);
|
||||
if (SPIFFS.exists("/Earth.jpg") == true) ui.drawJpeg("/Earth.jpg", 0, 320-56);
|
||||
|
||||
//webResource.downloadFile((String)"http://i.imgur.com/IY57GSv.jpg", (String)"/Horizon.jpg", _downloadCallback);
|
||||
//if (SPIFFS.exists("/Horizon.jpg") == true) ui.drawJpeg("/Horizon.jpg", 0, 320-160);
|
||||
|
||||
//webResource.downloadFile((String)"http://i.imgur.com/jZptbtY.jpg", (String)"/Rainbow.jpg", _downloadCallback);
|
||||
//if (SPIFFS.exists("/Rainbow.jpg") == true) ui.drawJpeg("/Rainbow.jpg", 0, 0);
|
||||
|
||||
for (int i = 0; i < 19; i++) {
|
||||
sprintf(id, "%02d", i);
|
||||
webResource.downloadFile("http://www.squix.org/blog/wunderground/" + wundergroundIcons[i] + ".bmp", wundergroundIcons[i] + ".bmp", _downloadCallback);
|
||||
}
|
||||
for (int i = 0; i < 19; i++) {
|
||||
sprintf(id, "%02d", i);
|
||||
webResource.downloadFile("http://www.squix.org/blog/wunderground/mini/" + wundergroundIcons[i] + ".bmp", "/mini/" + wundergroundIcons[i] + ".bmp", _downloadCallback);
|
||||
}
|
||||
for (int i = 0; i < 24; i++) {
|
||||
webResource.downloadFile("http://www.squix.org/blog/moonphase_L" + String(i) + ".bmp", "/moon" + String(i) + ".bmp", _downloadCallback);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the internet based information and update screen
|
||||
void updateData() {
|
||||
// booted = true; // Test only
|
||||
// booted = false; // Test only
|
||||
|
||||
if (booted) ui.drawJpeg("/WU.jpg", 0, 10); // May have already drawn this but it does not take long
|
||||
else tft.drawCircle(22, 22, 18, TFT_DARKGREY); // Outer ring - optional
|
||||
|
||||
if (booted) drawProgress(20, "Updating time...");
|
||||
else fillSegment(22, 22, 0, (int) (20 * 3.6), 16, TFT_NAVY);
|
||||
|
||||
timeClient.updateTime();
|
||||
if (booted) drawProgress(50, "Updating conditions...");
|
||||
else fillSegment(22, 22, 0, (int) (50 * 3.6), 16, TFT_NAVY);
|
||||
|
||||
wunderground.updateConditions(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
|
||||
if (booted) drawProgress(70, "Updating forecasts...");
|
||||
else fillSegment(22, 22, 0, (int) (70 * 3.6), 16, TFT_NAVY);
|
||||
|
||||
wunderground.updateForecast(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
|
||||
if (booted) drawProgress(90, "Updating astronomy...");
|
||||
else fillSegment(22, 22, 0, (int) (90 * 3.6), 16, TFT_NAVY);
|
||||
|
||||
wunderground.updateAstronomy(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
|
||||
// lastUpdate = timeClient.getFormattedTime();
|
||||
// readyForWeatherUpdate = false;
|
||||
if (booted) drawProgress(100, "Done...");
|
||||
else fillSegment(22, 22, 0, 360, 16, TFT_NAVY);
|
||||
|
||||
if (booted) delay(2000);
|
||||
|
||||
if (booted) tft.fillScreen(TFT_BLACK);
|
||||
else fillSegment(22, 22, 0, 360, 22, TFT_BLACK);
|
||||
|
||||
//tft.fillScreen(TFT_CYAN); // For text padding and update graphics over-write checking only
|
||||
drawTime();
|
||||
drawCurrentWeather();
|
||||
drawForecast();
|
||||
drawAstronomy();
|
||||
booted = false;
|
||||
}
|
||||
|
||||
// Progress bar helper
|
||||
void drawProgress(uint8_t percentage, String text) {
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.setTextPadding(240);
|
||||
tft.drawString(text, 120, 220);
|
||||
|
||||
ui.drawProgressBar(10, 225, 240 - 20, 15, percentage, TFT_WHITE, TFT_BLUE);
|
||||
|
||||
tft.setTextPadding(0);
|
||||
}
|
||||
|
||||
// draws the clock
|
||||
void drawTime() {
|
||||
|
||||
tft.setFreeFont(&ArialRoundedMTBold_36);
|
||||
|
||||
String timeNow = timeClient.getHours() + ":" + timeClient.getMinutes();
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth(" 44:44 ")); // String width + margin
|
||||
tft.drawString(timeNow, 120, 53);
|
||||
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
|
||||
String date = wunderground.getDate();
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth(" Ddd, 44 Mmm 4444 ")); // String width + margin
|
||||
tft.drawString(date, 120, 16);
|
||||
|
||||
drawSeparator(54);
|
||||
|
||||
tft.setTextPadding(0);
|
||||
}
|
||||
|
||||
// draws current weather information
|
||||
void drawCurrentWeather() {
|
||||
// Weather Icon
|
||||
String weatherIcon = getMeteoconIcon(wunderground.getTodayIcon());
|
||||
//uint32_t dt = millis();
|
||||
ui.drawBmp(weatherIcon + ".bmp", 0, 59);
|
||||
//Serial.print("Icon draw time = "); Serial.println(millis()-dt);
|
||||
|
||||
// Weather Text
|
||||
|
||||
String weatherText = wunderground.getWeatherText();
|
||||
//weatherText = "Heavy Thunderstorms with Small Hail"; // Test line splitting with longest(?) string
|
||||
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
|
||||
tft.setTextDatum(BR_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
|
||||
int splitPoint = 0;
|
||||
int xpos = 230;
|
||||
splitPoint = splitIndex(weatherText);
|
||||
if (splitPoint > 16) xpos = 235;
|
||||
|
||||
tft.setTextPadding(tft.textWidth("Heavy Thunderstorms")); // Max anticipated string width
|
||||
if (splitPoint) tft.drawString(weatherText.substring(0, splitPoint), xpos, 72);
|
||||
tft.setTextPadding(tft.textWidth(" with Small Hail")); // Max anticipated string width + margin
|
||||
tft.drawString(weatherText.substring(splitPoint), xpos, 87);
|
||||
|
||||
tft.setFreeFont(&ArialRoundedMTBold_36);
|
||||
|
||||
tft.setTextDatum(TR_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
|
||||
// Font ASCII code 96 (0x60) modified to make "`" a degree symbol
|
||||
tft.setTextPadding(tft.textWidth("-88`")); // Max width of vales
|
||||
|
||||
weatherText = wunderground.getCurrentTemp();
|
||||
if (weatherText.indexOf(".")) weatherText = weatherText.substring(0, weatherText.indexOf(".")); // Make it integer temperature
|
||||
if (weatherText == "") weatherText = "?"; // Handle null return
|
||||
tft.drawString(weatherText + "`", 221, 100);
|
||||
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
|
||||
tft.setTextDatum(TL_DATUM);
|
||||
tft.setTextPadding(0);
|
||||
if (IS_METRIC) tft.drawString("C ", 221, 100);
|
||||
else tft.drawString("F ", 221, 100);
|
||||
|
||||
//tft.drawString(wunderground.getPressure(), 180, 30);
|
||||
|
||||
weatherText = ""; //wunderground.getWindDir() + " ";
|
||||
weatherText += String((int)(wunderground.getWindSpeed().toInt() * WIND_SPEED_SCALING)) + WIND_SPEED_UNITS;
|
||||
|
||||
tft.setTextDatum(TC_DATUM);
|
||||
tft.setTextPadding(tft.textWidth(" 888 mph")); // Max string length?
|
||||
tft.drawString(weatherText, 128, 136);
|
||||
|
||||
weatherText = wunderground.getPressure();
|
||||
|
||||
tft.setTextDatum(TR_DATUM);
|
||||
tft.setTextPadding(tft.textWidth(" 8888mb")); // Max string length?
|
||||
tft.drawString(weatherText, 230, 136);
|
||||
|
||||
weatherText = wunderground.getWindDir();
|
||||
|
||||
int windAngle = 0;
|
||||
String compassCardinal = "";
|
||||
switch (weatherText.length()) {
|
||||
case 1:
|
||||
compassCardinal = "N E S W "; // Not used, see default below
|
||||
windAngle = 90 * compassCardinal.indexOf(weatherText) / 2;
|
||||
break;
|
||||
case 2:
|
||||
compassCardinal = "NE SE SW NW";
|
||||
windAngle = 45 + 90 * compassCardinal.indexOf(weatherText) / 3;
|
||||
break;
|
||||
case 3:
|
||||
compassCardinal = "NNE ENE ESE SSE SSW WSW WNW NNW";
|
||||
windAngle = 22 + 45 * compassCardinal.indexOf(weatherText) / 4; // 22 should be 22.5 but accuracy is not needed!
|
||||
break;
|
||||
default:
|
||||
if (weatherText == "Variable") windAngle = -1;
|
||||
else {
|
||||
// v23456v23456v23456v23456 character ruler
|
||||
compassCardinal = "North East South West"; // Possible strings
|
||||
windAngle = 90 * compassCardinal.indexOf(weatherText) / 6;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
tft.fillCircle(128, 110, 23, TFT_BLACK); // Erase old plot, radius + 1 to delete stray pixels
|
||||
tft.drawCircle(128, 110, 22, TFT_DARKGREY); // Outer ring - optional
|
||||
if ( windAngle >= 0 ) fillSegment(128, 110, windAngle - 15, 30, 22, TFT_GREEN); // Might replace this with a bigger rotating arrow
|
||||
tft.drawCircle(128, 110, 6, TFT_RED);
|
||||
|
||||
drawSeparator(153);
|
||||
|
||||
tft.setTextDatum(TL_DATUM); // Reset datum to normal
|
||||
tft.setTextPadding(0); // Reset padding width to none
|
||||
}
|
||||
|
||||
// draws the three forecast columns
|
||||
void drawForecast() {
|
||||
drawForecastDetail(10, 171, 0);
|
||||
drawForecastDetail(95, 171, 2);
|
||||
drawForecastDetail(180, 171, 4);
|
||||
drawSeparator(171 + 69);
|
||||
}
|
||||
|
||||
// helper for the forecast columns
|
||||
void drawForecastDetail(uint16_t x, uint16_t y, uint8_t dayIndex) {
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
|
||||
String day = wunderground.getForecastTitle(dayIndex).substring(0, 3);
|
||||
day.toUpperCase();
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth("WWW"));
|
||||
tft.drawString(day, x + 25, y);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth("-88 -88"));
|
||||
tft.drawString(wunderground.getForecastHighTemp(dayIndex) + " " + wunderground.getForecastLowTemp(dayIndex), x + 25, y + 14);
|
||||
|
||||
String weatherIcon = getMeteoconIcon(wunderground.getForecastIcon(dayIndex));
|
||||
ui.drawBmp("/mini/" + weatherIcon + ".bmp", x, y + 15);
|
||||
|
||||
tft.setTextPadding(0); // Reset padding width to none
|
||||
}
|
||||
|
||||
// draw moonphase and sunrise/set and moonrise/set
|
||||
void drawAstronomy() {
|
||||
tft.setFreeFont(&ArialRoundedMTBold_14);
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth(" Waxing Crescent "));
|
||||
tft.drawString(wunderground.getMoonPhase(), 120, 260 - 2);
|
||||
|
||||
int moonAgeImage = 24 * wunderground.getMoonAge().toInt() / 30.0;
|
||||
ui.drawBmp("/moon" + String(moonAgeImage) + ".bmp", 120 - 30, 260);
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.setTextPadding(0); // Reset padding width to none
|
||||
tft.drawString("Sun", 40, 280);
|
||||
|
||||
tft.setTextDatum(BR_DATUM);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth(" 88:88 "));
|
||||
int dt = rightOffset(wunderground.getSunriseTime(), ":"); // Draw relative to colon to them aligned
|
||||
tft.drawString(wunderground.getSunriseTime(), 40 + dt, 300);
|
||||
|
||||
dt = rightOffset(wunderground.getSunsetTime(), ":");
|
||||
tft.drawString(wunderground.getSunsetTime(), 40 + dt, 315);
|
||||
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.setTextPadding(0); // Reset padding width to none
|
||||
tft.drawString("Moon", 200, 280);
|
||||
|
||||
tft.setTextDatum(BR_DATUM);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextPadding(tft.textWidth(" 88:88 "));
|
||||
dt = rightOffset(wunderground.getMoonriseTime(), ":"); // Draw relative to colon to them aligned
|
||||
tft.drawString(wunderground.getMoonriseTime(), 200 + dt, 300);
|
||||
|
||||
dt = rightOffset(wunderground.getMoonsetTime(), ":");
|
||||
tft.drawString(wunderground.getMoonsetTime(), 200 + dt, 315);
|
||||
|
||||
tft.setTextPadding(0); // Reset padding width to none
|
||||
}
|
||||
|
||||
// Helper function, should be part of the weather station library and should disappear soon
|
||||
String getMeteoconIcon(String iconText) {
|
||||
if (iconText == "F") return "chanceflurries";
|
||||
if (iconText == "Q") return "chancerain";
|
||||
if (iconText == "W") return "chancesleet";
|
||||
if (iconText == "V") return "chancesnow";
|
||||
if (iconText == "S") return "chancetstorms";
|
||||
if (iconText == "B") return "clear";
|
||||
if (iconText == "Y") return "cloudy";
|
||||
if (iconText == "F") return "flurries";
|
||||
if (iconText == "M") return "fog";
|
||||
if (iconText == "E") return "hazy";
|
||||
if (iconText == "Y") return "mostlycloudy";
|
||||
if (iconText == "H") return "mostlysunny";
|
||||
if (iconText == "H") return "partlycloudy";
|
||||
if (iconText == "J") return "partlysunny";
|
||||
if (iconText == "W") return "sleet";
|
||||
if (iconText == "R") return "rain";
|
||||
if (iconText == "W") return "snow";
|
||||
if (iconText == "B") return "sunny";
|
||||
if (iconText == "0") return "tstorms";
|
||||
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
// if you want separators, uncomment the tft-line
|
||||
void drawSeparator(uint16_t y) {
|
||||
tft.drawFastHLine(10, y, 240 - 2 * 10, 0x4228);
|
||||
}
|
||||
|
||||
// determine the "space" split point in a long string
|
||||
int splitIndex(String text)
|
||||
{
|
||||
int index = 0;
|
||||
while ( (text.indexOf(' ', index) >= 0) && ( index <= text.length() / 2 ) ) {
|
||||
index = text.indexOf(' ', index) + 1;
|
||||
}
|
||||
if (index) index--;
|
||||
return index;
|
||||
}
|
||||
|
||||
// Calculate coord delta from start of text String to start of sub String contained within that text
|
||||
// Can be used to vertically right align text so for example a colon ":" in the time value is always
|
||||
// plotted at same point on the screen irrespective of different proportional character widths,
|
||||
// could also be used to align decimal points for neat formatting
|
||||
int rightOffset(String text, String sub)
|
||||
{
|
||||
int index = text.indexOf(sub);
|
||||
return tft.textWidth(text.substring(index));
|
||||
}
|
||||
|
||||
// Calculate coord delta from start of text String to start of sub String contained within that text
|
||||
// Can be used to vertically left align text so for example a colon ":" in the time value is always
|
||||
// plotted at same point on the screen irrespective of different proportional character widths,
|
||||
// could also be used to align decimal points for neat formatting
|
||||
int leftOffset(String text, String sub)
|
||||
{
|
||||
int index = text.indexOf(sub);
|
||||
return tft.textWidth(text.substring(0, index));
|
||||
}
|
||||
|
||||
// Draw a segment of a circle, centred on x,y with defined start_angle and subtended sub_angle
|
||||
// Angles are defined in a clockwise direction with 0 at top
|
||||
// Segment has radius r and it is plotted in defined colour
|
||||
// Can be used for pie charts etc, in this sketch it is used for wind direction
|
||||
#define DEG2RAD 0.0174532925 // Degrees to Radians conversion factor
|
||||
#define INC 2 // Minimum segment subtended angle and plotting angle increment (in degrees)
|
||||
void fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned int colour)
|
||||
{
|
||||
// Calculate first pair of coordinates for segment start
|
||||
float sx = cos((start_angle - 90) * DEG2RAD);
|
||||
float sy = sin((start_angle - 90) * DEG2RAD);
|
||||
uint16_t x1 = sx * r + x;
|
||||
uint16_t y1 = sy * r + y;
|
||||
|
||||
// Draw colour blocks every INC degrees
|
||||
for (int i = start_angle; i < start_angle + sub_angle; i += INC) {
|
||||
|
||||
// Calculate pair of coordinates for segment end
|
||||
int x2 = cos((i + 1 - 90) * DEG2RAD) * r + x;
|
||||
int y2 = sin((i + 1 - 90) * DEG2RAD) * r + y;
|
||||
|
||||
tft.fillTriangle(x1, y1, x2, y2, x, y, colour);
|
||||
|
||||
// Copy segment end to sgement start for next segment
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
// We need this header file to use FLASH as storage with PROGMEM directive:
|
||||
#include <pgmspace.h>
|
||||
|
||||
// Icon width and height
|
||||
const uint16_t alertWidth = 32;
|
||||
const uint16_t alertHeight = 32;
|
||||
|
||||
// The icon file can be created with the "UTFT ImageConverter 565" bitmap to .c file creation utility, more can be pasted in here
|
||||
const unsigned short alert[1024] PROGMEM={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0840,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1080,0xAC66,0xEDE8,0xFE69,0xC4C6,0x2901,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBCC6,0xFE68,0xFE68,0xFE6A,0xFE68,0xEDE8,0x18A1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8344,0xFE48,0xFE8C,0xFFDD,0xFFFF,0xFEF0,0xFE48,0xB466,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1880,0xEDC7,0xFE48,0xFF99,0xFFBC,0xFF9B,0xFFBD,0xFE6A,0xFE48,0x5A23,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9BE5,0xFE28,0xFED0,0xFFBC,0xFF7A,0xFF9A,0xFF9B,0xFF35,0xFE28,0xBCA6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3962,0xFE28,0xFE28,0xFF9A,0xFF79,0xFF9A,0xFF9B,0xFF9A,0xFFBD,0xFE6B,0xFE28,0x72E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB465,0xFE28,0xFEF2,0xFF7A,0xFF79,0xFF7A,0xFF9A,0xFF7A,0xFF7A,0xFF78,0xFE28,0xDD67,0x0860,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5A22,0xFE07,0xFE29,0xFF9B,0xFF37,0xFF58,0xFF79,0xFF79,0xFF79,0xFF58,0xFF9B,0xFEAE,0xFE07,0x93A4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC4A5,0xFE07,0xFF15,0xFF37,0xFF36,0xAD11,0x2965,0x2965,0xCDF4,0xFF37,0xFF37,0xFF79,0xFE07,0xFE07,0x2901,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7B03,0xFDE7,0xFE4B,0xFF79,0xFEF4,0xFF15,0xB552,0x2945,0x2945,0xDE55,0xFF16,0xFF15,0xFF58,0xFED1,0xFDE7,0xAC25,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0840,0xDD26,0xFDE7,0xFF57,0xFED3,0xFED2,0xFEF4,0xBD93,0x2124,0x2124,0xDE75,0xFF14,0xFED3,0xFED3,0xFF7A,0xFE08,0xFDE7,0x49A2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9BA4,0xFDC6,0xFE6E,0xFF36,0xFE90,0xFEB1,0xFED3,0xC592,0x2124,0x2124,0xE675,0xFED3,0xFEB2,0xFEB1,0xFEF3,0xFEF3,0xFDC6,0xBC45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 12, 416 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3141,0xF5C6,0xF5C7,0xFF58,0xFE90,0xFE6F,0xFE8F,0xFEB1,0xCDB2,0x2104,0x2104,0xF6B4,0xFEB1,0xFE90,0xFE8F,0xFE90,0xFF58,0xFE0A,0xF5C6,0x72A3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 13, 448 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xABE4,0xF5A6,0xFEB1,0xFED3,0xFE4E,0xFE6E,0xFE6F,0xFE90,0xD5F2,0x18E3,0x18E3,0xFED4,0xFE90,0xFE6F,0xFE6F,0xFE6E,0xFE91,0xFF36,0xF5A6,0xCCA5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 14, 480 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x5202,0xF5A6,0xF5C7,0xFF58,0xFE4D,0xFE4D,0xFE4D,0xFE4E,0xFE6F,0xDE11,0x18C3,0x18C3,0xFED3,0xFE6F,0xFE6E,0xFE4E,0xFE4D,0xFE4D,0xFF16,0xFE2C,0xF5A6,0x9363,0x0000,0x0000,0x0000,0x0000,0x0000, // row 15, 512 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0xBC44,0xF585,0xFED3,0xFE6F,0xFE2C,0xFE2C,0xFE2D,0xFE4D,0xFE4E,0xE630,0x10A2,0x2104,0xFED1,0xFE4E,0xFE4D,0xFE4D,0xFE2D,0xFE2C,0xFE4D,0xFF37,0xF586,0xF585,0x28E1,0x0000,0x0000,0x0000,0x0000, // row 16, 544 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x7282,0xF565,0xF5EA,0xFF16,0xFE0B,0xFE0B,0xFE0B,0xFE2C,0xFE2C,0xFE4D,0xF670,0x1082,0x2924,0xFEB0,0xFE2D,0xFE2C,0xFE2C,0xFE2C,0xFE0B,0xFE0B,0xFEB2,0xFE6F,0xF565,0xA383,0x0000,0x0000,0x0000,0x0000, // row 17, 576 pixels
|
||||
0x0000,0x0000,0x0000,0x0840,0xD4C4,0xF565,0xFEF5,0xFE0C,0xFDE9,0xFDEA,0xFE0A,0xFE0B,0xFE0B,0xFE2C,0xFE8F,0x0861,0x2964,0xFE8F,0xFE2C,0xFE0B,0xFE0B,0xFE0B,0xFE0A,0xFDEA,0xFE0B,0xFF37,0xF586,0xF565,0x4181,0x0000,0x0000,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x0000,0x0000,0x9343,0xF545,0xF60C,0xFED3,0xFDC8,0xFDC8,0xFDC9,0xFDE9,0xFDEA,0xFDEA,0xFE0B,0xFE8E,0x0861,0x3184,0xFE6D,0xFE0B,0xFE0A,0xFDEA,0xFDEA,0xFDE9,0xFDC9,0xFDC9,0xFE4E,0xFEB2,0xF545,0xB3E3,0x0000,0x0000,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x0000,0x28E0,0xF544,0xF545,0xFF17,0xFDC8,0xFDA7,0xFDA7,0xFDC8,0xFDC8,0xFDC9,0xFDC9,0xFDE9,0xFE6C,0x10A2,0x39C4,0xFE4C,0xFDEA,0xFDE9,0xFDC9,0xFDC9,0xFDC8,0xFDC8,0xFDA7,0xFDA8,0xFF16,0xF588,0xF544,0x6222,0x0000,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x0000,0xA383,0xF524,0xF64E,0xFE4E,0xFD86,0xFD86,0xFD87,0xFDA7,0xFDA7,0xFDA8,0xFDC8,0xFDC8,0xFE2A,0xA469,0xB4EA,0xFE2A,0xFDC9,0xFDC8,0xFDC8,0xFDA8,0xFDA7,0xFDA7,0xFD87,0xFD86,0xFDEA,0xFED3,0xF524,0xC443,0x0000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x51C1,0xF504,0xF546,0xFF16,0xF565,0xFD65,0xFD65,0xFD86,0xFD86,0xFD86,0xFDA7,0xFDA7,0xFDA7,0xFDE8,0xFE6A,0xFE4A,0xFDE8,0xFDA7,0xFDA7,0xFDA7,0xFDA7,0xFD86,0xFD86,0xFD86,0xFD65,0xFD65,0xFEB2,0xF5CA,0xF504,0x8AE2,0x0000, // row 22, 736 pixels
|
||||
0x0000,0xB3A2,0xED03,0xFE92,0xFDC9,0xF543,0xF544,0xFD44,0xFD65,0xFD65,0xFD65,0xFD86,0xFD86,0xFD86,0xFDA7,0xFDC7,0xFDC7,0xFDA7,0xFD86,0xFD86,0xFD86,0xFD86,0xFD65,0xFD65,0xFD65,0xFD44,0xF544,0xFD86,0xFEF5,0xED03,0xE4C3,0x1880, // row 23, 768 pixels
|
||||
0x7241,0xECE3,0xF567,0xFED3,0xF523,0xF523,0xF523,0xF543,0xF544,0xF544,0xFD65,0xFD65,0xFD65,0xFD65,0xD4E6,0x39C5,0x39A5,0xD4E6,0xFD86,0xFD65,0xFD65,0xFD65,0xFD65,0xF544,0xF544,0xF543,0xF523,0xF523,0xFE2E,0xF5EC,0xECE3,0x9B42, // row 24, 800 pixels
|
||||
0xD443,0xECE3,0xFED4,0xF565,0xF502,0xF502,0xF522,0xF523,0xF523,0xF543,0xF544,0xF544,0xF544,0xFD65,0x8B64,0x18C3,0x18C3,0x8344,0xFD85,0xFD44,0xF544,0xF544,0xF544,0xF543,0xF523,0xF523,0xF522,0xF502,0xF523,0xFEF5,0xED04,0xECE3, // row 25, 832 pixels
|
||||
0xECC3,0xF5AB,0xFE6F,0xF501,0xF4E1,0xF501,0xF502,0xF502,0xF522,0xF522,0xF523,0xF523,0xF523,0xFD84,0xC504,0x20E1,0x18E1,0xC4E4,0xFD84,0xF543,0xF523,0xF523,0xF523,0xF522,0xF522,0xF502,0xF502,0xF501,0xF501,0xFDC9,0xF62F,0xECC3, // row 26, 864 pixels
|
||||
0xECC2,0xFE92,0xF523,0xF4E0,0xF4E0,0xF4E1,0xF4E1,0xF501,0xF501,0xF502,0xF502,0xF522,0xF522,0xF543,0xFDE3,0xFEA5,0xF6A4,0xFE04,0xF543,0xF522,0xF522,0xF522,0xF502,0xF502,0xF501,0xF501,0xF4E1,0xF4E1,0xF4E0,0xF4E1,0xFED4,0xECC2, // row 27, 896 pixels
|
||||
0xECA2,0xF5EC,0xF4E0,0xF4C0,0xF4E0,0xF4E0,0xF4E0,0xF4E1,0xF4E1,0xF501,0xF501,0xF501,0xF502,0xF502,0xF542,0xFDA2,0xFDA2,0xF542,0xF502,0xF502,0xF502,0xF501,0xF501,0xF501,0xF4E1,0xF4E1,0xF4E0,0xF4E0,0xF4E0,0xF4C0,0xF5A9,0xECA2, // row 28, 928 pixels
|
||||
0xECA2,0xECA2,0xECC2,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4E1,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xECC2,0xECC3,0xECA2, // row 29, 960 pixels
|
||||
0x8AC1,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0x9B01, // row 30, 992 pixels
|
||||
0x0000,0x1880,0x51A0,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x61E0,0x28E0,0x0000}; // row 31, 1024 pixels
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// We need this header file to use FLASH as storage with PROGMEM directive:
|
||||
#include <pgmspace.h>
|
||||
|
||||
// Icon width and height
|
||||
const uint16_t closeWidth = 32;
|
||||
const uint16_t closeHeight = 32;
|
||||
|
||||
// The icon file can be created with the "UTFT ImageConverter 565" bitmap to .c file creation utility, more can be pasted in here
|
||||
const unsigned short closeX[1024] PROGMEM={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x30C3,0x4124,0x61C7,0x61C7,0x4124,0x30E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x48E3,0xA249,0xEB8E,0xFCB2,0xFD14,0xFD75,0xFD96,0xFD34,0xFCF3,0xEBEF,0xA28A,0x4904,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x58E3,0xC228,0xFC10,0xFD34,0xFE18,0xFE59,0xFE79,0xFE9A,0xFE9A,0xFE9A,0xFE9A,0xFE59,0xFD75,0xFC51,0xC28A,0x5904,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2041,0x8945,0xF34D,0xFD34,0xFDB6,0xFD75,0xFD55,0xFD55,0xFD96,0xFDD7,0xFDF7,0xFDF7,0xFDB6,0xFDB6,0xFDD7,0xFDF7,0xFD75,0xF38E,0x8965,0x2041,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x4082,0xE208,0xF410,0xFD34,0xFC92,0xFBEF,0xFBAE,0xFBEF,0xFC71,0xFD14,0xFD75,0xFDB6,0xFD75,0xFD14,0xFC92,0xFC51,0xFC71,0xFCF3,0xFD75,0xFC30,0xEA28,0x40A2,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x3861,0xE1E7,0xF451,0xFC92,0xFB4D,0xFA49,0xFA49,0xFAEB,0xFBAE,0xFC71,0xFD34,0xFDB6,0xFE18,0xFDB6,0xFD34,0xFC71,0xFBAE,0xFB0C,0xFAEB,0xFBAE,0xFCD3,0xFC71,0xE208,0x4082,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x1020,0xD986,0xF430,0xFC30,0xFA28,0xF924,0xF965,0xFA8A,0xFB0C,0xFBAE,0xFC51,0xFD14,0xFD75,0xFDB6,0xFD75,0xFD14,0xFC51,0xFC71,0xFBEF,0xFA28,0xF9C7,0xFA8A,0xFC51,0xF430,0xD9A6,0x1020,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x78A2,0xEB6D,0xFC30,0xF9C7,0xF861,0xF8A2,0xFA08,0xFEDB,0xFD55,0xFB4D,0xFC10,0xFC92,0xFD14,0xFD34,0xFD14,0xFC92,0xFCB2,0xFF7D,0xFF7D,0xFB2C,0xF945,0xF8E3,0xF9E7,0xFC30,0xEB8E,0x78C3,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x3841,0xD9E7,0xF492,0xF208,0xF041,0xF800,0xF945,0xFE9A,0xFFFF,0xFFFF,0xFD75,0xFB8E,0xFC10,0xFC51,0xFC71,0xFC51,0xFCB2,0xFF7D,0xFFFF,0xFFFF,0xFF3C,0xFA8A,0xF882,0xF841,0xFA08,0xFC92,0xDA08,0x3841,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x88A2,0xEBCF,0xF2EB,0xF061,0xF000,0xF8E3,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD75,0xFB4D,0xFBAE,0xFBAE,0xFC71,0xFF7D,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFEFB,0xFA28,0xF800,0xF061,0xF2EB,0xEBEF,0x90C3,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x2820,0xD1C7,0xF410,0xE945,0xE800,0xF000,0xFE9A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD34,0xFAEB,0xFBCF,0xFF5D,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF1C,0xF986,0xF000,0xF145,0xF410,0xD1E7,0x2820,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x6841,0xDB2C,0xEACB,0xE041,0xE800,0xF000,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD14,0xFF1C,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFBCF,0xF082,0xF000,0xE841,0xEACB,0xE34D,0x7061,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x9861,0xE3CF,0xE186,0xE000,0xE800,0xE800,0xF145,0xFEDB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE986,0xEBCF,0xA082,0x0000, // row 12, 416 pixels
|
||||
0x0800,0xB8A2,0xE3AE,0xD8A2,0xD800,0xE000,0xE800,0xE800,0xF145,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE000,0xE0A2,0xEBAE,0xC0C3,0x0800, // row 13, 448 pixels
|
||||
0x1800,0xC124,0xE30C,0xD020,0xD800,0xE000,0xE000,0xE800,0xE800,0xF145,0xFEDB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE000,0xE000,0xD820,0xE30C,0xC124,0x1800, // row 14, 480 pixels
|
||||
0x2800,0xC165,0xDAAA,0xC800,0xD000,0xD800,0xE000,0xE000,0xE800,0xE800,0xF124,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB6D,0xF000,0xF000,0xE800,0xE800,0xE000,0xE000,0xD800,0xD000,0xDAAA,0xC165,0x2800, // row 15, 512 pixels
|
||||
0x2000,0xB924,0xD269,0xC800,0xD000,0xD000,0xD800,0xE000,0xE000,0xE800,0xE924,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF36D,0xE800,0xE800,0xE800,0xE000,0xE000,0xD800,0xD000,0xD000,0xDA69,0xC145,0x2800, // row 16, 544 pixels
|
||||
0x1000,0xB0A2,0xD28A,0xC000,0xC800,0xD000,0xD000,0xD800,0xD800,0xE165,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF3AE,0xE000,0xE000,0xD800,0xD800,0xD000,0xD000,0xC800,0xD28A,0xB8C3,0x1000, // row 17, 576 pixels
|
||||
0x0000,0xA800,0xD2AA,0xB800,0xC000,0xC800,0xC800,0xD000,0xD965,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBAE,0xD800,0xD800,0xD000,0xC800,0xC800,0xC000,0xD2AA,0xB020,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x8000,0xCA69,0xB841,0xB800,0xC000,0xC800,0xD186,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBCF,0xD000,0xC800,0xC800,0xC000,0xC041,0xCA69,0x8000,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x4800,0xC1C7,0xB8E3,0xB800,0xB800,0xC000,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBEF,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xE410,0xC841,0xC000,0xB800,0xC0E3,0xC1C7,0x4800,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x1000,0xB061,0xC1E7,0xB000,0xB000,0xB800,0xD269,0xFFBE,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xE38E,0xD000,0xD965,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xDB0C,0xC020,0xB800,0xB000,0xC1E7,0xB061,0x1000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x0000,0x6000,0xB9C7,0xB061,0xB000,0xB000,0xB800,0xCA49,0xFF9E,0xFFFF,0xFFFF,0xFFFF,0xE38E,0xC800,0xC800,0xC800,0xD186,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xDB0C,0xB800,0xB800,0xB000,0xB061,0xC1C7,0x6000,0x0000,0x0000, // row 22, 736 pixels
|
||||
0x0000,0x0000,0x1800,0xB041,0xB986,0xA800,0xA800,0xB000,0xB000,0xCA49,0xFF7D,0xFFFF,0xDB8E,0xC000,0xC000,0xC000,0xC000,0xC000,0xC986,0xF6DB,0xFFFF,0xFFFF,0xD30C,0xB800,0xB000,0xB000,0xA800,0xB986,0xB041,0x1800,0x0000,0x0000, // row 23, 768 pixels
|
||||
0x0000,0x0000,0x0000,0x5800,0xB0E3,0xA8C3,0xA800,0xA800,0xA800,0xB000,0xCACB,0xD38E,0xB000,0xB800,0xB800,0xB800,0xB800,0xB800,0xB800,0xC145,0xF6DB,0xD34D,0xB000,0xB000,0xA800,0xA800,0xB0C3,0xB0E3,0x5800,0x0000,0x0000,0x0000, // row 24, 800 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x6000,0xB124,0xA882,0xA000,0xA800,0xA800,0xA800,0xA800,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xA800,0xA800,0xA800,0xA800,0xA882,0xB124,0x6000,0x0000,0x0000,0x0000,0x0000, // row 25, 832 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x6000,0xB104,0xA882,0xA000,0xA000,0xA000,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA000,0xA000,0xA882,0xB104,0x6000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 26, 864 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6000,0xB0A2,0xA8C3,0xA020,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA020,0xA8C3,0xB0A2,0x6000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 27, 896 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4800,0xA800,0xB0C3,0xA0A2,0x9800,0x9800,0x9800,0x9800,0xA000,0xA000,0xA000,0x9800,0x9800,0x9800,0xA082,0xB0E3,0xA800,0x4800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 28, 928 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5800,0xA800,0xB0A2,0xA8E3,0xA0A2,0xA041,0x9800,0x9800,0xA041,0xA0A2,0xA8E3,0xB0A2,0xA800,0x5800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 29, 960 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3000,0x6000,0x8800,0xA000,0xA800,0xA800,0xA000,0x8800,0x6000,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 30, 992 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; // row 31, 1024 pixels
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
// Code partly derived from ILI9341_due library example
|
||||
|
||||
// Draws the 3 icons across the middle of the screen and pauses.
|
||||
// Then draws 300 icons at random locations, clears screen and repeats
|
||||
//
|
||||
// This demonstrates drawing icons from FLASH
|
||||
|
||||
// Icons are stored in tabs, e.g. Alert.h etc
|
||||
// more than one icon can be in a header file.
|
||||
|
||||
/*
|
||||
This sketch demonstrates loading images from arrays stored in program (FLASH) memory.
|
||||
|
||||
Works with TFT_eSPI library here:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
This sketch does not use/need any fonts at all...
|
||||
|
||||
Arrays containing FLASH images can be created with UTFT library tool:
|
||||
(libraries\UTFT\Tools\ImageConverter565.exe)
|
||||
Convert to .c format then copy into a new tab
|
||||
|
||||
The number and size of icons is limited by available FLASH memory. The icon array will
|
||||
use width x height x 2 bytes of FLASH, i.e. 32 x 32 icon uses ~2048 bytes
|
||||
|
||||
*/
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
#include <SPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library with default width and height
|
||||
|
||||
// Include the header files that contain the icons
|
||||
#include "Alert.h"
|
||||
#include "Close.h"
|
||||
#include "Info.h"
|
||||
|
||||
long count = 0; // Loop count
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
tft.begin();
|
||||
tft.setRotation(1); // landscape
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
// Draw the icons
|
||||
drawIcon(info, (tft.width() - infoWidth)/2 - 50, (tft.height() - infoHeight)/2, infoWidth, infoHeight);
|
||||
drawIcon(alert, (tft.width() - alertWidth)/2, (tft.height() - alertHeight)/2, alertWidth, alertHeight);
|
||||
drawIcon(closeX, (tft.width() - closeWidth)/2 + 50, (tft.height() - closeHeight)/2, closeWidth, closeHeight);
|
||||
|
||||
// Pause here to admire the icons!
|
||||
delay(4000);
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Loop filling and clearing screen
|
||||
drawIcon(info, random(tft.width() - infoWidth), random(tft.height() - infoHeight), infoWidth, infoHeight);
|
||||
drawIcon(alert, random(tft.width() - alertWidth), random(tft.height() - alertHeight), alertWidth, alertHeight);
|
||||
drawIcon(closeX, random(tft.width() - closeWidth), random(tft.height() - closeHeight), alertWidth, closeHeight);
|
||||
|
||||
// Clear screen after 100 x 3 = 300 icons drawn
|
||||
if (100 == count++) {
|
||||
count = 1;
|
||||
tft.setRotation(2 * random(2)); // Rotate randomly to clear display left>right or right>left to reduce monotony!
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(1);
|
||||
Serial.println(millis());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//====================================================================================
|
||||
// This is the function to draw the icon stored as an array in program memory (FLASH)
|
||||
//====================================================================================
|
||||
|
||||
// To speed up rendering we use a 64 pixel buffer
|
||||
#define BUFF_SIZE 64
|
||||
|
||||
// Draw array "icon" of defined width and height at coordinate x,y
|
||||
// Maximum icon size is 255x255 pixels to avoid integer overflow
|
||||
|
||||
void drawIcon(const unsigned short* icon, int16_t x, int16_t y, uint16_t width, uint16_t height) {
|
||||
|
||||
uint16_t pix_buffer[BUFF_SIZE]; // Pixel buffer (16 bits per pixel)
|
||||
|
||||
// Set up a window the right size to stream pixels into
|
||||
tft.setWindow(x, y, x + width - 1, y + height - 1);
|
||||
|
||||
// Work out the number whole buffers to send
|
||||
uint16_t nb = ((uint16_t)height * width) / BUFF_SIZE;
|
||||
|
||||
// Fill and send "nb" buffers to TFT
|
||||
for (int i = 0; i < nb; i++) {
|
||||
for (int j = 0; j < BUFF_SIZE; j++) {
|
||||
pix_buffer[j] = pgm_read_word(&icon[i * BUFF_SIZE + j]);
|
||||
}
|
||||
tft.pushColors(pix_buffer, BUFF_SIZE);
|
||||
}
|
||||
|
||||
// Work out number of pixels not yet sent
|
||||
uint16_t np = ((uint16_t)height * width) % BUFF_SIZE;
|
||||
|
||||
// Send any partial buffer left over
|
||||
if (np) {
|
||||
for (int i = 0; i < np; i++) pix_buffer[i] = pgm_read_word(&icon[nb * BUFF_SIZE + i]);
|
||||
tft.pushColors(pix_buffer, np);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// We need this header file to use FLASH as storage with PROGMEM directive:
|
||||
#include <pgmspace.h>
|
||||
|
||||
// Icon width and height
|
||||
const uint16_t infoWidth = 32;
|
||||
const uint16_t infoHeight = 32;
|
||||
|
||||
// The icon file can be created with the "UTFT ImageConverter 565" bitmap to .c file creation utility, more can be pasted in here
|
||||
const unsigned short info[1024] PROGMEM={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0861,0x4A69,0x8C71,0xA514,0xBDF7,0xBDF7,0xA514,0x8C71,0x4A69,0x0861,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x39E7,0x9CF3,0xEF7D,0xF79E,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xF79E,0xEF7D,0x9CF3,0x39E7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2965,0x9492,0xF79E,0xFFDF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFDF,0xF79E,0x9492,0x2965,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x630C,0xEF7D,0xFFDF,0xFFFF,0xFFFF,0xFFFF,0xD75F,0xB6BF,0x9E5F,0x963F,0x963F,0x9E5F,0xB6BF,0xD75F,0xFFFF,0xFFFF,0xFFFF,0xFFDF,0xEF7D,0x630C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x73AE,0xEF7D,0xFFDF,0xFFFF,0xFFDF,0xBEDF,0x7DBF,0x7DBF,0x7DDF,0x7DDF,0x7DDF,0x7DDF,0x7DDF,0x7DBF,0x759F,0x7DBE,0xBEBF,0xFFDF,0xFFFF,0xFFDF,0xEF7D,0x73AE,0x0000,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x630C,0xEF7D,0xFFFF,0xFFFF,0xE77F,0x7DBE,0x759E,0x759F,0x7DBF,0x7DDF,0x7DDF,0x85FF,0x7DDF,0x7DDF,0x7DBF,0x759F,0x759E,0x6D7E,0x7DBE,0xDF7F,0xFFFF,0xFFFF,0xEF7D,0x630C,0x0000,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x31A6,0xEF5D,0xFFDF,0xFFFF,0xCF1E,0x6D7E,0x6D7E,0x759E,0x759F,0x7DBF,0x7DDF,0x8E1F,0xBEDF,0xC6FF,0x8DFF,0x75BF,0x759F,0x759E,0x6D7E,0x655E,0x655D,0xCF1E,0xFFFF,0xFFDF,0xEF5D,0x31A6,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x0000,0x94B2,0xF7BE,0xFFFF,0xDF5E,0x655D,0x655D,0x6D7E,0x6D7E,0x759E,0x75BF,0x759F,0xEFBF,0xFFFF,0xFFFF,0xEFBF,0x759F,0x759E,0x6D7E,0x6D7E,0x655D,0x653D,0x653D,0xDF5E,0xFFFF,0xF7BE,0x94B2,0x0000,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x4228,0xEF7D,0xFFFF,0xF7BF,0x6D5D,0x653D,0x655D,0x6D5E,0x6D7E,0x759E,0x759E,0x85DF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8DFE,0x6D7E,0x6D7E,0x6D5E,0x655D,0x653D,0x5D1D,0x6D5D,0xF7BF,0xFFFF,0xEF7D,0x4228,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x0000,0xA534,0xFFDF,0xFFDF,0xA65D,0x5D1D,0x5D1D,0x653D,0x655E,0x6D7E,0x6D7E,0x6D7E,0x651E,0xE77F,0xFFFF,0xFFFF,0xF7BF,0x5CFE,0x6D7E,0x6D7E,0x655E,0x653D,0x5D1D,0x5D1D,0x54FC,0xA65D,0xFFDF,0xFFDF,0xA534,0x0000,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x18E3,0xEF5D,0xFFFF,0xEF9E,0x5CFC,0x54FC,0x5D1D,0x5D3D,0x653D,0x655E,0x6D7E,0x6D7E,0x653E,0x6D3E,0xB67E,0xBEBE,0x755E,0x5D1E,0x6D5E,0x655E,0x653D,0x5D3D,0x5D1D,0x54FC,0x54DC,0x54FC,0xEF9E,0xFFFF,0xEF5D,0x18E3,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x630C,0xEF7D,0xFFDF,0xB69D,0x54DC,0x54FC,0x5CFC,0x5D1D,0x653D,0x653D,0x655E,0x6D5E,0x655E,0x5CFE,0x4C9D,0x4C7D,0x54DD,0x653E,0x655E,0x653D,0x653D,0x5D1D,0x5CFC,0x54FC,0x54DC,0x4CBC,0xB69D,0xFFDF,0xEF7D,0x630C,0x0000, // row 12, 416 pixels
|
||||
0x0000,0x94B2,0xF7BE,0xFFDF,0x85BC,0x4CBC,0x54DC,0x54FC,0x5CFD,0x5D1D,0x5D3D,0x653D,0x655D,0x653D,0x85DE,0xC6FE,0xC6FE,0x85BE,0x653D,0x653D,0x5D3D,0x5D1D,0x5CFD,0x54FC,0x54DC,0x4CBC,0x4CBB,0x85BC,0xFFDF,0xF7BE,0x94B2,0x0000, // row 13, 448 pixels
|
||||
0x0000,0xB5B6,0xFFDF,0xF7BE,0x651C,0x4CBB,0x4CBC,0x54DC,0x54FC,0x5CFC,0x5D1D,0x5D1D,0x653D,0x5D1D,0xE77E,0xFFDF,0xFFDF,0xEF9E,0x5CFD,0x5D1D,0x5D1D,0x5CFC,0x54FC,0x54DC,0x4CBC,0x4CBB,0x449B,0x651B,0xF7BE,0xFFDF,0xB5B6,0x0000, // row 14, 480 pixels
|
||||
0x0000,0xC638,0xFFDF,0xF7BE,0x54DB,0x449B,0x4CBB,0x4CBC,0x54DC,0x54FC,0x54FC,0x5D1D,0x5D1D,0x7D7D,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x7D7D,0x5CFD,0x54FC,0x54FC,0x54DC,0x4CBC,0x4CBB,0x449B,0x447B,0x54BB,0xF7BE,0xFFDF,0xC638,0x0000, // row 15, 512 pixels
|
||||
0x0000,0xC638,0xFFDF,0xF79E,0x4CBB,0x449B,0x449B,0x4CBB,0x4CBC,0x54DC,0x54DC,0x54FC,0x54DC,0x753C,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x753C,0x54DC,0x54DC,0x54DC,0x4CBC,0x4CBB,0x449B,0x449B,0x3C7B,0x4C9B,0xF79E,0xFFDF,0xC638,0x0000, // row 16, 544 pixels
|
||||
0x0000,0xB5B6,0xFFDF,0xF7BE,0x5CFB,0x3C7B,0x447B,0x449B,0x4CBB,0x4CBC,0x4CBC,0x4CDC,0x4CBC,0x6D1C,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x6CFC,0x4CBC,0x4CBC,0x4CBC,0x4CBB,0x449B,0x447B,0x3C7B,0x3C5A,0x54DB,0xF7BE,0xFFDF,0xB5B6,0x0000, // row 17, 576 pixels
|
||||
0x0000,0x94B2,0xF7BE,0xF7BE,0x755B,0x3C5A,0x3C7B,0x447B,0x449B,0x449B,0x4CBB,0x4CBB,0x4C9B,0x6CFB,0xF79E,0xF79E,0xF79E,0xF79E,0x64FB,0x449B,0x4CBB,0x449B,0x449B,0x447B,0x3C7B,0x3C5A,0x3C5A,0x753B,0xF7BE,0xF7BE,0x9CD3,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x6B4D,0xEF7D,0xF7BE,0xA61C,0x3C5A,0x3C5A,0x3C7B,0x447B,0x447B,0x449B,0x449B,0x447B,0x64DB,0xF79E,0xF79E,0xF79E,0xF79E,0x64DB,0x447B,0x449B,0x447B,0x447B,0x3C7B,0x3C5A,0x3C5A,0x343A,0xA61C,0xF7BE,0xEF7D,0x6B4D,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x2124,0xE71C,0xFFDF,0xDF3D,0x3C5A,0x343A,0x3C5A,0x3C5A,0x3C7B,0x3C7B,0x447B,0x3C5B,0x64BA,0xF79E,0xF79E,0xF79E,0xF79E,0x64BA,0x3C5B,0x3C7B,0x3C7B,0x3C5A,0x3C5A,0x343A,0x343A,0x343A,0xDF3D,0xFFDF,0xE71C,0x2124,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x0000,0xAD75,0xF7BE,0xF79E,0x859B,0x343A,0x343A,0x345A,0x3C5A,0x3C5A,0x3C5A,0x3C5A,0x5C9A,0xEF7D,0xEF7D,0xEF7D,0xEF7D,0x5C9A,0x3C3A,0x3C5A,0x3C5A,0x345A,0x343A,0x343A,0x341A,0x859B,0xF79E,0xF7BE,0xAD75,0x0000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x0000,0x528A,0xE71C,0xFFDF,0xDF3D,0x3C5A,0x343A,0x343A,0x343A,0x343A,0x3C5A,0x343A,0x4C5A,0xEF7D,0xEF7D,0xEF7D,0xEF7D,0x4C59,0x343A,0x343A,0x343A,0x343A,0x343A,0x341A,0x3C5A,0xDF3D,0xFFDF,0xE71C,0x528A,0x0000,0x0000, // row 22, 736 pixels
|
||||
0x0000,0x0000,0x0000,0x9CD3,0xF79E,0xF7BE,0xBE7C,0x3419,0x341A,0x341A,0x343A,0x343A,0x341A,0x2B99,0xC69C,0xEF7D,0xEF7D,0xD6DC,0x2398,0x341A,0x343A,0x341A,0x341A,0x2C19,0x2C19,0xBE7C,0xF7BE,0xF79E,0x9CD3,0x0000,0x0000,0x0000, // row 23, 768 pixels
|
||||
0x0000,0x0000,0x0000,0x39E7,0xDEDB,0xFFDF,0xF79E,0x9DFB,0x2C19,0x2C19,0x2C1A,0x341A,0x341A,0x2BB9,0x2B57,0x6459,0x74B9,0x2337,0x2BB9,0x341A,0x2C1A,0x2C19,0x2C19,0x2C19,0x9DFB,0xF79E,0xFFDF,0xDEDB,0x39E7,0x0000,0x0000,0x0000, // row 24, 800 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x632C,0xDEFB,0xFFDF,0xEF7D,0xB65C,0x3C39,0x2BF9,0x2C19,0x2C19,0x2BF9,0x2398,0x1B58,0x1B37,0x2398,0x2BF9,0x2C19,0x2BF9,0x2BF9,0x3439,0xB65C,0xEF7D,0xFFDF,0xDEFB,0x632C,0x0000,0x0000,0x0000,0x0000, // row 25, 832 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x73AE,0xDEFB,0xF7BE,0xF79E,0xDF1C,0x7D5A,0x2BF9,0x2BF9,0x2BF9,0x2BF9,0x23D9,0x23D9,0x2BF9,0x2BF9,0x2BF9,0x2BF9,0x7D5A,0xDF1C,0xF79E,0xF7BE,0xDEFB,0x73AE,0x0000,0x0000,0x0000,0x0000,0x0000, // row 26, 864 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x632C,0xDEDB,0xF79E,0xFFDF,0xEF7D,0xD6FC,0x9DFB,0x5CDA,0x4C9A,0x3419,0x3419,0x4C9A,0x5CDA,0x9DFB,0xD6FC,0xEF7D,0xFFDF,0xF79E,0xDEDB,0x632C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 27, 896 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4208,0x94B2,0xDEFB,0xF7BE,0xFFDF,0xF7BE,0xF79E,0xEF7D,0xEF5D,0xEF5D,0xEF7D,0xF79E,0xF7BE,0xFFDF,0xF7BE,0xDEFB,0x94B2,0x4208,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 28, 928 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x528A,0xA534,0xDEDB,0xE73C,0xF79E,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0xF79E,0xE73C,0xDEDB,0xA534,0x528A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 29, 960 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x18C3,0x5AEB,0x8C71,0xAD55,0xBDD7,0xBDD7,0xAD55,0x8C71,0x5AEB,0x18C3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 30, 992 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; // row 31, 1024 pixels
|
||||
|
|
@ -171,11 +171,14 @@ void renderJPEG(int xpos, int ypos) {
|
|||
// calculate how many pixels must be drawn
|
||||
uint32_t mcu_pixels = win_w * win_h;
|
||||
|
||||
tft.startWrite();
|
||||
|
||||
// draw image MCU block only if it will fit on the screen
|
||||
if (( mcu_x + win_w ) <= tft.width() && ( mcu_y + win_h ) <= tft.height())
|
||||
{
|
||||
|
||||
// Now set a MCU bounding window on the TFT to push pixels into (x, y, x + width - 1, y + height - 1)
|
||||
tft.setWindow(mcu_x, mcu_y, mcu_x + win_w - 1, mcu_y + win_h - 1);
|
||||
tft.setAddrWindow(mcu_x, mcu_y, win_w, win_h);
|
||||
|
||||
// Write all MCU pixels to the TFT window
|
||||
while (mcu_pixels--) {
|
||||
|
|
@ -185,6 +188,8 @@ void renderJPEG(int xpos, int ypos) {
|
|||
|
||||
}
|
||||
else if ( (mcu_y + win_h) >= tft.height()) JpegDec.abort(); // Image has run off bottom of screen so abort decoding
|
||||
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
// calculate how long it took to draw the image
|
||||
|
|
|
|||
|
|
@ -251,8 +251,10 @@ void drawIcon(const unsigned short* icon, int16_t x, int16_t y, int8_t width, in
|
|||
|
||||
uint16_t pix_buffer[BUFF_SIZE]; // Pixel buffer (16 bits per pixel)
|
||||
|
||||
tft.startWrite();
|
||||
|
||||
// Set up a window the right size to stream pixels into
|
||||
tft.setWindow(x, y, x + width - 1, y + height - 1);
|
||||
tft.setAddrWindow(x, y, width, height);
|
||||
|
||||
// Work out the number whole buffers to send
|
||||
uint16_t nb = ((uint16_t)height * width) / BUFF_SIZE;
|
||||
|
|
@ -273,5 +275,7 @@ void drawIcon(const unsigned short* icon, int16_t x, int16_t y, int8_t width, in
|
|||
for (int i = 0; i < np; i++) pix_buffer[i] = pgm_read_word(&icon[nb * BUFF_SIZE + i]);
|
||||
tft.pushColors(pix_buffer, np);
|
||||
}
|
||||
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
Example for TFT_eSPI library
|
||||
|
||||
This example shows the use of a Adafruit_GFX custom font with a
|
||||
character code range of 32 - 255, this means accented characters
|
||||
(amongst others) are available.
|
||||
|
||||
The custom font file is attached to this sketch as a header file. The
|
||||
font data has been created following the instructions here:
|
||||
https://www.youtube.com/watch?v=L8MmTISmwZ8
|
||||
|
||||
Note that online converters for Adafruit_GFX compatible fonts are
|
||||
available but these typically only use characters in the range 32-127,
|
||||
and thus do not include the accented characters. These online converters
|
||||
can however still be used with this sketch but the example characters
|
||||
used must be changed.
|
||||
|
||||
The Arduino IDE uses UTF8 encoding for these characters. The TFT_eSPI
|
||||
library also expects characters in the range 128 to 255 to be UTF-8
|
||||
encoded. See link here for details:
|
||||
|
||||
https://playground.arduino.cc/Code/UTF-8
|
||||
|
||||
To sumarise, UTF-8 characters are encoded as mor than 1 byte so care must
|
||||
be taken:
|
||||
|
||||
char c = 'µ'; // Wrong
|
||||
char bad[4] = "5µA"; // Wrong
|
||||
char good[] = "5µA"; // Good
|
||||
String okay = "5µA"; // Good
|
||||
|
||||
Created by Bodmer 08/02/19
|
||||
|
||||
Make sure LOAD_GFXFF is defined in the used User_Setup file
|
||||
within the library folder.
|
||||
|
||||
#########################################################################
|
||||
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
|
||||
###### TO SELECT YOUR DISPLAY TYPE, PINS USED AND ENABLE FONTS ######
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
#define TEST_TEXT "ßäöü ñâàå" // Text that will be printed on screen in the font
|
||||
//#define TEST_TEXT "Hello" // Text that will be printed on screen in the font
|
||||
|
||||
#include "SPI.h"
|
||||
#include "TFT_eSPI.h"
|
||||
|
||||
// The custom font file attached to this sketch must be included
|
||||
#include "MyFont.h"
|
||||
|
||||
// Stock font and GFXFF reference handle
|
||||
#define GFXFF 1
|
||||
|
||||
// Easily remembered name for the font
|
||||
#define MYFONT32 &myFont32pt8b
|
||||
|
||||
// Use hardware SPI
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
void setup(void) {
|
||||
|
||||
Serial.begin(250000);
|
||||
|
||||
tft.begin();
|
||||
|
||||
tft.setRotation(1);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Show custom fonts
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
// Where font sizes increase the screen is not cleared as the larger fonts overwrite
|
||||
// the smaller one with the background colour.
|
||||
|
||||
// We can set the text datum to be Top, Middle, Bottom vertically and Left, Centre
|
||||
// and Right horizontally. These are the text datums that can be used:
|
||||
// TL_DATUM = Top left (default)
|
||||
// TC_DATUM = Top centre
|
||||
// TR_DATUM = Top right
|
||||
// ML_DATUM = Middle left
|
||||
// MC_DATUM = Middle centre <<< This is used below
|
||||
// MR_DATUM = Middle right
|
||||
// BL_DATUM = Bottom left
|
||||
// BC_DATUM = Bottom centre
|
||||
// BR_DATUM = Bottom right
|
||||
// L_BASELINE = Left character baseline (Line the 'A' character would sit on)
|
||||
// C_BASELINE = Centre character baseline
|
||||
// R_BASELINE = Right character baseline
|
||||
|
||||
//Serial.println();
|
||||
|
||||
// Set text datum to middle centre (MC_DATUM)
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
|
||||
// Set text colour to white with black background
|
||||
// Unlike the stock Adafruit_GFX library, the TFT_eSPI library DOES optionally draw
|
||||
// the background colour for the custom and Free Fonts when using drawString()
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK); // White characters on black background
|
||||
//tft.setTextColor(TFT_WHITE); // or white characters, no background
|
||||
|
||||
tft.fillScreen(TFT_BLUE); // Clear screen
|
||||
tft.setFreeFont(MYFONT32); // Select the font
|
||||
tft.drawString("MyFont 32", 160, 60, GFXFF); // Print the name of the font
|
||||
tft.setFreeFont(MYFONT32); // Select the font
|
||||
tft.drawString(TEST_TEXT, 160, 140, GFXFF); // Print the test text in the custom font
|
||||
delay(2000);
|
||||
|
||||
// Setting textDatum does nothing when using tft.print
|
||||
tft.fillScreen(TFT_BLUE); // Clear screen
|
||||
tft.setCursor(0,60); // To be compatible with Adafruit_GFX the cursor datum is always bottom left
|
||||
tft.print("âäàå"); // Using tft.print means text background is NEVER rendered
|
||||
delay(2000);
|
||||
|
||||
// Reset text padding to zero (default)
|
||||
tft.setTextPadding(0);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -38,4 +38,3 @@ const unsigned short alert[1024] PROGMEM={
|
|||
0xECA2,0xECA2,0xECC2,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4E1,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xECC2,0xECC3,0xECA2, // row 29, 960 pixels
|
||||
0x8AC1,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0x9B01, // row 30, 992 pixels
|
||||
0x0000,0x1880,0x51A0,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x61E0,0x28E0,0x0000}; // row 31, 1024 pixels
|
||||
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
// Icon images are stored in tabs ^ e.g. Alert.h etc above this line
|
||||
// more than one icon can be in a header file
|
||||
|
||||
// Arrays containing FLASH images can be created with UTFT library tool:
|
||||
// (libraries\UTFT\Tools\ImageConverter565.exe)
|
||||
// Convert to .c format then copy into a new tab
|
||||
|
||||
/*
|
||||
This sketch demonstrates loading images from arrays stored in program (FLASH) memory.
|
||||
|
||||
Works with TFT_eSPI library here:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
This sketch does not use/need any fonts at all...
|
||||
|
||||
Code derived from ILI9341_due library example
|
||||
|
||||
Make sure all the display driver and pin comnenctions are correct by
|
||||
editting the User_Setup.h file in the TFT_eSPI library folder.
|
||||
|
||||
#########################################################################
|
||||
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
// Include the header files that contain the icons
|
||||
#include "Alert.h"
|
||||
#include "Close.h"
|
||||
#include "Info.h"
|
||||
|
||||
long count = 0; // Loop count
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
tft.begin();
|
||||
tft.setRotation(1); // landscape
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
// Swap the colour byte order when rendering
|
||||
tft.setSwapBytes(true);
|
||||
|
||||
// Draw the icons
|
||||
tft.pushImage(100, 100, infoWidth, infoHeight, info);
|
||||
tft.pushImage(140, 100, alertWidth, alertHeight, alert);
|
||||
tft.pushImage(180, 100, closeWidth, closeHeight, closeX);
|
||||
|
||||
// Pause here to admire the icons!
|
||||
delay(2000);
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Loop filling and clearing screen
|
||||
tft.pushImage(random(tft.width() - infoWidth), random(tft.height() - infoHeight), infoWidth, infoHeight, info);
|
||||
tft.pushImage(random(tft.width() - alertWidth), random(tft.height() - alertHeight), alertWidth, alertHeight, alert);
|
||||
tft.pushImage(random(tft.width() - closeWidth), random(tft.height() - closeHeight), alertWidth, closeHeight, closeX);
|
||||
|
||||
// Clear screen after 100 x 3 = 300 icons drawn
|
||||
if (1000 == count++) {
|
||||
count = 1;
|
||||
tft.setRotation(2 * random(2)); // Rotate randomly to clear display left>right or right>left to reduce monotony!
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
/*
|
||||
This sketch has been written to test the Processing screenshot client.
|
||||
|
||||
It has been created to work with the TFT_eSPI library here:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
It sends screenshots to a PC running a Processing client sketch.
|
||||
|
||||
The Processing IDE that will run the client sketch can be downloaded
|
||||
here: https://processing.org/
|
||||
|
||||
The Processing sketch needed is contained within a tab attached to this
|
||||
Arduino sketch. Cut and paste that tab into the Processing IDE and run.
|
||||
Read the Procesing sketch header for instructions.
|
||||
|
||||
This sketch uses the GLCD, 2, 4, 6 fonts only.
|
||||
|
||||
Make sure all the display driver and pin comnenctions are correct by
|
||||
editting the User_Setup.h file in the TFT_eSPI library folder.
|
||||
|
||||
Maximum recommended SPI clock rate is 27MHz when reading pixels, 40MHz
|
||||
seems to be OK with ILI9341 displays but this is above the manufacturers
|
||||
specifed maximum clock rate.
|
||||
|
||||
In the setup file you can define different write and read SPI clock rates
|
||||
|
||||
In the setup file you can define TFT_SDA_READ for a TFT with bi-directional
|
||||
SDA pin (otherwise the normal MISO pin will be used to read from the TFT)
|
||||
|
||||
>>>> NOTE: NOT ALL TFTs SUPPORT READING THE CGRAM (pixel) MEMORY <<<<
|
||||
|
||||
#########################################################################
|
||||
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
// Created by: Bodmer 5/3/17
|
||||
// Updated by: Bodmer 10/3/17
|
||||
// Updated by: Bodmer 23/11/18 to support SDA reads and the ESP32
|
||||
// Version: 0.07
|
||||
|
||||
// MIT licence applies, all text above must be included in derivative works
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
#include <SPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
unsigned long targetTime = 0;
|
||||
byte red = 0x1F;
|
||||
byte green = 0;
|
||||
byte blue = 0;
|
||||
byte state = 0;
|
||||
unsigned int colour = red << 11; // Colour order is RGB 5+6+5 bits each
|
||||
|
||||
void setup(void) {
|
||||
Serial.begin(921600); // Set to a high rate for fast image transfer to a PC
|
||||
|
||||
tft.init();
|
||||
tft.setRotation(0);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
randomSeed(analogRead(A0));
|
||||
|
||||
targetTime = millis() + 1000;
|
||||
}
|
||||
|
||||
#define RGB_TEST false // true produces a simple RGB color test screen
|
||||
|
||||
void loop() {
|
||||
|
||||
if (targetTime < millis()) {
|
||||
if (!RGB_TEST)
|
||||
{
|
||||
targetTime = millis() + 1500; // Wait a minimum of 1.5s
|
||||
|
||||
tft.setRotation(random(4));
|
||||
rainbow_fill(); // Fill the screen with rainbow colours
|
||||
|
||||
tft.setTextColor(TFT_BLACK); // Text background is not defined so it is transparent
|
||||
tft.setTextDatum(TC_DATUM); // Top Centre datum
|
||||
int xpos = tft.width() / 2; // Centre of screen
|
||||
|
||||
tft.setTextFont(0); // Select font 0 which is the Adafruit font
|
||||
tft.drawString("Original Adafruit font!", xpos, 5);
|
||||
|
||||
// The new larger fonts do not need to use the .setCursor call, coords are embedded
|
||||
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
|
||||
|
||||
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
|
||||
tft.drawString("Font size 2", xpos, 14, 2); // Draw text centre at position xpos, 14 using font 2
|
||||
tft.drawString("Font size 4", xpos, 30, 4); // Draw text centre at position xpos, 30 using font 4
|
||||
tft.drawString("12.34", xpos, 54, 6); // Draw text centre at position xpos, 54 using font 6
|
||||
|
||||
tft.drawString("12.34 is in font size 6", xpos, 92, 2); // Draw text centre at position xpos, 92 using font 2
|
||||
// Note the x position is the top of the font!
|
||||
|
||||
// draw a floating point number
|
||||
float pi = 3.1415926; // Value to print
|
||||
int precision = 3; // Number of digits after decimal point
|
||||
|
||||
int ypos = 110; // y position
|
||||
|
||||
tft.setTextDatum(TR_DATUM); // Top Right datum so text butts neatly to xpos (right justified)
|
||||
|
||||
tft.drawFloat(pi, precision, xpos, ypos, 2); // Draw rounded number and return new xpos delta for next print position
|
||||
|
||||
tft.setTextDatum(TL_DATUM); // Top Left datum so text butts neatly to xpos (left justified)
|
||||
|
||||
tft.drawString(" is pi", xpos, ypos, 2);
|
||||
|
||||
tft.setTextSize(1); // We are using a font size multiplier of 1
|
||||
tft.setTextDatum(TC_DATUM); // Top Centre datum
|
||||
tft.setTextColor(TFT_BLACK); // Set text colour to black, no background (so transparent)
|
||||
|
||||
tft.drawString("Transparent...", xpos, 125, 4); // Font 4
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set text colour to white and background to black
|
||||
tft.drawString("White on black", xpos, 150, 4); // Font 4
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK); // This time we will use green text on a black background
|
||||
|
||||
tft.setTextFont(2); // Select font 2, now we do not need to specify the font in drawString()
|
||||
|
||||
// An easier way to position text and blank old text is to set the datum and use width padding
|
||||
tft.setTextDatum(BC_DATUM); // Bottom centre for text datum
|
||||
tft.setTextPadding(tft.width() + 1); // Pad text to full screen width + 1 spare for +/-1 position rounding
|
||||
|
||||
tft.drawString("Ode to a Small Lump of Green Putty", xpos, 230 - 32);
|
||||
tft.drawString("I Found in My Armpit One Midsummer", xpos, 230 - 16);
|
||||
tft.drawString("Morning", xpos, 230);
|
||||
|
||||
tft.setTextDatum(TL_DATUM); // Reset to top left for text datum
|
||||
tft.setTextPadding(0); // Reset text padding to 0 pixels
|
||||
|
||||
// Now call the screen server to send a copy of the TFT screen to the PC running the Processing client sketch
|
||||
screenServer();
|
||||
}
|
||||
else
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.fillRect( 0, 0, 16, 16, TFT_RED);
|
||||
tft.fillRect(16, 0, 16, 16, TFT_GREEN);
|
||||
tft.fillRect(32, 0, 16, 16, TFT_BLUE);
|
||||
screenServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill screen with a rainbow pattern
|
||||
void rainbow_fill()
|
||||
{
|
||||
// The colours and state are not initialised so the start colour changes each time the funtion is called
|
||||
int rotation = tft.getRotation();
|
||||
tft.setRotation(random(4));
|
||||
for (int i = tft.height() - 1; i >= 0; i--) {
|
||||
// This is a "state machine" that ramps up/down the colour brightnesses in sequence
|
||||
switch (state) {
|
||||
case 0:
|
||||
green ++;
|
||||
if (green == 64) {
|
||||
green = 63;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
red--;
|
||||
if (red == 255) {
|
||||
red = 0;
|
||||
state = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
blue ++;
|
||||
if (blue == 32) {
|
||||
blue = 31;
|
||||
state = 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
green --;
|
||||
if (green == 255) {
|
||||
green = 0;
|
||||
state = 4;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
red ++;
|
||||
if (red == 32) {
|
||||
red = 31;
|
||||
state = 5;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
blue --;
|
||||
if (blue == 255) {
|
||||
blue = 0;
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
colour = red << 11 | green << 5 | blue;
|
||||
// Draw a line 1 pixel wide in the selected colour
|
||||
tft.drawFastHLine(0, i, tft.width(), colour); // tft.width() returns the pixel width of the display
|
||||
}
|
||||
tft.setRotation(rotation);
|
||||
}
|
||||
|
|
@ -11,16 +11,14 @@
|
|||
|
||||
// Created by: Bodmer 27/1/17
|
||||
// Updated by: Bodmer 10/3/17
|
||||
// Version: 0.07
|
||||
// Updated by: Bodmer 23/11/18 to support SDA reads and the ESP32
|
||||
// Version: 0.08
|
||||
|
||||
// MIT licence applies, all text above must be included in derivative works
|
||||
|
||||
//====================================================================================
|
||||
// Definitions
|
||||
//====================================================================================
|
||||
#define BAUD_RATE 250000 // Maximum Serial Monitor rate for other messages
|
||||
#define DUMP_BAUD_RATE 921600 // Rate used for screen dumps
|
||||
|
||||
#define PIXEL_TIMEOUT 100 // 100ms Time-out between pixel requests
|
||||
#define START_TIMEOUT 10000 // 10s Maximum time to wait at start transfer
|
||||
|
||||
|
|
@ -33,14 +31,17 @@
|
|||
#define FILE_TYPE "png" // jpg, bmp, png, tif are valid
|
||||
|
||||
// Filename extension
|
||||
// '#' = add 0-9, '@' = add timestamp, '%' add millis() timestamp, '*' = add nothing
|
||||
// '#' = add incrementing number, '@' = add timestamp, '%' add millis() timestamp,
|
||||
// '*' = add nothing
|
||||
// '@' and '%' will generate new unique filenames, so beware of cluttering up your
|
||||
// hard drive with lots of images! The PC client sketch is set to limit the number of
|
||||
// saved images to 1000 and will then prompt for a restart.
|
||||
#define FILE_EXT '%'
|
||||
#define FILE_EXT '@'
|
||||
|
||||
// Number of pixels to send in a burst (minimum of 1), no benefit above 8
|
||||
// NPIXELS values and render times: 1 = 5.0s, 2 = 1.75s, 4 = 1.68s, 8 = 1.67s
|
||||
// NPIXELS values and render times:
|
||||
// NPIXELS 1 = use readPixel() = >5s and 16 bit pixels only
|
||||
// NPIXELS >1 using rectRead() 2 = 1.75s, 4 = 1.68s, 8 = 1.67s
|
||||
#define NPIXELS 8 // Must be integer division of both TFT width and TFT height
|
||||
|
||||
//====================================================================================
|
||||
|
|
@ -60,16 +61,12 @@ boolean screenServer(void)
|
|||
// Start a screen dump server (serial or network) - filename specified
|
||||
boolean screenServer(String filename)
|
||||
{
|
||||
Serial.end(); // Stop the serial port (clears buffers too)
|
||||
Serial.begin(DUMP_BAUD_RATE); // Force baud rate to be high
|
||||
delay(0); // Equivalent to yield() for ESP8266;
|
||||
|
||||
boolean result = serialScreenServer(filename); // Screenshot serial port server
|
||||
//boolean result = wifiScreenServer(filename); // Screenshot WiFi UDP port server (WIP)
|
||||
|
||||
Serial.end(); // Stop the serial port (clears buffers too)
|
||||
Serial.begin(BAUD_RATE); // Return baud rate to normal
|
||||
delay(0); // Equivalent to yield() for ESP8266;
|
||||
delay(0); // Equivalent to yield()
|
||||
|
||||
//Serial.println();
|
||||
//if (result) Serial.println(F("Screen dump passed :-)"));
|
||||
|
|
@ -146,14 +143,20 @@ boolean serialScreenServer(String filename)
|
|||
// Save arrival time of the read command (for later time-out check)
|
||||
lastCmdTime = millis();
|
||||
|
||||
#if defined BITS_PER_PIXEL && BITS_PER_PIXEL >= 24
|
||||
#if defined BITS_PER_PIXEL && BITS_PER_PIXEL >= 24 && NPIXELS > 1
|
||||
// Fetch N RGB pixels from x,y and put in buffer
|
||||
tft.readRectRGB(x, y, NPIXELS, 1, color);
|
||||
// Send buffer to client
|
||||
Serial.write(color, 3 * NPIXELS); // Write all pixels in the buffer
|
||||
#else
|
||||
// Fetch N 565 format pixels from x,y and put in buffer
|
||||
tft.readRect(x, y, NPIXELS, 1, (uint16_t *)color);
|
||||
if (NPIXELS > 1) tft.readRect(x, y, NPIXELS, 1, (uint16_t *)color);
|
||||
else
|
||||
{
|
||||
uint16_t c = tft.readPixel(x, y);
|
||||
color[0] = c>>8;
|
||||
color[1] = c & 0xFF; // Swap bytes
|
||||
}
|
||||
// Send buffer to client
|
||||
Serial.write(color, 2 * NPIXELS); // Write all pixels in the buffer
|
||||
#endif
|
||||
|
|
@ -179,7 +182,8 @@ void sendParameters(String filename)
|
|||
Serial.write(tft.height() & 0xFF);
|
||||
|
||||
Serial.write('Y'); // Bits per pixel (16 or 24)
|
||||
Serial.write(BITS_PER_PIXEL);
|
||||
if (NPIXELS > 1) Serial.write(BITS_PER_PIXEL);
|
||||
else Serial.write(16); // readPixel() only provides 16 bit values
|
||||
|
||||
Serial.write('?'); // Filename next
|
||||
Serial.print(filename);
|
||||
|
|
@ -190,5 +194,3 @@ void sendParameters(String filename)
|
|||
|
||||
Serial.write(*FILE_TYPE); // First character defines file type j,b,p,t
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
Sketch to demonstrate using the print class with smooth fonts
|
||||
that are saved onto an SD Card accessed by the SD library.
|
||||
|
||||
For ESP32 only, GPIO 5 must be used for SD chip select.
|
||||
This method of storing the fonts is NOT compatible with the ESP8266.
|
||||
|
||||
Sketch is written for a 240 x 320 display
|
||||
|
||||
Load the font file onto the root directory of the SD Card. The font files
|
||||
used by this sketch can be found in the Data folder, press Ctrl+K to see it.
|
||||
|
||||
The library supports 16 bit unicode characters:
|
||||
https://en.wikipedia.org/wiki/Unicode_font
|
||||
|
||||
The characters supported are in the in the Basic Multilingal Plane:
|
||||
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
||||
|
||||
Make sure all the display driver and pin connenctions are correct by
|
||||
editting the User_Setup.h file in the TFT_eSPI library folder.
|
||||
|
||||
#########################################################################
|
||||
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
// Font file is stored on SD card
|
||||
#include <SD.h>
|
||||
|
||||
// Graphics and font library
|
||||
#include <TFT_eSPI.h>
|
||||
#include <SPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke library
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Setup
|
||||
// -------------------------------------------------------------------------
|
||||
void setup(void) {
|
||||
Serial.begin(115200); // Used for messages
|
||||
|
||||
// Initialise the SD library before the TFT so the chip select is defined
|
||||
if (!SD.begin()) {
|
||||
Serial.println("Card Mount Failed");
|
||||
return;
|
||||
}
|
||||
uint8_t cardType = SD.cardType();
|
||||
|
||||
if (cardType == CARD_NONE) {
|
||||
Serial.println("No SD card attached");
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.print("SD Card Type: ");
|
||||
if (cardType == CARD_MMC) {
|
||||
Serial.println("MMC");
|
||||
} else if (cardType == CARD_SD) {
|
||||
Serial.println("SDSC");
|
||||
} else if (cardType == CARD_SDHC) {
|
||||
Serial.println("SDHC");
|
||||
} else {
|
||||
Serial.println("UNKNOWN");
|
||||
}
|
||||
|
||||
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
||||
Serial.printf("SD Card Size: %lluMB\n", cardSize);
|
||||
|
||||
// Initialise the TFT after the SD card!
|
||||
tft.init();
|
||||
tft.setRotation(1);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
listDir(SD, "/", 0);
|
||||
|
||||
Serial.println("SD and TFT initialisation done.");
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Main loop
|
||||
// -------------------------------------------------------------------------
|
||||
void loop() {
|
||||
// Wrap test at right and bottom of screen
|
||||
tft.setTextWrap(true, true);
|
||||
|
||||
// Name of font file (library adds leading / and .vlw)
|
||||
String fileName = "Final-Frontier-28";
|
||||
|
||||
// Font and background colour, background colour is used for anti-alias blending
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
// Load the font
|
||||
tft.loadFont(fileName, SD); // Use font stored on SD
|
||||
|
||||
// Display all characters of the font
|
||||
tft.showFont(2000);
|
||||
|
||||
uint32_t dt = millis();
|
||||
|
||||
int count = 100;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
// Set "cursor" at top left corner of display (0,0)
|
||||
// (cursor will move to next line automatically during printing with 'tft.println'
|
||||
// or stay on the line is there is room for the text with tft.print)
|
||||
tft.setCursor(0, 0);
|
||||
|
||||
// Set the font colour to be white with a black background, set text size multiplier to 1
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
// We can now plot text on screen using the "print" class
|
||||
tft.println("Hello World!");
|
||||
|
||||
// Set the font colour to be yellow
|
||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
tft.println(1234.56);
|
||||
|
||||
// Set the font colour to be red
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.println((uint32_t)3735928559, HEX); // Should print DEADBEEF
|
||||
|
||||
// Set the font colour to be green with black background
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.println("Anti-aliased font!");
|
||||
tft.println("");
|
||||
|
||||
// Test some print formatting functions
|
||||
float fnumber = 123.45;
|
||||
|
||||
// Set the font colour to be blue
|
||||
tft.setTextColor(TFT_BLUE, TFT_BLACK);
|
||||
tft.print("Float = "); tft.println(fnumber); // Print floating point number
|
||||
tft.print("Binary = "); tft.println((int)fnumber, BIN); // Print as integer value in binary
|
||||
tft.print("Hexadecimal = "); tft.println((int)fnumber, HEX); // Print as integer number in Hexadecimal
|
||||
}
|
||||
|
||||
Serial.println(millis()-dt);
|
||||
|
||||
// Unload the font to recover used RAM
|
||||
tft.unloadFont();
|
||||
|
||||
delay(10000);
|
||||
}
|
||||
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
|
||||
Serial.printf("Listing directory: %s\n", dirname);
|
||||
|
||||
File root = fs.open(dirname);
|
||||
if(!root){
|
||||
Serial.println("Failed to open directory");
|
||||
return;
|
||||
}
|
||||
if(!root.isDirectory()){
|
||||
Serial.println("Not a directory");
|
||||
return;
|
||||
}
|
||||
|
||||
File file = root.openNextFile();
|
||||
while(file){
|
||||
if(file.isDirectory()){
|
||||
Serial.print(" DIR : ");
|
||||
Serial.println(file.name());
|
||||
if(levels){
|
||||
listDir(fs, file.name(), levels -1);
|
||||
}
|
||||
} else {
|
||||
Serial.print(" FILE: ");
|
||||
Serial.print(file.name());
|
||||
Serial.print(" SIZE: ");
|
||||
Serial.println(file.size());
|
||||
}
|
||||
file = root.openNextFile();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
There are four different methods of plotting anti-aliased fonts to the screen.
|
||||
|
||||
This sketch uses method 1, using tft.print() and tft.println() calls.
|
||||
|
||||
In some cases the sketch shows what can go wrong too, so read the comments!
|
||||
|
||||
The font is rendered WITHOUT a background, but a background colour needs to be
|
||||
set so the anti-aliasing of the character is performed correctly. This is because
|
||||
characters are drawn one by one.
|
||||
|
||||
This method is good for static text that does not change often because changing
|
||||
values may flicker. The text appears at the tft cursor coordinates.
|
||||
|
||||
It is also possible to "print" text directly into a created sprite, for example using
|
||||
spr.println("Hello"); and then push the sprite to the screen. That method is not
|
||||
demonstrated in this sketch.
|
||||
|
||||
*/
|
||||
// The fonts used are in the sketch data folder, press Ctrl+K to view.
|
||||
|
||||
// Upload the fonts and icons to SPIFFS (must set at least 1M for SPIFFS) using the
|
||||
// "Tools" "ESP8266 (or ESP32) Sketch Data Upload" menu option in the IDE.
|
||||
// To add this option follow instructions here for the ESP8266:
|
||||
// https://github.com/esp8266/arduino-esp8266fs-plugin
|
||||
// or for the ESP32:
|
||||
// https://github.com/me-no-dev/arduino-esp32fs-plugin
|
||||
|
||||
// Close the IDE and open again to see the new menu option.
|
||||
|
||||
// A processing sketch to create new fonts can be found in the Tools folder of TFT_eSPI
|
||||
// https://github.com/Bodmer/TFT_eSPI/tree/master/Tools/Create_Smooth_Font/Create_font
|
||||
|
||||
// This sketch uses font files created from the Noto family of fonts:
|
||||
// https://www.google.com/get/noto/
|
||||
|
||||
#define AA_FONT_SMALL "NotoSansBold15"
|
||||
#define AA_FONT_LARGE "NotoSansBold36"
|
||||
|
||||
// Font files are stored in SPIFFS, so load the linbrary
|
||||
#include <FS.h>
|
||||
|
||||
#include <SPI.h>
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
|
||||
void setup(void) {
|
||||
|
||||
Serial.begin(250000);
|
||||
|
||||
tft.begin();
|
||||
|
||||
tft.setRotation(0);
|
||||
|
||||
if (!SPIFFS.begin()) {
|
||||
Serial.println("SPIFFS initialisation failed!");
|
||||
while (1) yield(); // Stay here twiddling thumbs waiting
|
||||
}
|
||||
Serial.println("\r\nSPIFFS available!");
|
||||
|
||||
// ESP32 will crash if any of the fonts are missing
|
||||
bool font_missing = false;
|
||||
if (SPIFFS.exists("/NotoSansBold15.vlw") == false) font_missing = true;
|
||||
if (SPIFFS.exists("/NotoSansBold36.vlw") == false) font_missing = true;
|
||||
|
||||
if (font_missing)
|
||||
{
|
||||
Serial.println("\r\nFont missing in SPIFFS, did you upload it?");
|
||||
while(1) yield();
|
||||
}
|
||||
else Serial.println("\r\nFonts found OK.");
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour AND the background colour
|
||||
// so the anti-aliasing works
|
||||
|
||||
tft.setCursor(0, 0); // Set cursor at top left of screen
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Small font
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
tft.loadFont(AA_FONT_SMALL); // Must load the font first
|
||||
|
||||
tft.println("Small 15pt font"); // println moves cursor down for a new line
|
||||
|
||||
tft.println(); // New line
|
||||
|
||||
tft.print("ABC"); // print leaves cursor at end of line
|
||||
|
||||
tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
tft.println("1234"); // Added to line after ABC
|
||||
|
||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
// print stream formatting can be used,see:
|
||||
// https://www.arduino.cc/en/Serial/Print
|
||||
int ivalue = 1234;
|
||||
tft.println(ivalue); // print as an ASCII-encoded decimal
|
||||
tft.println(ivalue, DEC); // print as an ASCII-encoded decimal
|
||||
tft.println(ivalue, HEX); // print as an ASCII-encoded hexadecimal
|
||||
tft.println(ivalue, OCT); // print as an ASCII-encoded octal
|
||||
tft.println(ivalue, BIN); // print as an ASCII-encoded binary
|
||||
|
||||
tft.println(); // New line
|
||||
tft.setTextColor(TFT_MAGENTA, TFT_BLACK);
|
||||
float fvalue = 1.23456;
|
||||
tft.println(fvalue, 0); // no decimal places
|
||||
tft.println(fvalue, 1); // 1 decimal place
|
||||
tft.println(fvalue, 2); // 2 decimal places
|
||||
tft.println(fvalue, 5); // 5 decimal places
|
||||
|
||||
delay(5000);
|
||||
|
||||
// Get ready for the next demo while we have this font loaded
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(0, 0); // Set cursor at top left of screen
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.println("Wrong and right ways to");
|
||||
tft.println("print changing values...");
|
||||
|
||||
tft.unloadFont(); // Remove the font to recover memory used
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Large font
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
tft.loadFont(AA_FONT_LARGE); // Load another different font
|
||||
|
||||
//tft.fillScreen(TFT_BLACK);
|
||||
|
||||
// Draw changing numbers - does not work unless a filled rectangle is drawn over the old text
|
||||
for (int i = 0; i <= 20; i++)
|
||||
{
|
||||
tft.setCursor(50, 50);
|
||||
tft.print(" "); // Overprinting old number with spaces DOES NOT WORK!
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.setCursor(50, 50);
|
||||
tft.print(i / 10.0, 1);
|
||||
|
||||
tft.fillRect (50, 90, 60, 40, TFT_BLACK); // Overprint with a filled rectangle
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.setCursor(50, 90);
|
||||
tft.print(i / 10.0, 1);
|
||||
|
||||
delay (200);
|
||||
}
|
||||
|
||||
delay(5000);
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Large font text wrapping
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Change the font colour and the background colour
|
||||
|
||||
tft.setCursor(0, 0); // Set cursor at top left of screen
|
||||
|
||||
tft.println("Large font!");
|
||||
|
||||
tft.setTextWrap(true); // Wrap on width
|
||||
tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
tft.println("Long lines wrap to the next line");
|
||||
|
||||
tft.setTextWrap(false, false); // Wrap on width and height switched off
|
||||
tft.setTextColor(TFT_MAGENTA, TFT_BLACK);
|
||||
tft.println("Unless text wrap is switched off");
|
||||
|
||||
tft.unloadFont(); // Remove the font to recover memory used
|
||||
|
||||
delay(8000);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
|
||||
Information notes only:
|
||||
======================
|
||||
|
||||
//These are the text plotting alignment (reference datum point)
|
||||
|
||||
TL_DATUM = Top left (default)
|
||||
TC_DATUM = Top centre
|
||||
TR_DATUM = Top right
|
||||
|
||||
ML_DATUM = Middle left
|
||||
MC_DATUM = Middle centre
|
||||
MR_DATUM = Middle right
|
||||
|
||||
BL_DATUM = Bottom left
|
||||
BC_DATUM = Bottom centre
|
||||
BR_DATUM = Bottom right
|
||||
|
||||
L_BASELINE = Left character baseline (Line the 'A' character would sit on)
|
||||
C_BASELINE = Centre character baseline
|
||||
R_BASELINE = Right character baseline
|
||||
|
||||
// Basic colours already defined:
|
||||
|
||||
TFT_BLACK 0x0000
|
||||
TFT_NAVY 0x000F
|
||||
TFT_DARKGREEN 0x03E0
|
||||
TFT_DARKCYAN 0x03EF
|
||||
TFT_MAROON 0x7800
|
||||
TFT_PURPLE 0x780F
|
||||
TFT_OLIVE 0x7BE0
|
||||
TFT_LIGHTGREY 0xC618
|
||||
TFT_DARKGREY 0x7BEF
|
||||
TFT_BLUE 0x001F
|
||||
TFT_GREEN 0x07E0
|
||||
TFT_CYAN 0x07FF
|
||||
TFT_RED 0xF800
|
||||
TFT_MAGENTA 0xF81F
|
||||
TFT_YELLOW 0xFFE0
|
||||
TFT_WHITE 0xFFFF
|
||||
TFT_ORANGE 0xFDA0
|
||||
TFT_GREENYELLOW 0xB7E0
|
||||
TFT_PINK 0xFC9F
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
There are four different methods of plotting anti-aliased fonts to the screen.
|
||||
|
||||
This sketch uses method 2, using graphics calls plotting direct to the TFT:
|
||||
tft.drawString(string, x, y);
|
||||
tft.drawNumber(integer, x, y);
|
||||
tft.drawFloat(float, dp, x, y); // dp = number of decimal places
|
||||
|
||||
setTextDatum() and setTextPadding() functions work with those draw functions.
|
||||
|
||||
This method is good for static text that does not change often because changing
|
||||
values may flicker.
|
||||
|
||||
*/
|
||||
// The fonts used are in the sketch data folder, press Ctrl+K to view.
|
||||
|
||||
// Upload the fonts and icons to SPIFFS (must set at least 1M for SPIFFS) using the
|
||||
// "Tools" "ESP8266 (or ESP32) Sketch Data Upload" menu option in the IDE.
|
||||
// To add this option follow instructions here for the ESP8266:
|
||||
// https://github.com/esp8266/arduino-esp8266fs-plugin
|
||||
// or for the ESP32:
|
||||
// https://github.com/me-no-dev/arduino-esp32fs-plugin
|
||||
|
||||
// Close the IDE and open again to see the new menu option.
|
||||
|
||||
// A processing sketch to create new fonts can be found in the Tools folder of TFT_eSPI
|
||||
// https://github.com/Bodmer/TFT_eSPI/tree/master/Tools/Create_Smooth_Font/Create_font
|
||||
|
||||
// This sketch uses font files created from the Noto family of fonts:
|
||||
// https://www.google.com/get/noto/
|
||||
|
||||
#define AA_FONT_SMALL "NotoSansBold15"
|
||||
#define AA_FONT_LARGE "NotoSansBold36"
|
||||
|
||||
// Font files are stored in SPIFFS, so load the linbrary
|
||||
#include <FS.h>
|
||||
|
||||
#include <SPI.h>
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
void setup(void) {
|
||||
|
||||
Serial.begin(250000);
|
||||
|
||||
tft.begin();
|
||||
|
||||
tft.setRotation(1);
|
||||
|
||||
if (!SPIFFS.begin()) {
|
||||
Serial.println("SPIFFS initialisation failed!");
|
||||
while (1) yield(); // Stay here twiddling thumbs waiting
|
||||
}
|
||||
Serial.println("\r\nSPIFFS available!");
|
||||
|
||||
// ESP32 will crash if any of the fonts are missing
|
||||
bool font_missing = false;
|
||||
if (SPIFFS.exists("/NotoSansBold15.vlw") == false) font_missing = true;
|
||||
if (SPIFFS.exists("/NotoSansBold36.vlw") == false) font_missing = true;
|
||||
|
||||
if (font_missing)
|
||||
{
|
||||
Serial.println("\r\nFont missing in SPIFFS, did you upload it?");
|
||||
while(1) yield();
|
||||
}
|
||||
else Serial.println("\r\nFonts found OK.");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour and the background colour
|
||||
|
||||
tft.setTextDatum(TC_DATUM); // Top Centre datum
|
||||
|
||||
int xpos = tft.width() / 2; // Half the screen width
|
||||
int ypos = 10;
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Small font
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
tft.loadFont(AA_FONT_SMALL); // Must load the font first
|
||||
|
||||
tft.drawString("Small 15pt font", xpos, ypos);
|
||||
|
||||
ypos += tft.fontHeight(); // Get the font height and move ypos down
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
|
||||
// If the string does not fit the screen width, then the next character will wrap to a new line
|
||||
tft.drawString("Ode To A Small Lump Of Green Putty I Found In My Armpit One Midsummer Morning", xpos, ypos);
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLUE); // Background colour does not match the screen background!
|
||||
tft.drawString("Anti-aliasing causes odd looking shadow effects if the text and screen background colours are not the same!", xpos, ypos + 60);
|
||||
|
||||
tft.unloadFont(); // Remove the font to recover memory used
|
||||
|
||||
delay(5000);
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Large font
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
tft.loadFont(AA_FONT_LARGE); // Load another different font
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLUE); // Change the font colour and the background colour
|
||||
|
||||
tft.drawString("36pt font", xpos, ypos);
|
||||
|
||||
ypos += tft.fontHeight(); // Get the font height and move ypos down
|
||||
|
||||
// Set text padding to 100 pixels wide area to over-write old values on screen
|
||||
tft.setTextPadding(100);
|
||||
|
||||
// Draw changing numbers - likely to flicker using this plot method!
|
||||
for (int i = 0; i <= 20; i++) {
|
||||
tft.drawFloat(i / 10.0, 1, xpos, ypos);
|
||||
delay (200);
|
||||
}
|
||||
|
||||
tft.unloadFont(); // Remove the font to recover memory used
|
||||
|
||||
delay(5000);
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// Setting the 12 datum positions works with free fonts
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
// Integer numbers, floats and strings can be drawn relative to a x,y datum, e.g.:
|
||||
// tft.drawNumber( 123, x, y);
|
||||
// tft.drawFloat( 1.23, dp, x, y); // Where dp is number of decimal places to show
|
||||
// tft.drawString( "Abc", x, y);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.setTextColor(TFT_DARKGREY, TFT_BLACK);
|
||||
|
||||
// Use middle of screen as datum
|
||||
xpos = tft.width() /2;
|
||||
ypos = tft.height()/2;
|
||||
|
||||
tft.loadFont(AA_FONT_SMALL);
|
||||
tft.setTextDatum(TL_DATUM);
|
||||
tft.drawString("[Top left]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(TC_DATUM);
|
||||
tft.drawString("[Top centre]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(TR_DATUM);
|
||||
tft.drawString("[Top right]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(ML_DATUM);
|
||||
tft.drawString("[Middle left]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString("[Middle centre]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(MR_DATUM);
|
||||
tft.drawString("[Middle right]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(BL_DATUM);
|
||||
tft.drawString("[Bottom left]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(BC_DATUM);
|
||||
tft.drawString("[Bottom centre]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(BR_DATUM);
|
||||
tft.drawString("[Bottom right]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(L_BASELINE);
|
||||
tft.drawString("[Left baseline]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(C_BASELINE);
|
||||
tft.drawString("[Centre baseline]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(R_BASELINE);
|
||||
tft.drawString("[Right baseline]", xpos, ypos);
|
||||
drawDatumMarker(xpos, ypos);
|
||||
delay(1000);
|
||||
|
||||
tft.unloadFont(); // Remove the font to recover memory used
|
||||
|
||||
delay(4000);
|
||||
|
||||
}
|
||||
|
||||
// Draw a + mark centred on x,y
|
||||
void drawDatumMarker(int x, int y)
|
||||
{
|
||||
tft.drawLine(x - 5, y, x + 5, y, TFT_GREEN);
|
||||
tft.drawLine(x, y - 5, x, y + 5, TFT_GREEN);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
|
||||
Information notes only:
|
||||
======================
|
||||
|
||||
//These are the text plotting alignment (reference datum point)
|
||||
|
||||
TL_DATUM = Top left (default)
|
||||
TC_DATUM = Top centre
|
||||
TR_DATUM = Top right
|
||||
|
||||
ML_DATUM = Middle left
|
||||
MC_DATUM = Middle centre
|
||||
MR_DATUM = Middle right
|
||||
|
||||
BL_DATUM = Bottom left
|
||||
BC_DATUM = Bottom centre
|
||||
BR_DATUM = Bottom right
|
||||
|
||||
L_BASELINE = Left character baseline (Line the 'A' character would sit on)
|
||||
C_BASELINE = Centre character baseline
|
||||
R_BASELINE = Right character baseline
|
||||
|
||||
// Basic colours already defined:
|
||||
|
||||
TFT_BLACK 0x0000
|
||||
TFT_NAVY 0x000F
|
||||
TFT_DARKGREEN 0x03E0
|
||||
TFT_DARKCYAN 0x03EF
|
||||
TFT_MAROON 0x7800
|
||||
TFT_PURPLE 0x780F
|
||||
TFT_OLIVE 0x7BE0
|
||||
TFT_LIGHTGREY 0xC618
|
||||
TFT_DARKGREY 0x7BEF
|
||||
TFT_BLUE 0x001F
|
||||
TFT_GREEN 0x07E0
|
||||
TFT_CYAN 0x07FF
|
||||
TFT_RED 0xF800
|
||||
TFT_MAGENTA 0xF81F
|
||||
TFT_YELLOW 0xFFE0
|
||||
TFT_WHITE 0xFFFF
|
||||
TFT_ORANGE 0xFDA0
|
||||
TFT_GREENYELLOW 0xB7E0
|
||||
TFT_PINK 0xFC9F
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue