summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-23 01:01:25 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-23 01:01:25 +0000
commitd72659290086f2797b0675ceec49887bbb3b188b (patch)
treeb47108e9f9ec38e2c60fc8ec3cbfd90ed44858f7 /firmware/drivers/button.c
parent464b6a2c4c0f5f54ab82289d3c01e705604d6b90 (diff)
Some minor tweaks for iriver button_read()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8049 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index c764e1392f..2802d9f0ac 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -391,11 +391,12 @@ static int button_read(void)
{
remote_backlight_on();
}
+
hold_button = button_hold();
remote_hold_button = remote_button_hold();
/* normal buttons */
- if (!button_hold())
+ if (!hold_button)
{
data = adc_scan(ADC_BUTTONS);
@@ -425,7 +426,7 @@ static int button_read(void)
}
/* remote buttons */
- if (!remote_button_hold())
+ if (!remote_hold_button)
{
data = adc_scan(ADC_REMOTE);
@@ -462,9 +463,9 @@ static int button_read(void)
/* special buttons */
data = GPIO1_READ;
- if (!button_hold() && ((data & 0x20) == 0))
+ if (!hold_button && ((data & 0x20) == 0))
btn |= BUTTON_ON;
- if (!remote_button_hold() && ((data & 0x40) == 0))
+ if (!remote_hold_button && ((data & 0x40) == 0))
btn |= BUTTON_RC_ON;
#elif CONFIG_KEYPAD == IRIVER_H300_PAD
@@ -481,11 +482,12 @@ static int button_read(void)
{
remote_backlight_on();
}
+
hold_button = button_hold();
remote_hold_button = remote_button_hold();
/* normal buttons */
- if (!button_hold())
+ if (!hold_button)
{
data = adc_scan(ADC_BUTTONS);
@@ -509,7 +511,7 @@ static int button_read(void)
}
/* remote buttons */
- if (!remote_button_hold())
+ if (!remote_hold_button)
{
data = adc_scan(ADC_REMOTE);
@@ -543,18 +545,21 @@ static int button_read(void)
if (data < 0xf0)
btn = BUTTON_RC_REW;
}
-
+
/* special buttons */
- data = GPIO_READ;
- if (!button_hold() && ((data & 0x200) == 0))
- btn |= BUTTON_MODE;
- if (!button_hold() && ((data & 0x8000) == 0))
- btn |= BUTTON_REC;
+ if (!hold_button)
+ {
+ data = GPIO_READ;
+ if ((data & 0x0200) == 0)
+ btn |= BUTTON_MODE;
+ if ((data & 0x8000) == 0)
+ btn |= BUTTON_REC;
+ }
data = GPIO1_READ;
- if (!button_hold() && ((data & 0x20) == 0))
+ if (!hold_button && ((data & 0x20) == 0))
btn |= BUTTON_ON;
- if (!remote_button_hold() && ((data & 0x40) == 0))
+ if (!remote_hold_button && ((data & 0x40) == 0))
btn |= BUTTON_RC_ON;
#elif CONFIG_KEYPAD == RECORDER_PAD