Format and code tidy - fixes for compatibility issues

This commit is contained in:
Bodmer 2017-04-14 01:04:04 +01:00
parent e65f4cb1fe
commit d31cbc3dbd
18 changed files with 378 additions and 465 deletions

View File

@ -29,7 +29,6 @@
// Delay between some initialisation commands
#define TFT_INIT_DELAY 0x80
#define DELAY 0x80
// Generic commands used by TFT_eSPI.cpp

View File

@ -11,8 +11,8 @@
static const uint8_t ILI9163_cmds[] PROGMEM =
{
17, // 17 commands follow
0x01, 0, // Software reset
0x11, 0, // Exit sleep mode
0x01, 0 + TFT_INIT_DELAY, 120, // Software reset
//0x11, 0, // Exit sleep mode
0x3A, 1, 0x05, // Set pixel format
0x26, 1, 0x04, // Set Gamma curve
0xF2, 1, 0x01, // Gamma adjustment enabled
@ -26,8 +26,8 @@
0xC1, 1, 0x02, // Power control 2
0xC5, 2, 0x50, 0x5B, // Vcom control 1
0xC7, 1, 0x40, // Vcom offset
0x2A, 4+DELAY, 0x00, 0x00, 0x00, 0x7F, 250, // Set column address
0x2B, 4, 0x00, 0x00, 0x00, 0x9F, // Set page address
0x2A, 4, 0x00, 0x00, 0x00, 0x7F, // Set column address
0x2B, 4 + TFT_INIT_DELAY, 0x00, 0x00, 0x00, 0x9F, 250, // Set page address
0x36, 1, 0xC8, // Set address mode
0x29, 0, // Set display on
};

View File

@ -29,7 +29,6 @@
// Delay between some initialisation commands
#define TFT_INIT_DELAY 0x80
#define DELAY 0x80
// Generic commands used by TFT_eSPI.cpp

View File

@ -24,20 +24,20 @@
0xf8, 1, 0x11, // Gate control
0xf7, 4, 0xc8, 0x20, 0x00, 0x00, // Interface control
0xf3, 2, 0x00, 0x00, // Power sequence control
0x11, DELAY, 50, // Wake
0xf3, 2+DELAY, 0x00, 0x01, 50, // Power sequence control
0xf3, 2+DELAY, 0x00, 0x03, 50, // Power sequence control
0xf3, 2+DELAY, 0x00, 0x07, 50, // Power sequence control
0xf3, 2+DELAY, 0x00, 0x0f, 50, // Power sequence control
0xf4, 15+DELAY, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, 50, // Power control
0xf3, 2+DELAY, 0x00, 0x1f, 50, // Power sequence control
0xf3, 2+DELAY, 0x00, 0x7f, 50, // Power sequence control
0xf3, 2+DELAY, 0x00, 0xff, 50, // Power sequence control
0x11, TFT_INIT_DELAY, 50, // Wake
0xf3, 2+TFT_INIT_DELAY, 0x00, 0x01, 50, // Power sequence control
0xf3, 2+TFT_INIT_DELAY, 0x00, 0x03, 50, // Power sequence control
0xf3, 2+TFT_INIT_DELAY, 0x00, 0x07, 50, // Power sequence control
0xf3, 2+TFT_INIT_DELAY, 0x00, 0x0f, 50, // Power sequence control
0xf4, 15+TFT_INIT_DELAY, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, 50, // Power control
0xf3, 2+TFT_INIT_DELAY, 0x00, 0x1f, 50, // Power sequence control
0xf3, 2+TFT_INIT_DELAY, 0x00, 0x7f, 50, // Power sequence control
0xf3, 2+TFT_INIT_DELAY, 0x00, 0xff, 50, // Power sequence control
0xfd, 11, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x00, 0x01, 0x00, 0x16, 0x16, // Analog parameter control
0xf4, 15, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, // Power control
0x36, 1, 0xC8, // Memory access data control
0x35, 1, 0x00, // Tearing effect line on
0x3a, 1+DELAY, 0x05, 150, // Interface pixel control
0x3a, 1+TFT_INIT_DELAY, 0x05, 150, // Interface pixel control
0x29, 0, // Display on
0x2c, 0 // Memory write
};

View File

