mirror of https://github.com/arendst/Tasmota.git
Removed the need for SPI for TM1637 to work
This commit is contained in:
parent
c5f79aa532
commit
75699fe203
|
@ -1678,9 +1678,7 @@ void GpioInit(void)
|
|||
ValidSpiPinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
|
||||
ValidSpiPinUsed(GPIO_ST7789_CS) ||
|
||||
(ValidSpiPinUsed(GPIO_SSD1331_CS) && ValidSpiPinUsed(GPIO_SSD1331_DC)) ||
|
||||
ValidSpiPinUsed(GPIO_SDCARD_CS) ||
|
||||
(ValidSpiPinUsed(GPIO_TM1637CLK) && ValidSpiPinUsed(GPIO_TM1637DIO)) ||
|
||||
(ValidSpiPinUsed(GPIO_TM1638CLK) && ValidSpiPinUsed(GPIO_TM1638DIO) && ValidSpiPinUsed(GPIO_TM1638STB))
|
||||
ValidSpiPinUsed(GPIO_SDCARD_CS)
|
||||
);
|
||||
// If SPI_CS and/or SPI_DC is used they must be valid
|
||||
TasmotaGlobal.spi_enabled = (valid_cs) ? SPI_MOSI_MISO : SPI_NONE;
|
||||
|
|
|
@ -147,6 +147,7 @@ struct {
|
|||
bool module_changed; // Indicate module changed since last restart
|
||||
bool wifi_stay_asleep; // Allow sleep only incase of ESP32 BLE
|
||||
bool no_autoexec; // Disable autoexec
|
||||
bool tm1637_enabled; // TM1637 driver enabled
|
||||
|
||||
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
|
||||
uint8_t spi_enabled; // SPI configured
|
||||
|
@ -227,7 +228,9 @@ void setup(void) {
|
|||
TasmotaGlobal.tele_period = 9999;
|
||||
TasmotaGlobal.active_device = 1;
|
||||
TasmotaGlobal.global_state.data = 0xF; // Init global state (wifi_down, mqtt_down) to solve possible network issues
|
||||
|
||||
#if defined(USE_DISPLAY) && defined(USE_DISPLAY_TM1637)
|
||||
TasmotaGlobal.tm1637_enabled = true;
|
||||
#endif
|
||||
RtcRebootLoad();
|
||||
if (!RtcRebootValid()) {
|
||||
RtcReboot.fast_reboot_count = 0;
|
||||
|
|
|
@ -2779,7 +2779,7 @@ bool Xdrv13(uint8_t function)
|
|||
{
|
||||
bool result = false;
|
||||
|
||||
if ((TasmotaGlobal.i2c_enabled || TasmotaGlobal.spi_enabled || TasmotaGlobal.soft_spi_enabled) && XdspPresent()) {
|
||||
if ((TasmotaGlobal.i2c_enabled || TasmotaGlobal.spi_enabled || TasmotaGlobal.soft_spi_enabled || TasmotaGlobal.tm1637_enabled) && XdspPresent()) {
|
||||
switch (function) {
|
||||
case FUNC_PRE_INIT:
|
||||
DisplayInitDriver();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(USE_I2C) || defined(USE_SPI)
|
||||
#if defined(USE_I2C) || defined(USE_SPI) || defined(USE_DISPLAY_TM1637)
|
||||
#ifdef USE_DISPLAY
|
||||
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
|
@ -26,6 +26,8 @@ bool (* const xdsp_func_ptr[])(uint8_t) PROGMEM = { // Display Function Pointe
|
|||
bool (* const xdsp_func_ptr[])(uint8_t) = { // Display Function Pointers
|
||||
#endif
|
||||
|
||||
#if defined(USE_I2C) || defined(USE_SPI)
|
||||
|
||||
#ifdef XDSP_01
|
||||
&Xdsp01,
|
||||
#endif
|
||||
|
@ -82,10 +84,18 @@ bool (* const xdsp_func_ptr[])(uint8_t) = { // Display Function Pointers
|
|||
&Xdsp14,
|
||||
#endif
|
||||
|
||||
#endif // #if defined(USE_I2C) || defined(USE_SPI)
|
||||
|
||||
#ifdef USE_DISPLAY_TM1637
|
||||
|
||||
#ifdef XDSP_15
|
||||
&Xdsp15,
|
||||
#endif
|
||||
|
||||
#endif // USE_DISPLAY_TM1637
|
||||
|
||||
#if defined(USE_I2C) || defined(USE_SPI)
|
||||
|
||||
#ifdef XDSP_16
|
||||
&Xdsp16,
|
||||
#endif
|
||||
|
@ -153,6 +163,9 @@ bool (* const xdsp_func_ptr[])(uint8_t) = { // Display Function Pointers
|
|||
#ifdef XDSP_32
|
||||
&Xdsp32
|
||||
#endif
|
||||
|
||||
#endif // #if defined(USE_I2C) || defined(USE_SPI)
|
||||
|
||||
};
|
||||
|
||||
const uint8_t xdsp_present = sizeof(xdsp_func_ptr) / sizeof(xdsp_func_ptr[0]); // Number of drivers found
|
||||
|
|
Loading…
Reference in New Issue