Carifications and implicit HW_PIN... definition

This commit is contained in:
Blaz Kristan 2022-12-18 11:33:13 +01:00
parent 171cebed1c
commit 00fed4f995
2 changed files with 28 additions and 12 deletions

View File

@ -392,12 +392,22 @@
#define INTERFACE_UPDATE_COOLDOWN 2000 //time in ms to wait between websockets, alexa, and MQTT updates #define INTERFACE_UPDATE_COOLDOWN 2000 //time in ms to wait between websockets, alexa, and MQTT updates
// HW_PIN_SCL & HW_PIN_SDA are used for information in usermods settings page and usermods themselves
// which GPIO pins are actually used in a hardwarea layout (controller board)
#if defined(I2CSCLPIN) && !defined(HW_PIN_SCL)
#define HW_PIN_SCL I2CSCLPIN
#endif
#if defined(I2CSDAPIN) && !defined(HW_PIN_SDA)
#define HW_PIN_SDA I2CSDAPIN
#endif
// you cannot change HW I2C pins on 8266
#if defined(ESP8266) && defined(HW_PIN_SCL) #if defined(ESP8266) && defined(HW_PIN_SCL)
#undef HW_PIN_SCL #undef HW_PIN_SCL
#endif #endif
#if defined(ESP8266) && defined(HW_PIN_SDA) #if defined(ESP8266) && defined(HW_PIN_SDA)
#undef HW_PIN_SDA #undef HW_PIN_SDA
#endif #endif
// defaults for 1st I2C on ESP32 (Wire global)
#ifndef HW_PIN_SCL #ifndef HW_PIN_SCL
#define HW_PIN_SCL SCL #define HW_PIN_SCL SCL
#endif #endif
@ -405,6 +415,18 @@
#define HW_PIN_SDA SDA #define HW_PIN_SDA SDA
#endif #endif
// HW_PIN_SCLKSPI & HW_PIN_MOSISPI & HW_PIN_MISOSPI are used for information in usermods settings page and usermods themselves
// which GPIO pins are actually used in a hardwarea layout (controller board)
#if defined(SPISCLKPIN) && !defined(HW_PIN_CLOCKSPI)
#define HW_PIN_CLOCKSPI SPISCLKPIN
#endif
#if defined(SPIMOSIPIN) && !defined(HW_PIN_MOSISPI)
#define HW_PIN_MOSISPI SPIMOSIPIN
#endif
#if defined(SPIMISOPIN) && !defined(HW_PIN_MISOSPI)
#define HW_PIN_MISOSPI SPIMISOPIN
#endif
// you cannot change HW SPI pins on 8266
#if defined(ESP8266) && defined(HW_PIN_CLOCKSPI) #if defined(ESP8266) && defined(HW_PIN_CLOCKSPI)
#undef HW_PIN_CLOCKSPI #undef HW_PIN_CLOCKSPI
#endif #endif
@ -414,10 +436,7 @@
#if defined(ESP8266) && defined(HW_PIN_MISOSPI) #if defined(ESP8266) && defined(HW_PIN_MISOSPI)
#undef HW_PIN_MISOSPI #undef HW_PIN_MISOSPI
#endif #endif
#if defined(ESP8266) && defined(HW_PIN_CSSPI) // defaults for VSPI on ESP32 (SPI global, SPI.cpp) as HSPI is used by WLED (bus_wrapper.h)
#undef HW_PIN_CSSPI
#endif
// defaults for VSPI
#ifndef HW_PIN_CLOCKSPI #ifndef HW_PIN_CLOCKSPI
#define HW_PIN_CLOCKSPI SCK #define HW_PIN_CLOCKSPI SCK
#endif #endif
@ -427,8 +446,5 @@
#ifndef HW_PIN_MISOSPI #ifndef HW_PIN_MISOSPI
#define HW_PIN_MISOSPI MISO #define HW_PIN_MISOSPI MISO
#endif #endif
#ifndef HW_PIN_CSSPI
#define HW_PIN_CSSPI SS
#endif
#endif #endif

View File

@ -676,32 +676,32 @@ WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available l
// Usermod manager // Usermod manager
WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager()); WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
// global I2C SDA pin [HW_PIN_SDA] (used for usermods) // global I2C SDA pin (used for usermods)
#ifndef I2CSDAPIN #ifndef I2CSDAPIN
WLED_GLOBAL int8_t i2c_sda _INIT(-1); WLED_GLOBAL int8_t i2c_sda _INIT(-1);
#else #else
WLED_GLOBAL int8_t i2c_sda _INIT(I2CSDAPIN); WLED_GLOBAL int8_t i2c_sda _INIT(I2CSDAPIN);
#endif #endif
// global I2C SCL pin [HW_PIN_SCL] (used for usermods) // global I2C SCL pin (used for usermods)
#ifndef I2CSCLPIN #ifndef I2CSCLPIN
WLED_GLOBAL int8_t i2c_scl _INIT(-1); WLED_GLOBAL int8_t i2c_scl _INIT(-1);
#else #else
WLED_GLOBAL int8_t i2c_scl _INIT(I2CSCLPIN); WLED_GLOBAL int8_t i2c_scl _INIT(I2CSCLPIN);
#endif #endif
// global SPI DATA/MOSI pin [HW_PIN_DATASPI] (used for usermods) // global SPI DATA/MOSI pin (used for usermods)
#ifndef SPIMOSIPIN #ifndef SPIMOSIPIN
WLED_GLOBAL int8_t spi_mosi _INIT(-1); WLED_GLOBAL int8_t spi_mosi _INIT(-1);
#else #else
WLED_GLOBAL int8_t spi_mosi _INIT(SPIMOSIPIN); WLED_GLOBAL int8_t spi_mosi _INIT(SPIMOSIPIN);
#endif #endif
// global SPI DATA/MISO pin [HW_PIN_MISOSPI] (used for usermods) // global SPI DATA/MISO pin (used for usermods)
#ifndef SPIMISOPIN #ifndef SPIMISOPIN
WLED_GLOBAL int8_t spi_miso _INIT(-1); WLED_GLOBAL int8_t spi_miso _INIT(-1);
#else #else
WLED_GLOBAL int8_t spi_miso _INIT(SPIMISOPIN); WLED_GLOBAL int8_t spi_miso _INIT(SPIMISOPIN);
#endif #endif
// global SPI CLOCK/SCLK pin [HW_PIN_CLOCKSPI] (used for usermods) // global SPI CLOCK/SCLK pin (used for usermods)
#ifndef SPISCLKPIN #ifndef SPISCLKPIN
WLED_GLOBAL int8_t spi_sclk _INIT(-1); WLED_GLOBAL int8_t spi_sclk _INIT(-1);
#else #else