From c9f59e6f75bcfa25a563fedd77bfa77b3617f133 Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Tue, 8 Aug 2006 22:03:56 +0000 Subject: 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 --- firmware/drivers/button.c | 59 +++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'firmware/drivers') 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(); -- cgit v1.2.3