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>2014-10-30 22:29:36 +0300
committerDaniel Garcia <danielgarcia@gmail.com>2014-10-30 22:29:36 +0300
commit7adedb990ff9e1ee1a72f68247a579d984312075 (patch)
treeaa05ced1cb546a612186a34144ebd7829f8d0e16 /clockless_trinket.h
parentda847e5a1361cff5065468c9f50a0abcd42a0aa0 (diff)
Make the interrupt gap-handling dynamic based on the define WAIT_TIME for the given chipset
Diffstat (limited to 'clockless_trinket.h')
-rw-r--r--clockless_trinket.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/clockless_trinket.h b/clockless_trinket.h
index 64d6d354..f0637a70 100644
--- a/clockless_trinket.h
+++ b/clockless_trinket.h
@@ -15,6 +15,8 @@
#define DITHER 1
#endif
+#define US_PER_TICK (64 / (F_CPU/1000000))
+
// Variations on the functions in delay.h - w/a loop var passed in to preserve registers across calls by the optimizer/compiler
template<int CYCLES> inline void _dc(register uint8_t & loopvar);
@@ -255,7 +257,7 @@ protected:
ADJDITHER2(d2,e2);
cli();
- if((TCNT0-lasttime) > (F_CPU/2000000)) { sei(); return; }
+ if((TCNT0-lasttime) > ((WAIT_TIME-10)/US_PER_TICK)) { sei(); return; }
// Sum of the clock counts across each row should be 10 for 8Mhz, WS2811
// The values in the D1/D2/D3 indicate how many cycles the previous column takes
// to allow things to line back up.