mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2024-09-21 10:27:11 +00:00
Support for SSD1963 and ST7706 SPI read
The SSD1963 support has been tested with a 480x800 pixel display from Buy Display. Support for reading an ST7796 SPI display has been added. pushToSprite added to keywords list.
This commit is contained in:
parent
0c49b71dd4
commit
49cef1f35d
@ -457,7 +457,11 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
|||||||
if ( (color >> 8) == (color & 0x00FF) )
|
if ( (color >> 8) == (color & 0x00FF) )
|
||||||
{ if (!len) return;
|
{ if (!len) return;
|
||||||
tft_Write_16(color);
|
tft_Write_16(color);
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
while (--len) {WR_L; WR_H; WR_L; WR_H; WR_L; WR_H;}
|
||||||
|
#else
|
||||||
while (--len) {WR_L; WR_H; WR_L; WR_H;}
|
while (--len) {WR_L; WR_H; WR_L; WR_H;}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else while (len--) {tft_Write_16(color);}
|
else while (len--) {tft_Write_16(color);}
|
||||||
}
|
}
|
||||||
@ -649,8 +653,8 @@ extern "C" void dc_callback();
|
|||||||
|
|
||||||
void IRAM_ATTR dc_callback(spi_transaction_t *spi_tx)
|
void IRAM_ATTR dc_callback(spi_transaction_t *spi_tx)
|
||||||
{
|
{
|
||||||
if ((bool)spi_tx->user) DC_D;
|
if ((bool)spi_tx->user) {DC_D;}
|
||||||
else DC_C;
|
else {DC_C;}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
|
@ -84,24 +84,42 @@ void TFT_eSPI::end_SDA_Read(void)
|
|||||||
** Description: Write a block of pixels of the same colour
|
** Description: Write a block of pixels of the same colour
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||||
// Loop unrolling improves speed dramtically graphics test 0.634s => 0.374s
|
// Loop unrolling improves speed dramtically graphics test 0.634s => 0.374s
|
||||||
while (len>31) {
|
while (len>31) {
|
||||||
// 32D macro writes 16 bits twice
|
#if !defined (SSD1963_DRIVER)
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
// 32D macro writes 16 bits twice
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
len-=32;
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
}
|
#else
|
||||||
while (len>7) {
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
tft_Write_32D(color); tft_Write_32D(color);
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
len-=8;
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
}
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
|
#endif
|
||||||
|
len-=32;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (len>7) {
|
||||||
|
#if !defined (SSD1963_DRIVER)
|
||||||
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
|
tft_Write_32D(color); tft_Write_32D(color);
|
||||||
|
#else
|
||||||
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
|
tft_Write_16(color); tft_Write_16(color); tft_Write_16(color); tft_Write_16(color);
|
||||||
|
#endif
|
||||||
|
len-=8;
|
||||||
|
}
|
||||||
|
|
||||||
while (len--) {tft_Write_16(color);}
|
while (len--) {tft_Write_16(color);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,6 +411,31 @@
|
|||||||
GPIOB->BSRR = D3_BSR_MASK(C) | D4_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
GPIOB->BSRR = D3_BSR_MASK(C) | D4_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
||||||
WR_STB // Need to slow down strobe
|
WR_STB // Need to slow down strobe
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
|
||||||
|
// Write 18 bit color to TFT (untested)
|
||||||
|
#define tft_Write_16(C) uint8_t r = (((C) & 0xF800)>> 8); uint8_t g = (((C) & 0x07E0)>> 3); uint8_t b = (((C) & 0x001F)<< 3); \
|
||||||
|
GPIOA->BSRR = D0_BSR_MASK(r) | D2_BSR_MASK(r) | D7_BSR_MASK(r); \
|
||||||
|
WR_L; \
|
||||||
|
GPIOC->BSRR = D1_BSR_MASK(r); \
|
||||||
|
GPIOB->BSRR = D3_BSR_MASK(r) | D4_BSR_MASK(r) | D5_BSR_MASK(r) | D6_BSR_MASK(r); \
|
||||||
|
WR_STB; \
|
||||||
|
GPIOA->BSRR = D0_BSR_MASK(g) | D2_BSR_MASK(g) | D7_BSR_MASK(g); \
|
||||||
|
WR_L; \
|
||||||
|
GPIOC->BSRR = D1_BSR_MASK(g); \
|
||||||
|
GPIOB->BSRR = D3_BSR_MASK(g) | D4_BSR_MASK(g) | D5_BSR_MASK(g) | D6_BSR_MASK(g); \
|
||||||
|
WR_STB; \
|
||||||
|
GPIOA->BSRR = D0_BSR_MASK(b) | D2_BSR_MASK(b) | D7_BSR_MASK(b); \
|
||||||
|
WR_L; \
|
||||||
|
GPIOC->BSRR = D1_BSR_MASK(b); \
|
||||||
|
GPIOB->BSRR = D3_BSR_MASK(b) | D4_BSR_MASK(b) | D5_BSR_MASK(b) | D6_BSR_MASK(b); \
|
||||||
|
WR_STB // Need to slow down strobe
|
||||||
|
|
||||||
|
// 18 bit color write with swapped bytes
|
||||||
|
#define tft_Write_16S(C) uint16_t Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// Write 16 bits to TFT
|
// Write 16 bits to TFT
|
||||||
#define tft_Write_16(C) GPIOA->BSRR = D8_BSR_MASK(C) | D10_BSR_MASK(C) | D15_BSR_MASK(C); \
|
#define tft_Write_16(C) GPIOA->BSRR = D8_BSR_MASK(C) | D10_BSR_MASK(C) | D15_BSR_MASK(C); \
|
||||||
WR_L; \
|
WR_L; \
|
||||||
@ -434,6 +459,7 @@
|
|||||||
GPIOC->BSRR = D9_BSR_MASK(C); \
|
GPIOC->BSRR = D9_BSR_MASK(C); \
|
||||||
GPIOB->BSRR = D11_BSR_MASK(C) | D12_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
|
GPIOB->BSRR = D11_BSR_MASK(C) | D12_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
|
||||||
WR_STB
|
WR_STB
|
||||||
|
#endif
|
||||||
|
|
||||||
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
||||||
|
|
||||||
@ -527,6 +553,31 @@
|
|||||||
GPIOE->BSRR = D3_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
GPIOE->BSRR = D3_BSR_MASK(C) | D5_BSR_MASK(C) | D6_BSR_MASK(C); \
|
||||||
WR_STB
|
WR_STB
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
|
||||||
|
// Write 18 bit color to TFT (untested)
|
||||||
|
#define tft_Write_16(C) uint8_t r = (((C) & 0xF800)>> 8); uint8_t g = (((C) & 0x07E0)>> 3); uint8_t b = (((C) & 0x001F)<< 3); \
|
||||||
|
GPIOF->BSRR = D0_BSR_MASK(r) | D2_BSR_MASK(r) | D4_BSR_MASK(r) | D7_BSR_MASK(r); \
|
||||||
|
WR_L; \
|
||||||
|
GPIOD->BSRR = D1_BSR_MASK(r); \
|
||||||
|
GPIOE->BSRR = D3_BSR_MASK(r) | D5_BSR_MASK(r) | D6_BSR_MASK(r); \
|
||||||
|
WR_STB; \
|
||||||
|
GPIOF->BSRR = D0_BSR_MASK(g) | D2_BSR_MASK(g) | D4_BSR_MASK(g) | D7_BSR_MASK(g); \
|
||||||
|
WR_L; \
|
||||||
|
GPIOD->BSRR = D1_BSR_MASK(g); \
|
||||||
|
GPIOE->BSRR = D3_BSR_MASK(g) | D5_BSR_MASK(g) | D6_BSR_MASK(g); \
|
||||||
|
WR_STB; \
|
||||||
|
GPIOF->BSRR = D0_BSR_MASK(b) | D2_BSR_MASK(b) | D4_BSR_MASK(b) | D7_BSR_MASK(b); \
|
||||||
|
WR_L; \
|
||||||
|
GPIOD->BSRR = D1_BSR_MASK(b); \
|
||||||
|
GPIOE->BSRR = D3_BSR_MASK(b) | D5_BSR_MASK(b) | D6_BSR_MASK(b); \
|
||||||
|
WR_STB // Need to slow down strobe
|
||||||
|
|
||||||
|
// 18 bit color write with swapped bytes
|
||||||
|
#define tft_Write_16S(C) uint16_t Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// Write 16 bits to TFT
|
// Write 16 bits to TFT
|
||||||
#define tft_Write_16(C) GPIOF->BSRR = D8_BSR_MASK(C) | D10_BSR_MASK(C) | D12_BSR_MASK(C) | D15_BSR_MASK(C); \
|
#define tft_Write_16(C) GPIOF->BSRR = D8_BSR_MASK(C) | D10_BSR_MASK(C) | D12_BSR_MASK(C) | D15_BSR_MASK(C); \
|
||||||
WR_L; \
|
WR_L; \
|
||||||
@ -551,6 +602,8 @@
|
|||||||
GPIOE->BSRR = D11_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
|
GPIOE->BSRR = D11_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
|
||||||
WR_STB
|
WR_STB
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
||||||
|
|
||||||
#define tft_Write_32C(C,D) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(D))
|
#define tft_Write_32C(C,D) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(D))
|
||||||
@ -672,7 +725,20 @@
|
|||||||
|
|
||||||
// Write 8 bits to TFT
|
// Write 8 bits to TFT
|
||||||
#define tft_Write_8(C) GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C)); WR_L; WR_STB
|
#define tft_Write_8(C) GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C)); WR_L; WR_STB
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
|
||||||
|
// Write 18 bit color to TFT (untested)
|
||||||
|
#define tft_Write_16(C) uint8_t r = (((C) & 0xF800)>> 8); uint8_t g = (((C) & 0x07E0)>> 3); uint8_t b = (((C) & 0x001F)<< 3); \
|
||||||
|
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(r)); WR_L; WR_STB; \
|
||||||
|
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(g)); WR_L; WR_STB; \
|
||||||
|
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(b)); WR_L; WR_STB
|
||||||
|
|
||||||
|
// 18 bit color write with swapped bytes
|
||||||
|
#define tft_Write_16S(C) uint16_t Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// Write 16 bits to TFT
|
// Write 16 bits to TFT
|
||||||
#define tft_Write_16(C) GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB; \
|
#define tft_Write_16(C) GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB; \
|
||||||
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB
|
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB
|
||||||
@ -680,6 +746,7 @@
|
|||||||
// 16 bit write with swapped bytes
|
// 16 bit write with swapped bytes
|
||||||
#define tft_Write_16S(C) GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB; \
|
#define tft_Write_16S(C) GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB; \
|
||||||
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB
|
GPIOA->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB
|
||||||
|
#endif
|
||||||
|
|
||||||
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
||||||
|
|
||||||
@ -701,7 +768,20 @@
|
|||||||
|
|
||||||
// Write 8 bits to TFT
|
// Write 8 bits to TFT
|
||||||
#define tft_Write_8(C) GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C)); WR_L; WR_STB
|
#define tft_Write_8(C) GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C)); WR_L; WR_STB
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
|
||||||
|
// Write 18 bit color to TFT (untested)
|
||||||
|
#define tft_Write_16(C) uint8_t r = (((C) & 0xF800)>> 8); uint8_t g = (((C) & 0x07E0)>> 3); uint8_t b = (((C) & 0x001F)<< 3); \
|
||||||
|
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(r)); WR_L; WR_STB; \
|
||||||
|
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(g)); WR_L; WR_STB; \
|
||||||
|
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(b)); WR_L; WR_STB
|
||||||
|
|
||||||
|
// 18 bit color write with swapped bytes
|
||||||
|
#define tft_Write_16S(C) uint16_t Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// Write 16 bits to TFT
|
// Write 16 bits to TFT
|
||||||
#define tft_Write_16(C) GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB; \
|
#define tft_Write_16(C) GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB; \
|
||||||
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB
|
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB
|
||||||
@ -709,6 +789,7 @@
|
|||||||
// 16 bit write with swapped bytes
|
// 16 bit write with swapped bytes
|
||||||
#define tft_Write_16S(C) GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB; \
|
#define tft_Write_16S(C) GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>0)); WR_L; WR_STB; \
|
||||||
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB
|
GPIOB->BSRR = (0x00FF0000 | (uint8_t)(C>>8)); WR_L; WR_STB
|
||||||
|
#endif
|
||||||
|
|
||||||
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
||||||
|
|
||||||
@ -801,6 +882,46 @@
|
|||||||
D7_PIN_PORT->BSRR = D7_BSR_MASK(C); \
|
D7_PIN_PORT->BSRR = D7_BSR_MASK(C); \
|
||||||
WR_STB
|
WR_STB
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
|
||||||
|
// Write 18 bit color to TFT (untested)
|
||||||
|
#define tft_Write_16(C) uint8_t r = (((C) & 0xF800)>> 8); uint8_t g = (((C) & 0x07E0)>> 3); uint8_t b = (((C) & 0x001F)<< 3); \
|
||||||
|
D0_PIN_PORT->BSRR = D8_BSR_MASK(r); \
|
||||||
|
D1_PIN_PORT->BSRR = D9_BSR_MASK(r); \
|
||||||
|
D2_PIN_PORT->BSRR = D10_BSR_MASK(r); \
|
||||||
|
D3_PIN_PORT->BSRR = D11_BSR_MASK(r); \
|
||||||
|
WR_L; \
|
||||||
|
D4_PIN_PORT->BSRR = D12_BSR_MASK(r); \
|
||||||
|
D5_PIN_PORT->BSRR = D13_BSR_MASK(r); \
|
||||||
|
D6_PIN_PORT->BSRR = D14_BSR_MASK(r); \
|
||||||
|
D7_PIN_PORT->BSRR = D15_BSR_MASK(r); \
|
||||||
|
WR_STB;\
|
||||||
|
D0_PIN_PORT->BSRR = D8_BSR_MASK(g); \
|
||||||
|
D1_PIN_PORT->BSRR = D9_BSR_MASK(g); \
|
||||||
|
D2_PIN_PORT->BSRR = D10_BSR_MASK(g); \
|
||||||
|
D3_PIN_PORT->BSRR = D11_BSR_MASK(g); \
|
||||||
|
WR_L; \
|
||||||
|
D4_PIN_PORT->BSRR = D12_BSR_MASK(g); \
|
||||||
|
D5_PIN_PORT->BSRR = D13_BSR_MASK(g); \
|
||||||
|
D6_PIN_PORT->BSRR = D14_BSR_MASK(g); \
|
||||||
|
D7_PIN_PORT->BSRR = D15_BSR_MASK(g); \
|
||||||
|
WR_STB;\
|
||||||
|
D0_PIN_PORT->BSRR = D0_BSR_MASK(b); \
|
||||||
|
D1_PIN_PORT->BSRR = D1_BSR_MASK(b); \
|
||||||
|
D2_PIN_PORT->BSRR = D2_BSR_MASK(b); \
|
||||||
|
D3_PIN_PORT->BSRR = D3_BSR_MASK(b); \
|
||||||
|
WR_L; \
|
||||||
|
D4_PIN_PORT->BSRR = D4_BSR_MASK(b); \
|
||||||
|
D5_PIN_PORT->BSRR = D5_BSR_MASK(b); \
|
||||||
|
D6_PIN_PORT->BSRR = D6_BSR_MASK(b); \
|
||||||
|
D7_PIN_PORT->BSRR = D7_BSR_MASK(b); \
|
||||||
|
WR_STB
|
||||||
|
|
||||||
|
// 18 bit color write with swapped bytes
|
||||||
|
#define tft_Write_16S(C) uint16_t Cswap = ((C) >>8 | (C) << 8); tft_Write_16(Cswap)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// Write 16 bits to TFT
|
// Write 16 bits to TFT
|
||||||
#define tft_Write_16(C) D0_PIN_PORT->BSRR = D8_BSR_MASK(C); \
|
#define tft_Write_16(C) D0_PIN_PORT->BSRR = D8_BSR_MASK(C); \
|
||||||
D1_PIN_PORT->BSRR = D9_BSR_MASK(C); \
|
D1_PIN_PORT->BSRR = D9_BSR_MASK(C); \
|
||||||
@ -844,6 +965,7 @@
|
|||||||
D6_PIN_PORT->BSRR = D14_BSR_MASK(C); \
|
D6_PIN_PORT->BSRR = D14_BSR_MASK(C); \
|
||||||
D7_PIN_PORT->BSRR = D15_BSR_MASK(C); \
|
D7_PIN_PORT->BSRR = D15_BSR_MASK(C); \
|
||||||
WR_STB
|
WR_STB
|
||||||
|
#endif
|
||||||
|
|
||||||
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
#elif defined (SSD1963_800ALT_DRIVER)
|
#elif defined (SSD1963_800ALT_DRIVER)
|
||||||
#define TFT_WIDTH 480
|
#define TFT_WIDTH 480
|
||||||
#define TFT_HEIGHT 800
|
#define TFT_HEIGHT 800
|
||||||
|
#elif defined (SSD1963_800BD_DRIVER)
|
||||||
|
#define TFT_WIDTH 480
|
||||||
|
#define TFT_HEIGHT 800
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Set driver type common to all initialisation options
|
//Set driver type common to all initialisation options
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
writedata(0x01); //GPIO0 normal
|
writedata(0x01); //GPIO0 normal
|
||||||
|
|
||||||
writecommand(0x36); //rotation
|
writecommand(0x36); //rotation
|
||||||
writedata(0x2A);
|
writedata(0x21 | TFT_MAD_COLOR_ORDER);
|
||||||
|
|
||||||
writecommand(0xF0); //pixel data interface
|
writecommand(0xF0); //pixel data interface
|
||||||
writedata(0x00); //8 bit bus
|
writedata(0x00); //8 bit bus
|
||||||
@ -163,7 +163,7 @@
|
|||||||
writedata(0x01); //GPIO0 normal
|
writedata(0x01); //GPIO0 normal
|
||||||
|
|
||||||
writecommand(0x36); //rotation
|
writecommand(0x36); //rotation
|
||||||
writedata(0x2A);
|
writedata(0x21 | TFT_MAD_COLOR_ORDER);
|
||||||
|
|
||||||
writecommand(0xF0); //pixel data interface
|
writecommand(0xF0); //pixel data interface
|
||||||
writedata(0x00); //8 bit bus
|
writedata(0x00); //8 bit bus
|
||||||
@ -267,7 +267,7 @@
|
|||||||
writedata(0x01); //GPIO0 normal
|
writedata(0x01); //GPIO0 normal
|
||||||
|
|
||||||
writecommand(0x36); //rotation
|
writecommand(0x36); //rotation
|
||||||
writedata(0x22); // -- Set to 0x21 to rotate 180 degrees
|
writedata(0x21 | TFT_MAD_COLOR_ORDER); // -- Set rotation
|
||||||
|
|
||||||
writecommand(0xF0); //pixel data interface
|
writecommand(0xF0); //pixel data interface
|
||||||
writedata(0x00); //8 bit bus
|
writedata(0x00); //8 bit bus
|
||||||
@ -303,4 +303,96 @@
|
|||||||
|
|
||||||
writecommand(0x2C);
|
writecommand(0x2C);
|
||||||
|
|
||||||
|
#elif defined (SSD1963_800BD_DRIVER) // Copied from Buy Display code
|
||||||
|
|
||||||
|
writecommand(0xE2); //PLL multiplier, set PLL clock to 120M
|
||||||
|
writedata(0x23); //N=0x36 for 6.5M, 0x23 for 10M crystal
|
||||||
|
writedata(0x02);
|
||||||
|
writedata(0x54);
|
||||||
|
|
||||||
|
writecommand(0xE0); // PLL enable
|
||||||
|
writedata(0x01);
|
||||||
|
|
||||||
|
delay(10);
|
||||||
|
|
||||||
|
writecommand(0xE0);
|
||||||
|
writedata(0x03);
|
||||||
|
|
||||||
|
delay(10);
|
||||||
|
|
||||||
|
writecommand(0x01); // software reset
|
||||||
|
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
writecommand(0xE6); //PLL setting for PCLK, depends on resolution
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x33);
|
||||||
|
writedata(0x33);
|
||||||
|
|
||||||
|
writecommand(0xB0); //LCD SPECIFICATION
|
||||||
|
writedata(0x20);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(799 >> 8); //Set HDP 799
|
||||||
|
writedata(799 & 0xFF);
|
||||||
|
writedata(479 >> 8); //Set VDP 479
|
||||||
|
writedata(479 & 0xFF);
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(0xB4); //HSYNC
|
||||||
|
writedata(0x04); //Set HT
|
||||||
|
writedata(0x1F);
|
||||||
|
writedata(0x00); //Set HPS
|
||||||
|
writedata(0xD2);
|
||||||
|
writedata(0x00); //Set HPW
|
||||||
|
writedata(0x00); //Set LPS
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(0xB6); //VSYNC
|
||||||
|
writedata(0x02); //Set VT
|
||||||
|
writedata(0x0C);
|
||||||
|
writedata(0x00); //Set VPS
|
||||||
|
writedata(0x22);
|
||||||
|
writedata(0x00); //Set VPW
|
||||||
|
writedata(0x00); //Set FPS
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(0xB8);
|
||||||
|
writedata(0x0F); //GPIO3=input, GPIO[2:0]=output
|
||||||
|
writedata(0x01); //GPIO0 normal
|
||||||
|
|
||||||
|
writecommand(0xBA);
|
||||||
|
writedata(0x01); //GPIO[0] out 1 --- LCD display on/off control PIN
|
||||||
|
|
||||||
|
writecommand(0x36); //rotation
|
||||||
|
writedata(0x21 | TFT_MAD_COLOR_ORDER); //set to rotate
|
||||||
|
|
||||||
|
//writecommand(0x003A); //Set the current pixel format for RGB image data
|
||||||
|
//writedata(0x0050); //16-bit/pixel
|
||||||
|
|
||||||
|
writecommand(0xF0); //pixel data interface
|
||||||
|
writedata(0x00); //000 = 8 bit bus, 011 = 16 bit, 110 = 9 bit
|
||||||
|
|
||||||
|
writecommand(0xBC);
|
||||||
|
writedata(0x40); //contrast value
|
||||||
|
writedata(0x80); //brightness value
|
||||||
|
writedata(0x40); //saturation value
|
||||||
|
writedata(0x01); //Post Processor Enable
|
||||||
|
|
||||||
|
|
||||||
|
delay(10);
|
||||||
|
|
||||||
|
writecommand(0x29); //display on
|
||||||
|
|
||||||
|
writecommand(0xBE); //set PWM for B/L
|
||||||
|
writedata(0x06);
|
||||||
|
writedata(0x80);
|
||||||
|
writedata(0x01);
|
||||||
|
writedata(0xF0);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(0xD0);
|
||||||
|
writedata(0x0D);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,48 +1,27 @@
|
|||||||
|
|
||||||
// This is the command sequence that rotates the SSD1963 driver coordinate frame
|
// This is the command sequence that rotates the SSD1963 driver coordinate frame
|
||||||
|
|
||||||
rotation = m % 8; // Limit the range of values to 0-7
|
rotation = m % 4; // Limit the range of values to 0-3
|
||||||
|
|
||||||
writecommand(TFT_MADCTL);
|
writecommand(TFT_MADCTL);
|
||||||
switch (rotation) {
|
switch (rotation) {
|
||||||
case 0:
|
case 0:
|
||||||
writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER);
|
writedata(0x21 | TFT_MAD_COLOR_ORDER);
|
||||||
_width = _init_width;
|
_width = _init_width;
|
||||||
_height = _init_height;
|
_height = _init_height;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
writedata(0x00 | TFT_MAD_COLOR_ORDER);
|
||||||
_width = _init_height;
|
_width = _init_height;
|
||||||
_height = _init_width;
|
_height = _init_width;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
writedata(0x22 | TFT_MAD_COLOR_ORDER);
|
||||||
_width = _init_width;
|
_width = _init_width;
|
||||||
_height = _init_height;
|
_height = _init_height;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
writedata(0x03 | TFT_MAD_COLOR_ORDER);
|
||||||
_width = _init_height;
|
|
||||||
_height = _init_width;
|
|
||||||
break;
|
|
||||||
// These next rotations are for bottom up BMP drawing
|
|
||||||
case 4:
|
|
||||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
|
||||||
_width = _init_width;
|
|
||||||
_height = _init_height;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER);
|
|
||||||
_width = _init_height;
|
|
||||||
_height = _init_width;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
writedata(TFT_MAD_COLOR_ORDER);
|
|
||||||
_width = _init_width;
|
|
||||||
_height = _init_height;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
|
||||||
_width = _init_height;
|
_width = _init_height;
|
||||||
_height = _init_width;
|
_height = _init_width;
|
||||||
break;
|
break;
|
||||||
|
90
TFT_eSPI.cpp
90
TFT_eSPI.cpp
@ -105,6 +105,11 @@ inline void TFT_eSPI::end_tft_read(void){
|
|||||||
if(!inTransaction) {CS_H;}
|
if(!inTransaction) {CS_H;}
|
||||||
#endif
|
#endif
|
||||||
SET_BUS_WRITE_MODE;
|
SET_BUS_WRITE_MODE;
|
||||||
|
|
||||||
|
// The ST7796 appears to need a 4ms delay after a CGRAM read, otherwise subsequent writes will fail!
|
||||||
|
#ifdef ST7796_DRIVER
|
||||||
|
delay(4);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
@ -395,13 +400,7 @@ void TFT_eSPI::init(uint8_t tc)
|
|||||||
#elif defined (ST7789_2_DRIVER)
|
#elif defined (ST7789_2_DRIVER)
|
||||||
#include "TFT_Drivers/ST7789_2_Init.h"
|
#include "TFT_Drivers/ST7789_2_Init.h"
|
||||||
|
|
||||||
#elif defined (SSD1963_480_DRIVER)
|
#elif defined (SSD1963_DRIVER)
|
||||||
#include "TFT_Drivers/SSD1963_Init.h"
|
|
||||||
|
|
||||||
#elif defined (SSD1963_800_DRIVER)
|
|
||||||
#include "TFT_Drivers/SSD1963_Init.h"
|
|
||||||
|
|
||||||
#elif defined (SSD1963_800ALT_DRIVER)
|
|
||||||
#include "TFT_Drivers/SSD1963_Init.h"
|
#include "TFT_Drivers/SSD1963_Init.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -480,6 +479,9 @@ void TFT_eSPI::setRotation(uint8_t m)
|
|||||||
#elif defined (ST7789_2_DRIVER)
|
#elif defined (ST7789_2_DRIVER)
|
||||||
#include "TFT_Drivers/ST7789_2_Rotation.h"
|
#include "TFT_Drivers/ST7789_2_Rotation.h"
|
||||||
|
|
||||||
|
#elif defined (SSD1963_DRIVER)
|
||||||
|
#include "TFT_Drivers/SSD1963_Rotation.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delayMicroseconds(10);
|
delayMicroseconds(10);
|
||||||
@ -708,6 +710,8 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
bool wasInTransaction = inTransaction;
|
bool wasInTransaction = inTransaction;
|
||||||
if (inTransaction) { inTransaction= false; end_tft_write();}
|
if (inTransaction) { inTransaction= false; end_tft_write();}
|
||||||
|
|
||||||
|
uint16_t color = 0;
|
||||||
|
|
||||||
begin_tft_read();
|
begin_tft_read();
|
||||||
|
|
||||||
readAddrWindow(x0, y0, 1, 1); // Sets CS low
|
readAddrWindow(x0, y0, 1, 1); // Sets CS low
|
||||||
@ -721,11 +725,18 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
|
|
||||||
//#if !defined (ILI9488_DRIVER)
|
//#if !defined (ILI9488_DRIVER)
|
||||||
|
|
||||||
// Read the 3 RGB bytes, colour is actually only in the top 6 bits of each byte
|
#if defined (ST7796_DRIVER)
|
||||||
// as the TFT stores colours as 18 bits
|
// Read the 2 bytes
|
||||||
uint8_t r = tft_Read_8();
|
color = ((tft_Read_8()) << 8) | (tft_Read_8());
|
||||||
uint8_t g = tft_Read_8();
|
#else
|
||||||
uint8_t b = tft_Read_8();
|
// 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
|
||||||
|
uint8_t r = tft_Read_8();
|
||||||
|
uint8_t g = tft_Read_8();
|
||||||
|
uint8_t b = tft_Read_8();
|
||||||
|
color = color565(r, g, b);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -734,6 +745,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
uint8_t r = (tft_Read_8()&0x7E)<<1;
|
uint8_t r = (tft_Read_8()&0x7E)<<1;
|
||||||
uint8_t g = (tft_Read_8()&0x7E)<<1;
|
uint8_t g = (tft_Read_8()&0x7E)<<1;
|
||||||
uint8_t b = (tft_Read_8()&0x7E)<<1;
|
uint8_t b = (tft_Read_8()&0x7E)<<1;
|
||||||
|
color = color565(r, g, b);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
@ -748,7 +760,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
// Reinstate the transaction if one was in progress
|
// Reinstate the transaction if one was in progress
|
||||||
if(wasInTransaction) { begin_tft_write(); inTransaction = true; }
|
if(wasInTransaction) { begin_tft_write(); inTransaction = true; }
|
||||||
|
|
||||||
return color565(r, g, b);
|
return color;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -815,6 +827,8 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
|||||||
|
|
||||||
#else // SPI interface
|
#else // SPI interface
|
||||||
|
|
||||||
|
uint16_t color = 0;
|
||||||
|
|
||||||
begin_tft_read();
|
begin_tft_read();
|
||||||
|
|
||||||
readAddrWindow(x, y, w, h);
|
readAddrWindow(x, y, w, h);
|
||||||
@ -830,29 +844,35 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
|||||||
uint32_t len = w * h;
|
uint32_t len = w * h;
|
||||||
while (len--) {
|
while (len--) {
|
||||||
|
|
||||||
#if !defined (ILI9488_DRIVER)
|
#if !defined (ILI9488_DRIVER)
|
||||||
|
|
||||||
// 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
|
|
||||||
uint8_t r = tft_Read_8();
|
|
||||||
uint8_t g = tft_Read_8();
|
|
||||||
uint8_t b = tft_Read_8();
|
|
||||||
|
|
||||||
|
#if defined (ST7796_DRIVER)
|
||||||
|
// Read the 2 bytes
|
||||||
|
color = ((tft_Read_8()) << 8) | (tft_Read_8());
|
||||||
#else
|
#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
|
||||||
|
uint8_t r = tft_Read_8();
|
||||||
|
uint8_t g = tft_Read_8();
|
||||||
|
uint8_t b = tft_Read_8();
|
||||||
|
color = color565(r, g, b);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// The 6 colour bits are in MS 6 bits of each byte but we do not include the extra clock pulse
|
// The 6 colour bits are in MS 6 bits of each byte but we do not include the extra clock pulse
|
||||||
// so we use a trick and mask the middle 6 bits of the byte, then only shift 1 place left
|
// so we use a trick and mask the middle 6 bits of the byte, then only shift 1 place left
|
||||||
uint8_t r = (tft_Read_8()&0x7E)<<1;
|
uint8_t r = (tft_Read_8()&0x7E)<<1;
|
||||||
uint8_t g = (tft_Read_8()&0x7E)<<1;
|
uint8_t g = (tft_Read_8()&0x7E)<<1;
|
||||||
uint8_t b = (tft_Read_8()&0x7E)<<1;
|
uint8_t b = (tft_Read_8()&0x7E)<<1;
|
||||||
|
color = color565(r, g, b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Swapped colour byte order for compatibility with pushRect()
|
// Swapped colour byte order for compatibility with pushRect()
|
||||||
*data++ = (r & 0xF8) | (g & 0xE0) >> 5 | (b & 0xF8) << 5 | (g & 0x1C) << 11;
|
*data++ = color << 8 | color >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
CS_H;
|
//CS_H;
|
||||||
|
|
||||||
#ifdef TFT_SDA_READ
|
#ifdef TFT_SDA_READ
|
||||||
end_SDA_Read();
|
end_SDA_Read();
|
||||||
@ -2620,6 +2640,10 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
|||||||
{
|
{
|
||||||
//begin_tft_write(); // Must be called before setWindow
|
//begin_tft_write(); // Must be called before setWindow
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
if ((rotation & 0x1) == 0) { swap_coord(x0, y0); swap_coord(x1, y1); }
|
||||||
|
#endif
|
||||||
|
|
||||||
addr_row = 0xFFFF;
|
addr_row = 0xFFFF;
|
||||||
addr_col = 0xFFFF;
|
addr_col = 0xFFFF;
|
||||||
|
|
||||||
@ -2662,6 +2686,10 @@ void TFT_eSPI::readAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h)
|
|||||||
ye += rowstart;
|
ye += rowstart;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
if ((rotation & 0x1) == 0) { swap_coord(xs, ys); swap_coord(xe, ye); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Column addr set
|
// Column addr set
|
||||||
DC_C; tft_Write_8(TFT_CASET);
|
DC_C; tft_Write_8(TFT_CASET);
|
||||||
DC_D; tft_Write_32C(xs, xe);
|
DC_D; tft_Write_32C(xs, xe);
|
||||||
@ -2693,6 +2721,10 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
|||||||
y+=rowstart;
|
y+=rowstart;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
if ((rotation & 0x1) == 0) { swap_coord(x, y); }
|
||||||
|
#endif
|
||||||
|
|
||||||
begin_tft_write();
|
begin_tft_write();
|
||||||
|
|
||||||
#ifdef MULTI_TFT_SUPPORT
|
#ifdef MULTI_TFT_SUPPORT
|
||||||
@ -3769,11 +3801,11 @@ int16_t TFT_eSPI::drawString(const char *string, int32_t poX, int32_t poY, uint8
|
|||||||
padding += 2;
|
padding += 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Check coordinates are OK, adjust if not
|
/* // Check coordinates are OK, adjust if not
|
||||||
if (poX < 0) poX = 0;
|
if (poX < 0) poX = 0;
|
||||||
if (poX+cwidth > width()) poX = width() - cwidth;
|
if (poX+cwidth > width()) poX = width() - cwidth;
|
||||||
if (poY < 0) poY = 0;
|
if (poY < 0) poY = 0;
|
||||||
if (poY+cheight-baseline> height()) poY = height() - cheight;
|
if (poY+cheight-baseline> height()) poY = height() - cheight; //*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3851,9 +3883,8 @@ int16_t TFT_eSPI::drawString(const char *string, int32_t poX, int32_t poY, uint8
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fillRect(padXc,poY,(padX-cwidth)>>1,cheight, textbgcolor);
|
fillRect(padXc,poY,(padX-cwidth)>>1,cheight, textbgcolor);
|
||||||
padXc = (padX-cwidth)>>1;
|
padXc = poX - ((padX-cwidth)>>1);
|
||||||
if (padXc>poX) padXc = poX;
|
fillRect(padXc,poY,(padX-cwidth)>>1,cheight, textbgcolor);
|
||||||
fillRect(poX - padXc,poY,(padX-cwidth)>>1,cheight, textbgcolor);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (padXc>padX) padXc = padX;
|
if (padXc>padX) padXc = padX;
|
||||||
@ -3882,7 +3913,6 @@ int16_t TFT_eSPI::drawString(const char *string, int32_t poX, int32_t poY, uint8
|
|||||||
case 2:
|
case 2:
|
||||||
drawRect(padXc,poY,(padX-sumX)>>1, cheight, TFT_WHITE);
|
drawRect(padXc,poY,(padX-sumX)>>1, cheight, TFT_WHITE);
|
||||||
padXc = (padX-sumX)>>1;
|
padXc = (padX-sumX)>>1;
|
||||||
if (padXc>poX) padXc = poX;
|
|
||||||
drawRect(poX - padXc,poY,(padX-sumX)>>1,cheight, TFT_WHITE);
|
drawRect(poX - padXc,poY,(padX-sumX)>>1,cheight, TFT_WHITE);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#ifndef _TFT_eSPIH_
|
#ifndef _TFT_eSPIH_
|
||||||
#define _TFT_eSPIH_
|
#define _TFT_eSPIH_
|
||||||
|
|
||||||
#define TFT_ESPI_VERSION "2.2.20"
|
#define TFT_ESPI_VERSION "2.2.21"
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Section 1: Load required header files
|
** Section 1: Load required header files
|
||||||
@ -578,7 +578,7 @@ class TFT_eSPI : public Print {
|
|||||||
uint32_t alphaBlend24(uint8_t alpha, uint32_t fgc, uint32_t bgc, uint8_t dither = 0);
|
uint32_t alphaBlend24(uint8_t alpha, uint32_t fgc, uint32_t bgc, uint8_t dither = 0);
|
||||||
|
|
||||||
|
|
||||||
// DMA support functions - these are currently just for SPI writes whe using the STM32 processors
|
// DMA support functions - these are currently just for SPI writes when using the ESP32 or STM32 processors
|
||||||
// Bear in mind DMA will only be of benefit in particular circumstances and can be tricky
|
// Bear in mind DMA will only be of benefit in particular circumstances and can be tricky
|
||||||
// to manage by noobs. The functions have however been designed to be noob friendly and
|
// to manage by noobs. The functions have however been designed to be noob friendly and
|
||||||
// avoid a few DMA behaviour "gotchas".
|
// avoid a few DMA behaviour "gotchas".
|
||||||
@ -593,7 +593,7 @@ class TFT_eSPI : public Print {
|
|||||||
// processor leaves a function or its content being changed while the DMA engine is reading it.
|
// processor leaves a function or its content being changed while the DMA engine is reading it.
|
||||||
//
|
//
|
||||||
// The compiler MAY change the implied scope of a buffer which has been set aside by creating
|
// The compiler MAY change the implied scope of a buffer which has been set aside by creating
|
||||||
// and an array. For example a buffer defined before a "for-next" loop may get de-allocated when
|
// an array. For example a buffer defined before a "for-next" loop may get de-allocated when
|
||||||
// the loop ends. To avoid this use, for example, malloc() and free() to take control of when
|
// the loop ends. To avoid this use, for example, malloc() and free() to take control of when
|
||||||
// the buffer space is available and ensure it is not released until DMA is complete.
|
// the buffer space is available and ensure it is not released until DMA is complete.
|
||||||
//
|
//
|
||||||
@ -608,7 +608,7 @@ class TFT_eSPI : public Print {
|
|||||||
|
|
||||||
// Push an image to the TFT using DMA, buffer is optional and grabs (double buffers) a copy of the image
|
// Push an image to the TFT using DMA, buffer is optional and grabs (double buffers) a copy of the image
|
||||||
// Use the buffer if the image data will get over-written or destroyed while DMA is in progress
|
// Use the buffer if the image data will get over-written or destroyed while DMA is in progress
|
||||||
// If swapping colour bytes is defined, and the double buffer option is NOT used then the bytes
|
// If swapping colour bytes is defined, and the double buffer option is NOT used, then the bytes
|
||||||
// in the original data image will be swapped by the function before DMA is initiated.
|
// in the original data image will be swapped by the function before DMA is initiated.
|
||||||
// The function will wait for the last DMA to complete if it is called while a previous DMA is still
|
// The function will wait for the last DMA to complete if it is called while a previous DMA is still
|
||||||
// in progress, this simplifies the sketch and helps avoid "gotchas".
|
// in progress, this simplifies the sketch and helps avoid "gotchas".
|
||||||
|
@ -72,6 +72,8 @@
|
|||||||
//#include <User_Setups/Setup44_TTGO_CameraPlus.h> // Setup file for ESP32 and TTGO T-CameraPlus ST7789 SPI bus TFT 240x240
|
//#include <User_Setups/Setup44_TTGO_CameraPlus.h> // Setup file for ESP32 and TTGO T-CameraPlus ST7789 SPI bus TFT 240x240
|
||||||
//#include <User_Setups/Setup45_TTGO_T_Watch.h> // Setup file for ESP32 and TTGO T-Watch ST7789 SPI bus TFT 240x240
|
//#include <User_Setups/Setup45_TTGO_T_Watch.h> // Setup file for ESP32 and TTGO T-Watch ST7789 SPI bus TFT 240x240
|
||||||
|
|
||||||
|
//#include <User_Setups/Setup50_SSD1963_Parallel.h> // Setup file for ESP32 and SSD1963 TFT display
|
||||||
|
|
||||||
//#include <User_Setups/Setup135_ST7789.h> // Setup file for ESP8266 and ST7789 135 x 240 TFT
|
//#include <User_Setups/Setup135_ST7789.h> // Setup file for ESP8266 and ST7789 135 x 240 TFT
|
||||||
|
|
||||||
//#include <User_Setups/SetupX_Template.h>
|
//#include <User_Setups/SetupX_Template.h>
|
||||||
@ -161,6 +163,9 @@
|
|||||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||||
#define TFT_DRIVER 0x1963
|
#define TFT_DRIVER 0x1963
|
||||||
#elif defined (SSD1963_800ALT_DRIVER)
|
#elif defined (SSD1963_800ALT_DRIVER)
|
||||||
|
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||||
|
#define TFT_DRIVER 0x1963
|
||||||
|
#elif defined (SSD1963_800BD_DRIVER)
|
||||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||||
#define TFT_DRIVER 0x1963
|
#define TFT_DRIVER 0x1963
|
||||||
// <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
// <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// See SetupX_Template.h for all options available
|
// See SetupX_Template.h for all options available
|
||||||
|
|
||||||
#define ESP32_PARALLEL
|
#define TFT_PARALLEL_8_BIT
|
||||||
|
|
||||||
|
|
||||||
#define ILI9341_DRIVER
|
#define ILI9341_DRIVER
|
||||||
|
@ -23,17 +23,35 @@
|
|||||||
// - Arduino SCK to TFT SCK
|
// - Arduino SCK to TFT SCK
|
||||||
// - Arduino MOSI to TFT SDI(may be marked SDA or MOSI)
|
// - Arduino MOSI to TFT SDI(may be marked SDA or MOSI)
|
||||||
// Typical Arduino SPI port 1 pins are (SCK=D13, MISO=D12, MOSI=D11) this is port pins PA5, PA6 and PA7 on Nucleo-F767ZI
|
// Typical Arduino SPI port 1 pins are (SCK=D13, MISO=D12, MOSI=D11) this is port pins PA5, PA6 and PA7 on Nucleo-F767ZI
|
||||||
// SPI port 2 pins are (SCK=D18, MISO=A7, MOSI=D17) this is typically port pins PB13, PB14 and PB15
|
// SPI port 2 pins are (SCK=D18, MISO=A7, MOSI=D17) this is port pins PB13, PC2 and PB15 on Nucleo-F767ZI
|
||||||
|
|
||||||
|
/*
|
||||||
#define TFT_SPI_PORT 1 // SPI 1 maximum clock rate is 55MHz
|
#define TFT_SPI_PORT 1 // SPI 1 maximum clock rate is 55MHz
|
||||||
#define TFT_MOSI PA7
|
#define TFT_MOSI PA7
|
||||||
#define TFT_MISO PA6
|
#define TFT_MISO PA6
|
||||||
#define TFT_SCLK PA5
|
#define TFT_SCLK PA5
|
||||||
|
//*/
|
||||||
|
|
||||||
//#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
/*
|
||||||
//#define TFT_MOSI PB15
|
#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
||||||
//#define TFT_MISO PB14
|
#define TFT_MOSI D17
|
||||||
//#define TFT_SCLK PB13
|
#define TFT_MISO A7
|
||||||
|
#define TFT_SCLK D18
|
||||||
|
//*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
||||||
|
#define TFT_MOSI PB15
|
||||||
|
#define TFT_MISO PC2
|
||||||
|
#define TFT_SCLK PB13
|
||||||
|
//*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define TFT_SPI_PORT 2 // SPI 2 maximum clock rate is 27MHz
|
||||||
|
#define TFT_MOSI PB15
|
||||||
|
#define TFT_MISO PB14
|
||||||
|
#define TFT_SCLK PB13
|
||||||
|
//*/
|
||||||
|
|
||||||
// Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select
|
// Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select
|
||||||
#define TFT_CS D5 // Chip select control pin to TFT CS
|
#define TFT_CS D5 // Chip select control pin to TFT CS
|
||||||
@ -63,7 +81,7 @@
|
|||||||
// STM32 support for smooth fonts via program memory (FLASH) arrays
|
// STM32 support for smooth fonts via program memory (FLASH) arrays
|
||||||
#define SMOOTH_FONT
|
#define SMOOTH_FONT
|
||||||
|
|
||||||
|
|
||||||
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc
|
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc
|
||||||
|
|
||||||
#define SPI_FREQUENCY 27000000 // 27MHz SPI clock
|
#define SPI_FREQUENCY 27000000 // 27MHz SPI clock
|
||||||
|
92
User_Setups/Setup50_SSD1963_Parallel.h
Normal file
92
User_Setups/Setup50_SSD1963_Parallel.h
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
// USER DEFINED SETTINGS
|
||||||
|
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||||
|
//
|
||||||
|
// See the User_Setup_Select.h file if you wish to be able to define multiple
|
||||||
|
// setups and then easily select which setup file is used by the compiler.
|
||||||
|
//
|
||||||
|
// If this file is edited correctly then all the library example sketches should
|
||||||
|
// run without the need to make any more changes for a particular hardware setup!
|
||||||
|
|
||||||
|
// ##################################################################################
|
||||||
|
//
|
||||||
|
// Section 0. Call up the right driver file and any options for it
|
||||||
|
//
|
||||||
|
// ##################################################################################
|
||||||
|
|
||||||
|
// Use ESP32 Parallel interface
|
||||||
|
#define TFT_PARALLEL_8_BIT
|
||||||
|
|
||||||
|
// Only define one driver, the other ones must be commented out
|
||||||
|
//#define SSD1963_480_DRIVER // 272 x 480 display
|
||||||
|
//#define SSD1963_800_DRIVER // 480 x 800 display
|
||||||
|
//#define SSD1963_800ALT_DRIVER // Alternative 480 x 800 display
|
||||||
|
#define SSD1963_800BD_DRIVER // 480 x 800 displau sourced from https://www.buydisplay.com/7-tft-screen-touch-lcd-display-module-w-ssd1963-controller-board-mcu
|
||||||
|
|
||||||
|
// ##################################################################################
|
||||||
|
//
|
||||||
|
// Section 1. Define the pins that are used to interface with the display here
|
||||||
|
//
|
||||||
|
// ##################################################################################
|
||||||
|
|
||||||
|
// ESP32 pins used
|
||||||
|
#define TFT_CS 33 // Chip select control pin
|
||||||
|
#define TFT_DC 15 // Data Command control pin - must use a pin in the range 0-31
|
||||||
|
#define TFT_RST 32 // Reset pin
|
||||||
|
|
||||||
|
#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31
|
||||||
|
#define TFT_RD 2
|
||||||
|
|
||||||
|
#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus
|
||||||
|
#define TFT_D1 13 // so a single register write sets/clears all bits
|
||||||
|
#define TFT_D2 26
|
||||||
|
#define TFT_D3 25
|
||||||
|
#define TFT_D4 17
|
||||||
|
#define TFT_D5 16
|
||||||
|
#define TFT_D6 27
|
||||||
|
#define TFT_D7 14
|
||||||
|
|
||||||
|
// ##################################################################################
|
||||||
|
//
|
||||||
|
// Section 2. Define the way the DC and/or CS lines are driven (ESP8266 only)
|
||||||
|
//
|
||||||
|
// ##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
// ##################################################################################
|
||||||
|
//
|
||||||
|
// Section 3. Define the fonts that are to be used here
|
||||||
|
//
|
||||||
|
// ##################################################################################
|
||||||
|
|
||||||
|
// Comment out the #defines below with // to stop that font being loaded
|
||||||
|
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
|
||||||
|
// normally necessary. If all fonts are loaded the extra FLASH space required is
|
||||||
|
// about 17Kbytes. To save FLASH space only enable the fonts you need!
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
// ##################################################################################
|
||||||
|
//
|
||||||
|
// Section 4. Not used
|
||||||
|
//
|
||||||
|
// ##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
// ##################################################################################
|
||||||
|
//
|
||||||
|
// Section 5. Other options
|
||||||
|
//
|
||||||
|
// ##################################################################################
|
||||||
|
|
||||||
|
|
@ -157,6 +157,7 @@ getPivotX KEYWORD2
|
|||||||
getPivotY KEYWORD2
|
getPivotY KEYWORD2
|
||||||
getRotatedBounds KEYWORD2
|
getRotatedBounds KEYWORD2
|
||||||
readPixelValue KEYWORD2
|
readPixelValue KEYWORD2
|
||||||
|
pushToSprite KEYWORD2
|
||||||
drawGlyph KEYWORD2
|
drawGlyph KEYWORD2
|
||||||
printToSprite KEYWORD2
|
printToSprite KEYWORD2
|
||||||
pushSprite KEYWORD2
|
pushSprite KEYWORD2
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "2.2.20",
|
"version": "2.2.21",
|
||||||
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
|
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
|
||||||
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
|
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
|
||||||
"repository":
|
"repository":
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=2.2.20
|
version=2.2.21
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
|
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
|
||||||
|
Loading…
Reference in New Issue
Block a user