summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2005-04-19 11:34:22 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2005-04-19 11:34:22 +0000
commited0c8764c44ca5d651b08fdd19bb2597f3a8300b (patch)
tree26d356a48691cc00f53214717f52e5568cc20446
parente5e08c7ee56ab3bb870bce452fe69cda2ae6749a (diff)
downloadrockbox-ed0c8764c44ca5d651b08fdd19bb2597f3a8300b.tar.gz
rockbox-ed0c8764c44ca5d651b08fdd19bb2597f3a8300b.zip
iRiver: added support for hold-button on main unit and remote control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6320 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/status.c7
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/drivers/button.c133
-rw-r--r--firmware/export/button.h1
4 files changed, 89 insertions, 53 deletions
diff --git a/apps/status.c b/apps/status.c
index 62eb03465c..d7d3a21f5b 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -37,6 +37,9 @@
#include "powermgmt.h"
#include "led.h"
#include "sound.h"
+#if CONFIG_KEYPAD == IRIVER_H100_PAD
+#include "button.h"
+#endif
static enum playmode ff_mode;
@@ -157,7 +160,11 @@ void status_draw(bool force_redraw)
info.hour = tm->tm_hour;
info.minute = tm->tm_min;
info.shuffle = global_settings.playlist_shuffle;
+#if CONFIG_KEYPAD == IRIVER_H100_PAD
+ info.keylock = button_hold();
+#else
info.keylock = keys_locked;
+#endif
info.repeat = global_settings.repeat_mode;
info.playmode = current_playmode();
#ifndef HAVE_LED
diff --git a/docs/CREDITS b/docs/CREDITS
index e2d75c60ec..bc1d2311e8 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -105,3 +105,4 @@ Tony Motakis
Andy Young
Alexandre Bourget
Richard S. La Charité III
+Christian Gmeiner
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 4a3fab20e1..38bb319d81 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -356,70 +356,97 @@ static int button_read(void)
#if CONFIG_KEYPAD == IRIVER_H100_PAD
- data = adc_scan(ADC_BUTTONS);
+ static bool hold_button = false;
+ static bool remote_hold_button = false;
- if (data < 0x80)
- if (data < 0x30)
- if (data < 0x18)
- btn = BUTTON_SELECT;
- else
- btn = BUTTON_UP;
- else
- if (data < 0x50)
- btn = BUTTON_LEFT;
- else
- btn = BUTTON_DOWN;
- else
- if (data < 0xb0)
- if (data < 0xa0)
- btn = BUTTON_RIGHT;
- else
- btn = BUTTON_OFF;
- else
- if (data < 0xd0)
- btn = BUTTON_MODE;
- else
- if (data < 0xf0)
- btn = BUTTON_REC;
-
- data = adc_scan(ADC_REMOTE);
+ /* light handling */
+ if (hold_button && !button_hold())
+ {
+ backlight_on();
+ }
+ if (remote_hold_button && !remote_button_hold())
+ {
+ remote_backlight_on();
+ }
+ hold_button = button_hold();
+ remote_hold_button = remote_button_hold();
- if (data < 0x74)
- if (data < 0x40)
- if (data < 0x20)
- if(data < 0x10)
- btn = BUTTON_RC_STOP;
+ /* normal buttons */
+ if (!button_hold())
+ {
+ data = adc_scan(ADC_BUTTONS);
+
+ if (data < 0x80)
+ if (data < 0x30)
+ if (data < 0x18)
+ btn = BUTTON_SELECT;
else
- btn = BUTTON_RC_VOL_DOWN;
+ btn = BUTTON_UP;
else
- btn = BUTTON_RC_VOL;
+ if (data < 0x50)
+ btn = BUTTON_LEFT;
+ else
+ btn = BUTTON_DOWN;
else
- if (data < 0x58)
- btn = BUTTON_RC_VOL_UP;
+ if (data < 0xb0)
+ if (data < 0xa0)
+ btn = BUTTON_RIGHT;
+ else
+ btn = BUTTON_OFF;
else
- btn = BUTTON_RC_BITRATE;
- else
- if (data < 0xb0)
- if (data < 0x88)
- btn = BUTTON_RC_REC;
+ if (data < 0xd0)
+ btn = BUTTON_MODE;
+ else
+ if (data < 0xf0)
+ btn = BUTTON_REC;
+ }
+
+ /* remote buttons */
+ if (!remote_button_hold())
+ {
+ data = adc_scan(ADC_REMOTE);
+
+ if (data < 0x74)
+ if (data < 0x40)
+ if (data < 0x20)
+ if(data < 0x10)
+ btn = BUTTON_RC_STOP;
+ else
+ btn = BUTTON_RC_VOL_DOWN;
+ else
+ btn = BUTTON_RC_VOL;
else
- btn = BUTTON_RC_SOURCE;
+ if (data < 0x58)
+ btn = BUTTON_RC_VOL_UP;
+ else
+ btn = BUTTON_RC_BITRATE;
else
- if (data < 0xd8)
- if(data < 0xc0)
- btn = BUTTON_RC_FF;
+ if (data < 0xb0)
+ if (data < 0x88)
+ btn = BUTTON_RC_REC;
else
- btn = BUTTON_RC_MENU;
+ btn = BUTTON_RC_SOURCE;
else
- if (data < 0xf0)
- btn = BUTTON_RC_REW;
-
- data = GPIO1_READ;
- if ((data & 0x20) == 0)
- btn |= BUTTON_ON;
+ if (data < 0xd8)
+ if(data < 0xc0)
+ btn = BUTTON_RC_FF;
+ else
+ btn = BUTTON_RC_MENU;
+ else
+ if (data < 0xf0)
+ btn = BUTTON_RC_REW;
+ }
+
+ /* special buttons */
+ if (!button_hold())
+ {
+ data = GPIO1_READ;
+ if ((data & 0x20) == 0)
+ btn |= BUTTON_ON;
- if ((data & 0x40) == 0)
- btn |= BUTTON_RC_ON;
+ if ((data & 0x40) == 0)
+ btn |= BUTTON_RC_ON;
+ }
#elif CONFIG_KEYPAD == RECORDER_PAD
diff --git a/firmware/export/button.h b/firmware/export/button.h
index 5b76e50b56..5b55cc54c7 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -36,6 +36,7 @@ void button_set_flip(bool flip); /* turn 180 degrees */
#if CONFIG_KEYPAD == IRIVER_H100_PAD
bool button_hold(void);
+bool remote_button_hold(void);
#endif
#define BUTTON_NONE 0x0000