From 6c33c51a4ca9907d23e3154d956fd6781122f492 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Sun, 19 Sep 2004 21:58:37 +0000 Subject: Redesigned the button handling. The code now uses symbolic function defines instead of checking for specific buttons. This makes it easier to add support for new devices with different button layouts. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5091 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/button.c | 11 +++++------ firmware/drivers/serial.c | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index f934052746..25cdd3d96b 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -267,7 +267,6 @@ void button_set_flip(bool flip) } } - /* * Get button pressed from hardware */ @@ -376,12 +375,12 @@ static int button_read(void) if(adc_read(2) < 0x180) btn |= BUTTON_RIGHT; if(adc_read(3) < 0x180) - btn |= BUTTON_PLAY | BUTTON_UP; + btn |= BUTTON_PLAY; if ( !(porta & 0x20) ) btn |= BUTTON_ON; if ( !(porta & 0x800) ) - btn |= BUTTON_STOP | BUTTON_DOWN; + btn |= BUTTON_STOP; return btn; } @@ -488,7 +487,7 @@ static int button_read(void) if(adc_read(ADC_BUTTON_OPTION) > 0x200) /* active high */ btn |= BUTTON_MENU; if(adc_read(ADC_BUTTON_ONOFF) < 0x120) /* active low */ - btn |= BUTTON_ON; + btn |= BUTTON_OFF; /* Check the 4 direction keys, hard-coded analog limits for now */ if (data >= 0x2EF) @@ -496,9 +495,9 @@ static int button_read(void) else if (data >= 0x246) btn |= BUTTON_RIGHT; else if (data >= 0x19D) - btn |= BUTTON_PLAY | BUTTON_UP; + btn |= BUTTON_UP; else if (data >= 0x0A1) - btn |= BUTTON_STOP | BUTTON_DOWN; + btn |= BUTTON_DOWN; return btn; } diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index 11dadc6f19..e1e0eb82e9 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c @@ -85,7 +85,7 @@ int remote_control_rx(void) } else { -#ifndef HAVE_NEO_KEYPAD /* This needs to be fixed for Neo */ +#if !defined(HAVE_NEO_KEYPAD) && !defined(HAVE_ONDIO_KEYPAD) switch (btn) { case STOP: -- cgit v1.2.3