mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
Breaking change replacing SPI CS and SPI DC
Breaking change replacing SPI CS and SPI DC by device specific CS and DC
This commit is contained in:
parent
0c7266fed1
commit
58e6ec55f1
15
CHANGELOG.md
15
CHANGELOG.md
@ -6,12 +6,19 @@ All notable changes to this project will be documented in this file.
|
|||||||
## [9.2.0.2]
|
## [9.2.0.2]
|
||||||
### Added
|
### Added
|
||||||
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin (#8630)
|
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin (#8630)
|
||||||
- Command ``CTRange`` to specify the visible CT range the bulb is capable of
|
- Command ``CTRange`` to specify the visible CT range the bulb is capable of (#10311)
|
||||||
- Command ``VirtualCT`` to simulate or fine tune CT bulbs with 3,4,5 channels
|
- Command ``VirtualCT`` to simulate or fine tune CT bulbs with 3,4,5 channels (#10311)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_RC522_CS``
|
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``SPI CS`` by ``RC522 CS``
|
||||||
- Replaced ILI9341 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_ILI9341_CS`` and ``GPIO_SPI_DC`` by ``GPIO_ILI9341_DC``
|
- Replaced NRF24L01 GPIO selection from ``SPI CS`` by ``NRF24 CS`` and ``SPI DC`` by ``NRF24 DC``
|
||||||
|
- Replaced ILI9341 GPIO selection from ``SPI CS`` by ``ILI9341 CS`` and ``SPI DC`` by ``ILI9341 DC``
|
||||||
|
- Replaced ST7789 GPIO selection from ``SPI CS`` by ``ST7789 CS`` and ``SPI DC`` by ``ST7789 DC``
|
||||||
|
- Replaced ILI9488 GPIO selection from ``SPI CS`` by ``ILI9488_CS``
|
||||||
|
- Replaced EPaper29 GPIO selection from ``SPI CS`` by ``EPaper29 CS``
|
||||||
|
- Replaced EPaper42 GPIO selection from ``SPI CS`` by ``EPaper42 CS``
|
||||||
|
- Replaced SSD1351 GPIO selection from ``SPI CS`` by ``SSD1351 CS``
|
||||||
|
- Replaced RA8876 GPIO selection from ``SPI CS`` by ``RA8876 CS``
|
||||||
|
|
||||||
## [9.2.0.1] 20201229
|
## [9.2.0.1] 20201229
|
||||||
### Added
|
### Added
|
||||||
|
@ -58,6 +58,8 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
|
|
||||||
## Changelog v9.2.0.2
|
## Changelog v9.2.0.2
|
||||||
### Added
|
### Added
|
||||||
|
- Command ``CTRange`` to specify the visible CT range the bulb is capable of [#10311](https://github.com/arendst/Tasmota/issues/10311)
|
||||||
|
- Command ``VirtualCT`` to simulate or fine tune CT bulbs with 3,4,5 channels [#10311](https://github.com/arendst/Tasmota/issues/10311)
|
||||||
- Milliseconds to console output [#10152](https://github.com/arendst/Tasmota/issues/10152)
|
- Milliseconds to console output [#10152](https://github.com/arendst/Tasmota/issues/10152)
|
||||||
- Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs [#10196](https://github.com/arendst/Tasmota/issues/10196)
|
- Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs [#10196](https://github.com/arendst/Tasmota/issues/10196)
|
||||||
- BSSID and Signal Strength Indicator to GUI wifi scan result [#10253](https://github.com/arendst/Tasmota/issues/10253)
|
- BSSID and Signal Strength Indicator to GUI wifi scan result [#10253](https://github.com/arendst/Tasmota/issues/10253)
|
||||||
@ -71,8 +73,15 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin [#8630](https://github.com/arendst/Tasmota/issues/8630)
|
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin [#8630](https://github.com/arendst/Tasmota/issues/8630)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_RC522_CS``
|
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``SPI CS`` by ``RC522 CS``
|
||||||
- Replaced ILI9341 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_ILI9341_CS`` and ``GPIO_SPI_DC`` by ``GPIO_ILI9341_DC``
|
- Replaced NRF24L01 GPIO selection from ``SPI CS`` by ``NRF24 CS`` and ``SPI DC`` by ``NRF24 DC``
|
||||||
|
- Replaced ILI9341 GPIO selection from ``SPI CS`` by ``ILI9341 CS`` and ``SPI DC`` by ``ILI9341 DC``
|
||||||
|
- Replaced ST7789 GPIO selection from ``SPI CS`` by ``ST7789 CS`` and ``SPI DC`` by ``ST7789 DC``
|
||||||
|
- Replaced ILI9488 GPIO selection from ``SPI CS`` by ``ILI9488_CS``
|
||||||
|
- Replaced EPaper29 GPIO selection from ``SPI CS`` by ``EPaper29 CS``
|
||||||
|
- Replaced EPaper42 GPIO selection from ``SPI CS`` by ``EPaper42 CS``
|
||||||
|
- Replaced SSD1351 GPIO selection from ``SPI CS`` by ``SSD1351 CS``
|
||||||
|
- Replaced RA8876 GPIO selection from ``SPI CS`` by ``RA8876 CS``
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Logging from heap to stack freeing 700 bytes RAM
|
- Logging from heap to stack freeing 700 bytes RAM
|
||||||
|
@ -1479,8 +1479,7 @@ bool FlashPin(uint32_t pin)
|
|||||||
return (((pin > 5) && (pin < 9)) || (11 == pin));
|
return (((pin > 5) && (pin < 9)) || (11 == pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ValidPin(uint32_t pin, uint32_t gpio)
|
uint32_t ValidPin(uint32_t pin, uint32_t gpio) {
|
||||||
{
|
|
||||||
if (FlashPin(pin)) {
|
if (FlashPin(pin)) {
|
||||||
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
|
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
|
||||||
}
|
}
|
||||||
@ -1495,8 +1494,7 @@ uint32_t ValidPin(uint32_t pin, uint32_t gpio)
|
|||||||
return gpio;
|
return gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
bool ValidGPIO(uint32_t pin, uint32_t gpio) {
|
||||||
{
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#ifdef USE_ADC_VCC
|
#ifdef USE_ADC_VCC
|
||||||
if (ADC0_PIN == pin) { return false; } // ADC0 = GPIO17
|
if (ADC0_PIN == pin) { return false; } // ADC0 = GPIO17
|
||||||
@ -1505,6 +1503,17 @@ bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
|||||||
return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins
|
return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ValidSpiGPIO(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;
|
||||||
|
if (PinUsed(gpio)) {
|
||||||
|
pin = Pin(gpio);
|
||||||
|
result = ((pin < 12) || (pin > 14));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool JsonTemplate(char* dataBuf)
|
bool JsonTemplate(char* dataBuf)
|
||||||
{
|
{
|
||||||
// Old: {"NAME":"Shelly 2.5","GPIO":[56,0,17,0,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}
|
// Old: {"NAME":"Shelly 2.5","GPIO":[56,0,17,0,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}
|
||||||
@ -2106,6 +2115,25 @@ void AddLogBufferSize(uint32_t loglevel, uint8_t *buffer, uint32_t count, uint32
|
|||||||
AddLogData(loglevel, log_data);
|
AddLogData(loglevel, log_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddLogSpi(bool hardware, uint32_t clk, uint32_t mosi, uint32_t miso) {
|
||||||
|
// Needs optimization
|
||||||
|
uint32_t enabled = (hardware) ? TasmotaGlobal.spi_enabled : TasmotaGlobal.soft_spi_enabled;
|
||||||
|
switch(enabled) {
|
||||||
|
case SPI_MOSI:
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK) and GPIO%02d(MOSI)"),
|
||||||
|
(hardware) ? PSTR("Hardware") : PSTR("Software"), clk, mosi);
|
||||||
|
break;
|
||||||
|
case SPI_MISO:
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK) and GPIO%02d(MISO)"),
|
||||||
|
(hardware) ? PSTR("Hardware") : PSTR("Software"), clk, miso);
|
||||||
|
break;
|
||||||
|
case SPI_MOSI_MISO:
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("SPI: %s using GPIO%02d(CLK), GPIO%02d(MOSI) and GPIO%02d(MISO)"),
|
||||||
|
(hardware) ? PSTR("Hardware") : PSTR("Software"), clk, mosi, miso);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Uncompress static PROGMEM strings
|
* Uncompress static PROGMEM strings
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
@ -1596,29 +1596,33 @@ void GpioInit(void)
|
|||||||
if ((2 == Pin(GPIO_TXD)) || (H801 == TasmotaGlobal.module_type)) { Serial.set_tx(2); }
|
if ((2 == Pin(GPIO_TXD)) || (H801 == TasmotaGlobal.module_type)) { Serial.set_tx(2); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TasmotaGlobal.soft_spi_enabled = (PinUsed(GPIO_SSPI_SCLK) && (PinUsed(GPIO_SSPI_MOSI) || PinUsed(GPIO_SSPI_MISO)));
|
uint32_t sspi_mosi = (PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MOSI)) ? SPI_MOSI : SPI_NONE;
|
||||||
|
uint32_t sspi_miso = (PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MISO)) ? SPI_MISO : SPI_NONE;
|
||||||
|
TasmotaGlobal.soft_spi_enabled = sspi_mosi + sspi_miso;
|
||||||
|
AddLogSpi(0, Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSPI_MOSI), PinUsed(GPIO_SSPI_MISO));
|
||||||
|
|
||||||
#ifdef USE_SPI
|
#ifdef USE_SPI
|
||||||
uint32_t pin_cs = Pin(GPIO_SPI_CS);
|
|
||||||
uint32_t pin_dc = Pin(GPIO_SPI_DC);
|
|
||||||
if (PinUsed(GPIO_RC522_CS)) {
|
|
||||||
pin_cs = Pin(GPIO_RC522_CS);
|
|
||||||
}
|
|
||||||
if (PinUsed(GPIO_ILI9341_CS)) {
|
|
||||||
pin_cs = Pin(GPIO_ILI9341_CS);
|
|
||||||
if (PinUsed(GPIO_ILI9341_DC)) {
|
|
||||||
pin_dc = Pin(GPIO_ILI9341_DC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
if (!TasmotaGlobal.soft_spi_enabled) {
|
if (!TasmotaGlobal.soft_spi_enabled) {
|
||||||
// If SPI_CS is used it must be valid
|
bool valid_cs = (ValidSpiGPIO(GPIO_SPI_CS) &&
|
||||||
TasmotaGlobal.spi_enabled = ((pin_cs < 99) && ((pin_cs > 14) || (pin_cs < 12)));
|
ValidSpiGPIO(GPIO_RC522_CS) &&
|
||||||
if (TasmotaGlobal.spi_enabled && (pin_dc < 99)) {
|
ValidSpiGPIO(GPIO_NRF24_CS) &&
|
||||||
// If SPI_DC is used it must be valid
|
ValidSpiGPIO(GPIO_ILI9341_CS) &&
|
||||||
TasmotaGlobal.spi_enabled = ((pin_dc > 14) || (pin_dc < 12));
|
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_dc = (ValidSpiGPIO(GPIO_SPI_DC) &&
|
||||||
|
ValidSpiGPIO(GPIO_NRF24_DC) &&
|
||||||
|
ValidSpiGPIO(GPIO_ILI9341_DC) &&
|
||||||
|
ValidSpiGPIO(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) {
|
if (TasmotaGlobal.spi_enabled) {
|
||||||
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
||||||
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
||||||
@ -1626,65 +1630,27 @@ void GpioInit(void)
|
|||||||
SetPin(13, AGPIO(GPIO_SPI_MOSI));
|
SetPin(13, AGPIO(GPIO_SPI_MOSI));
|
||||||
TasmotaGlobal.my_module.io[14] = AGPIO(GPIO_SPI_CLK);
|
TasmotaGlobal.my_module.io[14] = AGPIO(GPIO_SPI_CLK);
|
||||||
SetPin(14, AGPIO(GPIO_SPI_CLK));
|
SetPin(14, AGPIO(GPIO_SPI_CLK));
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK)"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
if (pin_cs < 99) {
|
if (PinUsed(GPIO_SPI_CS) ||
|
||||||
/*
|
PinUsed(GPIO_RC522_CS) ||
|
||||||
// Do not do this as ESP32 can have SPI_CS everywhere
|
PinUsed(GPIO_NRF24_CS) ||
|
||||||
if ((15 == pin_cs) && (!GetPin(12) && !GetPin(13) && !GetPin(14))) { // HSPI
|
PinUsed(GPIO_ILI9341_CS) ||
|
||||||
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
PinUsed(GPIO_EPAPER29_CS) ||
|
||||||
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
PinUsed(GPIO_EPAPER42_CS) ||
|
||||||
TasmotaGlobal.my_module.io[13] = AGPIO(GPIO_SPI_MOSI);
|
PinUsed(GPIO_ILI9488_CS) ||
|
||||||
SetPin(13, AGPIO(GPIO_SPI_MOSI));
|
PinUsed(GPIO_SSD1351_CS) ||
|
||||||
TasmotaGlobal.my_module.io[14] = AGPIO(GPIO_SPI_CLK);
|
PinUsed(GPIO_RA8876_CS) ||
|
||||||
SetPin(14, AGPIO(GPIO_SPI_CLK));
|
PinUsed(GPIO_ST7789_CS)
|
||||||
}
|
) {
|
||||||
else if ((5 == pin_cs) && (!GetPin(19) && !GetPin(23) && !GetPin(18))) { // VSPI
|
uint32_t spi_mosi = (PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MOSI)) ? SPI_MOSI : SPI_NONE;
|
||||||
TasmotaGlobal.my_module.io[19] = AGPIO(GPIO_SPI_MISO);
|
uint32_t spi_miso = (PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MISO)) ? SPI_MISO : SPI_NONE;
|
||||||
SetPin(19, AGPIO(GPIO_SPI_MISO));
|
TasmotaGlobal.spi_enabled = spi_mosi + spi_miso;
|
||||||
TasmotaGlobal.my_module.io[23] = AGPIO(GPIO_SPI_MOSI);
|
|
||||||
SetPin(23, AGPIO(GPIO_SPI_MOSI));
|
|
||||||
TasmotaGlobal.my_module.io[18] = AGPIO(GPIO_SPI_CLK);
|
|
||||||
SetPin(18, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if ((12 == Pin(GPIO_SPI_MISO)) || (13 == Pin(GPIO_SPI_MOSI)) || (14 == Pin(GPIO_SPI_CLK))) { // HSPI
|
|
||||||
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
|
||||||
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
|
||||||
TasmotaGlobal.my_module.io[13] = AGPIO(GPIO_SPI_MOSI);
|
|
||||||
SetPin(13, AGPIO(GPIO_SPI_MOSI));
|
|
||||||
TasmotaGlobal.my_module.io[14] = AGPIO(GPIO_SPI_CLK);
|
|
||||||
SetPin(14, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if ((19 == Pin(GPIO_SPI_MISO)) || (23 == Pin(GPIO_SPI_MOSI)) || (18 == Pin(GPIO_SPI_CLK))) { // VSPI
|
|
||||||
TasmotaGlobal.my_module.io[19] = AGPIO(GPIO_SPI_MISO);
|
|
||||||
SetPin(19, AGPIO(GPIO_SPI_MISO));
|
|
||||||
TasmotaGlobal.my_module.io[23] = AGPIO(GPIO_SPI_MOSI);
|
|
||||||
SetPin(23, AGPIO(GPIO_SPI_MOSI));
|
|
||||||
TasmotaGlobal.my_module.io[18] = AGPIO(GPIO_SPI_CLK);
|
|
||||||
SetPin(18, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
TasmotaGlobal.spi_enabled = (PinUsed(GPIO_SPI_CLK) && (PinUsed(GPIO_SPI_MOSI) || PinUsed(GPIO_SPI_MISO)));
|
|
||||||
*/
|
|
||||||
TasmotaGlobal.spi_enabled = (pin_cs < 99);
|
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
|
||||||
if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO), GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
|
||||||
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
|
||||||
Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if (PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO) and GPIO%02d(CLK)"),
|
|
||||||
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
AddLogSpi(1, Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_MISO));
|
||||||
#endif // USE_SPI
|
#endif // USE_SPI
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ARRAY_SIZE(TasmotaGlobal.my_module.io); i++) {
|
for (uint32_t i = 0; i < ARRAY_SIZE(TasmotaGlobal.my_module.io); i++) {
|
||||||
|
@ -313,6 +313,8 @@ enum SettingsTextIndex { SET_OTAURL,
|
|||||||
SET_SHD_PARAM,
|
SET_SHD_PARAM,
|
||||||
SET_MAX };
|
SET_MAX };
|
||||||
|
|
||||||
|
enum SpiInterfaces { SPI_NONE, SPI_MOSI, SPI_MISO, SPI_MOSI_MISO };
|
||||||
|
|
||||||
enum DevGroupMessageType { DGR_MSGTYP_FULL_STATUS, DGR_MSGTYP_PARTIAL_UPDATE, DGR_MSGTYP_UPDATE, DGR_MSGTYP_UPDATE_MORE_TO_COME, DGR_MSGTYP_UPDATE_DIRECT, DGR_MSGTYPE_UPDATE_COMMAND, DGR_MSGTYPFLAG_WITH_LOCAL = 128 };
|
enum DevGroupMessageType { DGR_MSGTYP_FULL_STATUS, DGR_MSGTYP_PARTIAL_UPDATE, DGR_MSGTYP_UPDATE, DGR_MSGTYP_UPDATE_MORE_TO_COME, DGR_MSGTYP_UPDATE_DIRECT, DGR_MSGTYPE_UPDATE_COMMAND, DGR_MSGTYPFLAG_WITH_LOCAL = 128 };
|
||||||
|
|
||||||
enum DevGroupMessageFlag { DGR_FLAG_RESET = 1, DGR_FLAG_STATUS_REQUEST = 2, DGR_FLAG_FULL_STATUS = 4, DGR_FLAG_ACK = 8, DGR_FLAG_MORE_TO_COME = 16, DGR_FLAG_DIRECT = 32, DGR_FLAG_ANNOUNCEMENT = 64, DGR_FLAG_LOCAL = 128 };
|
enum DevGroupMessageFlag { DGR_FLAG_RESET = 1, DGR_FLAG_STATUS_REQUEST = 2, DGR_FLAG_FULL_STATUS = 4, DGR_FLAG_ACK = 8, DGR_FLAG_MORE_TO_COME = 16, DGR_FLAG_DIRECT = 32, DGR_FLAG_ANNOUNCEMENT = 64, DGR_FLAG_LOCAL = 128 };
|
||||||
|
@ -119,8 +119,6 @@ struct {
|
|||||||
bool blinkstate; // LED state
|
bool blinkstate; // LED state
|
||||||
bool pwm_present; // Any PWM channel configured with SetOption15 0
|
bool pwm_present; // Any PWM channel configured with SetOption15 0
|
||||||
bool i2c_enabled; // I2C configured
|
bool i2c_enabled; // I2C configured
|
||||||
bool spi_enabled; // SPI configured
|
|
||||||
bool soft_spi_enabled; // Software SPI configured
|
|
||||||
bool ntp_force_sync; // Force NTP sync
|
bool ntp_force_sync; // Force NTP sync
|
||||||
bool is_8285; // Hardware device ESP8266EX (0) or ESP8285 (1)
|
bool is_8285; // Hardware device ESP8266EX (0) or ESP8285 (1)
|
||||||
bool skip_light_fade; // Temporarily skip light fading
|
bool skip_light_fade; // Temporarily skip light fading
|
||||||
@ -128,6 +126,8 @@ struct {
|
|||||||
bool module_changed; // Indicate module changed since last restart
|
bool module_changed; // Indicate module changed since last restart
|
||||||
|
|
||||||
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
|
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
|
||||||
|
uint8_t spi_enabled; // SPI configured
|
||||||
|
uint8_t soft_spi_enabled; // Software SPI configured
|
||||||
uint8_t blinks; // Number of LED blinks
|
uint8_t blinks; // Number of LED blinks
|
||||||
uint8_t restart_flag; // Tasmota restart flag
|
uint8_t restart_flag; // Tasmota restart flag
|
||||||
uint8_t ota_state_flag; // OTA state flag
|
uint8_t ota_state_flag; // OTA state flag
|
||||||
|
@ -46,6 +46,11 @@
|
|||||||
#undef CODE_IMAGE_STR
|
#undef CODE_IMAGE_STR
|
||||||
#define CODE_IMAGE_STR "odroid-go"
|
#define CODE_IMAGE_STR "odroid-go"
|
||||||
|
|
||||||
|
#undef MODULE
|
||||||
|
#define MODULE ODROID_GO // [Module] Select default module from tasmota_template.h
|
||||||
|
#undef FALLBACK_MODULE
|
||||||
|
#define FALLBACK_MODULE ODROID_GO // [Module2] Select default module on fast reboot where USER_MODULE is user template
|
||||||
|
|
||||||
#define USE_ODROID_GO // Add support for Odroid Go
|
#define USE_ODROID_GO // Add support for Odroid Go
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_SPI
|
#define USE_SPI
|
||||||
|
@ -365,8 +365,8 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||||||
AGPIO(GPIO_SPI_CS), // SPI Chip Select
|
AGPIO(GPIO_SPI_CS), // SPI Chip Select
|
||||||
AGPIO(GPIO_SPI_DC), // SPI Data Direction
|
AGPIO(GPIO_SPI_DC), // SPI Data Direction
|
||||||
#ifdef USE_NRF24
|
#ifdef USE_NRF24
|
||||||
// AGPIO(GPIO_NRF24_CS),
|
AGPIO(GPIO_NRF24_CS),
|
||||||
// AGPIO(GPIO_NRF24_DC),
|
AGPIO(GPIO_NRF24_DC),
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_RC522
|
#ifdef USE_RC522
|
||||||
AGPIO(GPIO_RC522_CS), // RC522 Rfid Chip Select
|
AGPIO(GPIO_RC522_CS), // RC522 Rfid Chip Select
|
||||||
@ -386,23 +386,23 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||||||
AGPIO(GPIO_SSPI_DC), // Software SPI Data or Command
|
AGPIO(GPIO_SSPI_DC), // Software SPI Data or Command
|
||||||
#ifdef USE_DISPLAY
|
#ifdef USE_DISPLAY
|
||||||
#ifdef USE_DISPLAY_ILI9488
|
#ifdef USE_DISPLAY_ILI9488
|
||||||
// AGPIO(GPIO_ILI9488_CS),
|
AGPIO(GPIO_ILI9488_CS),
|
||||||
#endif // USE_DISPLAY_ILI9488
|
#endif // USE_DISPLAY_ILI9488
|
||||||
#ifdef USE_DISPLAY_EPAPER_29
|
#ifdef USE_DISPLAY_EPAPER_29
|
||||||
// AGPIO(GPIO_EPAPER29_CS),
|
AGPIO(GPIO_EPAPER29_CS),
|
||||||
#endif // USE_DISPLAY_EPAPER_29
|
#endif // USE_DISPLAY_EPAPER_29
|
||||||
#ifdef USE_DISPLAY_EPAPER_42
|
#ifdef USE_DISPLAY_EPAPER_42
|
||||||
// AGPIO(GPIO_EPAPER42_CS),
|
AGPIO(GPIO_EPAPER42_CS),
|
||||||
#endif // USE_DISPLAY_EPAPER_42
|
#endif // USE_DISPLAY_EPAPER_42
|
||||||
#ifdef USE_DISPLAY_SSD1351
|
#ifdef USE_DISPLAY_SSD1351
|
||||||
// AGPIO(GPIO_SSD1351_CS),
|
AGPIO(GPIO_SSD1351_CS),
|
||||||
#endif // USE_DISPLAY_SSD1351
|
#endif // USE_DISPLAY_SSD1351
|
||||||
#ifdef USE_DISPLAY_RA8876
|
#ifdef USE_DISPLAY_RA8876
|
||||||
// AGPIO(GPIO_RA8876_CS),
|
AGPIO(GPIO_RA8876_CS),
|
||||||
#endif // USE_DISPLAY_RA8876
|
#endif // USE_DISPLAY_RA8876
|
||||||
#ifdef USE_DISPLAY_ST7789
|
#ifdef USE_DISPLAY_ST7789
|
||||||
// AGPIO(GPIO_ST7789_CS),
|
AGPIO(GPIO_ST7789_CS),
|
||||||
// AGPIO(GPIO_ST7789_DC),
|
AGPIO(GPIO_ST7789_DC),
|
||||||
#endif //f USE_DISPLAY_ST7789
|
#endif //f USE_DISPLAY_ST7789
|
||||||
AGPIO(GPIO_BACKLIGHT), // Display backlight control
|
AGPIO(GPIO_BACKLIGHT), // Display backlight control
|
||||||
AGPIO(GPIO_OLED_RESET), // OLED Display Reset
|
AGPIO(GPIO_OLED_RESET), // OLED Display Reset
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* NRF24l01(+)
|
* NRF24l01(+)
|
||||||
*
|
*
|
||||||
* Usage: 5 SPI-data-wires plus VVC/ground, use hardware SPI, select GPIO_SPI_CS/GPIO_SPI_DC
|
* Usage: 5 SPI-data-wires plus VVC/ground, use hardware SPI, select GPIO_NRF24_CS/GPIO_NRF24_DC
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
#define XDRV_33 33
|
#define XDRV_33 33
|
||||||
@ -51,45 +51,40 @@ struct {
|
|||||||
|
|
||||||
RF24 NRF24radio;
|
RF24 NRF24radio;
|
||||||
|
|
||||||
bool NRF24initRadio()
|
bool NRF24initRadio() {
|
||||||
{
|
NRF24radio.begin(Pin(GPIO_NRF24_CS), Pin(GPIO_NRF24_DC));
|
||||||
NRF24radio.begin(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_DC));
|
|
||||||
NRF24radio.powerUp();
|
NRF24radio.powerUp();
|
||||||
|
|
||||||
if(NRF24radio.isChipConnected()){
|
if (NRF24radio.isChipConnected()) {
|
||||||
DEBUG_DRIVER_LOG(PSTR("NRF24 chip connected"));
|
DEBUG_DRIVER_LOG(PSTR("NRF: Chip connected"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DEBUG_DRIVER_LOG(PSTR("NRF24 chip NOT !!!! connected"));
|
DEBUG_DRIVER_LOG(PSTR("NRF: Chip NOT !!!! connected"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NRF24Detect(void)
|
void NRF24Detect(void) {
|
||||||
{
|
if (PinUsed(GPIO_NRF24_CS) && PinUsed(GPIO_NRF24_DC) && TasmotaGlobal.spi_enabled) {
|
||||||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_DC)) {
|
if (NRF24initRadio()) {
|
||||||
if(NRF24initRadio()){
|
|
||||||
NRF24.chipType = 32; // SPACE
|
NRF24.chipType = 32; // SPACE
|
||||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF24L01 initialized"));
|
AddLog_P(LOG_LEVEL_INFO, PSTR("NRF: Model 24L01 initialized"));
|
||||||
if(NRF24radio.isPVariant()){
|
if (NRF24radio.isPVariant()) {
|
||||||
NRF24.chipType = 43; // +
|
NRF24.chipType = 43; // +
|
||||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF24L01+ detected"));
|
AddLog_P(LOG_LEVEL_INFO, PSTR("NRF: Model 24L01+ detected"));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool Xdrv33(uint8_t function)
|
bool Xdrv33(uint8_t function) {
|
||||||
{
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (FUNC_INIT == function) {
|
if (FUNC_INIT == function) {
|
||||||
result = NRF24Detect();
|
NRF24Detect();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ uint16_t tft_top = TFT_TOP;
|
|||||||
uint16_t tft_bottom = TFT_BOTTOM;
|
uint16_t tft_bottom = TFT_BOTTOM;
|
||||||
uint16_t tft_scroll = TFT_TOP;
|
uint16_t tft_scroll = TFT_TOP;
|
||||||
uint16_t tft_cols = 0;
|
uint16_t tft_cols = 0;
|
||||||
|
bool tft_init_done = false;
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
@ -57,8 +58,7 @@ bool Ili9341Header(void) {
|
|||||||
return (tft_cols > 17);
|
return (tft_cols > 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341InitMode(void)
|
void Ili9341InitMode(void) {
|
||||||
{
|
|
||||||
tft->setRotation(Settings.display_rotate); // 0
|
tft->setRotation(Settings.display_rotate); // 0
|
||||||
tft->invertDisplay(0);
|
tft->invertDisplay(0);
|
||||||
tft->fillScreen(ILI9341_BLACK);
|
tft->fillScreen(ILI9341_BLACK);
|
||||||
@ -78,8 +78,7 @@ void Ili9341InitMode(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341Init(uint8_t mode)
|
void Ili9341Init(uint8_t mode) {
|
||||||
{
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case DISPLAY_INIT_MODE:
|
case DISPLAY_INIT_MODE:
|
||||||
Ili9341InitMode();
|
Ili9341InitMode();
|
||||||
@ -95,24 +94,11 @@ void Ili9341Init(uint8_t mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341InitDriver(void)
|
void Ili9341InitDriver(void) {
|
||||||
{
|
if (PinUsed(GPIO_ILI9341_CS) && PinUsed(GPIO_ILI9341_DC) && TasmotaGlobal.spi_enabled) {
|
||||||
uint32_t pin_cs = Pin(GPIO_SPI_CS);
|
|
||||||
uint32_t pin_dc = Pin(GPIO_SPI_DC);
|
|
||||||
if (!Settings.display_model) {
|
|
||||||
if (PinUsed(GPIO_ILI9341_CS)) {
|
|
||||||
pin_cs = Pin(GPIO_ILI9341_CS);
|
|
||||||
if (PinUsed(GPIO_ILI9341_DC)) {
|
|
||||||
pin_dc = Pin(GPIO_ILI9341_DC);
|
|
||||||
}
|
|
||||||
Settings.display_model = XDSP_04;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy
|
|
||||||
Settings.display_model = XDSP_04;
|
Settings.display_model = XDSP_04;
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_04 == Settings.display_model) {
|
|
||||||
if (Settings.display_width != ILI9341_TFTWIDTH) {
|
if (Settings.display_width != ILI9341_TFTWIDTH) {
|
||||||
Settings.display_width = ILI9341_TFTWIDTH;
|
Settings.display_width = ILI9341_TFTWIDTH;
|
||||||
}
|
}
|
||||||
@ -120,7 +106,7 @@ void Ili9341InitDriver(void)
|
|||||||
Settings.display_height = ILI9341_TFTHEIGHT;
|
Settings.display_height = ILI9341_TFTHEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
tft = new Adafruit_ILI9341(pin_cs, pin_dc);
|
tft = new Adafruit_ILI9341(Pin(GPIO_ILI9341_CS), Pin(GPIO_ILI9341_DC));
|
||||||
tft->begin();
|
tft->begin();
|
||||||
|
|
||||||
#ifdef USE_DISPLAY_MODES1TO5
|
#ifdef USE_DISPLAY_MODES1TO5
|
||||||
@ -131,18 +117,17 @@ void Ili9341InitDriver(void)
|
|||||||
|
|
||||||
Ili9341InitMode();
|
Ili9341InitMode();
|
||||||
|
|
||||||
|
tft_init_done = true;
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: ILI9341"));
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: ILI9341"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341Clear(void)
|
void Ili9341Clear(void) {
|
||||||
{
|
|
||||||
tft->fillScreen(ILI9341_BLACK);
|
tft->fillScreen(ILI9341_BLACK);
|
||||||
tft->setCursor(0, 0);
|
tft->setCursor(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8_t flag)
|
void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8_t flag) {
|
||||||
{
|
|
||||||
uint16_t active_color = ILI9341_WHITE;
|
uint16_t active_color = ILI9341_WHITE;
|
||||||
|
|
||||||
tft->setTextSize(Settings.display_size);
|
tft->setTextSize(Settings.display_size);
|
||||||
@ -156,8 +141,7 @@ void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint
|
|||||||
tft->println(str);
|
tft->println(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341DisplayOnOff()
|
void Ili9341DisplayOnOff() {
|
||||||
{
|
|
||||||
// tft->showDisplay(disp_power);
|
// tft->showDisplay(disp_power);
|
||||||
// tft->invertDisplay(disp_power);
|
// tft->invertDisplay(disp_power);
|
||||||
if (PinUsed(GPIO_BACKLIGHT)) {
|
if (PinUsed(GPIO_BACKLIGHT)) {
|
||||||
@ -170,8 +154,7 @@ void Ili9341DisplayOnOff()
|
|||||||
|
|
||||||
#ifdef USE_DISPLAY_MODES1TO5
|
#ifdef USE_DISPLAY_MODES1TO5
|
||||||
|
|
||||||
void Ili9341PrintLog(void)
|
void Ili9341PrintLog(void) {
|
||||||
{
|
|
||||||
disp_refresh--;
|
disp_refresh--;
|
||||||
if (!disp_refresh) {
|
if (!disp_refresh) {
|
||||||
disp_refresh = Settings.display_refresh;
|
disp_refresh = Settings.display_refresh;
|
||||||
@ -217,8 +200,7 @@ void Ili9341PrintLog(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341Refresh(void) // Every second
|
void Ili9341Refresh(void) { // Every second
|
||||||
{
|
|
||||||
if (Settings.display_mode) { // Mode 0 is User text
|
if (Settings.display_mode) { // Mode 0 is User text
|
||||||
// 24-04-2017 13:45:43 = 19 + 1 ('\0') = 20
|
// 24-04-2017 13:45:43 = 19 + 1 ('\0') = 20
|
||||||
// 24-04-2017 13:45 = 16 + 1 ('\0') = 17
|
// 24-04-2017 13:45 = 16 + 1 ('\0') = 17
|
||||||
@ -263,15 +245,13 @@ void Ili9341Refresh(void) // Every second
|
|||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool Xdsp04(uint8_t function)
|
bool Xdsp04(uint8_t function) {
|
||||||
{
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
|
||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
Ili9341InitDriver();
|
Ili9341InitDriver();
|
||||||
}
|
}
|
||||||
else if (XDSP_04 == Settings.display_model) {
|
else if (tft_init_done && (XDSP_04 == Settings.display_model)) {
|
||||||
|
|
||||||
if (!dsp_color) { dsp_color = ILI9341_WHITE; }
|
if (!dsp_color) { dsp_color = ILI9341_WHITE; }
|
||||||
|
|
||||||
@ -331,7 +311,6 @@ bool Xdsp04(uint8_t function)
|
|||||||
#endif // USE_DISPLAY_MODES1TO5
|
#endif // USE_DISPLAY_MODES1TO5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,18 +39,18 @@
|
|||||||
//unsigned char image[(EPD_HEIGHT * EPD_WIDTH) / 8];
|
//unsigned char image[(EPD_HEIGHT * EPD_WIDTH) / 8];
|
||||||
extern uint8_t *buffer;
|
extern uint8_t *buffer;
|
||||||
uint16_t epd_scroll;
|
uint16_t epd_scroll;
|
||||||
|
bool epd_init_done = false;
|
||||||
|
|
||||||
Epd *epd;
|
Epd *epd;
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void EpdInitDriver29()
|
void EpdInitDriver29(void) {
|
||||||
{
|
if (PinUsed(GPIO_EPAPER29_CS) &&
|
||||||
if (!Settings.display_model) {
|
((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) {
|
||||||
Settings.display_model = XDSP_05;
|
|
||||||
}
|
Settings.display_model = XDSP_05;
|
||||||
|
|
||||||
if (XDSP_05 == Settings.display_model) {
|
|
||||||
if (Settings.display_width != EPD_WIDTH) {
|
if (Settings.display_width != EPD_WIDTH) {
|
||||||
Settings.display_width = EPD_WIDTH;
|
Settings.display_width = EPD_WIDTH;
|
||||||
}
|
}
|
||||||
@ -64,19 +64,14 @@ void EpdInitDriver29()
|
|||||||
if (!buffer) return;
|
if (!buffer) return;
|
||||||
|
|
||||||
// init renderer
|
// init renderer
|
||||||
epd = new Epd(EPD_WIDTH,EPD_HEIGHT);
|
epd = new Epd(EPD_WIDTH, EPD_HEIGHT);
|
||||||
|
|
||||||
// whiten display with full update, takes 3 seconds
|
// whiten display with full update, takes 3 seconds
|
||||||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MOSI)) {
|
if (TasmotaGlobal.soft_spi_enabled) {
|
||||||
epd->Begin(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_MOSI),Pin(GPIO_SPI_CLK));
|
epd->Begin(Pin(GPIO_EPAPER29_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK));
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EPD: HardSPI CS %d, CLK %d, MOSI %d"),Pin(GPIO_SPI_CS), Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MOSI));
|
|
||||||
}
|
}
|
||||||
else if (PinUsed(GPIO_SSPI_CS) && PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MOSI)) {
|
else if (TasmotaGlobal.spi_enabled) {
|
||||||
epd->Begin(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_SCLK));
|
epd->Begin(Pin(GPIO_EPAPER29_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EPD: SoftSPI CS %d, CLK %d, MOSI %d"),Pin(GPIO_SSPI_CS), Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSPI_MOSI));
|
|
||||||
} else {
|
|
||||||
free(buffer);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = epd;
|
renderer = epd;
|
||||||
@ -95,6 +90,8 @@ void EpdInitDriver29()
|
|||||||
renderer->fillScreen(0);
|
renderer->fillScreen(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
epd_init_done = true;
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: E-Paper 2.9"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,10 +183,11 @@ void EpdRefresh29(void) // Every second
|
|||||||
bool Xdsp05(uint8_t function)
|
bool Xdsp05(uint8_t function)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
EpdInitDriver29();
|
EpdInitDriver29();
|
||||||
}
|
}
|
||||||
else if (XDSP_05 == Settings.display_model) {
|
else if (epd_init_done && (XDSP_05 == Settings.display_model)) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_DISPLAY_MODEL:
|
case FUNC_DISPLAY_MODEL:
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -35,19 +35,18 @@
|
|||||||
#include <epdpaint.h>
|
#include <epdpaint.h>
|
||||||
|
|
||||||
extern uint8_t *buffer;
|
extern uint8_t *buffer;
|
||||||
|
bool epd42_init_done = false;
|
||||||
|
|
||||||
Epd42 *epd42;
|
Epd42 *epd42;
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void EpdInitDriver42()
|
void EpdInitDriver42() {
|
||||||
{
|
if (PinUsed(GPIO_EPAPER42_CS) &&
|
||||||
if (!Settings.display_model) {
|
((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) {
|
||||||
Settings.display_model = XDSP_06;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_06 == Settings.display_model) {
|
Settings.display_model = XDSP_06;
|
||||||
|
|
||||||
if (Settings.display_width != EPD_WIDTH42) {
|
if (Settings.display_width != EPD_WIDTH42) {
|
||||||
Settings.display_width = EPD_WIDTH42;
|
Settings.display_width = EPD_WIDTH42;
|
||||||
@ -62,23 +61,14 @@ void EpdInitDriver42()
|
|||||||
if (!buffer) return;
|
if (!buffer) return;
|
||||||
|
|
||||||
// init renderer
|
// init renderer
|
||||||
epd42 = new Epd42(EPD_WIDTH42,EPD_HEIGHT42);
|
epd42 = new Epd42(EPD_WIDTH42, EPD_HEIGHT42);
|
||||||
|
|
||||||
#ifdef USE_SPI
|
if (TasmotaGlobal.soft_spi_enabled) {
|
||||||
if (PinUsed(GPIO_SSPI_CS) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK)) {
|
epd42->Begin(Pin(GPIO_EPAPER42_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK));
|
||||||
epd42->Begin(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_SCLK));
|
|
||||||
} else {
|
|
||||||
free(buffer);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#else
|
else if (TasmotaGlobal.spi_enabled) {
|
||||||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_CLK)) {
|
epd42->Begin(Pin(GPIO_EPAPER42_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||||
epd42->Begin(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_MOSI),Pin(GPIO_SPI_CLK));
|
|
||||||
} else {
|
|
||||||
free(buffer);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
renderer = epd42;
|
renderer = epd42;
|
||||||
|
|
||||||
@ -105,6 +95,8 @@ void EpdInitDriver42()
|
|||||||
renderer->fillScreen(0);
|
renderer->fillScreen(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
epd42_init_done = true;
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: E-Paper 4.2"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,13 +129,11 @@ bool Xdsp06(uint8_t function)
|
|||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
EpdInitDriver42();
|
EpdInitDriver42();
|
||||||
}
|
}
|
||||||
else if (XDSP_06 == Settings.display_model) {
|
else if (epd42_init_done && (XDSP_06 == Settings.display_model)) {
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_DISPLAY_MODEL:
|
case FUNC_DISPLAY_MODEL:
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef USE_DISPLAY_MODES1TO5
|
#ifdef USE_DISPLAY_MODES1TO5
|
||||||
case FUNC_DISPLAY_EVERY_SECOND:
|
case FUNC_DISPLAY_EVERY_SECOND:
|
||||||
EpdRefresh42();
|
EpdRefresh42();
|
||||||
@ -154,7 +144,6 @@ bool Xdsp06(uint8_t function)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // USE_DISPLAY_EPAPER42
|
#endif // USE_DISPLAY_EPAPER42
|
||||||
#endif // USE_DISPLAY
|
#endif // USE_DISPLAY
|
||||||
#endif // USE_SPI
|
#endif // USE_SPI
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <ILI9488.h>
|
#include <ILI9488.h>
|
||||||
uint8_t ili9488_ctouch_counter = 0;
|
uint8_t ili9488_ctouch_counter = 0;
|
||||||
|
bool ili9488_init_done = false;
|
||||||
|
|
||||||
// currently fixed
|
// currently fixed
|
||||||
#define BACKPLANE_PIN 2
|
#define BACKPLANE_PIN 2
|
||||||
@ -45,13 +46,10 @@ extern const uint16_t picture[];
|
|||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void ILI9488_InitDriver()
|
void ILI9488_InitDriver(void) {
|
||||||
{
|
if (PinUsed(GPIO_ILI9488_CS) && (TasmotaGlobal.spi_enabled & SPI_MOSI)) {
|
||||||
if (!Settings.display_model) {
|
|
||||||
Settings.display_model = XDSP_08;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_08 == Settings.display_model) {
|
Settings.display_model = XDSP_08;
|
||||||
|
|
||||||
if (Settings.display_width != ILI9488_TFTWIDTH) {
|
if (Settings.display_width != ILI9488_TFTWIDTH) {
|
||||||
Settings.display_width = ILI9488_TFTWIDTH;
|
Settings.display_width = ILI9488_TFTWIDTH;
|
||||||
@ -61,44 +59,19 @@ void ILI9488_InitDriver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// disable screen buffer
|
// disable screen buffer
|
||||||
buffer=NULL;
|
buffer = NULL;
|
||||||
|
|
||||||
// default colors
|
// default colors
|
||||||
fg_color = ILI9488_WHITE;
|
fg_color = ILI9488_WHITE;
|
||||||
bg_color = ILI9488_BLACK;
|
bg_color = ILI9488_BLACK;
|
||||||
|
|
||||||
uint8_t bppin=BACKPLANE_PIN;
|
uint8_t bppin = BACKPLANE_PIN;
|
||||||
if (PinUsed(GPIO_BACKLIGHT)) {
|
if (PinUsed(GPIO_BACKLIGHT)) {
|
||||||
bppin=Pin(GPIO_BACKLIGHT);
|
bppin = Pin(GPIO_BACKLIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESP8266
|
|
||||||
#undef HW_SPI_MOSI
|
|
||||||
#define HW_SPI_MOSI 13
|
|
||||||
#undef HW_SPI_MISO
|
|
||||||
#define HW_SPI_MISO 12
|
|
||||||
#undef HW_SPI_CLK
|
|
||||||
#define HW_SPI_CLK 14
|
|
||||||
#endif // ESP8266
|
|
||||||
#ifdef ESP32
|
|
||||||
#undef HW_SPI_MOSI
|
|
||||||
#define HW_SPI_MOSI 23
|
|
||||||
#undef HW_SPI_MISO
|
|
||||||
#define HW_SPI_MISO 19
|
|
||||||
#undef HW_SPI_CLK
|
|
||||||
#define HW_SPI_CLK 18
|
|
||||||
#endif // ESP32
|
|
||||||
|
|
||||||
// init renderer, must use hardware spi
|
// init renderer, must use hardware spi
|
||||||
if (PinUsed(GPIO_SSPI_CS) && (Pin(GPIO_SSPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SSPI_SCLK)==HW_SPI_CLK)) {
|
ili9488 = new ILI9488(Pin(GPIO_ILI9488_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK), bppin);
|
||||||
ili9488 = new ILI9488(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_SCLK),bppin);
|
|
||||||
} else {
|
|
||||||
if (PinUsed(GPIO_SPI_CS) && (Pin(GPIO_SPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SPI_CLK)==HW_SPI_CLK)) {
|
|
||||||
ili9488 = new ILI9488(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_MOSI),Pin(GPIO_SPI_CLK),bppin);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ili9488->begin();
|
ili9488->begin();
|
||||||
renderer = ili9488;
|
renderer = ili9488;
|
||||||
@ -120,6 +93,9 @@ void ILI9488_InitDriver()
|
|||||||
#ifdef USE_FT5206
|
#ifdef USE_FT5206
|
||||||
Touch_Init(Wire);
|
Touch_Init(Wire);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ili9488_init_done = true;
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: ILI9488"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,8 +149,7 @@ bool Xdsp08(uint8_t function)
|
|||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
ILI9488_InitDriver();
|
ILI9488_InitDriver();
|
||||||
}
|
}
|
||||||
else if (XDSP_08 == Settings.display_model) {
|
else if (ili9488_init_done && (XDSP_08 == Settings.display_model)) {
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_DISPLAY_MODEL:
|
case FUNC_DISPLAY_MODEL:
|
||||||
result = true;
|
result = true;
|
||||||
@ -188,7 +163,6 @@ bool Xdsp08(uint8_t function)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <SSD1351.h>
|
#include <SSD1351.h>
|
||||||
|
|
||||||
|
bool ssd1351_init_done = false;
|
||||||
extern uint8_t *buffer;
|
extern uint8_t *buffer;
|
||||||
extern uint8_t color_type;
|
extern uint8_t color_type;
|
||||||
SSD1351 *ssd1351;
|
SSD1351 *ssd1351;
|
||||||
@ -40,11 +41,10 @@ SSD1351 *ssd1351;
|
|||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void SSD1351_InitDriver() {
|
void SSD1351_InitDriver() {
|
||||||
if (!Settings.display_model) {
|
if (PinUsed(GPIO_SSD1351_CS) &&
|
||||||
Settings.display_model = XDSP_09;
|
((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) {
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_09 == Settings.display_model) {
|
Settings.display_model = XDSP_09;
|
||||||
|
|
||||||
if (Settings.display_width != SSD1351_WIDTH) {
|
if (Settings.display_width != SSD1351_WIDTH) {
|
||||||
Settings.display_width = SSD1351_WIDTH;
|
Settings.display_width = SSD1351_WIDTH;
|
||||||
@ -53,21 +53,18 @@ void SSD1351_InitDriver() {
|
|||||||
Settings.display_height = SSD1351_HEIGHT;
|
Settings.display_height = SSD1351_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer=0;
|
buffer = 0;
|
||||||
|
|
||||||
// default colors
|
// default colors
|
||||||
fg_color = SSD1351_WHITE;
|
fg_color = SSD1351_WHITE;
|
||||||
bg_color = SSD1351_BLACK;
|
bg_color = SSD1351_BLACK;
|
||||||
|
|
||||||
// init renderer
|
// init renderer
|
||||||
if (PinUsed(GPIO_SSPI_CS) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK)){
|
if (TasmotaGlobal.soft_spi_enabled){
|
||||||
ssd1351 = new SSD1351(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_SCLK));
|
ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK));
|
||||||
} else {
|
|
||||||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
ssd1351 = new SSD1351(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_MOSI),Pin(GPIO_SPI_CLK));
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (TasmotaGlobal.spi_enabled) {
|
||||||
|
ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
@ -85,6 +82,9 @@ void SSD1351_InitDriver() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
color_type = COLOR_COLOR;
|
color_type = COLOR_COLOR;
|
||||||
|
|
||||||
|
ssd1351_init_done = true;
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: SSD1351"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ bool Xdsp09(uint8_t function)
|
|||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
SSD1351_InitDriver();
|
SSD1351_InitDriver();
|
||||||
}
|
}
|
||||||
else if (XDSP_09 == Settings.display_model) {
|
else if (ssd1351_init_done && (XDSP_09 == Settings.display_model)) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_DISPLAY_MODEL:
|
case FUNC_DISPLAY_MODEL:
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -33,19 +33,17 @@
|
|||||||
|
|
||||||
#include <RA8876.h>
|
#include <RA8876.h>
|
||||||
|
|
||||||
|
bool ra8876_init_done = false;
|
||||||
uint8_t ra8876_ctouch_counter = 0;
|
uint8_t ra8876_ctouch_counter = 0;
|
||||||
extern uint8_t *buffer;
|
extern uint8_t *buffer;
|
||||||
extern uint8_t color_type;
|
extern uint8_t color_type;
|
||||||
RA8876 *ra8876;
|
RA8876 *ra8876;
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
void RA8876_InitDriver()
|
void RA8876_InitDriver(void) {
|
||||||
{
|
if (PinUsed(GPIO_RA8876_CS) && (SPI_MOSI_MISO == TasmotaGlobal.spi_enabled)) {
|
||||||
if (!Settings.display_model) {
|
|
||||||
Settings.display_model = XDSP_10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_10 == Settings.display_model) {
|
Settings.display_model = XDSP_10;
|
||||||
|
|
||||||
if (Settings.display_width != RA8876_TFTWIDTH) {
|
if (Settings.display_width != RA8876_TFTWIDTH) {
|
||||||
Settings.display_width = RA8876_TFTWIDTH;
|
Settings.display_width = RA8876_TFTWIDTH;
|
||||||
@ -53,39 +51,15 @@ void RA8876_InitDriver()
|
|||||||
if (Settings.display_height != RA8876_TFTHEIGHT) {
|
if (Settings.display_height != RA8876_TFTHEIGHT) {
|
||||||
Settings.display_height = RA8876_TFTHEIGHT;
|
Settings.display_height = RA8876_TFTHEIGHT;
|
||||||
}
|
}
|
||||||
buffer=0;
|
|
||||||
|
buffer = 0;
|
||||||
|
|
||||||
// default colors
|
// default colors
|
||||||
fg_color = RA8876_WHITE;
|
fg_color = RA8876_WHITE;
|
||||||
bg_color = RA8876_BLACK;
|
bg_color = RA8876_BLACK;
|
||||||
|
|
||||||
#ifdef ESP8266
|
|
||||||
#undef HW_SPI_MOSI
|
|
||||||
#define HW_SPI_MOSI 13
|
|
||||||
#undef HW_SPI_MISO
|
|
||||||
#define HW_SPI_MISO 12
|
|
||||||
#undef HW_SPI_CLK
|
|
||||||
#define HW_SPI_CLK 14
|
|
||||||
#endif // ESP8266
|
|
||||||
#ifdef ESP32
|
|
||||||
#undef HW_SPI_MOSI
|
|
||||||
#define HW_SPI_MOSI 23
|
|
||||||
#undef HW_SPI_MISO
|
|
||||||
#define HW_SPI_MISO 19
|
|
||||||
#undef HW_SPI_CLK
|
|
||||||
#define HW_SPI_CLK 18
|
|
||||||
#endif // ESP32
|
|
||||||
|
|
||||||
// init renderer, must use hardware spi
|
// init renderer, must use hardware spi
|
||||||
if (PinUsed(GPIO_SSPI_CS) && (Pin(GPIO_SSPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SSPI_MISO)==HW_SPI_MISO) && (Pin(GPIO_SSPI_SCLK)==HW_SPI_CLK)) {
|
ra8876 = new RA8876(Pin(GPIO_RA8876_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_CLK), Pin(GPIO_BACKLIGHT));
|
||||||
ra8876 = new RA8876(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_MISO),Pin(GPIO_SSPI_SCLK),Pin(GPIO_BACKLIGHT));
|
|
||||||
} else {
|
|
||||||
if (PinUsed(GPIO_SPI_CS) && (Pin(GPIO_SPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SPI_MISO)==HW_SPI_MISO) && (Pin(GPIO_SPI_CLK)==HW_SPI_CLK)) {
|
|
||||||
ra8876 = new RA8876(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_MOSI),Pin(GPIO_SPI_MISO),Pin(GPIO_SPI_CLK),Pin(GPIO_BACKLIGHT));
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ra8876->begin();
|
ra8876->begin();
|
||||||
renderer = ra8876;
|
renderer = ra8876;
|
||||||
@ -107,6 +81,8 @@ void RA8876_InitDriver()
|
|||||||
Touch_Init(Wire);
|
Touch_Init(Wire);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ra8876_init_done = true;
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: RA8876"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +305,7 @@ bool Xdsp10(uint8_t function)
|
|||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
RA8876_InitDriver();
|
RA8876_InitDriver();
|
||||||
}
|
}
|
||||||
else if (XDSP_10 == Settings.display_model) {
|
else if (ra8876_init_done && (XDSP_10 == Settings.display_model)) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_DISPLAY_MODEL:
|
case FUNC_DISPLAY_MODEL:
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -53,16 +53,15 @@ Arduino_ST7789 *st7789;
|
|||||||
#ifdef USE_FT5206
|
#ifdef USE_FT5206
|
||||||
uint8_t st7789_ctouch_counter = 0;
|
uint8_t st7789_ctouch_counter = 0;
|
||||||
#endif // USE_FT5206
|
#endif // USE_FT5206
|
||||||
|
bool st7789_init_done = false;
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void ST7789_InitDriver()
|
void ST7789_InitDriver(void) {
|
||||||
{
|
if (PinUsed(GPIO_ST7789_CS) && PinUsed(GPIO_ST7789_DC) &&
|
||||||
if (!Settings.display_model) {
|
((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) {
|
||||||
Settings.display_model = XDSP_12;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_12 == Settings.display_model) {
|
Settings.display_model = XDSP_12;
|
||||||
|
|
||||||
if (!Settings.display_width) {
|
if (!Settings.display_width) {
|
||||||
Settings.display_width = 240;
|
Settings.display_width = 240;
|
||||||
@ -72,57 +71,30 @@ void ST7789_InitDriver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// disable screen buffer
|
// disable screen buffer
|
||||||
buffer=NULL;
|
buffer = NULL;
|
||||||
|
|
||||||
// default colors
|
// default colors
|
||||||
fg_color = ST7789_WHITE;
|
fg_color = ST7789_WHITE;
|
||||||
bg_color = ST7789_BLACK;
|
bg_color = ST7789_BLACK;
|
||||||
|
|
||||||
int8_t bppin=BACKPLANE_PIN;
|
int8_t bppin = BACKPLANE_PIN;
|
||||||
if (PinUsed(GPIO_BACKLIGHT)) {
|
if (PinUsed(GPIO_BACKLIGHT)) {
|
||||||
bppin=Pin(GPIO_BACKLIGHT);
|
bppin = Pin(GPIO_BACKLIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t reset = -1;
|
int8_t reset = -1;
|
||||||
if (PinUsed(GPIO_OLED_RESET)) {
|
if (PinUsed(GPIO_OLED_RESET)) {
|
||||||
reset=Pin(GPIO_OLED_RESET);
|
reset = Pin(GPIO_OLED_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t cs = -1;
|
|
||||||
if (PinUsed(GPIO_SSPI_CS)) {
|
|
||||||
cs=Pin(GPIO_SSPI_CS);
|
|
||||||
} else if (PinUsed(GPIO_SPI_CS)) {
|
|
||||||
cs=Pin(GPIO_SPI_CS);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
|
||||||
#undef HW_SPI_MOSI
|
|
||||||
#define HW_SPI_MOSI 13
|
|
||||||
#undef HW_SPI_CLK
|
|
||||||
#define HW_SPI_CLK 14
|
|
||||||
#endif // ESP8266
|
|
||||||
#ifdef ESP32
|
|
||||||
#undef HW_SPI_MOSI
|
|
||||||
#define HW_SPI_MOSI 23
|
|
||||||
#undef HW_SPI_CLK
|
|
||||||
#define HW_SPI_CLK 18
|
|
||||||
#endif // ESP32
|
|
||||||
|
|
||||||
// init renderer, may use hardware spi
|
// init renderer, may use hardware spi
|
||||||
//if (PinUsed(GPIO_SPI_CS) && (Pin(GPIO_SPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SPI_CLK)==HW_SPI_CLK) && PinUsed(GPIO_SPI_DC)) {
|
if (TasmotaGlobal.soft_spi_enabled) {
|
||||||
if ((Pin(GPIO_SPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SPI_CLK)==HW_SPI_CLK) && PinUsed(GPIO_SPI_DC)) {
|
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_SPI_DC), reset, cs, bppin);
|
|
||||||
} else {
|
|
||||||
if ((PinUsed(GPIO_SSPI_CS) || PinUsed(GPIO_OLED_RESET)) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_DC)) {
|
|
||||||
if ((Pin(GPIO_SSPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SSPI_SCLK)==HW_SPI_CLK)) {
|
|
||||||
st7789 = new Arduino_ST7789(Pin(GPIO_SSPI_DC), reset, cs, bppin);
|
|
||||||
} else {
|
|
||||||
st7789 = new Arduino_ST7789(Pin(GPIO_SSPI_DC), reset, Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), cs, bppin);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (TasmotaGlobal.spi_enabled) {
|
||||||
|
st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), reset, Pin(GPIO_ST7789_CS), bppin);
|
||||||
}
|
}
|
||||||
|
|
||||||
st7789->init(Settings.display_width,Settings.display_height);
|
st7789->init(Settings.display_width,Settings.display_height);
|
||||||
renderer = st7789;
|
renderer = st7789;
|
||||||
renderer->DisplayInit(DISPLAY_INIT_MODE,Settings.display_size,Settings.display_rotate,Settings.display_font);
|
renderer->DisplayInit(DISPLAY_INIT_MODE,Settings.display_size,Settings.display_rotate,Settings.display_font);
|
||||||
@ -154,6 +126,8 @@ void ST7789_InitDriver()
|
|||||||
#endif // USE_FT5206
|
#endif // USE_FT5206
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
|
st7789_init_done = true;
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: ST7789"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +186,7 @@ bool Xdsp12(uint8_t function)
|
|||||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||||
ST7789_InitDriver();
|
ST7789_InitDriver();
|
||||||
}
|
}
|
||||||
else if (XDSP_12 == Settings.display_model) {
|
else if (st7789_init_done && (XDSP_12 == Settings.display_model)) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_DISPLAY_MODEL:
|
case FUNC_DISPLAY_MODEL:
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -409,7 +409,8 @@ static union{
|
|||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
void MINRFinit(void){
|
void MINRFinit(void) {
|
||||||
|
if (PinUsed(GPIO_NRF24_CS) && PinUsed(GPIO_NRF24_DC) && TasmotaGlobal.spi_enabled) {
|
||||||
MINRFinitBLE(1);
|
MINRFinitBLE(1);
|
||||||
|
|
||||||
MINRF.option.allwaysAggregate = 1;
|
MINRF.option.allwaysAggregate = 1;
|
||||||
@ -417,6 +418,9 @@ void MINRFinit(void){
|
|||||||
MINRF.option.noSummary = 0;
|
MINRF.option.noSummary = 0;
|
||||||
MINRF.option.minimalSummary = 0;
|
MINRF.option.minimalSummary = 0;
|
||||||
MINRF.option.directBridgeMode = 0;
|
MINRF.option.directBridgeMode = 0;
|
||||||
|
|
||||||
|
AddLog_P(LOG_LEVEL_INFO, PSTR("NRF: Started"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
@ -431,7 +435,7 @@ void MINRFinit(void){
|
|||||||
bool MINRFinitBLE(uint8_t _mode)
|
bool MINRFinitBLE(uint8_t _mode)
|
||||||
{
|
{
|
||||||
if (MINRF.timer%1000 == 0){ // only re-init every 20 seconds
|
if (MINRF.timer%1000 == 0){ // only re-init every 20 seconds
|
||||||
NRF24radio.begin(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_DC));
|
NRF24radio.begin(Pin(GPIO_NRF24_CS),Pin(GPIO_NRF24_DC));
|
||||||
NRF24radio.setAutoAck(false);
|
NRF24radio.setAutoAck(false);
|
||||||
NRF24radio.setDataRate(RF24_1MBPS);
|
NRF24radio.setDataRate(RF24_1MBPS);
|
||||||
NRF24radio.disableCRC();
|
NRF24radio.disableCRC();
|
||||||
@ -1958,7 +1962,6 @@ bool Xsns61(uint8_t function)
|
|||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_INIT:
|
case FUNC_INIT:
|
||||||
MINRFinit();
|
MINRFinit();
|
||||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF: started"));
|
|
||||||
break;
|
break;
|
||||||
case FUNC_EVERY_50_MSECOND:
|
case FUNC_EVERY_50_MSECOND:
|
||||||
MINRF_EVERY_50_MSECOND();
|
MINRF_EVERY_50_MSECOND();
|
||||||
|
@ -98,7 +98,7 @@ void RC522ScanForTag(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RC522Init(void) {
|
void RC522Init(void) {
|
||||||
if (PinUsed(GPIO_RC522_CS) && PinUsed(GPIO_RC522_RST)) {
|
if (PinUsed(GPIO_RC522_CS) && PinUsed(GPIO_RC522_RST) && TasmotaGlobal.spi_enabled) {
|
||||||
Mfrc522 = new MFRC522(Pin(GPIO_RC522_CS), Pin(GPIO_RC522_RST));
|
Mfrc522 = new MFRC522(Pin(GPIO_RC522_CS), Pin(GPIO_RC522_RST));
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
Mfrc522->PCD_Init();
|
Mfrc522->PCD_Init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user