[wip] add esp32-c3 support
This commit is contained in:
parent
a2140a4d04
commit
ac1b1dd1e2
|
|
@ -213,7 +213,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
/*
|
/*
|
||||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||||
|
|
||||||
uint32_t color32 = (color<<8 | color >>8)<<16 | (color<<8 | color >>8);
|
uint32_t color32 = (color<<8 | color >>8)<<16 | (color<<8 | color >>8);
|
||||||
bool empty = true;
|
bool empty = true;
|
||||||
volatile uint32_t* spi_w = (volatile uint32_t*)_spi_w;
|
volatile uint32_t* spi_w = (volatile uint32_t*)_spi_w;
|
||||||
|
|
@ -262,7 +262,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||||
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||||
|
|
||||||
volatile uint32_t* spi_w = _spi_w;
|
volatile uint32_t* spi_w = _spi_w;
|
||||||
uint32_t color32 = (color<<8 | color >>8)<<16 | (color<<8 | color >>8);
|
uint32_t color32 = (color<<8 | color >>8)<<16 | (color<<8 | color >>8);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
uint32_t rem = len & 0x1F;
|
uint32_t rem = len & 0x1F;
|
||||||
len = len - rem;
|
len = len - rem;
|
||||||
|
|
@ -287,7 +287,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){
|
||||||
{
|
{
|
||||||
while (*_spi_cmd&SPI_USR);
|
while (*_spi_cmd&SPI_USR);
|
||||||
*_spi_cmd = SPI_USR;
|
*_spi_cmd = SPI_USR;
|
||||||
len -= 32;
|
len -= 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not wait here
|
// Do not wait here
|
||||||
|
|
@ -315,7 +315,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){
|
||||||
data+=4;
|
data+=4;
|
||||||
}
|
}
|
||||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), color[0]);
|
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), color[0]);
|
||||||
WRITE_PERI_REG(SPI_W1_REG(SPI_PORT), color[1]);
|
WRITE_PERI_REG(SPI_W1_REG(SPI_PORT), color[1]);
|
||||||
WRITE_PERI_REG(SPI_W2_REG(SPI_PORT), color[2]);
|
WRITE_PERI_REG(SPI_W2_REG(SPI_PORT), color[2]);
|
||||||
WRITE_PERI_REG(SPI_W3_REG(SPI_PORT), color[3]);
|
WRITE_PERI_REG(SPI_W3_REG(SPI_PORT), color[3]);
|
||||||
|
|
@ -346,7 +346,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){
|
||||||
}
|
}
|
||||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
while (READ_PERI_REG(SPI_CMD_REG(SPI_PORT))&SPI_USR);
|
||||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), 255);
|
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_PORT), 255);
|
||||||
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), color[0]);
|
WRITE_PERI_REG(SPI_W0_REG(SPI_PORT), color[0]);
|
||||||
WRITE_PERI_REG(SPI_W1_REG(SPI_PORT), color[1]);
|
WRITE_PERI_REG(SPI_W1_REG(SPI_PORT), color[1]);
|
||||||
WRITE_PERI_REG(SPI_W2_REG(SPI_PORT), color[2]);
|
WRITE_PERI_REG(SPI_W2_REG(SPI_PORT), color[2]);
|
||||||
WRITE_PERI_REG(SPI_W3_REG(SPI_PORT), color[3]);
|
WRITE_PERI_REG(SPI_W3_REG(SPI_PORT), color[3]);
|
||||||
|
|
@ -832,5 +832,5 @@ void TFT_eSPI::deInitDMA(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
#endif // End of DMA FUNCTIONS
|
#endif // End of DMA FUNCTIONS
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ HSPI = 2, uses SPI3
|
||||||
VSPI not defined
|
VSPI not defined
|
||||||
|
|
||||||
ESP32 C3:
|
ESP32 C3:
|
||||||
FSPI = 0, uses SPI2 ???? To be checked
|
FSPI = 0, uses SPI2
|
||||||
HSPI = 1, uses SPI3 ???? To be checked
|
HSPI = 1, uses SPI2
|
||||||
VSPI not defined
|
VSPI not defined
|
||||||
|
|
||||||
For ESP32/S2/C3:
|
For ESP32/S2/C3:
|
||||||
|
|
@ -61,13 +61,21 @@ SPI3_HOST = 2
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
#define SPI_PORT HSPI //HSPI is port 2 on ESP32
|
#define SPI_PORT HSPI //HSPI is port 2 on ESP32
|
||||||
#else
|
#else
|
||||||
#define SPI_PORT 3 //HSPI is port 3 on ESP32 S2
|
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
#define SPI_PORT 2 //HSPI is port 1 on the ESP32 c3
|
||||||
|
#else
|
||||||
|
#define SPI_PORT 3 //HSPI is port 3 on ESP32 S2
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
#define SPI_PORT VSPI
|
#define SPI_PORT VSPI
|
||||||
#else
|
#else
|
||||||
#define SPI_PORT 2 //FSPI(ESP32 S2)
|
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
#define SPI_PORT 2 //FSPI(ESP32 C3)
|
||||||
|
#else
|
||||||
|
#define SPI_PORT 2 //FSPI(ESP32 S2)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -322,7 +330,7 @@ SPI3_HOST = 2
|
||||||
|
|
||||||
// Create a bit set lookup table for data bus - wastes 1kbyte of RAM but speeds things up dramatically
|
// Create a bit set lookup table for data bus - wastes 1kbyte of RAM but speeds things up dramatically
|
||||||
// can then use e.g. GPIO.out_w1ts = set_mask(0xFF); to set data bus to 0xFF
|
// can then use e.g. GPIO.out_w1ts = set_mask(0xFF); to set data bus to 0xFF
|
||||||
#define PARALLEL_INIT_TFT_DATA_BUS \
|
#define CONSTRUCTOR_INIT_TFT_DATA_BUS \
|
||||||
for (int32_t c = 0; c<256; c++) \
|
for (int32_t c = 0; c<256; c++) \
|
||||||
{ \
|
{ \
|
||||||
xset_mask[c] = 0; \
|
xset_mask[c] = 0; \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue