1
0
Fork 0
forked from len0rd/rockbox

A lot more stable remote control handling

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2447 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-09-30 08:55:22 +00:00
parent 07557e5612
commit cfec25bb9e
3 changed files with 99 additions and 67 deletions

View file

@ -28,6 +28,7 @@
#include "kernel.h"
#include "backlight.h"
#include "adc.h"
#include "serial.h"
struct event_queue button_queue;
@ -52,18 +53,27 @@ static int button_read(void);
static void button_tick(void)
{
static int tick=0;
static int count=0;
static int lastbtn=0;
static int repeat_speed=REPEAT_INTERVAL_START;
static bool repeat=false;
static int tick = 0;
static int count = 0;
static int lastbtn = 0;
static int repeat_speed = REPEAT_INTERVAL_START;
static bool repeat = false;
int diff;
int btn;
/* Post events for the remote control */
btn = remote_control_rx();
if(btn)
{
queue_post(&button_queue, btn, NULL);
backlight_on();
}
/* only poll every X ticks */
if ( ++tick >= POLL_FREQUENCY )
{
bool post = false;
int btn = button_read();
btn = button_read();
/* Find out if a key has been released */
diff = btn ^ lastbtn;
@ -91,7 +101,7 @@ static void button_tick(void)
if (count == 0) {
post = true;
/* yes we have repeat */
repeat_speed--;
repeat_speed--;
if (repeat_speed < REPEAT_INTERVAL_FINISH)
repeat_speed = REPEAT_INTERVAL_FINISH;
count = repeat_speed;