summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/kernel-as3525.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/kernel-as3525.c')
-rw-r--r--firmware/target/arm/as3525/kernel-as3525.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/kernel-as3525.c b/firmware/target/arm/as3525/kernel-as3525.c
index 3252e5abd1..986ceb3189 100644
--- a/firmware/target/arm/as3525/kernel-as3525.c
+++ b/firmware/target/arm/as3525/kernel-as3525.c
@@ -24,12 +24,29 @@
24#include "panic.h" 24#include "panic.h"
25#include "timer-target.h" 25#include "timer-target.h"
26 26
27#ifdef HAVE_SCROLLWHEEL
28/* The scrollwheel is polled every 5 ms (the tick tasks only every 10) */
29extern void button_read_dbop(void);
30static volatile int poll_scrollwheel = 0;
31
32void INT_TIMER2(void)
33{
34 if (!poll_scrollwheel)
35 call_tick_tasks(); /* Run through the list of tick tasks */
36 else
37 button_read_dbop();
38
39 poll_scrollwheel ^= 1;
40 TIMER2_INTCLR = 0; /* clear interrupt */
41}
42#else
27void INT_TIMER2(void) 43void INT_TIMER2(void)
28{ 44{
29 call_tick_tasks(); /* Run through the list of tick tasks */ 45 call_tick_tasks(); /* Run through the list of tick tasks */
30 46
31 TIMER2_INTCLR = 0; /* clear interrupt */ 47 TIMER2_INTCLR = 0; /* clear interrupt */
32} 48}
49#endif
33 50
34void tick_start(unsigned int interval_in_ms) 51void tick_start(unsigned int interval_in_ms)
35{ 52{
@@ -37,6 +54,11 @@ void tick_start(unsigned int interval_in_ms)
37 int prescale = 1; 54 int prescale = 1;
38 int cycles = TIMER_FREQ / 1000 * interval_in_ms; 55 int cycles = TIMER_FREQ / 1000 * interval_in_ms;
39 56
57#ifdef HAVE_SCROLLWHEEL
58 /* let the timer interrupt twice as often for the scrollwheel polling */
59 cycles >>= 1;
60#endif
61
40 while(cycles > 0x10000) 62 while(cycles > 0x10000)
41 { 63 {
42 phi++; 64 phi++;