Update for spelling etc. in comments!

This commit is contained in:
Bodmer 2023-12-07 20:35:59 +00:00
parent aefcf5af63
commit d506a3c49d
197 changed files with 1006 additions and 757 deletions

View File

@ -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;

View File

@ -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)
{
@ -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)
@ -2138,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()
@ -2290,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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 : - .

View File

@ -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)

View File

@ -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 : . -

View File

@ -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"

View File

@ -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,

View File

@ -87,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
@ -380,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
@ -399,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
@ -412,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; \
@ -447,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)
@ -460,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)
@ -468,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))
////////////////////////////////////////////////////////////////////////////////////////
@ -479,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); \
@ -490,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
@ -514,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); \
@ -525,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
@ -549,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

View File

@ -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
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************

View File

@ -79,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
@ -371,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
@ -390,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
@ -403,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; \
@ -438,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)
@ -451,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)
@ -459,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))
////////////////////////////////////////////////////////////////////////////////////////
@ -470,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); \
@ -481,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
@ -505,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); \
@ -516,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
@ -548,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

View File

@ -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
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************
@ -646,7 +646,7 @@ void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len)
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
bool temp = _swapBytes;
_swapBytes = false;
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
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)
}
@ -690,7 +690,7 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
bool temp = _swapBytes;
_swapBytes = false;
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
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)
}
@ -778,7 +778,7 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
bool temp = _swapBytes;
_swapBytes = false;
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
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)
}

View File

@ -93,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
@ -414,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
@ -433,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
@ -446,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; \
@ -481,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)
@ -494,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)
@ -502,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; \
@ -524,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
@ -563,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

View File

@ -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;

View File

@ -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); \

View File

@ -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
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************

View 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_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))

View File

@ -22,7 +22,7 @@
#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
@ -30,7 +30,7 @@
#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)
@ -458,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
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************

View 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_
@ -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

View File

@ -76,7 +76,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 +286,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
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************
@ -356,7 +356,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
}
////////////////////////////////////////////////////////////////////////////////////////
#else // Standard SPI 16 bit colour TFT All Tested
#else // Standard SPI 16-bit colour TFT All Tested
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************
@ -405,7 +405,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
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
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
}
@ -527,7 +527,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)
}

View File

@ -401,7 +401,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 +420,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 +438,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 +454,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 +541,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 +561,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 +579,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 +596,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 +659,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 +692,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 +743,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 +759,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 +832,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 +857,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 +890,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 +917,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,19 +960,19 @@
////////////////////////////////////////////////////////////////////////////////////////
// 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); }
// 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) \
{ spiBuffer[0] = ((C) & 0xF800)>>8; spiBuffer[1] = ((C) & 0x07E0)>>3; spiBuffer[2] = ((C) & 0x001F)<<3; \
HAL_SPI_Transmit(&spiHal, spiBuffer, 3, 10); }
// 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) \
{ spiBuffer[0] = (C) & 0xF8; spiBuffer[1] = ((C) & 0xE000)>>11 | ((C) & 0x07)<<5; spiBuffer[2] = ((C) & 0x1F00)>>5; \
HAL_SPI_Transmit(&spiHal, spiBuffer, 3, 10); }

View File

@ -1,6 +1,6 @@
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// 16 bit parallel //
// 16-bit parallel //
// -------------------------------------------------- //
#pragma once

View File

@ -1,6 +1,6 @@
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// 8 bit parallel //
// 8-bit parallel //
// -------------------------------------------------- //
#pragma once

View File

@ -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

View File

@ -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

View File

