1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2009-04-13 17:10:52 +00:00
parent c48f4c6be4
commit 42f5973177
5 changed files with 27 additions and 10 deletions

View file

@ -25,8 +25,8 @@
#include "timer-target.h" #include "timer-target.h"
#ifdef HAVE_SCROLLWHEEL #ifdef HAVE_SCROLLWHEEL
#include "button-target.h"
/* The scrollwheel is polled every 5 ms (the tick tasks only every 10) */ /* 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; static volatile int poll_scrollwheel = 0;
void INT_TIMER2(void) void INT_TIMER2(void)
@ -34,7 +34,10 @@ void INT_TIMER2(void)
if (!poll_scrollwheel) if (!poll_scrollwheel)
call_tick_tasks(); /* Run through the list of tick tasks */ call_tick_tasks(); /* Run through the list of tick tasks */
else else
{
if (!button_hold())
button_read_dbop(); button_read_dbop();
}
poll_scrollwheel ^= 1; poll_scrollwheel ^= 1;
TIMER2_INTCLR = 0; /* clear interrupt */ TIMER2_INTCLR = 0; /* clear interrupt */

View file

@ -55,7 +55,7 @@ static void scrollwheel(short dbop_din)
unsigned btn = BUTTON_NONE; unsigned btn = BUTTON_NONE;
/* old wheel values */ /* old wheel values */
static unsigned old_wheel_value = 0; static unsigned old_wheel_value = 0;
static unsigned wheel_repeat = BUTTON_NONE; static unsigned old_btn = BUTTON_NONE;
/* getting BUTTON_REPEAT works like this: Remember when the btn value was /* getting BUTTON_REPEAT works like this: Remember when the btn value was
* posted to the button_queue last, and if it was recent enough, generate * posted to the button_queue last, and if it was recent enough, generate
@ -78,6 +78,12 @@ static void scrollwheel(short dbop_din)
{ 1, 3, 0, 2 }, /* Counter-clockwise */ { 1, 3, 0, 2 }, /* Counter-clockwise */
}; };
if(hold_button)
{
repeat = counter = 0;
return;
}
wheel_value = dbop_din & (1<<13|1<<14); wheel_value = dbop_din & (1<<13|1<<14);
wheel_value >>= 13; wheel_value >>= 13;
@ -88,10 +94,10 @@ static void scrollwheel(short dbop_din)
if (btn != BUTTON_NONE) if (btn != BUTTON_NONE)
{ {
if (btn != wheel_repeat) if (btn != old_btn)
{ {
/* direction reversals nullify repeats */ /* direction reversals nullify repeats */
wheel_repeat = btn; old_btn = btn;
repeat = counter = 0; repeat = counter = 0;
} }
if (btn != BUTTON_NONE) if (btn != BUTTON_NONE)

View file

@ -30,6 +30,7 @@
bool button_hold(void); bool button_hold(void);
void button_init_device(void); void button_init_device(void);
int button_read_device(void); int button_read_device(void);
short button_read_dbop(void);
/* Sandisk Sansa E200 button codes */ /* Sandisk Sansa E200 button codes */

View file

@ -56,7 +56,7 @@ static void scrollwheel(short dbop_din)
unsigned btn = BUTTON_NONE; unsigned btn = BUTTON_NONE;
/* old wheel values */ /* old wheel values */
static unsigned old_wheel_value = 0; static unsigned old_wheel_value = 0;
static unsigned wheel_repeat = BUTTON_NONE; static unsigned old_btn = BUTTON_NONE;
/* getting BUTTON_REPEAT works like this: We increment repeat by 2 if the /* getting BUTTON_REPEAT works like this: We increment repeat by 2 if the
* wheel was turned, and decrement it by 1 each tick, * wheel was turned, and decrement it by 1 each tick,
@ -76,6 +76,13 @@ static void scrollwheel(short dbop_din)
{ 2, 0, 3, 1 }, /* Clockwise rotation */ { 2, 0, 3, 1 }, /* Clockwise rotation */
{ 1, 3, 0, 2 }, /* Counter-clockwise */ { 1, 3, 0, 2 }, /* Counter-clockwise */
}; };
if(hold_button)
{
repeat = counter = 0;
return;
}
wheel_value = dbop_din & (1<<13|1<<14); wheel_value = dbop_din & (1<<13|1<<14);
wheel_value >>= 13; wheel_value >>= 13;
@ -86,10 +93,10 @@ static void scrollwheel(short dbop_din)
if (btn != BUTTON_NONE) if (btn != BUTTON_NONE)
{ {
if (btn != wheel_repeat) if (btn != old_btn)
{ {
/* direction reversals nullify repeats */ /* direction reversals nullify repeats */
wheel_repeat = btn; old_btn = btn;
repeat = counter = 0; repeat = counter = 0;
} }
if (btn != BUTTON_NONE) if (btn != BUTTON_NONE)

View file

@ -30,7 +30,7 @@
void button_init_device(void); void button_init_device(void);
bool button_hold(void); bool button_hold(void);
int button_read_device(void); int button_read_device(void);
short button_read_dbop(void);
/* Sandisk Sansa Fuze button codes */ /* Sandisk Sansa Fuze button codes */
/* Main unit's buttons */ /* Main unit's buttons */