update missing code
This commit is contained in:
parent
05beb5bbd0
commit
8429d05cfd
26
TFT_eSPI.cpp
26
TFT_eSPI.cpp
|
|
@ -189,7 +189,7 @@ bool TFT_eSPI::checkViewport(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||||
x+= _xDatum;
|
x+= _xDatum;
|
||||||
y+= _yDatum;
|
y+= _yDatum;
|
||||||
|
|
||||||
if ((x >= _vpW) || (y >= _vpH)) return false;
|
if ((x >= _vpW) || (y >= _vpH)) return false;
|
||||||
|
|
||||||
int32_t dx = 0;
|
int32_t dx = 0;
|
||||||
int32_t dy = 0;
|
int32_t dy = 0;
|
||||||
|
|
@ -296,7 +296,7 @@ void TFT_eSPI::frameViewport(uint16_t color, int32_t w)
|
||||||
// a large negative width will clear the screen outside the viewport
|
// a large negative width will clear the screen outside the viewport
|
||||||
{
|
{
|
||||||
w = -w;
|
w = -w;
|
||||||
|
|
||||||
// Save old values
|
// Save old values
|
||||||
int32_t _xT = _vpX; _vpX = 0;
|
int32_t _xT = _vpX; _vpX = 0;
|
||||||
int32_t _yT = _vpY; _vpY = 0;
|
int32_t _yT = _vpY; _vpY = 0;
|
||||||
|
|
@ -691,7 +691,13 @@ void TFT_eSPI::init(uint8_t tc)
|
||||||
** Function name: setRotation
|
** Function name: setRotation
|
||||||
** Description: rotate the screen orientation m = 0-3 or 4-7 for BMP drawing
|
** Description: rotate the screen orientation m = 0-3 or 4-7 for BMP drawing
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
void TFT_eSPI::setRotation(uint8_t m)
|
void TFT_eSPI::setRotation(uint8_t m)
|
||||||
|
{
|
||||||
|
setRotation(m, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TFT_eSPI::setRotation(uint8_t m, bool mirror)
|
||||||
{
|
{
|
||||||
|
|
||||||
begin_tft_write();
|
begin_tft_write();
|
||||||
|
|
@ -1894,7 +1900,7 @@ void TFT_eSPI::readRectRGB(int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_
|
||||||
uint8_t* buf565 = data + len;
|
uint8_t* buf565 = data + len;
|
||||||
|
|
||||||
readRect(x0, y0, w, h, (uint16_t*)buf565);
|
readRect(x0, y0, w, h, (uint16_t*)buf565);
|
||||||
|
|
||||||
while (len--) {
|
while (len--) {
|
||||||
uint16_t pixel565 = (*buf565++)<<8;
|
uint16_t pixel565 = (*buf565++)<<8;
|
||||||
pixel565 |= *buf565++;
|
pixel565 |= *buf565++;
|
||||||
|
|
@ -1973,7 +1979,7 @@ void TFT_eSPI::drawCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color)
|
||||||
int32_t xs = -1;
|
int32_t xs = -1;
|
||||||
int32_t xe = 0;
|
int32_t xe = 0;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
do {
|
do {
|
||||||
while (f < 0) {
|
while (f < 0) {
|
||||||
|
|
@ -3231,7 +3237,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||||
x+= _xDatum;
|
x+= _xDatum;
|
||||||
y+= _yDatum;
|
y+= _yDatum;
|
||||||
|
|
||||||
// Range checking
|
// Range checking
|
||||||
if ((x < _vpX) || (y < _vpY) ||(x >= _vpW) || (y >= _vpH)) return;
|
if ((x < _vpX) || (y < _vpY) ||(x >= _vpW) || (y >= _vpH)) return;
|
||||||
|
|
||||||
#ifdef CGRAM_OFFSET
|
#ifdef CGRAM_OFFSET
|
||||||
|
|
@ -3254,7 +3260,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||||
DC_D; tft_Write_16(0);
|
DC_D; tft_Write_16(0);
|
||||||
DC_C; tft_Write_8(TFT_CASET2);
|
DC_C; tft_Write_8(TFT_CASET2);
|
||||||
DC_D; tft_Write_16(175);
|
DC_D; tft_Write_16(175);
|
||||||
|
|
||||||
DC_C; tft_Write_8(TFT_PASET1);
|
DC_C; tft_Write_8(TFT_PASET1);
|
||||||
DC_D; tft_Write_16(0);
|
DC_D; tft_Write_16(0);
|
||||||
DC_C; tft_Write_8(TFT_PASET2);
|
DC_C; tft_Write_8(TFT_PASET2);
|
||||||
|
|
@ -3342,7 +3348,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined (SSD1351_DRIVER) || defined (SSD1963_DRIVER)
|
#if defined (SSD1351_DRIVER) || defined (SSD1963_DRIVER)
|
||||||
if ((rotation & 0x1) == 0) { swap_coord(x, y); }
|
if ((rotation & 0x1) == 0) { swap_coord(x, y); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -3384,7 +3390,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DC_C; tft_Write_8(TFT_RAMWR);
|
DC_C; tft_Write_8(TFT_RAMWR);
|
||||||
|
|
||||||
#if defined(TFT_PARALLEL_8_BIT) || !defined(ESP32)
|
#if defined(TFT_PARALLEL_8_BIT) || !defined(ESP32)
|
||||||
DC_D; tft_Write_16(color);
|
DC_D; tft_Write_16(color);
|
||||||
#else
|
#else
|
||||||
|
|
@ -3899,7 +3905,7 @@ uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc, uint8_t
|
||||||
if (alphaDither < 0) alpha = 0;
|
if (alphaDither < 0) alpha = 0;
|
||||||
if (alphaDither >255) alpha = 255;
|
if (alphaDither >255) alpha = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
return alphaBlend(alpha, fgc, bgc);
|
return alphaBlend(alpha, fgc, bgc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4235,7 +4241,7 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
|
||||||
|
|
||||||
w *= height; // Now w is total number of pixels in the character
|
w *= height; // Now w is total number of pixels in the character
|
||||||
if (textcolor == textbgcolor && !clip) {
|
if (textcolor == textbgcolor && !clip) {
|
||||||
|
|
||||||
int32_t px = 0, py = pY; // To hold character block start and end column and row values
|
int32_t px = 0, py = pY; // To hold character block start and end column and row values
|
||||||
int32_t pc = 0; // Pixel count
|
int32_t pc = 0; // Pixel count
|
||||||
uint8_t np = textsize * textsize; // Number of pixels in a drawn pixel
|
uint8_t np = textsize * textsize; // Number of pixels in a drawn pixel
|
||||||
|
|
|
||||||
23
TFT_eSPI.h
23
TFT_eSPI.h
|
|
@ -277,6 +277,11 @@ const PROGMEM fontinfo fontdata [] = {
|
||||||
#define TFT_SKYBLUE 0x867D /* 135, 206, 235 */
|
#define TFT_SKYBLUE 0x867D /* 135, 206, 235 */
|
||||||
#define TFT_VIOLET 0x915C /* 180, 46, 226 */
|
#define TFT_VIOLET 0x915C /* 180, 46, 226 */
|
||||||
|
|
||||||
|
#define TFT_PORTRAIT 0
|
||||||
|
#define TFT_LANDSCAPE 1
|
||||||
|
#define TFT_PORTRAIT_INVERT 2
|
||||||
|
#define TFT_LANDSCAPE_INVERT 3
|
||||||
|
|
||||||
// Next is a special 16 bit colour value that encodes to 8 bits
|
// Next is a special 16 bit colour value that encodes to 8 bits
|
||||||
// and will then decode back to the same 16 bit value.
|
// and will then decode back to the same 16 bit value.
|
||||||
// Convenient for 8 bit and 16 bit transparent sprites.
|
// Convenient for 8 bit and 16 bit transparent sprites.
|
||||||
|
|
@ -303,15 +308,7 @@ static const uint16_t default_4bit_palette[] PROGMEM = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Section 7: Screen rotation enumeration
|
** Section 7: Diagnostic support
|
||||||
***************************************************************************************/
|
|
||||||
#define TFT_PORTRAIT 0
|
|
||||||
#define TFT_LANDSCAPE 1
|
|
||||||
#define TFT_PORTRAIT_INVERT 2
|
|
||||||
#define TFT_LANDSCAPE_INVERT 3
|
|
||||||
|
|
||||||
/***************************************************************************************
|
|
||||||
** Section 8: Diagnostic support
|
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
// #define TFT_eSPI_DEBUG // Switch on debug support serial messages (not used yet)
|
// #define TFT_eSPI_DEBUG // Switch on debug support serial messages (not used yet)
|
||||||
// #define TFT_eSPI_FNx_DEBUG // Switch on debug support for function "x" (not used yet)
|
// #define TFT_eSPI_FNx_DEBUG // Switch on debug support for function "x" (not used yet)
|
||||||
|
|
@ -377,7 +374,7 @@ int16_t tch_spi_freq;// Touch controller read/write SPI frequency
|
||||||
} setup_t;
|
} setup_t;
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Section 9: Class member and support functions
|
** Section 8: Class member and support functions
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
// Swap any type
|
// Swap any type
|
||||||
template <typename T> static inline void
|
template <typename T> static inline void
|
||||||
|
|
@ -412,7 +409,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||||
width(void);
|
width(void);
|
||||||
|
|
||||||
void setRotation(uint8_t r); // Set the display image orientation to 0, 1, 2 or 3
|
void setRotation(uint8_t r); // Set the display image orientation to 0, 1, 2 or 3
|
||||||
void setRotation(uint8_t r, bool mirror); // Set the display image orientation with mirror option
|
void setRotation(uint8_t r, bool mirror); // Set the display image orientation with mirro flag
|
||||||
uint8_t getRotation(void); // Read the current rotation
|
uint8_t getRotation(void); // Read the current rotation
|
||||||
|
|
||||||
void invertDisplay(bool i); // Tell TFT to invert all displayed colours
|
void invertDisplay(bool i); // Tell TFT to invert all displayed colours
|
||||||
|
|
@ -808,7 +805,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Section 10: TFT_eSPI class conditional extensions
|
** Section 9: TFT_eSPI class conditional extensions
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
// Load the Touch extension
|
// Load the Touch extension
|
||||||
#ifdef TOUCH_CS
|
#ifdef TOUCH_CS
|
||||||
|
|
@ -823,7 +820,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||||
}; // End of class TFT_eSPI
|
}; // End of class TFT_eSPI
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Section 11: Additional extension classes
|
** Section 10: Additional extension classes
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
// Load the Button Class
|
// Load the Button Class
|
||||||
#include "Extensions/Button.h"
|
#include "Extensions/Button.h"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue