diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/button.c | 59 |
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) | |||
844 | static bool remote_hold_button = false; | 844 | static bool remote_hold_button = false; |
845 | static int prev_data = 0xff; | 845 | static int prev_data = 0xff; |
846 | static int last_valid = 0xff; | 846 | static int last_valid = 0xff; |
847 | bool hold_button_old; | ||
847 | 848 | ||
848 | /* light handling */ | 849 | /* normal buttons */ |
849 | if (hold_button && !button_hold()) | 850 | hold_button_old = hold_button; |
850 | { | ||
851 | backlight_on(); | ||
852 | } | ||
853 | if (remote_hold_button && !remote_button_hold_only()) | ||
854 | { | ||
855 | remote_backlight_on(); | ||
856 | } | ||
857 | |||
858 | hold_button = button_hold(); | 851 | hold_button = button_hold(); |
859 | remote_hold_button = remote_button_hold_only(); | ||
860 | 852 | ||
861 | /* normal buttons */ | 853 | if (hold_button != hold_button_old) |
854 | backlight_hold_changed(hold_button); | ||
855 | |||
862 | if (!hold_button) | 856 | if (!hold_button) |
863 | { | 857 | { |
864 | data = adc_scan(ADC_BUTTONS); | 858 | data = adc_scan(ADC_BUTTONS); |
@@ -920,6 +914,13 @@ static int button_read(void) | |||
920 | } | 914 | } |
921 | 915 | ||
922 | /* remote buttons */ | 916 | /* remote buttons */ |
917 | remote_hold_button = remote_button_hold_only(); | ||
918 | |||
919 | if (remote_hold_button && !remote_button_hold_only()) | ||
920 | { | ||
921 | remote_backlight_on(); | ||
922 | } | ||
923 | |||
923 | if (!remote_hold_button) | 924 | if (!remote_hold_button) |
924 | { | 925 | { |
925 | data = adc_scan(ADC_REMOTE); | 926 | data = adc_scan(ADC_REMOTE); |
@@ -1038,15 +1039,15 @@ static int button_read(void) | |||
1038 | 1039 | ||
1039 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD | 1040 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD |
1040 | static bool hold_button = false; | 1041 | static bool hold_button = false; |
1042 | bool hold_button_old; | ||
1041 | 1043 | ||
1042 | /* light handling */ | 1044 | /* normal buttons */ |
1043 | if (hold_button && !button_hold()) | 1045 | hold_button_old = hold_button; |
1044 | { | ||
1045 | backlight_on(); | ||
1046 | } | ||
1047 | hold_button = button_hold(); | 1046 | hold_button = button_hold(); |
1048 | 1047 | ||
1049 | /* normal buttons */ | 1048 | if (hold_button != hold_button_old) |
1049 | backlight_hold_changed(hold_button); | ||
1050 | |||
1050 | if (!button_hold()) | 1051 | if (!button_hold()) |
1051 | { | 1052 | { |
1052 | data = adc_read(ADC_BUTTONS); | 1053 | data = adc_read(ADC_BUTTONS); |
@@ -1217,28 +1218,30 @@ static int button_read(void) | |||
1217 | 1218 | ||
1218 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) | 1219 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) |
1219 | static bool hold_button = false; | 1220 | static bool hold_button = false; |
1221 | bool hold_button_old; | ||
1220 | 1222 | ||
1221 | /* light handling */ | 1223 | /* normal buttons */ |
1222 | if (hold_button && !button_hold()) | 1224 | hold_button_old = hold_button; |
1223 | { | ||
1224 | backlight_on(); | ||
1225 | } | ||
1226 | hold_button = button_hold(); | 1225 | hold_button = button_hold(); |
1227 | 1226 | ||
1227 | if (hold_button != hold_button_old) | ||
1228 | backlight_hold_changed(hold_button); | ||
1229 | |||
1228 | (void)data; | 1230 | (void)data; |
1229 | /* The int_btn variable is set in the button interrupt handler */ | 1231 | /* The int_btn variable is set in the button interrupt handler */ |
1230 | btn = int_btn; | 1232 | btn = int_btn; |
1231 | 1233 | ||
1232 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) | 1234 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) |
1233 | static bool hold_button = false; | 1235 | static bool hold_button = false; |
1236 | bool hold_button_old; | ||
1234 | 1237 | ||
1235 | /* light handling */ | 1238 | /* normal buttons */ |
1236 | if (hold_button && !button_hold()) | 1239 | hold_button_old = hold_button; |
1237 | { | ||
1238 | backlight_on(); | ||
1239 | } | ||
1240 | hold_button = button_hold(); | 1240 | hold_button = button_hold(); |
1241 | 1241 | ||
1242 | if (hold_button != hold_button_old) | ||
1243 | backlight_hold_changed(hold_button); | ||
1244 | |||
1242 | (void)data; | 1245 | (void)data; |
1243 | btn = ipod_3g_button_read(); | 1246 | btn = ipod_3g_button_read(); |
1244 | 1247 | ||