Update TFT_eSPI to v2.5.43
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Issue template
|
||||
about: Guide to content
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Only raise issues for problems with the library and/or provided examples. Post questions, comments and useful tips etc in the "Discussions" section.
|
||||
|
||||
To minimise effort to resolve issues the following should be provided as a minimum:
|
||||
1. A description of the problem and the conditions that cause it to occur
|
||||
2. IDE (e.g. Arduino or PlatformIO)
|
||||
3. TFT_eSPI library version (try the latest, the problem may have been resolved!) from the Manage Libraries... menu
|
||||
4. Board package version (e.g. 2.0.3) available from the Boards Manager... menu
|
||||
5. Procesor, e.g RP2040, ESP32 S3 etc
|
||||
6. TFT driver (e.g. ILI9341), a link to the vendors product web page is useful too.
|
||||
7. Interface type (SPI or parallel)
|
||||
|
||||
Plus further information as appropriate to the problem:
|
||||
1. TFT to processor connections used
|
||||
2. A zip file containing your setup file (just drag and drop in message window - do not paste in long files!)
|
||||
3. A zip file containing a simple and complete example sketch that demonstrates the problem but needs no special hardware sensors or libraries.
|
||||
4. Screen shot pictures showing the problem (just drag and drop in message window)
|
||||
|
||||
The idea is to provide sufficient information so I can setup the exact same (or sufficiently similar) scenario to investigate and resolve the issue without having a tedious ping-pong of Q&A.
|
||||
|
||||
DO NOT paste code directly into the issue. To correctly format code put three ticks ( ` character on key next to "1" key) at the start and end of short pasted code segments to avoid format/markup anomolies. [See here:](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code)
|
||||
|
||||
Example output:
|
||||
|
||||
```
|
||||
Serial.begin(115200);
|
||||
tft.init();
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
{"type": "library", "name": "TFT_eSPI", "version": "2.5.43", "spec": {"owner": "bodmer", "id": 1559, "name": "TFT_eSPI", "requirements": null, "uri": null}}
|
||||
@@ -48,7 +48,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
6. Descent in pixels from baseline to bottom of "p"
|
||||
|
||||
Next are gCount sets of values for each glyph, each set comprises 7 int32t parameters (28 bytes):
|
||||
1. Glyph Unicode stored as a 32 bit value
|
||||
1. Glyph Unicode stored as a 32-bit value
|
||||
2. Height of bitmap bounding box
|
||||
3. Width of bitmap bounding box
|
||||
4. gxAdvance for cursor (setWidth in Processing)
|
||||
@@ -57,7 +57,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
7. padding value, typically 0
|
||||
|
||||
The bitmaps start next at 24 + (28 * gCount) bytes from the start of the file.
|
||||
Each pixel is 1 byte, an 8 bit Alpha value which represents the transparency from
|
||||
Each pixel is 1 byte, an 8-bit Alpha value which represents the transparency from
|
||||
0xFF foreground colour, 0x00 background. The library uses a linear interpolation
|
||||
between the foreground and background RGB component colours. e.g.
|
||||
pixelRed = ((fgRed * alpha) + (bgRed * (255 - alpha))/255
|
||||
@@ -158,7 +158,7 @@ void TFT_eSPI::loadMetrics(void)
|
||||
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||
if ( psramFound() )
|
||||
{
|
||||
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)ps_malloc( gFont.gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)ps_malloc( gFont.gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)ps_malloc( gFont.gCount ); // xAdvance - to move x cursor
|
||||
@@ -169,7 +169,7 @@ void TFT_eSPI::loadMetrics(void)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)malloc( gFont.gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)malloc( gFont.gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)malloc( gFont.gCount ); // xAdvance - to move x cursor
|
||||
@@ -308,7 +308,7 @@ void TFT_eSPI::unloadFont( void )
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: readInt32
|
||||
** Description: Get a 32 bit integer from the font file
|
||||
** Description: Get a 32-bit integer from the font file
|
||||
*************************************************************************************x*/
|
||||
uint32_t TFT_eSPI::readInt32(void)
|
||||
{
|
||||
@@ -316,18 +316,18 @@ uint32_t TFT_eSPI::readInt32(void)
|
||||
|
||||
#ifdef FONT_FS_AVAILABLE
|
||||
if (fs_font) {
|
||||
val = fontFile.read() << 24;
|
||||
val |= fontFile.read() << 16;
|
||||
val |= fontFile.read() << 8;
|
||||
val |= fontFile.read();
|
||||
val = (uint32_t)fontFile.read() << 24;
|
||||
val |= (uint32_t)fontFile.read() << 16;
|
||||
val |= (uint32_t)fontFile.read() << 8;
|
||||
val |= (uint32_t)fontFile.read();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
val = pgm_read_byte(fontPtr++) << 24;
|
||||
val |= pgm_read_byte(fontPtr++) << 16;
|
||||
val |= pgm_read_byte(fontPtr++) << 8;
|
||||
val |= pgm_read_byte(fontPtr++);
|
||||
val = (uint32_t)pgm_read_byte(fontPtr++) << 24;
|
||||
val |= (uint32_t)pgm_read_byte(fontPtr++) << 16;
|
||||
val |= (uint32_t)pgm_read_byte(fontPtr++) << 8;
|
||||
val |= (uint32_t)pgm_read_byte(fontPtr++);
|
||||
}
|
||||
|
||||
return val;
|
||||
|
||||
@@ -47,7 +47,7 @@ TFT_eSprite::TFT_eSprite(TFT_eSPI *tft)
|
||||
** Function name: createSprite
|
||||
** Description: Create a sprite (bitmap) of defined width and height
|
||||
***************************************************************************************/
|
||||
// cast returned value to (uint8_t*) for 8 bit or (uint16_t*) for 16 bit colours
|
||||
// cast returned value to (uint8_t*) for 8-bit or (uint16_t*) for 16-bit colours
|
||||
void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
{
|
||||
|
||||
@@ -88,8 +88,6 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
_img8_2 = _img8 + (w * h + 1);
|
||||
}
|
||||
|
||||
if ( (_bpp == 4) && (_colorMap == nullptr)) createPalette(default_4bit_palette);
|
||||
|
||||
// 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) && (frames > 1) )
|
||||
@@ -101,6 +99,8 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
if (_img8)
|
||||
{
|
||||
_created = true;
|
||||
if ( (_bpp == 4) && (_colorMap == nullptr)) createPalette(default_4bit_palette);
|
||||
|
||||
rotation = 0;
|
||||
setViewport(0, 0, _dwidth, _dheight);
|
||||
setPivot(_iwidth/2, _iheight/2);
|
||||
@@ -1104,7 +1104,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_
|
||||
}
|
||||
else if (_bpp == 4)
|
||||
{
|
||||
// The image is assumed to be 4 bit, where each byte corresponds to two pixels.
|
||||
// The image is assumed to be 4-bit, where each byte corresponds to two pixels.
|
||||
// much faster when aligned to a byte boundary, because the alternative is slower, requiring
|
||||
// tedious bit operations.
|
||||
|
||||
@@ -1355,10 +1355,10 @@ void TFT_eSprite::writeColor(uint16_t color)
|
||||
{
|
||||
if (!_created ) return;
|
||||
|
||||
// Write 16 bit RGB 565 encoded colour to RAM
|
||||
// Write 16-bit RGB 565 encoded colour to RAM
|
||||
if (_bpp == 16) _img [_xptr + _yptr * _iwidth] = color;
|
||||
|
||||
// Write 8 bit RGB 332 encoded colour to RAM
|
||||
// Write 8-bit RGB 332 encoded colour to RAM
|
||||
else if (_bpp == 8) _img8[_xptr + _yptr * _iwidth] = (uint8_t) color;
|
||||
|
||||
else if (_bpp == 4)
|
||||
@@ -1985,10 +1985,6 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
{
|
||||
if ( _vpOoB || !_created ) return;
|
||||
|
||||
if ((x >= _vpW - _xDatum) || // Clip right
|
||||
(y >= _vpH - _yDatum)) // Clip bottom
|
||||
return;
|
||||
|
||||
if (c < 32) return;
|
||||
#ifdef LOAD_GLCD
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
@@ -1997,10 +1993,17 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
#endif
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
|
||||
if ((x >= _vpW - _xDatum) || // Clip right
|
||||
(y >= _vpH - _yDatum)) // Clip bottom
|
||||
return;
|
||||
|
||||
if (((x + 6 * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
return;
|
||||
|
||||
if (c > 255) return;
|
||||
if (!_cp437 && c > 175) c++;
|
||||
|
||||
bool fillbg = (bg != color);
|
||||
|
||||
if ((size==1) && fillbg)
|
||||
@@ -2135,7 +2138,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: drawChar
|
||||
** Description: draw a unicode glyph into the sprite
|
||||
** Description: draw a Unicode glyph into the sprite
|
||||
***************************************************************************************/
|
||||
// TODO: Rationalise with TFT_eSPI
|
||||
// Any UTF-8 decoding must be done before calling drawChar()
|
||||
@@ -2287,7 +2290,7 @@ int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t fo
|
||||
|
||||
uint8_t tnp = 0; // Temporary copy of np for while loop
|
||||
uint8_t ts = textsize - 1; // Temporary copy of textsize
|
||||
// 16 bit pixel count so maximum font size is equivalent to 180x180 pixels in area
|
||||
// 16-bit pixel count so maximum font size is equivalent to 180x180 pixels in area
|
||||
// w is total number of pixels to plot to fill character block
|
||||
while (pc < w) {
|
||||
line = pgm_read_byte((uint8_t *)flash_address);
|
||||
|
||||
@@ -13,12 +13,12 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
~TFT_eSprite(void);
|
||||
|
||||
// Create a sprite of width x height pixels, return a pointer to the RAM area
|
||||
// Sketch can cast returned value to (uint16_t*) for 16 bit depth if needed
|
||||
// Sketch can cast returned value to (uint16_t*) for 16-bit depth if needed
|
||||
// RAM required is:
|
||||
// - 1 bit per pixel for 1 bit colour depth
|
||||
// - 1 nibble per pixel for 4 bit colour (with palette table)
|
||||
// - 1 byte per pixel for 8 bit colour (332 RGB format)
|
||||
// - 2 bytes per pixel for 16 bit color depth (565 RGB format)
|
||||
// - 1 nibble per pixel for 4-bit colour (with palette table)
|
||||
// - 1 byte per pixel for 8-bit colour (332 RGB format)
|
||||
// - 2 bytes per pixel for 16-bit color depth (565 RGB format)
|
||||
void* createSprite(int16_t width, int16_t height, uint8_t frames = 1);
|
||||
|
||||
// Returns a pointer to the sprite or nullptr if not created, user must cast to pointer type
|
||||
@@ -39,7 +39,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
void* setColorDepth(int8_t b);
|
||||
int8_t getColorDepth(void);
|
||||
|
||||
// Set the palette for a 4 bit depth sprite. Only the first 16 colours in the map are used.
|
||||
// Set the palette for a 4-bit depth sprite. Only the first 16 colours in the map are used.
|
||||
void createPalette(uint16_t *palette = nullptr, uint8_t colors = 16); // Palette in RAM
|
||||
void createPalette(const uint16_t *palette = nullptr, uint8_t colors = 16); // Palette in FLASH
|
||||
|
||||
@@ -61,14 +61,14 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Fill Sprite with a colour
|
||||
fillSprite(uint32_t color),
|
||||
|
||||
// Define a window to push 16 bit colour pixels into in a raster order
|
||||
// Define a window to push 16-bit colour pixels into in a raster order
|
||||
// Colours are converted to the set Sprite colour bit depth
|
||||
setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1),
|
||||
// Push a color (aka singe pixel) to the sprite's set window area
|
||||
pushColor(uint16_t color),
|
||||
// Push len colors (pixels) to the sprite's set window area
|
||||
pushColor(uint16_t color, uint32_t len),
|
||||
// Push a pixel pre-formatted as a 1, 4, 8 or 16 bit colour (avoids conversion overhead)
|
||||
// Push a pixel pre-formatted as a 1, 4, 8 or 16-bit colour (avoids conversion overhead)
|
||||
writeColor(uint16_t color),
|
||||
|
||||
// Set the scroll zone, top left corner at x,y with defined width and height
|
||||
@@ -139,7 +139,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
height(void);
|
||||
|
||||
// Functions associated with anti-aliased fonts
|
||||
// Draw a single unicode character using the loaded font
|
||||
// Draw a single Unicode character using the loaded font
|
||||
void drawGlyph(uint16_t code);
|
||||
// Print string to sprite using loaded font at cursor position
|
||||
void printToSprite(String string);
|
||||
@@ -162,13 +162,13 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
protected:
|
||||
|
||||
uint8_t _bpp; // bits per pixel (1, 4, 8 or 16)
|
||||
uint16_t *_img; // pointer to 16 bit sprite
|
||||
uint8_t *_img8; // pointer to 1 and 8 bit sprite frame 1 or frame 2
|
||||
uint8_t *_img4; // pointer to 4 bit sprite (uses color map)
|
||||
uint16_t *_img; // pointer to 16-bit sprite
|
||||
uint8_t *_img8; // pointer to 1 and 8-bit sprite frame 1 or frame 2
|
||||
uint8_t *_img4; // pointer to 4-bit sprite (uses color map)
|
||||
uint8_t *_img8_1; // pointer to frame 1
|
||||
uint8_t *_img8_2; // pointer to frame 2
|
||||
|
||||
uint16_t *_colorMap; // color map pointer: 16 entries, used with 4 bit color map.
|
||||
uint16_t *_colorMap; // color map pointer: 16 entries, used with 4-bit color map.
|
||||
|
||||
int32_t _sinra; // Sine of rotation angle in fixed point
|
||||
int32_t _cosra; // Cosine of rotation angle in fixed point
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
|
||||
// See license in root directory.
|
||||
|
||||
// Define a default pressure threshold
|
||||
#ifndef Z_THRESHOLD
|
||||
#define Z_THRESHOLD 350 // Touch pressure threshold for validating touches
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: begin_touch_read_write - was spi_begin_touch
|
||||
** Description: Start transaction and select touch controller
|
||||
@@ -161,7 +166,6 @@ uint8_t TFT_eSPI::validTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
||||
** Function name: getTouch
|
||||
** Description: read callibrated position. Return false if not pressed.
|
||||
***************************************************************************************/
|
||||
#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;
|
||||
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
// Get the screen touch coordinates, returns true if screen has been touched
|
||||
// if the touch coordinates are off screen then x and y are not updated
|
||||
// The returned value can be treated as a bool type, false or 0 means touch not detected
|
||||
// In future the function may return an 8 "quality" (jitter) value.
|
||||
// In future the function may return an 8-bit "quality" (jitter) value.
|
||||
// The threshold value is optional, this must be higher than the bias level for z (pressure)
|
||||
// reported by Test_Touch_Controller when the screen is NOT touched. When touched the z value
|
||||
// must be higher than the threshold for a touch to be detected.
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Font 4
|
||||
//
|
||||
// This font has been 8 bit Run Length Encoded to save FLASH space
|
||||
// This font has been 8-bit Run Length Encoded to save FLASH space
|
||||
//
|
||||
// This font contains 96 ASCII characters
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Font 6 is intended to display numbers and time
|
||||
//
|
||||
// This font has been 8 bit Run Length Encoded to save FLASH space
|
||||
// This font has been 8-bit Run Length Encoded to save FLASH space
|
||||
//
|
||||
// This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 : - . a p m
|
||||
// The Pipe character | is a narrow space to aid formatting
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Font 8
|
||||
//
|
||||
// This font has been 8 bit Run Length Encoded to save FLASH space
|
||||
// This font has been 8-bit Run Length Encoded to save FLASH space
|
||||
//
|
||||
// It is a Arial 75 pixel height font intended to display large numbers
|
||||
// This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 0 : - .
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Font 8
|
||||
//
|
||||
// This font has been 8 bit Run Length Encoded to save FLASH space
|
||||
// This font has been 8-bit Run Length Encoded to save FLASH space
|
||||
//
|
||||
// It is a Arial 75 pixel height font intended to display large numbers
|
||||
// Width for numerals reduced from 55 to 53 (to fit in 160 pixel screens)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Font 7
|
||||
//
|
||||
// This font has been 8 bit Run Length Encoded to save FLASH space
|
||||
// This font has been 8-bit Run Length Encoded to save FLASH space
|
||||
//
|
||||
// This is a 7 segment font intended to display numbers and time
|
||||
// This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 : . -
|
||||
|
||||
@@ -182,8 +182,9 @@ static const unsigned char font[] PROGMEM = {
|
||||
0x00, 0x00, 0x7B, 0x00, 0x00,
|
||||
0x08, 0x14, 0x2A, 0x14, 0x22,
|
||||
0x22, 0x14, 0x2A, 0x14, 0x08,
|
||||
0xAA, 0x00, 0x55, 0x00, 0xAA,
|
||||
0xAA, 0x55, 0xAA, 0x55, 0xAA,
|
||||
0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
|
||||
0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block
|
||||
0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block
|
||||
0x00, 0x00, 0x00, 0xFF, 0x00,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x00,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x00,
|
||||
|
||||
@@ -158,7 +158,7 @@ menu "TFT_eSPI"
|
||||
config TFT_SPI
|
||||
bool "SPI"
|
||||
config TFT_PARALLEL_8_BIT
|
||||
bool "Parallel (8 bit)"
|
||||
bool "Parallel (8-bit)"
|
||||
endchoice
|
||||
|
||||
menu "Display Data pins"
|
||||
|
||||
@@ -100,7 +100,7 @@ void TFT_eSPI::end_SDA_Read(void)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: read byte - supports class functions
|
||||
** Description: Read a byte from ESP32 8 bit data port
|
||||
** Description: Read a byte from ESP32 8-bit data port
|
||||
***************************************************************************************/
|
||||
// Parallel bus MUST be set to input before calling this function!
|
||||
uint8_t TFT_eSPI::readByte(void)
|
||||
@@ -415,7 +415,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -428,7 +428,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
uint32_t r = (color & 0xF800)>>8;
|
||||
uint32_t g = (color & 0x07E0)<<5;
|
||||
uint32_t b = (color & 0x001F)<<19;
|
||||
// Concatenate 4 pixels into three 32 bit blocks
|
||||
// Concatenate 4 pixels into three 32-bit blocks
|
||||
uint32_t r0 = r<<24 | b | g | r;
|
||||
uint32_t r1 = r0>>8 | g<<16;
|
||||
uint32_t r2 = r1>>8 | b<<8;
|
||||
@@ -512,7 +512,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (TFT_PARALLEL_8_BIT) // Now the code for ESP32 8 bit parallel
|
||||
#elif defined (TFT_PARALLEL_8_BIT) // Now the code for ESP32 8-bit parallel
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -793,7 +793,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
.sclk_io_num = TFT_SCLK,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||
#ifdef xCONFIG_IDF_TARGET_ESP32S2
|
||||
.data4_io_num = -1,
|
||||
.data5_io_num = -1,
|
||||
.data6_io_num = -1,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// Include processor specific header
|
||||
#include "soc/spi_reg.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "hal/gpio_ll.h"
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32)
|
||||
#define CONFIG_IDF_TARGET_ESP32
|
||||
@@ -86,14 +87,14 @@ SPI3_HOST = 2
|
||||
// Initialise processor specific SPI functions, used by init()
|
||||
#define INIT_TFT_DATA_BUS // Not used
|
||||
|
||||
// Define a generic flag for 8 bit parallel
|
||||
// Define a generic flag for 8-bit parallel
|
||||
#if defined (ESP32_PARALLEL) // Specific to ESP32 for backwards compatibility
|
||||
#if !defined (TFT_PARALLEL_8_BIT)
|
||||
#define TFT_PARALLEL_8_BIT // Generic parallel flag
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Ensure ESP32 specific flag is defined for 8 bit parallel
|
||||
// Ensure ESP32 specific flag is defined for 8-bit parallel
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
#if !defined (ESP32_PARALLEL)
|
||||
#define ESP32_PARALLEL
|
||||
@@ -379,12 +380,12 @@ SPI3_HOST = 2
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT
|
||||
// Write 18-bit color to TFT
|
||||
#define tft_Write_16(C) GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) (((C) & 0xF800)>> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) (((C) & 0x07E0)>> 3)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) (((C) & 0x001F)<< 3)); WR_H
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -398,7 +399,7 @@ SPI3_HOST = 2
|
||||
#define tft_Write_16(C) GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H
|
||||
#endif
|
||||
@@ -411,13 +412,13 @@ SPI3_HOST = 2
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H
|
||||
|
||||
// Write two concatenated 16 bit values to TFT
|
||||
// Write two concatenated 16-bit values to TFT
|
||||
#define tft_Write_32C(C,D) GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((D) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((D) >> 0)); WR_H
|
||||
|
||||
// Write 16 bit value twice to TFT - used by drawPixel()
|
||||
// Write 16-bit value twice to TFT - used by drawPixel()
|
||||
#define tft_Write_32D(C) GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
@@ -446,12 +447,12 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI ILI948x TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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)
|
||||
@@ -459,7 +460,7 @@ SPI3_HOST = 2
|
||||
// Future option for transfer without wait
|
||||
#define tft_Write_16N(C) tft_Write_16(C)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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) & 0xE000)>>11 | ((C) & 0x07)<<5); \
|
||||
spi.transfer(((C) & 0x1F00)>>5)
|
||||
@@ -467,10 +468,10 @@ SPI3_HOST = 2
|
||||
// Write 32 bits to TFT
|
||||
#define tft_Write_32(C) spi.write32(C)
|
||||
|
||||
// Write two concatenated 16 bit values to TFT
|
||||
// Write two concatenated 16-bit values to TFT
|
||||
#define tft_Write_32C(C,D) spi.write32((C)<<16 | (D))
|
||||
|
||||
// Write 16 bit value twice to TFT
|
||||
// Write 16-bit value twice to TFT
|
||||
#define tft_Write_32D(C) spi.write32((C)<<16 | (C))
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -478,7 +479,7 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (RPI_DISPLAY_TYPE)
|
||||
|
||||
// ESP32 low level SPI writes for 8, 16 and 32 bit values
|
||||
// ESP32 low level SPI writes for 8, 16 and 32-bit values
|
||||
// to avoid the function call overhead
|
||||
#define TFT_WRITE_BITS(D, B) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), B-1); \
|
||||
@@ -489,7 +490,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS((C)<<8, 16)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Future option for transfer without wait
|
||||
@@ -513,7 +514,7 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else
|
||||
/* Old macros
|
||||
// ESP32 low level SPI writes for 8, 16 and 32 bit values
|
||||
// ESP32 low level SPI writes for 8, 16 and 32-bit values
|
||||
// to avoid the function call overhead
|
||||
#define TFT_WRITE_BITS(D, B) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), B-1); \
|
||||
@@ -524,7 +525,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Write 16 bits
|
||||
@@ -548,7 +549,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Future option for transfer without wait
|
||||
|
||||
@@ -93,7 +93,7 @@ void TFT_eSPI::end_SDA_Read(void)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: read byte - supports class functions
|
||||
** Description: Read a byte from ESP32 8 bit data port
|
||||
** Description: Read a byte from ESP32 8-bit data port
|
||||
***************************************************************************************/
|
||||
// Parallel bus MUST be set to input before calling this function!
|
||||
uint8_t TFT_eSPI::readByte(void)
|
||||
@@ -436,7 +436,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -449,7 +449,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
uint32_t r = (color & 0xF800)>>8;
|
||||
uint32_t g = (color & 0x07E0)<<5;
|
||||
uint32_t b = (color & 0x001F)<<19;
|
||||
// Concatenate 4 pixels into three 32 bit blocks
|
||||
// Concatenate 4 pixels into three 32-bit blocks
|
||||
uint32_t r0 = r<<24 | b | g | r;
|
||||
uint32_t r1 = r0>>8 | g<<16;
|
||||
uint32_t r2 = r1>>8 | b<<8;
|
||||
@@ -540,7 +540,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (TFT_PARALLEL_8_BIT) // Now the code for ESP32 8 bit parallel
|
||||
#elif defined (TFT_PARALLEL_8_BIT) // Now the code for ESP32 8-bit parallel
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -806,6 +806,10 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
.sclk_io_num = TFT_SCLK,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.data4_io_num = -1,
|
||||
.data5_io_num = -1,
|
||||
.data6_io_num = -1,
|
||||
.data7_io_num = -1,
|
||||
.max_transfer_sz = TFT_WIDTH * TFT_HEIGHT * 2 + 8, // TFT screen size
|
||||
.flags = 0,
|
||||
.intr_flags = 0
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// Include processor specific header
|
||||
#include "soc/spi_reg.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "hal/gpio_ll.h"
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32)
|
||||
#define CONFIG_IDF_TARGET_ESP32
|
||||
@@ -78,14 +79,14 @@ SPI3_HOST = 2
|
||||
// Initialise processor specific SPI functions, used by init()
|
||||
#define INIT_TFT_DATA_BUS // Not used
|
||||
|
||||
// Define a generic flag for 8 bit parallel
|
||||
// Define a generic flag for 8-bit parallel
|
||||
#if defined (ESP32_PARALLEL) // Specific to ESP32 for backwards compatibility
|
||||
#if !defined (TFT_PARALLEL_8_BIT)
|
||||
#define TFT_PARALLEL_8_BIT // Generic parallel flag
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Ensure ESP32 specific flag is defined for 8 bit parallel
|
||||
// Ensure ESP32 specific flag is defined for 8-bit parallel
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
#if !defined (ESP32_PARALLEL)
|
||||
#define ESP32_PARALLEL
|
||||
@@ -370,12 +371,12 @@ SPI3_HOST = 2
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT
|
||||
// Write 18-bit color to TFT
|
||||
#define tft_Write_16(C) GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) (((C) & 0xF800)>> 8)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) (((C) & 0x07E0)>> 3)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) (((C) & 0x001F)<< 3)); WR_H
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -389,7 +390,7 @@ SPI3_HOST = 2
|
||||
#define tft_Write_16(C) GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 0)); WR_H
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 8)); WR_H
|
||||
#endif
|
||||
@@ -402,13 +403,13 @@ SPI3_HOST = 2
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 0)); WR_H
|
||||
|
||||
// Write two concatenated 16 bit values to TFT
|
||||
// Write two concatenated 16-bit values to TFT
|
||||
#define tft_Write_32C(C,D) GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((D) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((D) >> 0)); WR_H
|
||||
|
||||
// Write 16 bit value twice to TFT - used by drawPixel()
|
||||
// Write 16-bit value twice to TFT - used by drawPixel()
|
||||
#define tft_Write_32D(C) GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO.out_w1tc.val = GPIO_OUT_CLR_MASK; GPIO.out_w1ts.val = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
@@ -437,12 +438,12 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI ILI948x TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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)
|
||||
@@ -450,7 +451,7 @@ SPI3_HOST = 2
|
||||
// Future option for transfer without wait
|
||||
#define tft_Write_16N(C) tft_Write_16(C)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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) & 0xE000)>>11 | ((C) & 0x07)<<5); \
|
||||
spi.transfer(((C) & 0x1F00)>>5)
|
||||
@@ -458,10 +459,10 @@ SPI3_HOST = 2
|
||||
// Write 32 bits to TFT
|
||||
#define tft_Write_32(C) spi.write32(C)
|
||||
|
||||
// Write two concatenated 16 bit values to TFT
|
||||
// Write two concatenated 16-bit values to TFT
|
||||
#define tft_Write_32C(C,D) spi.write32((C)<<16 | (D))
|
||||
|
||||
// Write 16 bit value twice to TFT
|
||||
// Write 16-bit value twice to TFT
|
||||
#define tft_Write_32D(C) spi.write32((C)<<16 | (C))
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -469,7 +470,7 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (RPI_DISPLAY_TYPE)
|
||||
|
||||
// ESP32 low level SPI writes for 8, 16 and 32 bit values
|
||||
// ESP32 low level SPI writes for 8, 16 and 32-bit values
|
||||
// to avoid the function call overhead
|
||||
#define TFT_WRITE_BITS(D, B) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), B-1); \
|
||||
@@ -480,7 +481,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS((C)<<8, 16)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Future option for transfer without wait
|
||||
@@ -504,7 +505,7 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else
|
||||
/* Old macros
|
||||
// ESP32 low level SPI writes for 8, 16 and 32 bit values
|
||||
// ESP32 low level SPI writes for 8, 16 and 32-bit values
|
||||
// to avoid the function call overhead
|
||||
#define TFT_WRITE_BITS(D, B) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), B-1); \
|
||||
@@ -515,7 +516,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Write 16 bits
|
||||
@@ -547,7 +548,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Future option for transfer without wait
|
||||
|
||||
@@ -84,7 +84,7 @@ void TFT_eSPI::end_SDA_Read(void)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: read byte - supports class functions
|
||||
** Description: Read a byte from ESP32 8 bit data port
|
||||
** Description: Read a byte from ESP32 8-bit data port
|
||||
***************************************************************************************/
|
||||
// Parallel bus MUST be set to input before calling this function!
|
||||
uint8_t TFT_eSPI::readByte(void)
|
||||
@@ -426,7 +426,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -439,7 +439,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
uint32_t r = (color & 0xF800)>>8;
|
||||
uint32_t g = (color & 0x07E0)<<5;
|
||||
uint32_t b = (color & 0x001F)<<19;
|
||||
// Concatenate 4 pixels into three 32 bit blocks
|
||||
// Concatenate 4 pixels into three 32-bit blocks
|
||||
uint32_t r0 = r<<24 | b | g | r;
|
||||
uint32_t r1 = r0>>8 | g<<16;
|
||||
uint32_t r2 = r1>>8 | b<<8;
|
||||
@@ -530,7 +530,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (TFT_PARALLEL_8_BIT) // Now the code for ESP32 8 bit parallel
|
||||
#elif defined (TFT_PARALLEL_8_BIT) // Now the code for ESP32 8-bit parallel
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -644,10 +644,13 @@ void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len)
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
bool temp = _swapBytes;
|
||||
_swapBytes = false;
|
||||
while(len>0x4000) { // Transfer 16-bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(image, 0x400);
|
||||
len -= 0x400; image+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
_swapBytes = temp;
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
@@ -685,10 +688,13 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
bool temp = _swapBytes;
|
||||
_swapBytes = false;
|
||||
while(len>0x4000) { // Transfer 16-bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(buffer, 0x400);
|
||||
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
_swapBytes = temp;
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
@@ -770,10 +776,13 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
bool temp = _swapBytes;
|
||||
_swapBytes = false;
|
||||
while(len>0x4000) { // Transfer 16-bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(buffer, 0x400);
|
||||
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
_swapBytes = temp;
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
@@ -834,6 +843,10 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
.sclk_io_num = TFT_SCLK,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.data4_io_num = -1,
|
||||
.data5_io_num = -1,
|
||||
.data6_io_num = -1,
|
||||
.data7_io_num = -1,
|
||||
.max_transfer_sz = 65536, // ESP32 S3 max size is 64Kbytes
|
||||
.flags = 0,
|
||||
.intr_flags = 0
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// Include processor specific header
|
||||
#include "soc/spi_reg.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "hal/gpio_ll.h"
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32)
|
||||
#define CONFIG_IDF_TARGET_ESP32
|
||||
@@ -92,14 +93,14 @@ SPI3_HOST = 2
|
||||
// Initialise processor specific SPI functions, used by init()
|
||||
#define INIT_TFT_DATA_BUS // Not used
|
||||
|
||||
// Define a generic flag for 8 bit parallel
|
||||
// Define a generic flag for 8-bit parallel
|
||||
#if defined (ESP32_PARALLEL) // Specific to ESP32 for backwards compatibility
|
||||
#if !defined (TFT_PARALLEL_8_BIT)
|
||||
#define TFT_PARALLEL_8_BIT // Generic parallel flag
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Ensure ESP32 specific flag is defined for 8 bit parallel
|
||||
// Ensure ESP32 specific flag is defined for 8-bit parallel
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
#if !defined (ESP32_PARALLEL)
|
||||
#define ESP32_PARALLEL
|
||||
@@ -413,12 +414,12 @@ SPI3_HOST = 2
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT
|
||||
// Write 18-bit color to TFT
|
||||
#define tft_Write_16(C) GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) (((C) & 0xF800)>> 8)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) (((C) & 0x07E0)>> 3)); WR_H; \
|
||||
GPIO.out_w1tc = GPIO_OUT_CLR_MASK; GPIO.out_w1ts = set_mask((uint8_t) (((C) & 0x001F)<< 3)); WR_H
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -432,7 +433,7 @@ SPI3_HOST = 2
|
||||
#define tft_Write_16(C) GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 0)); WR_H
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 8)); WR_H
|
||||
#endif
|
||||
@@ -445,13 +446,13 @@ SPI3_HOST = 2
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 0)); WR_H
|
||||
|
||||
// Write two concatenated 16 bit values to TFT
|
||||
// Write two concatenated 16-bit values to TFT
|
||||
#define tft_Write_32C(C,D) GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((D) >> 8)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((D) >> 0)); WR_H
|
||||
|
||||
// Write 16 bit value twice to TFT - used by drawPixel()
|
||||
// Write 16-bit value twice to TFT - used by drawPixel()
|
||||
#define tft_Write_32D(C) GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 0)); WR_H; \
|
||||
GPIO_CLR_REG = GPIO_OUT_CLR_MASK; GPIO_SET_REG = set_mask((uint8_t) ((C) >> 8)); WR_H; \
|
||||
@@ -480,12 +481,12 @@ SPI3_HOST = 2
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI ILI948x TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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)
|
||||
@@ -493,7 +494,7 @@ SPI3_HOST = 2
|
||||
// Future option for transfer without wait
|
||||
#define tft_Write_16N(C) tft_Write_16(C)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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) & 0xE000)>>11 | ((C) & 0x07)<<5); \
|
||||
spi.transfer(((C) & 0x1F00)>>5)
|
||||
@@ -501,17 +502,17 @@ SPI3_HOST = 2
|
||||
// Write 32 bits to TFT
|
||||
#define tft_Write_32(C) spi.write32(C)
|
||||
|
||||
// Write two concatenated 16 bit values to TFT
|
||||
// Write two concatenated 16-bit values to TFT
|
||||
#define tft_Write_32C(C,D) spi.write32((C)<<16 | (D))
|
||||
|
||||
// Write 16 bit value twice to TFT
|
||||
// Write 16-bit value twice to TFT
|
||||
#define tft_Write_32D(C) spi.write32((C)<<16 | (C))
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to an Raspberry Pi TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (RPI_DISPLAY_TYPE)
|
||||
// ESP32-S3 low level SPI writes for 8, 16 and 32 bit values
|
||||
// ESP32-S3 low level SPI writes for 8, 16 and 32-bit values
|
||||
// to avoid the function call overhead
|
||||
#define TFT_WRITE_BITS(D, B) *_spi_mosi_dlen = B-1; \
|
||||
*_spi_w = D; \
|
||||
@@ -523,7 +524,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS((C)<<8, 16)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Future option for transfer without wait
|
||||
@@ -562,7 +563,7 @@ SPI3_HOST = 2
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
|
||||
|
||||
// Write 16 bits with corrected endianness for 16 bit colours
|
||||
// Write 16 bits with corrected endianness for 16-bit colours
|
||||
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
|
||||
|
||||
// Future option for transfer without wait
|
||||
|
||||
@@ -109,7 +109,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -122,7 +122,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
uint8_t r = (color & 0xF800)>>8;
|
||||
uint8_t g = (color & 0x07E0)>>3;
|
||||
uint8_t b = (color & 0x001F)<<3;
|
||||
// Concatenate 4 pixels into three 32 bit blocks
|
||||
// Concatenate 4 pixels into three 32-bit blocks
|
||||
uint32_t r0 = r<<24 | b<<16 | g<<8 | r;
|
||||
uint32_t r1 = g<<24 | r<<16 | b<<8 | g;
|
||||
uint32_t r2 = b<<24 | g<<16 | r<<8 | b;
|
||||
|
||||
@@ -117,17 +117,17 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI ILI948x TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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) & 0xE000)>>11 | ((C) & 0x07)<<5); \
|
||||
spi.transfer(((C) & 0x1F00)>>5)
|
||||
@@ -148,7 +148,7 @@
|
||||
// Command is 16 bits
|
||||
#define CMD_BITS 16
|
||||
|
||||
// ESP8266 low level SPI writes for 8, 16 and 32 bit values
|
||||
// ESP8266 low level SPI writes for 8, 16 and 32-bit values
|
||||
// to avoid the function call overhead
|
||||
#define TFT_WRITE_BITS(D, B) \
|
||||
SPI1U1 = ((B-1) << SPILMOSI); \
|
||||
|
||||
@@ -172,7 +172,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -216,7 +216,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else // Standard SPI 16 bit colour TFT
|
||||
#else // Standard SPI 16-bit colour TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// This is a generic driver for Arduino boards, it supports SPI interface displays
|
||||
// 8 bit parallel interface to TFT is not supported for generic processors
|
||||
// 8-bit parallel interface to TFT is not supported for generic processors
|
||||
|
||||
#ifndef _TFT_eSPI_GENERICH_
|
||||
#define _TFT_eSPI_GENERICH_
|
||||
@@ -94,17 +94,17 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI ILI948x TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
// 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) & 0xE000)>>11 | ((C) & 0x07)<<5); \
|
||||
spi.transfer(((C) & 0x1F00)>>5)
|
||||
@@ -121,7 +121,7 @@
|
||||
// Macros to write commands/pixel colour data to other displays
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16-bit transfers
|
||||
#define tft_Write_8(C) spi.transfer(C); spi.transfer(C)
|
||||
#define tft_Write_16(C) spi.transfer((uint8_t)((C)>>8));spi.transfer((uint8_t)((C)>>0))
|
||||
#define tft_Write_16S(C) spi.transfer((uint8_t)((C)>>0));spi.transfer((uint8_t)((C)>>8))
|
||||
@@ -143,7 +143,7 @@
|
||||
spi.transfer(0); spi.transfer((C)>>0)
|
||||
|
||||
#else
|
||||
#ifdef __AVR__ // AVR processors do not have 16 bit transfer
|
||||
#ifdef __AVR__ // AVR processors do not have 16-bit transfer
|
||||
#define tft_Write_8(C) {SPDR=(C); while (!(SPSR&_BV(SPIF)));}
|
||||
#define tft_Write_16(C) tft_Write_8((uint8_t)((C)>>8));tft_Write_8((uint8_t)((C)>>0))
|
||||
#define tft_Write_16S(C) tft_Write_8((uint8_t)((C)>>0));tft_Write_8((uint8_t)((C)>>8))
|
||||
|
||||
@@ -18,26 +18,26 @@
|
||||
SPIClassRP2040 spi = SPIClassRP2040(SPI_X, TFT_MISO, -1, TFT_SCLK, TFT_MOSI);
|
||||
#endif
|
||||
|
||||
#else // PIO interface used (8 bit parallel or SPI)
|
||||
#else // PIO interface used (8-bit parallel or SPI)
|
||||
|
||||
#ifdef RP2040_PIO_SPI
|
||||
#if defined (SPI_18BIT_DRIVER)
|
||||
// SPI PIO code for 18 bit colour transmit
|
||||
// SPI PIO code for 18-bit colour transmit
|
||||
#include "pio_SPI_18bit.pio.h"
|
||||
#else
|
||||
// SPI PIO code for 16 bit colour transmit
|
||||
// SPI PIO code for 16-bit colour transmit
|
||||
#include "pio_SPI.pio.h"
|
||||
#endif
|
||||
#elif defined (TFT_PARALLEL_8_BIT)
|
||||
#if defined (SSD1963_DRIVER)
|
||||
// PIO code for 8 bit parallel interface (18 bit colour)
|
||||
// PIO code for 8-bit parallel interface (18-bit colour)
|
||||
#include "pio_8bit_parallel_18bpp.pio.h"
|
||||
#else
|
||||
// PIO code for 8 bit parallel interface (16 bit colour)
|
||||
// PIO code for 8-bit parallel interface (16-bit colour)
|
||||
#include "pio_8bit_parallel.pio.h"
|
||||
#endif
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
// PIO code for 16 bit parallel interface (16 bit colour)
|
||||
// PIO code for 16-bit parallel interface (16-bit colour)
|
||||
#include "pio_16bit_parallel.pio.h"
|
||||
#endif
|
||||
|
||||
@@ -128,24 +128,12 @@ void TFT_eSPI::end_SDA_Read(void)
|
||||
#ifdef RP2040_PIO_SPI
|
||||
void pioinit(uint32_t clock_freq) {
|
||||
|
||||
// Find a free SM on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
|
||||
/*
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, false); // false means don't panic
|
||||
// Try pio1 if SM not found
|
||||
if (pio_sm < 0) {
|
||||
tft_pio = pio1;
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, true); // panic this time if no SM is free
|
||||
}
|
||||
*/
|
||||
|
||||
// Find enough free space on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
tft_pio = pio1;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
Serial.println("No room for PIO program!");
|
||||
// Serial.println("No room for PIO program!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -197,29 +185,21 @@ void pioinit(uint32_t clock_freq) {
|
||||
pio_instr_set_dc = pio_encode_set((pio_src_dest)0, 1);
|
||||
pio_instr_clr_dc = pio_encode_set((pio_src_dest)0, 0);
|
||||
}
|
||||
#else // 8 or 16 bit parallel
|
||||
#else // 8 or 16-bit parallel
|
||||
void pioinit(uint16_t clock_div, uint16_t fract_div) {
|
||||
|
||||
// Find a free SM on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, false); // false means don't panic
|
||||
// Try pio1 if SM not found
|
||||
if (pio_sm < 0) {
|
||||
tft_pio = pio1;
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, true); // panic this time if no SM is free
|
||||
}
|
||||
/*
|
||||
// Find enough free space on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program) {
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
tft_pio = pio1;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program) {
|
||||
Serial.println("No room for PIO program!");
|
||||
while(1) delay(100);
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
// Serial.println("No room for PIO program!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, false);
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
uint8_t bits = 8;
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
@@ -478,7 +458,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -491,12 +471,12 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
uint16_t g = (color & 0x07E0)>>3;
|
||||
uint16_t b = (color & 0x001F)<<3;
|
||||
|
||||
// If more than 32 pixels then change to 16 bit transfers with concatenated pixels
|
||||
// If more than 32 pixels then change to 16-bit transfers with concatenated pixels
|
||||
if (len > 32) {
|
||||
uint32_t rg = r<<8 | g;
|
||||
uint32_t br = b<<8 | r;
|
||||
uint32_t gb = g<<8 | b;
|
||||
// Must wait before changing to 16 bit
|
||||
// Must wait before changing to 16-bit
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
while ( len > 1 ) {
|
||||
@@ -505,7 +485,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
while (!spi_is_writable(SPI_X)){}; spi_get_hw(SPI_X)->dr = gb;
|
||||
len -= 2;
|
||||
}
|
||||
// Must wait before changing back to 8 bit
|
||||
// Must wait before changing back to 8-bit
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
}
|
||||
@@ -536,7 +516,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else // Standard SPI 16 bit colour TFT
|
||||
#else // Standard SPI 16-bit colour TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -582,7 +562,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef RP2040_DMA // DMA functions for 16 bit SPI and 8/16 bit parallel displays
|
||||
#ifdef RP2040_DMA // DMA functions for 16-bit SPI and 8/16-bit parallel displays
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
These are created in header file:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// This is a generic driver for Arduino boards, it supports SPI interface displays
|
||||
// 8 bit parallel interface to TFT is not supported for generic processors
|
||||
// 8-bit parallel interface to TFT is not supported for generic processors
|
||||
|
||||
#ifndef _TFT_eSPI_RP2040H_
|
||||
#define _TFT_eSPI_RP2040H_
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
// Processor specific code used by SPI bus transaction begin/end_tft_write functions
|
||||
#define SET_BUS_WRITE_MODE spi_set_format(SPI_X, 8, (spi_cpol_t)(TFT_SPI_MODE >> 1), (spi_cpha_t)(TFT_SPI_MODE & 0x1), SPI_MSB_FIRST)
|
||||
#define SET_BUS_READ_MODE // spi_set_format(SPI_X, 8, (spi_cpol_t)0, (spi_cpha_t)0, SPI_MSB_FIRST)
|
||||
#define SET_BUS_READ_MODE spi_set_format(SPI_X, 8, (spi_cpol_t)0, (spi_cpha_t)0, SPI_MSB_FIRST)
|
||||
#else
|
||||
// Processor specific code used by SPI bus transaction begin/end_tft_write functions
|
||||
#define SET_BUS_WRITE_MODE
|
||||
@@ -72,8 +72,8 @@
|
||||
|
||||
#if !defined (RP2040_PIO_INTERFACE) // SPI
|
||||
|
||||
#if defined (MHS_DISPLAY_TYPE) // High speed RPi TFT type always needs 16 bit transfers
|
||||
// This swaps to 16 bit mode, used for commands so wait avoids clash with DC timing
|
||||
#if defined (MHS_DISPLAY_TYPE) // High speed RPi TFT type always needs 16-bit transfers
|
||||
// This swaps to 16-bit mode, used for commands so wait avoids clash with DC timing
|
||||
#define INIT_TFT_DATA_BUS hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS)
|
||||
#else
|
||||
// Initialise processor specific SPI functions, used by init()
|
||||
@@ -114,7 +114,7 @@
|
||||
#define DIV_UNITS 3 // 96ns write cycle time
|
||||
#endif
|
||||
#define DIV_FRACT 0
|
||||
#else // 8 bit parallel mode default 64ns write cycle time
|
||||
#else // 8-bit parallel mode default 64ns write cycle time
|
||||
#define DIV_UNITS 2
|
||||
#define DIV_FRACT 0 // Note: Fractional values done with clock period dithering
|
||||
#endif
|
||||
@@ -166,10 +166,10 @@
|
||||
tft_pio->sm[pio_sm].instr = pio_instr_clr_dc
|
||||
|
||||
#ifndef RM68120_DRIVER
|
||||
// Flush has happened before this and mode changed back to 16 bit
|
||||
// Flush has happened before this and mode changed back to 16-bit
|
||||
#define DC_D tft_pio->sm[pio_sm].instr = pio_instr_set_dc
|
||||
#else
|
||||
// Need to wait for stall since RM68120 commands are 16 bit
|
||||
// Need to wait for stall since RM68120 commands are 16-bit
|
||||
#define DC_D WAIT_FOR_STALL; tft_pio->sm[pio_sm].instr = pio_instr_set_dc
|
||||
#endif
|
||||
#endif
|
||||
@@ -257,7 +257,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined (RP2040_PIO_INTERFACE) // SPI
|
||||
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) spi_get_hw(SPI_X)->dr = (uint32_t)(C); \
|
||||
@@ -267,17 +267,17 @@
|
||||
#define tft_Write_8N(B) while (!spi_is_writable(SPI_X)){}; \
|
||||
spi_get_hw(SPI_X)->dr = (uint8_t)(B)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// Convert 16-bit colour to 18-bit and write in 3 bytes
|
||||
#define tft_Write_16(C) tft_Write_8N(((C) & 0xF800)>>8); \
|
||||
tft_Write_8N(((C) & 0x07E0)>>3); \
|
||||
tft_Write_8N(((C) & 0x001F)<<3)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
// Convert 16-bit colour to 18-bit and write in 3 bytes
|
||||
#define tft_Write_16N(C) tft_Write_8N(((C) & 0xF800)>>8); \
|
||||
tft_Write_8N(((C) & 0x07E0)>>3); \
|
||||
tft_Write_8N(((C) & 0x001F)<<3)
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
// Convert swapped byte 16-bit colour to 18-bit and write in 3 bytes
|
||||
#define tft_Write_16S(C) tft_Write_8N((C) & 0xF8); \
|
||||
tft_Write_8N(((C) & 0xE000)>>11 | ((C) & 0x07)<<5); \
|
||||
tft_Write_8N(((C) & 0x1F00)>>5)
|
||||
@@ -303,8 +303,8 @@
|
||||
// Macros to write commands/pixel colour data to other displays
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else
|
||||
#if defined (MHS_DISPLAY_TYPE) // High speed RPi TFT type always needs 16 bit transfers
|
||||
// This swaps to 16 bit mode, used for commands so wait avoids clash with DC timing
|
||||
#if defined (MHS_DISPLAY_TYPE) // High speed RPi TFT type always needs 16-bit transfers
|
||||
// This swaps to 16-bit mode, used for commands so wait avoids clash with DC timing
|
||||
#define tft_Write_8(C) while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {}; \
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); \
|
||||
spi_get_hw(SPI_X)->dr = (uint32_t)((C) | ((C)<<8)); \
|
||||
@@ -324,7 +324,7 @@
|
||||
|
||||
#define tft_Write_32D(C) spi_get_hw(SPI_X)->dr = (uint32_t)(C); spi_get_hw(SPI_X)->dr = (uint32_t)(C)
|
||||
|
||||
#elif defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
|
||||
#elif defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16-bit transfers
|
||||
#define tft_Write_8(C) spi.transfer(C); spi.transfer(C)
|
||||
#define tft_Write_16(C) spi.transfer((uint8_t)((C)>>8));spi.transfer((uint8_t)((C)>>0))
|
||||
#define tft_Write_16N(C) spi.transfer((uint8_t)((C)>>8));spi.transfer((uint8_t)((C)>>0))
|
||||
@@ -348,7 +348,7 @@
|
||||
|
||||
#elif defined (ILI9225_DRIVER) // Needs gaps between commands + data bytes, so use slower transfer functions
|
||||
|
||||
// Warning: these all end in 8 bit SPI mode!
|
||||
// Warning: these all end in 8-bit SPI mode!
|
||||
#define tft_Write_8(C) spi.transfer(C);
|
||||
|
||||
#define tft_Write_16(C) spi.transfer16(C)
|
||||
@@ -365,7 +365,7 @@
|
||||
|
||||
#else
|
||||
|
||||
// This swaps to 8 bit mode, then back to 16 bit mode
|
||||
// This swaps to 8-bit mode, then back to 16-bit mode
|
||||
#define tft_Write_8(C) while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {}; \
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); \
|
||||
spi_get_hw(SPI_X)->dr = (uint32_t)(C); \
|
||||
@@ -389,7 +389,7 @@
|
||||
#endif // RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
|
||||
#else // Parallel 8 bit or PIO SPI
|
||||
#else // Parallel 8-bit or PIO SPI
|
||||
|
||||
// Wait for the PIO to stall (SM pull request finds no data in TX FIFO)
|
||||
// This is used to detect when the SM is idle and hence ready for a jump instruction
|
||||
@@ -413,15 +413,15 @@
|
||||
// Temporary - to be deleted
|
||||
#define GPIO_DIR_MASK 0
|
||||
|
||||
#if defined (SPI_18BIT_DRIVER) || defined (SSD1963_DRIVER) // 18 bit colour (3 bytes)
|
||||
// This writes 8 bits, then switches back to 16 bit mode automatically
|
||||
#if defined (SPI_18BIT_DRIVER) || defined (SSD1963_DRIVER) // 18-bit colour (3 bytes)
|
||||
// This writes 8 bits, then switches back to 16-bit mode automatically
|
||||
// Have already waited for pio stalled (last data write complete) when DC switched to command mode
|
||||
// The wait for stall allows DC to be changed immediately afterwards
|
||||
#define tft_Write_8(C) tft_pio->sm[pio_sm].instr = pio_instr_jmp8; \
|
||||
TX_FIFO = (C); \
|
||||
WAIT_FOR_STALL
|
||||
|
||||
// Used to send last byte for 32 bit macros below since PIO sends 24 bits
|
||||
// Used to send last byte for 32-bit macros below since PIO sends 24 bits
|
||||
#define tft_Write_8L(C) WAIT_FOR_STALL; \
|
||||
tft_pio->sm[pio_sm].instr = pio_instr_jmp8; \
|
||||
TX_FIFO = (C)
|
||||
@@ -441,14 +441,14 @@
|
||||
#define tft_Write_32D(C) WAIT_FOR_FIFO_FREE(2); TX_FIFO = (((C)<<8) | ((C)>>8)); tft_Write_8L(C)
|
||||
|
||||
#else // PIO interface, SPI or parallel
|
||||
// This writes 8 bits, then switches back to 16 bit mode automatically
|
||||
// This writes 8 bits, then switches back to 16-bit mode automatically
|
||||
// Have already waited for pio stalled (last data write complete) when DC switched to command mode
|
||||
// The wait for stall allows DC to be changed immediately afterwards
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RP2040_PIO_SPI)
|
||||
#define tft_Write_8(C) tft_pio->sm[pio_sm].instr = pio_instr_jmp8; \
|
||||
TX_FIFO = (C); \
|
||||
WAIT_FOR_STALL
|
||||
#else // For 16 bit parallel 16 bits are always sent
|
||||
#else // For 16-bit parallel 16 bits are always sent
|
||||
#define tft_Write_8(C) TX_FIFO = (C); \
|
||||
WAIT_FOR_STALL
|
||||
#endif
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
DMA_HandleTypeDef dmaHal;
|
||||
#endif
|
||||
|
||||
// Buffer for SPI transmit byte padding and byte order manipulation
|
||||
uint8_t spiBuffer[8];
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (TFT_SDA_READ) && !defined (TFT_PARALLEL_8_BIT)
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -76,7 +73,7 @@ void TFT_eSPI::end_SDA_Read(void)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (TFT_PARALLEL_8_BIT) // Code for STM32 8 bit parallel
|
||||
#if defined (TFT_PARALLEL_8_BIT) // Code for STM32 8-bit parallel
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -286,7 +283,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -296,34 +293,19 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
#define BUF_SIZE 240*3
|
||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
{
|
||||
uint8_t col[BUF_SIZE];
|
||||
//uint8_t col[BUF_SIZE];
|
||||
// Always using swapped bytes is a peculiarity of this function...
|
||||
//color = color>>8 | color<<8;
|
||||
uint8_t r = (color & 0xF800)>>8; // Red
|
||||
uint8_t g = (color & 0x07E0)>>3; // Green
|
||||
uint8_t b = (color & 0x001F)<<3; // Blue
|
||||
|
||||
if (len<BUF_SIZE/3) {
|
||||
for (uint32_t i = 0; i < len*3; i++) {
|
||||
col[i] = r;
|
||||
col[++i] = g;
|
||||
col[++i] = b;
|
||||
}
|
||||
HAL_SPI_Transmit(&spiHal, col, len*3, HAL_MAX_DELAY);
|
||||
return;
|
||||
while(len--) {
|
||||
TX_FIFO = (r);
|
||||
TX_FIFO = (g);
|
||||
TX_FIFO = (b);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < BUF_SIZE; i++) {
|
||||
col[i] = r;
|
||||
col[++i] = g;
|
||||
col[++i] = b;
|
||||
}
|
||||
do {
|
||||
HAL_SPI_Transmit(&spiHal, col, BUF_SIZE, HAL_MAX_DELAY);
|
||||
len -= BUF_SIZE/3;
|
||||
} while ( len>=BUF_SIZE/3 ) ;
|
||||
// Send remaining pixels
|
||||
if (len) HAL_SPI_Transmit(&spiHal, col, len*3, HAL_MAX_DELAY); //*/
|
||||
SPI_BUSY_CHECK;
|
||||
}
|
||||
/***************************************************************************************
|
||||
** Function name: pushPixels - for STM32 and 3 byte RGB display
|
||||
@@ -333,30 +315,29 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
{
|
||||
uint16_t *data = (uint16_t*)data_in;
|
||||
|
||||
if(_swapBytes) {
|
||||
if(!_swapBytes) {
|
||||
while ( len-- ) {
|
||||
// Split out the colours
|
||||
spiBuffer[0] = (*data & 0xF8); // Red
|
||||
spiBuffer[1] = (*data & 0xE000)>>11 | (*data & 0x07)<<5; // Green
|
||||
spiBuffer[2] = (*data & 0x1F00)>>5; // Blue
|
||||
TX_FIFO = (*data & 0xF8); // Red
|
||||
TX_FIFO = (*data & 0xE000)>>11 | (*data & 0x07)<<5; // Green
|
||||
TX_FIFO = (*data & 0x1F00)>>5; // Blue
|
||||
data++;
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 3, HAL_MAX_DELAY);
|
||||
}
|
||||
}
|
||||
else {
|
||||
while ( len-- ) {
|
||||
// Split out the colours
|
||||
spiBuffer[0] = (*data & 0xF800)>>8; // Red
|
||||
spiBuffer[1] = (*data & 0x07E0)>>3; // Green
|
||||
spiBuffer[2] = (*data & 0x001F)<<3; // Blue
|
||||
TX_FIFO = (*data & 0xF800)>>8; // Red
|
||||
TX_FIFO = (*data & 0x07E0)>>3; // Green
|
||||
TX_FIFO = (*data & 0x001F)<<3; // Blue
|
||||
data++;
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 3, HAL_MAX_DELAY);
|
||||
}
|
||||
}
|
||||
SPI_BUSY_CHECK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else // Standard SPI 16 bit colour TFT All Tested
|
||||
#else // Standard SPI 16-bit colour TFT All Tested
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -364,6 +345,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
** Description: Write a block of pixels of the same colour
|
||||
***************************************************************************************/
|
||||
#define BUF_SIZE 480
|
||||
/*
|
||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
{
|
||||
uint16_t col[BUF_SIZE];
|
||||
@@ -381,7 +363,47 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
len -= BUF_SIZE;
|
||||
} while ( len>=BUF_SIZE ) ;
|
||||
// Send remaining pixels
|
||||
if (len) HAL_SPI_Transmit(&spiHal, (uint8_t*)col, len<<1, HAL_MAX_DELAY); //*/
|
||||
if (len) HAL_SPI_Transmit(&spiHal, (uint8_t*)col, len<<1, HAL_MAX_DELAY);
|
||||
}
|
||||
//*/
|
||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||
// Loop unrolling improves speed dramatically graphics test 0.634s => 0.374s
|
||||
while (len>31) {
|
||||
#if !defined (SSD1963_DRIVER)
|
||||
// 32D macro writes 16 bits twice
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
#else
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
#endif
|
||||
len-=32;
|
||||
}
|
||||
|
||||
while (len>7) {
|
||||
#if !defined (SSD1963_DRIVER)
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
tft_Write_32D(color); tft_Write_32D(color);
|
||||
#else
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||
#endif
|
||||
len-=8;
|
||||
}
|
||||
|
||||
while (len--) {tft_Write_16(color);}
|
||||
}
|
||||
|
||||
|
||||
@@ -392,26 +414,23 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||
{
|
||||
uint16_t *data = (uint16_t*)data_in;
|
||||
|
||||
if(_swapBytes) {
|
||||
uint16_t col[BUF_SIZE]; // Buffer for swapped bytes
|
||||
while ( len>=BUF_SIZE ) {
|
||||
for (uint32_t i = 0; i < BUF_SIZE; i++) { col[i] = (*data>>8) | (*data<<8); data++; }
|
||||
HAL_SPI_Transmit(&spiHal, (uint8_t*)col, BUF_SIZE<<1, HAL_MAX_DELAY);
|
||||
len -= BUF_SIZE;
|
||||
while ( len-- ) {
|
||||
TX_FIFO = (uint8_t)(*data>>8);
|
||||
TX_FIFO = (uint8_t)(*data<<8);
|
||||
data++;
|
||||
}
|
||||
for (uint32_t i = 0; i < len; i++) { col[i] = (*data>>8) | (*data<<8); data++; }
|
||||
HAL_SPI_Transmit(&spiHal, (uint8_t*)col, len<<1, HAL_MAX_DELAY);
|
||||
}
|
||||
else {
|
||||
// HAL byte count for transmit is only 16 bits maximum so to avoid this constraint
|
||||
// transfers of small blocks are performed until HAL capacity is reached.
|
||||
while(len>0x7FFF) { // Transfer 16 bit pixels in blocks if len*2 over 65534 bytes
|
||||
HAL_SPI_Transmit(&spiHal, (uint8_t*)data, 0x800<<1, HAL_MAX_DELAY);
|
||||
len -= 0x800; data+= 0x800; // Arbitrarily use 2KByte blocks
|
||||
while ( len-- ) {
|
||||
// Split out the colours
|
||||
TX_FIFO = (uint8_t)(*data);
|
||||
TX_FIFO = (uint8_t)(*data>>8);
|
||||
data++;
|
||||
}
|
||||
// Send remaining pixels (max 65534 bytes)
|
||||
HAL_SPI_Transmit(&spiHal, (uint8_t*)data, len<<1, HAL_MAX_DELAY);
|
||||
}
|
||||
SPI_BUSY_CHECK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -527,7 +546,7 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32767 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x7FFF) { // Transfer 16 bit pixels in blocks if len*2 over 65534 bytes
|
||||
while(len>0x7FFF) { // Transfer 16-bit pixels in blocks if len*2 over 65534 bytes
|
||||
HAL_SPI_Transmit(&spiHal, (uint8_t*)buffer, 0x800<<1, HAL_MAX_DELAY);
|
||||
len -= 0x800; buffer+= 0x800; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
|
||||
@@ -151,6 +151,15 @@
|
||||
#define TFT_SPI_PORT 1
|
||||
#endif
|
||||
|
||||
#if (TFT_SPI_PORT == 1)
|
||||
#define SPIX SPI1
|
||||
#elif (TFT_SPI_PORT == 2)
|
||||
#define SPIX SPI2
|
||||
#elif (TFT_SPI_PORT == 3)
|
||||
#define SPIX SPI3
|
||||
#elif (TFT_SPI_PORT == 4)
|
||||
#define SPIX SPI4
|
||||
#endif
|
||||
// Global define is _VARIANT_ARDUINO_STM32_, see board package stm32_def.h for specific variants
|
||||
#if defined (STM32F2xx) || defined (STM32F4xx) || defined (STM32F7xx)
|
||||
|
||||
@@ -226,8 +235,8 @@
|
||||
#define DC_PORT digitalPinToPort(TFT_DC)
|
||||
#define DC_PIN_MASK digitalPinToBitMask(TFT_DC)
|
||||
// Use bit set reset register
|
||||
#define DC_C DC_PORT->BSRR = DC_PIN_MASK<<16
|
||||
#define DC_D DC_PORT->BSRR = DC_PIN_MASK
|
||||
#define DC_C DC_DELAY; DC_PORT->BSRR = DC_PIN_MASK<<16
|
||||
#define DC_D DC_DELAY; DC_PORT->BSRR = DC_PIN_MASK
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -401,7 +410,7 @@
|
||||
#define D5_BSR_MASK(B) ((D5_PIN_MASK<<16)>>(((B)>> 1)&0x10))
|
||||
#define D6_BSR_MASK(B) ((D6_PIN_MASK<<16)>>(((B)>> 2)&0x10))
|
||||
#define D7_BSR_MASK(B) ((D7_PIN_MASK<<16)>>(((B)>> 3)&0x10))
|
||||
// Create bit set/reset mask for top byte of 16 bit value B
|
||||
// Create bit set/reset mask for top byte of 16-bit value B
|
||||
#define D8_BSR_MASK(B) ((D0_PIN_MASK<<16)>>(((B)>> 4)&0x10))
|
||||
#define D9_BSR_MASK(B) ((D1_PIN_MASK<<16)>>(((B)>> 5)&0x10))
|
||||
#define D10_BSR_MASK(B) ((D2_PIN_MASK<<16)>>(((B)>> 6)&0x10))
|
||||
@@ -420,7 +429,7 @@
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT (untested)
|
||||
// Write 18-bit color to TFT (untested)
|
||||
#define tft_Write_16(C) r6 = (((C) & 0xF800)>> 8); g6 = (((C) & 0x07E0)>> 3); b6 = (((C) & 0x001F)<< 3); \
|
||||
GPIOA->BSRR = D0_BSR_MASK(r6) | D2_BSR_MASK(r6) | D7_BSR_MASK(r6); \
|
||||
WR_L; \
|
||||
@@ -438,7 +447,7 @@
|
||||
GPIOB->BSRR = D3_BSR_MASK(b6) | D4_BSR_MASK(b6) | D5_BSR_MASK(b6) | D6_BSR_MASK(b6); \
|
||||
WR_STB // Need to slow down strobe
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -454,7 +463,7 @@
|
||||
GPIOB->BSRR = D3_BSR_MASK(C) | D4_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
||||
WR_STB // Need to slow down strobe
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIOA->BSRR = D0_BSR_MASK(C) | D2_BSR_MASK(C) | D7_BSR_MASK(C); \
|
||||
WR_L; \
|
||||
GPIOC->BSRR = D1_BSR_MASK(C); \
|
||||
@@ -541,7 +550,7 @@
|
||||
#define D5_BSR_MASK(B) ((D5_PIN_MASK<<16)>>(((B)>> 1)&0x10))
|
||||
#define D6_BSR_MASK(B) ((D6_PIN_MASK<<16)>>(((B)>> 2)&0x10))
|
||||
#define D7_BSR_MASK(B) ((D7_PIN_MASK<<16)>>(((B)>> 3)&0x10))
|
||||
// Create bit set/reset mask for top byte of 16 bit value B
|
||||
// Create bit set/reset mask for top byte of 16-bit value B
|
||||
#define D8_BSR_MASK(B) ((D0_PIN_MASK<<16)>>(((B)>> 4)&0x10))
|
||||
#define D9_BSR_MASK(B) ((D1_PIN_MASK<<16)>>(((B)>> 5)&0x10))
|
||||
#define D10_BSR_MASK(B) ((D2_PIN_MASK<<16)>>(((B)>> 6)&0x10))
|
||||
@@ -561,7 +570,7 @@
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT (untested)
|
||||
// Write 18-bit color to TFT (untested)
|
||||
#define tft_Write_16(C) r6 = (((C) & 0xF800)>> 8); g6 = (((C) & 0x07E0)>> 3); b6 = (((C) & 0x001F)<< 3); \
|
||||
GPIOF->BSRR = D0_BSR_MASK(r6) | D2_BSR_MASK(r6) | D4_BSR_MASK(r6) | D7_BSR_MASK(r6); \
|
||||
WR_L; \
|
||||
@@ -579,7 +588,7 @@
|
||||
GPIOE->BSRR = D3_BSR_MASK(b6) | D5_BSR_MASK(b6) | D6_BSR_MASK(b6); \
|
||||
WR_STB // Need to slow down strobe
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -596,7 +605,7 @@
|
||||
GPIOE->BSRR = D3_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
||||
WR_STB
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIOF->BSRR = D0_BSR_MASK(C) | D2_BSR_MASK(C) | D4_BSR_MASK(C) | D7_BSR_MASK(C); \
|
||||
WR_L; \
|
||||
GPIOD->BSRR = D1_BSR_MASK(C); \
|
||||
@@ -659,7 +668,7 @@
|
||||
#define D5_BSR_MASK(B) ((D5_PIN_MASK<<16)>>(((B)>> 1)&0x10))
|
||||
#define D6_BSR_MASK(B) ((D6_PIN_MASK<<16)>>(((B)>> 2)&0x10))
|
||||
#define D7_BSR_MASK(B) ((D7_PIN_MASK<<16)>>(((B)>> 3)&0x10))
|
||||
// Create bit set/reset mask for top byte of 16 bit value B
|
||||
// Create bit set/reset mask for top byte of 16-bit value B
|
||||
#define D8_BSR_MASK(B) ((D0_PIN_MASK<<16)>>(((B)>> 4)&0x10))
|
||||
#define D9_BSR_MASK(B) ((D1_PIN_MASK<<16)>>(((B)>> 5)&0x10))
|
||||
#define D10_BSR_MASK(B) ((D2_PIN_MASK<<16)>>(((B)>> 6)&0x10))
|
||||
@@ -692,7 +701,7 @@
|
||||
GPIOE->BSRR = D3_BSR_MASK(C) | D4_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
||||
WR_STB
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIOF->BSRR = D0_BSR_MASK(C); \
|
||||
GPIOG->BSRR = D2_BSR_MASK(C) | D7_BSR_MASK(C); \
|
||||
WR_L; \
|
||||
@@ -743,14 +752,14 @@
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT (untested)
|
||||
// Write 18-bit color to TFT (untested)
|
||||
|
||||
#define tft_Write_16(C) r6 = (((C) & 0xF800)>> 8); g6 = (((C) & 0x07E0)>> 3); b6 = (((C) & 0x001F)<< 3); \
|
||||
GPIOX->BSRR = (0x00FF0000 | (uint8_t)(r6)); WR_L; WR_STB; \
|
||||
GPIOX->BSRR = (0x00FF0000 | (uint8_t)(g6)); WR_L; WR_STB; \
|
||||
GPIOX->BSRR = (0x00FF0000 | (uint8_t)(b6)); WR_L; WR_STB
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -759,7 +768,7 @@
|
||||
#define tft_Write_16(C) GPIOX->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB; \
|
||||
GPIOX->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) GPIOX->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB; \
|
||||
GPIOX->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB
|
||||
#endif
|
||||
@@ -832,7 +841,7 @@
|
||||
#define D5_BSR_MASK(B) ((D5_PIN_MASK<<16)>>(((B)>> 1)&0x10))
|
||||
#define D6_BSR_MASK(B) ((D6_PIN_MASK<<16)>>(((B)>> 2)&0x10))
|
||||
#define D7_BSR_MASK(B) ((D7_PIN_MASK<<16)>>(((B)>> 3)&0x10))
|
||||
// Create bit set/reset mask for top byte of 16 bit value B
|
||||
// Create bit set/reset mask for top byte of 16-bit value B
|
||||
#define D8_BSR_MASK(B) ((D0_PIN_MASK<<16)>>(((B)>> 4)&0x10))
|
||||
#define D9_BSR_MASK(B) ((D1_PIN_MASK<<16)>>(((B)>> 5)&0x10))
|
||||
#define D10_BSR_MASK(B) ((D2_PIN_MASK<<16)>>(((B)>> 6)&0x10))
|
||||
@@ -857,7 +866,7 @@
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
|
||||
// Write 18 bit color to TFT (untested)
|
||||
// Write 18-bit color to TFT (untested)
|
||||
#define tft_Write_16(C) r6 = (((C) & 0xF800)>> 8); g6 = (((C) & 0x07E0)>> 3); b6 = (((C) & 0x001F)<< 3); \
|
||||
D0_PIN_PORT->BSRR = D8_BSR_MASK(r6); \
|
||||
D1_PIN_PORT->BSRR = D9_BSR_MASK(r6); \
|
||||
@@ -890,7 +899,7 @@
|
||||
D7_PIN_PORT->BSRR = D7_BSR_MASK(b6); \
|
||||
WR_STB
|
||||
|
||||
// 18 bit color write with swapped bytes
|
||||
// 18-bit color write with swapped bytes
|
||||
#define tft_Write_16S(C) Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||
|
||||
#else
|
||||
@@ -917,7 +926,7 @@
|
||||
D7_PIN_PORT->BSRR = D7_BSR_MASK(C); \
|
||||
WR_STB
|
||||
|
||||
// 16 bit write with swapped bytes
|
||||
// 16-bit write with swapped bytes
|
||||
#define tft_Write_16S(C) D0_PIN_PORT->BSRR = D0_BSR_MASK(C); \
|
||||
D1_PIN_PORT->BSRR = D1_BSR_MASK(C); \
|
||||
D2_PIN_PORT->BSRR = D2_BSR_MASK(C); \
|
||||
@@ -960,66 +969,58 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI ILI948x TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#elif defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
|
||||
// Write 8 bits to TFT
|
||||
#define tft_Write_8(C) \
|
||||
{ spiBuffer[0] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 1, 10); }
|
||||
#define SPI_TXE_CHECK while(!__HAL_SPI_GET_FLAG(&spiHal, SPI_FLAG_TXE)){}
|
||||
//BSY check must allow for APB clock delay by checking TXE flag first
|
||||
#define SPI_BUSY_CHECK SPI_TXE_CHECK; while( __HAL_SPI_GET_FLAG(&spiHal, SPI_FLAG_BSY)){}
|
||||
#define TX_FIFO SPI_TXE_CHECK; *((__IO uint8_t *)&SPIX->DR)
|
||||
|
||||
// Convert 16 bit colour to 18 bit and write in 3 bytes
|
||||
#define tft_Write_16(C) \
|
||||
{ spiBuffer[0] = ((C) & 0xF800)>>8; spiBuffer[1] = ((C) & 0x07E0)>>3; spiBuffer[2] = ((C) & 0x001F)<<3; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 3, 10); }
|
||||
//#define tft_Write_8(C) spi.transfer(C)
|
||||
#define tft_Write_8(C) TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
#define tft_Write_16(C) TX_FIFO = ((C) & 0xF800)>>8; TX_FIFO = ((C) & 0x07E0)>>3; TX_FIFO = ((C) & 0x001F)<<3; SPI_BUSY_CHECK
|
||||
#define tft_Write_16S(C) TX_FIFO = (C) & 0xF8; TX_FIFO = ((C) & 0xE000)>>11 | ((C) & 0x07)<<5; TX_FIFO = ((C) & 0x1F00)>>5; SPI_BUSY_CHECK
|
||||
#define tft_Write_16N(C) TX_FIFO = ((C) & 0xF800)>>8; TX_FIFO = ((C) & 0x07E0)>>3; TX_FIFO = ((C) & 0x001F)<<3
|
||||
|
||||
// Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes
|
||||
#define tft_Write_16S(C) \
|
||||
{ spiBuffer[0] = (C) & 0xF8; spiBuffer[1] = ((C) & 0xE000)>>11 | ((C) & 0x07)<<5; spiBuffer[2] = ((C) & 0x1F00)>>5; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 3, 10); }
|
||||
|
||||
// Write 32 bits to TFT
|
||||
#define tft_Write_32(C) \
|
||||
{ spiBuffer[0] = (C)>>24; spiBuffer[1] = (C)>>16; spiBuffer[2] = (C)>>8; spiBuffer[3] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>24; TX_FIFO = (C)>>16; \
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
|
||||
// Write two address coordinates
|
||||
#define tft_Write_32C(C,D) \
|
||||
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; spiBuffer[2] = (D)>>8; spiBuffer[3] = D; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); \
|
||||
TX_FIFO = (D)>>8; TX_FIFO = (D); SPI_BUSY_CHECK
|
||||
|
||||
// Write same value twice
|
||||
#define tft_Write_32D(C) \
|
||||
{ spiBuffer[0] = spiBuffer[2] = (C)>>8; spiBuffer[1] = spiBuffer[3] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); \
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to write commands/pixel colour data to a SPI Raspberry Pi TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (RPI_DISPLAY_TYPE)
|
||||
|
||||
#define tft_Write_8(C) \
|
||||
{ spiBuffer[0] = 0; spiBuffer[1] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 2, 10); }
|
||||
#define SPI_TXE_CHECK while(!__HAL_SPI_GET_FLAG(&spiHal, SPI_FLAG_TXE)){}
|
||||
//BSY check must allow for APB clock delay by checking TXE flag first
|
||||
#define SPI_BUSY_CHECK SPI_TXE_CHECK; while( __HAL_SPI_GET_FLAG(&spiHal, SPI_FLAG_BSY)){}
|
||||
#define TX_FIFO SPI_TXE_CHECK; *((__IO uint8_t *)&SPIX->DR)
|
||||
|
||||
#define tft_Write_16(C) \
|
||||
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 2, 10); }
|
||||
|
||||
#define tft_Write_16S(C) \
|
||||
{ spiBuffer[0] = C; spiBuffer[1] = (C)>>8; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 2, 10); }
|
||||
//#define tft_Write_8(C) spi.transfer(C)
|
||||
#define tft_Write_8(C) TX_FIFO = (0); TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
#define tft_Write_16(C) TX_FIFO = (C)>>8; TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
#define tft_Write_16S(C) TX_FIFO = (C); TX_FIFO = (C)>>8; SPI_BUSY_CHECK
|
||||
#define tft_Write_16N(C) TX_FIFO = (C)>>8; TX_FIFO = (C)
|
||||
|
||||
#define tft_Write_32(C) \
|
||||
{ spiBuffer[0] = (C)>>24; spiBuffer[1] = (C)>>16; spiBuffer[2] = (C)>>8; spiBuffer[3] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>24; TX_FIFO = (C)>>16; \
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
|
||||
#define tft_Write_32C(C,D) \
|
||||
{ spiBuffer[1] = ((C)>>8); spiBuffer[3] = (C); spiBuffer[5] = ((D)>>8); spiBuffer[7] = D; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 8, 10); }
|
||||
TX_FIFO = (0); TX_FIFO = (C)>>8; TX_FIFO = (0); TX_FIFO = (C); \
|
||||
TX_FIFO = (0); TX_FIFO = (D)>>8; TX_FIFO = (0); TX_FIFO = (D); SPI_BUSY_CHECK
|
||||
|
||||
#define tft_Write_32D(C) \
|
||||
{ spiBuffer[1] = ((C)>>8); spiBuffer[3] = (C); spiBuffer[5] = ((C)>>8); spiBuffer[7] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 8, 10); }
|
||||
TX_FIFO = (0); TX_FIFO = (C)>>8; TX_FIFO = (0); TX_FIFO = (C); \
|
||||
TX_FIFO = (0); TX_FIFO = (C)>>8; TX_FIFO = (0); TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros for all other SPI displays
|
||||
@@ -1027,37 +1028,37 @@
|
||||
|
||||
#else
|
||||
|
||||
#if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER)
|
||||
// Temporary workaround for issue #510 part 2
|
||||
#define tft_Write_8(C) spi.transfer(C)
|
||||
#else
|
||||
#define tft_Write_8(C) \
|
||||
{ spiBuffer[0] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 1, 10); delayMicroseconds(1);}
|
||||
#endif
|
||||
//#define DC_DELAY delayMicroseconds(1) // Premature BSY clear Hardware bug?
|
||||
|
||||
#define tft_Write_16(C) \
|
||||
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 2, 10); }
|
||||
#define SPI_TXE_CHECK while(!__HAL_SPI_GET_FLAG(&spiHal, SPI_FLAG_TXE)){}
|
||||
//BSY check must allow for APB clock delay by checking TXE flag first
|
||||
#define SPI_BUSY_CHECK SPI_TXE_CHECK; while( __HAL_SPI_GET_FLAG(&spiHal, SPI_FLAG_BSY)){}
|
||||
#define TX_FIFO SPI_TXE_CHECK; *((__IO uint8_t *)&SPIX->DR)
|
||||
|
||||
#define tft_Write_16S(C) \
|
||||
{ spiBuffer[0] = C; spiBuffer[1] = (C)>>8; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 2, 10); }
|
||||
#define tft_Write_8(C) TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
#define tft_Write_16(C) TX_FIFO = (C)>>8; TX_FIFO = (C); SPI_BUSY_CHECK
|
||||
#define tft_Write_16S(C) TX_FIFO = (C); TX_FIFO = (C)>>8; SPI_BUSY_CHECK
|
||||
#define tft_Write_16N(C) TX_FIFO = (C)>>8; TX_FIFO = (C)
|
||||
|
||||
#define tft_Write_32(C) \
|
||||
{ spiBuffer[0] = (C)>>24; spiBuffer[1] = (C)>>16; spiBuffer[2] = (C)>>8; spiBuffer[3] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>24; TX_FIFO = (C)>>16; \
|
||||
tft_Write_16((uint16_t) ((C)>>0))
|
||||
|
||||
#define tft_Write_32C(C,D) \
|
||||
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; spiBuffer[2] = (D)>>8; spiBuffer[3] = D; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); \
|
||||
tft_Write_16((uint16_t) (D))
|
||||
|
||||
#define tft_Write_32D(C) \
|
||||
{ spiBuffer[0] = spiBuffer[2] = (C)>>8; spiBuffer[1] = spiBuffer[3] = C; \
|
||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
|
||||
TX_FIFO = (C)>>8; TX_FIFO = (C); \
|
||||
tft_Write_16((uint16_t) (C))
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef DC_DELAY
|
||||
//#define DC_DELAY delayMicroseconds(1) // Premature BSY clear hardware bug?
|
||||
#define DC_DELAY
|
||||
#endif
|
||||
|
||||
#ifndef tft_Write_16N
|
||||
#define tft_Write_16N tft_Write_16
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// -------------------------------------------------- //
|
||||
// This file is autogenerated by pioasm; do not edit! //
|
||||
// 16 bit parallel //
|
||||
// 16-bit parallel //
|
||||
// -------------------------------------------------- //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// -------------------------------------------------- //
|
||||
// This file is autogenerated by pioasm; do not edit! //
|
||||
// 8 bit parallel //
|
||||
// 8-bit parallel //
|
||||
// -------------------------------------------------- //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// -------------------------------------------------- //
|
||||
// This file is autogenerated by pioasm; do not edit! //
|
||||
// 8 + 16 bit SPI - no auto colour conversion //
|
||||
// 8 + 16-bit SPI - no auto colour conversion //
|
||||
// -------------------------------------------------- //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// -------------------------------------------------- //
|
||||
// This file is autogenerated by pioasm; do not edit! //
|
||||
// 8 + 18 bit SPI - no auto colour conversion //
|
||||
// 8 + 18-bit SPI - no auto colour conversion //
|
||||
// -------------------------------------------------- //
|
||||
|
||||
#pragma once
|
||||
|
||||
+29
-30
@@ -1,6 +1,10 @@
|
||||
A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has been added for Q&A etc. Use the ["Issues"](https://github.com/Bodmer/TFT_eSPI/issues) tab only for problems with the library. Thanks!
|
||||
# News
|
||||
1. New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing (which will then render faster). The arc ends can be straight or rounded. The arc drawing algorithm uses an optimised fixed point sqrt() function to improve performance on processors that do not have a hardware Floating Point Unit (e.g. RP2040). Here are two demo images, on the left smooth (anti-aliased) arcs with rounded ends, the image to the right is the same resolution (grabbed from the same 240x240 TFT) with the smoothing diasbled (no anti-aliasing):
|
||||
1. The Create_font Processing sketch has been updated to automatically create a complete C header file. The automatic opening of the font folder can also be disabled within the Processing sketch. (Thanks to Pierre-Loup Martin).
|
||||
|
||||
2. New board setup files have been added for the Seeed XIAO with round display, LilyGo T-Embed S3, LilyGo_T_QT_Pro_S3, ESP32 S3 Box and ESP32_S3_Box_Lite. The "RPi" interface style boards are now supported with the ESP32 S3.
|
||||
|
||||
3. New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing (which will then render faster). The arc ends can be straight or rounded. The arc drawing algorithm uses an optimised fixed point sqrt() function to improve performance on processors that do not have a hardware Floating Point Unit (e.g. RP2040). Here are two demo images, on the left smooth (anti-aliased) arcs with rounded ends, the image to the right is the same resolution (grabbed from the same 240x240 TFT) with the smoothing diasbled (no anti-aliasing):
|
||||
|
||||
 
|
||||
|
||||
@@ -8,17 +12,17 @@ A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has b
|
||||
|
||||

|
||||
|
||||
2. An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by [takkaO](https://github.com/takkaO/OpenFontRender), I have created a branch with some bug fixes [here](https://github.com/Bodmer/OpenFontRender). The library provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, the ESP8266 does not have sufficient RAM due to the glyph render complexity. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
|
||||
4. An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by [takkaO](https://github.com/takkaO/OpenFontRender). The library provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, the ESP8266 does not have sufficient RAM due to the glyph render complexity. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
|
||||
|
||||

|
||||
|
||||
3. New GUI examples have been added for sliders, buttons, graphs and meters. These examples require a new support library here:
|
||||
5. New GUI examples have been added for sliders, buttons, graphs and meters. These examples require a new support library here:
|
||||
|
||||
[TFT_eWidget](https://github.com/Bodmer/TFT_eWidget)
|
||||
|
||||
4. Support has been added in v2.4.70 for the RP2040 with 16 bit parallel displays. This has been tested and the screen update performance is very good (4ms to clear 320 x 480 screen with HC8357C). The use of the RP2040 PIO makes it easy to change the write cycle timing for different displays. DMA with 16 bit transfers is also supported.
|
||||
6. Support has been added in v2.4.70 for the RP2040 with 16-bit parallel displays. This has been tested and the screen update performance is very good (4ms to clear 320 x 480 screen with HC8357C). The use of the RP2040 PIO makes it easy to change the write cycle timing for different displays. DMA with 16-bit transfers is also supported.
|
||||
|
||||
5. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA only on ESP32 S3 at the moment). Tested with v2.0.3 RC1 of the ESP32 board package. Example setups:
|
||||
7. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA only on ESP32 S3 at the moment). Tested with v2.0.3 RC1 of the ESP32 board package. Example setups:
|
||||
|
||||
[Setup70_ESP32_S2_ILI9341.h](https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup70_ESP32_S2_ILI9341.h)
|
||||
|
||||
@@ -28,18 +32,18 @@ A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has b
|
||||
|
||||
[Setup70d_ILI9488_S3_Parallel.h](https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup70d_ILI9488_S3_Parallel.h)
|
||||
|
||||
6. Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
|
||||
8. Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLUE, true);
|
||||
spr.setTextColor(TFT_BLUE, TFT_BLACK, true);
|
||||
|
||||
Note: background rendering for Smooth fonts is also now available when using the print stream e.g. with: tft.println("Hello World");
|
||||
|
||||
7. New anti-aliased graphics functions to draw lines, wedge shaped lines, circles and rounded rectangles. [Examples are included](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Smooth%20Graphics). Examples have also been added to [display PNG compressed images](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/PNG%20Images) (note: requires ~40kbytes RAM).
|
||||
9. New anti-aliased graphics functions to draw lines, wedge shaped lines, circles and rounded rectangles. [Examples are included](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Smooth%20Graphics). Examples have also been added to [display PNG compressed images](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/PNG%20Images) (note: requires ~40kbytes RAM).
|
||||
|
||||
8. Users of PowerPoint experienced with running macros may be interested in the [pptm sketch generator here](https://github.com/Bodmer/PowerPoint_to_sketch), this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros [created by Kris Kasprzak here](https://github.com/KrisKasprzak/Powerpoint-ILI9341_t3).
|
||||
10. Users of PowerPoint experienced with running macros may be interested in the [pptm sketch generator here](https://github.com/Bodmer/PowerPoint_to_sketch), this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros [created by Kris Kasprzak here](https://github.com/KrisKasprzak/Powerpoint-ILI9341_t3).
|
||||
|
||||
9. The library contains two new functions for rectangles filled with a horizontal or vertical coloured gradient:
|
||||
11. The library contains two new functions for rectangles filled with a horizontal or vertical coloured gradient:
|
||||
|
||||
tft.fillRectHGradient(x, y, w, h, color1, color2);
|
||||
|
||||
@@ -47,19 +51,14 @@ Note: background rendering for Smooth fonts is also now available when using the
|
||||
|
||||

|
||||
|
||||
10. The RP2040 8 bit parallel interface uses the PIO. The PIO now manages the "setWindow" and "block fill" actions, releasing the processor for other tasks when areas of the screen are being filled with a colour. The PIO can optionally be used for SPI interface displays if #define RP2040_PIO_SPI is put in the setup file. Touch screens and pixel read operations are not supported when the PIO interface is used.
|
||||
12. The RP2040 8-bit parallel interface uses the PIO. The PIO now manages the "setWindow" and "block fill" actions, releasing the processor for other tasks when areas of the screen are being filled with a colour. The PIO can optionally be used for SPI interface displays if #define RP2040_PIO_SPI is put in the setup file. Touch screens and pixel read operations are not supported when the PIO interface is used.
|
||||
The RP2040 PIO features only work with [Earle Philhower's board package](https://github.com/earlephilhower/arduino-pico), NOT the Arduino Mbed version.
|
||||
|
||||
The use of PIO for SPI allows the RP2040 to be over-clocked (up to 250MHz works on my boards) in Earle's board package whilst still maintaining high SPI clock rates.
|
||||
|
||||
11. DMA can now be used with the Raspberry Pi Pico (RP2040) when used with 8/16 bit parallel and 16 bit colour SPI displays. See "Bouncy_Circles" sketch.
|
||||
|
||||
["Bouncing circles"](https://www.youtube.com/watch?v=njFXIzCTQ_Q&lc=UgymaUIwOIuihvYh-Qt4AaABAg)
|
||||
|
||||
|
||||
# TFT_eSPI
|
||||
|
||||
A feature rich Arduino IDE compatible graphics and fonts library for 32 bit processors. The library is targeted at 32 bit processors, it has been performance optimised for RP2040, STM32, ESP8266 and ESP32 types, other 32 bit processors may be used but will use the slower generic Arduino interface calls. The library can be loaded using the Arduino IDE's Library Manager. Direct Memory Access (DMA) can be used with the ESP32, RP2040 and STM32 processors with SPI interface displays to improve rendering performance. DMA with a parallel interface (8 and 16 bit) is only supported with the RP2040.
|
||||
A feature rich Arduino IDE compatible graphics and fonts library for 32-bit processors. The library is targeted at 32-bit processors, it has been performance optimised for RP2040, STM32, ESP8266 and ESP32 types, other 32-bit processors may be used but will use the slower generic Arduino interface calls. The library can be loaded using the Arduino IDE's Library Manager. Direct Memory Access (DMA) can be used with the ESP32, RP2040 and STM32 processors with SPI interface displays to improve rendering performance. DMA with a parallel interface (8 and 16-bit) is only supported with the RP2040.
|
||||
|
||||
The updates for the ESP32 S2/C3/S3 means that the library requires the ESP32 Arduino board package 2.x.x or later.
|
||||
|
||||
@@ -76,7 +75,7 @@ Optimised drivers have been tested with the following processors:
|
||||
|
||||
The library supports the following interface types for these processors:
|
||||
|
||||
| Processor | 4 wire SPI | 8 bit parallel | 16 bit parallel | DMA support |
|
||||
| Processor | 4 wire SPI | 8-bit parallel | 16-bit parallel | DMA support |
|
||||
|-----------| :---: | :---: | :---: | :---: |
|
||||
| RP2040 | Yes | Yes | Yes | Yes (all) |
|
||||
| ESP32 | Yes | Yes | No | Yes (SPI only) |
|
||||
@@ -89,7 +88,9 @@ The library supports the following interface types for these processors:
|
||||
|
||||
For other (generic) processors only SPI interface displays are supported and the slower Arduino SPI library functions are used by the library. Higher clock speed processors such as used for the Teensy 3.x and 4.x boards will still provide a very good performance with the generic Arduino SPI functions.
|
||||
|
||||
Due to lack of GPIO pins the 8 bit parallel interface is NOT supported on the ESP8266. 8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32 Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
|
||||
4 wire SPI means the display must have SPI interface comaptible signals and a "Data/Command" control signal, this signal line is sometimes labelled DC, RS or A0.
|
||||
|
||||
Due to lack of GPIO pins the 8-bit parallel interface is NOT supported on the ESP8266. 8-bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32Fxxx Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
|
||||
|
||||
Support for the XPT2046 touch screen controller is built into the library and can be used with SPI interface displays. Third party touch support libraries are also available when using a display parallel interface.
|
||||
|
||||
@@ -103,8 +104,8 @@ Displays using the following controllers are supported:
|
||||
* ILI9481 (DMA not supported with SPI)
|
||||
* ILI9486 (DMA not supported with SPI)
|
||||
* ILI9488 (DMA not supported with SPI)
|
||||
* HX8357B (16 bit parallel tested with RP2040)
|
||||
* HX8357C (16 bit parallel tested with RP2040)
|
||||
* HX8357B (16-bit parallel tested with RP2040)
|
||||
* HX8357C (16-bit parallel tested with RP2040)
|
||||
* HX8357D
|
||||
* R61581
|
||||
* RM68120 (support files added but untested)
|
||||
@@ -118,27 +119,25 @@ Displays using the following controllers are supported:
|
||||
|
||||
ILI9341 and ST7796 SPI based displays are recommended as starting point for experimenting with this library.
|
||||
|
||||
The library supports some TFT displays designed for the Raspberry Pi (RPi) that are based on a ILI9486 or ST7796 driver chip with a 480 x 320 pixel screen. The ILI9486 RPi 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. Note that due to design variations between these displays not all RPi displays will work with this library, so purchasing a RPi display of these types solely for use with this library is NOT recommended.
|
||||
The library supports some TFT displays designed for the Raspberry Pi (RPi) that are based on a ILI9486 or ST7796 driver chip with a 480 x 320 pixel screen. The ILI9486 RPi 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. Note that due to design variations between these displays not all RPi displays will work with this library, so purchasing a RPi display of these types solely for use with this library is NOT recommended.
|
||||
|
||||
A "good" RPi display is the [MHS-4.0 inch Display-B type ST7796](http://www.lcdwiki.com/MHS-4.0inch_Display-B) which provides good performance. This has a dedicated controller and can be clocked at up to 80MHz with the ESP32 (125MHz with overclocked RP2040, 55MHz with STM32 and 40MHz with ESP8266). The [MHS-3.5 inch RPi ILI9486](http://www.lcdwiki.com/MHS-3.5inch_RPi_Display) based display is also supported, however the MHS ILI9341 based display of the same type does NOT work with this library.
|
||||
|
||||
Some displays permit the internal TFT screen RAM to be read, a few of the examples use this feature. The TFT_Screen_Capture example allows full screens to be captured and sent to a PC, this is handy to create program documentation.
|
||||
|
||||
The library supports Waveshare 2 and 3 colour ePaper displays using full frame buffers. This addition is relatively immature and thus only one example has been provided.
|
||||
|
||||
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.
|
||||
|
||||
# Sprites
|
||||
|
||||
A Sprite is notionally an invisible graphics screen that is kept in the processors RAM. Graphics can be drawn into the Sprite just as they can be drawn directly to the screen. Once the Sprite is completed it can be plotted onto the screen in any position. If there is sufficient RAM then the Sprite can be the same size as the screen and used as a frame buffer. Sprites by default use 16 bit colours, the bit depth can be set to 8 bits (256 colours) , or 1 bit (any 2 colours) to reduce the RAM needed. On an ESP8266 the largest 16 bit colour Sprite that can be created is about 160x128 pixels, this consumes 40Kbytes of RAM. On an ESP32 the workspace RAM is more limited than the datasheet implies so a 16 bit colour Sprite is limited to about 200x200 pixels (~80Kbytes), an 8 bit sprite to 320x240 pixels (~76kbytes). A 1 bit per pixel Sprite requires only 9600 bytes for a full 320 x 240 screen buffer, this is ideal for supporting use with 2 colour bitmap fonts.
|
||||
A Sprite is notionally an invisible graphics screen that is kept in the processors RAM. Graphics can be drawn into the Sprite just as they can be drawn directly to the screen. Once the Sprite is completed it can be plotted onto the screen in any position. If there is sufficient RAM then the Sprite can be the same size as the screen and used as a frame buffer. Sprites by default use 16-bit colours, the bit depth can be set to 8 bits (256 colours) , or 1 bit (any 2 colours) to reduce the RAM needed. On an ESP8266 the largest 16-bit colour Sprite that can be created is about 160x128 pixels, this consumes 40Kbytes of RAM. On an ESP32 the workspace RAM is more limited than the datasheet implies so a 16-bit colour Sprite is limited to about 200x200 pixels (~80Kbytes), an 8-bit sprite to 320x240 pixels (~76kbytes). A 1 bit per pixel Sprite requires only 9600 bytes for a full 320 x 240 screen buffer, this is ideal for supporting use with 2 colour bitmap fonts.
|
||||
|
||||
One or more sprites can be created, a sprite can be any pixel width and height, limited only by available RAM. The RAM needed for a 16 bit colour depth Sprite is (2 x width x height) bytes, for a Sprite with 8 bit colour depth the RAM needed is (width x height) bytes. Sprites can be created and deleted dynamically as needed in the sketch, this means RAM can be freed up after the Sprite has been plotted on the screen, more RAM intensive WiFi based code can then be run and normal graphics operations still work.
|
||||
One or more sprites can be created, a sprite can be any pixel width and height, limited only by available RAM. The RAM needed for a 16-bit colour depth Sprite is (2 x width x height) bytes, for a Sprite with 8-bit colour depth the RAM needed is (width x height) bytes. Sprites can be created and deleted dynamically as needed in the sketch, this means RAM can be freed up after the Sprite has been plotted on the screen, more RAM intensive WiFi based code can then be run and normal graphics operations still work.
|
||||
|
||||
Drawing graphics into a sprite is very fast, for those familiar with the Adafruit "graphicstest" example, this whole test completes in 18ms in a 160x128 sprite. Examples of sprite use can be found in the "examples/Sprite" folder.
|
||||
|
||||
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.
|
||||
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 "Animated_dial" example shows how dials can be created using a rotated Sprite for the needle. To run this example the TFT interface must support reading from the screen RAM (not all do). The dial rim and scale is a jpeg image, created using a paint program.
|
||||
|
||||
@@ -158,7 +157,7 @@ The library supports SPI overlap on the ESP8266 so the TFT screen can share MOSI
|
||||
|
||||
# Fonts
|
||||
|
||||
The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-aliased (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 contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-aliased (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 the different 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.
|
||||
|
||||
@@ -167,7 +166,7 @@ Configuration of the library font selections, pins used to interface with the TF
|
||||
|
||||
# Anti-aliased Fonts
|
||||
|
||||
Anti-aliased (smooth) font files in "vlw" format are generated by the free [Processing IDE](https://processing.org/) using a sketch included in the library Tools folder. This sketch with the Processing IDE can be used to generate font files from your computer's font set or any TrueType (.ttf) font, the font file can include **any** combination of 16 bit Unicode characters. This means Greek, Japanese and any other UCS-2 glyphs can be used. Character arrays and Strings in UTF-8 format are supported.
|
||||
Anti-aliased (smooth) font files in "vlw" format are generated by the free [Processing IDE](https://processing.org/) using a sketch included in the library Tools folder. This sketch with the Processing IDE can be used to generate font files from your computer's font set or any TrueType (.ttf) font, the font file can include **any** combination of 16-bit Unicode characters. This means Greek, Japanese and any other UCS-2 glyphs can be used. Character arrays and Strings in UTF-8 format are supported.
|
||||
|
||||
The .vlw files must be uploaded to the processors FLASH filing system (SPIFFS, LittleFS or SD card) for use. Alternatively the .vlw files can be converted to C arrays (see "Smooth Font -> FLASH_Array" examples) and stored directly in FLASH as part of the compile process. The array based approach is convenient, provides performance improvements and is suitable where: either use of a filing system is undesirable, or the processor type (e.g. STM32) does not support a FLASH based filing system.
|
||||
|
||||
@@ -189,9 +188,9 @@ Anti-aliased fonts can also be drawn over a gradient background with a callback
|
||||
|
||||
Anti-aliased fonts cannot be scaled with setTextSize so you need to create a font for each size you need. See examples.
|
||||
|
||||
# 8 bit parallel support
|
||||
# 8-bit parallel support
|
||||
|
||||
The common 8 bit "Mcufriend" shields are supported for the STM Nucleo 64/144 boards and ESP32 UNO style board. The STM32 "Blue/Black Pill" boards can also be used with 8 bit parallel displays.
|
||||
The common 8-bit "Mcufriend" shields are supported for the STM Nucleo 64/144 boards and ESP32 UNO style board. The STM32 "Blue/Black Pill" boards can also be used with 8-bit parallel displays.
|
||||
|
||||
The ESP32 board I have been using for testing has the following pinout:
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@ and the TFT chip driver library. It supports the ESP8266, ESP32,
|
||||
STM32 and RP2040 processors with performance optimised code. Other
|
||||
Arduino IDE compatible boards are also supported but the library
|
||||
then uses generic functions which will be slower. The library uses
|
||||
32 bit variables extensively so this will affect performance on 8
|
||||
and 16 bit processors.
|
||||
32-bit variables extensively so this will affect performance on 8
|
||||
and 16-bit processors.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#define TFT_HEIGHT 240
|
||||
#endif
|
||||
|
||||
// Delay between some initialisation commands
|
||||
@@ -14,6 +14,15 @@
|
||||
#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
|
||||
@@ -29,6 +38,3 @@
|
||||
#define TFT_MAD_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_RGB 0x00
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
@@ -9,20 +9,48 @@
|
||||
writedata(TFT_MAD_BGR);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 2;
|
||||
rowstart = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 1;
|
||||
rowstart = 2;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2: // Inverter portrait
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 2;
|
||||
rowstart = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 1;
|
||||
rowstart = 2;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the HX8357B driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the HX8357C driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the HX8357D driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
writedata(0x01);
|
||||
|
||||
writecommand(HX8357_COLMOD);
|
||||
writedata(0x55); // 16 bit
|
||||
writedata(0x55); // 16-bit
|
||||
|
||||
writecommand(HX8357_MADCTL);
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
@@ -42,6 +42,12 @@
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -57,6 +63,3 @@
|
||||
#define TFT_MAD_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_RGB 0x00
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -66,10 +72,6 @@
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#endif
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
|
||||
// All ILI9341 specific commands some are used by init()
|
||||
#define ILI9341_NOP 0x00
|
||||
#define ILI9341_SWRESET 0x01
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the ILI9341 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the ILI9481 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
@@ -64,9 +64,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -153,9 +153,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -242,9 +242,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -327,9 +327,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -415,9 +415,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -527,9 +527,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -605,9 +605,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
@@ -700,9 +700,9 @@
|
||||
|
||||
writecommand(0x3a);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT)
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -56,6 +62,3 @@
|
||||
#define TFT_MAD_SS 0x02
|
||||
#define TFT_MAD_GS 0x01
|
||||
#define TFT_MAD_RGB 0x00
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the ILI9486 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
writedata(0x55); // 16-bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
writedata(0x66); // 18-bit colour interface
|
||||
#endif
|
||||
|
||||
writecommand(0xC0); // 1100.0000 Power Control 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the ILI9488 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
|
||||
writecommand(0x3A); // Pixel Interface Format
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour for parallel
|
||||
writedata(0x55); // 16-bit colour for parallel
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour for SPI
|
||||
writedata(0x66); // 18-bit colour for SPI
|
||||
#endif
|
||||
|
||||
writecommand(0xB0); // Interface Mode Control
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the R61581 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
#define TFT_NOP 0x0000
|
||||
#define TFT_SWRST 0x0100
|
||||
|
||||
#define TFT_INVOFF 0x2000
|
||||
#define TFT_INVON 0x2100
|
||||
|
||||
#define TFT_DISPOFF 0x2800
|
||||
#define TFT_DISPON 0x2900
|
||||
|
||||
#define TFT_CASET 0x2A00
|
||||
#define TFT_PASET 0x2B00
|
||||
#define TFT_RAMWR 0x2C00
|
||||
@@ -44,6 +50,3 @@
|
||||
#else
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
|
||||
#endif
|
||||
|
||||
#define TFT_INVOFF 0x2000
|
||||
#define TFT_INVON 0x2100
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the RM68140 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -50,6 +56,3 @@
|
||||
#define TFT_MAD_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_RGB 0x00
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -51,6 +57,3 @@
|
||||
#else
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#endif
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
writedata(0x21 | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
writecommand(0xF0); //pixel data interface
|
||||
writedata(0x00); //8 bit bus
|
||||
writedata(0x00); //8-bit bus
|
||||
|
||||
delay(1);
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
writedata(0x21 | TFT_MAD_COLOR_ORDER);
|
||||
|
||||
writecommand(0xF0); //pixel data interface
|
||||
writedata(0x00); //8 bit bus
|
||||
writedata(0x00); //8-bit bus
|
||||
|
||||
delay(1);
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
writedata(0x21 | TFT_MAD_COLOR_ORDER); // -- Set rotation
|
||||
|
||||
writecommand(0xF0); //pixel data interface
|
||||
writedata(0x00); //8 bit bus
|
||||
writedata(0x00); //8-bit bus
|
||||
|
||||
delay(10);
|
||||
|
||||
@@ -371,7 +371,7 @@
|
||||
//writedata(0x0050); //16-bit/pixel
|
||||
|
||||
writecommand(0xF0); //pixel data interface
|
||||
writedata(0x00); //000 = 8 bit bus, 011 = 16 bit, 110 = 9 bit
|
||||
writedata(0x00); //000 = 8-bit bus, 011 = 16-bit, 110 = 9-bit
|
||||
|
||||
writecommand(0xBC);
|
||||
writedata(0x40); //contrast value
|
||||
|
||||
@@ -95,6 +95,12 @@
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -125,9 +131,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
// ST7735 specific commands used in init
|
||||
#define ST7735_NOP 0x00
|
||||
#define ST7735_SWRESET 0x01
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
// 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 320
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 480
|
||||
#endif
|
||||
|
||||
// Generic commands used by TFT_eSPI.cpp
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#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
|
||||
@@ -31,10 +42,6 @@
|
||||
#define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
|
||||
#endif
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
|
||||
// ST7796 specific commands
|
||||
#define ST7796_NOP 0x00
|
||||
#define ST7796_SWRESET 0x01
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// This is the command sequence that initialises the ST7796 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
// This setup information uses simple 8-bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
@@ -9,21 +9,49 @@
|
||||
writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 49;
|
||||
rowstart = 0;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 0;
|
||||
rowstart = 49;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 49;
|
||||
rowstart = 0;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 0;
|
||||
rowstart = 49;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
// These next rotations are for bottom up BMP drawing
|
||||
case 4:
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/***************************************************************************************
|
||||
** Others
|
||||
***************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_WARNINGS
|
||||
#define DISABLE_ALL_LIBRARY_WARNINGS
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** TFT_eSPI Configuration defines
|
||||
***************************************************************************************/
|
||||
@@ -137,7 +145,9 @@
|
||||
#endif
|
||||
|
||||
#if CONFIG_TFT_RST == -1
|
||||
#error "Invalid Reset pin. Check TFT_eSPI configuration"
|
||||
#if !defined(DISABLE_ALL_LIBRARY_WARNINGS)
|
||||
#warning "Invalid Reset pin. Check TFT_eSPI configuration"
|
||||
#endif
|
||||
#else
|
||||
#define TFT_RST CONFIG_TFT_RST
|
||||
#endif
|
||||
@@ -307,12 +317,4 @@
|
||||
#define SPI_TOUCH_FREQUENCY CONFIG_SPI_TOUCH_FREQUENCY
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** Section 6: Others
|
||||
***************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_WARNINGS
|
||||
#define DISABLE_ALL_LIBRARY_WARNINGS
|
||||
#endif
|
||||
|
||||
#endif // TFT_CONFIG_H
|
||||
|
||||
+92
-84
@@ -1,5 +1,5 @@
|
||||
/***************************************************
|
||||
Arduino TFT graphics library targeted at 32 bit
|
||||
Arduino TFT graphics library targeted at 32-bit
|
||||
processors such as ESP32, ESP8266 and STM32.
|
||||
|
||||
This is a stand-alone library that contains the
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#if defined (ESP32)
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#include "Processors/TFT_eSPI_ESP32_S3.c" // Tested with SPI and 8 bit parallel
|
||||
#include "Processors/TFT_eSPI_ESP32_S3.c" // Tested with SPI and 8-bit parallel
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#include "Processors/TFT_eSPI_ESP32_C3.c" // Tested with SPI (8 bit parallel will probably work too!)
|
||||
#include "Processors/TFT_eSPI_ESP32_C3.c" // Tested with SPI (8-bit parallel will probably work too!)
|
||||
#else
|
||||
#include "Processors/TFT_eSPI_ESP32.c"
|
||||
#endif
|
||||
@@ -467,7 +467,7 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
|
||||
lockTransaction = false; // start/endWrite lock flag to allow sketch to keep SPI bus access open
|
||||
|
||||
_booted = true; // Default attributes
|
||||
_cp437 = true; // Legacy GLCD font bug fix
|
||||
_cp437 = false; // Legacy GLCD font bug fix disabled by default
|
||||
_utf8 = true; // UTF8 decoding enabled
|
||||
|
||||
#if defined (FONT_FS_AVAILABLE) && defined (SMOOTH_FONT)
|
||||
@@ -942,7 +942,7 @@ void TFT_eSPI::commandList (const uint8_t *addr)
|
||||
{
|
||||
writecommand(pgm_read_byte(addr++)); // Read, issue command
|
||||
numArgs = pgm_read_byte(addr++); // Number of args to follow
|
||||
ms = numArgs & TFT_INIT_DELAY; // If hibit set, delay follows args
|
||||
ms = numArgs & TFT_INIT_DELAY; // If high bit set, delay follows args
|
||||
numArgs &= ~TFT_INIT_DELAY; // Mask out delay bit
|
||||
|
||||
while (numArgs--) // For each argument...
|
||||
@@ -974,7 +974,7 @@ void TFT_eSPI::spiwrite(uint8_t c)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: writecommand
|
||||
** Description: Send an 8 bit command to the TFT
|
||||
** Description: Send an 8-bit command to the TFT
|
||||
***************************************************************************************/
|
||||
#ifndef RM68120_DRIVER
|
||||
void TFT_eSPI::writecommand(uint8_t c)
|
||||
@@ -1038,7 +1038,7 @@ void TFT_eSPI::writeRegister16(uint16_t c, uint16_t d)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: writedata
|
||||
** Description: Send a 8 bit data value to the TFT
|
||||
** Description: Send a 8-bit data value to the TFT
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::writedata(uint8_t d)
|
||||
{
|
||||
@@ -1056,7 +1056,7 @@ void TFT_eSPI::writedata(uint8_t d)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: readcommand8
|
||||
** Description: Read a 8 bit data value from an indexed command register
|
||||
** Description: Read a 8-bit data value from an indexed command register
|
||||
***************************************************************************************/
|
||||
uint8_t TFT_eSPI::readcommand8(uint8_t cmd_function, uint8_t index)
|
||||
{
|
||||
@@ -1099,7 +1099,7 @@ uint8_t TFT_eSPI::readcommand8(uint8_t cmd_function, uint8_t index)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: readcommand16
|
||||
** Description: Read a 16 bit data value from an indexed command register
|
||||
** Description: Read a 16-bit data value from an indexed command register
|
||||
***************************************************************************************/
|
||||
uint16_t TFT_eSPI::readcommand16(uint8_t cmd_function, uint8_t index)
|
||||
{
|
||||
@@ -1114,7 +1114,7 @@ uint16_t TFT_eSPI::readcommand16(uint8_t cmd_function, uint8_t index)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: readcommand32
|
||||
** Description: Read a 32 bit data value from an indexed command register
|
||||
** Description: Read a 32-bit data value from an indexed command register
|
||||
***************************************************************************************/
|
||||
uint32_t TFT_eSPI::readcommand32(uint8_t cmd_function, uint8_t index)
|
||||
{
|
||||
@@ -1157,12 +1157,12 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
||||
readByte();
|
||||
#endif
|
||||
|
||||
// Fetch the 16 bit BRG pixel
|
||||
// Fetch the 16-bit BRG pixel
|
||||
//uint16_t rgb = (readByte() << 8) | readByte();
|
||||
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9488_DRIVER) || defined (SSD1963_DRIVER)// Read 3 bytes
|
||||
|
||||
// Read window pixel 24 bit RGB values and fill in LS bits
|
||||
// Read window pixel 24-bit RGB values and fill in LS bits
|
||||
uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
|
||||
|
||||
if (!inTransaction) { CS_H; } // CS_H can be multi-statement
|
||||
@@ -1172,9 +1172,9 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
||||
|
||||
return rgb;
|
||||
|
||||
#else // ILI9481 or ILI9486 16 bit read
|
||||
#else // ILI9481 or ILI9486 16-bit read
|
||||
|
||||
// Fetch the 16 bit BRG pixel
|
||||
// Fetch the 16-bit BRG pixel
|
||||
uint16_t bgr = (readByte() << 8) | readByte();
|
||||
|
||||
if (!inTransaction) { CS_H; } // CS_H can be multi-statement
|
||||
@@ -1289,12 +1289,12 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
// Dummy read to throw away don't care value
|
||||
readByte();
|
||||
|
||||
// Fetch the 24 bit RGB value
|
||||
// Fetch the 24-bit RGB value
|
||||
while (dh--) {
|
||||
int32_t lw = dw;
|
||||
uint16_t* line = data;
|
||||
while (lw--) {
|
||||
// Assemble the RGB 16 bit colour
|
||||
// Assemble the RGB 16-bit colour
|
||||
uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
|
||||
|
||||
// Swapped byte order for compatibility with pushRect()
|
||||
@@ -1304,7 +1304,7 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
}
|
||||
|
||||
#elif defined (SSD1963_DRIVER)
|
||||
// Fetch the 18 bit BRG pixels
|
||||
// Fetch the 18-bit BRG pixels
|
||||
while (dh--) {
|
||||
int32_t lw = dw;
|
||||
uint16_t* line = data;
|
||||
@@ -1324,16 +1324,16 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
// Dummy read to throw away don't care value
|
||||
readByte();
|
||||
|
||||
// Fetch the 16 bit BRG pixels
|
||||
// Fetch the 16-bit BRG pixels
|
||||
while (dh--) {
|
||||
int32_t lw = dw;
|
||||
uint16_t* line = data;
|
||||
while (lw--) {
|
||||
#if defined (ILI9486_DRIVER) || defined (ST7796_DRIVER)
|
||||
// Read the RGB 16 bit colour
|
||||
// Read the RGB 16-bit colour
|
||||
*line++ = readByte() | (readByte() << 8);
|
||||
#else
|
||||
// Read the BRG 16 bit colour
|
||||
// Read the BRG 16-bit colour
|
||||
uint16_t bgr = (readByte() << 8) | readByte();
|
||||
// Swap Red and Blue (could check MADCTL setting to see if this is needed)
|
||||
uint16_t rgb = (bgr>>11) | (bgr<<11) | (bgr & 0x7E0);
|
||||
@@ -1372,7 +1372,7 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
// Dummy read to throw away don't care value
|
||||
tft_Read_8();
|
||||
|
||||
// Read window pixel 24 bit RGB values
|
||||
// Read window pixel 24-bit RGB values
|
||||
while (dh--) {
|
||||
int32_t lw = dw;
|
||||
uint16_t* line = data;
|
||||
@@ -1443,7 +1443,7 @@ void TFT_eSPI::pushRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushImage
|
||||
** Description: plot 16 bit colour sprite or image onto TFT
|
||||
** Description: plot 16-bit colour sprite or image onto TFT
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data)
|
||||
{
|
||||
@@ -1473,7 +1473,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *d
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushImage
|
||||
** Description: plot 16 bit sprite or image with 1 colour being transparent
|
||||
** Description: plot 16-bit sprite or image with 1 colour being transparent
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data, uint16_t transp)
|
||||
{
|
||||
@@ -1532,11 +1532,11 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *d
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushImage - for FLASH (PROGMEM) stored images
|
||||
** Description: plot 16 bit image
|
||||
** Description: plot 16-bit image
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data)
|
||||
{
|
||||
// Requires 32 bit aligned access, so use PROGMEM 16 bit word functions
|
||||
// Requires 32-bit aligned access, so use PROGMEM 16-bit word functions
|
||||
PI_CLIP;
|
||||
|
||||
begin_tft_write();
|
||||
@@ -1562,11 +1562,11 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint1
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushImage - for FLASH (PROGMEM) stored images
|
||||
** Description: plot 16 bit image with 1 colour being transparent
|
||||
** Description: plot 16-bit image with 1 colour being transparent
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data, uint16_t transp)
|
||||
{
|
||||
// Requires 32 bit aligned access, so use PROGMEM 16 bit word functions
|
||||
// Requires 32-bit aligned access, so use PROGMEM 16-bit word functions
|
||||
PI_CLIP;
|
||||
|
||||
begin_tft_write();
|
||||
@@ -1618,7 +1618,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint1
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushImage
|
||||
** Description: plot 8 bit or 4 bit or 1 bit image or sprite using a line buffer
|
||||
** Description: plot 8-bit or 4-bit or 1 bit image or sprite using a line buffer
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint8_t *data, bool bpp8, uint16_t *cmap)
|
||||
{
|
||||
@@ -1637,7 +1637,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint8
|
||||
{
|
||||
_swapBytes = false;
|
||||
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5-bit colour lookup table
|
||||
|
||||
_lastColor = -1; // Set to illegal value
|
||||
|
||||
@@ -1751,7 +1751,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint8
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushImage
|
||||
** Description: plot 8 bit or 4 bit or 1 bit image or sprite using a line buffer
|
||||
** Description: plot 8-bit or 4-bit or 1 bit image or sprite using a line buffer
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t *data, bool bpp8, uint16_t *cmap)
|
||||
{
|
||||
@@ -1770,7 +1770,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t *da
|
||||
{
|
||||
_swapBytes = false;
|
||||
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5-bit colour lookup table
|
||||
|
||||
_lastColor = -1; // Set to illegal value
|
||||
|
||||
@@ -1903,7 +1903,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t *da
|
||||
|
||||
data += dx + dy * w;
|
||||
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5-bit colour lookup table
|
||||
|
||||
_lastColor = -1; // Set to illegal value
|
||||
|
||||
@@ -2089,7 +2089,7 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t *da
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushMaskedImage
|
||||
** Description: Render a 16 bit colour image to TFT with a 1bpp mask
|
||||
** Description: Render a 16-bit colour image to TFT with a 1bpp mask
|
||||
***************************************************************************************/
|
||||
// Can be used with a 16bpp sprite and a 1bpp sprite for the mask
|
||||
void TFT_eSPI::pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *img, uint8_t *mask)
|
||||
@@ -2097,7 +2097,7 @@ void TFT_eSPI::pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint1
|
||||
if (_vpOoB || w < 1 || h < 1) return;
|
||||
|
||||
// To simplify mask handling the window clipping is done by the pushImage function
|
||||
// Each mask image line assumed to be padded to and integer number of bytes & padding bits are 0
|
||||
// Each mask image line assumed to be padded to an integer number of bytes & padding bits are 0
|
||||
|
||||
begin_tft_write();
|
||||
inTransaction = true;
|
||||
@@ -2158,6 +2158,7 @@ void TFT_eSPI::pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint1
|
||||
xp += clearCount;
|
||||
clearCount = 0;
|
||||
pushImage(x + xp, y, setCount, 1, iptr + xp); // pushImage handles clipping
|
||||
if (mptr >= eptr) break;
|
||||
xp += setCount;
|
||||
}
|
||||
} while (setCount || mptr < eptr);
|
||||
@@ -2174,7 +2175,7 @@ void TFT_eSPI::pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint1
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: setSwapBytes
|
||||
** Description: Used by 16 bit pushImage() to swap byte order in colours
|
||||
** Description: Used by 16-bit pushImage() to swap byte order in colours
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::setSwapBytes(bool swap)
|
||||
{
|
||||
@@ -2230,7 +2231,7 @@ void TFT_eSPI::readRectRGB(int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_
|
||||
// Dummy read to throw away don't care value
|
||||
tft_Read_8();
|
||||
|
||||
// Read window pixel 24 bit RGB values, buffer must be set in sketch to 3 * w * h
|
||||
// Read window pixel 24-bit RGB values, buffer must be set in sketch to 3 * w * h
|
||||
uint32_t len = w * h;
|
||||
while (len--) {
|
||||
|
||||
@@ -2352,7 +2353,7 @@ void TFT_eSPI::drawCircleHelper( int32_t x0, int32_t y0, int32_t rr, uint8_t cor
|
||||
//begin_tft_write(); // Sprite class can use this function, avoiding begin_tft_write()
|
||||
inTransaction = true;
|
||||
|
||||
while (xe < rr--)
|
||||
do
|
||||
{
|
||||
while (f < 0) {
|
||||
++xe;
|
||||
@@ -2398,7 +2399,8 @@ void TFT_eSPI::drawCircleHelper( int32_t x0, int32_t y0, int32_t rr, uint8_t cor
|
||||
}
|
||||
}
|
||||
xs = xe;
|
||||
}
|
||||
} while (xe < rr--);
|
||||
|
||||
inTransaction = lockTransaction;
|
||||
end_tft_write(); // Does nothing if Sprite class uses this function
|
||||
}
|
||||
@@ -2865,7 +2867,7 @@ void TFT_eSPI::setCursor(int16_t x, int16_t y)
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::setCursor(int16_t x, int16_t y, uint8_t font)
|
||||
{
|
||||
textfont = font;
|
||||
setTextFont(font);
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
}
|
||||
@@ -3138,7 +3140,7 @@ int16_t TFT_eSPI::textWidth(const char *string, uint8_t font)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: fontsLoaded
|
||||
** Description: return an encoded 16 bit value showing the fonts loaded
|
||||
** Description: return an encoded 16-bit value showing the fonts loaded
|
||||
***************************************************************************************/
|
||||
// Returns a value showing which fonts are loaded (bit N set = Font N loaded)
|
||||
uint16_t TFT_eSPI::fontsLoaded(void)
|
||||
@@ -3187,8 +3189,6 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
|
||||
#endif
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
|
||||
if (c > 255) return;
|
||||
|
||||
int32_t xd = x + _xDatum;
|
||||
int32_t yd = y + _yDatum;
|
||||
|
||||
@@ -3198,6 +3198,9 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
|
||||
((yd + 8 * size - 1) < _vpY)) // Clip top
|
||||
return;
|
||||
|
||||
if (c > 255) return;
|
||||
if (!_cp437 && c > 175) c++;
|
||||
|
||||
bool fillbg = (bg != color);
|
||||
bool clip = xd < _vpX || xd + 6 * textsize >= _vpW || yd < _vpY || yd + 8 * textsize >= _vpH;
|
||||
|
||||
@@ -3381,7 +3384,7 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
||||
DC_D;
|
||||
// Temporary solution is to include the RP2040 code here
|
||||
#if (defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_ARCH_MBED)) && !defined(RP2040_PIO_INTERFACE)
|
||||
// For ILI9225 and RP2040 the slower Arduino SPI transfer calls were used, so need to swap back to 16 bit mode
|
||||
// For ILI9225 and RP2040 the slower Arduino SPI transfer calls were used, so need to swap back to 16-bit mode
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
#endif
|
||||
@@ -3412,12 +3415,12 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
||||
// Temporary solution is to include the RP2040 optimised code here
|
||||
#if (defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_ARCH_MBED))
|
||||
#if !defined(RP2040_PIO_INTERFACE)
|
||||
// Use hardware SPI port, this code does not swap from 8 to 16 bit
|
||||
// Use hardware SPI port, this code does not swap from 8 to 16-bit
|
||||
// to avoid the spi_set_format() call overhead
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
DC_C;
|
||||
#if !defined (SPI_18BIT_DRIVER)
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16-bit transfers
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
#else
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
@@ -3515,7 +3518,7 @@ void TFT_eSPI::readAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h)
|
||||
|
||||
// Temporary solution is to include the RP2040 optimised code here
|
||||
#if (defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_ARCH_MBED)) && !defined(RP2040_PIO_INTERFACE)
|
||||
// Use hardware SPI port, this code does not swap from 8 to 16 bit
|
||||
// Use hardware SPI port, this code does not swap from 8 to 16-bit
|
||||
// to avoid the spi_set_format() call overhead
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
DC_C;
|
||||
@@ -3638,7 +3641,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
#if !defined(RP2040_PIO_INTERFACE)
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16-bit transfers
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
#else
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
@@ -3673,7 +3676,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
DC_C;
|
||||
spi_get_hw(SPI_X)->dr = (uint32_t)TFT_RAMWR;
|
||||
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18-bit colour
|
||||
uint8_t r = (color & 0xF800)>>8;
|
||||
uint8_t g = (color & 0x07E0)>>3;
|
||||
uint8_t b = (color & 0x001F)<<3;
|
||||
@@ -3683,7 +3686,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
#else
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
DC_D;
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
|
||||
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16-bit transfers
|
||||
spi_get_hw(SPI_X)->dr = (uint32_t)color;
|
||||
#else
|
||||
spi_get_hw(SPI_X)->dr = (uint32_t)color>>8;
|
||||
@@ -3840,7 +3843,7 @@ void TFT_eSPI::writeColor(uint16_t color, uint32_t len)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushColors
|
||||
** Description: push an array of pixels for 16 bit raw image drawing
|
||||
** Description: push an array of pixels for 16-bit raw image drawing
|
||||
***************************************************************************************/
|
||||
// Assumed that setAddrWindow() has previously been called
|
||||
// len is number of bytes, not pixels
|
||||
@@ -3874,7 +3877,7 @@ void TFT_eSPI::pushColors(uint16_t *data, uint32_t len, bool swap)
|
||||
** Function name: drawLine
|
||||
** Description: draw a line between 2 arbitrary points
|
||||
***************************************************************************************/
|
||||
// Bresenham's algorithm - thx wikipedia - speed enhanced by Bodmer to use
|
||||
// Bresenham's algorithm - thx Wikipedia - speed enhanced by Bodmer to use
|
||||
// an efficient FastH/V Line draw routine for line segments of 2 pixels or more
|
||||
void TFT_eSPI::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
|
||||
{
|
||||
@@ -3954,7 +3957,7 @@ constexpr float deg2rad = 3.14159265359/180.0;
|
||||
uint16_t TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color, uint8_t alpha, uint32_t bg_color)
|
||||
{
|
||||
if (bg_color == 0x00FFFFFF) bg_color = readPixel(x, y);
|
||||
color = alphaBlend(alpha, color, bg_color);
|
||||
color = fastBlend(alpha, color, bg_color);
|
||||
drawPixel(x, y, color);
|
||||
return color;
|
||||
}
|
||||
@@ -4103,7 +4106,7 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
float fabssin = fabsf(sinf(startAngle * deg2rad));
|
||||
|
||||
// U16.16 slope of arc start
|
||||
uint32_t slope = (fabscos/(fabssin + minDivisor)) * (float)(1<<16);
|
||||
uint32_t slope = (fabscos/(fabssin + minDivisor)) * (float)(1UL<<16);
|
||||
|
||||
// Update slope table, add slope for arc start
|
||||
if (startAngle <= 90) {
|
||||
@@ -4127,7 +4130,7 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
fabssin = fabsf(sinf(endAngle * deg2rad));
|
||||
|
||||
// U16.16 slope of arc end
|
||||
slope = (uint32_t)((fabscos/(fabssin + minDivisor)) * (float)(1<<16));
|
||||
slope = (uint32_t)((fabscos/(fabssin + minDivisor)) * (float)(1UL<<16));
|
||||
|
||||
// Work out which quadrants will need to be drawn and add slope for arc end
|
||||
if (endAngle <= 90) {
|
||||
@@ -4195,7 +4198,7 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
if (alpha < 16) continue; // Skip low alpha pixels
|
||||
|
||||
// If background is read it must be done in each quadrant
|
||||
uint16_t pcol = alphaBlend(alpha, fg_color, bg_color);
|
||||
uint16_t pcol = fastBlend(alpha, fg_color, bg_color);
|
||||
// Check if an AA pixels need to be drawn
|
||||
slope = ((r - cy)<<16)/(r - cx);
|
||||
if (slope <= startSlope[0] && slope >= endSlope[0]) // BL
|
||||
@@ -4366,7 +4369,7 @@ void TFT_eSPI::drawSmoothRoundRect(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
if (alpha < 16) continue; // Skip low alpha pixels
|
||||
|
||||
// If background is read it must be done in each quadrant - TODO
|
||||
uint16_t pcol = alphaBlend(alpha, fg_color, bg_color);
|
||||
uint16_t pcol = fastBlend(alpha, fg_color, bg_color);
|
||||
if (quadrants & 0x8) drawPixel(x + cx - r, y - cy + r + h, pcol); // BL
|
||||
if (quadrants & 0x1) drawPixel(x + cx - r, y + cy - r, pcol); // TL
|
||||
if (quadrants & 0x2) drawPixel(x - cx + r + w, y + cy - r, pcol); // TR
|
||||
@@ -4522,11 +4525,12 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
||||
bg = readPixel(xp, yp); swin = true;
|
||||
}
|
||||
#ifdef GC9A01_DRIVER
|
||||
uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
uint16_t pcol = fastBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
drawPixel(xp, yp, pcol);
|
||||
swin = swin;
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
pushColor(fastBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -4559,11 +4563,12 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
||||
bg = readPixel(xp, yp); swin = true;
|
||||
}
|
||||
#ifdef GC9A01_DRIVER
|
||||
uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
uint16_t pcol = fastBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
drawPixel(xp, yp, pcol);
|
||||
swin = swin;
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
pushColor(fastBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -4717,7 +4722,7 @@ void TFT_eSPI::fillRectVGradient(int16_t x, int16_t y, int16_t w, int16_t h, uin
|
||||
while (h--) {
|
||||
drawFastHLine(x, y++, w, color);
|
||||
alpha += delta;
|
||||
color = alphaBlend((uint8_t)alpha, color1, color2);
|
||||
color = fastBlend((uint8_t)alpha, color1, color2);
|
||||
}
|
||||
|
||||
end_nin_write();
|
||||
@@ -4755,7 +4760,7 @@ void TFT_eSPI::fillRectHGradient(int16_t x, int16_t y, int16_t w, int16_t h, uin
|
||||
while (w--) {
|
||||
drawFastVLine(x++, y, h, color);
|
||||
alpha += delta;
|
||||
color = alphaBlend((uint8_t)alpha, color1, color2);
|
||||
color = fastBlend((uint8_t)alpha, color1, color2);
|
||||
}
|
||||
|
||||
end_nin_write();
|
||||
@@ -4764,7 +4769,7 @@ void TFT_eSPI::fillRectHGradient(int16_t x, int16_t y, int16_t w, int16_t h, uin
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: color565
|
||||
** Description: convert three 8 bit RGB levels to a 16 bit colour value
|
||||
** Description: convert three 8-bit RGB levels to a 16-bit colour value
|
||||
***************************************************************************************/
|
||||
uint16_t TFT_eSPI::color565(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
@@ -4774,7 +4779,7 @@ uint16_t TFT_eSPI::color565(uint8_t r, uint8_t g, uint8_t b)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: color16to8
|
||||
** Description: convert 16 bit colour to an 8 bit 332 RGB colour value
|
||||
** Description: convert 16-bit colour to an 8-bit 332 RGB colour value
|
||||
***************************************************************************************/
|
||||
uint8_t TFT_eSPI::color16to8(uint16_t c)
|
||||
{
|
||||
@@ -4784,11 +4789,11 @@ uint8_t TFT_eSPI::color16to8(uint16_t c)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: color8to16
|
||||
** Description: convert 8 bit colour to a 16 bit 565 colour value
|
||||
** Description: convert 8-bit colour to a 16-bit 565 colour value
|
||||
***************************************************************************************/
|
||||
uint16_t TFT_eSPI::color8to16(uint8_t color)
|
||||
{
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5 bit colour lookup table
|
||||
uint8_t blue[] = {0, 11, 21, 31}; // blue 2 to 5-bit colour lookup table
|
||||
uint16_t color16 = 0;
|
||||
|
||||
// =====Green===== ===============Red==============
|
||||
@@ -4801,7 +4806,7 @@ uint16_t TFT_eSPI::color8to16(uint8_t color)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: color16to24
|
||||
** Description: convert 16 bit colour to a 24 bit 888 colour value
|
||||
** Description: convert 16-bit colour to a 24-bit 888 colour value
|
||||
***************************************************************************************/
|
||||
uint32_t TFT_eSPI::color16to24(uint16_t color565)
|
||||
{
|
||||
@@ -4814,7 +4819,7 @@ uint32_t TFT_eSPI::color16to24(uint16_t color565)
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: color24to16
|
||||
** Description: convert 24 bit colour to a 16 bit 565 colour value
|
||||
** Description: convert 24-bit colour to a 16-bit 565 colour value
|
||||
***************************************************************************************/
|
||||
uint32_t TFT_eSPI::color24to16(uint32_t color888)
|
||||
{
|
||||
@@ -4895,26 +4900,26 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t c)
|
||||
{
|
||||
if (!_utf8) return c;
|
||||
|
||||
// 7 bit Unicode Code Point
|
||||
// 7-bit Unicode Code Point
|
||||
if ((c & 0x80) == 0x00) {
|
||||
decoderState = 0;
|
||||
return c;
|
||||
}
|
||||
|
||||
if (decoderState == 0) {
|
||||
// 11 bit Unicode Code Point
|
||||
// 11-bit Unicode Code Point
|
||||
if ((c & 0xE0) == 0xC0) {
|
||||
decoderBuffer = ((c & 0x1F)<<6);
|
||||
decoderState = 1;
|
||||
return 0;
|
||||
}
|
||||
// 16 bit Unicode Code Point
|
||||
// 16-bit Unicode Code Point
|
||||
if ((c & 0xF0) == 0xE0) {
|
||||
decoderBuffer = ((c & 0x0F)<<12);
|
||||
decoderState = 2;
|
||||
return 0;
|
||||
}
|
||||
// 21 bit Unicode Code Point not supported so fall-back to extended ASCII
|
||||
// 21-bit Unicode Code Point not supported so fall-back to extended ASCII
|
||||
// if ((c & 0xF8) == 0xF0) return c;
|
||||
}
|
||||
else {
|
||||
@@ -4947,21 +4952,24 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
||||
|
||||
if (!_utf8) return c;
|
||||
|
||||
// 7 bit Unicode
|
||||
// 7-bit Unicode
|
||||
if ((c & 0x80) == 0x00) return c;
|
||||
|
||||
// 11 bit Unicode
|
||||
// 11-bit Unicode
|
||||
if (((c & 0xE0) == 0xC0) && (remaining > 1))
|
||||
return ((c & 0x1F)<<6) | (buf[(*index)++]&0x3F);
|
||||
|
||||
// 16 bit Unicode
|
||||
// 16-bit Unicode
|
||||
if (((c & 0xF0) == 0xE0) && (remaining > 2)) {
|
||||
c = ((c & 0x0F)<<12) | ((buf[(*index)++]&0x3F)<<6);
|
||||
return c | ((buf[(*index)++]&0x3F));
|
||||
}
|
||||
|
||||
// 21 bit Unicode not supported so fall-back to extended ASCII
|
||||
// if ((c & 0xF8) == 0xF0) return c;
|
||||
// 21-bit Unicode not supported so fall-back to extended ASCII
|
||||
// if (((c & 0xF8) == 0xF0) && (remaining > 3)) {
|
||||
// c = ((c & 0x07) << 18) | ((buf[(*index)++] & 0x03F) << 12);
|
||||
// c |= ((buf[(*index)++] & 0x3F) << 6);
|
||||
// return c | ((buf[(*index)++] & 0x3F));
|
||||
|
||||
return c; // fall-back to extended ASCII
|
||||
}
|
||||
@@ -4971,12 +4979,12 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
||||
** Function name: alphaBlend
|
||||
** Description: Blend 16bit foreground and background
|
||||
*************************************************************************************x*/
|
||||
inline uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
||||
uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
||||
{
|
||||
// Split out and blend 5 bit red and blue channels
|
||||
// Split out and blend 5-bit red and blue channels
|
||||
uint32_t rxb = bgc & 0xF81F;
|
||||
rxb += ((fgc & 0xF81F) - rxb) * (alpha >> 2) >> 6;
|
||||
// Split out and blend 6 bit green channel
|
||||
// Split out and blend 6-bit green channel
|
||||
uint32_t xgx = bgc & 0x07E0;
|
||||
xgx += ((fgc & 0x07E0) - xgx) * alpha >> 8;
|
||||
// Recombine channels
|
||||
@@ -5016,9 +5024,9 @@ uint32_t TFT_eSPI::alphaBlend24(uint8_t alpha, uint32_t fgc, uint32_t bgc, uint8
|
||||
uint32_t rxx = bgc & 0xFF0000;
|
||||
rxx += ((fgc & 0xFF0000) - rxx) * alpha >> 8;
|
||||
uint32_t xgx = bgc & 0x00FF00;
|
||||
xgx += ((fgc & 0xFF0000) - xgx) * alpha >> 8;
|
||||
xgx += ((fgc & 0x00FF00) - xgx) * alpha >> 8;
|
||||
uint32_t xxb = bgc & 0x0000FF;
|
||||
xxb += ((fgc & 0xFF0000) - xxb) * alpha >> 8;
|
||||
xxb += ((fgc & 0x0000FF) - xxb) * alpha >> 8;
|
||||
return (rxx & 0xFF0000) | (xgx & 0x00FF00) | (xxb & 0x0000FF);
|
||||
}
|
||||
|
||||
@@ -5347,7 +5355,7 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
|
||||
|
||||
uint8_t tnp = 0; // Temporary copy of np for while loop
|
||||
uint8_t ts = textsize - 1; // Temporary copy of textsize
|
||||
// 16 bit pixel count so maximum font size is equivalent to 180x180 pixels in area
|
||||
// 16-bit pixel count so maximum font size is equivalent to 180x180 pixels in area
|
||||
// w is total number of pixels to plot to fill character block
|
||||
while (pc < w) {
|
||||
line = pgm_read_byte((uint8_t *)flash_address);
|
||||
@@ -5931,7 +5939,7 @@ void TFT_eSPI::setTextFont(uint8_t f)
|
||||
** Function name: getSPIinstance
|
||||
** Description: Get the instance of the SPI class
|
||||
***************************************************************************************/
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && ! defined (RP2040_PIO_INTERFACE)
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_INTERFACE)
|
||||
SPIClass& TFT_eSPI::getSPIinstance(void)
|
||||
{
|
||||
return spi;
|
||||
|
||||
+49
-32
@@ -12,11 +12,11 @@
|
||||
Last review/edit by Bodmer: 04/02/22
|
||||
****************************************************/
|
||||
|
||||
// Stop fonts etc being loaded multiple times
|
||||
// Stop fonts etc. being loaded multiple times
|
||||
#ifndef _TFT_eSPIH_
|
||||
#define _TFT_eSPIH_
|
||||
|
||||
#define TFT_ESPI_VERSION "2.5.22"
|
||||
#define TFT_ESPI_VERSION "2.5.43"
|
||||
|
||||
// Bit level feature flags
|
||||
// Bit 0 set: viewport capability
|
||||
@@ -29,13 +29,14 @@
|
||||
//Standard support
|
||||
#include <Arduino.h>
|
||||
#include <Print.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_INTERFACE)
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
/***************************************************************************************
|
||||
** Section 2: Load library and processor specific header files
|
||||
***************************************************************************************/
|
||||
// Include header file that defines the fonts loaded, the TFT drivers
|
||||
// available and the pins to be used, etc, etc
|
||||
// available and the pins to be used, etc. etc.
|
||||
#ifdef CONFIG_TFT_eSPI_ESPIDF
|
||||
#include "TFT_config.h"
|
||||
#endif
|
||||
@@ -326,12 +327,12 @@ const PROGMEM fontinfo fontdata [] = {
|
||||
#define TFT_SKYBLUE 0x867D /* 135, 206, 235 */
|
||||
#define TFT_VIOLET 0x915C /* 180, 46, 226 */
|
||||
|
||||
// Next is a special 16 bit colour value that encodes to 8 bits
|
||||
// and will then decode back to the same 16 bit value.
|
||||
// Convenient for 8 bit and 16 bit transparent sprites.
|
||||
// Next is a special 16-bit colour value that encodes to 8 bits
|
||||
// and will then decode back to the same 16-bit value.
|
||||
// Convenient for 8-bit and 16-bit transparent sprites.
|
||||
#define TFT_TRANSPARENT 0x0120 // This is actually a dark green
|
||||
|
||||
// Default palette for 4 bit colour sprites
|
||||
// Default palette for 4-bit colour sprites
|
||||
static const uint16_t default_4bit_palette[] PROGMEM = {
|
||||
TFT_BLACK, // 0 ^
|
||||
TFT_BROWN, // 1 |
|
||||
@@ -504,7 +505,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
// Support for half duplex (bi-directional SDA) SPI bus where MOSI must be switched to input
|
||||
#ifdef TFT_SDA_READ
|
||||
#if defined (TFT_eSPI_ENABLE_8_BIT_READ)
|
||||
uint8_t tft_Read_8(void); // Read 8 bit value from TFT command register
|
||||
uint8_t tft_Read_8(void); // Read 8-bit value from TFT command register
|
||||
#endif
|
||||
void begin_SDA_Read(void); // Begin a read on a half duplex (bi-directional SDA) SPI bus - sets MOSI to input
|
||||
void end_SDA_Read(void); // Restore MOSI to output
|
||||
@@ -597,7 +598,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
getPivotY(void); // Get pivot y
|
||||
|
||||
// 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 size must be at least w * h
|
||||
// Read a block of pixels to a data buffer, buffer is 16-bit and the size must be at least w * h
|
||||
void readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data);
|
||||
// Write a block of pixels to the screen which have been read by readRect()
|
||||
void pushRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data);
|
||||
@@ -618,11 +619,11 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
// FLASH version
|
||||
void pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint8_t *data, bool bpp8, uint16_t *cmap = nullptr);
|
||||
|
||||
// Render a 16 bit colour image with a 1bpp mask
|
||||
// Render a 16-bit colour image with a 1bpp mask
|
||||
void pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *img, uint8_t *mask);
|
||||
|
||||
// This next function has been used successfully to dump the TFT screen to a PC for documentation purposes
|
||||
// It reads a screen area and returns the 3 RGB 8 bit colour values of each pixel in the buffer
|
||||
// It reads a screen area and returns the 3 RGB 8-bit colour values of each pixel in the buffer
|
||||
// Set w and h to 1 to read 1 pixel's colour. The data buffer must be at least w * h * 3 bytes
|
||||
void readRectRGB(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t *data);
|
||||
|
||||
@@ -649,7 +650,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
drawRightString(const String& string, int32_t x, int32_t y, uint8_t font); // Deprecated, use setTextDatum() and drawString()
|
||||
|
||||
|
||||
// Text rendering and font handling support funtions
|
||||
// Text rendering and font handling support functions
|
||||
void setCursor(int16_t x, int16_t y), // Set cursor for tft.print()
|
||||
setCursor(int16_t x, int16_t y, uint8_t font); // Set cursor and font number for tft.print()
|
||||
|
||||
@@ -662,7 +663,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
|
||||
void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height
|
||||
|
||||
void setTextDatum(uint8_t datum); // Set text datum position (default is top left), see Section 6 above
|
||||
void setTextDatum(uint8_t datum); // Set text datum position (default is top left), see Section 5 above
|
||||
uint8_t getTextDatum(void);
|
||||
|
||||
void setTextPadding(uint16_t x_width); // Set text padding (background blanking/over-write) width in pixels
|
||||
@@ -680,8 +681,8 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
textWidth(const char *string), // Returns pixel width of string in current font
|
||||
textWidth(const String& string, uint8_t font), // As above for String types
|
||||
textWidth(const String& string),
|
||||
fontHeight(int16_t font), // Returns pixel height of string in specified font
|
||||
fontHeight(void); // Returns pixel width of string in current font
|
||||
fontHeight(int16_t font), // Returns pixel height of specified font
|
||||
fontHeight(void); // Returns pixel height of current font
|
||||
|
||||
// Used by library and Smooth font class to extract Unicode point codes from a UTF8 encoded string
|
||||
uint16_t decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining),
|
||||
@@ -700,11 +701,11 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
// Low level read/write
|
||||
void spiwrite(uint8_t); // legacy support only
|
||||
#ifdef RM68120_DRIVER
|
||||
void writecommand(uint16_t c); // Send a 16 bit command, function resets DC/RS high ready for data
|
||||
void writeRegister8(uint16_t c, uint8_t d); // Write 8 bit data data to 16 bit command register
|
||||
void writeRegister16(uint16_t c, uint16_t d); // Write 16 bit data data to 16 bit command register
|
||||
void writecommand(uint16_t c); // Send a 16-bit command, function resets DC/RS high ready for data
|
||||
void writeRegister8(uint16_t c, uint8_t d); // Write 8-bit data data to 16-bit command register
|
||||
void writeRegister16(uint16_t c, uint16_t d); // Write 16-bit data data to 16-bit command register
|
||||
#else
|
||||
void writecommand(uint8_t c); // Send an 8 bit command, function resets DC/RS high ready for data
|
||||
void writecommand(uint8_t c); // Send an 8-bit command, function resets DC/RS high ready for data
|
||||
#endif
|
||||
void writedata(uint8_t d); // Send data with DC/RS set high
|
||||
|
||||
@@ -716,30 +717,31 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
|
||||
|
||||
// Colour conversion
|
||||
// Convert 8 bit red, green and blue to 16 bits
|
||||
// Convert 8-bit red, green and blue to 16 bits
|
||||
uint16_t color565(uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
// Convert 8 bit colour to 16 bits
|
||||
// Convert 8-bit colour to 16 bits
|
||||
uint16_t color8to16(uint8_t color332);
|
||||
// Convert 16 bit colour to 8 bits
|
||||
// Convert 16-bit colour to 8 bits
|
||||
uint8_t color16to8(uint16_t color565);
|
||||
|
||||
// Convert 16 bit colour to/from 24 bit, R+G+B concatenated into LS 24 bits
|
||||
// Convert 16-bit colour to/from 24-bit, R+G+B concatenated into LS 24 bits
|
||||
uint32_t color16to24(uint16_t color565);
|
||||
uint32_t color24to16(uint32_t color888);
|
||||
|
||||
// Alpha blend 2 colours, see generic "alphaBlend_Test" example
|
||||
// alpha = 0 = 100% background colour
|
||||
// alpha = 255 = 100% foreground colour
|
||||
inline uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
// 16 bit colour alphaBlend with alpha dither (dither reduces colour banding)
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
|
||||
// 16-bit colour alphaBlend with alpha dither (dither reduces colour banding)
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc, uint8_t dither);
|
||||
// 24 bit colour alphaBlend with optional alpha dither
|
||||
// 24-bit colour alphaBlend with optional alpha dither
|
||||
uint32_t alphaBlend24(uint8_t alpha, uint32_t fgc, uint32_t bgc, uint8_t dither = 0);
|
||||
|
||||
// Direct Memory Access (DMA) support functions
|
||||
// These can be used for SPI writes when using the ESP32 (original) or STM32 processors.
|
||||
// DMA also works on a RP2040 processor with PIO based SPI and parallel (8 and 16 bit) interfaces
|
||||
// DMA also works on a RP2040 processor with PIO based SPI and parallel (8 and 16-bit) interfaces
|
||||
// Bear in mind DMA will only be of benefit in particular circumstances and can be tricky
|
||||
// to manage by noobs. The functions have however been designed to be noob friendly and
|
||||
// avoid a few DMA behaviour "gotchas".
|
||||
@@ -818,8 +820,9 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
bool verifySetupID(uint32_t id);
|
||||
|
||||
// Global variables
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_INTERFACE)
|
||||
static SPIClass& getSPIinstance(void); // Get SPI class handle
|
||||
|
||||
#endif
|
||||
uint32_t textcolor, textbgcolor; // Text foreground and background colours
|
||||
|
||||
uint32_t bitmap_fg, bitmap_bg; // Bitmap foreground (bit=1) and background (bit=0) colours
|
||||
@@ -936,7 +939,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
bool _booted; // init() or begin() has already run once
|
||||
|
||||
// User sketch manages these via set/getAttribute()
|
||||
bool _cp437; // If set, use correct CP437 charset (default is ON)
|
||||
bool _cp437; // If set, use correct CP437 charset (default is OFF)
|
||||
bool _utf8; // If set, use UTF-8 decoder in print stream 'write()' function (default ON)
|
||||
bool _psram_enable; // Enable PSRAM use for library functions (TBD) and Sprites
|
||||
|
||||
@@ -960,7 +963,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
#ifdef TOUCH_CS
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RP2040_PIO_INTERFACE)
|
||||
#if !defined(DISABLE_ALL_LIBRARY_WARNINGS)
|
||||
#error >>>>------>> Touch functions not supported in 8/16 bit parallel mode or with RP2040 PIO.
|
||||
#error >>>>------>> Touch functions not supported in 8/16-bit parallel mode or with RP2040 PIO.
|
||||
#endif
|
||||
#else
|
||||
#include "Extensions/Touch.h" // Loaded if TOUCH_CS is defined by user
|
||||
@@ -982,6 +985,20 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
template <typename T> static inline void
|
||||
transpose(T& a, T& b) { T t = a; a = b; b = t; }
|
||||
|
||||
// Fast alphaBlend
|
||||
template <typename A, typename F, typename B> static inline uint16_t
|
||||
fastBlend(A alpha, F fgc, B bgc)
|
||||
{
|
||||
// Split out and blend 5-bit red and blue channels
|
||||
uint32_t rxb = bgc & 0xF81F;
|
||||
rxb += ((fgc & 0xF81F) - rxb) * (alpha >> 2) >> 6;
|
||||
// Split out and blend 6-bit green channel
|
||||
uint32_t xgx = bgc & 0x07E0;
|
||||
xgx += ((fgc & 0x07E0) - xgx) * alpha >> 8;
|
||||
// Recombine channels
|
||||
return (rxb & 0xF81F) | (xgx & 0x07E0);
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Section 10: Additional extension classes
|
||||
***************************************************************************************/
|
||||
|
||||
@@ -48,13 +48,13 @@ Software License Agreement (FreeBSD License)
|
||||
// >>>>>>>>>>>>>>>>>>>> INSTRUCTIONS <<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
// See comments below in code for specifying the font parameters (point size,
|
||||
// unicode blocks to include etc). Ranges of characters (glyphs) and specific
|
||||
// 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 location.
|
||||
|
||||
// 16 bit Unicode point codes 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.
|
||||
|
||||
@@ -134,11 +134,17 @@ String fontType = ".ttf";
|
||||
|
||||
|
||||
// Define the font size in points for the TFT_eSPI font file
|
||||
int fontSize = 20;
|
||||
int fontSize = 28;
|
||||
|
||||
// Font size to use in the Processing sketch display window that pops up (can be different to above)
|
||||
int displayFontSize = 28;
|
||||
|
||||
// Create a C header (.h file) ready to be used or copied in your sketch folder
|
||||
boolean createHeaderFile = true;
|
||||
|
||||
// Automaticely open the folder with created files when done
|
||||
boolean openFolder = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Next we specify which unicode blocks from the the Basic Multilingual Plane (BMP) are included in the final font file. //
|
||||
// Note: The ttf/otf font file MAY NOT contain all possible Unicode characters, refer to the fonts online documentation. //
|
||||
@@ -363,7 +369,7 @@ static final int[] specificUnicodes = {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Variable to hold the inclusive Unicode range (16 bit values only for this sketch)
|
||||
// Variable to hold the inclusive Unicode range (16-bit values only for this sketch)
|
||||
int firstUnicode = 0;
|
||||
int lastUnicode = 0;
|
||||
|
||||
@@ -392,7 +398,7 @@ void setup() {
|
||||
// Set the fontName from the array number or the defined fontName
|
||||
if (fontNumber >= 0)
|
||||
{
|
||||
fontName = fontList[fontNumber];
|
||||
// fontName = fontList[fontNumber];
|
||||
fontType = "";
|
||||
}
|
||||
|
||||
@@ -499,11 +505,13 @@ void setup() {
|
||||
|
||||
println("Created font " + fontName + str(fontSize) + ".vlw");
|
||||
|
||||
String fontFileName = "FontFiles/" + fontName + str(fontSize) + ".vlw";
|
||||
|
||||
// creating file
|
||||
try {
|
||||
print("Saving to sketch FontFiles folder... ");
|
||||
|
||||
OutputStream output = createOutput("FontFiles/" + fontName + str(fontSize) + ".vlw");
|
||||
OutputStream output = createOutput(fontFileName);
|
||||
font.save(output);
|
||||
output.close();
|
||||
|
||||
@@ -513,11 +521,50 @@ void setup() {
|
||||
|
||||
// Open up the FontFiles folder to access the saved file
|
||||
String path = sketchPath();
|
||||
Desktop.getDesktop().open(new File(path+"/FontFiles"));
|
||||
if(openFolder){
|
||||
Desktop.getDesktop().open(new File(path+"/FontFiles"));
|
||||
}
|
||||
|
||||
System.err.println("All done! Note: Rectangles are displayed for non-existant characters.");
|
||||
}
|
||||
catch(IOException e) {
|
||||
println("Doh! Failed to create the file");
|
||||
}
|
||||
|
||||
if(!createHeaderFile) return;
|
||||
// Now creating header file if the option was specified.
|
||||
try{
|
||||
print("saving header file to FontFile folder...");
|
||||
|
||||
InputStream input = createInputRaw(fontFileName);
|
||||
PrintWriter output = createWriter("FontFiles/" + fontName + str(fontSize) + ".h");
|
||||
|
||||
output.println("#include <pgmspace.h>");
|
||||
output.println();
|
||||
output.println("const uint8_t " + fontName + str(fontSize) + "[] PROGMEM = {");
|
||||
|
||||
int i = 0;
|
||||
int data = input.read();
|
||||
while(data != -1){
|
||||
output.print("0x");
|
||||
output.print(hex(data, 2));
|
||||
if(i++ < 15){
|
||||
output.print(", ");
|
||||
} else {
|
||||
output.println(",");
|
||||
i = 0;
|
||||
}
|
||||
data = input.read();
|
||||
}
|
||||
// font.save(output);
|
||||
output.println("\n};");
|
||||
|
||||
output.close();
|
||||
input.close();
|
||||
|
||||
println("C header file created.");
|
||||
|
||||
} catch(IOException e){
|
||||
println("Failed to create C header file");
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -55,7 +55,7 @@ int max_allowed = 1000; // Maximum number of save images allowed before a resta
|
||||
// These are default values, this sketch obtains the actual values from the Arduino board
|
||||
int tft_width = 480; // default TFT width (automatic - sent by Arduino)
|
||||
int tft_height = 480; // default TFT height (automatic - sent by Arduino)
|
||||
int color_bytes = 2; // 2 for 16 bit, 3 for three RGB bytes (automatic - sent by Arduino)
|
||||
int color_bytes = 2; // 2 for 16-bit, 3 for three RGB bytes (automatic - sent by Arduino)
|
||||
|
||||
import processing.serial.*;
|
||||
|
||||
|
||||
+20
-14
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
@@ -28,15 +28,15 @@
|
||||
//#define NUCLEO_64_TFT
|
||||
//#define NUCLEO_144_TFT
|
||||
|
||||
// STM32 8 bit parallel only:
|
||||
// If STN32 Port A or B pins 0-7 are used for 8 bit parallel data bus bits 0-7
|
||||
// STM32 8-bit parallel only:
|
||||
// If STN32 Port A or B pins 0-7 are used for 8-bit parallel data bus bits 0-7
|
||||
// then this will improve rendering performance by a factor of ~8x
|
||||
//#define STM_PORTA_DATA_BUS
|
||||
//#define STM_PORTB_DATA_BUS
|
||||
|
||||
// Tell the library to use parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
//#defined TFT_PARALLEL_16_BIT // **** 16 bit parallel ONLY for RP2040 processor ****
|
||||
//#defined TFT_PARALLEL_16_BIT // **** 16-bit parallel ONLY for RP2040 processor ****
|
||||
|
||||
// Display type - only define if RPi display
|
||||
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
|
||||
@@ -84,6 +84,7 @@
|
||||
// #define TFT_WIDTH 80
|
||||
// #define TFT_WIDTH 128
|
||||
// #define TFT_WIDTH 172 // ST7789 172 x 320
|
||||
// #define TFT_WIDTH 170 // ST7789 170 x 320
|
||||
// #define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
|
||||
// #define TFT_HEIGHT 160
|
||||
// #define TFT_HEIGHT 128
|
||||
@@ -104,7 +105,7 @@
|
||||
// #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_ROBOTLCD // For some RobotLCD arduino shields (128x160, BGR, https://docs.arduino.cc/retired/getting-started-guides/TFT)
|
||||
// #define ST7735_ROBOTLCD // For some RobotLCD Arduino shields (128x160, BGR, https://docs.arduino.cc/retired/getting-started-guides/TFT)
|
||||
// #define ST7735_REDTAB
|
||||
// #define ST7735_BLACKTAB
|
||||
// #define ST7735_REDTAB160x80 // For 160 x 80 display with 24 pixel offset
|
||||
@@ -166,10 +167,15 @@
|
||||
// ###### 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_MISO PIN_D6 // Automatically assigned with ESP8266 if not defined
|
||||
#define TFT_MOSI PIN_D7 // Automatically assigned with ESP8266 if not defined
|
||||
#define TFT_SCLK PIN_D5 // Automatically assigned with ESP8266 if not defined
|
||||
|
||||
#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_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin)
|
||||
|
||||
@@ -236,7 +242,7 @@
|
||||
|
||||
// ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ######
|
||||
|
||||
// The library supports 8 bit parallel TFTs with the ESP32, the pin
|
||||
// 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!
|
||||
@@ -244,7 +250,7 @@
|
||||
// Parallel bus is only supported for the STM32 and ESP32
|
||||
// Example below is for ESP32 Parallel interface with UNO displays
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// The ESP32 and TFT the pins used for testing are:
|
||||
@@ -324,11 +330,11 @@
|
||||
// For RP2040 processor and SPI displays, uncomment the following line to use the PIO interface.
|
||||
//#define RP2040_PIO_SPI // Leave commented out to use standard RP2040 SPI port interface
|
||||
|
||||
// For RP2040 processor and 8 or 16 bit parallel displays:
|
||||
// For RP2040 processor and 8 or 16-bit parallel displays:
|
||||
// The parallel interface write cycle period is derived from a division of the CPU clock
|
||||
// speed so scales with the processor clock. This means that the divider ratio may need
|
||||
// to be increased when overclocking. I may also need to be adjusted dependant on the
|
||||
// display controller type (ILI94341, HX8357C etc). If RP2040_PIO_CLK_DIV is not defined
|
||||
// to be increased when overclocking. It may also need to be adjusted dependant on the
|
||||
// display controller type (ILI94341, HX8357C etc.). If RP2040_PIO_CLK_DIV is not defined
|
||||
// the library will set default values which may not suit your display.
|
||||
// The display controller data sheet will specify the minimum write cycle period. The
|
||||
// controllers often work reliably for shorter periods, however if the period is too short
|
||||
|
||||
+108
-102
@@ -12,14 +12,11 @@
|
||||
// Create a shortcut to this file on your desktop to permit quick access for editing.
|
||||
// Re-compile and upload after making and saving any changes to this file.
|
||||
|
||||
// Customised User_Setup files are stored in the "User_Setups" folder.
|
||||
|
||||
// It is also possible for the user tft settings to be included with the sketch, see
|
||||
// the "Sketch_with_tft_setup" generic example. This may be more convenient for
|
||||
// multiple projects.
|
||||
// Example User_Setup files are stored in the "User_Setups" folder. These can be used
|
||||
// unmodified or adapted for a particular hardware configuration.
|
||||
|
||||
#ifndef USER_SETUP_LOADED // Lets PlatformIO users define settings in
|
||||
// platformio.ini, see notes in "Tools" folder.
|
||||
// platformio.ini, see notes in "Tools" folder.
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// User configuration selection lines are below //
|
||||
@@ -49,7 +46,7 @@
|
||||
//#include <User_Setups/Setup17_ePaper.h> // Setup file for ESP8266 and any Waveshare ePaper display
|
||||
//#include <User_Setups/Setup18_ST7789.h> // Setup file for ESP8266 configured for ST7789
|
||||
|
||||
//#include <User_Setups/Setup19_RM68140_Parallel.h> // Setup file configured for RM68140 with parallel bus
|
||||
//#include <User_Setups/Setup19_RM68140_Parallel.h> // Setup file configured for RM68140 with parallel bus
|
||||
|
||||
//#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
|
||||
@@ -89,9 +86,11 @@
|
||||
//#include <User_Setups/Setup51_LilyPi_ILI9481.h> // Setup file for LilyGo LilyPi with ILI9481 display
|
||||
//#include <User_Setups/Setup52_LilyPi_ST7796.h> // Setup file for LilyGo LilyPi with ST7796 display
|
||||
|
||||
//#include <User_Setups/Setup60_RP2040_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
//#include <User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h> // Setup file for RP2040 with PIO SPI ILI9341
|
||||
//#include <User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
//#include <User_Setups/Setup60_RP2040_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
//#include <User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h> // Setup file for RP2040 with PIO SPI ILI9341
|
||||
//#include <User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
|
||||
//#include <User_Setups/Setup66_Seeed_XIAO_Round.h> // Setup file for Seeed XIAO with GC9A01 240x240
|
||||
|
||||
//#include <User_Setups/Setup70_ESP32_S2_ILI9341.h> // Setup file for ESP32 S2 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70b_ESP32_S3_ILI9341.h> // Setup file for ESP32 S3 with SPI ILI9341
|
||||
@@ -101,15 +100,16 @@
|
||||
//#include <User_Setups/Setup71_ESP32_S2_ST7789.h> // Setup file for ESP32 S2 with ST7789
|
||||
//#include <User_Setups/Setup72_ESP32_ST7789_172x320.h> // Setup file for ESP32 with ST7789 1.47" 172x320
|
||||
|
||||
//#include <User_Setups/Setup100_RP2040_ILI9488_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ILI9488
|
||||
//#include <User_Setups/Setup101_RP2040_ILI9481_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ILI9481
|
||||
//#include <User_Setups/Setup102_RP2040_ILI9341_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ILI9341
|
||||
//#include <User_Setups/Setup103_RP2040_ILI9486_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ILI9486
|
||||
//#include <User_Setups/Setup104_RP2040_ST7796_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ST7796
|
||||
//#include <User_Setups/Setup100_RP2040_ILI9488_parallel.h> // Setup file for Pico/RP2040 with 8-bit parallel ILI9488
|
||||
//#include <User_Setups/Setup101_RP2040_ILI9481_parallel.h> // Setup file for Pico/RP2040 with 8-bit parallel ILI9481
|
||||
//#include <User_Setups/Setup102_RP2040_ILI9341_parallel.h> // Setup file for Pico/RP2040 with 8-bit parallel ILI9341
|
||||
//#include <User_Setups/Setup103_RP2040_ILI9486_parallel.h> // Setup file for Pico/RP2040 with 8-bit parallel ILI9486
|
||||
//#include <User_Setups/Setup104_RP2040_ST7796_parallel.h> // Setup file for Pico/RP2040 with 8-bit parallel ST7796
|
||||
|
||||
//#include <User_Setups/Setup105_RP2040_ST7796_16bit_parallel.h> // Setup file for RP2040 16 bit parallel display
|
||||
//#include <User_Setups/Setup106_RP2040_ILI9481_16bit_parallel.h> // Setup file for RP2040 16 bit parallel display
|
||||
//#include <User_Setups/Setup107_RP2040_ILI9341_16bit_parallel.h> // Setup file for RP2040 16 bit parallel display
|
||||
//#include <User_Setups/Setup105_RP2040_ST7796_16bit_parallel.h> // Setup file for RP2040 16-bit parallel display
|
||||
//#include <User_Setups/Setup106_RP2040_ILI9481_16bit_parallel.h> // Setup file for RP2040 16-bit parallel display
|
||||
//#include <User_Setups/Setup107_RP2040_ILI9341_16bit_parallel.h> // Setup file for RP2040 16-bit parallel display
|
||||
//#include <User_Setups/Setup108_RP2040_ST7735.h> // Setup file for Waveshare RP2040 board with onboard ST7735 0.96" 160x80 display
|
||||
|
||||
//#include <User_Setups/Setup135_ST7789.h> // Setup file for ESP8266 and ST7789 135 x 240 TFT
|
||||
|
||||
@@ -124,32 +124,38 @@
|
||||
|
||||
//#include <User_Setups/Setup202_SSD1351_128.h> // Setup file for ESP32/ESP8266 based SSD1351 128x128 1.5inch OLED display
|
||||
|
||||
//#include <User_Setups/Setup203_ST7789.h> // Setup file for ESP32/ESP8266 based ST7789 240X280 1.69inch TFT
|
||||
//#include <User_Setups/Setup203_ST7789.h> // Setup file for ESP32/ESP8266 based ST7789 240X280 1.69inch TFT
|
||||
|
||||
//#include <User_Setups/Setup204_ESP32_TouchDown.h> // Setup file for the ESP32 TouchDown based on ILI9488 480 x 320 TFT
|
||||
//#include <User_Setups/Setup204_ESP32_TouchDown.h> // Setup file for the ESP32 TouchDown based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup205_ESP32_TouchDown_S3.h> // Setup file for the ESP32 TouchDown S3 based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup206_LilyGo_T_Display_S3.h>
|
||||
//#include <User_Setups/Setup207_LilyGo_T_HMI.h>
|
||||
|
||||
//#include <User_Setups/Setup208_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite (may also work with ESP32 S3 Box)
|
||||
//#include <User_Setups/Setup205_ESP32_TouchDown_S3.h> // Setup file for the ESP32 TouchDown S3 based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup206_LilyGo_T_Display_S3.h> // For the LilyGo T-Display S3 based ESP32S3 with ST7789 170 x 320 TFT
|
||||
//#include <User_Setups/Setup207_LilyGo_T_HMI.h> // For the LilyGo T-HMI S3 based ESP32S3 with ST7789 240 x 320 TFT
|
||||
//#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
|
||||
#include <User_Setups/Setup210_LilyGo_T_Deck.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
|
||||
//#include <User_Setups/Setup210_LilyGo_T_Embed_S3.h> // For the LilyGo T-Embed S3 based ESP32S3 with ST7789 170 x 320 TFT
|
||||
#include <User_Setups/Setup210_LilyGo_T_Deck.h> // For the LilyGo T-Deck based ESP32S3 with ST7789 320 x 240 TFT
|
||||
//#include <User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h> // For the LilyGo T-QT Pro S3 based ESP32S3 with GC9A01 128 x 128 TFT
|
||||
// #include <User_Setups/Setup212_LilyGo_T_PicoPro.h> // For the LilyGo T-PICO-Pro with ST7796 222 x 480 TFT
|
||||
// #include <User_Setups/Setup213_LilyGo_T_Beam_Shield.h> // For the LilyGo T-BEAM V1.x with ST7796 222 x 480 TFT
|
||||
|
||||
//#include <User_Setups/Setup250_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite
|
||||
//#include <User_Setups/Setup251_ESP32_S3_Box.h> // For the ESP32 S3 Box
|
||||
|
||||
//#include <User_Setups/Setup301_BW16_ST7735.h> // Setup file for Bw16-based boards with ST7735 160 x 80 TFT
|
||||
//#include <User_Setups/Setup302_Waveshare_ESP32S3_GC9A01.h> // Setup file for Waveshare ESP32-S3-Touch-LCD-1.28 board with GC9A01 240*240 TFT
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h> // Template file for a setup
|
||||
|
||||
//#include <User_Setups/Dustin_ILI9488.h> // Setup file for Dustin Watts PCB with ILI9488
|
||||
|
||||
//#include <User_Setups/Dustin_ILI9488.h> // Setup file for Dustin Watts PCB with ILI9488
|
||||
//#include <User_Setups/Dustin_ST7796.h> // Setup file for Dustin Watts PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ILI9488_Pico.h> // Setup file for Dustin Watts Pico PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ST7789_Pico.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_Pico.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_ESP32.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_STT7789_ESP32.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_ILI9341_ESP32.h> // Setup file for Dustin Watts PCB with ILI9341
|
||||
//#include <User_Setups/Dustin_ILI9488_Pico.h> // Setup file for Dustin Watts Pico PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ST7789_Pico.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_Pico.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_ESP32.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_STT7789_ESP32.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_ILI9341_ESP32.h> // Setup file for Dustin Watts PCB with ILI9341
|
||||
//#include <User_Setups/ILI9225.h>
|
||||
|
||||
#endif // USER_SETUP_LOADED
|
||||
@@ -164,116 +170,116 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Identical looking TFT displays may have a different colour ordering in the 16 bit colour
|
||||
// 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
|
||||
|
||||
// Legacy setup support, RPI_DISPLAY_TYPE replaces RPI_DRIVER
|
||||
#if defined (RPI_DRIVER)
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Legacy setup support, RPI_ILI9486_DRIVER form is deprecated
|
||||
// Instead define RPI_DISPLAY_TYPE and also define driver (e.g. ILI9486_DRIVER)
|
||||
// Instead define RPI_DISPLAY_TYPE and also define driver (e.g. ILI9486_DRIVER)
|
||||
#if defined (RPI_ILI9486_DRIVER)
|
||||
#if !defined (ILI9486_DRIVER)
|
||||
#define ILI9486_DRIVER
|
||||
#endif
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#if !defined (ILI9486_DRIVER)
|
||||
#define ILI9486_DRIVER
|
||||
#endif
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Invoke 18 bit colour for selected displays
|
||||
// Invoke 18-bit colour for selected displays
|
||||
#if !defined (RPI_DISPLAY_TYPE) && !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT) && !defined (ESP32_PARALLEL)
|
||||
#if defined (ILI9481_DRIVER) || defined (ILI9486_DRIVER) || defined (ILI9488_DRIVER)
|
||||
#define SPI_18BIT_DRIVER
|
||||
#endif
|
||||
#if defined (ILI9481_DRIVER) || defined (ILI9486_DRIVER) || defined (ILI9488_DRIVER)
|
||||
#define SPI_18BIT_DRIVER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Load the right driver definition - do not tinker here !
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9342_DRIVER)
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
#define TFT_DRIVER 0x9341
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
#define TFT_DRIVER 0x9341
|
||||
#elif defined (ST7735_DRIVER)
|
||||
#include <TFT_Drivers/ST7735_Defines.h>
|
||||
#define TFT_DRIVER 0x7735
|
||||
#include <TFT_Drivers/ST7735_Defines.h>
|
||||
#define TFT_DRIVER 0x7735
|
||||
#elif defined (ILI9163_DRIVER)
|
||||
#include <TFT_Drivers/ILI9163_Defines.h>
|
||||
#define TFT_DRIVER 0x9163
|
||||
#include <TFT_Drivers/ILI9163_Defines.h>
|
||||
#define TFT_DRIVER 0x9163
|
||||
#elif defined (S6D02A1_DRIVER)
|
||||
#include <TFT_Drivers/S6D02A1_Defines.h>
|
||||
#define TFT_DRIVER 0x6D02
|
||||
#include <TFT_Drivers/S6D02A1_Defines.h>
|
||||
#define TFT_DRIVER 0x6D02
|
||||
#elif defined (ST7796_DRIVER)
|
||||
#include "TFT_Drivers/ST7796_Defines.h"
|
||||
#define TFT_DRIVER 0x7796
|
||||
#include "TFT_Drivers/ST7796_Defines.h"
|
||||
#define TFT_DRIVER 0x7796
|
||||
#elif defined (ILI9486_DRIVER)
|
||||
#include <TFT_Drivers/ILI9486_Defines.h>
|
||||
#define TFT_DRIVER 0x9486
|
||||
#include <TFT_Drivers/ILI9486_Defines.h>
|
||||
#define TFT_DRIVER 0x9486
|
||||
#elif defined (ILI9481_DRIVER)
|
||||
#include <TFT_Drivers/ILI9481_Defines.h>
|
||||
#define TFT_DRIVER 0x9481
|
||||
#include <TFT_Drivers/ILI9481_Defines.h>
|
||||
#define TFT_DRIVER 0x9481
|
||||
#elif defined (ILI9488_DRIVER)
|
||||
#include <TFT_Drivers/ILI9488_Defines.h>
|
||||
#define TFT_DRIVER 0x9488
|
||||
#include <TFT_Drivers/ILI9488_Defines.h>
|
||||
#define TFT_DRIVER 0x9488
|
||||
#elif defined (HX8357D_DRIVER)
|
||||
#include "TFT_Drivers/HX8357D_Defines.h"
|
||||
#define TFT_DRIVER 0x8357
|
||||
#include "TFT_Drivers/HX8357D_Defines.h"
|
||||
#define TFT_DRIVER 0x8357
|
||||
#elif defined (EPD_DRIVER)
|
||||
#include "TFT_Drivers/EPD_Defines.h"
|
||||
#define TFT_DRIVER 0xE9D
|
||||
#include "TFT_Drivers/EPD_Defines.h"
|
||||
#define TFT_DRIVER 0xE9D
|
||||
#elif defined (ST7789_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_Defines.h"
|
||||
#define TFT_DRIVER 0x7789
|
||||
#include "TFT_Drivers/ST7789_Defines.h"
|
||||
#define TFT_DRIVER 0x7789
|
||||
#elif defined (R61581_DRIVER)
|
||||
#include "TFT_Drivers/R61581_Defines.h"
|
||||
#define TFT_DRIVER 0x6158
|
||||
#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
|
||||
#include "TFT_Drivers/ST7789_2_Defines.h"
|
||||
#define TFT_DRIVER 0x778B
|
||||
#elif defined (RM68140_DRIVER)
|
||||
#include "TFT_Drivers/RM68140_Defines.h"
|
||||
#define TFT_DRIVER 0x6814
|
||||
#include "TFT_Drivers/RM68140_Defines.h"
|
||||
#define TFT_DRIVER 0x6814
|
||||
#elif defined (SSD1351_DRIVER)
|
||||
#include "TFT_Drivers/SSD1351_Defines.h"
|
||||
#define TFT_DRIVER 0x1351
|
||||
#include "TFT_Drivers/SSD1351_Defines.h"
|
||||
#define TFT_DRIVER 0x1351
|
||||
#elif defined (SSD1963_480_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (SSD1963_800_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (SSD1963_800ALT_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (SSD1963_800BD_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (GC9A01_DRIVER)
|
||||
#include "TFT_Drivers/GC9A01_Defines.h"
|
||||
#define TFT_DRIVER 0x9A01
|
||||
#include "TFT_Drivers/GC9A01_Defines.h"
|
||||
#define TFT_DRIVER 0x9A01
|
||||
#elif defined (ILI9225_DRIVER)
|
||||
#include "TFT_Drivers/ILI9225_Defines.h"
|
||||
#define TFT_DRIVER 0x9225
|
||||
#include "TFT_Drivers/ILI9225_Defines.h"
|
||||
#define TFT_DRIVER 0x9225
|
||||
#elif defined (RM68120_DRIVER)
|
||||
#include "TFT_Drivers/RM68120_Defines.h"
|
||||
#define TFT_DRIVER 0x6812
|
||||
#include "TFT_Drivers/RM68120_Defines.h"
|
||||
#define TFT_DRIVER 0x6812
|
||||
#elif defined (HX8357B_DRIVER)
|
||||
#include "TFT_Drivers/HX8357B_Defines.h"
|
||||
#define TFT_DRIVER 0x835B
|
||||
#include "TFT_Drivers/HX8357B_Defines.h"
|
||||
#define TFT_DRIVER 0x835B
|
||||
#elif defined (HX8357C_DRIVER)
|
||||
#include "TFT_Drivers/HX8357C_Defines.h"
|
||||
#define TFT_DRIVER 0x835C
|
||||
#include "TFT_Drivers/HX8357C_Defines.h"
|
||||
#define TFT_DRIVER 0x835C
|
||||
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||
// XYZZY_init.h and XYZZY_rotation.h must also be added in TFT_eSPI.cpp
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||
// XYZZY_init.h and XYZZY_rotation.h must also be added in TFT_eSPI.cpp
|
||||
#elif defined (XYZZY_DRIVER)
|
||||
#include "TFT_Drivers/XYZZY_Defines.h"
|
||||
#define TFT_DRIVER 0x0000
|
||||
#include "TFT_Drivers/XYZZY_Defines.h"
|
||||
#define TFT_DRIVER 0x0000
|
||||
#else
|
||||
#define TFT_DRIVER 0x0000
|
||||
#define TFT_DRIVER 0x0000
|
||||
#endif
|
||||
|
||||
// These are the pins for ESP8266 boards
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// For sprite only functionality (untested)
|
||||
#define USER_SETUP_ID 0
|
||||
|
||||
#define TFT_WIDTH 1000
|
||||
#define TFT_HEIGHT 1000
|
||||
|
||||
#define TFT_INIT_DELAY 0
|
||||
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x00
|
||||
|
||||
#define TFT_CASET 0x00
|
||||
#define TFT_PASET 0x00
|
||||
#define TFT_RAMWR 0x00
|
||||
|
||||
#define TFT_RAMRD 0x00
|
||||
#define TFT_IDXRD 0x00
|
||||
|
||||
/*
|
||||
#define TFT_MADCTL 0x00
|
||||
#define TFT_MAD_MY 0x00
|
||||
#define TFT_MAD_MX 0x00
|
||||
#define TFT_MAD_MV 0x00
|
||||
#define TFT_MAD_ML 0x00
|
||||
#define TFT_MAD_BGR 0x00
|
||||
#define TFT_MAD_MH 0x00
|
||||
#define TFT_MAD_RGB 0x00
|
||||
*/
|
||||
#define TFT_INVOFF 0x00
|
||||
#define TFT_INVON 0x00
|
||||
|
||||
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI -1
|
||||
#define TFT_SCLK -1
|
||||
|
||||
|
||||
#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
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 100
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 101
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 102
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 103
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 104
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 105
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 106
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// The parallel interface write cycle period is derived from a division of the CPU clock
|
||||
// speed so scales with the processor clock. This means that the divider ratio may need
|
||||
// to be increased when overclocking. I may also need to be adjusted dependant on the
|
||||
// display controller type (ILI94341, HX8357C etc). If RP2040_PIO_CLK_DIV is not defined
|
||||
// display controller type (ILI94341, HX8357C etc.). If RP2040_PIO_CLK_DIV is not defined
|
||||
// the library will set default values which may not suit your display.
|
||||
// The display controller data sheet will specify the minimum write cycle period. The
|
||||
// controllers often work reliably for shorter periods, however if the period is too short
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// This setup is for the RP2040 processor only when used with 8-bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 107
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// This setup is for the Waveshare RP2040-LCD-0.96 board
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 108
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display driver type
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define ST7735_DRIVER
|
||||
#define ST7735_GREENTAB160x80
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display params
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define TFT_WIDTH 80
|
||||
#define TFT_HEIGHT 160
|
||||
#define TFT_INVERSION_ON
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// RP2040 config and pins
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define SPI_FREQUENCY 27000000
|
||||
#define RP2040_PIO_CLK_DIV 1
|
||||
#define TFT_SPI_PORT 1
|
||||
|
||||
#define TFT_MOSI 11
|
||||
#define TFT_SCLK 10
|
||||
#define TFT_CS 9
|
||||
#define TFT_DC 8
|
||||
#define TFT_RST 12
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Fonts to be available
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#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_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
#define TFT_WIDTH 170
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
#define TFT_DC 7
|
||||
#define TFT_CS 6
|
||||
#define TFT_DC 7
|
||||
#define TFT_RST 5
|
||||
|
||||
#define TFT_WR 8
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// ST7789 170 x 320 display with no chip select line
|
||||
#define USER_SETUP_ID 210
|
||||
|
||||
#define ST7789_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 170
|
||||
#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 TFT_INVERSION_ON
|
||||
//#define TFT_INVERSION_OFF
|
||||
#define TFT_BACKLIGHT_ON 1
|
||||
|
||||
#define TFT_BL 15 // LED back-light
|
||||
#define TFT_MISO -1 // Not connected
|
||||
#define TFT_MOSI 11
|
||||
#define TFT_SCLK 12
|
||||
#define TFT_CS 10
|
||||
#define TFT_DC 13
|
||||
#define TFT_RST 9 // Connect reset to ensure display initialises
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,45 @@
|
||||
// GC9A01 128 x 128 display with no chip select line
|
||||
#define USER_SETUP_ID 211
|
||||
|
||||
#define GC9A01_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 128
|
||||
|
||||
// #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
|
||||
#define TFT_BACKLIGHT_ON 0
|
||||
#define CGRAM_OFFSET
|
||||
|
||||
|
||||
#define TFT_BL 10 // LED back-light
|
||||
#define TFT_MISO -1 // Not connected
|
||||
#define TFT_MOSI 2
|
||||
#define TFT_SCLK 3
|
||||
#define TFT_CS 5
|
||||
#define TFT_DC 6
|
||||
#define TFT_RST 1 // Connect reset to ensure display initialises
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,45 @@
|
||||
// ST7796 222 x 480 display with no chip select line
|
||||
#define USER_SETUP_ID 212
|
||||
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 222
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define CGRAM_OFFSET // Library will add offsets required
|
||||
|
||||
// #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_MISO 4
|
||||
#define TFT_MOSI 7
|
||||
#define TFT_SCLK 6
|
||||
#define TFT_CS 8
|
||||
#define TFT_DC 9
|
||||
#define TFT_RST 16
|
||||
#define TFT_BACKLIGHT_ON 1
|
||||
#define TFT_BL 10
|
||||
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,36 @@
|
||||
// ST7796 222 x 480 display with no chip select line
|
||||
#define USER_SETUP_ID 213
|
||||
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 222
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define CGRAM_OFFSET // Library will add offsets required
|
||||
|
||||
// #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_MISO -1
|
||||
#define TFT_MOSI 14
|
||||
#define TFT_SCLK 15
|
||||
#define TFT_CS 25
|
||||
#define TFT_DC 13
|
||||
#define TFT_RST 2
|
||||
#define TFT_BL 4
|
||||
#define TFT_BACKLIGHT_ON HIGH
|
||||
|
||||
|
||||
#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 40000000
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Display configuration for ST7789-based ESP32-S3-Box-Lite
|
||||
|
||||
#define USER_SETUP_ID 208
|
||||
#define USER_SETUP_ID 250
|
||||
#define USER_SETUP_INFO "ESP32-S3-BOX-LITE"
|
||||
|
||||
#define ST7789_DRIVER
|
||||
@@ -0,0 +1,28 @@
|
||||
// Display configuration for ILI9342-based ESP32-S3-Box
|
||||
|
||||
#define USER_SETUP_ID 251
|
||||
#define USER_SETUP_INFO "ESP32-S3-BOX"
|
||||
|
||||
#define M5STACK // S3-Box uses the same ILI9342 display, don't remove
|
||||
|
||||
#define ILI9341_DRIVER
|
||||
|
||||
#define TFT_MISO 0
|
||||
#define TFT_MOSI 6
|
||||
#define TFT_SCLK 7
|
||||
#define TFT_CS 5 // Chip select control pin
|
||||
#define TFT_DC 4 // Data Command control pin
|
||||
#define TFT_RST 48 // Reset pin (could connect to Arduino RESET pin)
|
||||
#define TFT_BL 45 // LED back-light
|
||||
|
||||
#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_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 27000000
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc
|
||||
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc.
|
||||
|
||||
#define SPI_FREQUENCY 27000000 // 27MHz SPI clock
|
||||
//#define SPI_FREQUENCY 55000000 // 55MHz is over-clocking ILI9341 but seems to work reliably!
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
|
||||
#define STM32
|
||||
|
||||
#define NUCLEO_64_TFT
|
||||
//#define TFT_INVERSION_OFF
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
#define ST7789_DRIVER
|
||||
#define TFT_RGB_ORDER TFT_BGR
|
||||
|
||||
#define TFT_SPI_PORT 1 // SPI 1 maximum clock rate is 55MHz
|
||||
#define TFT_MOSI D11
|
||||
#define TFT_MISO D12
|
||||
#define TFT_SCLK D13
|
||||
|
||||
|
||||
// Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select
|
||||
#define TFT_CS D5 // Chip select control pin to TFT CS
|
||||
#define TFT_DC D6 // Data Command control pin to TFT DC (may be labelled RS = Register Select)
|
||||
#define TFT_RST D7 // Reset pin to TFT RST (or RESET)
|
||||
|
||||
#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_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
// STM32 support for smooth fonts via program memory (FLASH) arrays
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 55000000 // 27MHz SPI clock
|
||||
//#define SPI_FREQUENCY 55000000 // 55MHz is over-clocking ILI9341 but seems to work reliably!
|
||||
|
||||
#define SPI_READ_FREQUENCY 15000000 // Reads need a slower SPI clock, probably ends up at 13.75MHz (CPU clock/16)
|
||||
|
||||
// This has no effect, transactions for STM32 are automatically enabled
|
||||
#define SUPPORT_TRANSACTIONS
|
||||
|
||||
/*
|
||||
///////////////////////////////////////////////////
|
||||
// Setup for STM32 Nucleo and ILI9341 display //
|
||||
///////////////////////////////////////////////////
|
||||
#define USER_SETUP_ID 29
|
||||
|
||||
// Last update by Bodmer: 28/11/19
|
||||
|
||||
// STM32 optimised functions are not yet compatible with STM32H743 processor.
|
||||
// The STM32H743 does work with the slower generic processor drivers
|
||||
//
|
||||
// REMINDER - Nucleo-F743ZI and Nucleo-F743ZI2 have different pin port allocations
|
||||
// and require appropriate selection in IDE. ^---- Note the extra 2 in part number!
|
||||
|
||||
|
||||
// Define STM32 to invoke STM32 optimised driver
|
||||
#define STM32
|
||||
|
||||
// Define the TFT display driver
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ILI9481_DRIVER
|
||||
#define ST7789_DRIVER
|
||||
#define TFT_RGB_ORDER TFT_BGR
|
||||
// MOSI and SCK do not need to be defined, connect:
|
||||
// - Arduino SCK to TFT SCK
|
||||
// - Arduino MOSI to TFT SDI(may be marked SDA or MOSI)
|
||||
// Typical Arduino SPI port 1 pins are (SCK=D13, MISO=D12, MOSI=D11) this is port pins PA5, PA6 and PA7 on Nucleo-F767ZI
|
||||
// SPI port 2 pins are (SCK=D18, MISO=A7, MOSI=D17) this is port pins PB13, PC2 and PB15 on Nucleo-F767ZI
|
||||
|
||||
//*
|
||||
#define TFT_SPI_PORT 1 // SPI 1 maximum clock rate is 55MHz
|
||||
#define TFT_MOSI PA7
|
||||
#define TFT_MISO PA6
|
||||
#define TFT_SCLK PA5
|
||||
//*/
|
||||
|
||||
/*
|
||||
#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
||||
#define TFT_MOSI D17
|
||||
#define TFT_MISO A7
|
||||
#define TFT_SCLK D18
|
||||
//*/
|
||||
|
||||
/*
|
||||
#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
||||
#define TFT_MOSI PB15
|
||||
#define TFT_MISO PC2
|
||||
#define TFT_SCLK PB13
|
||||
//*/
|
||||
|
||||
/*
|
||||
#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
||||
#define TFT_MOSI PB15
|
||||
#define TFT_MISO PB14
|
||||
#define TFT_SCLK PB13
|
||||
//*/
|
||||
|
||||
/*
|
||||
// Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select
|
||||
#define TFT_CS D5 // Chip select control pin to TFT CS
|
||||
#define TFT_DC D6 // Data Command control pin to TFT DC (may be labelled RS = Register Select)
|
||||
#define TFT_RST D7 // Reset pin to TFT RST (or RESET)
|
||||
|
||||
// Alternatively, we can use STM32 port reference names PXnn
|
||||
//#define TFT_CS PE11 // Nucleo-F767ZI equivalent of D5
|
||||
//#define TFT_DC PE9 // Nucleo-F767ZI equivalent of D6
|
||||
//#define TFT_RST PF13 // Nucleo-F767ZI equivalent of D7
|
||||
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to processor reset
|
||||
// Use an Arduino pin for initial testing as connecting to processor reset
|
||||
// may not work (pulse too short at power up?)
|
||||
|
||||
// Chip select for XPT2046 touch controller
|
||||
#define TOUCH_CS D4
|
||||
|
||||
#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_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
// STM32 support for smooth fonts via program memory (FLASH) arrays
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc.
|
||||
|
||||
#define SPI_FREQUENCY 27000000 // 27MHz SPI clock
|
||||
//#define SPI_FREQUENCY 55000000 // 55MHz is over-clocking ILI9341 but seems to work reliably!
|
||||
|
||||
#define SPI_READ_FREQUENCY 15000000 // Reads need a slower SPI clock, probably ends up at 13.75MHz (CPU clock/16)
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000 // Must be very slow
|
||||
|
||||
// This has no effect, transactions for STM32 are automatically enabled
|
||||
#define SUPPORT_TRANSACTIONS
|
||||
*/
|
||||
@@ -0,0 +1,33 @@
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 302
|
||||
|
||||
#define GC9A01_DRIVER
|
||||
|
||||
#define TFT_MISO 12
|
||||
#define TFT_MOSI 11
|
||||
#define TFT_SCLK 10
|
||||
#define TFT_CS 9 // Chip select control pin
|
||||
#define TFT_DC 8 // Data Command control pin
|
||||
#define TFT_RST 14 // Reset pin (could connect to RST pin)
|
||||
#define TFT_BL 2
|
||||
#define TFT_BACKLIGHT_ON HIGH
|
||||
|
||||
#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_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
|
||||
#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
@@ -14,7 +14,7 @@
|
||||
#define NUCLEO_64_TFT
|
||||
//#define NUCLEO_144_TFT
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// Define the display driver chip type
|
||||
@@ -31,7 +31,7 @@
|
||||
#define TFT_WR A1 // Write strobe control pin
|
||||
#define TFT_RD A0 // Read pin
|
||||
|
||||
#define TFT_D0 D8 // 8 bit parallel bus to TFT
|
||||
#define TFT_D0 D8 // 8-bit parallel bus to TFT
|
||||
#define TFT_D1 D9
|
||||
#define TFT_D2 D2
|
||||
#define TFT_D3 D3
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define NUCLEO_64_TFT
|
||||
//#define NUCLEO_144_TFT
|
||||
|
||||
// Tell the library to use 8 bit parallel mode(otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode(otherwise SPI is assumed)
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// Define the display driver chip type
|
||||
@@ -30,7 +30,7 @@
|
||||
#define TFT_WR A1 // Write strobe control pin
|
||||
#define TFT_RD A0 // Read pin
|
||||
|
||||
#define TFT_D0 D8 // 8 bit parallel bus to TFT
|
||||
#define TFT_D0 D8 // 8-bit parallel bus to TFT
|
||||
#define TFT_D1 D9
|
||||
#define TFT_D2 D2
|
||||
#define TFT_D3 D3
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc
|
||||
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc.
|
||||
|
||||
#define SPI_FREQUENCY 20000000 // 27MHz SPI clock
|
||||
//#define SPI_FREQUENCY 55000000 // 55MHz is over-clocking ILI9341 but seems to work reliably!
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define NUCLEO_64_TFT
|
||||
//#define NUCLEO_144_TFT
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// Define the display driver chip type
|
||||
@@ -29,7 +29,7 @@
|
||||
#define TFT_WR A1 // Write strobe control pin
|
||||
#define TFT_RD A0 // Read pin
|
||||
|
||||
#define TFT_D0 D8 // 8 bit parallel bus to TFT
|
||||
#define TFT_D0 D8 // 8-bit parallel bus to TFT
|
||||
#define TFT_D1 D9
|
||||
#define TFT_D2 D2
|
||||
#define TFT_D3 D3
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
//#define STM_PORTC_DATA_BUS // Pins below must re re-allocated to use this option
|
||||
//#define STM_PORTD_DATA_BUS // Pins below must re re-allocated to use this option
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// Define ONE of the the TFT display drivers
|
||||
@@ -30,7 +30,7 @@
|
||||
#define TFT_WR PB9 // Write strobe control pin
|
||||
#define TFT_RD PB1 // Read pin
|
||||
|
||||
#define TFT_D0 PA0 // 8 bit Port A parallel bus to TFT
|
||||
#define TFT_D0 PA0 // 8-bit Port A parallel bus to TFT
|
||||
#define TFT_D1 PA1
|
||||
#define TFT_D2 PA2
|
||||
#define TFT_D3 PA3
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// Display type - only define if RPi display
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#define USER_SETUP_ID 162
|
||||
#define ST7796_DRIVER
|
||||
|
||||
#define MHS_DISPLAY_TYPE
|
||||
//#define RP2040_PIO_SPI
|
||||
#define TFT_MISO 16
|
||||
#define TFT_MOSI 19
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_CS 17 // Chip select control pin
|
||||
#define TFT_DC 20 // Data Command control pin
|
||||
#define TFT_RST 21 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_BL // LED back-light
|
||||
|
||||
#define TOUCH_CS 22 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
#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 125000000
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// Display type - only define if RPi display
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#define USER_SETUP_ID 66
|
||||
|
||||
#define GC9A01_DRIVER // Full configuration option, define additional parameters below for this display
|
||||
|
||||
#define TFT_RGB_ORDER TFT_RGB // Colour order Blue-Green-Red
|
||||
#define TFT_HEIGHT 240 // GC9A01 240 x 240
|
||||
|
||||
#define TFT_SCLK D8
|
||||
#define TFT_MISO D9
|
||||
#define TFT_MOSI D10
|
||||
#define TFT_CS D1 // Chip select control pin
|
||||
#define TFT_DC D3 // Data Command control pin
|
||||
#define TFT_BL D6
|
||||
#define TFT_RST -1 // Reset pin (could connect to RST pin)
|
||||
|
||||
#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 40000000
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
// #define USE_HSPI_PORT
|
||||
@@ -0,0 +1,31 @@
|
||||
// Setup for the ESP32 S3 with GC9A01 display
|
||||
#define USER_SETUP_ID 70
|
||||
|
||||
#define GC9A01_DRIVER
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
// Typical board default pins - change to match your board
|
||||
#define TFT_CS 10 //34 // 10 or 34 (FSPI CS0)
|
||||
#define TFT_MOSI 11 //35 // 11 or 35 (FSPI D)
|
||||
#define TFT_SCLK 12 //36 // 12 or 36 (FSPI CLK)
|
||||
#define TFT_MISO 13 //37 // 13 or 37 (FSPI Q)
|
||||
|
||||
// Use pins in range 0-31
|
||||
#define TFT_DC 7
|
||||
#define TFT_RST 6
|
||||
|
||||
#define LOAD_GLCD
|
||||
#define LOAD_FONT2
|
||||
#define LOAD_FONT4
|
||||
#define LOAD_FONT6
|
||||
#define LOAD_FONT7
|
||||
#define LOAD_FONT8
|
||||
#define LOAD_GFXFF
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// FSPI port (SPI2) used unless following defined
|
||||
#define USE_HSPI_PORT
|
||||
|
||||
#define SPI_FREQUENCY 80000000 // Maximum for ILI9341
|
||||
@@ -1,5 +1,5 @@
|
||||
// USER DEFINED SETTINGS
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
// 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.
|
||||
@@ -27,15 +27,15 @@
|
||||
//#define NUCLEO_64_TFT
|
||||
//#define NUCLEO_144_TFT
|
||||
|
||||
// STM32 8 bit parallel only:
|
||||
// If STN32 Port A or B pins 0-7 are used for 8 bit parallel data bus bits 0-7
|
||||
// STM32 8-bit parallel only:
|
||||
// If STN32 Port A or B pins 0-7 are used for 8-bit parallel data bus bits 0-7
|
||||
// then this will improve rendering performance by a factor of ~8x
|
||||
//#define STM_PORTA_DATA_BUS
|
||||
//#define STM_PORTB_DATA_BUS
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
//#define TFT_PARALLEL_16_BIT // **** 16 bit parallel ONLY with RP2040 processor ****
|
||||
//#define TFT_PARALLEL_16_BIT // **** 16-bit parallel ONLY with RP2040 processor ****
|
||||
|
||||
// Display type - only define if RPi display
|
||||
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
|
||||
@@ -236,7 +236,7 @@
|
||||
|
||||
// ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ######
|
||||
|
||||
// The library supports 8 bit parallel TFTs with the ESP32, the pin
|
||||
// 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!
|
||||
@@ -244,7 +244,7 @@
|
||||
// Parallel bus is only supported for the STM32 and ESP32
|
||||
// Example below is for ESP32 Parallel interface with UNO displays
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// The ESP32 and TFT the pins used for testing are:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user