@ -20,7 +20,7 @@ A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has b
[TFT_eWidget](https://github.com/Bodmer/TFT_eWidget)
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.
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.
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:
@ -51,14 +51,14 @@ Note: background rendering for Smooth fonts is also now available when using the
![Gradient](https://i.imgur.com/atR0DmP.png)
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.
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.
# 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.
@ -75,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) |
@ -90,7 +90,7 @@ For other (generic) processors only SPI interface displays are supported and the
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).
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.
@ -104,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)
@ -119,7 +119,7 @@ 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.
@ -129,15 +129,15 @@ The library includes a "Sprite" class, this enables flicker free updates of comp
# 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.
@ -157,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.
@ -166,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.
@ -188,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:

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,12 +1,13 @@
// This is the command sequence that initialises the ST7789 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
#ifndef INIT_SEQUENCE_3
{
fillScreen(TFT_RED);
writecommand(ST7789_SLPOUT); // Sleep out
delay(120);
@ -24,7 +25,7 @@
writecommand(ST7789_RAMCTRL);
writedata(0x00);
writedata(0xE0); // 5 to 6 bit conversion: r0 = r5, b0 = b5
writedata(0xE0); // 5 to 6-bit conversion: r0 = r5, b0 = b5
writecommand(ST7789_COLMOD);
writedata(0x55);
@ -143,7 +144,7 @@
// writecommand(ST7789_RAMCTRL);
// writedata(0x00);
// writedata(0xE0); // 5 to 6 bit conversion: r0 = r5, b0 = b5
// writedata(0xE0); // 5 to 6-bit conversion: r0 = r5, b0 = b5
writecommand(ST7789_COLMOD);
writedata(0x55);

View File

@ -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

View File

@ -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
@ -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)
@ -2175,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)
{
@ -2231,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--) {
@ -3140,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)
@ -3384,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
@ -3415,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);
@ -3518,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;
@ -3641,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);
@ -3676,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;
@ -3686,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;
@ -3843,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
@ -3877,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)
{
@ -4106,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) {
@ -4130,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) {
@ -4769,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)
{
@ -4779,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)
{
@ -4789,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==============
@ -4806,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)
{
@ -4819,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)
{
@ -4900,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 {
@ -4952,20 +4952,20 @@ 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
// 21-bit Unicode not supported so fall-back to extended ASCII
// if ((c & 0xF8) == 0xF0) return c;
return c; // fall-back to extended ASCII
@ -4978,10 +4978,10 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
*************************************************************************************x*/
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
@ -5352,7 +5352,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);

View File

@ -12,7 +12,7 @@
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_
@ -36,7 +36,7 @@
** 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
@ -327,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 |
@ -505,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
@ -598,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);
@ -619,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);
@ -650,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()
@ -663,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
@ -701,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
@ -717,15 +717,15 @@ 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);
@ -734,14 +734,14 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
// alpha = 255 = 100% foreground colour
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
// 16 bit colour alphaBlend with alpha dither (dither reduces colour banding)
// 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".
@ -963,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
@ -989,10 +989,10 @@ transpose(T& a, T& b) { T t = a; a = b; b = t; }
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
// 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

View File

@ -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.
@ -369,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;

View File

@ -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.*;

View File

@ -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
@ -105,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
@ -242,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!
@ -250,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:
@ -330,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. It 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

View File

@ -100,15 +100,15 @@
//#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
@ -168,7 +168,7 @@
/////////////////////////////////////////////////////////////////////////////////////
// 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
@ -190,7 +190,7 @@
#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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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!

View File

@ -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
*/

View File

@ -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

View File

@ -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

View File

