summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-04-13 17:10:52 +0000
committerThomas Martitz <kugel@rockbox.org>2009-04-13 17:10:52 +0000
commit42f5973177df838c65b76eb96646a8b5df2a533b (patch)
tree888669e9272d3c8f035e96061ffd59dc61628d2d
parentc48f4c6be480c6653c0dc76c64ba86df564ad0bf (diff)
downloadrockbox-42f5973177df838c65b76eb96646a8b5df2a533b.tar.gz
rockbox-42f5973177df838c65b76eb96646a8b5df2a533b.zip
Few Fuze/e200v2 button fixes. Don't read the scrollwheel when the hold button is active and rename a variable to describe better what it is for.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20701 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/kernel-as3525.c7
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c14
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/button-target.h1
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/button-fuze.c13
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/button-target.h2
5 files changed, 27 insertions, 10 deletions
diff --git a/firmware/target/arm/as3525/kernel-as3525.c b/firmware/target/arm/as3525/kernel-as3525.c
index 986ceb3189..fd3b219e64 100644
--- a/firmware/target/arm/as3525/kernel-as3525.c
+++ b/firmware/target/arm/as3525/kernel-as3525.c
@@ -25,8 +25,8 @@
25#include "timer-target.h" 25#include "timer-target.h"
26 26
27#ifdef HAVE_SCROLLWHEEL 27#ifdef HAVE_SCROLLWHEEL
28#include "button-target.h"
28/* The scrollwheel is polled every 5 ms (the tick tasks only every 10) */ 29/* 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; 30static volatile int poll_scrollwheel = 0;
31 31
32void INT_TIMER2(void) 32void INT_TIMER2(void)
@@ -34,7 +34,10 @@ void INT_TIMER2(void)
34 if (!poll_scrollwheel) 34 if (!poll_scrollwheel)
35 call_tick_tasks(); /* Run through the list of tick tasks */ 35 call_tick_tasks(); /* Run through the list of tick tasks */
36 else 36 else
37 button_read_dbop(); 37 {
38 if (!button_hold())
39 button_read_dbop();
40 }
38 41
39 poll_scrollwheel ^= 1; 42 poll_scrollwheel ^= 1;
40 TIMER2_INTCLR = 0; /* clear interrupt */ 43 TIMER2_INTCLR = 0; /* clear interrupt */
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
index 021110c7c6..bc92995094 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
@@ -55,7 +55,7 @@ static void scrollwheel(short dbop_din)
55 unsigned btn = BUTTON_NONE; 55 unsigned btn = BUTTON_NONE;
56 /* old wheel values */ 56 /* old wheel values */
57 static unsigned old_wheel_value = 0; 57 static unsigned old_wheel_value = 0;
58 static unsigned wheel_repeat = BUTTON_NONE; 58 static unsigned old_btn = BUTTON_NONE;
59 59
60 /* getting BUTTON_REPEAT works like this: Remember when the btn value was 60 /* getting BUTTON_REPEAT works like this: Remember when the btn value was
61 * posted to the button_queue last, and if it was recent enough, generate 61 * posted to the button_queue last, and if it was recent enough, generate
@@ -77,7 +77,13 @@ static void scrollwheel(short dbop_din)
77 { 2, 0, 3, 1 }, /* Clockwise rotation */ 77 { 2, 0, 3, 1 }, /* Clockwise rotation */
78 { 1, 3, 0, 2 }, /* Counter-clockwise */ 78 { 1, 3, 0, 2 }, /* Counter-clockwise */
79 }; 79 };
80 80
81 if(hold_button)
82 {
83 repeat = counter = 0;
84 return;
85 }
86
81 wheel_value = dbop_din & (1<<13|1<<14); 87 wheel_value = dbop_din & (1<<13|1<<14);
82 wheel_value >>= 13; 88 wheel_value >>= 13;
83 89
@@ -88,10 +94,10 @@ static void scrollwheel(short dbop_din)
88 94
89 if (btn != BUTTON_NONE) 95 if (btn != BUTTON_NONE)
90 { 96 {
91 if (btn != wheel_repeat) 97 if (btn != old_btn)
92 { 98 {
93 /* direction reversals nullify repeats */ 99 /* direction reversals nullify repeats */
94 wheel_repeat = btn; 100 old_btn = btn;
95 repeat = counter = 0; 101 repeat = counter = 0;
96 } 102 }
97 if (btn != BUTTON_NONE) 103 if (btn != BUTTON_NONE)
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-target.h b/firmware/target/arm/as3525/sansa-e200v2/button-target.h
index a9aa663202..e09743d89c 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/button-target.h
+++ b/firmware/target/arm/as3525/sansa-e200v2/button-target.h
@@ -30,6 +30,7 @@
30bool button_hold(void); 30bool button_hold(void);
31void button_init_device(void); 31void button_init_device(void);
32int button_read_device(void); 32int button_read_device(void);
33short button_read_dbop(void);
33 34
34/* Sandisk Sansa E200 button codes */ 35/* Sandisk Sansa E200 button codes */
35 36
diff --git a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
index f532a96431..afbba78074 100644
--- a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
@@ -56,7 +56,7 @@ static void scrollwheel(short dbop_din)
56 unsigned btn = BUTTON_NONE; 56 unsigned btn = BUTTON_NONE;
57 /* old wheel values */ 57 /* old wheel values */
58 static unsigned old_wheel_value = 0; 58 static unsigned old_wheel_value = 0;
59 static unsigned wheel_repeat = BUTTON_NONE; 59 static unsigned old_btn = BUTTON_NONE;
60 60
61 /* getting BUTTON_REPEAT works like this: We increment repeat by 2 if the 61 /* getting BUTTON_REPEAT works like this: We increment repeat by 2 if the
62 * wheel was turned, and decrement it by 1 each tick, 62 * wheel was turned, and decrement it by 1 each tick,
@@ -76,6 +76,13 @@ static void scrollwheel(short dbop_din)
76 { 2, 0, 3, 1 }, /* Clockwise rotation */ 76 { 2, 0, 3, 1 }, /* Clockwise rotation */
77 { 1, 3, 0, 2 }, /* Counter-clockwise */ 77 { 1, 3, 0, 2 }, /* Counter-clockwise */
78 }; 78 };
79
80 if(hold_button)
81 {
82 repeat = counter = 0;
83 return;
84 }
85
79 wheel_value = dbop_din & (1<<13|1<<14); 86 wheel_value = dbop_din & (1<<13|1<<14);
80 wheel_value >>= 13; 87 wheel_value >>= 13;
81 88
@@ -86,10 +93,10 @@ static void scrollwheel(short dbop_din)
86 93
87 if (btn != BUTTON_NONE) 94 if (btn != BUTTON_NONE)
88 { 95 {
89 if (btn != wheel_repeat) 96 if (btn != old_btn)
90 { 97 {
91 /* direction reversals nullify repeats */ 98 /* direction reversals nullify repeats */
92 wheel_repeat = btn; 99 old_btn = btn;
93 repeat = counter = 0; 100 repeat = counter = 0;
94 } 101 }
95 if (btn != BUTTON_NONE) 102 if (btn != BUTTON_NONE)
diff --git a/firmware/target/arm/as3525/sansa-fuze/button-target.h b/firmware/target/arm/as3525/sansa-fuze/button-target.h
index 75ce3d060e..5b5b1e097f 100644
--- a/firmware/target/arm/as3525/sansa-fuze/button-target.h
+++ b/firmware/target/arm/as3525/sansa-fuze/button-target.h
@@ -30,7 +30,7 @@
30void button_init_device(void); 30void button_init_device(void);
31bool button_hold(void); 31bool button_hold(void);
32int button_read_device(void); 32int button_read_device(void);
33 33short button_read_dbop(void);
34/* Sandisk Sansa Fuze button codes */ 34/* Sandisk Sansa Fuze button codes */
35 35
36/* Main unit's buttons */ 36/* Main unit's buttons */