update lib of TFT_eSPI from 2.5.0 to 2.5.23
This commit is contained in:
parent
8a3d22ab2f
commit
084eb40404
@ -6,8 +6,8 @@
|
||||
// within button
|
||||
***************************************************************************************/
|
||||
|
||||
class TFT_eSPI_Button : public TFT_eSPI {
|
||||
|
||||
class TFT_eSPI_Button
|
||||
{
|
||||
public:
|
||||
TFT_eSPI_Button(void);
|
||||
// "Classic" initButton() uses centre & size
|
||||
|
@ -223,10 +223,7 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
***************************************************************************************/
|
||||
void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
||||
{
|
||||
if (_colorMap != nullptr)
|
||||
{
|
||||
free(_colorMap);
|
||||
}
|
||||
if (!_created) return;
|
||||
|
||||
if (colorMap == nullptr)
|
||||
{
|
||||
@ -236,7 +233,7 @@ void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
||||
}
|
||||
|
||||
// Allocate and clear memory for 16 color map
|
||||
_colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
||||
if (_colorMap == nullptr) _colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
||||
|
||||
if (colors > 16) colors = 16;
|
||||
|
||||
@ -254,6 +251,8 @@ void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
||||
***************************************************************************************/
|
||||
void TFT_eSprite::createPalette(const uint16_t colorMap[], uint8_t colors)
|
||||
{
|
||||
if (!_created) return;
|
||||
|
||||
if (colorMap == nullptr)
|
||||
{
|
||||
// Create a color map using the default FLASH map
|
||||
@ -261,7 +260,7 @@ void TFT_eSprite::createPalette(const uint16_t colorMap[], uint8_t colors)
|
||||
}
|
||||
|
||||
// Allocate and clear memory for 16 color map
|
||||
_colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
||||
if (_colorMap == nullptr) _colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
||||
|
||||
if (colors > 16) colors = 16;
|
||||
|
||||
@ -310,13 +309,9 @@ void* TFT_eSprite::setColorDepth(int8_t b)
|
||||
else if ( b > 1 ) _bpp = 4;
|
||||
else _bpp = 1;
|
||||
|
||||
// Can't change an existing sprite's colour depth so delete it
|
||||
if (_created) free(_img8_1);
|
||||
|
||||
// If it existed, re-create the sprite with the new colour depth
|
||||
if (_created)
|
||||
{
|
||||
_created = false;
|
||||
// Can't change an existing sprite's colour depth so delete and create a new one
|
||||
if (_created) {
|
||||
deleteSprite();
|
||||
return createSprite(_dwidth, _dheight);
|
||||
}
|
||||
|
||||
@ -380,7 +375,7 @@ void TFT_eSprite::deleteSprite(void)
|
||||
if (_colorMap != nullptr)
|
||||
{
|
||||
free(_colorMap);
|
||||
_colorMap = nullptr;
|
||||
_colorMap = nullptr;
|
||||
}
|
||||
|
||||
if (_created)
|
||||
|
@ -10,6 +10,11 @@
|
||||
|
||||
// See license in root directory.
|
||||
|
||||
// Define a default pressure threshold
|
||||
#ifndef Z_THRESHOLD
|
||||
#define Z_THRESHOLD 350 // Touch pressure threshold for validating touches
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: begin_touch_read_write - was spi_begin_touch
|
||||
** Description: Start transaction and select touch controller
|
||||
@ -161,7 +166,6 @@ uint8_t TFT_eSPI::validTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
||||
** Function name: getTouch
|
||||
** Description: read callibrated position. Return false if not pressed.
|
||||
***************************************************************************************/
|
||||
#define Z_THRESHOLD 350 // Touch pressure threshold for validating touches
|
||||
uint8_t TFT_eSPI::getTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
|
||||
uint16_t x_tmp, y_tmp;
|
||||
|
||||
|
@ -150,12 +150,16 @@ menu "TFT_eSPI"
|
||||
|
||||
endchoice
|
||||
|
||||
config TFT_PARALLEL_8_BIT
|
||||
bool "Enable 8-bit parallel mode (otherwise SPI is assumed)"
|
||||
default "n"
|
||||
depends on IDF_TARGET_ESP32
|
||||
choice TFT_INTERFACE
|
||||
prompt "LCD Interface"
|
||||
default TFT_SPI
|
||||
help
|
||||
Use 8-bit parallel bus to send data to the LCD. If not set SPI will be used.
|
||||
Communication interface between the microcontroller and the LCD.
|
||||
config TFT_SPI
|
||||
bool "SPI"
|
||||
config TFT_PARALLEL_8_BIT
|
||||
bool "Parallel (8 bit)"
|
||||
endchoice
|
||||
|
||||
menu "Display Data pins"
|
||||
depends on TFT_PARALLEL_8_BIT
|
||||
@ -211,11 +215,11 @@ menu "TFT_eSPI"
|
||||
endmenu
|
||||
|
||||
menu "Display SPI config"
|
||||
depends on !TFT_PARALLEL_8_BIT
|
||||
depends on TFT_SPI
|
||||
|
||||
choice TFT_SPI_PORT
|
||||
prompt "SPI port"
|
||||
default TFT_SPI_2_HOST
|
||||
default TFT_VSPI_PORT
|
||||
help
|
||||
The ESP32 has 2 free SPI ports i.e. VSPI (SPI2) and HSPI (SPI3),
|
||||
the VSPI is the default. If the VSPI port is in use and pins are
|
||||
@ -232,6 +236,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 32 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
help
|
||||
Master In Slave Out pin.
|
||||
Can be labelled as SDO in some displays
|
||||
@ -241,6 +246,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 32 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
help
|
||||
Master Out Slave In pin.
|
||||
Can be labelled as SDA or SDI in some displays
|
||||
@ -250,6 +256,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 32 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
help
|
||||
Labelled in some displays as WR
|
||||
|
||||
@ -287,6 +294,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 33 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
|
||||
config TFT_DC
|
||||
int "TFT Data/Command pin"
|
||||
@ -300,6 +308,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 33 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
|
||||
config ENABLE_BL
|
||||
bool "Enable backlight control"
|
||||
@ -311,6 +320,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 33 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
help
|
||||
Pin for the backlight control signal
|
||||
|
||||
@ -379,6 +389,7 @@ menu "TFT_eSPI"
|
||||
default -1
|
||||
range -1 33 if IDF_TARGET_ESP32
|
||||
range -1 45 if IDF_TARGET_ESP32S2
|
||||
range -1 48 if IDF_TARGET_ESP32S3
|
||||
|
||||
config SPI_TOUCH_FREQUENCY
|
||||
int "SPI frequency for XPT2046 chip (Hz)"
|
||||
@ -387,4 +398,10 @@ menu "TFT_eSPI"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
menu "Other settings"
|
||||
config DISABLE_WARNINGS
|
||||
bool "Disable Library warnings"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
@ -41,11 +41,11 @@
|
||||
#endif
|
||||
#else
|
||||
#ifdef USE_HSPI_PORT
|
||||
#define DMA_CHANNEL 2
|
||||
spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes
|
||||
#define DMA_CHANNEL SPI_DMA_CH_AUTO
|
||||
spi_host_device_t spi_host = (spi_host_device_t) SPI3_HOST; // Draws once then freezes
|
||||
#else // use FSPI port
|
||||
#define DMA_CHANNEL 1
|
||||
spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes
|
||||
#define DMA_CHANNEL SPI_DMA_CH_AUTO
|
||||
spi_host_device_t spi_host = (spi_host_device_t) SPI2_HOST; // Draws once then freezes
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@ -64,29 +64,35 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: beginSDA
|
||||
** Description: Detach SPI from pin to permit software SPI
|
||||
** Function name: beginSDA - VSPI port only, FPSI port only for S2
|
||||
** Description: Detach MOSI and attach MISO to SDA for reads
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::begin_SDA_Read(void)
|
||||
{
|
||||
pinMatrixOutDetach(TFT_MOSI, false, false);
|
||||
pinMode(TFT_MOSI, INPUT);
|
||||
pinMatrixInAttach(TFT_MOSI, VSPIQ_IN_IDX, false);
|
||||
gpio_set_direction((gpio_num_t)TFT_MOSI, GPIO_MODE_INPUT);
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
pinMatrixInAttach(TFT_MOSI, VSPIQ_IN_IDX, false);
|
||||
#else // S2
|
||||
pinMatrixInAttach(TFT_MOSI, FSPIQ_IN_IDX, false);
|
||||
#endif
|
||||
SET_BUS_READ_MODE;
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: endSDA
|
||||
** Description: Attach SPI pins after software SPI
|
||||
** Function name: endSDA - VSPI port only, FPSI port only for S2
|
||||
** Description: Attach MOSI to SDA and detach MISO for writes
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::end_SDA_Read(void)
|
||||
{
|
||||
pinMode(TFT_MOSI, OUTPUT);
|
||||
pinMatrixOutAttach(TFT_MOSI, VSPID_OUT_IDX, false, false);
|
||||
pinMode(TFT_MISO, INPUT);
|
||||
pinMatrixInAttach(TFT_MISO, VSPIQ_IN_IDX, false);
|
||||
gpio_set_direction((gpio_num_t)TFT_MOSI, GPIO_MODE_OUTPUT);
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
pinMatrixOutAttach(TFT_MOSI, VSPID_OUT_IDX, false, false);
|
||||
#else // S2
|
||||
pinMatrixOutAttach(TFT_MOSI, FSPID_OUT_IDX, false, false);
|
||||
#endif
|
||||
SET_BUS_WRITE_MODE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // #if defined (TFT_SDA_READ)
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -761,6 +767,17 @@ void IRAM_ATTR dc_callback(spi_transaction_t *spi_tx)
|
||||
else {DC_C;}
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: dma_end_callback
|
||||
** Description: Clear DMA run flag to stop retransmission loop
|
||||
***************************************************************************************/
|
||||
extern "C" void dma_end_callback();
|
||||
|
||||
void IRAM_ATTR dma_end_callback(spi_transaction_t *spi_tx)
|
||||
{
|
||||
WRITE_PERI_REG(SPI_DMA_CONF_REG(spi_host), 0);
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: initDMA
|
||||
** Description: Initialise the DMA engine - returns true if init OK
|
||||
@ -776,6 +793,12 @@ 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
|
||||
.data4_io_num = -1,
|
||||
.data5_io_num = -1,
|
||||
.data6_io_num = -1,
|
||||
.data7_io_num = -1,
|
||||
#endif
|
||||
.max_transfer_sz = TFT_WIDTH * TFT_HEIGHT * 2 + 8, // TFT screen size
|
||||
.flags = 0,
|
||||
.intr_flags = 0
|
||||
@ -798,7 +821,11 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
.flags = SPI_DEVICE_NO_DUMMY, //0,
|
||||
.queue_size = 1,
|
||||
.pre_cb = 0, //dc_callback, //Callback to handle D/C line
|
||||
.post_cb = 0
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
.post_cb = 0
|
||||
#else
|
||||
.post_cb = dma_end_callback
|
||||
#endif
|
||||
};
|
||||
ret = spi_bus_initialize(spi_host, &buscfg, DMA_CHANNEL);
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
@ -66,27 +66,24 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: beginSDA
|
||||
** Description: Detach SPI from pin to permit software SPI
|
||||
** Function name: beginSDA - FPSI port only
|
||||
** Description: Detach MOSI and attach MISO to SDA for reads
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::begin_SDA_Read(void)
|
||||
{
|
||||
pinMatrixOutDetach(TFT_MOSI, false, false);
|
||||
pinMode(TFT_MOSI, INPUT);
|
||||
pinMatrixInAttach(TFT_MOSI, VSPIQ_IN_IDX, false);
|
||||
gpio_set_direction((gpio_num_t)TFT_MOSI, GPIO_MODE_INPUT);
|
||||
pinMatrixInAttach(TFT_MOSI, FSPIQ_IN_IDX, false);
|
||||
SET_BUS_READ_MODE;
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: endSDA
|
||||
** Description: Attach SPI pins after software SPI
|
||||
** Function name: endSDA - FPSI port only
|
||||
** Description: Attach MOSI to SDA and detach MISO for writes
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::end_SDA_Read(void)
|
||||
{
|
||||
pinMode(TFT_MOSI, OUTPUT);
|
||||
pinMatrixOutAttach(TFT_MOSI, VSPID_OUT_IDX, false, false);
|
||||
pinMode(TFT_MISO, INPUT);
|
||||
pinMatrixInAttach(TFT_MISO, VSPIQ_IN_IDX, false);
|
||||
gpio_set_direction((gpio_num_t)TFT_MOSI, GPIO_MODE_OUTPUT);
|
||||
pinMatrixOutAttach(TFT_MOSI, FSPID_OUT_IDX, false, false);
|
||||
SET_BUS_WRITE_MODE;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,11 +43,11 @@
|
||||
#endif
|
||||
#else
|
||||
#ifdef USE_HSPI_PORT
|
||||
#define DMA_CHANNEL 2
|
||||
spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes
|
||||
#define DMA_CHANNEL SPI_DMA_CH_AUTO
|
||||
spi_host_device_t spi_host = SPI3_HOST;
|
||||
#else // use FSPI port
|
||||
#define DMA_CHANNEL 1
|
||||
spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes
|
||||
#define DMA_CHANNEL SPI_DMA_CH_AUTO
|
||||
spi_host_device_t spi_host = SPI2_HOST;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@ -57,27 +57,24 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: beginSDA
|
||||
** Description: Detach SPI from pin to permit software SPI
|
||||
** Function name: beginSDA - FPSI port only
|
||||
** Description: Detach MOSI and attach MISO to SDA for reads
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::begin_SDA_Read(void)
|
||||
{
|
||||
pinMatrixOutDetach(TFT_MOSI, false, false);
|
||||
pinMode(TFT_MOSI, INPUT);
|
||||
pinMatrixInAttach(TFT_MOSI, VSPIQ_IN_IDX, false);
|
||||
gpio_set_direction((gpio_num_t)TFT_MOSI, GPIO_MODE_INPUT);
|
||||
pinMatrixInAttach(TFT_MOSI, FSPIQ_IN_IDX, false);
|
||||
SET_BUS_READ_MODE;
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: endSDA
|
||||
** Description: Attach SPI pins after software SPI
|
||||
** Function name: endSDA - FPSI port only
|
||||
** Description: Attach MOSI to SDA and detach MISO for writes
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::end_SDA_Read(void)
|
||||
{
|
||||
pinMode(TFT_MOSI, OUTPUT);
|
||||
pinMatrixOutAttach(TFT_MOSI, VSPID_OUT_IDX, false, false);
|
||||
pinMode(TFT_MISO, INPUT);
|
||||
pinMatrixInAttach(TFT_MISO, VSPIQ_IN_IDX, false);
|
||||
gpio_set_direction((gpio_num_t)TFT_MOSI, GPIO_MODE_OUTPUT);
|
||||
pinMatrixOutAttach(TFT_MOSI, FSPID_OUT_IDX, false, false);
|
||||
SET_BUS_WRITE_MODE;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -96,21 +93,20 @@ uint8_t TFT_eSPI::readByte(void)
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
RD_L;
|
||||
uint32_t reg; // Read all GPIO pins 0-31
|
||||
reg = gpio_input_get(); // Read three times to allow for bus access time
|
||||
reg = gpio_input_get();
|
||||
reg = gpio_input_get(); // Data should be stable now
|
||||
RD_H;
|
||||
b = gpio_get_level((gpio_num_t)TFT_D0); // Read three times to allow for bus access time
|
||||
b = gpio_get_level((gpio_num_t)TFT_D0);
|
||||
b = gpio_get_level((gpio_num_t)TFT_D0); // Data should be stable now
|
||||
|
||||
// Check GPIO bits used and build value
|
||||
b = (((reg>>TFT_D0)&1) << 0);
|
||||
b |= (((reg>>TFT_D1)&1) << 1);
|
||||
b |= (((reg>>TFT_D2)&1) << 2);
|
||||
b |= (((reg>>TFT_D3)&1) << 3);
|
||||
b |= (((reg>>TFT_D4)&1) << 4);
|
||||
b |= (((reg>>TFT_D5)&1) << 5);
|
||||
b |= (((reg>>TFT_D6)&1) << 6);
|
||||
b |= (((reg>>TFT_D7)&1) << 7);
|
||||
b = (gpio_get_level((gpio_num_t)TFT_D0) << 0);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D1) << 1);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D2) << 2);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D3) << 3);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D4) << 4);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D5) << 5);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D6) << 6);
|
||||
b |= (gpio_get_level((gpio_num_t)TFT_D7) << 7);
|
||||
RD_H;
|
||||
#endif
|
||||
|
||||
return b;
|
||||
@ -644,6 +640,15 @@ void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len)
|
||||
for (uint32_t i = 0; i < len; i++) (image[i] = image[i] << 8 | image[i] >> 8);
|
||||
}
|
||||
|
||||
// DMA byte count for transmit is 64Kbytes maximum, so to avoid this constraint
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(image, 0x400);
|
||||
len -= 0x400; image+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
|
||||
@ -670,11 +675,20 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
{
|
||||
if ((w == 0) || (h == 0) || (!DMA_Enabled)) return;
|
||||
|
||||
uint16_t *buffer = (uint16_t*)image;
|
||||
uint32_t len = w*h;
|
||||
|
||||
dmaWait();
|
||||
|
||||
setAddrWindow(x, y, w, h);
|
||||
// DMA byte count for transmit is 64Kbytes maximum, so to avoid this constraint
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(buffer, 0x400);
|
||||
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
@ -682,7 +696,7 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
memset(&trans, 0, sizeof(spi_transaction_t));
|
||||
|
||||
trans.user = (void *)1;
|
||||
trans.tx_buffer = image; //Data pointer
|
||||
trans.tx_buffer = buffer; //Data pointer
|
||||
trans.length = len * 16; //Data length, in bits
|
||||
trans.flags = 0; //SPI_TRANS_USE_TXDATA flag
|
||||
|
||||
@ -752,6 +766,15 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
|
||||
setAddrWindow(x, y, dw, dh);
|
||||
|
||||
// DMA byte count for transmit is 64Kbytes maximum, so to avoid this constraint
|
||||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(buffer, 0x400);
|
||||
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
|
||||
@ -775,7 +798,7 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
||||
// The DMA functions here work with SPI only (not parallel)
|
||||
/***************************************************************************************
|
||||
** Function name: dc_callback
|
||||
** Description: Toggles DC line during transaction
|
||||
** Description: Toggles DC line during transaction (not used)
|
||||
***************************************************************************************/
|
||||
extern "C" void dc_callback();
|
||||
|
||||
@ -785,6 +808,17 @@ void IRAM_ATTR dc_callback(spi_transaction_t *spi_tx)
|
||||
else {DC_C;}
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: dma_end_callback
|
||||
** Description: Clear DMA run flag to stop retransmission loop
|
||||
***************************************************************************************/
|
||||
extern "C" void dma_end_callback();
|
||||
|
||||
void IRAM_ATTR dma_end_callback(spi_transaction_t *spi_tx)
|
||||
{
|
||||
WRITE_PERI_REG(SPI_DMA_CONF_REG(spi_host), 0);
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: initDMA
|
||||
** Description: Initialise the DMA engine - returns true if init OK
|
||||
@ -800,7 +834,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
.sclk_io_num = TFT_SCLK,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.max_transfer_sz = TFT_WIDTH * TFT_HEIGHT * 2 + 8, // TFT screen size
|
||||
.max_transfer_sz = 65536, // ESP32 S3 max size is 64Kbytes
|
||||
.flags = 0,
|
||||
.intr_flags = 0
|
||||
};
|
||||
@ -820,9 +854,9 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
.input_delay_ns = 0,
|
||||
.spics_io_num = pin,
|
||||
.flags = SPI_DEVICE_NO_DUMMY, //0,
|
||||
.queue_size = 1,
|
||||
.pre_cb = 0, //dc_callback, //Callback to handle D/C line
|
||||
.post_cb = 0
|
||||
.queue_size = 1, // Not using queues
|
||||
.pre_cb = 0, //dc_callback, //Callback to handle D/C line (not used)
|
||||
.post_cb = dma_end_callback //Callback to end transmission
|
||||
};
|
||||
ret = spi_bus_initialize(spi_host, &buscfg, DMA_CHANNEL);
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
@ -7,10 +7,6 @@
|
||||
#ifndef _TFT_eSPI_ESP32H_
|
||||
#define _TFT_eSPI_ESP32H_
|
||||
|
||||
#if !defined(DISABLE_ALL_LIBRARY_WARNINGS)
|
||||
#warning >>>>------>> DMA is not supported on the ESP32 S3 (possible future update)
|
||||
#endif
|
||||
|
||||
// Processor ID reported by getSetup()
|
||||
#define PROCESSOR_ID 0x32
|
||||
|
||||
@ -110,6 +106,10 @@ SPI3_HOST = 2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_ALL_LIBRARY_WARNINGS) && defined (ESP32_PARALLEL)
|
||||
#warning >>>>------>> DMA is not supported in parallel mode
|
||||
#endif
|
||||
|
||||
// Processor specific code used by SPI bus transaction startWrite and endWrite functions
|
||||
#if !defined (ESP32_PARALLEL)
|
||||
#define _spi_cmd (volatile uint32_t*)(SPI_CMD_REG(SPI_PORT))
|
||||
@ -134,7 +134,7 @@ SPI3_HOST = 2
|
||||
#if !defined(TFT_PARALLEL_8_BIT) && !defined(SPI_18BIT_DRIVER)
|
||||
#define ESP32_DMA
|
||||
// Code to check if DMA is busy, used by SPI DMA + transaction + endWrite functions
|
||||
#define DMA_BUSY_CHECK //dmaWait()
|
||||
#define DMA_BUSY_CHECK dmaWait()
|
||||
#else
|
||||
#define DMA_BUSY_CHECK
|
||||
#endif
|
||||
@ -375,7 +375,7 @@ SPI3_HOST = 2
|
||||
if ( c & 0x20 ) xset_mask[c] |= (1 << (TFT_D5-MASK_OFFSET)); \
|
||||
if ( c & 0x40 ) xset_mask[c] |= (1 << (TFT_D6-MASK_OFFSET)); \
|
||||
if ( c & 0x80 ) xset_mask[c] |= (1 << (TFT_D7-MASK_OFFSET)); \
|
||||
} \
|
||||
} \
|
||||
|
||||
// Mask for the 8 data bits to set pin directions
|
||||
#define GPIO_DIR_MASK ((1 << (TFT_D0-MASK_OFFSET)) | (1 << (TFT_D1-MASK_OFFSET)) | (1 << (TFT_D2-MASK_OFFSET)) | (1 << (TFT_D3-MASK_OFFSET)) | (1 << (TFT_D4-MASK_OFFSET)) | (1 << (TFT_D5-MASK_OFFSET)) | (1 << (TFT_D6-MASK_OFFSET)) | (1 << (TFT_D7-MASK_OFFSET)))
|
||||
@ -511,14 +511,14 @@ SPI3_HOST = 2
|
||||
// Macros to write commands/pixel colour data to an Raspberry Pi TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#elif defined (RPI_DISPLAY_TYPE)
|
||||
|
||||
// ESP32 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) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), B-1); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), D); \
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_PORT), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||
#define TFT_WRITE_BITS(D, B) *_spi_mosi_dlen = B-1; \
|
||||
*_spi_w = D; \
|
||||
*_spi_cmd = SPI_UPDATE; \
|
||||
while (*_spi_cmd & SPI_UPDATE); \
|
||||
*_spi_cmd = SPI_USR; \
|
||||
while (*_spi_cmd & SPI_USR);
|
||||
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS((C)<<8, 16)
|
||||
@ -546,34 +546,6 @@ SPI3_HOST = 2
|
||||
// Macros for all other SPI displays
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else
|
||||
/* Old macros
|
||||
// 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); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), D); \
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_PORT), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||
|
||||
// Write 8 bits
|
||||
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
|
||||
|
||||
// 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
|
||||
#define tft_Write_16S(C) TFT_WRITE_BITS(C, 16)
|
||||
|
||||
// Write 32 bits
|
||||
#define tft_Write_32(C) TFT_WRITE_BITS(C, 32)
|
||||
|
||||
// Write two address coordinates
|
||||
#define tft_Write_32C(C,D) TFT_WRITE_BITS((uint16_t)((D)<<8 | (D)>>8)<<16 | (uint16_t)((C)<<8 | (C)>>8), 32)
|
||||
|
||||
// Write same value twice
|
||||
#define tft_Write_32D(C) TFT_WRITE_BITS((uint16_t)((C)<<8 | (C)>>8)<<16 | (uint16_t)((C)<<8 | (C)>>8), 32)
|
||||
//*/
|
||||
//* Replacement slimmer macros
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define TFT_WRITE_BITS(D, B) *_spi_mosi_dlen = B-1; \
|
||||
*_spi_w = D; \
|
||||
@ -598,13 +570,13 @@ SPI3_HOST = 2
|
||||
#define tft_Write_16N(C) *_spi_mosi_dlen = 16-1; \
|
||||
*_spi_w = ((C)<<8 | (C)>>8); \
|
||||
*_spi_cmd = SPI_USR;
|
||||
#else
|
||||
#else
|
||||
#define tft_Write_16N(C) *_spi_mosi_dlen = 16-1; \
|
||||
*_spi_w = ((C)<<8 | (C)>>8); \
|
||||
*_spi_cmd = SPI_UPDATE; \
|
||||
while (*_spi_cmd & SPI_UPDATE); \
|
||||
*_spi_cmd = SPI_USR;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Write 16 bits
|
||||
#define tft_Write_16S(C) TFT_WRITE_BITS(C, 16)
|
||||
@ -618,7 +590,6 @@ SPI3_HOST = 2
|
||||
// Write same value twice
|
||||
#define tft_Write_32D(C) TFT_WRITE_BITS((uint16_t)((C)<<8 | (C)>>8)<<16 | (uint16_t)((C)<<8 | (C)>>8), 32)
|
||||
|
||||
//*/
|
||||
#endif
|
||||
|
||||
#ifndef tft_Write_16N
|
||||
|
@ -29,10 +29,15 @@
|
||||
#include "pio_SPI.pio.h"
|
||||
#endif
|
||||
#elif defined (TFT_PARALLEL_8_BIT)
|
||||
// SPI PIO code for 8 bit parallel interface (16 bit colour)
|
||||
#include "pio_8bit_parallel.pio.h"
|
||||
#if defined (SSD1963_DRIVER)
|
||||
// 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)
|
||||
#include "pio_8bit_parallel.pio.h"
|
||||
#endif
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
// SPI PIO code for 16 bit parallel interface (16 bit colour)
|
||||
// PIO code for 16 bit parallel interface (16 bit colour)
|
||||
#include "pio_16bit_parallel.pio.h"
|
||||
#endif
|
||||
|
||||
@ -279,7 +284,7 @@ void pioinit(uint16_t clock_div, uint16_t fract_div) {
|
||||
// PIO handles pixel block fill writes
|
||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
||||
{
|
||||
#if defined (SPI_18BIT_DRIVER)
|
||||
#if defined (SPI_18BIT_DRIVER) || (defined (SSD1963_DRIVER) && defined (TFT_PARALLEL_8_BIT))
|
||||
uint32_t col = ((color & 0xF800)<<8) | ((color & 0x07E0)<<5) | ((color & 0x001F)<<3);
|
||||
if (len) {
|
||||
WAIT_FOR_STALL;
|
||||
@ -327,7 +332,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||
** Description: Write a sequence of pixels
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
||||
#if defined (SPI_18BIT_DRIVER)
|
||||
#if defined (SPI_18BIT_DRIVER) || (defined (SSD1963_DRIVER) && defined (TFT_PARALLEL_8_BIT))
|
||||
uint16_t *data = (uint16_t*)data_in;
|
||||
if (_swapBytes) {
|
||||
while ( len-- ) {
|
||||
|
@ -165,8 +165,13 @@
|
||||
#define DC_C WAIT_FOR_STALL; \
|
||||
tft_pio->sm[pio_sm].instr = pio_instr_clr_dc
|
||||
|
||||
// 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
|
||||
#ifndef RM68120_DRIVER
|
||||
// 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
|
||||
#define DC_D WAIT_FOR_STALL; tft_pio->sm[pio_sm].instr = pio_instr_set_dc
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -408,7 +413,7 @@
|
||||
// Temporary - to be deleted
|
||||
#define GPIO_DIR_MASK 0
|
||||
|
||||
#if defined (SPI_18BIT_DRIVER) // SPI 18 bit colour
|
||||
#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
|
||||
|
@ -598,6 +598,8 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
||||
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn); // Enable DMA end interrupt handler
|
||||
#elif (TFT_SPI_PORT == 2)
|
||||
HAL_NVIC_EnableIRQ(DMA1_Stream4_IRQn); // Enable DMA end interrupt handler
|
||||
#elif (TFT_SPI_PORT == 3)
|
||||
HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn);
|
||||
#endif
|
||||
|
||||
__HAL_LINKDMA(&spiHal, hdmatx, dmaHal); // Attach DMA engine to SPI peripheral
|
||||
|
73
lib/TFT_eSPI/Processors/pio_8bit_parallel_18bpp.pio.h
Normal file
73
lib/TFT_eSPI/Processors/pio_8bit_parallel_18bpp.pio.h
Normal file
@ -0,0 +1,73 @@
|
||||
// -------------------------------------------------- //
|
||||
// This file is autogenerated by pioasm; do not edit! //
|
||||
// -------------------------------------------------- //
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !PICO_NO_HARDWARE
|
||||
#include "hardware/pio.h"
|
||||
#endif
|
||||
|
||||
// ------ //
|
||||
// tft_io //
|
||||
// ------ //
|
||||
|
||||
#define tft_io_wrap_target 11
|
||||
#define tft_io_wrap 31
|
||||
|
||||
#define tft_io_offset_block_fill 0u
|
||||
#define tft_io_offset_start_tx 11u
|
||||
#define tft_io_offset_start_8 18u
|
||||
#define tft_io_offset_set_addr_window 21u
|
||||
|
||||
static const uint16_t tft_io_program_instructions[] = {
|
||||
0x98a0, // 0: pull block side 1
|
||||
0xa027, // 1: mov x, osr
|
||||
0x80a0, // 2: pull block
|
||||
0xa047, // 3: mov y, osr
|
||||
0xb8e1, // 4: mov osr, x side 1
|
||||
0x7110, // 5: out pins, 16 side 0 [1]
|
||||
0xb942, // 6: nop side 1 [1]
|
||||
0x7108, // 7: out pins, 8 side 0 [1]
|
||||
0xb942, // 8: nop side 1 [1]
|
||||
0x7108, // 9: out pins, 8 side 0 [1]
|
||||
0x1884, // 10: jmp y--, 4 side 1
|
||||
// .wrap_target
|
||||
0x98a0, // 11: pull block side 1
|
||||
0x7110, // 12: out pins, 16 side 0 [1]
|
||||
0xb942, // 13: nop side 1 [1]
|
||||
0x7108, // 14: out pins, 8 side 0 [1]
|
||||
0xb942, // 15: nop side 1 [1]
|
||||
0x7108, // 16: out pins, 8 side 0 [1]
|
||||
0x180b, // 17: jmp 11 side 1
|
||||
0x98a0, // 18: pull block side 1
|
||||
0x7100, // 19: out pins, 32 side 0 [1]
|
||||
0x180b, // 20: jmp 11 side 1
|
||||
0xf822, // 21: set x, 2 side 1
|
||||
0xe000, // 22: set pins, 0
|
||||
0x80a0, // 23: pull block
|
||||
0x7000, // 24: out pins, 32 side 0
|
||||
0x003e, // 25: jmp !x, 30
|
||||
0x98a0, // 26: pull block side 1
|
||||
0xe001, // 27: set pins, 1
|
||||
0x7108, // 28: out pins, 8 side 0 [1]
|
||||
0x19fc, // 29: jmp !osre, 28 side 1 [1]
|
||||
0x1856, // 30: jmp x--, 22 side 1
|
||||
0xe001, // 31: set pins, 1
|
||||
// .wrap
|
||||
};
|
||||
|
||||
#if !PICO_NO_HARDWARE
|
||||
static const struct pio_program tft_io_program = {
|
||||
.instructions = tft_io_program_instructions,
|
||||
.length = 32,
|
||||
.origin = -1,
|
||||
};
|
||||
|
||||
static inline pio_sm_config tft_io_program_get_default_config(uint offset) {
|
||||
pio_sm_config c = pio_get_default_sm_config();
|
||||
sm_config_set_wrap(&c, offset + tft_io_wrap_target, offset + tft_io_wrap);
|
||||
sm_config_set_sideset(&c, 2, true, false);
|
||||
return c;
|
||||
}
|
||||
#endif
|
@ -1,21 +1,24 @@
|
||||
A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has been added for Q&A etc. Use the ["Issues"](https://github.com/Bodmer/TFT_eSPI/issues) tab only for problems with the library. Thanks!
|
||||
# News
|
||||
1. New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches for the arcs are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing. The arc ends can be straight or rounded. Further demo examples will be added soon!
|
||||
1. New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing (which will then render faster). The arc ends can be straight or rounded. The arc drawing algorithm uses an optimised fixed point sqrt() function to improve performance on processors that do not have a hardware Floating Point Unit (e.g. RP2040). Here are two demo images, on the left smooth (anti-aliased) arcs with rounded ends, the image to the right is the same resolution (grabbed from the same 240x240 TFT) with the smoothing diasbled (no anti-aliasing):
|
||||
|
||||
2. An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by takkaO [and is available here](https://github.com/takkaO/OpenFontRender). I have been reluctant to support yet another font format but this is an amazing library which is very easy to use. It provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, however the ESP8266 does not have sufficient RAM. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
|
||||
![arcs](https://github.com/Bodmer/Github-images/blob/main/aa_arc_240x240.png) ![pixelated_arcs](https://github.com/Bodmer/Github-images/blob/main/no_aa_arc_240x240.png)
|
||||
|
||||
Here the smooth arcs have been used to create anti-aliased meter gauges on a 320x240 TFT:
|
||||
|
||||
![arcs](https://github.com/Bodmer/Github-images/blob/main/xarc_meters_320x240.png)
|
||||
|
||||
2. An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by [takkaO](https://github.com/takkaO/OpenFontRender), I have created a branch with some bug fixes [here](https://github.com/Bodmer/OpenFontRender). The library provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, the ESP8266 does not have sufficient RAM due to the glyph render complexity. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
|
||||
|
||||
![ttf_font_demo](https://i.imgur.com/bKkilIb.png)
|
||||
|
||||
3. The following is now deprecated due to the number of issues it can cause in certain circumstances. <del>For ESP32 ONLY, the TFT configuration (user setup) can now be included inside an Arduino IDE sketch providing the instructions in the example Generic->Sketch_with_tft_setup are followed. See ReadMe tab in that sketch for the instructions. If the setup is not in the sketch then the library settings will be used. This means that "per project" configurations are possible without modifying the library setup files. Please note that ALL the other examples in the library will use the library settings unless they are adapted and the "tft_setup.h" header file included. Note: there are issues with this approach, [#2007](https://github.com/Bodmer/TFT_eSPI/discussions/2007#discussioncomment-3834755) proposes an alternative method. </del>
|
||||
|
||||
4. New GUI examples have been added for sliders, buttons, graphs and meters. These examples require a new support library here:
|
||||
3. New GUI examples have been added for sliders, buttons, graphs and meters. These examples require a new support library here:
|
||||
|
||||
[TFT_eWidget](https://github.com/Bodmer/TFT_eWidget)
|
||||
|
||||
5. 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.
|
||||
4. Support has been added in v2.4.70 for the RP2040 with 16 bit parallel displays. This has been tested and the screen update performance is very good (4ms to clear 320 x 480 screen with HC8357C). The use of the RP2040 PIO makes it easy to change the write cycle timing for different displays. DMA with 16 bit transfers is also supported.
|
||||
|
||||
6. Support for HX8357B and HX8357C screens has been added (only tested with RP2040 and 16 bit parallel interface)
|
||||
7. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA not supported at the moment). Tested with v2.0.3 RC1 of the ESP32 board package. Example setups:
|
||||
5. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA only on ESP32 S3 at the moment). Tested with v2.0.3 RC1 of the ESP32 board package. Example setups:
|
||||
|
||||
[Setup70_ESP32_S2_ILI9341.h](https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup70_ESP32_S2_ILI9341.h)
|
||||
|
||||
@ -25,20 +28,18 @@ A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has b
|
||||
|
||||
[Setup70d_ILI9488_S3_Parallel.h](https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup70d_ILI9488_S3_Parallel.h)
|
||||
|
||||
8. Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
|
||||
6. Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLUE, true);
|
||||
spr.setTextColor(TFT_BLUE, TFT_BLACK, true);
|
||||
|
||||
Note: background rendering for Smooth fonts is also now available when using the print stream e.g. with: tft.println("Hello World");
|
||||
|
||||
9. New anti-aliased graphics functions to draw lines, wedge shaped lines, circles and rounded rectangles. [Examples are included](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Smooth%20Graphics). Examples have also been added to [display PNG compressed images](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/PNG%20Images) (note: requires ~40kbytes RAM).
|
||||
7. New anti-aliased graphics functions to draw lines, wedge shaped lines, circles and rounded rectangles. [Examples are included](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Smooth%20Graphics). Examples have also been added to [display PNG compressed images](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/PNG%20Images) (note: requires ~40kbytes RAM).
|
||||
|
||||
10. Frank Boesing has created an extension library for TFT_eSPI that allows a large range of ready-built fonts to be used. Frank's library (adapted to permit rendering in sprites as well as TFT) can be [downloaded here](https://github.com/Bodmer/TFT_eSPI_ext). More than 3300 additional Fonts are [available here](https://github.com/FrankBoesing/fonts/tree/master/ofl). The TFT_eSPI_ext library contains examples that demonstrate the use of the fonts.
|
||||
8. Users of PowerPoint experienced with running macros may be interested in the [pptm sketch generator here](https://github.com/Bodmer/PowerPoint_to_sketch), this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros [created by Kris Kasprzak here](https://github.com/KrisKasprzak/Powerpoint-ILI9341_t3).
|
||||
|
||||
11. Users of PowerPoint experienced with running macros may be interested in the [pptm sketch generator here](https://github.com/Bodmer/PowerPoint_to_sketch), this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros [created by Kris Kasprzak here](https://github.com/KrisKasprzak/Powerpoint-ILI9341_t3).
|
||||
|
||||
12. The library contains two new functions for rectangles filled with a horizontal or vertical coloured gradient:
|
||||
9. The library contains two new functions for rectangles filled with a horizontal or vertical coloured gradient:
|
||||
|
||||
tft.fillRectHGradient(x, y, w, h, color1, color2);
|
||||
|
||||
@ -46,19 +47,25 @@ Note: background rendering for Smooth fonts is also now available when using the
|
||||
|
||||
![Gradient](https://i.imgur.com/atR0DmP.png)
|
||||
|
||||
13. 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.
|
||||
10. The RP2040 8 bit parallel interface uses the PIO. The PIO now manages the "setWindow" and "block fill" actions, releasing the processor for other tasks when areas of the screen are being filled with a colour. The PIO can optionally be used for SPI interface displays if #define RP2040_PIO_SPI is put in the setup file. Touch screens and pixel read operations are not supported when the PIO interface is used.
|
||||
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.
|
||||
|
||||
14. DMA can now be used with the Raspberry Pi Pico (RP2040) when used with both 8 bit parallel and 16 bit colour SPI displays. See "Bouncy_Circles" sketch.
|
||||
11. DMA can now be used with the Raspberry Pi Pico (RP2040) when used with 8/16 bit parallel and 16 bit colour SPI displays. See "Bouncy_Circles" sketch.
|
||||
|
||||
["Bouncing circles"](https://www.youtube.com/watch?v=njFXIzCTQ_Q&lc=UgymaUIwOIuihvYh-Qt4AaABAg)
|
||||
|
||||
|
||||
# TFT_eSPI
|
||||
|
||||
An 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 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 parallel) 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.
|
||||
|
||||
The screen controller, interface pins and library configuration settings must be defined inside the library. They can NOT be defined in the Arduino sketch. See the User_Setup_Select.h file for details. This approach has significant advantages, it keeps the examples clean from long configuration options and once the setup is defined any example can be run without modification. PlatformIO users can define these settings on a per project basis within a platformio.ini file, see Docs folder in library.
|
||||
|
||||
Lots of example sketches are provided which demonstrate using the functions in the library. Due to the popularity of the library there are lots of online tutorials for TFT_eSPI that have been created by enthusiastic users.
|
||||
|
||||
Optimised drivers have been tested with the following processors:
|
||||
|
||||
@ -67,9 +74,24 @@ Optimised drivers have been tested with the following processors:
|
||||
* ESP8266
|
||||
* STM32F1xx, STM32F2xx, STM32F4xx, STM32F767 (higher RAM processors recommended)
|
||||
|
||||
For other processors only SPI interface displays are supported and the slower Arduino SPI library functions are used by the library. Higher clock speed processors such as used for the Teensy 3.x and 4.x boards will still provide a very good performance with the generic Arduino SPI functions.
|
||||
The library supports the following interface types for these processors:
|
||||
|
||||
"Four wire" SPI and 8 bit parallel interfaces are supported. Due to lack of GPIO pins the 8 bit parallel interface is NOT supported on the ESP8266. 8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32 Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
|
||||
| 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) |
|
||||
| ESP32 C3 | Yes | No | No | No |
|
||||
| ESP32 S2 | Yes | No | No | No |
|
||||
| ESP32 S3 | Yes | Yes | No | Yes (SPI only) |
|
||||
| ESP8266 | Yes | No | No | No |
|
||||
| STM32Fxxx | Yes | Yes | No | Yes (SPI only) |
|
||||
| Other | Yes | No | No | No |
|
||||
|
||||
For other (generic) processors only SPI interface displays are supported and the slower Arduino SPI library functions are used by the library. Higher clock speed processors such as used for the Teensy 3.x and 4.x boards will still provide a very good performance with the generic Arduino SPI functions.
|
||||
|
||||
Due to lack of GPIO pins the 8 bit parallel interface is NOT supported on the ESP8266. 8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32 Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
|
||||
|
||||
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.
|
||||
|
||||
Displays using the following controllers are supported:
|
||||
|
||||
@ -89,7 +111,7 @@ Displays using the following controllers are supported:
|
||||
* RM68140
|
||||
* S6D02A1
|
||||
* SSD1351
|
||||
* SSD1963
|
||||
* SSD1963 (this controller only has a parallel interface option)
|
||||
* ST7735
|
||||
* ST7789
|
||||
* ST7796
|
||||
@ -204,10 +226,3 @@ You can take this one step further and have your own setup select file and then
|
||||
#include <../TFT_eSPI_Setups/my_setup_select.h>
|
||||
```
|
||||
To select a new setup you then edit your own my_setup_select.h file (which will not get overwritten during an upgrade).
|
||||
|
||||
# ePaper displays
|
||||
|
||||
The library was intended to support only TFT displays but using a Sprite as a 1 bit per pixel screen buffer permits support for the Waveshare 2 and 3 colour SPI ePaper displays. This addition to the library is experimental and only one example is provided. Further examples will be added.
|
||||
|
||||
![Example](https://i.imgur.com/L2tV129.jpg?1)
|
||||
|
||||
|
@ -9,20 +9,48 @@
|
||||
writedata(TFT_MAD_BGR);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 2;
|
||||
rowstart = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 1;
|
||||
rowstart = 2;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2: // Inverter portrait
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 2;
|
||||
rowstart = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 1;
|
||||
rowstart = 2;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -14,24 +14,26 @@
|
||||
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||
|
||||
// Generic commands used by TFT_eSPI.cpp
|
||||
#define TFT_NOP 0x0000
|
||||
#define TFT_SWRST 0x0100
|
||||
#define TFT_NOP 0x0000
|
||||
#define TFT_SWRST 0x0100
|
||||
|
||||
#define TFT_CASET 0x2A00
|
||||
#define TFT_PASET 0x2B00
|
||||
#define TFT_RAMWR 0x2C00
|
||||
#define TFT_CASET 0x2A00
|
||||
#define TFT_PASET 0x2B00
|
||||
#define TFT_RAMWR 0x2C00
|
||||
|
||||
#define TFT_RAMRD 0x2E00
|
||||
#define TFT_IDXRD 0xDD00 // ILI9341 only, indexed control register read
|
||||
#define TFT_RAMRD 0x2E00
|
||||
#define TFT_IDXRD 0xDD00 // ILI9341 only, indexed control register read
|
||||
|
||||
#define TFT_MADCTL 0x3600
|
||||
#define TFT_MAD_MY 0x80
|
||||
#define TFT_MAD_MX 0x40
|
||||
#define TFT_MAD_MV 0x20
|
||||
#define TFT_MAD_ML 0x10
|
||||
#define TFT_MAD_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_RGB 0x00
|
||||
#define TFT_MADCTL 0x3600
|
||||
#define TFT_MAD_MY 0x80
|
||||
#define TFT_MAD_MX 0x40
|
||||
#define TFT_MAD_MV 0x20
|
||||
#define TFT_MAD_ML 0x10
|
||||
#define TFT_MAD_BGR 0x08
|
||||
#define TFT_MAD_RGB 0x00
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_H_FLIP 0x02
|
||||
#define TFT_MAD_V_FLIP 0x01
|
||||
|
||||
#ifdef TFT_RGB_ORDER
|
||||
#if (TFT_RGB_ORDER == 1)
|
||||
|
@ -1,423 +1,263 @@
|
||||
// Initialisation for RM68120
|
||||
|
||||
writeRegister(0xF000, 0x55);
|
||||
writeRegister(0xF001, 0xAA);
|
||||
writeRegister(0xF002, 0x52);
|
||||
writeRegister(0xF003, 0x08);
|
||||
writeRegister(0xF004, 0x01);
|
||||
//ENABLE PAGE 1
|
||||
writeRegister8(0xF000, 0x55);
|
||||
writeRegister8(0xF001, 0xAA);
|
||||
writeRegister8(0xF002, 0x52);
|
||||
writeRegister8(0xF003, 0x08);
|
||||
writeRegister8(0xF004, 0x01);
|
||||
|
||||
//GAMMA SETING RED
|
||||
writeRegister(0xD100, 0x00);
|
||||
writeRegister(0xD101, 0x00);
|
||||
writeRegister(0xD102, 0x1b);
|
||||
writeRegister(0xD103, 0x44);
|
||||
writeRegister(0xD104, 0x62);
|
||||
writeRegister(0xD105, 0x00);
|
||||
writeRegister(0xD106, 0x7b);
|
||||
writeRegister(0xD107, 0xa1);
|
||||
writeRegister(0xD108, 0xc0);
|
||||
writeRegister(0xD109, 0xee);
|
||||
writeRegister(0xD10A, 0x55);
|
||||
writeRegister(0xD10B, 0x10);
|
||||
writeRegister(0xD10C, 0x2c);
|
||||
writeRegister(0xD10D, 0x43);
|
||||
writeRegister(0xD10E, 0x57);
|
||||
writeRegister(0xD10F, 0x55);
|
||||
writeRegister(0xD110, 0x68);
|
||||
writeRegister(0xD111, 0x78);
|
||||
writeRegister(0xD112, 0x87);
|
||||
writeRegister(0xD113, 0x94);
|
||||
writeRegister(0xD114, 0x55);
|
||||
writeRegister(0xD115, 0xa0);
|
||||
writeRegister(0xD116, 0xac);
|
||||
writeRegister(0xD117, 0xb6);
|
||||
writeRegister(0xD118, 0xc1);
|
||||
writeRegister(0xD119, 0x55);
|
||||
writeRegister(0xD11A, 0xcb);
|
||||
writeRegister(0xD11B, 0xcd);
|
||||
writeRegister(0xD11C, 0xd6);
|
||||
writeRegister(0xD11D, 0xdf);
|
||||
writeRegister(0xD11E, 0x95);
|
||||
writeRegister(0xD11F, 0xe8);
|
||||
writeRegister(0xD120, 0xf1);
|
||||
writeRegister(0xD121, 0xfa);
|
||||
writeRegister(0xD122, 0x02);
|
||||
writeRegister(0xD123, 0xaa);
|
||||
writeRegister(0xD124, 0x0b);
|
||||
writeRegister(0xD125, 0x13);
|
||||
writeRegister(0xD126, 0x1d);
|
||||
writeRegister(0xD127, 0x26);
|
||||
writeRegister(0xD128, 0xaa);
|
||||
writeRegister(0xD129, 0x30);
|
||||
writeRegister(0xD12A, 0x3c);
|
||||
writeRegister(0xD12B, 0x4A);
|
||||
writeRegister(0xD12C, 0x63);
|
||||
writeRegister(0xD12D, 0xea);
|
||||
writeRegister(0xD12E, 0x79);
|
||||
writeRegister(0xD12F, 0xa6);
|
||||
writeRegister(0xD130, 0xd0);
|
||||
writeRegister(0xD131, 0x20);
|
||||
writeRegister(0xD132, 0x0f);
|
||||
writeRegister(0xD133, 0x8e);
|
||||
writeRegister(0xD134, 0xff);
|
||||
//GAMMA SETING GREEN
|
||||
writeRegister(0xD200, 0x00);
|
||||
writeRegister(0xD201, 0x00);
|
||||
writeRegister(0xD202, 0x1b);
|
||||
writeRegister(0xD203, 0x44);
|
||||
writeRegister(0xD204, 0x62);
|
||||
writeRegister(0xD205, 0x00);
|
||||
writeRegister(0xD206, 0x7b);
|
||||
writeRegister(0xD207, 0xa1);
|
||||
writeRegister(0xD208, 0xc0);
|
||||
writeRegister(0xD209, 0xee);
|
||||
writeRegister(0xD20A, 0x55);
|
||||
writeRegister(0xD20B, 0x10);
|
||||
writeRegister(0xD20C, 0x2c);
|
||||
writeRegister(0xD20D, 0x43);
|
||||
writeRegister(0xD20E, 0x57);
|
||||
writeRegister(0xD20F, 0x55);
|
||||
writeRegister(0xD210, 0x68);
|
||||
writeRegister(0xD211, 0x78);
|
||||
writeRegister(0xD212, 0x87);
|
||||
writeRegister(0xD213, 0x94);
|
||||
writeRegister(0xD214, 0x55);
|
||||
writeRegister(0xD215, 0xa0);
|
||||
writeRegister(0xD216, 0xac);
|
||||
writeRegister(0xD217, 0xb6);
|
||||
writeRegister(0xD218, 0xc1);
|
||||
writeRegister(0xD219, 0x55);
|
||||
writeRegister(0xD21A, 0xcb);
|
||||
writeRegister(0xD21B, 0xcd);
|
||||
writeRegister(0xD21C, 0xd6);
|
||||
writeRegister(0xD21D, 0xdf);
|
||||
writeRegister(0xD21E, 0x95);
|
||||
writeRegister(0xD21F, 0xe8);
|
||||
writeRegister(0xD220, 0xf1);
|
||||
writeRegister(0xD221, 0xfa);
|
||||
writeRegister(0xD222, 0x02);
|
||||
writeRegister(0xD223, 0xaa);
|
||||
writeRegister(0xD224, 0x0b);
|
||||
writeRegister(0xD225, 0x13);
|
||||
writeRegister(0xD226, 0x1d);
|
||||
writeRegister(0xD227, 0x26);
|
||||
writeRegister(0xD228, 0xaa);
|
||||
writeRegister(0xD229, 0x30);
|
||||
writeRegister(0xD22A, 0x3c);
|
||||
writeRegister(0xD22B, 0x4a);
|
||||
writeRegister(0xD22C, 0x63);
|
||||
writeRegister(0xD22D, 0xea);
|
||||
writeRegister(0xD22E, 0x79);
|
||||
writeRegister(0xD22F, 0xa6);
|
||||
writeRegister(0xD230, 0xd0);
|
||||
writeRegister(0xD231, 0x20);
|
||||
writeRegister(0xD232, 0x0f);
|
||||
writeRegister(0xD233, 0x8e);
|
||||
writeRegister(0xD234, 0xff);
|
||||
|
||||
//GAMMA SETING BLUE
|
||||
writeRegister(0xD300, 0x00);
|
||||
writeRegister(0xD301, 0x00);
|
||||
writeRegister(0xD302, 0x1b);
|
||||
writeRegister(0xD303, 0x44);
|
||||
writeRegister(0xD304, 0x62);
|
||||
writeRegister(0xD305, 0x00);
|
||||
writeRegister(0xD306, 0x7b);
|
||||
writeRegister(0xD307, 0xa1);
|
||||
writeRegister(0xD308, 0xc0);
|
||||
writeRegister(0xD309, 0xee);
|
||||
writeRegister(0xD30A, 0x55);
|
||||
writeRegister(0xD30B, 0x10);
|
||||
writeRegister(0xD30C, 0x2c);
|
||||
writeRegister(0xD30D, 0x43);
|
||||
writeRegister(0xD30E, 0x57);
|
||||
writeRegister(0xD30F, 0x55);
|
||||
writeRegister(0xD310, 0x68);
|
||||
writeRegister(0xD311, 0x78);
|
||||
writeRegister(0xD312, 0x87);
|
||||
writeRegister(0xD313, 0x94);
|
||||
writeRegister(0xD314, 0x55);
|
||||
writeRegister(0xD315, 0xa0);
|
||||
writeRegister(0xD316, 0xac);
|
||||
writeRegister(0xD317, 0xb6);
|
||||
writeRegister(0xD318, 0xc1);
|
||||
writeRegister(0xD319, 0x55);
|
||||
writeRegister(0xD31A, 0xcb);
|
||||
writeRegister(0xD31B, 0xcd);
|
||||
writeRegister(0xD31C, 0xd6);
|
||||
writeRegister(0xD31D, 0xdf);
|
||||
writeRegister(0xD31E, 0x95);
|
||||
writeRegister(0xD31F, 0xe8);
|
||||
writeRegister(0xD320, 0xf1);
|
||||
writeRegister(0xD321, 0xfa);
|
||||
writeRegister(0xD322, 0x02);
|
||||
writeRegister(0xD323, 0xaa);
|
||||
writeRegister(0xD324, 0x0b);
|
||||
writeRegister(0xD325, 0x13);
|
||||
writeRegister(0xD326, 0x1d);
|
||||
writeRegister(0xD327, 0x26);
|
||||
writeRegister(0xD328, 0xaa);
|
||||
writeRegister(0xD329, 0x30);
|
||||
writeRegister(0xD32A, 0x3c);
|
||||
writeRegister(0xD32B, 0x4A);
|
||||
writeRegister(0xD32C, 0x63);
|
||||
writeRegister(0xD32D, 0xea);
|
||||
writeRegister(0xD32E, 0x79);
|
||||
writeRegister(0xD32F, 0xa6);
|
||||
writeRegister(0xD330, 0xd0);
|
||||
writeRegister(0xD331, 0x20);
|
||||
writeRegister(0xD332, 0x0f);
|
||||
writeRegister(0xD333, 0x8e);
|
||||
writeRegister(0xD334, 0xff);
|
||||
|
||||
|
||||
//GAMMA SETING RED
|
||||
writeRegister(0xD400, 0x00);
|
||||
writeRegister(0xD401, 0x00);
|
||||
writeRegister(0xD402, 0x1b);
|
||||
writeRegister(0xD403, 0x44);
|
||||
writeRegister(0xD404, 0x62);
|
||||
writeRegister(0xD405, 0x00);
|
||||
writeRegister(0xD406, 0x7b);
|
||||
writeRegister(0xD407, 0xa1);
|
||||
writeRegister(0xD408, 0xc0);
|
||||
writeRegister(0xD409, 0xee);
|
||||
writeRegister(0xD40A, 0x55);
|
||||
writeRegister(0xD40B, 0x10);
|
||||
writeRegister(0xD40C, 0x2c);
|
||||
writeRegister(0xD40D, 0x43);
|
||||
writeRegister(0xD40E, 0x57);
|
||||
writeRegister(0xD40F, 0x55);
|
||||
writeRegister(0xD410, 0x68);
|
||||
writeRegister(0xD411, 0x78);
|
||||
writeRegister(0xD412, 0x87);
|
||||
writeRegister(0xD413, 0x94);
|
||||
writeRegister(0xD414, 0x55);
|
||||
writeRegister(0xD415, 0xa0);
|
||||
writeRegister(0xD416, 0xac);
|
||||
writeRegister(0xD417, 0xb6);
|
||||
writeRegister(0xD418, 0xc1);
|
||||
writeRegister(0xD419, 0x55);
|
||||
writeRegister(0xD41A, 0xcb);
|
||||
writeRegister(0xD41B, 0xcd);
|
||||
writeRegister(0xD41C, 0xd6);
|
||||
writeRegister(0xD41D, 0xdf);
|
||||
writeRegister(0xD41E, 0x95);
|
||||
writeRegister(0xD41F, 0xe8);
|
||||
writeRegister(0xD420, 0xf1);
|
||||
writeRegister(0xD421, 0xfa);
|
||||
writeRegister(0xD422, 0x02);
|
||||
writeRegister(0xD423, 0xaa);
|
||||
writeRegister(0xD424, 0x0b);
|
||||
writeRegister(0xD425, 0x13);
|
||||
writeRegister(0xD426, 0x1d);
|
||||
writeRegister(0xD427, 0x26);
|
||||
writeRegister(0xD428, 0xaa);
|
||||
writeRegister(0xD429, 0x30);
|
||||
writeRegister(0xD42A, 0x3c);
|
||||
writeRegister(0xD42B, 0x4A);
|
||||
writeRegister(0xD42C, 0x63);
|
||||
writeRegister(0xD42D, 0xea);
|
||||
writeRegister(0xD42E, 0x79);
|
||||
writeRegister(0xD42F, 0xa6);
|
||||
writeRegister(0xD430, 0xd0);
|
||||
writeRegister(0xD431, 0x20);
|
||||
writeRegister(0xD432, 0x0f);
|
||||
writeRegister(0xD433, 0x8e);
|
||||
writeRegister(0xD434, 0xff);
|
||||
writeRegister8(0xD400, 0x00);
|
||||
writeRegister8(0xD401, 0x00);
|
||||
writeRegister8(0xD402, 0x1b);
|
||||
writeRegister8(0xD403, 0x44);
|
||||
writeRegister8(0xD404, 0x62);
|
||||
writeRegister8(0xD405, 0x00);
|
||||
writeRegister8(0xD406, 0x7b);
|
||||
writeRegister8(0xD407, 0xa1);
|
||||
writeRegister8(0xD408, 0xc0);
|
||||
writeRegister8(0xD409, 0xee);
|
||||
writeRegister8(0xD40A, 0x55);
|
||||
writeRegister8(0xD40B, 0x10);
|
||||
writeRegister8(0xD40C, 0x2c);
|
||||
writeRegister8(0xD40D, 0x43);
|
||||
writeRegister8(0xD40E, 0x57);
|
||||
writeRegister8(0xD40F, 0x55);
|
||||
writeRegister8(0xD410, 0x68);
|
||||
writeRegister8(0xD411, 0x78);
|
||||
writeRegister8(0xD412, 0x87);
|
||||
writeRegister8(0xD413, 0x94);
|
||||
writeRegister8(0xD414, 0x55);
|
||||
writeRegister8(0xD415, 0xa0);
|
||||
writeRegister8(0xD416, 0xac);
|
||||
writeRegister8(0xD417, 0xb6);
|
||||
writeRegister8(0xD418, 0xc1);
|
||||
writeRegister8(0xD419, 0x55);
|
||||
writeRegister8(0xD41A, 0xcb);
|
||||
writeRegister8(0xD41B, 0xcd);
|
||||
writeRegister8(0xD41C, 0xd6);
|
||||
writeRegister8(0xD41D, 0xdf);
|
||||
writeRegister8(0xD41E, 0x95);
|
||||
writeRegister8(0xD41F, 0xe8);
|
||||
writeRegister8(0xD420, 0xf1);
|
||||
writeRegister8(0xD421, 0xfa);
|
||||
writeRegister8(0xD422, 0x02);
|
||||
writeRegister8(0xD423, 0xaa);
|
||||
writeRegister8(0xD424, 0x0b);
|
||||
writeRegister8(0xD425, 0x13);
|
||||
writeRegister8(0xD426, 0x1d);
|
||||
writeRegister8(0xD427, 0x26);
|
||||
writeRegister8(0xD428, 0xaa);
|
||||
writeRegister8(0xD429, 0x30);
|
||||
writeRegister8(0xD42A, 0x3c);
|
||||
writeRegister8(0xD42B, 0x4A);
|
||||
writeRegister8(0xD42C, 0x63);
|
||||
writeRegister8(0xD42D, 0xea);
|
||||
writeRegister8(0xD42E, 0x79);
|
||||
writeRegister8(0xD42F, 0xa6);
|
||||
writeRegister8(0xD430, 0xd0);
|
||||
writeRegister8(0xD431, 0x20);
|
||||
writeRegister8(0xD432, 0x0f);
|
||||
writeRegister8(0xD433, 0x8e);
|
||||
writeRegister8(0xD434, 0xff);
|
||||
|
||||
//GAMMA SETING GREEN
|
||||
writeRegister(0xD500, 0x00);
|
||||
writeRegister(0xD501, 0x00);
|
||||
writeRegister(0xD502, 0x1b);
|
||||
writeRegister(0xD503, 0x44);
|
||||
writeRegister(0xD504, 0x62);
|
||||
writeRegister(0xD505, 0x00);
|
||||
writeRegister(0xD506, 0x7b);
|
||||
writeRegister(0xD507, 0xa1);
|
||||
writeRegister(0xD508, 0xc0);
|
||||
writeRegister(0xD509, 0xee);
|
||||
writeRegister(0xD50A, 0x55);
|
||||
writeRegister(0xD50B, 0x10);
|
||||
writeRegister(0xD50C, 0x2c);
|
||||
writeRegister(0xD50D, 0x43);
|
||||
writeRegister(0xD50E, 0x57);
|
||||
writeRegister(0xD50F, 0x55);
|
||||
writeRegister(0xD510, 0x68);
|
||||
writeRegister(0xD511, 0x78);
|
||||
writeRegister(0xD512, 0x87);
|
||||
writeRegister(0xD513, 0x94);
|
||||
writeRegister(0xD514, 0x55);
|
||||
writeRegister(0xD515, 0xa0);
|
||||
writeRegister(0xD516, 0xac);
|
||||
writeRegister(0xD517, 0xb6);
|
||||
writeRegister(0xD518, 0xc1);
|
||||
writeRegister(0xD519, 0x55);
|
||||
writeRegister(0xD51A, 0xcb);
|
||||
writeRegister(0xD51B, 0xcd);
|
||||
writeRegister(0xD51C, 0xd6);
|
||||
writeRegister(0xD51D, 0xdf);
|
||||
writeRegister(0xD51E, 0x95);
|
||||
writeRegister(0xD51F, 0xe8);
|
||||
writeRegister(0xD520, 0xf1);
|
||||
writeRegister(0xD521, 0xfa);
|
||||
writeRegister(0xD522, 0x02);
|
||||
writeRegister(0xD523, 0xaa);
|
||||
writeRegister(0xD524, 0x0b);
|
||||
writeRegister(0xD525, 0x13);
|
||||
writeRegister(0xD526, 0x1d);
|
||||
writeRegister(0xD527, 0x26);
|
||||
writeRegister(0xD528, 0xaa);
|
||||
writeRegister(0xD529, 0x30);
|
||||
writeRegister(0xD52A, 0x3c);
|
||||
writeRegister(0xD52B, 0x4a);
|
||||
writeRegister(0xD52C, 0x63);
|
||||
writeRegister(0xD52D, 0xea);
|
||||
writeRegister(0xD52E, 0x79);
|
||||
writeRegister(0xD52F, 0xa6);
|
||||
writeRegister(0xD530, 0xd0);
|
||||
writeRegister(0xD531, 0x20);
|
||||
writeRegister(0xD532, 0x0f);
|
||||
writeRegister(0xD533, 0x8e);
|
||||
writeRegister(0xD534, 0xff);
|
||||
writeRegister8(0xD500, 0x00);
|
||||
writeRegister8(0xD501, 0x00);
|
||||
writeRegister8(0xD502, 0x1b);
|
||||
writeRegister8(0xD503, 0x44);
|
||||
writeRegister8(0xD504, 0x62);
|
||||
writeRegister8(0xD505, 0x00);
|
||||
writeRegister8(0xD506, 0x7b);
|
||||
writeRegister8(0xD507, 0xa1);
|
||||
writeRegister8(0xD508, 0xc0);
|
||||
writeRegister8(0xD509, 0xee);
|
||||
writeRegister8(0xD50A, 0x55);
|
||||
writeRegister8(0xD50B, 0x10);
|
||||
writeRegister8(0xD50C, 0x2c);
|
||||
writeRegister8(0xD50D, 0x43);
|
||||
writeRegister8(0xD50E, 0x57);
|
||||
writeRegister8(0xD50F, 0x55);
|
||||
writeRegister8(0xD510, 0x68);
|
||||
writeRegister8(0xD511, 0x78);
|
||||
writeRegister8(0xD512, 0x87);
|
||||
writeRegister8(0xD513, 0x94);
|
||||
writeRegister8(0xD514, 0x55);
|
||||
writeRegister8(0xD515, 0xa0);
|
||||
writeRegister8(0xD516, 0xac);
|
||||
writeRegister8(0xD517, 0xb6);
|
||||
writeRegister8(0xD518, 0xc1);
|
||||
writeRegister8(0xD519, 0x55);
|
||||
writeRegister8(0xD51A, 0xcb);
|
||||
writeRegister8(0xD51B, 0xcd);
|
||||
writeRegister8(0xD51C, 0xd6);
|
||||
writeRegister8(0xD51D, 0xdf);
|
||||
writeRegister8(0xD51E, 0x95);
|
||||
writeRegister8(0xD51F, 0xe8);
|
||||
writeRegister8(0xD520, 0xf1);
|
||||
writeRegister8(0xD521, 0xfa);
|
||||
writeRegister8(0xD522, 0x02);
|
||||
writeRegister8(0xD523, 0xaa);
|
||||
writeRegister8(0xD524, 0x0b);
|
||||
writeRegister8(0xD525, 0x13);
|
||||
writeRegister8(0xD526, 0x1d);
|
||||
writeRegister8(0xD527, 0x26);
|
||||
writeRegister8(0xD528, 0xaa);
|
||||
writeRegister8(0xD529, 0x30);
|
||||
writeRegister8(0xD52A, 0x3c);
|
||||
writeRegister8(0xD52B, 0x4a);
|
||||
writeRegister8(0xD52C, 0x63);
|
||||
writeRegister8(0xD52D, 0xea);
|
||||
writeRegister8(0xD52E, 0x79);
|
||||
writeRegister8(0xD52F, 0xa6);
|
||||
writeRegister8(0xD530, 0xd0);
|
||||
writeRegister8(0xD531, 0x20);
|
||||
writeRegister8(0xD532, 0x0f);
|
||||
writeRegister8(0xD533, 0x8e);
|
||||
writeRegister8(0xD534, 0xff);
|
||||
|
||||
//GAMMA SETING BLUE
|
||||
writeRegister(0xD600, 0x00);
|
||||
writeRegister(0xD601, 0x00);
|
||||
writeRegister(0xD602, 0x1b);
|
||||
writeRegister(0xD603, 0x44);
|
||||
writeRegister(0xD604, 0x62);
|
||||
writeRegister(0xD605, 0x00);
|
||||
writeRegister(0xD606, 0x7b);
|
||||
writeRegister(0xD607, 0xa1);
|
||||
writeRegister(0xD608, 0xc0);
|
||||
writeRegister(0xD609, 0xee);
|
||||
writeRegister(0xD60A, 0x55);
|
||||
writeRegister(0xD60B, 0x10);
|
||||
writeRegister(0xD60C, 0x2c);
|
||||
writeRegister(0xD60D, 0x43);
|
||||
writeRegister(0xD60E, 0x57);
|
||||
writeRegister(0xD60F, 0x55);
|
||||
writeRegister(0xD610, 0x68);
|
||||
writeRegister(0xD611, 0x78);
|
||||
writeRegister(0xD612, 0x87);
|
||||
writeRegister(0xD613, 0x94);
|
||||
writeRegister(0xD614, 0x55);
|
||||
writeRegister(0xD615, 0xa0);
|
||||
writeRegister(0xD616, 0xac);
|
||||
writeRegister(0xD617, 0xb6);
|
||||
writeRegister(0xD618, 0xc1);
|
||||
writeRegister(0xD619, 0x55);
|
||||
writeRegister(0xD61A, 0xcb);
|
||||
writeRegister(0xD61B, 0xcd);
|
||||
writeRegister(0xD61C, 0xd6);
|
||||
writeRegister(0xD61D, 0xdf);
|
||||
writeRegister(0xD61E, 0x95);
|
||||
writeRegister(0xD61F, 0xe8);
|
||||
writeRegister(0xD620, 0xf1);
|
||||
writeRegister(0xD621, 0xfa);
|
||||
writeRegister(0xD622, 0x02);
|
||||
writeRegister(0xD623, 0xaa);
|
||||
writeRegister(0xD624, 0x0b);
|
||||
writeRegister(0xD625, 0x13);
|
||||
writeRegister(0xD626, 0x1d);
|
||||
writeRegister(0xD627, 0x26);
|
||||
writeRegister(0xD628, 0xaa);
|
||||
writeRegister(0xD629, 0x30);
|
||||
writeRegister(0xD62A, 0x3c);
|
||||
writeRegister(0xD62B, 0x4A);
|
||||
writeRegister(0xD62C, 0x63);
|
||||
writeRegister(0xD62D, 0xea);
|
||||
writeRegister(0xD62E, 0x79);
|
||||
writeRegister(0xD62F, 0xa6);
|
||||
writeRegister(0xD630, 0xd0);
|
||||
writeRegister(0xD631, 0x20);
|
||||
writeRegister(0xD632, 0x0f);
|
||||
writeRegister(0xD633, 0x8e);
|
||||
writeRegister(0xD634, 0xff);
|
||||
writeRegister8(0xD600, 0x00);
|
||||
writeRegister8(0xD601, 0x00);
|
||||
writeRegister8(0xD602, 0x1b);
|
||||
writeRegister8(0xD603, 0x44);
|
||||
writeRegister8(0xD604, 0x62);
|
||||
writeRegister8(0xD605, 0x00);
|
||||
writeRegister8(0xD606, 0x7b);
|
||||
writeRegister8(0xD607, 0xa1);
|
||||
writeRegister8(0xD608, 0xc0);
|
||||
writeRegister8(0xD609, 0xee);
|
||||
writeRegister8(0xD60A, 0x55);
|
||||
writeRegister8(0xD60B, 0x10);
|
||||
writeRegister8(0xD60C, 0x2c);
|
||||
writeRegister8(0xD60D, 0x43);
|
||||
writeRegister8(0xD60E, 0x57);
|
||||
writeRegister8(0xD60F, 0x55);
|
||||
writeRegister8(0xD610, 0x68);
|
||||
writeRegister8(0xD611, 0x78);
|
||||
writeRegister8(0xD612, 0x87);
|
||||
writeRegister8(0xD613, 0x94);
|
||||
writeRegister8(0xD614, 0x55);
|
||||
writeRegister8(0xD615, 0xa0);
|
||||
writeRegister8(0xD616, 0xac);
|
||||
writeRegister8(0xD617, 0xb6);
|
||||
writeRegister8(0xD618, 0xc1);
|
||||
writeRegister8(0xD619, 0x55);
|
||||
writeRegister8(0xD61A, 0xcb);
|
||||
writeRegister8(0xD61B, 0xcd);
|
||||
writeRegister8(0xD61C, 0xd6);
|
||||
writeRegister8(0xD61D, 0xdf);
|
||||
writeRegister8(0xD61E, 0x95);
|
||||
writeRegister8(0xD61F, 0xe8);
|
||||
writeRegister8(0xD620, 0xf1);
|
||||
writeRegister8(0xD621, 0xfa);
|
||||
writeRegister8(0xD622, 0x02);
|
||||
writeRegister8(0xD623, 0xaa);
|
||||
writeRegister8(0xD624, 0x0b);
|
||||
writeRegister8(0xD625, 0x13);
|
||||
writeRegister8(0xD626, 0x1d);
|
||||
writeRegister8(0xD627, 0x26);
|
||||
writeRegister8(0xD628, 0xaa);
|
||||
writeRegister8(0xD629, 0x30);
|
||||
writeRegister8(0xD62A, 0x3c);
|
||||
writeRegister8(0xD62B, 0x4A);
|
||||
writeRegister8(0xD62C, 0x63);
|
||||
writeRegister8(0xD62D, 0xea);
|
||||
writeRegister8(0xD62E, 0x79);
|
||||
writeRegister8(0xD62F, 0xa6);
|
||||
writeRegister8(0xD630, 0xd0);
|
||||
writeRegister8(0xD631, 0x20);
|
||||
writeRegister8(0xD632, 0x0f);
|
||||
writeRegister8(0xD633, 0x8e);
|
||||
writeRegister8(0xD634, 0xff);
|
||||
|
||||
//AVDD VOLTAGE SETTING
|
||||
writeRegister(0xB000, 0x05);
|
||||
writeRegister(0xB001, 0x05);
|
||||
writeRegister(0xB002, 0x05);
|
||||
writeRegister8(0xB000, 0x05);
|
||||
writeRegister8(0xB001, 0x05);
|
||||
writeRegister8(0xB002, 0x05);
|
||||
//AVEE VOLTAGE SETTING
|
||||
writeRegister(0xB100, 0x05);
|
||||
writeRegister(0xB101, 0x05);
|
||||
writeRegister(0xB102, 0x05);
|
||||
writeRegister8(0xB100, 0x05);
|
||||
writeRegister8(0xB101, 0x05);
|
||||
writeRegister8(0xB102, 0x05);
|
||||
|
||||
//AVDD Boosting
|
||||
writeRegister(0xB600, 0x34);
|
||||
writeRegister(0xB601, 0x34);
|
||||
writeRegister(0xB603, 0x34);
|
||||
writeRegister8(0xB600, 0x34);
|
||||
writeRegister8(0xB601, 0x34);
|
||||
writeRegister8(0xB603, 0x34);
|
||||
//AVEE Boosting
|
||||
writeRegister(0xB700, 0x24);
|
||||
writeRegister(0xB701, 0x24);
|
||||
writeRegister(0xB702, 0x24);
|
||||
writeRegister8(0xB700, 0x24);
|
||||
writeRegister8(0xB701, 0x24);
|
||||
writeRegister8(0xB702, 0x24);
|
||||
//VCL Boosting
|
||||
writeRegister(0xB800, 0x24);
|
||||
writeRegister(0xB801, 0x24);
|
||||
writeRegister(0xB802, 0x24);
|
||||
writeRegister8(0xB800, 0x24);
|
||||
writeRegister8(0xB801, 0x24);
|
||||
writeRegister8(0xB802, 0x24);
|
||||
//VGLX VOLTAGE SETTING
|
||||
writeRegister(0xBA00, 0x14);
|
||||
writeRegister(0xBA01, 0x14);
|
||||
writeRegister(0xBA02, 0x14);
|
||||
writeRegister8(0xBA00, 0x14);
|
||||
writeRegister8(0xBA01, 0x14);
|
||||
writeRegister8(0xBA02, 0x14);
|
||||
//VCL Boosting
|
||||
writeRegister(0xB900, 0x24);
|
||||
writeRegister(0xB901, 0x24);
|
||||
writeRegister(0xB902, 0x24);
|
||||
writeRegister8(0xB900, 0x24);
|
||||
writeRegister8(0xB901, 0x24);
|
||||
writeRegister8(0xB902, 0x24);
|
||||
//Gamma Voltage
|
||||
writeRegister(0xBc00, 0x00);
|
||||
writeRegister(0xBc01, 0xa0);//vgmp=5.0
|
||||
writeRegister(0xBc02, 0x00);
|
||||
writeRegister(0xBd00, 0x00);
|
||||
writeRegister(0xBd01, 0xa0);//vgmn=5.0
|
||||
writeRegister(0xBd02, 0x00);
|
||||
writeRegister8(0xBc00, 0x00);
|
||||
writeRegister8(0xBc01, 0xa0);//vgmp=5.0
|
||||
writeRegister8(0xBc02, 0x00);
|
||||
writeRegister8(0xBd00, 0x00);
|
||||
writeRegister8(0xBd01, 0xa0);//vgmn=5.0
|
||||
writeRegister8(0xBd02, 0x00);
|
||||
//VCOM Setting
|
||||
writeRegister(0xBe01, 0x3d);//3
|
||||
//ENABLE PAGE 0
|
||||
writeRegister(0xF000, 0x55);
|
||||
writeRegister(0xF001, 0xAA);
|
||||
writeRegister(0xF002, 0x52);
|
||||
writeRegister(0xF003, 0x08);
|
||||
writeRegister(0xF004, 0x00);
|
||||
//Vivid Color Function Control
|
||||
writeRegister(0xB400, 0x10);
|
||||
//Z-INVERSION
|
||||
writeRegister(0xBC00, 0x05);
|
||||
writeRegister(0xBC01, 0x05);
|
||||
writeRegister(0xBC02, 0x05);
|
||||
writeRegister8(0xBe01, 0x3d);//3
|
||||
|
||||
//ENABLE PAGE 0
|
||||
writeRegister8(0xF000, 0x55);
|
||||
writeRegister8(0xF001, 0xAA);
|
||||
writeRegister8(0xF002, 0x52);
|
||||
writeRegister8(0xF003, 0x08);
|
||||
writeRegister8(0xF004, 0x00);
|
||||
//Vivid Color Function Control
|
||||
writeRegister8(0xB400, 0x10);
|
||||
//Z-INVERSION
|
||||
writeRegister8(0xBC00, 0x05);
|
||||
writeRegister8(0xBC01, 0x05);
|
||||
writeRegister8(0xBC02, 0x05);
|
||||
//*************** add on 20111021**********************//
|
||||
writeRegister(0xB700, 0x22);//GATE EQ CONTROL
|
||||
writeRegister(0xB701, 0x22);//GATE EQ CONTROL
|
||||
writeRegister(0xC80B, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister(0xC80C, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister(0xC80F, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister(0xC810, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister8(0xB700, 0x22);//GATE EQ CONTROL
|
||||
writeRegister8(0xB701, 0x22);//GATE EQ CONTROL
|
||||
writeRegister8(0xC80B, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister8(0xC80C, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister8(0xC80F, 0x2A);//DISPLAY TIMING CONTROL
|
||||
writeRegister8(0xC810, 0x2A);//DISPLAY TIMING CONTROL
|
||||
//*************** add on 20111021**********************//
|
||||
//PWM_ENH_OE =1
|
||||
writeRegister(0xd000, 0x01);
|
||||
writeRegister8(0xd000, 0x01);
|
||||
//DM_SEL =1
|
||||
writeRegister(0xb300, 0x10);
|
||||
writeRegister8(0xb300, 0x10);
|
||||
//VBPDA=07h
|
||||
writeRegister(0xBd02, 0x07);
|
||||
writeRegister8(0xBd02, 0x07);
|
||||
//VBPDb=07h
|
||||
writeRegister(0xBe02, 0x07);
|
||||
writeRegister8(0xBe02, 0x07);
|
||||
//VBPDc=07h
|
||||
writeRegister(0xBf02, 0x07);
|
||||
writeRegister8(0xBf02, 0x07);
|
||||
|
||||
//ENABLE PAGE 2
|
||||
writeRegister(0xF000, 0x55);
|
||||
writeRegister(0xF001, 0xAA);
|
||||
writeRegister(0xF002, 0x52);
|
||||
writeRegister(0xF003, 0x08);
|
||||
writeRegister(0xF004, 0x02);
|
||||
writeRegister8(0xF000, 0x55);
|
||||
writeRegister8(0xF001, 0xAA);
|
||||
writeRegister8(0xF002, 0x52);
|
||||
writeRegister8(0xF003, 0x08);
|
||||
writeRegister8(0xF004, 0x02);
|
||||
//SDREG0 =0
|
||||
writeRegister(0xc301, 0xa9);
|
||||
writeRegister8(0xc301, 0xa9);
|
||||
//DS=14
|
||||
writeRegister(0xfe01, 0x94);
|
||||
writeRegister8(0xfe01, 0x94);
|
||||
//OSC =60h
|
||||
writeRegister(0xf600, 0x60);
|
||||
writeRegister8(0xf600, 0x60);
|
||||
//TE ON
|
||||
writeRegister(0x3500, 0x00);
|
||||
writeRegister8(0x3500, 0x00);
|
||||
writeRegister8(0xFFFF, 0xFF);
|
||||
|
||||
//SLEEP OUT
|
||||
writecommand(0x1100);
|
||||
delay(100);
|
||||
@ -425,5 +265,5 @@ delay(100);
|
||||
writecommand(0x2900);
|
||||
delay(100);
|
||||
|
||||
writeRegister(0x3A00, 0x55);
|
||||
writeRegister(0x3600, 0xA3);
|
||||
writeRegister16(0x3A00, 0x55);
|
||||
writeRegister8(0x3600, TFT_MAD_COLOR_ORDER);
|
||||
|
@ -2,28 +2,28 @@
|
||||
// This is the command sequence that rotates the RM68120 driver coordinate frame
|
||||
|
||||
rotation = m % 4; // Limit the range of values to 0-3
|
||||
uint8_t reg = 0;
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
writedata(TFT_MAD_COLOR_ORDER);
|
||||
reg = TFT_MAD_COLOR_ORDER;
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
break;
|
||||
case 1:
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER);
|
||||
reg = TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER;
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
break;
|
||||
case 2:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
reg = TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER;
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
break;
|
||||
case 3:
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
reg = TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER;
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
break;
|
||||
|
||||
}
|
||||
writeRegister16(TFT_MADCTL, reg);
|
@ -141,8 +141,14 @@
|
||||
writecommand(ST7789_MADCTL);
|
||||
writedata(TFT_MAD_COLOR_ORDER);
|
||||
|
||||
writecommand(0x3A);
|
||||
writedata(0x05);
|
||||
// writecommand(ST7789_RAMCTRL);
|
||||
// writedata(0x00);
|
||||
// writedata(0xE0); // 5 to 6 bit conversion: r0 = r5, b0 = b5
|
||||
|
||||
writecommand(ST7789_COLMOD);
|
||||
writedata(0x55);
|
||||
delay(10);
|
||||
|
||||
//--------------------------------ST7789V Frame rate setting----------------------------------//
|
||||
writecommand(ST7789_PORCTRL);
|
||||
writedata(0x0b);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* @author Ricard Bitriá Ribes (https://github.com/dracir9)
|
||||
* Created Date: 22-01-2022
|
||||
* -----
|
||||
* Last Modified: 14-04-2022
|
||||
* Last Modified: 25-02-2023
|
||||
* Modified By: Ricard Bitriá Ribes
|
||||
* -----
|
||||
* @copyright (c) 2022 Ricard Bitriá Ribes
|
||||
@ -161,6 +161,8 @@
|
||||
// 8 BIT PARALLEL BUS
|
||||
#ifdef CONFIG_TFT_PARALLEL_8_BIT
|
||||
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
#if CONFIG_TFT_D0 == -1
|
||||
#error "Invalid Data 0 pin. Check TFT_eSPI configuration"
|
||||
#else
|
||||
@ -305,4 +307,12 @@
|
||||
#define SPI_TOUCH_FREQUENCY CONFIG_SPI_TOUCH_FREQUENCY
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** Section 6: Others
|
||||
***************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_WARNINGS
|
||||
#define DISABLE_ALL_LIBRARY_WARNINGS
|
||||
#endif
|
||||
|
||||
#endif // TFT_CONFIG_H
|
||||
|
@ -533,25 +533,33 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
|
||||
void TFT_eSPI::initBus(void) {
|
||||
|
||||
#ifdef TFT_CS
|
||||
pinMode(TFT_CS, OUTPUT);
|
||||
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
|
||||
if (TFT_CS >= 0) {
|
||||
pinMode(TFT_CS, OUTPUT);
|
||||
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Configure chip select for touchscreen controller if present
|
||||
#ifdef TOUCH_CS
|
||||
pinMode(TOUCH_CS, OUTPUT);
|
||||
digitalWrite(TOUCH_CS, HIGH); // Chip select high (inactive)
|
||||
if (TOUCH_CS >= 0) {
|
||||
pinMode(TOUCH_CS, OUTPUT);
|
||||
digitalWrite(TOUCH_CS, HIGH); // Chip select high (inactive)
|
||||
}
|
||||
#endif
|
||||
|
||||
// In parallel mode and with the RP2040 processor, the TFT_WR line is handled in the PIO
|
||||
#if defined (TFT_WR) && !defined (ARDUINO_ARCH_RP2040) && !defined (ARDUINO_ARCH_MBED)
|
||||
pinMode(TFT_WR, OUTPUT);
|
||||
digitalWrite(TFT_WR, HIGH); // Set write strobe high (inactive)
|
||||
if (TFT_WR >= 0) {
|
||||
pinMode(TFT_WR, OUTPUT);
|
||||
digitalWrite(TFT_WR, HIGH); // Set write strobe high (inactive)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TFT_DC
|
||||
pinMode(TFT_DC, OUTPUT);
|
||||
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
|
||||
if (TFT_DC >= 0) {
|
||||
pinMode(TFT_DC, OUTPUT);
|
||||
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TFT_RST
|
||||
@ -564,8 +572,10 @@ void TFT_eSPI::initBus(void) {
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
|
||||
// Make sure read is high before we set the bus to output
|
||||
pinMode(TFT_RD, OUTPUT);
|
||||
digitalWrite(TFT_RD, HIGH);
|
||||
if (TFT_RD >= 0) {
|
||||
pinMode(TFT_RD, OUTPUT);
|
||||
digitalWrite(TFT_RD, HIGH);
|
||||
}
|
||||
|
||||
#if !defined (ARDUINO_ARCH_RP2040) && !defined (ARDUINO_ARCH_MBED)// PIO manages pins
|
||||
// Set TFT data bus lines to output
|
||||
@ -649,8 +659,10 @@ void TFT_eSPI::init(uint8_t tc)
|
||||
|
||||
#if defined (TFT_CS) && !defined(RP2040_PIO_INTERFACE)
|
||||
// Set to output once again in case MISO is used for CS
|
||||
pinMode(TFT_CS, OUTPUT);
|
||||
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
|
||||
if (TFT_CS >= 0) {
|
||||
pinMode(TFT_CS, OUTPUT);
|
||||
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
|
||||
}
|
||||
#elif defined (ARDUINO_ARCH_ESP8266) && !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_SPI)
|
||||
spi.setHwCs(1); // Use hardware SS toggling
|
||||
#endif
|
||||
@ -658,8 +670,10 @@ void TFT_eSPI::init(uint8_t tc)
|
||||
|
||||
// Set to output once again in case MISO is used for DC
|
||||
#if defined (TFT_DC) && !defined(RP2040_PIO_INTERFACE)
|
||||
if (TFT_DC >= 0) {
|
||||
pinMode(TFT_DC, OUTPUT);
|
||||
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
|
||||
}
|
||||
#endif
|
||||
|
||||
_booted = false;
|
||||
@ -670,7 +684,9 @@ void TFT_eSPI::init(uint8_t tc)
|
||||
#ifdef TFT_RST
|
||||
#if !defined(RP2040_PIO_INTERFACE)
|
||||
// Set to output once again in case MISO is used for TFT_RST
|
||||
pinMode(TFT_RST, OUTPUT);
|
||||
if (TFT_RST >= 0) {
|
||||
pinMode(TFT_RST, OUTPUT);
|
||||
}
|
||||
#endif
|
||||
if (TFT_RST >= 0) {
|
||||
writecommand(0x00); // Put SPI bus in known state for TFT with CS tied low
|
||||
@ -768,13 +784,17 @@ void TFT_eSPI::init(uint8_t tc)
|
||||
setRotation(rotation);
|
||||
|
||||
#if defined (TFT_BL) && defined (TFT_BACKLIGHT_ON)
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
||||
if (TFT_BL >= 0) {
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
||||
}
|
||||
#else
|
||||
#if defined (TFT_BL) && defined (M5STACK)
|
||||
// Turn on the back-light LED
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
if (TFT_BL >= 0) {
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -968,7 +988,6 @@ void TFT_eSPI::writecommand(uint8_t c)
|
||||
DC_D;
|
||||
|
||||
end_tft_write();
|
||||
|
||||
}
|
||||
#else
|
||||
void TFT_eSPI::writecommand(uint16_t c)
|
||||
@ -984,7 +1003,7 @@ void TFT_eSPI::writecommand(uint16_t c)
|
||||
end_tft_write();
|
||||
|
||||
}
|
||||
void TFT_eSPI::writeRegister(uint16_t c, uint8_t d)
|
||||
void TFT_eSPI::writeRegister8(uint16_t c, uint8_t d)
|
||||
{
|
||||
begin_tft_write();
|
||||
|
||||
@ -999,6 +1018,22 @@ void TFT_eSPI::writeRegister(uint16_t c, uint8_t d)
|
||||
end_tft_write();
|
||||
|
||||
}
|
||||
void TFT_eSPI::writeRegister16(uint16_t c, uint16_t d)
|
||||
{
|
||||
begin_tft_write();
|
||||
|
||||
DC_C;
|
||||
|
||||
tft_Write_16(c);
|
||||
|
||||
DC_D;
|
||||
|
||||
tft_Write_16(d);
|
||||
|
||||
end_tft_write();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
@ -1147,7 +1182,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
||||
// Set masked pins D0- D7 to output
|
||||
busDir(GPIO_DIR_MASK, OUTPUT);
|
||||
|
||||
#ifdef ILI9486_DRIVER
|
||||
#if defined (ILI9486_DRIVER) || defined (ST7796_DRIVER)
|
||||
return bgr;
|
||||
#else
|
||||
// Swap Red and Blue (could check MADCTL setting to see if this is needed)
|
||||
@ -1181,6 +1216,13 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
||||
#if defined (ST7796_DRIVER)
|
||||
// Read the 2 bytes
|
||||
color = ((tft_Read_8()) << 8) | (tft_Read_8());
|
||||
#elif defined (ST7735_DRIVER)
|
||||
// Read the 3 RGB bytes, colour is in LS 6 bits of the top 7 bits of each byte
|
||||
// as the TFT stores colours as 18 bits
|
||||
uint8_t r = tft_Read_8()<<1;
|
||||
uint8_t g = tft_Read_8()<<1;
|
||||
uint8_t b = tft_Read_8()<<1;
|
||||
color = color565(r, g, b);
|
||||
#else
|
||||
// Read the 3 RGB bytes, colour is actually only in the top 6 bits of each byte
|
||||
// as the TFT stores colours as 18 bits
|
||||
@ -1287,7 +1329,7 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
int32_t lw = dw;
|
||||
uint16_t* line = data;
|
||||
while (lw--) {
|
||||
#ifdef ILI9486_DRIVER
|
||||
#if defined (ILI9486_DRIVER) || defined (ST7796_DRIVER)
|
||||
// Read the RGB 16 bit colour
|
||||
*line++ = readByte() | (readByte() << 8);
|
||||
#else
|
||||
@ -1341,6 +1383,13 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
#if defined (ST7796_DRIVER)
|
||||
// Read the 2 bytes
|
||||
color = ((tft_Read_8()) << 8) | (tft_Read_8());
|
||||
#elif defined (ST7735_DRIVER)
|
||||
// Read the 3 RGB bytes, colour is in LS 6 bits of the top 7 bits of each byte
|
||||
// as the TFT stores colours as 18 bits
|
||||
uint8_t r = tft_Read_8()<<1;
|
||||
uint8_t g = tft_Read_8()<<1;
|
||||
uint8_t b = tft_Read_8()<<1;
|
||||
color = color565(r, g, b);
|
||||
#else
|
||||
// Read the 3 RGB bytes, colour is actually only in the top 6 bits of each byte
|
||||
// as the TFT stores colours as 18 bits
|
||||
@ -2040,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 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)
|
||||
@ -2109,7 +2158,6 @@ void TFT_eSPI::pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint1
|
||||
xp += clearCount;
|
||||
clearCount = 0;
|
||||
pushImage(x + xp, y, setCount, 1, iptr + xp); // pushImage handles clipping
|
||||
//pushImageDMA(x + xp, y, setCount, 1, iptr + xp);
|
||||
xp += setCount;
|
||||
}
|
||||
} while (setCount || mptr < eptr);
|
||||
@ -3132,14 +3180,15 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
|
||||
{
|
||||
if (_vpOoB) return;
|
||||
|
||||
if (c < 32) return;
|
||||
#ifdef LOAD_GLCD
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
#ifdef LOAD_GFXFF
|
||||
if(!gfxFont) { // 'Classic' built-in font
|
||||
if(!gfxFont) { // 'Classic' built-in GLCD font
|
||||
#endif
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
|
||||
if (c > 255) return;
|
||||
|
||||
int32_t xd = x + _xDatum;
|
||||
int32_t yd = y + _yDatum;
|
||||
|
||||
@ -3403,6 +3452,18 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
#endif
|
||||
DC_D;
|
||||
#elif defined (RM68120_DRIVER)
|
||||
DC_C; tft_Write_16(TFT_CASET+0); DC_D; tft_Write_16(x0 >> 8);
|
||||
DC_C; tft_Write_16(TFT_CASET+1); DC_D; tft_Write_16(x0 & 0xFF);
|
||||
DC_C; tft_Write_16(TFT_CASET+2); DC_D; tft_Write_16(x1 >> 8);
|
||||
DC_C; tft_Write_16(TFT_CASET+3); DC_D; tft_Write_16(x1 & 0xFF);
|
||||
DC_C; tft_Write_16(TFT_PASET+0); DC_D; tft_Write_16(y0 >> 8);
|
||||
DC_C; tft_Write_16(TFT_PASET+1); DC_D; tft_Write_16(y0 & 0xFF);
|
||||
DC_C; tft_Write_16(TFT_PASET+2); DC_D; tft_Write_16(y1 >> 8);
|
||||
DC_C; tft_Write_16(TFT_PASET+3); DC_D; tft_Write_16(y1 & 0xFF);
|
||||
|
||||
DC_C; tft_Write_16(TFT_RAMWR);
|
||||
DC_D;
|
||||
#else
|
||||
// This is for the RP2040 and PIO interface (SPI or parallel)
|
||||
WAIT_FOR_STALL;
|
||||
@ -3630,6 +3691,24 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
#endif
|
||||
#endif
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
#elif defined (RM68120_DRIVER)
|
||||
if (addr_col != x) {
|
||||
DC_C; tft_Write_16(TFT_CASET+0); DC_D; tft_Write_16(x >> 8);
|
||||
DC_C; tft_Write_16(TFT_CASET+1); DC_D; tft_Write_16(x & 0xFF);
|
||||
DC_C; tft_Write_16(TFT_CASET+2); DC_D; tft_Write_16(x >> 8);
|
||||
DC_C; tft_Write_16(TFT_CASET+3); DC_D; tft_Write_16(x & 0xFF);
|
||||
addr_col = x;
|
||||
}
|
||||
if (addr_row != y) {
|
||||
DC_C; tft_Write_16(TFT_PASET+0); DC_D; tft_Write_16(y >> 8);
|
||||
DC_C; tft_Write_16(TFT_PASET+1); DC_D; tft_Write_16(y & 0xFF);
|
||||
DC_C; tft_Write_16(TFT_PASET+2); DC_D; tft_Write_16(y >> 8);
|
||||
DC_C; tft_Write_16(TFT_PASET+3); DC_D; tft_Write_16(y & 0xFF);
|
||||
addr_row = y;
|
||||
}
|
||||
DC_C; tft_Write_16(TFT_RAMWR); DC_D;
|
||||
|
||||
TX_FIFO = color;
|
||||
#else
|
||||
// This is for the RP2040 and PIO interface (SPI or parallel)
|
||||
WAIT_FOR_STALL;
|
||||
@ -3640,7 +3719,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
TX_FIFO = (y<<16) | y;
|
||||
TX_FIFO = TFT_RAMWR;
|
||||
//DC set high by PIO
|
||||
#if defined (SPI_18BIT_DRIVER)
|
||||
#if defined (SPI_18BIT_DRIVER) || (defined (SSD1963_DRIVER) && defined (TFT_PARALLEL_8_BIT))
|
||||
TX_FIFO = ((color & 0xF800)<<8) | ((color & 0x07E0)<<5) | ((color & 0x001F)<<3);
|
||||
#else
|
||||
TX_FIFO = color;
|
||||
@ -3885,7 +3964,7 @@ uint16_t TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color, uint8_t alpha
|
||||
** Function name: drawSmoothArc
|
||||
** Description: Draw a smooth arc clockwise from 6 o'clock
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_t startAngle, int32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool roundEnds)
|
||||
void TFT_eSPI::drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, uint32_t startAngle, uint32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool roundEnds)
|
||||
// Centre at x,y
|
||||
// r = arc outer radius, ir = arc inner radius. Inclusive so arc thickness = r - ir + 1
|
||||
// Angles in range 0-360
|
||||
@ -3895,7 +3974,7 @@ void TFT_eSPI::drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_
|
||||
{
|
||||
inTransaction = true;
|
||||
|
||||
if (endAngle != startAngle)
|
||||
if (endAngle != startAngle && (startAngle != 0 || endAngle != 360))
|
||||
{
|
||||
float sx = -sinf(startAngle * deg2rad);
|
||||
float sy = +cosf(startAngle * deg2rad);
|
||||
@ -3927,17 +4006,9 @@ void TFT_eSPI::drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_
|
||||
drawWedgeLine(asx, asy, aex, aey, 0.3, 0.3, fg_color, bg_color);
|
||||
}
|
||||
|
||||
if (endAngle > startAngle)
|
||||
{
|
||||
// Draw arc in single sweep
|
||||
drawArc(x, y, r, ir, startAngle, endAngle, fg_color, bg_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Arc sweeps through 6 o'clock so draw in two parts
|
||||
drawArc(x, y, r, ir, startAngle, 360, fg_color, bg_color);
|
||||
drawArc(x, y, r, ir, 0, endAngle, fg_color, bg_color);
|
||||
}
|
||||
// Draw arc
|
||||
drawArc(x, y, r, ir, startAngle, endAngle, fg_color, bg_color);
|
||||
|
||||
}
|
||||
else // Draw full 360
|
||||
{
|
||||
@ -3949,12 +4020,12 @@ void TFT_eSPI::drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: sqrt_fraction
|
||||
** Function name: sqrt_fraction (private function)
|
||||
** Description: Smooth graphics support function for alpha derivation
|
||||
***************************************************************************************/
|
||||
// Compute the fixed point square root of an integer and
|
||||
// return the 8 MS bits of fractional part.
|
||||
// Quicker than sqrt() for processors that do not have and FPU (e.g. RP2040)
|
||||
// Quicker than sqrt() for processors that do not have an FPU (e.g. RP2040)
|
||||
inline uint8_t TFT_eSPI::sqrt_fraction(uint32_t num) {
|
||||
if (num > (0x40000000)) return 0;
|
||||
uint32_t bsh = 0x00004000;
|
||||
@ -3983,45 +4054,46 @@ inline uint8_t TFT_eSPI::sqrt_fraction(uint32_t num) {
|
||||
***************************************************************************************/
|
||||
// Centre at x,y
|
||||
// r = arc outer radius, ir = arc inner radius. Inclusive, so arc thickness = r-ir+1
|
||||
// Angles MUST be in range 0-360, end angle MUST be greater than start angle
|
||||
// Angles MUST be in range 0-360
|
||||
// Arc foreground fg_color anti-aliased with background colour along sides
|
||||
// smooth is optional, default is true, smooth=false means no antialiasing
|
||||
// Note: Arc ends are not anti-aliased (use drawSmoothArc instead for that)
|
||||
void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
int32_t startAngle, int32_t endAngle,
|
||||
uint32_t startAngle, uint32_t endAngle,
|
||||
uint32_t fg_color, uint32_t bg_color,
|
||||
bool smooth)
|
||||
{
|
||||
if (_vpOoB) return;
|
||||
if (endAngle > 360) endAngle = 360;
|
||||
if (startAngle > 360) startAngle = 360;
|
||||
if (_vpOoB || startAngle == endAngle) return;
|
||||
if (r < ir) transpose(r, ir); // Required that r > ir
|
||||
if (r <= 0 || ir < 0) return; // Invalid r, ir can be zero (circle sector)
|
||||
if (endAngle < startAngle) transpose(startAngle, endAngle);
|
||||
if (startAngle < 0) startAngle = 0;
|
||||
if (endAngle > 360) endAngle = 360;
|
||||
|
||||
if (endAngle < startAngle) {
|
||||
// Arc sweeps through 6 o'clock so draw in two parts
|
||||
if (startAngle < 360) drawArc(x, y, r, ir, startAngle, 360, fg_color, bg_color, smooth);
|
||||
if (endAngle == 0) return;
|
||||
startAngle = 0;
|
||||
}
|
||||
inTransaction = true;
|
||||
|
||||
int32_t xs = 0; // x start position for quadrant scan
|
||||
uint8_t alpha = 0; // alpha value for blending pixels
|
||||
int32_t xs = 0; // x start position for quadrant scan
|
||||
uint8_t alpha = 0; // alpha value for blending pixels
|
||||
|
||||
int32_t r2 = r * r; // Outer arc radius^2
|
||||
if (smooth) r++; // Outer AA zone radius
|
||||
int32_t r1 = r * r; // Outer AA radius^2
|
||||
int16_t w = r - ir; // Width of arc (r - ir + 1)
|
||||
int32_t r3 = ir * ir; // Inner arc radius^2
|
||||
if (smooth) ir--; // Inner AA zone radius
|
||||
int32_t r4 = ir * ir; // Inner AA radius^2
|
||||
|
||||
// Float variants of adjusted inner and outer arc radii
|
||||
//float irf = ir;
|
||||
//float rf = r;
|
||||
uint32_t r2 = r * r; // Outer arc radius^2
|
||||
if (smooth) r++; // Outer AA zone radius
|
||||
uint32_t r1 = r * r; // Outer AA radius^2
|
||||
int16_t w = r - ir; // Width of arc (r - ir + 1)
|
||||
uint32_t r3 = ir * ir; // Inner arc radius^2
|
||||
if (smooth) ir--; // Inner AA zone radius
|
||||
uint32_t r4 = ir * ir; // Inner AA radius^2
|
||||
|
||||
// 1 | 2
|
||||
// ---¦--- Arc quadrant index
|
||||
// 0 | 3
|
||||
// Fixed point U16.16 slope table for arc start/end in each quadrant
|
||||
uint32_t startSlope[4] = {0, 0, 0xFFFFFFFF, 0};
|
||||
uint32_t endSlope[4] = {0, 0xFFFFFFFF, 0, 0};
|
||||
uint32_t startSlope[4] = {0, 0, 0xFFFFFFFF, 0};
|
||||
uint32_t endSlope[4] = {0, 0xFFFFFFFF, 0, 0};
|
||||
|
||||
// Ensure maximum U16.16 slope of arc ends is ~ 0x8000 0000
|
||||
constexpr float minDivisor = 1.0f/0x8000;
|
||||
@ -4034,13 +4106,13 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
uint32_t slope = (fabscos/(fabssin + minDivisor)) * (float)(1<<16);
|
||||
|
||||
// Update slope table, add slope for arc start
|
||||
if (startAngle < 90) {
|
||||
if (startAngle <= 90) {
|
||||
startSlope[0] = slope;
|
||||
}
|
||||
else if (startAngle < 180) {
|
||||
else if (startAngle <= 180) {
|
||||
startSlope[1] = slope;
|
||||
}
|
||||
else if (startAngle < 270) {
|
||||
else if (startAngle <= 270) {
|
||||
startSlope[1] = 0xFFFFFFFF;
|
||||
startSlope[2] = slope;
|
||||
}
|
||||
@ -4058,16 +4130,16 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
slope = (uint32_t)((fabscos/(fabssin + minDivisor)) * (float)(1<<16));
|
||||
|
||||
// Work out which quadrants will need to be drawn and add slope for arc end
|
||||
if (endAngle < 90) {
|
||||
if (endAngle <= 90) {
|
||||
endSlope[0] = slope;
|
||||
endSlope[1] = 0;
|
||||
endSlope[2] = 0xFFFFFFFF;
|
||||
startSlope[2] = 0;
|
||||
}
|
||||
else if (endAngle < 180) {
|
||||
else if (endAngle <= 180) {
|
||||
endSlope[1] = slope;
|
||||
endSlope[2] = 0xFFFFFFFF;
|
||||
startSlope[2] = 0;
|
||||
}
|
||||
else if (endAngle < 270) {
|
||||
else if (endAngle <= 270) {
|
||||
endSlope[2] = slope;
|
||||
}
|
||||
else {
|
||||
@ -4091,7 +4163,6 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
|
||||
// If in outer zone calculate alpha
|
||||
if (hyp > r2) {
|
||||
//alpha = (uint8_t)((rf - sqrtf(hyp)) * 255);
|
||||
alpha = ~sqrt_fraction(hyp); // Outer AA zone
|
||||
}
|
||||
// If within arc fill zone, get line start and lengths for each quadrant
|
||||
@ -4110,7 +4181,7 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
xst[2] = cx; // Bottom right line start
|
||||
len[2]++;
|
||||
}
|
||||
if (slope >= startSlope[3] && slope <= endSlope[3]) { // slope lo -> hi
|
||||
if (slope <= endSlope[3] && slope >= startSlope[3]) { // slope lo -> hi
|
||||
xst[3] = cx; // Top right line start
|
||||
len[3]++;
|
||||
}
|
||||
@ -4118,7 +4189,6 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
}
|
||||
else {
|
||||
if (hyp <= r4) break; // Skip inner pixels
|
||||
//alpha = (uint8_t)((sqrtf(hyp) - irf) * 255.0);
|
||||
alpha = sqrt_fraction(hyp); // Inner AA zone
|
||||
}
|
||||
|
||||
@ -4134,7 +4204,7 @@ void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
drawPixel(x + cx - r, y + cy - r, pcol);
|
||||
if (slope <= startSlope[2] && slope >= endSlope[2]) // TR
|
||||
drawPixel(x - cx + r, y + cy - r, pcol);
|
||||
if (slope >= startSlope[3] && slope <= endSlope[3]) // BR
|
||||
if (slope <= endSlope[3] && slope >= startSlope[3]) // BR
|
||||
drawPixel(x - cx + r, y - cy + r, pcol);
|
||||
}
|
||||
// Add line in inner zone
|
||||
@ -4190,19 +4260,12 @@ void TFT_eSPI::fillSmoothCircle(int32_t x, int32_t y, int32_t r, uint32_t color,
|
||||
int32_t hyp2 = (r - cx) * (r - cx) + dy2;
|
||||
if (hyp2 <= r1) break;
|
||||
if (hyp2 >= r2) continue;
|
||||
//*
|
||||
|
||||
uint8_t alpha = ~sqrt_fraction(hyp2);
|
||||
if (alpha > 246) break;
|
||||
xs = cx;
|
||||
if (alpha < 9) continue;
|
||||
//*/
|
||||
/*
|
||||
float alphaf = (float)r - sqrtf(hyp2);
|
||||
if (alphaf > HiAlphaTheshold) break;
|
||||
xs = cx;
|
||||
if (alphaf < LoAlphaTheshold) continue;
|
||||
uint8_t alpha = alphaf * 255;
|
||||
//*/
|
||||
|
||||
if (bg_color == 0x00FFFFFF) {
|
||||
drawPixel(x + cx - r, y + cy - r, color, alpha, bg_color);
|
||||
drawPixel(x - cx + r, y + cy - r, color, alpha, bg_color);
|
||||
@ -4242,7 +4305,7 @@ void TFT_eSPI::drawSmoothRoundRect(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
{
|
||||
if (_vpOoB) return;
|
||||
if (r < ir) transpose(r, ir); // Required that r > ir
|
||||
if (r <= 0 || ir < 0) return; // Invalid
|
||||
if (r <= 0 || ir < 0) return; // Invalid
|
||||
|
||||
w -= 2*r;
|
||||
h -= 2*r;
|
||||
@ -4254,13 +4317,7 @@ void TFT_eSPI::drawSmoothRoundRect(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
|
||||
x += r;
|
||||
y += r;
|
||||
/*
|
||||
float alphaGain = 1.0;
|
||||
if (w != 0 || h != 0) {
|
||||
if (r - ir < 2) alphaGain = 1.5; // Boost brightness for thin lines
|
||||
if (r - ir < 1) alphaGain = 1.7;
|
||||
}
|
||||
*/
|
||||
|
||||
uint16_t t = r - ir + 1;
|
||||
int32_t xs = 0;
|
||||
int32_t cx = 0;
|
||||
@ -4273,8 +4330,6 @@ void TFT_eSPI::drawSmoothRoundRect(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
ir--;
|
||||
int32_t r4 = ir * ir; // Inner AA zone radius^2
|
||||
|
||||
//float irf = ir;
|
||||
//float rf = r;
|
||||
uint8_t alpha = 0;
|
||||
|
||||
// Scan top left quadrant x y r ir fg_color bg_color
|
||||
@ -4295,8 +4350,7 @@ void TFT_eSPI::drawSmoothRoundRect(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
|
||||
// If in outer zone calculate alpha
|
||||
if (hyp > r2) {
|
||||
alpha = ~sqrt_fraction(hyp);
|
||||
//alpha = (uint8_t)((rf - sqrtf(hyp)) * 255); // Outer AA zone
|
||||
alpha = ~sqrt_fraction(hyp); // Outer AA zone
|
||||
}
|
||||
// If within arc fill zone, get line lengths for each quadrant
|
||||
else if (hyp >= r3) {
|
||||
@ -4306,8 +4360,7 @@ void TFT_eSPI::drawSmoothRoundRect(int32_t x, int32_t y, int32_t r, int32_t ir,
|
||||
}
|
||||
else {
|
||||
if (hyp <= r4) break; // Skip inner pixels
|
||||
//alpha = (uint8_t)((sqrtf(hyp) - irf) * 255); // Inner AA zone
|
||||
alpha = sqrt_fraction(hyp);
|
||||
alpha = sqrt_fraction(hyp); // Inner AA zone
|
||||
}
|
||||
|
||||
if (alpha < 16) continue; // Skip low alpha pixels
|
||||
@ -4378,13 +4431,7 @@ void TFT_eSPI::fillSmoothRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, i
|
||||
if (alpha > 246) break;
|
||||
xs = cx;
|
||||
if (alpha < 9) continue;
|
||||
/*
|
||||
float alphaf = (float)r - sqrtf(hyp2);
|
||||
if (alphaf > HiAlphaTheshold) break;
|
||||
xs = cx;
|
||||
if (alphaf < LoAlphaTheshold) continue;
|
||||
uint8_t alpha = alphaf * 255;
|
||||
*/
|
||||
|
||||
drawPixel(x + cx - r, y + cy - r, color, alpha, bg_color);
|
||||
drawPixel(x - cx + r + w, y + cy - r, color, alpha, bg_color);
|
||||
drawPixel(x - cx + r + w, y - cy + r + h, color, alpha, bg_color);
|
||||
@ -4462,16 +4509,25 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
||||
// Track edge to minimise calculations
|
||||
if (!endX) { endX = true; xs = xp; }
|
||||
if (alpha > HiAlphaTheshold) {
|
||||
if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; }
|
||||
pushColor(fg_color);
|
||||
#ifdef GC9A01_DRIVER
|
||||
drawPixel(xp, yp, fg_color);
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(fg_color);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
//Blend color with background and plot
|
||||
if (bg_color == 0x00FFFFFF) {
|
||||
bg = readPixel(xp, yp); swin = true;
|
||||
}
|
||||
if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
#ifdef GC9A01_DRIVER
|
||||
uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
drawPixel(xp, yp, pcol);
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -4490,16 +4546,25 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
||||
// Track line boundary
|
||||
if (!endX) { endX = true; xs = xp; }
|
||||
if (alpha > HiAlphaTheshold) {
|
||||
if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; }
|
||||
pushColor(fg_color);
|
||||
#ifdef GC9A01_DRIVER
|
||||
drawPixel(xp, yp, fg_color);
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(fg_color);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
//Blend colour with background and plot
|
||||
if (bg_color == 0x00FFFFFF) {
|
||||
bg = readPixel(xp, yp); swin = true;
|
||||
}
|
||||
if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
#ifdef GC9A01_DRIVER
|
||||
uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
drawPixel(xp, yp, pcol);
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -4908,10 +4973,13 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
||||
*************************************************************************************x*/
|
||||
inline uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
||||
{
|
||||
// Split out and blend 5 bit red and blue channels
|
||||
uint32_t rxb = bgc & 0xF81F;
|
||||
rxb += ((fgc & 0xF81F) - rxb) * (alpha >> 2) >> 6;
|
||||
// Split out and blend 6 bit green channel
|
||||
uint32_t xgx = bgc & 0x07E0;
|
||||
xgx += ((fgc & 0x07E0) - xgx) * alpha >> 8;
|
||||
// Recombine channels
|
||||
return (rxb & 0xF81F) | (xgx & 0x07E0);
|
||||
}
|
||||
|
||||
@ -4998,7 +5066,6 @@ size_t TFT_eSPI::write(uint8_t utf8)
|
||||
#endif
|
||||
|
||||
if (uniCode == '\n') uniCode+=22; // Make it a valid space character to stop errors
|
||||
else if (uniCode < 32) return 1;
|
||||
|
||||
uint16_t cwidth = 0;
|
||||
uint16_t cheight = 0;
|
||||
@ -5017,7 +5084,7 @@ size_t TFT_eSPI::write(uint8_t utf8)
|
||||
|
||||
#ifdef LOAD_FONT2
|
||||
if (textfont == 2) {
|
||||
if (uniCode > 127) return 1;
|
||||
if (uniCode < 32 || uniCode > 127) return 1;
|
||||
|
||||
cwidth = pgm_read_byte(widtbl_f16 + uniCode-32);
|
||||
cheight = chr_hgt_f16;
|
||||
@ -5033,7 +5100,7 @@ size_t TFT_eSPI::write(uint8_t utf8)
|
||||
#ifdef LOAD_RLE
|
||||
{
|
||||
if ((textfont>2) && (textfont<9)) {
|
||||
if (uniCode > 127) return 1;
|
||||
if (uniCode < 32 || uniCode > 127) return 1;
|
||||
// Uses the fontinfo struct array to avoid lots of 'if' or 'switch' statements
|
||||
cwidth = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[textfont].widthtbl ) ) + uniCode-32 );
|
||||
cheight= pgm_read_byte( &fontdata[textfont].height );
|
||||
@ -5927,10 +5994,12 @@ void TFT_eSPI::getSetup(setup_t &tft_settings)
|
||||
#ifdef SPI_READ_FREQUENCY
|
||||
tft_settings.tft_rd_freq = SPI_READ_FREQUENCY/100000;
|
||||
#endif
|
||||
#ifdef TFT_SPI_PORT
|
||||
tft_settings.port = TFT_SPI_PORT;
|
||||
#else
|
||||
tft_settings.port = 255;
|
||||
#ifndef GENERIC_PROCESSOR
|
||||
#ifdef TFT_SPI_PORT
|
||||
tft_settings.port = TFT_SPI_PORT;
|
||||
#else
|
||||
tft_settings.port = 255;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef RP2040_PIO_SPI
|
||||
tft_settings.interface = 0x10;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef _TFT_eSPIH_
|
||||
#define _TFT_eSPIH_
|
||||
|
||||
#define TFT_ESPI_VERSION "2.5.0"
|
||||
#define TFT_ESPI_VERSION "2.5.23"
|
||||
|
||||
// Bit level feature flags
|
||||
// Bit 0 set: viewport capability
|
||||
@ -86,7 +86,9 @@
|
||||
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ESP32)
|
||||
#include <pgmspace.h>
|
||||
#else
|
||||
#define PROGMEM
|
||||
#ifndef PROGMEM
|
||||
#define PROGMEM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Include the processor specific drivers
|
||||
@ -104,6 +106,7 @@
|
||||
#include "Processors/TFT_eSPI_RP2040.h"
|
||||
#else
|
||||
#include "Processors/TFT_eSPI_Generic.h"
|
||||
#define GENERIC_PROCESSOR
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
@ -141,6 +144,17 @@
|
||||
#define SPI_BUSY_CHECK
|
||||
#endif
|
||||
|
||||
// If half duplex SDA mode is defined then MISO pin should be -1
|
||||
#ifdef TFT_SDA_READ
|
||||
#ifdef TFT_MISO
|
||||
#if TFT_MISO != -1
|
||||
#undef TFT_MISO
|
||||
#define TFT_MISO -1
|
||||
#warning TFT_MISO set to -1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** Section 4: Setup fonts
|
||||
***************************************************************************************/
|
||||
@ -353,7 +367,9 @@ uint32_t setup_id; // ID available to use in a user setup
|
||||
int32_t esp; // Processor code
|
||||
uint8_t trans; // SPI transaction support
|
||||
uint8_t serial; // Serial (SPI) or parallel
|
||||
#ifndef GENERIC_PROCESSOR
|
||||
uint8_t port; // SPI port
|
||||
#endif
|
||||
uint8_t overlap; // ESP8266 overlap mode
|
||||
uint8_t interface; // Interface type
|
||||
|
||||
@ -526,12 +542,12 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
// By default the arc is drawn with square ends unless the "roundEnds" parameter is included and set true
|
||||
// Angle = 0 is at 6 o'clock position, 90 at 9 o'clock etc. The angles must be in range 0-360 or they will be clipped to these limits
|
||||
// The start angle may be larger than the end angle. Arcs are always drawn clockwise from the start angle.
|
||||
void drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_t startAngle, int32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool roundEnds = false);
|
||||
void drawSmoothArc(int32_t x, int32_t y, int32_t r, int32_t ir, uint32_t startAngle, uint32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool roundEnds = false);
|
||||
|
||||
// As per "drawSmoothArc" except endAngle should be greater than startAngle (angles will be swapped otherwise)
|
||||
// As per "drawSmoothArc" except the ends of the arc are NOT anti-aliased, this facilitates dynamic arc length changes with
|
||||
// arc segments and ensures clean segment joints.
|
||||
// The sides of the arc are anti-aliased by default. If smoothArc is false sides will NOT be anti-aliased
|
||||
// The ends of the arc are NOT anti-aliased, this facilitates dynamic arc length changes with arc segments and ensures clean segment joints
|
||||
void drawArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_t startAngle, int32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool smoothArc = true);
|
||||
void drawArc(int32_t x, int32_t y, int32_t r, int32_t ir, uint32_t startAngle, uint32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool smoothArc = true);
|
||||
|
||||
// Draw an anti-aliased filled circle at x, y with radius r
|
||||
// Note: The thickness of line is 3 pixels to reduce the visible "braiding" effect of anti-aliasing narrow lines
|
||||
@ -683,11 +699,12 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
|
||||
// Low level read/write
|
||||
void spiwrite(uint8_t); // legacy support only
|
||||
#ifndef RM68120_DRIVER
|
||||
void writecommand(uint8_t c); // Send a command, function resets DC/RS high ready for data
|
||||
#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
|
||||
#else
|
||||
void writecommand(uint16_t c); // Send a command, function resets DC/RS high ready for data
|
||||
void writeRegister(uint16_t c, uint8_t d); // Write data to 16 bit command register
|
||||
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
|
||||
|
||||
|
@ -116,6 +116,8 @@
|
||||
//#include <User_Setups/Setup136_LilyGo_TTV.h> // Setup file for ESP32 and Lilygo TTV ST7789 SPI bus TFT 135x240
|
||||
//#include <User_Setups/Setup137_LilyGo_TDisplay_RP2040.h> // Setup file for Lilygo T-Display RP2040 (ST7789 on SPI bus with 135x240 TFT)
|
||||
|
||||
//#include <User_Setups/Setup138_Pico_Explorer_Base_RP2040_ST7789.h> // Setup file for Pico Explorer Base by Pimoroni for RP2040 (ST7789 on SPI bus with 240x240 TFT)
|
||||
|
||||
//#include <User_Setups/Setup200_GC9A01.h> // Setup file for ESP32 and GC9A01 240 x 240 TFT
|
||||
|
||||
//#include <User_Setups/Setup201_WT32_SC01.h> // Setup file for ESP32 based WT32_SC01 from Seeed
|
||||
@ -130,23 +132,25 @@
|
||||
#ifdef NERDMINERV2
|
||||
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h>
|
||||
#endif
|
||||
|
||||
#ifdef NERMINER_S3_AMOLED
|
||||
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h> //Just a stub. No driver implementation for S3 AMOLED in TFT_eSPI
|
||||
#endif
|
||||
//#include <User_Setups/Setup207_LilyGo_T_HMI.h> // For the LilyGo T-HMI S3 based ESP32S3 with ST7789 240 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup208_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite (may also work with ESP32 S3 Box)
|
||||
|
||||
//#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
|
||||
// #include <User_Setups/Setup210_LilyGo_T_Embed_S3.h> // For the LilyGo T-Embed S3 based ESP32S3 with ST7789 170 x 320 TFT
|
||||
#ifdef NERMINER_T_QT
|
||||
#include <User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h> // For the LilyGo T-QT Pro S3 based ESP32S3 with GC9A01 128 x 128 TFT
|
||||
#endif
|
||||
#ifdef NERMINER_S3_DONGLE
|
||||
#include <User_Setups/Setup300_TTGO_T_Dongle.h>
|
||||
#endif
|
||||
|
||||
#ifdef NERMINER_T_QT
|
||||
#include <User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h>
|
||||
#endif
|
||||
//#include <User_Setups/Setup301_BW16_ST7735.h> // Setup file for Bw16-based boards with ST7735 160 x 80 TFT
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h> // Template file for a setup
|
||||
|
||||
|
||||
//#include <User_Setups/Dustin_ILI9488.h> // Setup file for Dustin Watts PCB with ILI9488
|
||||
//#include <User_Setups/Dustin_ST7796.h> // Setup file for Dustin Watts PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ILI9488_Pico.h> // Setup file for Dustin Watts Pico PCB with ST7796
|
||||
|
@ -8,6 +8,19 @@
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
#define TFT_PARALLEL_16_BIT
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// the display may not initialise or graphics will become corrupted.
|
||||
// PIO write cycle frequency = (CPU clock/(4 * RP2040_PIO_CLK_DIV))
|
||||
//#define RP2040_PIO_CLK_DIV 1 // 32ns write cycle at 125MHz CPU clock
|
||||
//#define RP2040_PIO_CLK_DIV 2 // 64ns write cycle at 125MHz CPU clock
|
||||
//#define RP2040_PIO_CLK_DIV 3 // 96ns write cycle at 125MHz CPU clock
|
||||
//#define RP2040_PIO_CLK_DIV 4 // 96ns write cycle at 125MHz CPU clock
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display driver type
|
||||
|
@ -0,0 +1,32 @@
|
||||
// Pico Explorer Base by Pimoroni (RP2040) (ST7789 on SPI bus with 240x240 TFT)
|
||||
#define USER_SETUP_ID 138
|
||||
|
||||
#define ST7789_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
|
||||
#define CGRAM_OFFSET // Library will add offsets required
|
||||
|
||||
// For Pico Explorer Base (PR2040)
|
||||
#define TFT_CS 17 // Chip Select pin
|
||||
#define TFT_DC 16 // Data Command control pin
|
||||
#define TFT_RST -1 // No Reset pin
|
||||
#define TFT_MOSI 19
|
||||
#define TFT_SCLK 18
|
||||
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
// #define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 40000000
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
@ -1,7 +1,7 @@
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 13
|
||||
|
||||
#define ESP32_PARALLEL
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
|
||||
#define ILI9481_DRIVER
|
||||
|
@ -1,34 +1,9 @@
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 17
|
||||
|
||||
#define EPD_DRIVER // ePaper driver
|
||||
|
||||
|
||||
// READ THIS READ THIS READ THIS READ THIS READ THIS READ THIS
|
||||
// Install the ePaper library for your own display size and type
|
||||
// from here:
|
||||
// https://github.com/Bodmer/EPD_Libraries
|
||||
|
||||
// Note: Pin allocations for the ePaper signals are defined in
|
||||
// the ePaper library's epdif.h file. There follows the default
|
||||
// pins already included in epdif.h file for the ESP8266:
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// For ESP8266 connect as follows: //
|
||||
// Display 3.3V to NodeMCU 3V3 //
|
||||
// Display GND to NodeMCU GND //
|
||||
// //
|
||||
// Display GPIO NodeMCU pin //
|
||||
// BUSY 5 D1 //
|
||||
// RESET 4 D2 //
|
||||
// DC 0 D3 //
|
||||
// CS 2 D4 //
|
||||
// CLK 14 D5 //
|
||||
// D6 (MISO not connected to display) //
|
||||
// DIN 13 D7 //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI -1
|
||||
#define TFT_SCLK -1
|
||||
#define TFT_RST -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
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define TFT_DC 2
|
||||
#define TFT_RST 4
|
||||
#define TFT_CS 15
|
||||
#elif defined(ESP8266)
|
||||
#elif defined (ARDUINO_ARCH_ESP8266)
|
||||
//#define TFT_MOSI PIN_D5 // Can't change
|
||||
//#define TFT_SCLK PIN_D7 // Can't change
|
||||
#define TFT_DC PIN_D3
|
||||
|
@ -3,11 +3,11 @@
|
||||
#define USER_SETUP_ID 206
|
||||
|
||||
#define ST7789_DRIVER
|
||||
// #define INIT_SEQUENCE_3 // Using this initialisation sequence improves the display image
|
||||
#define INIT_SEQUENCE_3 // Using this initialisation sequence improves the display image
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
48
lib/TFT_eSPI/User_Setups/Setup207_LilyGo_T_HMI.h
Normal file
48
lib/TFT_eSPI/User_Setups/Setup207_LilyGo_T_HMI.h
Normal file
@ -0,0 +1,48 @@
|
||||
// ST7789 240 x 240 display with no chip select line
|
||||
#define USER_SETUP_ID 207
|
||||
|
||||
#define ST7789_DRIVER // Configure all registers
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
// #define TFT_INVERSION_ON
|
||||
#define TFT_INVERSION_OFF
|
||||
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
// The ESP32 and TFT the pins used for testing are:
|
||||
#define TFT_CS 6 // Chip select control pin (library pulls permanently low
|
||||
#define TFT_DC 7 // Data Command control pin
|
||||
#define TFT_RST -1 // Reset pin, toggles on startup
|
||||
|
||||
#define TFT_WR 8 // Write strobe control pin
|
||||
#define TFT_RD -1 // Read strobe control pin
|
||||
|
||||
#define TFT_D0 48 // Must use pins in the range 0-31 or alternatively 32-48
|
||||
#define TFT_D1 47 // so a single register write sets/clears all bits.
|
||||
#define TFT_D2 39 // Pins can be randomly assigned, this does not affect
|
||||
#define TFT_D3 40 // TFT screen update performance.
|
||||
#define TFT_D4 41
|
||||
#define TFT_D5 42
|
||||
#define TFT_D6 45
|
||||
#define TFT_D7 46
|
||||
|
||||
#define TFT_BL 38 // LED back-light
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
//#define LOAD_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
|
32
lib/TFT_eSPI/User_Setups/Setup208_ESP32_S3_Box_Lite.h
Normal file
32
lib/TFT_eSPI/User_Setups/Setup208_ESP32_S3_Box_Lite.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Display configuration for ST7789-based ESP32-S3-Box-Lite
|
||||
|
||||
#define USER_SETUP_ID 208
|
||||
#define USER_SETUP_INFO "ESP32-S3-BOX-LITE"
|
||||
|
||||
#define ST7789_DRIVER
|
||||
#define TFT_RGB_ORDER TFT_BGR
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
#define TFT_BL 45
|
||||
#define TFT_BACKLIGHT_ON LOW
|
||||
|
||||
#define TFT_CS 5
|
||||
#define TFT_DC 4
|
||||
#define TFT_RST 48
|
||||
|
||||
#define TFT_MOSI 6
|
||||
#define TFT_SCLK 7
|
||||
|
||||
#define LOAD_GLCD
|
||||
#define LOAD_FONT2
|
||||
#define LOAD_FONT4
|
||||
#define LOAD_FONT6
|
||||
#define LOAD_FONT7
|
||||
#define LOAD_FONT8
|
||||
#define LOAD_GFXFF
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 40000000
|
52
lib/TFT_eSPI/User_Setups/Setup209_LilyGo_T_Dongle_S3.h
Normal file
52
lib/TFT_eSPI/User_Setups/Setup209_LilyGo_T_Dongle_S3.h
Normal file
@ -0,0 +1,52 @@
|
||||
// Config for LilyGo T-Dongle S3 w ESP32 and ST7735 80 x 160 display
|
||||
#define USER_SETUP_ID 209
|
||||
|
||||
#define ST7735_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 80
|
||||
#define TFT_HEIGHT 160
|
||||
|
||||
// #define ST7735_INITB
|
||||
// #define ST7735_GREENTAB
|
||||
// #define ST7735_GREENTAB2
|
||||
// #define ST7735_GREENTAB3
|
||||
// #define ST7735_GREENTAB128 // For 128 x 128 display
|
||||
#define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset)
|
||||
// #define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
// #define ST7735_REDTAB160x80 // For 160 x 80 display with 24 pixel offset
|
||||
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
//#define TFT_INVERSION_ON
|
||||
//#define TFT_INVERSION_OFF
|
||||
|
||||
// Generic ESP32 setup
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI 3
|
||||
#define TFT_SCLK 5
|
||||
#define TFT_CS 4
|
||||
#define TFT_DC 2
|
||||
#define TFT_RST 1 // Connect reset to ensure display initialises
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
#define SPI_FREQUENCY 27000000
|
||||
//#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
43
lib/TFT_eSPI/User_Setups/Setup210_LilyGo_T_Embed_S3.h
Normal file
43
lib/TFT_eSPI/User_Setups/Setup210_LilyGo_T_Embed_S3.h
Normal file
@ -0,0 +1,43 @@
|
||||
// ST7789 170 x 320 display with no chip select line
|
||||
#define USER_SETUP_ID 210
|
||||
|
||||
#define ST7789_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 170
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_INVERSION_ON
|
||||
//#define TFT_INVERSION_OFF
|
||||
#define TFT_BACKLIGHT_ON 1
|
||||
|
||||
#define TFT_BL 15 // LED back-light
|
||||
#define TFT_MISO -1 // Not connected
|
||||
#define TFT_MOSI 11
|
||||
#define TFT_SCLK 12
|
||||
#define TFT_CS 10
|
||||
#define TFT_DC 13
|
||||
#define TFT_RST 9 // Connect reset to ensure display initialises
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
@ -1,37 +0,0 @@
|
||||
#define USER_SETUP_ID 300
|
||||
|
||||
#define ST7735_DRIVER
|
||||
|
||||
#define TFT_WIDTH 80
|
||||
#define TFT_HEIGHT 160
|
||||
|
||||
#define TFT_RST 1
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI 3
|
||||
#define TFT_SCLK 5
|
||||
#define TFT_CS 4
|
||||
#define TFT_DC 2
|
||||
// #define TFT_BL 38
|
||||
// #define TFT_BACKLIGHT_ON LOW
|
||||
|
||||
#define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset)
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
// #define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
|
||||
// this will save ~20kbytes of FLASH
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 50000000 // Actually sets it to 26.67MHz = 80/3
|
||||
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
#define TFT_RGB_ORDER TFT_BGR
|
44
lib/TFT_eSPI/User_Setups/Setup70f_ESP32_S2_ST7735.h
Normal file
44
lib/TFT_eSPI/User_Setups/Setup70f_ESP32_S2_ST7735.h
Normal file
@ -0,0 +1,44 @@
|
||||
// Setup for the ESP32 S2 with ST7735 80x160 display
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
#define USER_SETUP_ID 70
|
||||
|
||||
#define ST7735_DRIVER
|
||||
|
||||
#define TFT_SDA_READ // Display has a bidirectional SDA pin (no MISO)
|
||||
|
||||
#define TFT_WIDTH 80
|
||||
#define TFT_HEIGHT 160
|
||||
|
||||
#define ST7735_GREENTAB160x80
|
||||
//#define ST7735_REDTAB160x80
|
||||
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
||||
// Typical board default pins
|
||||
#define TFT_CS 10 // 10 or 34
|
||||
|
||||
#define TFT_MOSI 11 // 11 or 35
|
||||
#define TFT_SCLK 12 // 12 or 36
|
||||
|
||||
#define TFT_DC 14
|
||||
#define TFT_RST 15
|
||||
|
||||
#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 must be used for SDA reads. Do not use #define USE_HSPI_PORT
|
||||
|
||||
#define SPI_FREQUENCY 27000000
|
||||
#define SPI_READ_FREQUENCY 16000000
|
@ -1 +0,0 @@
|
||||
{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}
|
@ -1,96 +0,0 @@
|
||||
# This is the CMakeCache file.
|
||||
# For build in directory: d:/Users/19021/Documents/Arduino/libraries/TFT_eSPI/build
|
||||
# It was generated by CMake: C:/Program Files/CMake/bin/cmake.exe
|
||||
# You can edit this file to change values found and used by cmake.
|
||||
# If you do not want to change any of the values, simply exit the editor.
|
||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
||||
# The syntax for the file is as follows:
|
||||
# KEY:TYPE=VALUE
|
||||
# KEY is the name of a variable in the cache.
|
||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
||||
# VALUE is the current value for the KEY.
|
||||
|
||||
########################
|
||||
# EXTERNAL cache entries
|
||||
########################
|
||||
|
||||
//For backwards compatibility, what version of CMake commands and
|
||||
// syntax should this version of CMake try to support.
|
||||
CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_BUILD_TYPE:STRING=Debug
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
|
||||
|
||||
//Program used to build from makefiles.
|
||||
CMAKE_MAKE_PROGRAM:STRING=nmake
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_NAME:STATIC=Project
|
||||
|
||||
//Single output directory for building all executables.
|
||||
EXECUTABLE_OUTPUT_PATH:PATH=
|
||||
|
||||
//Single output directory for building all libraries.
|
||||
LIBRARY_OUTPUT_PATH:PATH=
|
||||
|
||||
//Value Computed by CMake
|
||||
Project_BINARY_DIR:STATIC=D:/Users/19021/Documents/Arduino/libraries/TFT_eSPI/build
|
||||
|
||||
//Value Computed by CMake
|
||||
Project_IS_TOP_LEVEL:STATIC=ON
|
||||
|
||||
//Value Computed by CMake
|
||||
Project_SOURCE_DIR:STATIC=D:/Users/19021/Documents/Arduino/libraries/TFT_eSPI
|
||||
|
||||
|
||||
########################
|
||||
# INTERNAL cache entries
|
||||
########################
|
||||
|
||||
//This is the directory where this CMakeCache.txt was created
|
||||
CMAKE_CACHEFILE_DIR:INTERNAL=d:/Users/19021/Documents/Arduino/libraries/TFT_eSPI/build
|
||||
//Major version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
||||
//Minor version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=23
|
||||
//Patch version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
|
||||
//Path to CMake executable.
|
||||
CMAKE_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cmake.exe
|
||||
//Path to cpack program executable.
|
||||
CMAKE_CPACK_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cpack.exe
|
||||
//Path to ctest program executable.
|
||||
CMAKE_CTEST_COMMAND:INTERNAL=C:/Program Files/CMake/bin/ctest.exe
|
||||
//Path to cache edit program executable.
|
||||
CMAKE_EDIT_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cmake-gui.exe
|
||||
//Name of external makefile project generator.
|
||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
||||
//Name of generator.
|
||||
CMAKE_GENERATOR:INTERNAL=NMake Makefiles
|
||||
//Generator instance identifier.
|
||||
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
||||
//Name of generator platform.
|
||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
||||
//Name of generator toolset.
|
||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
||||
//Source directory with the top level CMakeLists.txt file for this
|
||||
// project
|
||||
CMAKE_HOME_DIRECTORY:INTERNAL=D:/Users/19021/Documents/Arduino/libraries/TFT_eSPI
|
||||
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
|
||||
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
|
||||
//number of local generators
|
||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
|
||||
//Platform information initialized
|
||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
||||
//Path to CMake installation.
|
||||
CMAKE_ROOT:INTERNAL=C:/Program Files/CMake/share/cmake-3.23
|
||||
|
@ -1,15 +0,0 @@
|
||||
set(CMAKE_HOST_SYSTEM "Windows-10.0.19042")
|
||||
set(CMAKE_HOST_SYSTEM_NAME "Windows")
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "10.0.19042")
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
|
||||
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM "Windows-10.0.19042")
|
||||
set(CMAKE_SYSTEM_NAME "Windows")
|
||||
set(CMAKE_SYSTEM_VERSION "10.0.19042")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "AMD64")
|
||||
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
|
||||
set(CMAKE_SYSTEM_LOADED 1)
|
@ -1 +0,0 @@
|
||||
The system is: Windows - 10.0.19042 - AMD64
|
@ -1 +0,0 @@
|
||||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
63
lib/TFT_eSPI/docs/PlatformIO/rp2040.txt
Normal file
63
lib/TFT_eSPI/docs/PlatformIO/rp2040.txt
Normal file
@ -0,0 +1,63 @@
|
||||
;PlatformIO User notes:
|
||||
|
||||
;It is possible to load settings from the calling program rather than modifying
|
||||
;the library for each project by modifying the "platformio.ini" file.
|
||||
|
||||
;The User_Setup_Select.h file will not load the user setting header files if
|
||||
;USER_SETUP_LOADED is defined.
|
||||
|
||||
;Instead of using #define, use the -D prefix, for example:
|
||||
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter, extra scripting
|
||||
; Upload options: custom port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; http://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:pico]
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||
board = pico
|
||||
framework = arduino
|
||||
board_build.core = earlephilhower
|
||||
board_build.filesystem_size = 0.5m
|
||||
lib_deps = bodmer/TFT_eSPI@^2.5.21
|
||||
; change microcontroller
|
||||
board_build.mcu = rp2040
|
||||
|
||||
; change MCU frequency
|
||||
board_build.f_cpu = 133000000L
|
||||
|
||||
build_flags =
|
||||
-Os
|
||||
-DUSER_SETUP_LOADED=1
|
||||
; Define the TFT driver, pins etc here:
|
||||
-DTFT_PARALLEL_8_BIT=1
|
||||
-DRM68120_DRIVER=1
|
||||
-DRP2040_PIO_CLK_DIV=1
|
||||
-DTFT_DC=28
|
||||
-DTFT_WR=22
|
||||
-DTFT_RST=2
|
||||
|
||||
-DTFT_D0=6
|
||||
-DTFT_D1=7
|
||||
-DTFT_D2=8
|
||||
-DTFT_D3=9
|
||||
-DTFT_D4=10
|
||||
-DTFT_D5=11
|
||||
-DTFT_D6=12
|
||||
-DTFT_D7=13
|
||||
|
||||
-DTFT_BL=16
|
||||
-DTFT_BACKLIGHT_ON=HIGH
|
||||
|
||||
-DLOAD_GLCD=1
|
||||
-DLOAD_FONT2=1
|
||||
-DLOAD_FONT4=1
|
||||
-DLOAD_FONT6=1
|
||||
-DLOAD_FONT7=1
|
||||
-DLOAD_FONT8=1
|
||||
-DLOAD_GFXFF=1
|
||||
-DSMOOTH_FONT=1
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define TFT_GREY 0x2104 // Dark grey 16 bit colour
|
||||
|
||||
#include "alert.h" // Out of range alert icon
|
||||
#include "Alert.h" // Out of range alert icon
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
#include <SPI.h>
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
PNG png; // PNG decoder inatance
|
||||
|
||||
#define MAX_IMAGE_WDITH 240 // Adjust for your images
|
||||
#define MAX_IMAGE_WIDTH 240 // Adjust for your images
|
||||
|
||||
int16_t xpos = 0;
|
||||
int16_t ypos = 0;
|
||||
@ -50,7 +50,7 @@ void loop()
|
||||
{
|
||||
int16_t rc = png.openFLASH((uint8_t *)panda, sizeof(panda), pngDraw);
|
||||
if (rc == PNG_SUCCESS) {
|
||||
Serial.println("Successfully png file");
|
||||
Serial.println("Successfully opened png file");
|
||||
Serial.printf("image specs: (%d x %d), %d bpp, pixel type: %d\n", png.getWidth(), png.getHeight(), png.getBpp(), png.getPixelType());
|
||||
tft.startWrite();
|
||||
uint32_t dt = millis();
|
||||
@ -72,7 +72,7 @@ void loop()
|
||||
// you will need to adapt this function to suit.
|
||||
// Callback function to draw pixels to the display
|
||||
void pngDraw(PNGDRAW *pDraw) {
|
||||
uint16_t lineBuffer[MAX_IMAGE_WDITH];
|
||||
uint16_t lineBuffer[MAX_IMAGE_WIDTH];
|
||||
png.getLineAsRGB565(pDraw, lineBuffer, PNG_RGB565_BIG_ENDIAN, 0xffffffff);
|
||||
tft.pushImage(xpos, ypos + pDraw->y, pDraw->iWidth, 1, lineBuffer);
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
|
||||
// This example renders a png file that is stored in a FLASH array
|
||||
// using the PNGdec library (available via library manager).
|
||||
|
||||
// The example png is encoded as ARGB 8 bits per pixel with indexed colour
|
||||
// It was created using GIMP and has a transparent background area.
|
||||
|
||||
// Image files can be converted to arrays using the tool here:
|
||||
// https://notisrac.github.io/FileToCArray/
|
||||
// To use this tool:
|
||||
// 1. Drag and drop PNG image file on "Browse..." button
|
||||
// 2. Tick box "Treat as binary"
|
||||
// 3. Click "Convert"
|
||||
// 4. Click "Save as file" and move the header file to sketch folder
|
||||
// (alternatively use the "Copy to clipboard" and paste into a new tab)
|
||||
// 5. Open the sketch in IDE
|
||||
// 6. Include the header file containing the array (SpongeBob.h in this example)
|
||||
|
||||
// Include the PNG decoder library, available via the IDE library manager
|
||||
#include <PNGdec.h>
|
||||
|
||||
// Include image array
|
||||
#include "SpongeBob.h"
|
||||
|
||||
PNG png; // PNG decoder instance
|
||||
|
||||
#define MAX_IMAGE_WIDTH 240 // Sets rendering line buffer lengths, adjust for your images
|
||||
|
||||
// Include the TFT library - see https://github.com/Bodmer/TFT_eSPI for library information
|
||||
#include "SPI.h"
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
// Position variables must be global (PNGdec does not handle position coordinates)
|
||||
int16_t xpos = 0;
|
||||
int16_t ypos = 0;
|
||||
|
||||
//====================================================================================
|
||||
// Setup
|
||||
//====================================================================================
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println("\n\n Using the PNGdec library");
|
||||
|
||||
// Initialise the TFT
|
||||
tft.begin();
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
Serial.println("\r\nInitialisation done.");
|
||||
}
|
||||
|
||||
//====================================================================================
|
||||
// Loop
|
||||
//====================================================================================
|
||||
void loop()
|
||||
{
|
||||
uint16_t pngw = 0, pngh = 0; // To store width and height of image
|
||||
|
||||
int16_t rc = png.openFLASH((uint8_t *)bob, sizeof(bob), pngDraw);
|
||||
|
||||
if (rc == PNG_SUCCESS) {
|
||||
Serial.println("Successfully opened png file");
|
||||
pngw = png.getWidth();
|
||||
pngh = png.getHeight();
|
||||
Serial.printf("Image metrics: (%d x %d), %d bpp, pixel type: %d\n", pngw, pngh, png.getBpp(), png.getPixelType());
|
||||
|
||||
tft.startWrite();
|
||||
uint32_t dt = millis();
|
||||
rc = png.decode(NULL, 0);
|
||||
tft.endWrite();
|
||||
Serial.print(millis() - dt); Serial.println("ms");
|
||||
tft.endWrite();
|
||||
|
||||
// png.close(); // Required for files, not needed for FLASH arrays
|
||||
}
|
||||
|
||||
delay(250);
|
||||
|
||||
// Randomly change position
|
||||
xpos = random(tft.width() - pngw);
|
||||
ypos = random(tft.height() - pngh);
|
||||
|
||||
// Fill screen with a random colour at random intervals
|
||||
if (random(100) < 20) tft.fillScreen(random(0x10000));
|
||||
}
|
1355
lib/TFT_eSPI/examples/PNG Images/Flash_transparent_PNG/SpongeBob.h
Normal file
1355
lib/TFT_eSPI/examples/PNG Images/Flash_transparent_PNG/SpongeBob.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@
|
||||
|
||||
// PNGdec support functions
|
||||
|
||||
//=========================================v==========================================
|
||||
// pngDraw: Callback function to draw pixels to the display
|
||||
//====================================================================================
|
||||
// This function will be called during decoding of the png file to render each image
|
||||
// line to the TFT. PNGdec generates the image line and a 1bpp mask.
|
||||
void pngDraw(PNGDRAW *pDraw) {
|
||||
uint16_t lineBuffer[MAX_IMAGE_WIDTH]; // Line buffer for rendering
|
||||
uint8_t maskBuffer[1 + MAX_IMAGE_WIDTH / 8]; // Mask buffer
|
||||
|
||||
png.getLineAsRGB565(pDraw, lineBuffer, PNG_RGB565_BIG_ENDIAN, 0xffffffff);
|
||||
|
||||
if (png.getAlphaMask(pDraw, maskBuffer, 255)) {
|
||||
// Note: pushMaskedImage is for pushing to the TFT and will not work pushing into a sprite
|
||||
tft.pushMaskedImage(xpos, ypos + pDraw->y, pDraw->iWidth, 1, lineBuffer, maskBuffer);
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
#include <PNGdec.h>
|
||||
|
||||
PNG png;
|
||||
#define MAX_IMAGE_WDITH 240 // Adjust for your images
|
||||
#define MAX_IMAGE_WIDTH 240 // Adjust for your images
|
||||
|
||||
int16_t xpos = 0;
|
||||
int16_t ypos = 0;
|
||||
@ -67,7 +67,7 @@ void loop()
|
||||
tft.startWrite();
|
||||
Serial.printf("image specs: (%d x %d), %d bpp, pixel type: %d\n", png.getWidth(), png.getHeight(), png.getBpp(), png.getPixelType());
|
||||
uint32_t dt = millis();
|
||||
if (png.getWidth() > MAX_IMAGE_WDITH) {
|
||||
if (png.getWidth() > MAX_IMAGE_WIDTH) {
|
||||
Serial.println("Image too wide for allocated line buffer size!");
|
||||
}
|
||||
else {
|
||||
@ -93,7 +93,7 @@ void loop()
|
||||
// you will need to adapt this function to suit.
|
||||
// Callback function to draw pixels to the display
|
||||
void pngDraw(PNGDRAW *pDraw) {
|
||||
uint16_t lineBuffer[MAX_IMAGE_WDITH];
|
||||
uint16_t lineBuffer[MAX_IMAGE_WIDTH];
|
||||
png.getLineAsRGB565(pDraw, lineBuffer, PNG_RGB565_BIG_ENDIAN, 0xffffffff);
|
||||
tft.pushImage(xpos, ypos + pDraw->y, pDraw->iWidth, 1, lineBuffer);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <PNGdec.h>
|
||||
|
||||
PNG png;
|
||||
#define MAX_IMAGE_WDITH 240 // Adjust for your images
|
||||
#define MAX_IMAGE_WIDTH 240 // Adjust for your images
|
||||
|
||||
int16_t xpos = 0;
|
||||
int16_t ypos = 0;
|
||||
@ -73,7 +73,7 @@ void loop()
|
||||
tft.startWrite();
|
||||
Serial.printf("image specs: (%d x %d), %d bpp, pixel type: %d\n", png.getWidth(), png.getHeight(), png.getBpp(), png.getPixelType());
|
||||
uint32_t dt = millis();
|
||||
if (png.getWidth() > MAX_IMAGE_WDITH) {
|
||||
if (png.getWidth() > MAX_IMAGE_WIDTH) {
|
||||
Serial.println("Image too wide for allocated lin buffer!");
|
||||
}
|
||||
else {
|
||||
@ -99,8 +99,8 @@ void loop()
|
||||
// you will need to adapt this function to suit.
|
||||
// Callback function to draw pixels to the display
|
||||
void pngDraw(PNGDRAW *pDraw) {
|
||||
uint16_t lineBuffer[MAX_IMAGE_WDITH];
|
||||
static uint16_t dmaBuffer[MAX_IMAGE_WDITH]; // static so buffer persists after fn exit
|
||||
uint16_t lineBuffer[MAX_IMAGE_WIDTH];
|
||||
static uint16_t dmaBuffer[MAX_IMAGE_WIDTH]; // static so buffer persists after fn exit
|
||||
|
||||
png.getLineAsRGB565(pDraw, lineBuffer, PNG_RGB565_BIG_ENDIAN, 0xffffffff);
|
||||
tft.pushImageDMA(xpos, ypos + pDraw->y, pDraw->iWidth, 1, lineBuffer, dmaBuffer);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// This is a test sketch being developed for a new arc based meter widget
|
||||
// The meter grahic is fully anti-aliased to avoid jaggy pixelated edges
|
||||
// The meter graphic is fully anti-aliased to avoid jaggy pixelated edges
|
||||
|
||||
// For this demo randomly sized meters are drawn, cycled and redrawn a random size.
|
||||
// The meter is ramped up and down 0-100 and 100-0, then pauses before a new
|
||||
|
@ -0,0 +1,47 @@
|
||||
// Arc drawing example - draw a colour wheel
|
||||
|
||||
#include <TFT_eSPI.h> // Include the graphics library
|
||||
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
||||
|
||||
uint16_t colors[12];
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Setup
|
||||
// -------------------------------------------------------------------------
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
tft.init();
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
// Create the outer ring colours
|
||||
for (uint8_t c = 0; c < 2; c++) {
|
||||
colors[c + 10] = tft.alphaBlend(128 + c * 127, TFT_RED, TFT_MAGENTA);
|
||||
colors[c + 8] = tft.alphaBlend(128 + c * 127, TFT_MAGENTA, TFT_BLUE);
|
||||
colors[c + 6] = tft.alphaBlend(128 + c * 127, TFT_BLUE, TFT_GREEN);
|
||||
colors[c + 4] = tft.alphaBlend(128 + c * 127, TFT_GREEN, TFT_YELLOW);
|
||||
colors[c + 2] = tft.alphaBlend(128 + c * 127, TFT_YELLOW, TFT_ORANGE);
|
||||
colors[c + 0] = tft.alphaBlend(128 + c * 127, TFT_ORANGE, TFT_RED);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Main loop
|
||||
// -------------------------------------------------------------------------
|
||||
void loop() {
|
||||
uint16_t rDelta = (tft.width() - 1) / 10;
|
||||
uint16_t x = tft.width() / 2;
|
||||
uint16_t y = tft.height() / 2;
|
||||
bool smooth = true;
|
||||
|
||||
// Draw rings as a series of arcs, increasingly blend colour with white towards middle
|
||||
for (uint16_t i = 5; i > 0; i--) {
|
||||
for (uint16_t angle = 0; angle <= 330; angle += 30) {
|
||||
uint16_t radius = i * rDelta;
|
||||
uint16_t wheelColor = tft.alphaBlend((i * 255.0)/5.0, colors[angle / 30], TFT_WHITE);
|
||||
tft.drawArc(x, y, radius, radius - rDelta, angle, angle + 30, wheelColor, TFT_BLACK, smooth);
|
||||
}
|
||||
smooth = false; // Only outer ring is smooth
|
||||
}
|
||||
|
||||
while (1) delay(100);
|
||||
}
|
@ -7,8 +7,6 @@
|
||||
// The sides of the arc can optionally be smooth or not. Smooth arcs have
|
||||
// a much better appearance, especially at small sizes.
|
||||
|
||||
// Start angle for drawArc must be smaller than end angle
|
||||
|
||||
#include <TFT_eSPI.h> // Include the graphics library
|
||||
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
||||
|
||||
@ -42,7 +40,7 @@ void loop()
|
||||
|
||||
// 0 degrees is at 6 o'clock position
|
||||
// Arcs are drawn clockwise from start_angle to end_angle
|
||||
// Start angle for drawArc must be smaller than end angle (function will swap them otherwise)
|
||||
// Start angle can be greater than end angle, the arc will then be drawn through 0 degrees
|
||||
uint16_t start_angle = random(361); // Start angle must be in range 0 to 360
|
||||
uint16_t end_angle = random(361); // End angle must be in range 0 to 360
|
||||
|
||||
@ -50,35 +48,6 @@ void loop()
|
||||
|
||||
tft.drawArc(x, y, radius, inner_radius, start_angle, end_angle, fg_color, bg_color, smooth);
|
||||
|
||||
//tft.drawArc(x, y, radius, inner_radius, start_angle, end_angle, fg_color, bg_color); // always smooth sides if parameter is missing
|
||||
|
||||
// The following function allows arcs to be drawn through the 6 o'clock position by drawing in 2 segments if
|
||||
// the start angle is greater than the end angle
|
||||
//drawAnyArc(x, y, radius, inner_radius, start_angle, end_angle, fg_color, bg_color, smooth); // smooth sides if parameter is missing
|
||||
|
||||
count++;
|
||||
if (count < 30) delay(500); // After 15s draw as fast as possible!
|
||||
}
|
||||
|
||||
|
||||
// The following function allows arcs to be drawn through the 0 degree position by drawing in 2 segments
|
||||
|
||||
// Function prototype with default smooth setting
|
||||
void drawAnyArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_t startAngle, int32_t endAngle,
|
||||
uint32_t fg_color, uint32_t bg_color, bool smooth = true);
|
||||
|
||||
void drawAnyArc(int32_t x, int32_t y, int32_t r, int32_t ir, int32_t startAngle, int32_t endAngle,
|
||||
uint32_t fg_color, uint32_t bg_color, bool smooth)
|
||||
{
|
||||
if (endAngle > startAngle)
|
||||
{
|
||||
// Draw arc in single sweep
|
||||
tft.drawArc(x, y, r, ir, startAngle, endAngle, fg_color, bg_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Arc sweeps through 6 o'clock so draw in two parts
|
||||
tft.drawArc(x, y, r, ir, startAngle, 360, fg_color, bg_color);
|
||||
tft.drawArc(x, y, r, ir, 0, endAngle, fg_color, bg_color);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,98 @@
|
||||
// Example for drawSmoothCircle function. Which draws anti-aliased circles
|
||||
// The circle periphery has a "thickness" of ~3 pixles to minimise the
|
||||
// "braiding" effect present in narrow anti-aliased lines.
|
||||
|
||||
// For thicker or thinner circle outlines use the drawArc function.
|
||||
|
||||
#include <TFT_eSPI.h> // Include the graphics library
|
||||
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Setup
|
||||
// -------------------------------------------------------------------------
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
tft.init();
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Main loop
|
||||
// -------------------------------------------------------------------------
|
||||
void loop()
|
||||
{
|
||||
static uint32_t radius = 2;
|
||||
static uint32_t index = 0;
|
||||
|
||||
uint16_t fg_color = rainbow(index);
|
||||
uint16_t bg_color = TFT_BLACK; // This is the background colour used for smoothing (anti-aliasing)
|
||||
|
||||
uint16_t x = tft.width() / 2; // Position of centre of arc
|
||||
uint16_t y = tft.height() / 2;
|
||||
|
||||
tft.drawSmoothCircle(x, y, radius, fg_color, bg_color);
|
||||
|
||||
radius += 11;
|
||||
index += 5;
|
||||
index = index%192;
|
||||
|
||||
if (radius > tft.height()/2) {
|
||||
delay (1000);
|
||||
radius = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Return a 16 bit rainbow colour
|
||||
// -------------------------------------------------------------------------
|
||||
unsigned int rainbow(byte value)
|
||||
{
|
||||
// If 'value' is in the range 0-159 it is converted to a spectrum colour
|
||||
// from 0 = red through to 127 = blue to 159 = violet
|
||||
// Extending the range to 0-191 adds a further violet to red band
|
||||
|
||||
value = value%192;
|
||||
|
||||
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
|
||||
byte green = 0; // Green is the middle 6 bits, but only top 5 bits used here
|
||||
byte blue = 0; // Blue is the bottom 5 bits
|
||||
|
||||
byte sector = value >> 5;
|
||||
byte amplit = value & 0x1F;
|
||||
|
||||
switch (sector)
|
||||
{
|
||||
case 0:
|
||||
red = 0x1F;
|
||||
green = amplit; // Green ramps up
|
||||
blue = 0;
|
||||
break;
|
||||
case 1:
|
||||
red = 0x1F - amplit; // Red ramps down
|
||||
green = 0x1F;
|
||||
blue = 0;
|
||||
break;
|
||||
case 2:
|
||||
red = 0;
|
||||
green = 0x1F;
|
||||
blue = amplit; // Blue ramps up
|
||||
break;
|
||||
case 3:
|
||||
red = 0;
|
||||
green = 0x1F - amplit; // Green ramps down
|
||||
blue = 0x1F;
|
||||
break;
|
||||
case 4:
|
||||
red = amplit; // Red ramps up
|
||||
green = 0;
|
||||
blue = 0x1F;
|
||||
break;
|
||||
case 5:
|
||||
red = 0x1F;
|
||||
green = 0;
|
||||
blue = 0x1F - amplit; // Blue ramps down
|
||||
break;
|
||||
}
|
||||
return red << 11 | green << 6 | blue;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// Draw random coloured smooth (anti-aliased) rounded rectangles on the TFT
|
||||
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
void setup(void) {
|
||||
tft.init();
|
||||
tft.fillScreen(TFT_BLACK); // Background is black
|
||||
}
|
||||
|
||||
void loop() {
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(0, 0);
|
||||
|
||||
// Draw some random smooth rounded rectangles
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int radius = random(60);
|
||||
int w = random(2 * radius, 160);
|
||||
int h = random(2 * radius, 160);
|
||||
int t = random(1, radius / 3);
|
||||
int x = random(tft.width() - w);
|
||||
int y = random(tft.height() - h);
|
||||
|
||||
// Random colour is anti-aliased (blended) with background colour (black in this case)
|
||||
tft.drawSmoothRoundRect(x, y, radius, radius - t, w, h, random(0x10000), TFT_BLACK);
|
||||
}
|
||||
tft.print("Variable thickness");
|
||||
delay(2000);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(0, 0);
|
||||
|
||||
// Draw some random minimum thickness smooth rounded rectangles
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int radius = random(60);
|
||||
int w = random(2 * radius, 160);
|
||||
int h = random(2 * radius, 160);
|
||||
int t = 0;
|
||||
int x = random(tft.width() - w);
|
||||
int y = random(tft.height() - h);
|
||||
|
||||
// Random colour is anti-aliased (blended) with background colour (black in this case)
|
||||
tft.drawSmoothRoundRect(x, y, radius, radius - t, w, h, random(0x10000), TFT_BLACK);
|
||||
}
|
||||
tft.print("Minimum thickness");
|
||||
delay(2000);
|
||||
}
|
@ -58,25 +58,26 @@ void setup(void) {
|
||||
tft.init();
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.drawRect(0, 0, tft.width(), tft.height(), TFT_GREEN);
|
||||
|
||||
// Set "cursor" at top left corner of display (0,0) and select font 4
|
||||
tft.setCursor(0, 0, 4);
|
||||
tft.setCursor(0, 4, 4);
|
||||
|
||||
// Set the font colour to be white with a black background
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
|
||||
// We can now plot text on screen using the "print" class
|
||||
tft.println("Initialised default\n");
|
||||
tft.println("White text");
|
||||
tft.println(" Initialised default\n");
|
||||
tft.println(" White text");
|
||||
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.println("Red text");
|
||||
tft.setTextColor(TFT_RED);
|
||||
tft.println(" Red text");
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.println("Green text");
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.println(" Green text");
|
||||
|
||||
tft.setTextColor(TFT_BLUE, TFT_BLACK);
|
||||
tft.println("Blue text");
|
||||
tft.setTextColor(TFT_BLUE);
|
||||
tft.println(" Blue text");
|
||||
|
||||
delay(5000);
|
||||
|
||||
@ -87,22 +88,23 @@ void loop() {
|
||||
tft.invertDisplay( false ); // Where i is true or false
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.drawRect(0, 0, tft.width(), tft.height(), TFT_GREEN);
|
||||
|
||||
tft.setCursor(0, 0, 4);
|
||||
tft.setCursor(0, 4, 4);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.println("Invert OFF\n");
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.println(" Invert OFF\n");
|
||||
|
||||
tft.println("White text");
|
||||
tft.println(" White text");
|
||||
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.println("Red text");
|
||||
tft.setTextColor(TFT_RED);
|
||||
tft.println(" Red text");
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.println("Green text");
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.println(" Green text");
|
||||
|
||||
tft.setTextColor(TFT_BLUE, TFT_BLACK);
|
||||
tft.println("Blue text");
|
||||
tft.setTextColor(TFT_BLUE);
|
||||
tft.println(" Blue text");
|
||||
|
||||
delay(5000);
|
||||
|
||||
@ -111,22 +113,23 @@ void loop() {
|
||||
tft.invertDisplay( true ); // Where i is true or false
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.drawRect(0, 0, tft.width(), tft.height(), TFT_GREEN);
|
||||
|
||||
tft.setCursor(0, 0, 4);
|
||||
tft.setCursor(0, 4, 4);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.println("Invert ON\n");
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.println(" Invert ON\n");
|
||||
|
||||
tft.println("White text");
|
||||
tft.println(" White text");
|
||||
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.println("Red text");
|
||||
tft.setTextColor(TFT_RED);
|
||||
tft.println(" Red text");
|
||||
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.println("Green text");
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.println(" Green text");
|
||||
|
||||
tft.setTextColor(TFT_BLUE, TFT_BLACK);
|
||||
tft.println("Blue text");
|
||||
tft.setTextColor(TFT_BLUE);
|
||||
tft.println(" Blue text");
|
||||
|
||||
delay(5000);
|
||||
}
|
||||
|
@ -184,5 +184,5 @@ int8_t getPinName(int8_t pin)
|
||||
|
||||
if (user.esp == 0x32F) return pin;
|
||||
|
||||
return -1; // Invalid pin
|
||||
return pin; // Invalid pin
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TFT_eSPI",
|
||||
"version": "2.5.0",
|
||||
"version": "2.5.23",
|
||||
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
|
||||
"description": "A TFT and ePaper (SPI or parallel interface) graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32 processors",
|
||||
"repository":
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=TFT_eSPI
|
||||
version=2.5.0
|
||||
version=2.5.23
|
||||
author=Bodmer
|
||||
maintainer=Bodmer
|
||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||
paragraph=Supports TFT displays using drivers (ILI9341 etc) that operate with hardware SPI or 8 bit parallel.
|
||||
paragraph=Supports TFT displays using drivers (ILI9341 etc) that operate with hardware SPI or 8/16 bit parallel.
|
||||
category=Display
|
||||
url=https://github.com/Bodmer/TFT_eSPI
|
||||
architectures=*
|
||||
|
@ -105,7 +105,7 @@ and is compatible with the GNU GPL.
|
||||
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvStartvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
Software License Agreement (FreeBSD License)
|
||||
|
||||
Copyright (c) 2022 Bodmer (https://github.com/Bodmer)
|
||||
Copyright (c) 2023 Bodmer (https://github.com/Bodmer)
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -151,8 +151,8 @@ monitor_speed = 115200
|
||||
upload_speed = 115200
|
||||
|
||||
build_flags =
|
||||
-DBOARD_HAS_PSRAM
|
||||
-DNERMINER_T_QT=1
|
||||
-D BOARD_HAS_PSRAM
|
||||
-D NERMINER_T_QT=1
|
||||
|
||||
lib_deps =
|
||||
https://github.com/takkaO/OpenFontRender
|
||||
|
Loading…
Reference in New Issue
Block a user