diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-07-27 13:27:31 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-07-27 13:27:31 +0000 |
commit | c849219370fd65be2167a24a9f06f03bc1284ac1 (patch) | |
tree | f86aecea35281ccd42a180c2a92a4b17fecfbcfc /firmware | |
parent | 81537d49dfa871bbdd4cd83fee292b290ff3c980 (diff) | |
download | rockbox-c849219370fd65be2167a24a9f06f03bc1284ac1.tar.gz rockbox-c849219370fd65be2167a24a9f06f03bc1284ac1.zip |
Moved the X5 button driver to the target tree
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10339 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/drivers/button.c | 118 | ||||
-rw-r--r-- | firmware/export/button.h | 47 | ||||
-rwxr-xr-x | firmware/target/coldfire/iaudio/x5/button-target.h | 70 | ||||
-rwxr-xr-x | firmware/target/coldfire/iaudio/x5/button-x5.c | 131 |
5 files changed, 224 insertions, 143 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index bef54c0319..70a4c4ad25 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -217,6 +217,7 @@ drivers/m5636.c | |||
217 | target/coldfire/iaudio/x5/power-x5.c | 217 | target/coldfire/iaudio/x5/power-x5.c |
218 | #ifndef SIMULATOR | 218 | #ifndef SIMULATOR |
219 | drivers/generic_i2c.c | 219 | drivers/generic_i2c.c |
220 | target/coldfire/iaudio/x5/button-x5.c | ||
220 | target/coldfire/iaudio/x5/lcd-x5.c | 221 | target/coldfire/iaudio/x5/lcd-x5.c |
221 | target/coldfire/iaudio/x5/pcf50606-x5.c | 222 | target/coldfire/iaudio/x5/pcf50606-x5.c |
222 | target/coldfire/iaudio/x5/adc-x5.c | 223 | target/coldfire/iaudio/x5/adc-x5.c |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 216c51ea15..d9f9ae2a6d 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -44,6 +44,10 @@ | |||
44 | #include "lcd-remote.h" | 44 | #include "lcd-remote.h" |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef TARGET_TREE | ||
48 | #include "button-target.h" | ||
49 | #endif | ||
50 | |||
47 | struct event_queue button_queue; | 51 | struct event_queue button_queue; |
48 | 52 | ||
49 | static long lastbtn; /* Last valid button status */ | 53 | static long lastbtn; /* Last valid button status */ |
@@ -72,10 +76,7 @@ static bool remote_filter_first_keypress; | |||
72 | (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) | 76 | (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) |
73 | #define POWEROFF_BUTTON BUTTON_PLAY | 77 | #define POWEROFF_BUTTON BUTTON_PLAY |
74 | #define POWEROFF_COUNT 40 | 78 | #define POWEROFF_COUNT 40 |
75 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) | 79 | #elif !defined(TARGET_TREE) |
76 | #define POWEROFF_BUTTON BUTTON_POWER | ||
77 | #define POWEROFF_COUNT 10 | ||
78 | #else | ||
79 | #define POWEROFF_BUTTON BUTTON_OFF | 80 | #define POWEROFF_BUTTON BUTTON_OFF |
80 | #define POWEROFF_COUNT 10 | 81 | #define POWEROFF_COUNT 10 |
81 | #endif | 82 | #endif |
@@ -603,7 +604,10 @@ long button_get_w_tmo(int ticks) | |||
603 | void button_init(void) | 604 | void button_init(void) |
604 | { | 605 | { |
605 | /* hardware inits */ | 606 | /* hardware inits */ |
606 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 607 | #ifdef TARGET_TREE |
608 | button_init_device(); | ||
609 | |||
610 | #elif CONFIG_KEYPAD == IRIVER_H100_PAD | ||
607 | /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs */ | 611 | /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs */ |
608 | GPIO1_FUNCTION |= 0x00100062; | 612 | GPIO1_FUNCTION |= 0x00100062; |
609 | GPIO1_ENABLE &= ~0x00100060; | 613 | GPIO1_ENABLE &= ~0x00100060; |
@@ -614,11 +618,6 @@ void button_init(void) | |||
614 | /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs */ | 618 | /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs */ |
615 | GPIO1_ENABLE &= ~0x00100060; | 619 | GPIO1_ENABLE &= ~0x00100060; |
616 | GPIO1_FUNCTION |= 0x00100062; | 620 | GPIO1_FUNCTION |= 0x00100062; |
617 | #elif CONFIG_KEYPAD == IAUDIO_X5_PAD | ||
618 | /* Power, Remote Play & Hold switch */ | ||
619 | GPIO_FUNCTION |= 0x0e000000; | ||
620 | GPIO_ENABLE &= ~0x0e000000; | ||
621 | |||
622 | #elif CONFIG_KEYPAD == RECORDER_PAD | 621 | #elif CONFIG_KEYPAD == RECORDER_PAD |
623 | /* Set PB4 and PB8 as input pins */ | 622 | /* Set PB4 and PB8 as input pins */ |
624 | PBCR1 &= 0xfffc; /* PB8MD = 00 */ | 623 | PBCR1 &= 0xfffc; /* PB8MD = 00 */ |
@@ -833,9 +832,14 @@ static int button_read(void) | |||
833 | { | 832 | { |
834 | int btn = BUTTON_NONE; | 833 | int btn = BUTTON_NONE; |
835 | int retval; | 834 | int retval; |
835 | #ifndef TARGET_TREE | ||
836 | int data; | 836 | int data; |
837 | #endif | ||
837 | 838 | ||
838 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 839 | #ifdef TARGET_TREE |
840 | btn = button_read_device(); | ||
841 | |||
842 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
839 | static bool hold_button = false; | 843 | static bool hold_button = false; |
840 | static bool remote_hold_button = false; | 844 | static bool remote_hold_button = false; |
841 | static int prev_data = 0xff; | 845 | static int prev_data = 0xff; |
@@ -1238,86 +1242,6 @@ static int button_read(void) | |||
1238 | (void)data; | 1242 | (void)data; |
1239 | btn = ipod_3g_button_read(); | 1243 | btn = ipod_3g_button_read(); |
1240 | 1244 | ||
1241 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) | ||
1242 | static bool hold_button = false; | ||
1243 | static bool remote_hold_button = false; | ||
1244 | |||
1245 | /* light handling */ | ||
1246 | if (hold_button && !button_hold()) | ||
1247 | { | ||
1248 | backlight_on(); | ||
1249 | } | ||
1250 | /* TODO: add light handling for the remote */ | ||
1251 | |||
1252 | hold_button = button_hold(); | ||
1253 | remote_hold_button = remote_button_hold(); | ||
1254 | |||
1255 | /* normal buttons */ | ||
1256 | if (!hold_button) | ||
1257 | { | ||
1258 | data = adc_scan(ADC_BUTTONS); | ||
1259 | if (data < 0xf0) | ||
1260 | { | ||
1261 | if(data < 0x7c) | ||
1262 | if(data < 0x42) | ||
1263 | btn = BUTTON_LEFT; | ||
1264 | else | ||
1265 | if(data < 0x62) | ||
1266 | btn = BUTTON_RIGHT; | ||
1267 | else | ||
1268 | btn = BUTTON_SELECT; | ||
1269 | else | ||
1270 | if(data < 0xb6) | ||
1271 | if(data < 0x98) | ||
1272 | btn = BUTTON_REC; | ||
1273 | else | ||
1274 | btn = BUTTON_PLAY; | ||
1275 | else | ||
1276 | if(data < 0xd3) | ||
1277 | btn = BUTTON_DOWN; | ||
1278 | else | ||
1279 | btn = BUTTON_UP; | ||
1280 | } | ||
1281 | } | ||
1282 | |||
1283 | /* remote buttons */ | ||
1284 | data = adc_scan(ADC_REMOTE); | ||
1285 | if(data < 0x17) | ||
1286 | remote_hold_button = true; | ||
1287 | |||
1288 | if(!remote_hold_button) | ||
1289 | { | ||
1290 | if (data < 0xee) | ||
1291 | { | ||
1292 | if(data < 0x7a) | ||
1293 | if(data < 0x41) | ||
1294 | btn |= BUTTON_RC_REW; | ||
1295 | else | ||
1296 | if(data < 0x61) | ||
1297 | btn |= BUTTON_RC_FF; | ||
1298 | else | ||
1299 | btn |= BUTTON_RC_MODE; | ||
1300 | else | ||
1301 | if(data < 0xb4) | ||
1302 | if(data < 0x96) | ||
1303 | btn |= BUTTON_RC_REC; | ||
1304 | else | ||
1305 | btn |= BUTTON_RC_MENU; | ||
1306 | else | ||
1307 | if(data < 0xd1) | ||
1308 | btn |= BUTTON_RC_VOL_UP; | ||
1309 | else | ||
1310 | btn |= BUTTON_RC_VOL_DOWN; | ||
1311 | } | ||
1312 | } | ||
1313 | |||
1314 | data = GPIO_READ; | ||
1315 | if (!(data & 0x04000000)) | ||
1316 | btn |= BUTTON_POWER; | ||
1317 | |||
1318 | if (!(data & 0x02000000)) | ||
1319 | btn |= BUTTON_RC_PLAY; | ||
1320 | |||
1321 | #endif /* CONFIG_KEYPAD */ | 1245 | #endif /* CONFIG_KEYPAD */ |
1322 | 1246 | ||
1323 | #ifdef HAVE_LCD_BITMAP | 1247 | #ifdef HAVE_LCD_BITMAP |
@@ -1375,18 +1299,6 @@ bool button_hold(void) | |||
1375 | } | 1299 | } |
1376 | #endif | 1300 | #endif |
1377 | 1301 | ||
1378 | #if (CONFIG_KEYPAD == IAUDIO_X5_PAD) | ||
1379 | bool button_hold(void) | ||
1380 | { | ||
1381 | return (GPIO_READ & 0x08000000)?false:true; | ||
1382 | } | ||
1383 | |||
1384 | bool remote_button_hold(void) | ||
1385 | { | ||
1386 | return false; /* TODO X5 */ | ||
1387 | } | ||
1388 | #endif | ||
1389 | |||
1390 | int button_status(void) | 1302 | int button_status(void) |
1391 | { | 1303 | { |
1392 | return lastbtn; | 1304 | return lastbtn; |
diff --git a/firmware/export/button.h b/firmware/export/button.h index 93e6443645..92c9415372 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -23,8 +23,7 @@ | |||
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "config.h" | 24 | #include "config.h" |
25 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 25 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
26 | (CONFIG_KEYPAD == IRIVER_H300_PAD) || \ | 26 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
27 | (CONFIG_KEYPAD == IAUDIO_X5_PAD) | ||
28 | #define HAS_BUTTON_HOLD | 27 | #define HAS_BUTTON_HOLD |
29 | #define HAS_REMOTE_BUTTON_HOLD | 28 | #define HAS_REMOTE_BUTTON_HOLD |
30 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 29 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
@@ -64,6 +63,10 @@ bool remote_button_hold(void); | |||
64 | #define BUTTON_REPEAT 0x04000000 | 63 | #define BUTTON_REPEAT 0x04000000 |
65 | 64 | ||
66 | 65 | ||
66 | #ifdef TARGET_TREE | ||
67 | #include "button-target.h" | ||
68 | #else | ||
69 | |||
67 | /* Target specific button codes */ | 70 | /* Target specific button codes */ |
68 | 71 | ||
69 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD)\ | 72 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD)\ |
@@ -258,44 +261,6 @@ bool remote_button_hold(void); | |||
258 | 261 | ||
259 | #define BUTTON_REMOTE 0 | 262 | #define BUTTON_REMOTE 0 |
260 | 263 | ||
261 | #elif CONFIG_KEYPAD == IAUDIO_X5_PAD | ||
262 | |||
263 | /* iaudio X5 specific button codes */ | ||
264 | |||
265 | /* Main unit's buttons */ | ||
266 | #define BUTTON_POWER 0x00000001 | ||
267 | #define BUTTON_REC 0x00000002 | ||
268 | |||
269 | #define BUTTON_LEFT 0x00000004 | ||
270 | #define BUTTON_RIGHT 0x00000008 | ||
271 | #define BUTTON_UP 0x00000010 | ||
272 | #define BUTTON_DOWN 0x00000020 | ||
273 | |||
274 | #define BUTTON_PLAY 0x00000040 | ||
275 | #define BUTTON_SELECT 0x00000080 | ||
276 | |||
277 | #define BUTTON_MAIN (BUTTON_POWER|BUTTON_PLAY|BUTTON_LEFT|BUTTON_RIGHT\ | ||
278 | |BUTTON_UP|BUTTON_DOWN|BUTTON_REC|BUTTON_SELECT) | ||
279 | |||
280 | /* Remote control's buttons */ | ||
281 | #define BUTTON_RC_PLAY 0x00100000 | ||
282 | |||
283 | #define BUTTON_RC_REW 0x00080000 | ||
284 | #define BUTTON_RC_FF 0x00040000 | ||
285 | #define BUTTON_RC_VOL_UP 0x00020000 | ||
286 | #define BUTTON_RC_VOL_DOWN 0x00010000 | ||
287 | |||
288 | #define BUTTON_RC_REC 0x00008000 | ||
289 | #define BUTTON_RC_MENU 0x00004000 | ||
290 | |||
291 | #define BUTTON_RC_MODE 0x00002000 | ||
292 | |||
293 | #define BUTTON_REMOTE (BUTTON_RC_PLAY|BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN\ | ||
294 | |BUTTON_RC_REW|BUTTON_RC_FF\ | ||
295 | |BUTTON_RC_REC|BUTTON_RC_MENU|BUTTON_RC_MODE) | ||
296 | |||
297 | |||
298 | |||
299 | #elif CONFIG_KEYPAD == GIGABEAT_PAD | 264 | #elif CONFIG_KEYPAD == GIGABEAT_PAD |
300 | /* Toshiba Gigabeat specific button codes */ | 265 | /* Toshiba Gigabeat specific button codes */ |
301 | 266 | ||
@@ -337,5 +302,7 @@ bool remote_button_hold(void); | |||
337 | 302 | ||
338 | #endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */ | 303 | #endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */ |
339 | 304 | ||
305 | #endif /* TARGET_TREE */ | ||
306 | |||
340 | #endif /* _BUTTON_H_ */ | 307 | #endif /* _BUTTON_H_ */ |
341 | 308 | ||
diff --git a/firmware/target/coldfire/iaudio/x5/button-target.h b/firmware/target/coldfire/iaudio/x5/button-target.h new file mode 100755 index 0000000000..998522fe15 --- /dev/null +++ b/firmware/target/coldfire/iaudio/x5/button-target.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _BUTTON_TARGET_H_ | ||
20 | #define _BUTTON_TARGET_H_ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include "config.h" | ||
24 | |||
25 | #define HAS_BUTTON_HOLD | ||
26 | #define HAS_REMOTE_BUTTON_HOLD | ||
27 | |||
28 | bool button_hold(void); | ||
29 | bool remote_button_hold(void); | ||
30 | void button_init_device(void); | ||
31 | int button_read_device(void); | ||
32 | |||
33 | /* iaudio X5 specific button codes */ | ||
34 | |||
35 | /* Main unit's buttons */ | ||
36 | #define BUTTON_POWER 0x00000001 | ||
37 | #define BUTTON_REC 0x00000002 | ||
38 | |||
39 | #define BUTTON_LEFT 0x00000004 | ||
40 | #define BUTTON_RIGHT 0x00000008 | ||
41 | #define BUTTON_UP 0x00000010 | ||
42 | #define BUTTON_DOWN 0x00000020 | ||
43 | |||
44 | #define BUTTON_PLAY 0x00000040 | ||
45 | #define BUTTON_SELECT 0x00000080 | ||
46 | |||
47 | #define BUTTON_MAIN (BUTTON_POWER|BUTTON_PLAY|BUTTON_LEFT|BUTTON_RIGHT\ | ||
48 | |BUTTON_UP|BUTTON_DOWN|BUTTON_REC|BUTTON_SELECT) | ||
49 | |||
50 | /* Remote control's buttons */ | ||
51 | #define BUTTON_RC_PLAY 0x00100000 | ||
52 | |||
53 | #define BUTTON_RC_REW 0x00080000 | ||
54 | #define BUTTON_RC_FF 0x00040000 | ||
55 | #define BUTTON_RC_VOL_UP 0x00020000 | ||
56 | #define BUTTON_RC_VOL_DOWN 0x00010000 | ||
57 | |||
58 | #define BUTTON_RC_REC 0x00008000 | ||
59 | #define BUTTON_RC_MENU 0x00004000 | ||
60 | |||
61 | #define BUTTON_RC_MODE 0x00002000 | ||
62 | |||
63 | #define BUTTON_REMOTE (BUTTON_RC_PLAY|BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN\ | ||
64 | |BUTTON_RC_REW|BUTTON_RC_FF\ | ||
65 | |BUTTON_RC_REC|BUTTON_RC_MENU|BUTTON_RC_MODE) | ||
66 | |||
67 | #define POWEROFF_BUTTON BUTTON_POWER | ||
68 | #define POWEROFF_COUNT 10 | ||
69 | |||
70 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/coldfire/iaudio/x5/button-x5.c b/firmware/target/coldfire/iaudio/x5/button-x5.c new file mode 100755 index 0000000000..07bc7bf3f7 --- /dev/null +++ b/firmware/target/coldfire/iaudio/x5/button-x5.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stdlib.h> | ||
21 | #include "config.h" | ||
22 | #include "cpu.h" | ||
23 | #include "system.h" | ||
24 | #include "button.h" | ||
25 | #include "kernel.h" | ||
26 | #include "backlight.h" | ||
27 | #include "adc.h" | ||
28 | #include "system.h" | ||
29 | |||
30 | void button_init_device(void) | ||
31 | { | ||
32 | /* Power, Remote Play & Hold switch */ | ||
33 | GPIO_FUNCTION |= 0x0e000000; | ||
34 | GPIO_ENABLE &= ~0x0e000000; | ||
35 | } | ||
36 | |||
37 | bool button_hold(void) | ||
38 | { | ||
39 | return (GPIO_READ & 0x08000000)?false:true; | ||
40 | } | ||
41 | |||
42 | bool remote_button_hold(void) | ||
43 | { | ||
44 | return false; /* TODO X5 */ | ||
45 | } | ||
46 | |||
47 | int button_read_device(void) | ||
48 | { | ||
49 | int data; | ||
50 | int btn = BUTTON_NONE; | ||
51 | static bool hold_button = false; | ||
52 | static bool remote_hold_button = false; | ||
53 | |||
54 | /* backlight handling */ | ||
55 | if (hold_button && !button_hold()) | ||
56 | { | ||
57 | backlight_on(); | ||
58 | } | ||
59 | /* TODO: add light handling for the remote */ | ||
60 | |||
61 | hold_button = button_hold(); | ||
62 | remote_hold_button = remote_button_hold(); | ||
63 | |||
64 | /* normal buttons */ | ||
65 | if (!hold_button) | ||
66 | { | ||
67 | data = adc_scan(ADC_BUTTONS); | ||
68 | if (data < 0xf0) | ||
69 | { | ||
70 | if(data < 0x7c) | ||
71 | if(data < 0x42) | ||
72 | btn = BUTTON_LEFT; | ||
73 | else | ||
74 | if(data < 0x62) | ||
75 | btn = BUTTON_RIGHT; | ||
76 | else | ||
77 | btn = BUTTON_SELECT; | ||
78 | else | ||
79 | if(data < 0xb6) | ||
80 | if(data < 0x98) | ||
81 | btn = BUTTON_REC; | ||
82 | else | ||
83 | btn = BUTTON_PLAY; | ||
84 | else | ||
85 | if(data < 0xd3) | ||
86 | btn = BUTTON_DOWN; | ||
87 | else | ||
88 | btn = BUTTON_UP; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /* remote buttons */ | ||
93 | data = adc_scan(ADC_REMOTE); | ||
94 | if(data < 0x17) | ||
95 | remote_hold_button = true; | ||
96 | |||
97 | if(!remote_hold_button) | ||
98 | { | ||
99 | if (data < 0xee) | ||
100 | { | ||
101 | if(data < 0x7a) | ||
102 | if(data < 0x41) | ||
103 | btn |= BUTTON_RC_REW; | ||
104 | else | ||
105 | if(data < 0x61) | ||
106 | btn |= BUTTON_RC_FF; | ||
107 | else | ||
108 | btn |= BUTTON_RC_MODE; | ||
109 | else | ||
110 | if(data < 0xb4) | ||
111 | if(data < 0x96) | ||
112 | btn |= BUTTON_RC_REC; | ||
113 | else | ||
114 | btn |= BUTTON_RC_MENU; | ||
115 | else | ||
116 | if(data < 0xd1) | ||
117 | btn |= BUTTON_RC_VOL_UP; | ||
118 | else | ||
119 | btn |= BUTTON_RC_VOL_DOWN; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | data = GPIO_READ; | ||
124 | if (!(data & 0x04000000)) | ||
125 | btn |= BUTTON_POWER; | ||
126 | |||
127 | if (!(data & 0x02000000)) | ||
128 | btn |= BUTTON_RC_PLAY; | ||
129 | |||
130 | return btn; | ||
131 | } | ||