@ -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!

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -6,7 +6,7 @@
*/
// Note: At the time of writing there is a last character code definition bug in the
// Squix font file format so do NOT try and print the tilda (~) symbol (ASCII 0x7E)
// Squix font file format so do NOT try and print the tilde (~) symbol (ASCII 0x7E)
// Alternatively look at the end of the font header file and edit: 0x7E to read 0x7D
/* e.g. vvvv
(uint8_t *)Orbitron_Light_32Bitmaps,(GFXglyph *)Orbitron_Light_32Glyphs,0x20, 0x7D, 32};
@ -16,7 +16,7 @@
// When font files are placed in the Custom folder (TFT_eSPI\Fonts\Custom) then they must
// also be #included here:
// The CF_OL24 etc are a shorthand reference, but this is not essential to use the fonts
// The CF_OL24 etc. are a shorthand reference, but this is not essential to use the fonts
#ifdef LOAD_GFXFF

View File

@ -30,7 +30,7 @@ Steps to use:
If your board is connected choose serial port. Leave ESP-IDF component directory blank and
press Choose Template.
4. In the dropdown choose Extension and select Arduino-as-component. (This is not mandatory.
4. In the drop-down choose Extension and select Arduino-as-component. (This is not mandatory.
You can try other templates if you want). This will create a blank project with a simple
main source file in the "main" folder.

View File

@ -29,7 +29,7 @@ build_flags =
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DUSER_SETUP_LOADED=1
; Define the TFT driver, pins etc here:
; Define the TFT driver, pins etc. here:
-DST7789_DRIVER=1
-DTFT_WIDTH=128
-DTFT_HEIGHT=160

View File

@ -33,7 +33,7 @@ board_build.f_cpu = 133000000L
build_flags =
-Os
-DUSER_SETUP_LOADED=1
; Define the TFT driver, pins etc here:
; Define the TFT driver, pins etc. here:
-DTFT_PARALLEL_8_BIT=1
-DRM68120_DRIVER=1
-DRP2040_PIO_CLK_DIV=1

View File

@ -44,7 +44,7 @@ void setup() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE);
tft.setCursor(0, 0);
tft.setcursor(0, 0);
}
@ -54,11 +54,11 @@ void loop() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
tft.setTextColor(TFT_WHITE);
tft.setCursor(40, 5);
tft.setcursor(40, 5);
tft.println(F("Arduino"));
tft.setCursor(35, 25);
tft.setcursor(35, 25);
tft.println(F("Cellular"));
tft.setCursor(35, 45);
tft.setcursor(35, 45);
tft.println(F("Automata"));
delay(1000);

View File

@ -79,7 +79,7 @@ void loop() {
if (ss==0 || initial) {
initial = 0;
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setCursor (8, 52);
tft.setcursor (8, 52);
tft.print(__DATE__); // This uses the standard ADAFruit small font
tft.setTextColor(TFT_BLUE, TFT_BLACK);

View File

@ -20,7 +20,7 @@ void loop() {
tft.fillScreen(TFT_BLACK);
// Draw some random filled elipses
// Draw some random filled ellipses
for (int i = 0; i < 20; i++)
{
int rx = random(40);
@ -33,7 +33,7 @@ void loop() {
delay(2000);
tft.fillScreen(TFT_BLACK);
// Draw some random outline elipses
// Draw some random outline ellipses
for (int i = 0; i < 20; i++)
{
int rx = random(40);

View File

@ -73,7 +73,7 @@ void analogMeter()
// Long scale tick length
int tl = 15;
// Coodinates of tick to draw
// Coordinates of tick to draw
float sx = cos((i - 90) * 0.0174532925);
float sy = sin((i - 90) * 0.0174532925);
uint16_t x0 = sx * (M_SIZE*100 + tl) + M_SIZE*120;

View File

@ -1,5 +1,5 @@
/*
Test the tft.print() viz embedded tft.write() function
Test the tft.print() viz. embedded tft.write() function
This sketch used font 2, 4, 7
@ -36,7 +36,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0) and select font 2
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setCursor(0, 0, 2);
tft.setcursor(0, 0, 2);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
// We can now plot text on screen using the "print" class

View File

@ -90,13 +90,13 @@ void loop() {
// The standard ADAFruit font still works as before
tft.setTextColor(TFT_BLACK);
tft.setCursor (12, 5);
tft.setcursor (12, 5);
tft.print("Original ADAfruit font!");
// The new larger fonts do not use the .setCursor call, coords are embedded
// The new larger fonts do not use the .setcursor call, coords are embedded
tft.setTextColor(TFT_BLACK, TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
tft.drawCentreString("Font size 2", 80, 14, 2); // Draw text centre at position 80, 12 using font 2
//tft.drawCentreString("Font size 2",81,12,2); // Draw text centre at position 80, 12 using font 2

View File

@ -1,7 +1,7 @@
// Sketch to display images on a 160 x 128 TFT
// Renders images stored in an array in program (FLASH)
// The JPEG images are stored in header files (see jpeg1.h etc)
// The JPEG images are stored in header files (see jpeg1.h etc.)
// As well as the TFT_eSPI library:
// https://github.com/Bodmer/TFT_eSPI
@ -95,7 +95,7 @@ void drawArrayJpeg(const uint8_t arrayname[], uint32_t array_size, int xpos, int
// fit totally on the screen are cropped to the nearest MCU size and may leave right/bottom borders.
void renderJPEG(int xpos, int ypos) {
// retrieve infomration about the image
// retrieve information about the image
uint16_t *pImg;
uint16_t mcu_w = JpegDec.MCUWidth;
uint16_t mcu_h = JpegDec.MCUHeight;
@ -193,12 +193,12 @@ void jpegInfo() {
// Show the execution time (optional)
//####################################################################################################
// WARNING: for UNO/AVR legacy reasons printing text to the screen with the Mega might not work for
// sketch sizes greater than ~70KBytes because 16 bit address pointers are used in some libraries.
// sketch sizes greater than ~70KBytes because 16-bit address pointers are used in some libraries.
// The Due will work fine with the HX8357_Due library.
void showTime(uint32_t msTime) {
//tft.setCursor(0, 0);
//tft.setcursor(0, 0);
//tft.setTextFont(1);
//tft.setTextSize(2);
//tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -132,7 +132,7 @@ void loop(void)
d = -d;
}
tft.setCursor(0, 0);
tft.setcursor(0, 0);
tft.setTextColor(TFT_MAGENTA);
tft.println(F("Bodmer's TFT_eSPI"));
@ -343,7 +343,7 @@ uint32_t testHaD()
uint32_t t = micros() - start;
tft.setTextColor(TFT_YELLOW);
tft.setCursor(0, 145);
tft.setcursor(0, 145);
tft.print(F(" http://hackaday.io/"));
tft.print(F(" Xark"));
@ -371,7 +371,7 @@ uint32_t testFillScreen()
uint32_t testText() {
tft.fillScreen(TFT_BLACK);
uint32_t start = micros_start();
tft.setCursor(0, 0);
tft.setcursor(0, 0);
tft.setTextColor(TFT_WHITE); tft.setTextSize(1);
tft.println(F("Hello World!"));
tft.setTextColor(tft.color565(0xff, 0x00, 0x00));

View File

@ -126,7 +126,7 @@ void testlines(uint16_t color) {
}
void testdrawtext(char *text, uint16_t color) {
tft.setCursor(0, 0);
tft.setcursor(0, 0);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.print(text);
@ -215,7 +215,7 @@ void testroundrects() {
void tftPrintTest() {
tft.setTextWrap(false);
tft.fillScreen(TFT_BLACK);
tft.setCursor(0, 30);
tft.setcursor(0, 30);
tft.setTextColor(TFT_RED);
tft.setTextSize(1);
tft.println("Hello World!");
@ -229,7 +229,7 @@ void tftPrintTest() {
tft.setTextSize(4);
tft.print(1234.567);
delay(1500);
tft.setCursor(0, 0);
tft.setcursor(0, 0);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(0);

View File

@ -376,7 +376,7 @@ void loop() {
}
// There follows a crude way of flagging that this example sketch needs fonts which
// have not been enbabled in the User_Setup.h file inside the TFT_HX8357 library.
// have not been enabled in the User_Setup.h file inside the TFT_HX8357 library.
//
// These lines produce errors during compile time if settings in User_Setup are not correct
//

View File

@ -38,7 +38,7 @@ void setup() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE);
tft.setCursor(0, 0);
tft.setcursor(0, 0);
}
@ -48,11 +48,11 @@ void loop() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
tft.setTextColor(TFT_WHITE);
tft.setCursor(40, 5);
tft.setcursor(40, 5);
tft.println(F("Arduino"));
tft.setCursor(35, 25);
tft.setcursor(35, 25);
tft.println(F("Cellular"));
tft.setCursor(35, 45);
tft.setcursor(35, 45);
tft.println(F("Automata"));
delay(1000);

View File

@ -70,7 +70,7 @@ void loop() {
// For comaptibility with Adafruit_GFX library the text background is not plotted when using the print class
// even if we specify it.
tft.setTextColor(TFT_YELLOW);
tft.setCursor(xpos, ypos); // Set cursor near top left corner of screen
tft.setcursor(xpos, ypos); // Set cursor near top left corner of screen
tft.setFreeFont(TT1); // Select the orginal small TomThumb font
tft.println(); // Move cursor down a line
@ -280,7 +280,7 @@ void drawDatumMarker(int x, int y)
// There follows a crude way of flagging that this example sketch needs fonts which
// have not been enbabled in the User_Setup.h file inside the TFT_HX8357 library.
// have not been enabled in the User_Setup.h file inside the TFT_HX8357 library.
//
// These lines produce errors during compile time if settings in User_Setup are not correct
//

View File

@ -3,8 +3,8 @@
button handling class, this sketch is based on the Arduin-o-phone
example.
This example diplays a keypad where numbers can be entered and
send to the Serial Monitor window.
This example displays a keypad where numbers can be entered and
sent to the Serial Monitor window.
The sketch has been tested on the ESP8266 (which supports SPIFFS)
@ -164,7 +164,7 @@ void loop(void) {
// Update the number display field
tft.setTextDatum(TL_DATUM); // Use top left corner as text coord datum
tft.setFreeFont(&FreeSans18pt7b); // Choose a nicefont that fits box
tft.setFreeFont(&FreeSans18pt7b); // Choose a nice font that fits box
tft.setTextColor(DISP_TCOLOR); // Set the font colour
// Draw the string, the value returned is the width in pixels
@ -209,7 +209,7 @@ void touch_calibrate()
// check file system exists
if (!SPIFFS.begin()) {
Serial.println("Formating file system");
Serial.println("formatting file system");
SPIFFS.format();
SPIFFS.begin();
}
@ -238,7 +238,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setCursor(20, 0);
tft.setcursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
@ -272,7 +272,7 @@ void touch_calibrate()
// Print something in the mini status bar
void status(const char *msg) {
tft.setTextPadding(240);
//tft.setCursor(STATUS_X, STATUS_Y);
//tft.setcursor(STATUS_X, STATUS_Y);
tft.setTextColor(TFT_WHITE, TFT_DARKGREY);
tft.setTextFont(0);
tft.setTextDatum(TC_DATUM);

View File

@ -11,7 +11,7 @@
// Change the pin settings to suit your hardware
// UNO etc
// UNO etc.
//#define TFT_MOSI 11
//#define TFT_SCK 13
//#define TFT_CS 9
@ -116,7 +116,7 @@ void setup() {
uint32_t ID = 0;
Serial.begin(115200);
delay(4000); // Delay to allow USB to connect to a Leonardo etc
delay(4000); // Delay to allow USB to connect to a Leonardo etc.
Serial.println("TFT driver register values:");
Serial.println("===========================");

View File

@ -11,7 +11,7 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
byte inc = 0;
unsigned int col = 0;
byte red = 31; // Red is the top 5 bits of a 16 bit colour value
byte red = 31; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
byte state = 0;
@ -56,7 +56,7 @@ void loop() {
// rx = x axis outer radius
// ry = y axis outer radius
// w = width (thickness) of arc in pixels
// colour = 16 bit colour value
// colour = 16-bit colour value
// Note if rx and ry are the same then an arc of a circle is drawn
void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w, unsigned int colour)
@ -87,7 +87,7 @@ void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w
tft.fillTriangle(x0, y0, x1, y1, x2, y2, colour);
tft.fillTriangle(x1, y1, x2, y2, x3, y3, colour);
// Copy segment end to sgement start for next segment
// Copy segment end to segment start for next segment
x0 = x2;
y0 = y2;
x1 = x3;
@ -96,7 +96,7 @@ void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w
}
// #########################################################################
// Return the 16 bit colour with brightness 0-100%
// Return the 16-bit colour with brightness 0-100%
// #########################################################################
unsigned int brightness(unsigned int colour, int brightness)
{
@ -112,7 +112,7 @@ unsigned int brightness(unsigned int colour, int brightness)
}
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow(byte value)
{

View File

@ -19,7 +19,7 @@
#########################################################################
*/
// Note the the tilda symbol ~ does not exist in some fonts at the moment
// Note the the tilde symbol ~ does not exist in some fonts at the moment
#define TEXT "abc MWy 123 |" // Text that will be printed on screen in any font
#include "SPI.h"

