Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Garcia <danielgarcia@gmail.com>2017-08-17 00:45:58 +0300
committerDaniel Garcia <danielgarcia@gmail.com>2017-08-17 00:45:58 +0300
commit06521a48e9febdea8dbf3a5520620a578c051f95 (patch)
tree959de07403ad0338b1922d82df725e308f583c8a
parentf4d323b2196db0fcac6bf671ffe83d9dc52c09be (diff)
Better handle places where yield isn't defined by the system. E.g. Fixing #413.
-rw-r--r--FastLED.cpp6
-rw-r--r--lib8tion.h5
-rw-r--r--platforms/avr/led_sysdefs_avr.h12
3 files changed, 16 insertions, 7 deletions
diff --git a/FastLED.cpp b/FastLED.cpp
index 422c8ca0..7131da15 100644
--- a/FastLED.cpp
+++ b/FastLED.cpp
@@ -129,9 +129,7 @@ void CFastLED::delay(unsigned long ms) {
::delay(1);
#endif
show();
-#if defined(ARDUINO) && (ARDUINO > 150) && !defined(IS_BEAN) && !defined (ARDUINO_AVR_DIGISPARK) && !defined (__AVR_ATtinyX41__)
yield();
-#endif
}
while((millis()-start) < ms);
}
@@ -234,6 +232,10 @@ void CFastLED::setMaxRefreshRate(uint16_t refresh, bool constrain) {
extern "C" int atexit(void (* /*func*/ )()) { return 0; }
+#ifdef FASTLED_NEED_YIELD
+extern "C" void yield(void) __attribute__ ((weak, alias("__empty")));
+#endif
+
#ifdef NEED_CXX_BITS
namespace __cxxabiv1
{
diff --git a/lib8tion.h b/lib8tion.h
index 8a229084..c54f6b01 100644
--- a/lib8tion.h
+++ b/lib8tion.h
@@ -183,11 +183,6 @@ Lib8tion is pronounced like 'libation': lie-BAY-shun
// for memmove, memcpy, and memset if not defined here
#endif
-#if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtinyX41__)
-#define LIB8_ATTINY 1
-#endif
-
-
#if defined(__arm__)
#if defined(FASTLED_TEENSY3)
diff --git a/platforms/avr/led_sysdefs_avr.h b/platforms/avr/led_sysdefs_avr.h
index 37f8cff7..2a8dc164 100644
--- a/platforms/avr/led_sysdefs_avr.h
+++ b/platforms/avr/led_sysdefs_avr.h
@@ -51,4 +51,16 @@ extern volatile unsigned long timer0_millis;
# endif
};
+// special defs for the tiny environments
+#if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtinyX41__)
+#define LIB8_ATTINY 1
+#define FASTLED_NEEDS_YIELD
+#endif
+
+#if defined(ARDUINO) && (ARDUINO > 150) && !defined(IS_BEAN) && !defined (ARDUINO_AVR_DIGISPARK) && !defined (LIB8_TINY)
+// don't need YIELD defined by the library
+#else
+#define FASTLED_NEEDS_YIELD
+extern "C" void yield();
+#endif
#endif