1#ifndef __INC_FL_DELAY_H
2#define __INC_FL_DELAY_H
6#include "force_inline.h"
11FASTLED_NAMESPACE_BEGIN
14#if (!defined(NO_MINIMUM_WAIT) || (NO_MINIMUM_WAIT==0))
30 diff = (micros() & 0xFFFF) - mLastMicros;
35 void mark() { mLastMicros = micros() & 0xFFFF; }
66# define FL_NOP __asm__ __volatile__ ("cp r0,r0\n");
67# define FL_NOP2 __asm__ __volatile__ ("rjmp .+0");
70# define FL_NOP __asm__ __volatile__ ("nop\n");
72# define FL_NOP2 __asm__ __volatile__ ("nop\n\t nop\n");
94#if defined(FASTLED_AVR)
96template<
int LOOP, cycle_t PAD>
inline void _delaycycles_AVR() {
101 __asm__ __volatile__ (
111template<cycle_t CYCLES> FASTLED_FORCE_INLINE
void delaycycles() {
112 _delaycycles_AVR<CYCLES / 3, CYCLES % 3>();
149template<> FASTLED_FORCE_INLINE
void delaycycles<-10>() {}
150template<> FASTLED_FORCE_INLINE
void delaycycles<-9>() {}
151template<> FASTLED_FORCE_INLINE
void delaycycles<-8>() {}
152template<> FASTLED_FORCE_INLINE
void delaycycles<-7>() {}
153template<> FASTLED_FORCE_INLINE
void delaycycles<-6>() {}
154template<> FASTLED_FORCE_INLINE
void delaycycles<-5>() {}
155template<> FASTLED_FORCE_INLINE
void delaycycles<-4>() {}
156template<> FASTLED_FORCE_INLINE
void delaycycles<-3>() {}
157template<> FASTLED_FORCE_INLINE
void delaycycles<-2>() {}
158template<> FASTLED_FORCE_INLINE
void delaycycles<-1>() {}
169 const uint32_t termination = 4294966398 / 10;
170 const uint32_t remainder = 4294966398 % 10;
171 for (uint32_t i = 0; i < termination; i++) {
202#define F_CPU_MHZ (F_CPU / 1000000L)
207#define NS(_NS) (((_NS * F_CPU_MHZ) + 999) / 1000)
209#define CLKS_TO_MICROS(_CLKS) ((long)(_CLKS)) / (F_CPU / 1000000L)
212#define NO_TIME(A, B, C) (NS(A) < 3 || NS(B) < 3 || NS(C) < 6)
central include file for FastLED, defines the CFastLED class/object
Class to ensure that a minimum amount of time has kicked since the last time run - and delay if not e...
void mark()
Reset the timestamp that marks the start of the wait period.
void wait()
Blocking delay until WAIT time since mark() has passed.
#define FL_NOP2
Double no operation ("no-op") instruction for delay.
void delaycycles_min1()
A variant of delaycycles that will always delay at least one cycle.
void delaycycles()
Delay N clock cycles.
#define FL_NOP
Single no operation ("no-op") instruction for delay.