diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2016-05-17 11:59:19 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2016-05-17 11:59:19 +0300 |
commit | ae5598f762179cf466c8277ee1399349c3bd7b11 (patch) | |
tree | ce4678e668ec56fb038415bb5cfc6551739f1610 | |
parent | a5e92af84d6e1d37bee2b352bda5f56c4567ebd6 (diff) |
Fix #305 - block out pins that will cause the device to WDT on use, also put in logic to chose the correct pin to gpio mapping based on the board being compiled for.
-rw-r--r-- | platforms/esp/8266/fastpin_esp8266.h | 42 | ||||
-rw-r--r-- | platforms/esp/8266/led_sysdefs_esp8266.h | 15 |
2 files changed, 46 insertions, 11 deletions
diff --git a/platforms/esp/8266/fastpin_esp8266.h b/platforms/esp/8266/fastpin_esp8266.h index d6acd92c..04993493 100644 --- a/platforms/esp/8266/fastpin_esp8266.h +++ b/platforms/esp/8266/fastpin_esp8266.h @@ -35,23 +35,49 @@ public: #define _DEFPIN_ESP8266(PIN, REAL_PIN) template<> class FastPin<PIN> : public _ESPPIN<REAL_PIN, (1<<(REAL_PIN & 0xFF))> {}; -#define MAX_PIN 16 #ifdef FASTLED_ESP8266_RAW_PIN_ORDER +#define MAX_PIN 16 _DEFPIN_ESP8266(0,0); _DEFPIN_ESP8266(1,1); _DEFPIN_ESP8266(2,2); _DEFPIN_ESP8266(3,3); -_DEFPIN_ESP8266(4,4); _DEFPIN_ESP8266(5,5); _DEFPIN_ESP8266(6,6); _DEFPIN_ESP8266(7,7); -_DEFPIN_ESP8266(8,8); _DEFPIN_ESP8266(9,9); _DEFPIN_ESP8266(10,10); _DEFPIN_ESP8266(11,11); +_DEFPIN_ESP8266(4,4); _DEFPIN_ESP8266(5,5); + +// These pins should be disabled, as they always cause WDT resets +// _DEFPIN_ESP8266(6,6); _DEFPIN_ESP8266(7,7); +// _DEFPIN_ESP8266(8,8); _DEFPIN_ESP8266(9,9); _DEFPIN_ESP8266(10,10); _DEFPIN_ESP8266(11,11); + _DEFPIN_ESP8266(12,12); _DEFPIN_ESP8266(13,13); _DEFPIN_ESP8266(14,14); _DEFPIN_ESP8266(15,15); -#else +_DEFPIN_ESP8266(16,16); +#elif defined(FASTLED_ESP8266_D1_PIN_ORDER) +#define MAX_PIN 15 +_DEFPIN_ESP8266(0,3); +_DEFPIN_ESP8266(1,1); +_DEFPIN_ESP8266(2,16); +_DEFPIN_ESP8266(3,5); +_DEFPIN_ESP8266(4,4); +_DEFPIN_ESP8266(5,14); +_DEFPIN_ESP8266(6,12); +_DEFPIN_ESP8266(7,13); +_DEFPIN_ESP8266(8,0); +_DEFPIN_ESP8266(9,2); +_DEFPIN_ESP8266(10,15); +_DEFPIN_ESP8266(11,13); +_DEFPIN_ESP8266(12,12); +_DEFPIN_ESP8266(13,14); +_DEFPIN_ESP8266(14,4); +_DEFPIN_ESP8266(15,5); +#else // if defined(FASTLED_ESP8266_NODEMCU_PIN_ORDER) +#define MAX_PIN 10 + // This seems to be the standard Dxx pin mapping on most of the esp boards that i've found _DEFPIN_ESP8266(0,16); _DEFPIN_ESP8266(1,5); _DEFPIN_ESP8266(2,4); _DEFPIN_ESP8266(3,0); _DEFPIN_ESP8266(4,2); _DEFPIN_ESP8266(5,14); _DEFPIN_ESP8266(6,12); _DEFPIN_ESP8266(7,13); _DEFPIN_ESP8266(8,15); _DEFPIN_ESP8266(9,3); _DEFPIN_ESP8266(10,1); -// extra pins, for completeness, most esp8266 boards don't seem to expose these? -_DEFPIN_ESP8266(11,6); -_DEFPIN_ESP8266(12,7); _DEFPIN_ESP8266(13,8); _DEFPIN_ESP8266(14,9); _DEFPIN_ESP8266(15,10); -_DEFPIN_ESP8266(16,11); +// The rest of the pins - these are generally not available +// _DEFPIN_ESP8266(11,6); +// _DEFPIN_ESP8266(12,7); _DEFPIN_ESP8266(13,8); _DEFPIN_ESP8266(14,9); _DEFPIN_ESP8266(15,10); +// _DEFPIN_ESP8266(16,11); + #endif #define HAS_HARDWARE_PIN_SUPPORT diff --git a/platforms/esp/8266/led_sysdefs_esp8266.h b/platforms/esp/8266/led_sysdefs_esp8266.h index 0cbfaee2..a3f6ac32 100644 --- a/platforms/esp/8266/led_sysdefs_esp8266.h +++ b/platforms/esp/8266/led_sysdefs_esp8266.h @@ -16,15 +16,24 @@ typedef uint8_t boolean; // Default to NOT using PROGMEM here #ifndef FASTLED_USE_PROGMEM -#define FASTLED_USE_PROGMEM 0 +# define FASTLED_USE_PROGMEM 0 #endif #ifndef FASTLED_ALLOW_INTERRUPTS -#define FASTLED_ALLOW_INTERRUPTS 1 -#define INTERRUPT_THRESHOLD 0 +# define FASTLED_ALLOW_INTERRUPTS 1 +# define INTERRUPT_THRESHOLD 0 #endif #define NEED_CXX_BITS +// These can be overridden +#if !defined(FASTLED_ESP8266_RAW_PIN_ORDER) && !defined(FASTLED_ESP8266_NODEMCU_PIN_ORDER) && !defined(FASTLED_ESP8266_D1_PIN_ORDER) +# ifdef ARDUINO_ESP8266_NODEMCU +# define FASTLED_ESP8266_NODEMCU_PIN_ORDER +# else +# define FASTLED_ESP8266_RAW_PIN_ORDER +# endif +#endif + // #define cli() os_intr_lock(); // #define sei() os_intr_lock(); |