summaryrefslogtreecommitdiffstats
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 @@
#include "panic.h"
#include "timer-target.h"
+#ifdef HAVE_SCROLLWHEEL
+/* The scrollwheel is polled every 5 ms (the tick tasks only every 10) */
+extern void button_read_dbop(void);
+static volatile int poll_scrollwheel = 0;
+
+void INT_TIMER2(void)
+{
+ if (!poll_scrollwheel)
+ call_tick_tasks(); /* Run through the list of tick tasks */
+ else
+ button_read_dbop();
+
+ poll_scrollwheel ^= 1;
+ TIMER2_INTCLR = 0; /* clear interrupt */
+}
+#else
void INT_TIMER2(void)
{
call_tick_tasks(); /* Run through the list of tick tasks */
TIMER2_INTCLR = 0; /* clear interrupt */
}
+#endif
void tick_start(unsigned int interval_in_ms)
{
@@ -37,6 +54,11 @@ void tick_start(unsigned int interval_in_ms)
int prescale = 1;
int cycles = TIMER_FREQ / 1000 * interval_in_ms;
+#ifdef HAVE_SCROLLWHEEL
+ /* let the timer interrupt twice as often for the scrollwheel polling */
+ cycles >>= 1;
+#endif
+
while(cycles > 0x10000)
{
phi++;