Permalink
Browse files

Better handle places where yield isn't defined by the system. E.g. Fi…

…xing #413.
  • Loading branch information...
focalintent committed Aug 16, 2017
1 parent f4d323b commit 06521a48e9febdea8dbf3a5520620a578c051f95
Showing with 16 additions and 7 deletions.
  1. +4 −2 FastLED.cpp
  2. +0 −5 lib8tion.h
  3. +12 −0 platforms/avr/led_sysdefs_avr.h
View
@@ -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
{
View
@@ -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)
@@ -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

2 comments on commit 06521a4

@philfifi

This comment has been minimized.

Show comment
Hide comment
@philfifi

philfifi Aug 27, 2017

Hello,
There is a typo in define FASTLED_NEEDS_YIELD compared to the #ifdef.

philfifi replied Aug 27, 2017

Hello,
There is a typo in define FASTLED_NEEDS_YIELD compared to the #ifdef.

@NicoHood

This comment has been minimized.

Show comment
Hide comment
@NicoHood

NicoHood Aug 27, 2017

Contributor

In my build system also __empty() was not available.
NicoHood@f80a64c

Contributor

NicoHood replied Aug 27, 2017

In my build system also __empty() was not available.
NicoHood@f80a64c

Please sign in to comment.