@ -66,7 +66,6 @@
// Delay between some initialisation commands
#define TFT_INIT_DELAY 0x80
#define DELAY 0x80
// Generic commands used by TFT_eSPI.cpp

View File

@ -11,14 +11,14 @@
static const uint8_t PROGMEM
Bcmd[] = { // Initialization commands for 7735B screens
18, // 18 commands in list:
ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
ST7735_SWRESET, TFT_INIT_DELAY, // 1: Software reset, no args, w/delay
50, // 50 ms delay
ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
ST7735_SLPOUT , TFT_INIT_DELAY, // 2: Out of sleep mode, no args, w/delay
255, // 255 = 500 ms delay
ST7735_COLMOD , 1+DELAY, // 3: Set color mode, 1 arg + delay:
ST7735_COLMOD , 1+TFT_INIT_DELAY, // 3: Set color mode, 1 arg + delay:
0x05, // 16-bit color
10, // 10 ms delay
ST7735_FRMCTR1, 3+DELAY, // 4: Frame rate control, 3 args + delay:
ST7735_FRMCTR1, 3+TFT_INIT_DELAY, // 4: Frame rate control, 3 args + delay:
0x00, // fastest refresh
0x06, // 6 lines front porch
0x03, // 3 lines back porch
@ -31,7 +31,7 @@
0x02, // Fix on VTL
ST7735_INVCTR , 1 , // 7: Display inversion control, 1 arg:
0x0, // Line inversion
ST7735_PWCTR1 , 2+DELAY, // 8: Power control, 2 args + delay:
ST7735_PWCTR1 , 2+TFT_INIT_DELAY, // 8: Power control, 2 args + delay:
0x02, // GVDD = 4.7V
0x70, // 1.0uA
10, // 10 ms delay
@ -40,7 +40,7 @@
ST7735_PWCTR3 , 2 , // 10: Power control, 2 args, no delay:
0x01, // Opamp current small
0x02, // Boost frequency
ST7735_VMCTR1 , 2+DELAY, // 11: Power control, 2 args + delay:
ST7735_VMCTR1 , 2+TFT_INIT_DELAY, // 11: Power control, 2 args + delay:
0x3C, // VCOMH = 4V
0x38, // VCOML = -1.1V
10, // 10 ms delay
@ -51,7 +51,7 @@
0x21, 0x1B, 0x13, 0x19, // these config values represent)
0x17, 0x15, 0x1E, 0x2B,
0x04, 0x05, 0x02, 0x0E,
ST7735_GMCTRN1,16+DELAY, // 14: Sparkles and rainbows, 16 args + delay:
ST7735_GMCTRN1,16+TFT_INIT_DELAY, // 14: Sparkles and rainbows, 16 args + delay:
0x0B, 0x14, 0x08, 0x1E, // (ditto)
0x22, 0x1D, 0x18, 0x1E,
0x1B, 0x1A, 0x24, 0x2B,
@ -63,16 +63,16 @@
ST7735_RASET , 4 , // 16: Row addr set, 4 args, no delay:
0x00, 0x02, // XSTART = 1
0x00, 0x81, // XEND = 160
ST7735_NORON , DELAY, // 17: Normal display on, no args, w/delay
ST7735_NORON , TFT_INIT_DELAY, // 17: Normal display on, no args, w/delay
10, // 10 ms delay
ST7735_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
ST7735_DISPON , TFT_INIT_DELAY, // 18: Main screen turn on, no args, w/delay
255 }, // 255 = 500 ms delay
Rcmd1[] = { // Init for 7735R, part 1 (red or green tab)
15, // 15 commands in list:
ST7735_SWRESET, DELAY, // 1: Software reset, 0 args, w/delay
ST7735_SWRESET, TFT_INIT_DELAY, // 1: Software reset, 0 args, w/delay
150, // 150 ms delay
ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, 0 args, w/delay
ST7735_SLPOUT , TFT_INIT_DELAY, // 2: Out of sleep mode, 0 args, w/delay
255, // 500 ms delay
ST7735_FRMCTR1, 3 , // 3: Frame rate ctrl - normal mode, 3 args:
0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
@ -135,9 +135,9 @@
0x2E, 0x2C, 0x29, 0x2D,
0x2E, 0x2E, 0x37, 0x3F,
0x00, 0x00, 0x02, 0x10,
ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay
ST7735_NORON , TFT_INIT_DELAY, // 3: Normal display on, no args, w/delay
10, // 10 ms delay
ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
ST7735_DISPON , TFT_INIT_DELAY, // 4: Main screen turn on, no args w/delay
100 }; // 100 ms delay
tabcolor = TAB_COLOUR;

