1#define FASTLED_INTERNAL
12#if defined(FASTLED_AVR) && !defined(TEENSYDUINO) && !defined(LIB8_ATTINY)
16#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(64 * 256))
18typedef union {
unsigned long _long; uint8_t raw[4]; } tBytesForLong;
20volatile unsigned long FastLED_timer0_overflow_count=0;
21volatile unsigned long FastLED_timer0_millis = 0;
23LIB8STATIC void __attribute__((always_inline)) fastinc32 (
volatile uint32_t & _long) {
24 uint8_t b = ++((tBytesForLong&)_long).raw[0];
26 b = ++((tBytesForLong&)_long).raw[1];
28 b = ++((tBytesForLong&)_long).raw[2];
30 ++((tBytesForLong&)_long).raw[3];
36#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
42 fastinc32(FastLED_timer0_overflow_count);
50 uint8_t oldSREG = SREG;
55 m = FastLED_timer0_overflow_count;
58 return (m*(MICROSECONDS_PER_TIMER0_OVERFLOW/8))/(1000/8);
61unsigned long micros() {
63 uint8_t oldSREG = SREG, t;
66 m = FastLED_timer0_overflow_count;
72 #error TIMER 0 not defined
77 if ((TIFR0 & _BV(TOV0)) && (t < 255))
80 if ((TIFR & _BV(TOV0)) && (t < 255))
86 return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond());
89void delay(
unsigned long ms)
91 uint16_t start = (uint16_t)micros();
94 if (((uint16_t)micros() - start) >= 1000) {
101#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
111#if defined(TCCR0A) && defined(WGM01)
117#if defined(__AVR_ATmega128__)
120#elif defined(TCCR0) && defined(CS01) && defined(CS00)
124#elif defined(TCCR0B) && defined(CS01) && defined(CS00)
128#elif defined(TCCR0A) && defined(CS01) && defined(CS00)
133 #error Timer 0 prescale factor 64 not set correctly
137#if defined(TIMSK) && defined(TOIE0)
139#elif defined(TIMSK0) && defined(TOIE0)
142 #error Timer 0 overflow interrupt not set correctly
150#if defined(TCCR1B) && defined(CS11) && defined(CS10)
158#elif defined(TCCR1) && defined(CS11) && defined(CS10)
165#if defined(TCCR1A) && defined(WGM10)
168 #warning this needs to be finished
172#if defined(TCCR2) && defined(CS22)
174#elif defined(TCCR2B) && defined(CS22)
177 #warning Timer 2 not finished (may not be present on this CPU)
181#if defined(TCCR2) && defined(WGM20)
183#elif defined(TCCR2A) && defined(WGM20)
186 #warning Timer 2 not finished (may not be present on this CPU)
189#if defined(TCCR3B) && defined(CS31) && defined(WGM30)
195#if defined(TCCR4A) && defined(TCCR4B) && defined(TCCR4D)
203#if defined(TCCR4B) && defined(CS41) && defined(WGM40)
210#if defined(TCCR5B) && defined(CS51) && defined(WGM50)
central include file for FastLED, defines the CFastLED class/object
#define LIB8STATIC
Define a LIB8TION member function as static inline with an "unused" attribute.
#define FASTLED_USING_NAMESPACE
"Using" directive for the namespace