Skip to content

Commit 00fed4f

Browse files
committed
Carifications and implicit HW_PIN... definition
1 parent 171cebe commit 00fed4f

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

wled00/const.h

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,19 +392,41 @@
392392

393393
#define INTERFACE_UPDATE_COOLDOWN 2000 //time in ms to wait between websockets, alexa, and MQTT updates
394394

395+
// HW_PIN_SCL & HW_PIN_SDA are used for information in usermods settings page and usermods themselves
396+
// which GPIO pins are actually used in a hardwarea layout (controller board)
397+
#if defined(I2CSCLPIN) && !defined(HW_PIN_SCL)
398+
#define HW_PIN_SCL I2CSCLPIN
399+
#endif
400+
#if defined(I2CSDAPIN) && !defined(HW_PIN_SDA)
401+
#define HW_PIN_SDA I2CSDAPIN
402+
#endif
403+
// you cannot change HW I2C pins on 8266
395404
#if defined(ESP8266) && defined(HW_PIN_SCL)
396405
#undef HW_PIN_SCL
397406
#endif
398407
#if defined(ESP8266) && defined(HW_PIN_SDA)
399408
#undef HW_PIN_SDA
400409
#endif
410+
// defaults for 1st I2C on ESP32 (Wire global)
401411
#ifndef HW_PIN_SCL
402412
#define HW_PIN_SCL SCL
403413
#endif
404414
#ifndef HW_PIN_SDA
405415
#define HW_PIN_SDA SDA
406416
#endif
407417

418+
// HW_PIN_SCLKSPI & HW_PIN_MOSISPI & HW_PIN_MISOSPI are used for information in usermods settings page and usermods themselves
419+
// which GPIO pins are actually used in a hardwarea layout (controller board)
420+
#if defined(SPISCLKPIN) && !defined(HW_PIN_CLOCKSPI)
421+
#define HW_PIN_CLOCKSPI SPISCLKPIN
422+
#endif
423+
#if defined(SPIMOSIPIN) && !defined(HW_PIN_MOSISPI)
424+
#define HW_PIN_MOSISPI SPIMOSIPIN
425+
#endif
426+
#if defined(SPIMISOPIN) && !defined(HW_PIN_MISOSPI)
427+
#define HW_PIN_MISOSPI SPIMISOPIN
428+
#endif
429+
// you cannot change HW SPI pins on 8266
408430
#if defined(ESP8266) && defined(HW_PIN_CLOCKSPI)
409431
#undef HW_PIN_CLOCKSPI
410432
#endif
@@ -414,10 +436,7 @@
414436
#if defined(ESP8266) && defined(HW_PIN_MISOSPI)
415437
#undef HW_PIN_MISOSPI
416438
#endif
417-
#if defined(ESP8266) && defined(HW_PIN_CSSPI)
418-
#undef HW_PIN_CSSPI
419-
#endif
420-
// defaults for VSPI
439+
// defaults for VSPI on ESP32 (SPI global, SPI.cpp) as HSPI is used by WLED (bus_wrapper.h)
421440
#ifndef HW_PIN_CLOCKSPI
422441
#define HW_PIN_CLOCKSPI SCK
423442
#endif
@@ -427,8 +446,5 @@
427446
#ifndef HW_PIN_MISOSPI
428447
#define HW_PIN_MISOSPI MISO
429448
#endif
430-
#ifndef HW_PIN_CSSPI
431-
#define HW_PIN_CSSPI SS
432-
#endif
433449

434450
#endif

wled00/wled.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,32 +676,32 @@ WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available l
676676
// Usermod manager
677677
WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
678678

679-
// global I2C SDA pin [HW_PIN_SDA] (used for usermods)
679+
// global I2C SDA pin (used for usermods)
680680
#ifndef I2CSDAPIN
681681
WLED_GLOBAL int8_t i2c_sda _INIT(-1);
682682
#else
683683
WLED_GLOBAL int8_t i2c_sda _INIT(I2CSDAPIN);
684684
#endif
685-
// global I2C SCL pin [HW_PIN_SCL] (used for usermods)
685+
// global I2C SCL pin (used for usermods)
686686
#ifndef I2CSCLPIN
687687
WLED_GLOBAL int8_t i2c_scl _INIT(-1);
688688
#else
689689
WLED_GLOBAL int8_t i2c_scl _INIT(I2CSCLPIN);
690690
#endif
691691

692-
// global SPI DATA/MOSI pin [HW_PIN_DATASPI] (used for usermods)
692+
// global SPI DATA/MOSI pin (used for usermods)
693693
#ifndef SPIMOSIPIN
694694
WLED_GLOBAL int8_t spi_mosi _INIT(-1);
695695
#else
696696
WLED_GLOBAL int8_t spi_mosi _INIT(SPIMOSIPIN);
697697
#endif
698-
// global SPI DATA/MISO pin [HW_PIN_MISOSPI] (used for usermods)
698+
// global SPI DATA/MISO pin (used for usermods)
699699
#ifndef SPIMISOPIN
700700
WLED_GLOBAL int8_t spi_miso _INIT(-1);
701701
#else
702702
WLED_GLOBAL int8_t spi_miso _INIT(SPIMISOPIN);
703703
#endif
704-
// global SPI CLOCK/SCLK pin [HW_PIN_CLOCKSPI] (used for usermods)
704+
// global SPI CLOCK/SCLK pin (used for usermods)
705705
#ifndef SPISCLKPIN
706706
WLED_GLOBAL int8_t spi_sclk _INIT(-1);
707707
#else

0 commit comments

Comments
 (0)