View File

@ -91,7 +91,6 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
}
#endif
_width = w; // Set by specific xxxxx_Defines.h file or by users sketch
_height = h; // Set by specific xxxxx_Defines.h file or by users sketch
rotation = 0;
@ -168,14 +167,17 @@ void TFT_eSPI::init(void)
SPI.begin(); // This will set MISO to input
#ifndef SUPPORT_TRANSACTIONS
#ifdef SET_SPI_TO_LSB_FIRST
SPI.setBitOrder(LSBFIRST);
#else
SPI.setBitOrder(MSBFIRST);
#endif
SPI.setDataMode(SPI_MODE0);
//SPI.setHwCs(1); // Use hardware SS toggling on GPIO15 (D8) - not supported - benefit is only ~0.8% performance boost
SPI.setFrequency(SPI_FREQUENCY);
#endif
// SPI1U1 |= SPIUSIO; // Single I/O pin on MOSI (bi-directional) - do not use, not working as expected
@ -227,6 +229,7 @@ void TFT_eSPI::init(void)
#elif defined (RPI_ILI9486_DRIVER)
#include "TFT_Drivers/RPI_ILI9486_Init.h"
#endif
spi_end();
@ -1330,24 +1333,6 @@ spi_begin();
yo16 = yo;
}
// Todo: Add character clipping here
// NOTE: THERE IS NO 'BACKGROUND' COLOR OPTION ON CUSTOM FONTS.
// THIS IS ON PURPOSE AND BY DESIGN. The background color feature
// has typically been used with the 'classic' font to overwrite old
// screen contents with new data. This ONLY works because the
// characters are a uniform size; it's not a sensible thing to do with
// proportionally-spaced fonts with glyphs of varying sizes (and that
// may overlap). To replace previously-drawn text when using a custom
// font, use the getTextBounds() function to determine the smallest
// rectangle encompassing a string, erase the area with fillRect(),
// then draw new text. This WILL infortunately 'blink' the text, but
// is unavoidable. Drawing 'background' pixels will NOT fix this,
// only creates a new set of problems. Have an idea to work around
// this (a canvas object type for MCUs that can afford the RAM and
// displays supporting setAddrWindow() and pushColors()), but haven't
// implemented this yet.
// Here we have 3 versions of the same function just for evaluation purposes
// Comment out the next two #defines to revert to the slower Adafruit implementation
@ -1633,37 +1618,27 @@ inline void TFT_eSPI::setAddrWindow(int32_t x0, int32_t y0, int32_t x1, int32_t
// Column addr set
DC_C;
//SPI.write16(TFT_CASET);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = TFT_CASET<<(CMD_BITS + 1 - 8);
SPI1CMD |= SPIBUSY;
addr_col = 0xFFFF;
addr_col = 0xFFFF; // Use the waiting time to do something useful
addr_row = 0xFFFF;
while(SPI1CMD & SPIBUSY) {}
DC_D;
//SPI.write16(x >> 8); // Not tested on ESP32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x0 >> 0;
SPI1CMD |= SPIBUSY;
x0 = x0 << 8;
x0 = x0 << 8; // Use the waiting time to do something useful
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(x);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x0;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(x >> 8);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x1 >> 0;
SPI1CMD |= SPIBUSY;
x1 = x1 << 8;
x1 = x1 << 8; // Use the waiting time to do something useful
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(x);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x1;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
@ -1671,35 +1646,25 @@ inline void TFT_eSPI::setAddrWindow(int32_t x0, int32_t y0, int32_t x1, int32_t
// Row addr set
DC_C;
//SPI.write16(TFT_PASET);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = TFT_PASET<<(CMD_BITS + 1 - 8);
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
DC_D;
//SPI.write16(y >> 8); // Not tested on ESP32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y0 >> 0;
SPI1CMD |= SPIBUSY;
y0 = y0 << 8;
y0 = y0 << 8; // Use the waiting time to do something useful
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(y);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y0;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(y >> 8);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y1 >> 0;
SPI1CMD |= SPIBUSY;
y1 = y1 << 8;
y1 = y1 << 8; // Use the waiting time to do something useful
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(y);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y1;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
@ -1715,51 +1680,7 @@ inline void TFT_eSPI::setAddrWindow(int32_t x0, int32_t y0, int32_t x1, int32_t
spi_end();
}
/*
inline void TFT_eSPI::setAddrWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
{
spi_begin();
addr_col = 0xFFFF;
addr_row = 0xFFFF;
// Column addr set
DC_C;
CS_L;
SPI.write16(TFT_CASET);
DC_D;
SPI.write16(x0 >> 8); // Not tested on ESP32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SPI.write16(x0);
SPI.write16(x1 >> 8);
SPI.write16(x1);
// Row addr set
DC_C;
SPI.write16(TFT_PASET);
DC_D;
SPI.write16(y0 >> 8); // Not tested on ESP32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SPI.write16(y0);
SPI.write16(y1 >> 8);
SPI.write16(y1);
// write to RAM
DC_C;
SPI.write16(TFT_RAMWR);
DC_D;
spi_end();
}
*/
#else
inline void TFT_eSPI::setAddrWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
@ -2045,33 +1966,23 @@ void TFT_eSPI::drawPixel(uint32_t x, uint32_t y, uint32_t color)
if (addr_col != x) {
DC_C;
//SPI.write16(TFT_CASET);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = TFT_CASET<<(CMD_BITS + 1 - 8);
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
DC_D;
//SPI.write16(x >> 8); // Not tested on ESP32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x >> 0;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(x);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x << 8;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(x >> 8);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x >> 0;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(x);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = x << 8;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
@ -2083,33 +1994,23 @@ void TFT_eSPI::drawPixel(uint32_t x, uint32_t y, uint32_t color)
if (addr_row != y) {
DC_C;
//SPI.write16(TFT_PASET);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = TFT_PASET<<(CMD_BITS + 1 - 8);
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
DC_D;
//SPI.write16(y >> 8); // Not tested on ESP32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y >> 0;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(y);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y << 8;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(y >> 8);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y >> 0;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
//DC_D; // Small delay
//SPI.write16(y);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = y << 8;
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
@ -2119,16 +2020,12 @@ void TFT_eSPI::drawPixel(uint32_t x, uint32_t y, uint32_t color)
DC_C;
//SPI.write16(TFT_RAMWR);
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = TFT_RAMWR<<(CMD_BITS + 1 - 8);
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
DC_D;
//SPI.write16((color));// >> 8) | (color << 8));
//SPI1U1 = mask | (CMD_BITS << SPILMOSI) | (CMD_BITS << SPILMISO);
SPI1W0 = (color >> 8) | (color << 8);
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
@ -2484,7 +2381,9 @@ void TFT_eSPI::drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color)
spi_end();
}
#else
void TFT_eSPI::drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color)
{
// Rudimentary clipping
@ -2533,7 +2432,9 @@ void TFT_eSPI::drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color)
spi_end();
}
#else
void TFT_eSPI::drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color)
{
// Rudimentary clipping
@ -2582,7 +2483,9 @@ void TFT_eSPI::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t col
spi_end();
}
#else
void TFT_eSPI::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
{
// rudimentary clipping (drawChar w/big text requires this)
@ -3057,7 +2960,7 @@ int16_t TFT_eSPI::drawString(const char *string, int poX, int poY, int font)
int16_t sumX = 0;
uint8_t padding = 1, baseline = 0;
uint16_t cwidth = textWidth(string, font); // Find the pixel width of the string in the font
uint16_t cheight = 0;
uint16_t cheight = 8;
#ifdef LOAD_GFXFF
if (font == 1) {
@ -3152,7 +3055,7 @@ int16_t TFT_eSPI::drawString(const char *string, int poX, int poY, int font)
uint8_t c2 = *string - pgm_read_byte(&gfxFont->first);
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c2]);
xo = pgm_read_byte(&glyph->xOffset) * textsize;
// Adjust for negative xOffset, also see line 2708 below
// Adjust for negative xOffset, also see line 3095 below
//if (xo < 0)
cwidth -= xo;
// Add 1 pixel of padding all round
@ -3231,7 +3134,6 @@ int16_t TFT_eSPI::drawString(const char *string, int poX, int poY, int font)
#endif
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DEBUG ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return sumX;
}
@ -3383,8 +3285,8 @@ int16_t TFT_eSPI::drawFloat(float floatNumber, int dp, int poX, int poY, int fon
#ifdef LOAD_GFXFF
void TFT_eSPI::setFreeFont(const GFXfont *f) {
//textdatum = L_BASELINE;
void TFT_eSPI::setFreeFont(const GFXfont *f)
{
textfont = 1;
gfxFont = (GFXfont *)f;
@ -3401,18 +3303,6 @@ void TFT_eSPI::setFreeFont(const GFXfont *f) {
int8_t bb = pgm_read_byte(&glyph1->height) - ab;
if (bb > glyph_bb) glyph_bb = bb;
}
//Serial.print("new glyph_ab=");Serial.println(glyph_ab);
//Serial.print("new glyph_bb=");Serial.println(glyph_bb);
// Save above baseline (for say H) and below baseline (for y tail) heights
//uint16_t uniCode = FF_HEIGHT - pgm_read_byte(&gfxFont->first);
//GFXglyph *glyph1 = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[uniCode]);
//glyph_ab = -pgm_read_byte(&glyph1->yOffset);
//uniCode = FF_BOTTOM - pgm_read_byte(&gfxFont->first);
//GFXglyph *glyph2 = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[uniCode]);
//glyph_bb = pgm_read_byte(&glyph2->height) + (int8_t)pgm_read_byte(&glyph2->yOffset);
//Serial.print("glyph_ab=");Serial.println(glyph_ab);
//Serial.print("glyph_bb=");Serial.println(glyph_bb);
}
@ -3435,7 +3325,8 @@ void TFT_eSPI::setTextFont(uint8_t f)
***************************************************************************************/
// Alternative to setTextFont() so we don't need two different named functions
void TFT_eSPI::setFreeFont(uint8_t font) {
void TFT_eSPI::setFreeFont(uint8_t font)
{
setTextFont(font);
}

View File

@ -125,10 +125,14 @@
// ##################################################################################
//
// Section 4. Not used section
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -29,8 +29,6 @@
/////////////////////////////////////////////////////////////////////////////////////
// //
// DON'T TINKER WITH ANY OF THE FOLLOWING LINES, THESE ADD THE TFT DRIVERS //
@ -38,6 +36,7 @@
// //
/////////////////////////////////////////////////////////////////////////////////////
// Load the right driver definition - do not tinker here !
#if defined (ILI9341_DRIVER)
#include <TFT_Drivers/ILI9341_Defines.h>
@ -50,3 +49,18 @@
#elif defined (RPI_ILI9486_DRIVER)
#include <TFT_Drivers/RPI_ILI9486_Defines.h>
#endif
// Define the pins if needed (See Section 4 of User_Setup.h)
#ifdef DEFINE_DX_PINS
#define D0 16
#define D1 5
#define D2 4
#define D3 0
#define D4 2
#define D5 14
#define D6 12
#define D7 13
#define D8 15
#define D9 3
#define D10 1
#endif

View File

@ -114,13 +114,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -120,13 +120,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -103,13 +103,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -103,13 +103,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -125,13 +125,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -125,13 +125,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -121,13 +121,14 @@
// ##################################################################################
//
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
// Section 4. Define Dx pin allocations if needed
//
// ##################################################################################
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
// Some board selections do not include the Dx format of the NodeMCU so
// uncomment the next line to ensure they are defined.
// #define DEFINE_DX_PINS
// ##################################################################################
//

View File

@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "0.16.1",
"version": "0.16.2",
"keywords": "ILI9341, ST7735, ESP8266, TFT",
"description": "A TFT SPI graphics library for ESP8266",
"repository":

View File

@ -1,5 +1,5 @@
name=TFT_eSPI
version=0.16.1
version=0.16.2
author=Bodmer
maintainer=Bodmer
sentence=A fast TFT library for ESP8266 processors and the Arduino IDE