Merge pull request #2955 from ezcGman/i2c-build-flags
Add build flags for global i2c & SPI pins
This commit is contained in:
commit
b94e0ef797
@ -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
|
||||
|
@ -676,11 +676,37 @@ WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available l
|
||||
// Usermod manager
|
||||
WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
|
||||
|
||||
WLED_GLOBAL int8_t i2c_sda _INIT(-1); // global I2C SDA pin [HW_PIN_SDA] (used for usermods)
|
||||
WLED_GLOBAL int8_t i2c_scl _INIT(-1); // global I2C SCL pin [HW_PIN_SCL] (used for usermods)
|
||||
WLED_GLOBAL int8_t spi_mosi _INIT(-1); // global SPI DATA/MOSI pin [HW_PIN_DATASPI] (used for usermods)
|
||||
WLED_GLOBAL int8_t spi_miso _INIT(-1); // global SPI DATA/MISO pin [HW_PIN_MISOSPI] (used for usermods)
|
||||
WLED_GLOBAL int8_t spi_sclk _INIT(-1); // global SPI CLOCK/SCLK pin [HW_PIN_CLOCKSPI] (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 (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 (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 (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 (used for usermods)
|
||||
#ifndef SPISCLKPIN
|
||||
WLED_GLOBAL int8_t spi_sclk _INIT(-1);
|
||||
#else
|
||||
WLED_GLOBAL int8_t spi_sclk _INIT(SPISCLKPIN);
|
||||
#endif
|
||||
|
||||
// global ArduinoJson buffer
|
||||
WLED_GLOBAL StaticJsonDocument<JSON_BUFFER_SIZE> doc;
|
||||
|
Loading…
Reference in New Issue
Block a user