Fix ESP8266 SPI detection

This commit is contained in:
Theo Arends 2021-01-15 16:19:56 +01:00
parent 43fd9ee1f2
commit f1d15c015c
1 changed files with 4 additions and 10 deletions

View File

@ -1625,8 +1625,8 @@ void GpioInit(void)
if (!TasmotaGlobal.soft_spi_enabled) {
bool valid_cs = (ValidSpiPinUsed(GPIO_SPI_CS) ||
ValidSpiPinUsed(GPIO_RC522_CS) ||
ValidSpiPinUsed(GPIO_NRF24_CS) ||
ValidSpiPinUsed(GPIO_ILI9341_CS) ||
(ValidSpiPinUsed(GPIO_NRF24_CS) && ValidSpiPinUsed(GPIO_NRF24_DC)) ||
(ValidSpiPinUsed(GPIO_ILI9341_CS) && ValidSpiPinUsed(GPIO_ILI9341_DC)) ||
ValidSpiPinUsed(GPIO_EPAPER29_CS) ||
ValidSpiPinUsed(GPIO_EPAPER42_CS) ||
ValidSpiPinUsed(GPIO_ILI9488_CS) ||
@ -1634,17 +1634,11 @@ void GpioInit(void)
ValidSpiPinUsed(GPIO_RA8876_CS) ||
ValidSpiPinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
ValidSpiPinUsed(GPIO_ST7789_CS) ||
ValidSpiPinUsed(GPIO_SSD1331_CS) ||
(ValidSpiPinUsed(GPIO_SSD1331_CS) && ValidSpiPinUsed(GPIO_SSD1331_DC)) ||
ValidSpiPinUsed(GPIO_SDCARD_CS)
);
bool valid_dc = (ValidSpiPinUsed(GPIO_SPI_DC) ||
ValidSpiPinUsed(GPIO_NRF24_DC) ||
ValidSpiPinUsed(GPIO_ILI9341_DC) ||
ValidSpiPinUsed(GPIO_ST7789_DC) ||
ValidSpiPinUsed(GPIO_SSD1331_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;
TasmotaGlobal.spi_enabled = (valid_cs) ? SPI_MOSI_MISO : SPI_NONE;
if (TasmotaGlobal.spi_enabled) {
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
SetPin(12, AGPIO(GPIO_SPI_MISO));