diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2016-01-19 01:00:49 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2016-01-19 01:00:49 +0300 |
commit | 98874aaec6fae6ac6ea3930665de9e5858d68ac7 (patch) | |
tree | c9169a577fee50b4314322006bb69e2e79194648 | |
parent | ce72da0a0ddd1023d50aba4a4a52eaccac1b66f4 (diff) |
Add a variant of delaycycles that will always delay at least one cycle.
-rw-r--r-- | fastled_delay.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fastled_delay.h b/fastled_delay.h index ca6b06ab..f16d322e 100644 --- a/fastled_delay.h +++ b/fastled_delay.h @@ -43,6 +43,11 @@ public: // predeclaration to not upset the compiler template<int CYCLES> inline void delaycycles(); +template<int CYCLES> inline void delaycycles_min1() { + delaycycles<1>(); + delaycycles<CYCLES-1>(); +} + // TODO: ARM version of _delaycycles_ @@ -92,6 +97,10 @@ template<int CYCLES> __attribute__((always_inline)) inline void delaycycles() { // pre-instantiations for values small enough to not need the loop, as well as sanity holders // for some negative values. +template<> __attribute__((always_inline)) inline void delaycycles<-10>() {} +template<> __attribute__((always_inline)) inline void delaycycles<-9>() {} +template<> __attribute__((always_inline)) inline void delaycycles<-8>() {} +template<> __attribute__((always_inline)) inline void delaycycles<-7>() {} template<> __attribute__((always_inline)) inline void delaycycles<-6>() {} template<> __attribute__((always_inline)) inline void delaycycles<-5>() {} template<> __attribute__((always_inline)) inline void delaycycles<-4>() {} |