summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorRani Hod <raenye@gmail.com>2006-08-08 22:03:56 +0000
committerRani Hod <raenye@gmail.com>2006-08-08 22:03:56 +0000
commitc9f59e6f75bcfa25a563fedd77bfa77b3617f133 (patch)
treeceff51afb679acb2935ed18072384819abf4281e /firmware/drivers
parentf8866a3a9c3a12b72e87ae96445eca1b52ed23fb (diff)
Accepted FS #5772 by Michael Sevakis
1. X5 lcd sleep 2. #define HAVE_LCD_ENABLE 3. add "backlight (on hold switch)" setting, adapted from FS #5735 Note that the while(1) yield ==> asm("halt") part is NOT commited here, I prefer it would be discussed separately. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10489 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/button.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index d9f9ae2a6d..9ff0206a2b 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -844,21 +844,15 @@ static int button_read(void)
static bool remote_hold_button = false;
static int prev_data = 0xff;
static int last_valid = 0xff;
+ bool hold_button_old;
- /* light handling */
- if (hold_button && !button_hold())
- {
- backlight_on();
- }
- if (remote_hold_button && !remote_button_hold_only())
- {
- remote_backlight_on();
- }
-
+ /* normal buttons */
+ hold_button_old = hold_button;
hold_button = button_hold();
- remote_hold_button = remote_button_hold_only();
- /* normal buttons */
+ if (hold_button != hold_button_old)
+ backlight_hold_changed(hold_button);
+
if (!hold_button)
{
data = adc_scan(ADC_BUTTONS);
@@ -920,6 +914,13 @@ static int button_read(void)
}
/* remote buttons */
+ remote_hold_button = remote_button_hold_only();
+
+ if (remote_hold_button && !remote_button_hold_only())
+ {
+ remote_backlight_on();
+ }
+
if (!remote_hold_button)
{
data = adc_scan(ADC_REMOTE);
@@ -1038,15 +1039,15 @@ static int button_read(void)
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
static bool hold_button = false;
+ bool hold_button_old;
- /* light handling */
- if (hold_button && !button_hold())
- {
- backlight_on();
- }
+ /* normal buttons */
+ hold_button_old = hold_button;
hold_button = button_hold();
- /* normal buttons */
+ if (hold_button != hold_button_old)
+ backlight_hold_changed(hold_button);
+
if (!button_hold())
{
data = adc_read(ADC_BUTTONS);
@@ -1217,28 +1218,30 @@ static int button_read(void)
#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
static bool hold_button = false;
+ bool hold_button_old;
- /* light handling */
- if (hold_button && !button_hold())
- {
- backlight_on();
- }
+ /* normal buttons */
+ hold_button_old = hold_button;
hold_button = button_hold();
+ if (hold_button != hold_button_old)
+ backlight_hold_changed(hold_button);
+
(void)data;
/* The int_btn variable is set in the button interrupt handler */
btn = int_btn;
#elif (CONFIG_KEYPAD == IPOD_3G_PAD)
static bool hold_button = false;
+ bool hold_button_old;
- /* light handling */
- if (hold_button && !button_hold())
- {
- backlight_on();
- }
+ /* normal buttons */
+ hold_button_old = hold_button;
hold_button = button_hold();
+ if (hold_button != hold_button_old)
+ backlight_hold_changed(hold_button);
+
(void)data;
btn = ipod_3g_button_read();