1
0
Fork 0
forked from len0rd/rockbox

Since we poll buttons every tick now, the extra if() checking the polling interval was obsolete. Pointed out by Mikael Magnusson. * Some tweaks.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9536 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-04-06 18:58:42 +00:00
parent b509ff5069
commit 5106e228cc

View file

@ -58,16 +58,13 @@ static bool remote_filter_first_keypress;
#endif
#endif
/* how often we check to see if a button is pressed */
#define POLL_FREQUENCY HZ/100
/* how long until repeat kicks in */
/* how long until repeat kicks in, in ticks */
#define REPEAT_START 30
/* the speed repeat starts at */
/* the speed repeat starts at, in ticks */
#define REPEAT_INTERVAL_START 16
/* speed repeat finishes at */
/* speed repeat finishes at, in ticks */
#define REPEAT_INTERVAL_FINISH 5
/* the power-off button and number of repeated keys before shutting off */
@ -397,7 +394,6 @@ static int ipod_3g_button_read(void)
static void button_tick(void)
{
static int tick = 0;
static int count = 0;
static int repeat_speed = REPEAT_INTERVAL_START;
static int repeat_count = 0;
@ -422,9 +418,6 @@ static void button_tick(void)
}
#endif
/* only poll every X ticks */
if ( ++tick >= POLL_FREQUENCY )
{
btn = button_read();
/* Find out if a key has been released */
@ -458,7 +451,6 @@ static void button_tick(void)
post = true;
repeat = false;
repeat_speed = REPEAT_INTERVAL_START;
}
else /* repeat? */
{
@ -469,9 +461,8 @@ static void button_tick(void)
if (count == 0) {
post = true;
/* yes we have repeat */
if (repeat_speed > REPEAT_INTERVAL_FINISH)
repeat_speed--;
if (repeat_speed < REPEAT_INTERVAL_FINISH)
repeat_speed = REPEAT_INTERVAL_FINISH;
count = repeat_speed;
repeat_count++;
@ -518,20 +509,15 @@ static void button_tick(void)
{
if (repeat)
{
/* Only post repeat events if the queue is empty,
* to avoid afterscroll effects. */
if (queue_empty(&button_queue))
{
queue_post(
&button_queue, BUTTON_REPEAT | btn, NULL);
queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
#ifdef CONFIG_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if(btn & BUTTON_REMOTE)
{
if(skip_remote_release)
skip_remote_release = false;
}
else
#endif
if(skip_release)
skip_release = false;
#endif
post = false;
@ -579,8 +565,6 @@ static void button_tick(void)
}
}
lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT);
tick = 0;
}
}
long button_get(bool block)