mirror of https://github.com/arendst/Tasmota.git
Add support for SPI display driver for ST7789 TFT
Add support for SPI display driver for ST7789 TFT by Gerhard Mutz (#9037)
This commit is contained in:
parent
fc93b05476
commit
54c1a2d029
|
@ -201,9 +201,10 @@
|
|||
| USE_DISPLAY_ILI9341 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_EPAPER_29 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_EPAPER_42 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_ILI9488 | - | - | - | - | - | - | - |
|
||||
| USE_DISPLAY_SSD1351 | - | - | - | - | - | - | - |
|
||||
| USE_DISPLAY_RA8876 | - | - | - | - | - | - | - |
|
||||
| USE_DISPLAY_ILI9488 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_SSD1351 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_RA8876 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_ST7789 | - | - | - | - | - | - | x |
|
||||
|
||||
## Additional Features and Sensors on ESP32
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file.
|
|||
- Support for Afrikaans language translations by Christiaan Heerze
|
||||
- Support for IR inverted leds using ``#define IR_SEND_INVERTED true`` (#10301)
|
||||
- Support for disabling 38kHz IR modulation using ``#define IR_SEND_USE_MODULATION false`` (#10301)
|
||||
- Support for SPI display driver for ST7789 TFT by Gerhard Mutz (#9037)
|
||||
|
||||
### Changed
|
||||
- Logging from heap to stack freeing 700 bytes RAM
|
||||
|
|
|
@ -70,6 +70,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||
- Support for Afrikaans language translations by Christiaan Heerze
|
||||
- Support for IR inverted leds using ``#define IR_SEND_INVERTED true`` [#10301](https://github.com/arendst/Tasmota/issues/10301)
|
||||
- Support for disabling 38kHz IR modulation using ``#define IR_SEND_USE_MODULATION false`` [#10301](https://github.com/arendst/Tasmota/issues/10301)
|
||||
- Support for SPI display driver for ST7789 TFT by Gerhard Mutz [#9037](https://github.com/arendst/Tasmota/issues/9037)
|
||||
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin [#8630](https://github.com/arendst/Tasmota/issues/8630)
|
||||
|
||||
### Breaking Changed
|
||||
|
|
|
@ -626,8 +626,9 @@
|
|||
// #define USE_DISPLAY_EPAPER_29 // [DisplayModel 5] Enable e-paper 2.9 inch display (+19k code)
|
||||
// #define USE_DISPLAY_EPAPER_42 // [DisplayModel 6] Enable e-paper 4.2 inch display
|
||||
// #define USE_DISPLAY_ILI9488 // [DisplayModel 8] [I2cDriver38] (Touch)
|
||||
// #define USE_DISPLAY_SSD1351 // [DisplayModel 9]
|
||||
// #define USE_DISPLAY_SSD1351 // [DisplayModel 9] Enable SSD1351 module
|
||||
// #define USE_DISPLAY_RA8876 // [DisplayModel 10] [I2cDriver39] (Touch)
|
||||
// #define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
|
||||
// #define USE_RC522 // Add support for MFRC522 13.56Mhz Rfid reader (+6k code)
|
||||
// #define USE_RC522_DATA_FUNCTION // Add support for reading data block content (+0k4 code)
|
||||
// #define USE_RC522_TYPE_INFORMATION // Add support for showing card type (+0k4 code)
|
||||
|
|
|
@ -1503,12 +1503,11 @@ bool ValidGPIO(uint32_t pin, uint32_t gpio) {
|
|||
return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins
|
||||
}
|
||||
|
||||
bool ValidSpiGPIO(uint32_t gpio) {
|
||||
bool ValidSpiPinUsed(uint32_t gpio) {
|
||||
// ESP8266: If SPI pin selected chk if it's not one of the three Hardware SPI pins (12..14)
|
||||
bool result = true; // Not used and therefore valid
|
||||
uint32_t pin;
|
||||
bool result = false;
|
||||
if (PinUsed(gpio)) {
|
||||
pin = Pin(gpio);
|
||||
uint32_t pin = Pin(gpio);
|
||||
result = ((pin < 12) || (pin > 14));
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -162,7 +162,7 @@ void ResponseAppendFeatures(void)
|
|||
feature2 |= 0x00000800; // xdsp_05_epaper.ino
|
||||
#endif
|
||||
#if defined(USE_I2C) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SH1106)
|
||||
feature2 |= 0x00001000; // xdsp_06_sh1106.ino
|
||||
feature2 |= 0x00001000; // xdsp_07_sh1106.ino
|
||||
#endif
|
||||
#ifdef USE_MP3_PLAYER
|
||||
feature2 |= 0x00002000; // xdrv_14_mp3.ino
|
||||
|
@ -671,12 +671,21 @@ void ResponseAppendFeatures(void)
|
|||
#ifdef USE_FTC532
|
||||
feature7 |= 0x00004000; // xdrv_47_ftc532.ino
|
||||
#endif
|
||||
// feature7 |= 0x00008000;
|
||||
|
||||
// feature7 |= 0x00010000;
|
||||
// feature7 |= 0x00020000;
|
||||
// feature7 |= 0x00040000;
|
||||
// feature7 |= 0x00080000;
|
||||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_EPAPER_42)
|
||||
feature7 |= 0x00008000; // xdsp_06_epaper_42.ino
|
||||
#endif
|
||||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ILI9488)
|
||||
feature7 |= 0x00010000; // xdsp_08_ILI9488.ino
|
||||
#endif
|
||||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1351)
|
||||
feature7 |= 0x00020000; // xdsp_09_SSD1351.ino
|
||||
#endif
|
||||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_RA8876)
|
||||
feature7 |= 0x00040000; // xdsp_10_RA8876.ino
|
||||
#endif
|
||||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ST7789)
|
||||
feature7 |= 0x00080000; // xdsp_12_ST7789.ino
|
||||
#endif
|
||||
|
||||
// feature7 |= 0x00100000;
|
||||
// feature7 |= 0x00200000;
|
||||
|
|
|
@ -1604,23 +1604,23 @@ void GpioInit(void)
|
|||
#ifdef USE_SPI
|
||||
#ifdef ESP8266
|
||||
if (!TasmotaGlobal.soft_spi_enabled) {
|
||||
bool valid_cs = (ValidSpiGPIO(GPIO_SPI_CS) &&
|
||||
ValidSpiGPIO(GPIO_RC522_CS) &&
|
||||
ValidSpiGPIO(GPIO_NRF24_CS) &&
|
||||
ValidSpiGPIO(GPIO_ILI9341_CS) &&
|
||||
ValidSpiGPIO(GPIO_EPAPER29_CS) &&
|
||||
ValidSpiGPIO(GPIO_EPAPER42_CS) &&
|
||||
ValidSpiGPIO(GPIO_ILI9488_CS) &&
|
||||
ValidSpiGPIO(GPIO_SSD1351_CS) &&
|
||||
ValidSpiGPIO(GPIO_RA8876_CS) &&
|
||||
ValidSpiGPIO(GPIO_ST7789_CS)
|
||||
bool valid_cs = (ValidSpiPinUsed(GPIO_SPI_CS) ||
|
||||
ValidSpiPinUsed(GPIO_RC522_CS) ||
|
||||
ValidSpiPinUsed(GPIO_NRF24_CS) ||
|
||||
ValidSpiPinUsed(GPIO_ILI9341_CS) ||
|
||||
ValidSpiPinUsed(GPIO_EPAPER29_CS) ||
|
||||
ValidSpiPinUsed(GPIO_EPAPER42_CS) ||
|
||||
ValidSpiPinUsed(GPIO_ILI9488_CS) ||
|
||||
ValidSpiPinUsed(GPIO_SSD1351_CS) ||
|
||||
ValidSpiPinUsed(GPIO_RA8876_CS) ||
|
||||
ValidSpiPinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
|
||||
ValidSpiPinUsed(GPIO_ST7789_CS)
|
||||
);
|
||||
bool valid_dc = (ValidSpiGPIO(GPIO_SPI_DC) &&
|
||||
ValidSpiGPIO(GPIO_NRF24_DC) &&
|
||||
ValidSpiGPIO(GPIO_ILI9341_DC) &&
|
||||
ValidSpiGPIO(GPIO_ST7789_DC)
|
||||
bool valid_dc = (ValidSpiPinUsed(GPIO_SPI_DC) ||
|
||||
ValidSpiPinUsed(GPIO_NRF24_DC) ||
|
||||
ValidSpiPinUsed(GPIO_ILI9341_DC) ||
|
||||
ValidSpiPinUsed(GPIO_ST7789_DC)
|
||||
);
|
||||
|
||||
// If SPI_CS and/or SPI_DC is used they must be valid
|
||||
TasmotaGlobal.spi_enabled = (valid_cs && valid_dc) ? SPI_MOSI_MISO : SPI_NONE;
|
||||
if (TasmotaGlobal.spi_enabled) {
|
||||
|
@ -1643,6 +1643,7 @@ void GpioInit(void)
|
|||
PinUsed(GPIO_ILI9488_CS) ||
|
||||
PinUsed(GPIO_SSD1351_CS) ||
|
||||
PinUsed(GPIO_RA8876_CS) ||
|
||||
PinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
|
||||
PinUsed(GPIO_ST7789_CS)
|
||||
) {
|
||||
uint32_t spi_mosi = (PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MOSI)) ? SPI_MOSI : SPI_NONE;
|
||||
|
|
|
@ -306,9 +306,10 @@
|
|||
#define USE_DISPLAY_ILI9341 // [DisplayModel 4] Enable ILI9341 Tft 480x320 display (+19k code)
|
||||
#define USE_DISPLAY_EPAPER_29 // [DisplayModel 5] Enable e-paper 2.9 inch display (+19k code)
|
||||
#define USE_DISPLAY_EPAPER_42 // [DisplayModel 6] Enable e-paper 4.2 inch display
|
||||
// #define USE_DISPLAY_ILI9488 // [DisplayModel 8]
|
||||
// #define USE_DISPLAY_SSD1351 // [DisplayModel 9]
|
||||
// #define USE_DISPLAY_RA8876 // [DisplayModel 10]
|
||||
#define USE_DISPLAY_ILI9488 // [DisplayModel 8]
|
||||
#define USE_DISPLAY_SSD1351 // [DisplayModel 9]
|
||||
#define USE_DISPLAY_RA8876 // [DisplayModel 10]
|
||||
#define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
|
||||
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
|
|
|
@ -58,7 +58,7 @@ bool st7789_init_done = false;
|
|||
/*********************************************************************************************/
|
||||
|
||||
void ST7789_InitDriver(void) {
|
||||
if (PinUsed(GPIO_ST7789_CS) && PinUsed(GPIO_ST7789_DC) &&
|
||||
if (PinUsed(GPIO_ST7789_DC) && // This device does not need CS which breaks SPI bus usage
|
||||
((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) {
|
||||
|
||||
Settings.display_model = XDSP_12;
|
||||
|
@ -87,12 +87,17 @@ void ST7789_InitDriver(void) {
|
|||
reset = Pin(GPIO_OLED_RESET);
|
||||
}
|
||||
|
||||
int8_t cs = -1;
|
||||
if (PinUsed(GPIO_ST7789_CS)) {
|
||||
reset = Pin(GPIO_ST7789_CS);
|
||||
}
|
||||
|
||||
// init renderer, may use hardware spi
|
||||
if (TasmotaGlobal.soft_spi_enabled) {
|
||||
st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), reset, Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_ST7789_CS), bppin);
|
||||
st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), reset, Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), cs, bppin);
|
||||
}
|
||||
else if (TasmotaGlobal.spi_enabled) {
|
||||
st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), reset, Pin(GPIO_ST7789_CS), bppin);
|
||||
st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), reset, cs, bppin);
|
||||
}
|
||||
|
||||
st7789->init(Settings.display_width,Settings.display_height);
|
||||
|
|
|
@ -239,8 +239,8 @@ a_features = [[
|
|||
"USE_EZOORP","USE_EZORTD","USE_EZOHUM","USE_EZOEC",
|
||||
"USE_EZOCO2","USE_EZOO2","USE_EZOPRS","USE_EZOFLO",
|
||||
"USE_EZODO","USE_EZORGB","USE_EZOPMP","USE_AS608",
|
||||
"USE_SHELLY_DIMMER","USE_RC522","USE_FTC532","",
|
||||
"","","","",
|
||||
"USE_SHELLY_DIMMER","USE_RC522","USE_FTC532","USE_DISPLAY_EPAPER_42",
|
||||
"USE_DISPLAY_ILI9488","USE_DISPLAY_SSD1351","USE_DISPLAY_RA8876","USE_DISPLAY_ST7789",
|
||||
"","","","",
|
||||
"","","","",
|
||||
"","","",""
|
||||
|
|
Loading…
Reference in New Issue