From 00fed4f995c8936433b77939ec67bb7550efa9d7 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sun, 18 Dec 2022 11:33:13 +0100 Subject: [PATCH] Carifications and implicit HW_PIN... definition --- wled00/const.h | 30 +++++++++++++++++++++++------- wled00/wled.h | 10 +++++----- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/wled00/const.h b/wled00/const.h index d863ee2e..667656f4 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -392,12 +392,22 @@ #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) #undef HW_PIN_SCL #endif #if defined(ESP8266) && defined(HW_PIN_SDA) #undef HW_PIN_SDA #endif +// defaults for 1st I2C on ESP32 (Wire global) #ifndef HW_PIN_SCL #define HW_PIN_SCL SCL #endif @@ -405,6 +415,18 @@ #define HW_PIN_SDA SDA #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) #undef HW_PIN_CLOCKSPI #endif @@ -414,10 +436,7 @@ #if defined(ESP8266) && defined(HW_PIN_MISOSPI) #undef HW_PIN_MISOSPI #endif -#if defined(ESP8266) && defined(HW_PIN_CSSPI) - #undef HW_PIN_CSSPI -#endif -// defaults for VSPI +// defaults for VSPI on ESP32 (SPI global, SPI.cpp) as HSPI is used by WLED (bus_wrapper.h) #ifndef HW_PIN_CLOCKSPI #define HW_PIN_CLOCKSPI SCK #endif @@ -427,8 +446,5 @@ #ifndef HW_PIN_MISOSPI #define HW_PIN_MISOSPI MISO #endif -#ifndef HW_PIN_CSSPI - #define HW_PIN_CSSPI SS -#endif #endif diff --git a/wled00/wled.h b/wled00/wled.h index 9124cedc..6dea8d2e 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -676,32 +676,32 @@ WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available l // Usermod manager 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 WLED_GLOBAL int8_t i2c_sda _INIT(-1); #else WLED_GLOBAL int8_t i2c_sda _INIT(I2CSDAPIN); #endif -// global I2C SCL pin [HW_PIN_SCL] (used for usermods) +// global I2C SCL pin (used for usermods) #ifndef I2CSCLPIN WLED_GLOBAL int8_t i2c_scl _INIT(-1); #else WLED_GLOBAL int8_t i2c_scl _INIT(I2CSCLPIN); #endif -// global SPI DATA/MOSI pin [HW_PIN_DATASPI] (used for usermods) +// global SPI DATA/MOSI pin (used for usermods) #ifndef SPIMOSIPIN WLED_GLOBAL int8_t spi_mosi _INIT(-1); #else WLED_GLOBAL int8_t spi_mosi _INIT(SPIMOSIPIN); #endif -// global SPI DATA/MISO pin [HW_PIN_MISOSPI] (used for usermods) +// global SPI DATA/MISO pin (used for usermods) #ifndef SPIMISOPIN WLED_GLOBAL int8_t spi_miso _INIT(-1); #else WLED_GLOBAL int8_t spi_miso _INIT(SPIMISOPIN); #endif -// global SPI CLOCK/SCLK pin [HW_PIN_CLOCKSPI] (used for usermods) +// global SPI CLOCK/SCLK pin (used for usermods) #ifndef SPISCLKPIN WLED_GLOBAL int8_t spi_sclk _INIT(-1); #else