summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/kernel-as3525.c16
-rw-r--r--firmware/target/arm/as3525/timer-target.h9
2 files changed, 13 insertions, 12 deletions
diff --git a/firmware/target/arm/as3525/kernel-as3525.c b/firmware/target/arm/as3525/kernel-as3525.c
index 0f907f61e3..d8f0e23d30 100644
--- a/firmware/target/arm/as3525/kernel-as3525.c
+++ b/firmware/target/arm/as3525/kernel-as3525.c
@@ -25,18 +25,26 @@
25#include "timer-target.h" 25#include "timer-target.h"
26 26
27#ifdef HAVE_SCROLLWHEEL 27#ifdef HAVE_SCROLLWHEEL
28/* let the timer interrupt twice as often for the scrollwheel polling */
29#define KERNEL_TIMER_FREQ (TIMER_FREQ/2)
30#else
31#define KERNEL_TIMER_FREQ TIMER_FREQ
32#endif
33
34#ifdef HAVE_SCROLLWHEEL
28#include "button-target.h" 35#include "button-target.h"
29/* The scrollwheel is polled every 5 ms (the tick tasks only every 10) */ 36/* The scrollwheel is polled every 5 ms (the tick tasks only every 10) */
30static volatile int poll_scrollwheel = 0; 37static int poll_scrollwheel = 0;
31 38
32void INT_TIMER2(void) 39void INT_TIMER2(void)
33{ 40{
34 if (!poll_scrollwheel) 41 if (!poll_scrollwheel)
35 call_tick_tasks(); /* Run through the list of tick tasks */ 42 call_tick_tasks(); /* Run through the list of tick tasks
43 * (that includes reading the scrollwheel) */
36 else 44 else
37 { 45 {
38 if (!button_hold()) 46 if (!button_hold())
39 button_read_dbop(); 47 button_read_dbop(); /* Read the scrollwheel */
40 } 48 }
41 49
42 poll_scrollwheel ^= 1; 50 poll_scrollwheel ^= 1;
@@ -55,7 +63,7 @@ void tick_start(unsigned int interval_in_ms)
55{ 63{
56 int phi = 0; /* prescaler bits */ 64 int phi = 0; /* prescaler bits */
57 int prescale = 1; 65 int prescale = 1;
58 int cycles = TIMER_FREQ / 1000 * interval_in_ms; 66 int cycles = KERNEL_TIMER_FREQ / 1000 * interval_in_ms;
59 67
60 while(cycles > 0x10000) 68 while(cycles > 0x10000)
61 { 69 {
diff --git a/firmware/target/arm/as3525/timer-target.h b/firmware/target/arm/as3525/timer-target.h
index b5cdb74e85..21ee6e7804 100644
--- a/firmware/target/arm/as3525/timer-target.h
+++ b/firmware/target/arm/as3525/timer-target.h
@@ -25,14 +25,7 @@ bool __timer_set(long cycles, bool set);
25bool __timer_register(void); 25bool __timer_register(void);
26void __timer_unregister(void); 26void __timer_unregister(void);
27 27
28#ifdef HAVE_SCROLLWHEEL 28#define TIMER_FREQ (24000000 / 16)
29/* The scrollwheel is polled every 5 ms (the tick tasks still every 10ms) */
30#define TIMER_DIV (16*2)
31#else
32#define TIMER_DIV (16)
33#endif
34
35#define TIMER_FREQ (24000000 / TIMER_DIV)
36 29
37#define __TIMER_SET(cycles, set) \ 30#define __TIMER_SET(cycles, set) \
38 __timer_set(cycles, set) 31 __timer_set(cycles, set)