diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2014-10-30 22:52:37 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2014-10-30 22:52:37 +0300 |
commit | 4658c8bec68aacdbd09c4f7d2508de18a10edf9a (patch) | |
tree | 9c42f1a8fc34cce3187de55a7151970928e07c2c | |
parent | 7adedb990ff9e1ee1a72f68247a579d984312075 (diff) |
Centralize setting the interrupt threshold adjustment
-rw-r--r-- | clockless_arm_k20.h | 2 | ||||
-rw-r--r-- | clockless_block_arm_k20.h | 2 | ||||
-rw-r--r-- | clockless_trinket.h | 2 | ||||
-rw-r--r-- | led_sysdefs.h | 11 |
4 files changed, 14 insertions, 3 deletions
diff --git a/clockless_arm_k20.h b/clockless_arm_k20.h index 88f508e1..d96c9bb2 100644 --- a/clockless_arm_k20.h +++ b/clockless_arm_k20.h @@ -105,7 +105,7 @@ protected: cli(); // if interrupts took longer than 45µs, punt on the current frame if(ARM_DWT_CYCCNT > next_mark) { - if((ARM_DWT_CYCCNT-next_mark) > ((WAIT_TIME-5)*CLKS_PER_US)) { sei(); return ARM_DWT_CYCCNT; } + if((ARM_DWT_CYCCNT-next_mark) > ((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US)) { sei(); return ARM_DWT_CYCCNT; } } // Write first byte, read next byte diff --git a/clockless_block_arm_k20.h b/clockless_block_arm_k20.h index b38f69a3..63dc5030 100644 --- a/clockless_block_arm_k20.h +++ b/clockless_block_arm_k20.h @@ -322,7 +322,7 @@ public: cli(); // if interrupts took longer than 45µs, punt on the current frame if(ARM_DWT_CYCCNT > next_mark) { - if((ARM_DWT_CYCCNT-next_mark) > ((WAIT_TIME-5)*CLKS_PER_US)) { sei(); return ARM_DWT_CYCCNT; } + if((ARM_DWT_CYCCNT-next_mark) > ((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US)) { sei(); return ARM_DWT_CYCCNT; } } // Write first byte, read next byte writeBits<8+XTRA0,1>(next_mark, b0, allpixels); diff --git a/clockless_trinket.h b/clockless_trinket.h index f0637a70..0d3451b7 100644 --- a/clockless_trinket.h +++ b/clockless_trinket.h @@ -257,7 +257,7 @@ protected: ADJDITHER2(d2,e2); cli(); - if((TCNT0-lasttime) > ((WAIT_TIME-10)/US_PER_TICK)) { sei(); return; } + if((TCNT0-lasttime) > ((WAIT_TIME-INTERRUPT_THRESHOLD)/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. diff --git a/led_sysdefs.h b/led_sysdefs.h index fa40a46a..894055f1 100644 --- a/led_sysdefs.h +++ b/led_sysdefs.h @@ -5,6 +5,9 @@ #define FASTLED_TEENSY3 #define FASTLED_ARM #define FASTLED_ACCURATE_CLOCK +#ifndef INTERRUPT_THRESHOLD +#define INTERRUPT_THRESHOLD 5 +#endif #if (F_CPU == 96000000) #define CLK_DBL 1 #endif @@ -13,6 +16,9 @@ #else #define FASTLED_AVR #define FASTLED_ACCURATE_CLOCK +#ifndef INTERRUPT_THRESHOLD +#define INTERRUPT_THRESHOLD 10 +#endif #endif #ifndef CLK_DBL @@ -52,4 +58,9 @@ typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile u #endif #define CLKS_PER_US (F_CPU/1000000) + +#ifndef INTERRUPT_THRESHOLD +#define INTERRUPT_THRESHOLD 5 +#endif + #endif |