View File

@ -13,7 +13,7 @@ int segment = 0;
unsigned int col = 0;
int delta = -1;
byte red = 31; // Red is the top 5 bits of a 16 bit colour value
byte red = 31; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
byte state = 0;
@ -48,7 +48,7 @@ void loop() {
// rx = x axis radius
// yx = y axis radius
// w = width (thickness) of arc in pixels
// colour = 16 bit colour value
// colour = 16-bit colour value
// Note if rx and ry are the same an arc of a circle is drawn
void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w, unsigned int colour)
@ -82,7 +82,7 @@ void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w
}
// #########################################################################
// Return a 16 bit colour with brightness 0 - 100%
// Return a 16-bit colour with brightness 0 - 100%
// #########################################################################
unsigned int brightness(unsigned int colour, int brightness)
{
@ -98,7 +98,7 @@ unsigned int brightness(unsigned int colour, int brightness)
}
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow(byte value)
{

View File

@ -62,7 +62,7 @@ unsigned int rainbow(int value)
// Value is expected to be in range 0-127
// The value is converted to a spectrum colour from 0 = blue through to red = blue
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits

View File

@ -47,7 +47,7 @@ void setup(void) {
void loop() {
if (updateTime <= millis()) {
updateTime = millis() + 35; // Update emter every 35 milliseconds
updateTime = millis() + 35; // Update meter every 35 milliseconds
// Create a Sine wave for testing
d += 4; if (d >= 360) d = 0;
@ -75,7 +75,7 @@ void analogMeter()
// Long scale tick length
int tl = 15;
// Coodinates of tick to draw
// Coordinates of tick to draw
float sx = cos((i - 90) * 0.0174532925);
float sy = sin((i - 90) * 0.0174532925);
uint16_t x0 = sx * (M_SIZE*100 + tl) + M_SIZE*120;
@ -175,7 +175,7 @@ void plotNeedle(int value, byte ms_delay)
if (ms_delay == 0) old_analog = value; // Update immediately if delay is 0
float sdeg = map(old_analog, -10, 110, -150, -30); // Map value to angle
// Calcualte tip of needle coords
// Calculate tip of needle coords
float sx = cos(sdeg * 0.0174532925);
float sy = sin(sdeg * 0.0174532925);

View File

@ -95,7 +95,7 @@ void analogMeter()
// Long scale tick length
int tl = 15;
// Coodinates of tick to draw
// Coordinates of tick to draw
float sx = cos((i - 90) * 0.0174532925);
float sy = sin((i - 90) * 0.0174532925);
uint16_t x0 = sx * (100 + tl) + 120;
@ -195,7 +195,7 @@ void plotNeedle(int value, byte ms_delay)
if (ms_delay == 0) old_analog = value; // Update immediately id delay is 0
float sdeg = map(old_analog, -10, 110, -150, -30); // Map value to angle
// Calcualte tip of needle coords
// Calculate tip of needle coords
float sx = cos(sdeg * 0.0174532925);
float sy = sin(sdeg * 0.0174532925);

View File

@ -44,7 +44,7 @@ void loop() {
// start_angle = 0 - 359
// sub_angle = 0 - 360 = subtended angle
// r = radius
// colour = 16 bit colour value
// colour = 16-bit colour value
int fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned int colour)
{
@ -63,7 +63,7 @@ int fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned in
tft.fillTriangle(x1, y1, x2, y2, x, y, colour);
// Copy segment end to sgement start for next segment
// Copy segment end to segment start for next segment
x1 = x2;
y1 = y2;
}
@ -71,7 +71,7 @@ int fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned in
// #########################################################################
// Return the 16 bit colour with brightness 0-100%
// Return the 16-bit colour with brightness 0-100%
// #########################################################################
unsigned int brightness(unsigned int colour, int brightness)
{

View File

@ -1,5 +1,5 @@
/*
Test the tft.print() viz embedded tft.write() function
Test the tft.print() viz. embedded tft.write() function
This sketch used font 2, 4, 7
@ -34,7 +34,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0) and select font 2
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setCursor(0, 0, 2);
tft.setcursor(0, 0, 2);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
// We can now plot text on screen using the "print" class

View File

@ -45,15 +45,15 @@ void loop() {
// The standard AdaFruit font still works as before
tft.setTextColor(TFT_BLACK); // Background is not defined so it is transparent
tft.setCursor (60, 5);
tft.setcursor (60, 5);
tft.setTextFont(0); // Select font 0 which is the Adafruit font
tft.print("Original Adafruit font!");
//tft.drawString("Original Adafruit font!",60,5,1);
// The new larger fonts do not need to use the .setCursor call, coords are embedded
// The new larger fonts do not need to use the .setcursor call, coords are embedded
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
tft.drawCentreString("Font size 2", 120, 14, 2); // Draw text centre at position 120, 14 using font 2
tft.drawCentreString("Font size 4", 120, 30, 4); // Draw text centre at position 120, 30 using font 4
tft.drawCentreString("12.34", 120, 54, 6); // Draw text centre at position 120, 54 using font 6
@ -74,15 +74,15 @@ void loop() {
tft.setTextColor(TFT_BLACK); // Set text colour to black, no background (so transparent)
tft.setCursor(36, 150, 4); // Set cursor to x = 36, y = 150 and use font 4
tft.setcursor(36, 150, 4); // Set cursor to x = 36, y = 150 and use font 4
tft.println("Transparent..."); // As we use println, the cursor moves to the next line
tft.setCursor(30, 175); // Set cursor to x = 30, y = 175
tft.setcursor(30, 175); // Set cursor to x = 30, y = 175
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set text colour to white and background to black
tft.println("White on black");
tft.setTextFont(4); // Select font 4 without moving cursor
tft.setCursor(50, 210); // Set cursor to x = 50, y = 210 without changing the font
tft.setcursor(50, 210); // Set cursor to x = 50, y = 210 without changing the font
tft.setTextColor(TFT_WHITE);
// By using #TFT print we can use all the formatting features like printing HEX
tft.print(57005, HEX); // Cursor does no move to next line
@ -98,7 +98,7 @@ void loop() {
// Fill screen with a rainbow pattern
void rainbow_fill()
{
// The colours and state are not initialised so the start colour changes each time the funtion is called
// The colours and state are not initialised so the start colour changes each time the function is called
for (int i = 319; i > 0; i--) {
// Draw a vertical line 1 pixel wide in the selected colour

View File

@ -38,7 +38,7 @@ void setup(void) {
void loop() {
tft.fillScreen(TFT_BLUE);
tft.setCursor(0, 0, 2);
tft.setcursor(0, 0, 2);
// Set the font colour to be white with a black background
tft.setTextColor(TFT_WHITE, TFT_BLACK);
// We can now plot text on screen using the "print" class
@ -56,7 +56,7 @@ void loop() {
printSubset(); // Print a useful subset of the readable registers
readTest(); // Test 8, 16 and 32 bit reads and index on the ID register
readTest(); // Test 8, 16 and 32-bit reads and index on the ID register
//printRange32(0x00, 0xFF); // Print a range of registers (32 bits, index = 0)
@ -70,8 +70,8 @@ void loop() {
void readTest(void)
{
Serial.println(); Serial.println("Test 8, 16 and 32 bit reads and the index...");
// Test 8, 16 and 32 bit reads and index
Serial.println(); Serial.println("Test 8, 16 and 32-bit reads and the index...");
// Test 8, 16 and 32-bit reads and index
// Note at index 0 the register values are typically undefined (Bxxxxxxxx)
Serial.println(tft.readcommand8(ILI9341_RDID4, 2), HEX);
Serial.println(tft.readcommand16(ILI9341_RDID4, 2), HEX);

Some files were not shown because too many files have changed in this diff Show More