diff options
-rw-r--r-- | apps/SOURCES | 3 | ||||
-rw-r--r-- | apps/action.h | 8 | ||||
-rw-r--r-- | apps/keymaps/keymap-cowond2.c | 30 | ||||
-rwxr-xr-x | apps/keymaps/keymap-mr500.c | 5 | ||||
-rw-r--r-- | apps/keymaps/keymap-touchpad.c | 214 | ||||
-rw-r--r-- | apps/main.c | 3 | ||||
-rwxr-xr-x | bootloader/mrobe500.c | 29 | ||||
-rw-r--r-- | firmware/export/button.h | 19 | ||||
-rw-r--r-- | firmware/export/config-cowond2.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/button-target.h | 23 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | 32 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-target.h | 20 | ||||
-rw-r--r-- | uisimulator/sdl/button.c | 118 | ||||
-rw-r--r-- | uisimulator/sdl/uisdl.c | 6 |
14 files changed, 414 insertions, 97 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index b1e5cce75d..40aa022842 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -138,6 +138,9 @@ metadata/a52.c | |||
138 | #ifdef HAVE_TAGCACHE | 138 | #ifdef HAVE_TAGCACHE |
139 | tagcache.c | 139 | tagcache.c |
140 | #endif | 140 | #endif |
141 | #ifdef HAVE_TOUCHPAD | ||
142 | keymaps/keymap-touchpad.c | ||
143 | #endif | ||
141 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ | 144 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ |
142 | || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 145 | || (CONFIG_KEYPAD == IRIVER_H300_PAD) |
143 | keymaps/keymap-h1x0_h3x0.c | 146 | keymaps/keymap-h1x0_h3x0.c |
diff --git a/apps/action.h b/apps/action.h index c1c60c9b0b..96e8086baa 100644 --- a/apps/action.h +++ b/apps/action.h | |||
@@ -25,14 +25,15 @@ | |||
25 | #define TIMEOUT_NOBLOCK 0 | 25 | #define TIMEOUT_NOBLOCK 0 |
26 | 26 | ||
27 | #define CONTEXT_STOPSEARCHING 0xFFFFFFFF | 27 | #define CONTEXT_STOPSEARCHING 0xFFFFFFFF |
28 | #define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ | 28 | #define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ |
29 | #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ | 29 | #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ |
30 | #define CONTEXT_CUSTOM2 0x20000000 /* as above */ | ||
30 | 31 | ||
31 | #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE } | 32 | #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE } |
32 | #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } | 33 | #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } |
33 | 34 | ||
34 | #ifndef HAS_BUTTON_HOLD | 35 | #ifndef HAS_BUTTON_HOLD |
35 | #define ALLOW_SOFTLOCK 0x20000000 /* will be stripped.. never needed except in calls to get_action() */ | 36 | #define ALLOW_SOFTLOCK 0x10000000 /* will be stripped.. never needed except in calls to get_action() */ |
36 | #else | 37 | #else |
37 | #define ALLOW_SOFTLOCK 0 | 38 | #define ALLOW_SOFTLOCK 0 |
38 | #endif | 39 | #endif |
@@ -79,6 +80,7 @@ enum { | |||
79 | ACTION_UNKNOWN, | 80 | ACTION_UNKNOWN, |
80 | ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */ | 81 | ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */ |
81 | ACTION_TOUCHPAD, | 82 | ACTION_TOUCHPAD, |
83 | ACTION_TOUCHPAD_MODE, /* toggle the touchpad mode */ | ||
82 | 84 | ||
83 | /* standard actions, use these first */ | 85 | /* standard actions, use these first */ |
84 | ACTION_STD_PREV, | 86 | ACTION_STD_PREV, |
diff --git a/apps/keymaps/keymap-cowond2.c b/apps/keymaps/keymap-cowond2.c index ff4fdc5417..59ca7cb123 100644 --- a/apps/keymaps/keymap-cowond2.c +++ b/apps/keymaps/keymap-cowond2.c | |||
@@ -37,48 +37,27 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | static const struct button_mapping button_context_standard[] = { | 39 | static const struct button_mapping button_context_standard[] = { |
40 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
41 | { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE }, | 40 | { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE }, |
42 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
43 | { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | 41 | { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, |
44 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
45 | { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE }, | 42 | { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE }, |
46 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
47 | { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 43 | { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
48 | 44 | ||
49 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | 45 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, |
50 | { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
51 | |||
52 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | 46 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, |
53 | // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | 47 | // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, |
54 | { ACTION_STD_CONTEXT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 48 | { ACTION_STD_CONTEXT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
55 | { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
56 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | 49 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, |
57 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
58 | { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
59 | LAST_ITEM_IN_LIST | 50 | LAST_ITEM_IN_LIST |
60 | }; /* button_context_standard */ | 51 | }; /* button_context_standard */ |
61 | 52 | ||
62 | 53 | ||
63 | static const struct button_mapping button_context_wps[] = { | 54 | static const struct button_mapping button_context_wps[] = { |
64 | { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
65 | { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
66 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
67 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
68 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, | ||
69 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
70 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
71 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, | ||
72 | 55 | ||
73 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS, BUTTON_NONE }, | 56 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS, BUTTON_NONE }, |
74 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | 57 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, |
75 | { ACTION_WPS_VOLUP, BUTTON_PLUS, BUTTON_NONE }, | 58 | { ACTION_WPS_VOLUP, BUTTON_PLUS, BUTTON_NONE }, |
76 | { ACTION_WPS_VOLUP, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 59 | { ACTION_WPS_VOLUP, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
77 | |||
78 | { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REL, BUTTON_UP }, | ||
79 | { ACTION_WPS_CONTEXT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, | ||
80 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | 60 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, |
81 | { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, | ||
82 | LAST_ITEM_IN_LIST | 61 | LAST_ITEM_IN_LIST |
83 | }; /* button_context_wps */ | 62 | }; /* button_context_wps */ |
84 | 63 | ||
@@ -99,13 +78,9 @@ static const struct button_mapping button_context_listtree_scroll_without_combo[ | |||
99 | }; | 78 | }; |
100 | 79 | ||
101 | static const struct button_mapping button_context_settings[] = { | 80 | static const struct button_mapping button_context_settings[] = { |
102 | { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, | ||
103 | { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE }, | 81 | { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE }, |
104 | { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
105 | { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 82 | { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
106 | { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, | ||
107 | { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE }, | 83 | { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE }, |
108 | { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
109 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | 84 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, |
110 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, | 85 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, |
111 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | 86 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, |
@@ -154,10 +129,9 @@ static const struct button_mapping button_context_keyboard[] = { | |||
154 | //LAST_ITEM_IN_LIST | 129 | //LAST_ITEM_IN_LIST |
155 | }; /* button_context_keyboard */ | 130 | }; /* button_context_keyboard */ |
156 | 131 | ||
157 | extern int current_tick; | 132 | const struct button_mapping* target_get_context_mapping(int context) |
158 | const struct button_mapping* get_context_mapping(int context) | ||
159 | { | 133 | { |
160 | switch (context&(~CONTEXT_REMOTE)) | 134 | switch (context) |
161 | { | 135 | { |
162 | case CONTEXT_STD: | 136 | case CONTEXT_STD: |
163 | return button_context_standard; | 137 | return button_context_standard; |
diff --git a/apps/keymaps/keymap-mr500.c b/apps/keymaps/keymap-mr500.c index b0d75c15bf..c680929efd 100755 --- a/apps/keymaps/keymap-mr500.c +++ b/apps/keymaps/keymap-mr500.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | /* Button Code Definitions for the toshiba gigabeat target */ | 20 | /* Button Code Definitions for the Olympus M:robe 500 target */ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
@@ -137,8 +137,7 @@ static const struct button_mapping button_context_keyboard[] = { | |||
137 | LAST_ITEM_IN_LIST | 137 | LAST_ITEM_IN_LIST |
138 | }; /* button_context_keyboard */ | 138 | }; /* button_context_keyboard */ |
139 | 139 | ||
140 | extern int current_tick; | 140 | const struct button_mapping* target_get_context_mapping(int context) |
141 | const struct button_mapping* get_context_mapping(int context) | ||
142 | { | 141 | { |
143 | switch (context&(~CONTEXT_REMOTE)) | 142 | switch (context&(~CONTEXT_REMOTE)) |
144 | { | 143 | { |
diff --git a/apps/keymaps/keymap-touchpad.c b/apps/keymaps/keymap-touchpad.c new file mode 100644 index 0000000000..48f1103cd3 --- /dev/null +++ b/apps/keymaps/keymap-touchpad.c | |||
@@ -0,0 +1,214 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: keymap-mr500.c 16056 2008-01-11 21:48:01Z roolku $ | ||
9 | * | ||
10 | * Copyright (C) 2006 Jonathan Gordon | ||
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 | /* Button Code Definitions for touchpad targets */ | ||
21 | #include <stdio.h> | ||
22 | #include <string.h> | ||
23 | #include <stdlib.h> | ||
24 | |||
25 | #include "config.h" | ||
26 | #include "action.h" | ||
27 | #include "button.h" | ||
28 | #include "settings.h" | ||
29 | |||
30 | const struct button_mapping* target_get_context_mapping(int context); | ||
31 | /* How this file is used: | ||
32 | get_context_mapping() at the bottom of the file is called by action.c as usual. | ||
33 | if the context is for the remote control its then passed straight to | ||
34 | target_get_context_mapping(). | ||
35 | These tables are only used for the touchpad buttons, so at the end of each | ||
36 | CONTEXT_CUSTOM2 is OR'ed with the context and then sent to target_get_context_mapping() | ||
37 | (NOTE: CONTEXT_CUSTOM2 will be stripped before being sent to make it easier.) | ||
38 | In the target keymap, remember to |CONTEXT_CUSTOM2 in the LAST_ITEM_IN_LIST__NEXTLIST() macro | ||
39 | to speed it up a tiny bit... if you dont it will go through these tables first before going | ||
40 | back to the target file. | ||
41 | */ | ||
42 | |||
43 | |||
44 | /* touchpad "buttons" | ||
45 | screen is split into a 3x3 grid for buttons... | ||
46 | BUTTON_TOPLEFT BUTTON_TOPMIDDLE BUTTON_TOPRIGHT | ||
47 | BUTTON_MIDLEFT BUTTON_CENTER BUTTON_MIDRIGHT | ||
48 | BUTTON_BOTTOMLEFT BUTTON_BOTTOMMIDDLE BUTTON_BOTTOMRIGHT | ||
49 | */ | ||
50 | |||
51 | static const struct button_mapping button_context_standard[] = { | ||
52 | { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
53 | { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
54 | { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
55 | { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
56 | |||
57 | { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER }, | ||
58 | { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT }, | ||
59 | { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT }, | ||
60 | |||
61 | { ACTION_STD_MENU, BUTTON_TOPLEFT, BUTTON_NONE }, | ||
62 | { ACTION_STD_QUICKSCREEN, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
63 | { ACTION_STD_CONTEXT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER }, | ||
64 | { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
65 | { ACTION_STD_CANCEL, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
66 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_STD) | ||
67 | }; /* button_context_standard */ | ||
68 | |||
69 | static const struct button_mapping button_context_wps[] = { | ||
70 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_WPS) | ||
71 | }; /* button_context_wps */ | ||
72 | |||
73 | static const struct button_mapping button_context_list[] = { | ||
74 | #if 0 | ||
75 | /* this is all to show how the poor-mans-gestures can be used... */ | ||
76 | { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT, BUTTON_NONE}, | ||
77 | { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT}, | ||
78 | { ACTION_STD_NEXTREPEAT, BUTTON_CENTER, BUTTON_TOPMIDDLE}, | ||
79 | { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE, BUTTON_CENTER}, | ||
80 | { ACTION_NONE, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
81 | { ACTION_NONE, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
82 | { ACTION_STD_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE }, | ||
83 | { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE }, | ||
84 | { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE}, | ||
85 | { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT}, | ||
86 | { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE, BUTTON_CENTER}, | ||
87 | { ACTION_STD_PREVREPEAT, BUTTON_CENTER, BUTTON_BOTTOMMIDDLE}, | ||
88 | #endif | ||
89 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_LIST) | ||
90 | }; /* button_context_list */ | ||
91 | |||
92 | static const struct button_mapping button_context_tree[] = { | ||
93 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM2|CONTEXT_TREE) | ||
94 | }; /* button_context_tree */ | ||
95 | |||
96 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
97 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE), | ||
98 | }; | ||
99 | |||
100 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
101 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE), | ||
102 | }; | ||
103 | |||
104 | static const struct button_mapping button_context_settings[] = { | ||
105 | { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
106 | { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
107 | { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
108 | { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
109 | { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE }, | ||
110 | { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
111 | |||
112 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS) | ||
113 | }; /* button_context_settings */ | ||
114 | |||
115 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
116 | { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
117 | { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
118 | { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
119 | { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
120 | { ACTION_SETTINGS_INC, BUTTON_MIDRIGHT, BUTTON_NONE }, | ||
121 | { ACTION_SETTINGS_INCREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
122 | { ACTION_SETTINGS_DEC, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
123 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
124 | { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE }, | ||
125 | { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE }, | ||
126 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_SETTINGS) | ||
127 | }; /* button_context_settingsgraphical */ | ||
128 | |||
129 | static const struct button_mapping button_context_yesno[] = { | ||
130 | { ACTION_YESNO_ACCEPT, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
131 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN) | ||
132 | }; /* button_context_settings_yesno */ | ||
133 | |||
134 | static const struct button_mapping button_context_colorchooser[] = { | ||
135 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_COLOURCHOOSER), | ||
136 | }; /* button_context_colorchooser */ | ||
137 | |||
138 | static const struct button_mapping button_context_eq[] = { | ||
139 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_EQ), | ||
140 | }; /* button_context_eq */ | ||
141 | |||
142 | /* Bookmark Screen */ | ||
143 | static const struct button_mapping button_context_bmark[] = { | ||
144 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_BOOKMARKSCREEN), | ||
145 | }; /* button_context_bmark */ | ||
146 | |||
147 | static const struct button_mapping button_context_time[] = { | ||
148 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_TIME), | ||
149 | }; /* button_context_time */ | ||
150 | |||
151 | static const struct button_mapping button_context_quickscreen[] = { | ||
152 | |||
153 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_QUICKSCREEN) | ||
154 | }; /* button_context_quickscreen */ | ||
155 | |||
156 | static const struct button_mapping button_context_pitchscreen[] = { | ||
157 | |||
158 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_PITCHSCREEN) | ||
159 | }; /* button_context_pitchcreen */ | ||
160 | |||
161 | static const struct button_mapping button_context_keyboard[] = { | ||
162 | |||
163 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD) | ||
164 | }; /* button_context_keyboard */ | ||
165 | |||
166 | const struct button_mapping* get_context_mapping(int context) | ||
167 | { | ||
168 | if ((context&CONTEXT_REMOTE) || (context&CONTEXT_CUSTOM2)) | ||
169 | return target_get_context_mapping(context&(~CONTEXT_CUSTOM2)); | ||
170 | |||
171 | switch (context) | ||
172 | { | ||
173 | case CONTEXT_STD: | ||
174 | return button_context_standard; | ||
175 | case CONTEXT_WPS: | ||
176 | return button_context_wps; | ||
177 | |||
178 | case CONTEXT_LIST: | ||
179 | return button_context_list; | ||
180 | case CONTEXT_MAINMENU: | ||
181 | case CONTEXT_TREE: | ||
182 | if (global_settings.hold_lr_for_scroll_in_list) | ||
183 | return button_context_listtree_scroll_without_combo; | ||
184 | else | ||
185 | return button_context_listtree_scroll_with_combo; | ||
186 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
187 | return button_context_tree; | ||
188 | |||
189 | case CONTEXT_SETTINGS: | ||
190 | return button_context_settings; | ||
191 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
192 | return button_context_settings_right_is_inc; | ||
193 | |||
194 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
195 | return button_context_colorchooser; | ||
196 | case CONTEXT_SETTINGS_EQ: | ||
197 | return button_context_eq; | ||
198 | |||
199 | case CONTEXT_SETTINGS_TIME: | ||
200 | return button_context_time; | ||
201 | |||
202 | case CONTEXT_YESNOSCREEN: | ||
203 | return button_context_yesno; | ||
204 | case CONTEXT_BOOKMARKSCREEN: | ||
205 | return button_context_bmark; | ||
206 | case CONTEXT_QUICKSCREEN: | ||
207 | return button_context_quickscreen; | ||
208 | case CONTEXT_PITCHSCREEN: | ||
209 | return button_context_pitchscreen; | ||
210 | case CONTEXT_KEYBOARD: | ||
211 | return button_context_keyboard; | ||
212 | } | ||
213 | return button_context_standard; | ||
214 | } | ||
diff --git a/apps/main.c b/apps/main.c index 3f83850df7..7309d95df2 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -132,6 +132,9 @@ static void app_main(void) | |||
132 | screens[i].update(); | 132 | screens[i].update(); |
133 | } | 133 | } |
134 | tree_gui_init(); | 134 | tree_gui_init(); |
135 | #ifdef HAVE_TOUCHPAD | ||
136 | touchpad_set_mode(TOUCHPAD_BUTTON); | ||
137 | #endif | ||
135 | root_menu(); | 138 | root_menu(); |
136 | } | 139 | } |
137 | 140 | ||
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c index e6dc58118d..5958396188 100755 --- a/bootloader/mrobe500.c +++ b/bootloader/mrobe500.c | |||
@@ -117,7 +117,7 @@ void mrdebug(void) | |||
117 | printf("%d:%d:%d %d %d %d", t->tm_hour, t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon, t->tm_year); | 117 | printf("%d:%d:%d %d %d %d", t->tm_hour, t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon, t->tm_year); |
118 | printf("time: %d", mktime(t)); | 118 | printf("time: %d", mktime(t)); |
119 | #endif | 119 | #endif |
120 | button = button_get(false); | 120 | button = button_get(false); |
121 | if (button == BUTTON_POWER) | 121 | if (button == BUTTON_POWER) |
122 | { | 122 | { |
123 | printf("reset"); | 123 | printf("reset"); |
@@ -143,8 +143,18 @@ void mrdebug(void) | |||
143 | // // tsc2100_keyclick(); /* doesnt work :( */ | 143 | // // tsc2100_keyclick(); /* doesnt work :( */ |
144 | // line -= 6; | 144 | // line -= 6; |
145 | // } | 145 | // } |
146 | else if (button == BUTTON_RC_HEART) | ||
147 | { | ||
148 | printf("POINT"); | ||
149 | touchpad_set_mode(TOUCHPAD_POINT); | ||
150 | } | ||
151 | else if (button == BUTTON_RC_MODE) | ||
152 | { | ||
153 | printf("BUTTON"); | ||
154 | touchpad_set_mode(TOUCHPAD_BUTTON); | ||
155 | } | ||
146 | #if 1 | 156 | #if 1 |
147 | if (button&BUTTON_TOUCHPAD) | 157 | else if (button&BUTTON_TOUCHPAD) |
148 | { | 158 | { |
149 | if (button&BUTTON_REL) | 159 | if (button&BUTTON_REL) |
150 | continue; | 160 | continue; |
@@ -152,11 +162,24 @@ void mrdebug(void) | |||
152 | int x = (data&0xffff0000)>>16, y = data&0x0000ffff; | 162 | int x = (data&0xffff0000)>>16, y = data&0x0000ffff; |
153 | reset_screen(); | 163 | reset_screen(); |
154 | line = 9; | 164 | line = 9; |
155 | printf("%x %d %d\n", button, x,y); | 165 | printf("BB: %x %d %d", button, x,y); |
156 | lcd_hline(x-5, x+5, y); | 166 | lcd_hline(x-5, x+5, y); |
157 | lcd_vline(x, y-5, y+5); | 167 | lcd_vline(x, y-5, y+5); |
158 | lcd_update(); | 168 | lcd_update(); |
159 | } | 169 | } |
170 | else if (button == BUTTON_RC_PLAY) | ||
171 | { | ||
172 | reset_screen(); | ||
173 | } | ||
174 | |||
175 | else if (button) | ||
176 | { | ||
177 | // if (button&BUTTON_REL) | ||
178 | { | ||
179 | printf("%08x %s\n", button, (button&BUTTON_REL)?"yes":"no"); | ||
180 | } | ||
181 | } | ||
182 | |||
160 | #endif | 183 | #endif |
161 | } | 184 | } |
162 | } | 185 | } |
diff --git a/firmware/export/button.h b/firmware/export/button.h index 95da7adc42..6decf6ec69 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -64,4 +64,23 @@ int button_apply_acceleration(const unsigned int data); | |||
64 | #define BUTTON_REPEAT 0x04000000 | 64 | #define BUTTON_REPEAT 0x04000000 |
65 | #define BUTTON_TOUCHPAD 0x08000000 | 65 | #define BUTTON_TOUCHPAD 0x08000000 |
66 | 66 | ||
67 | #ifdef HAVE_TOUCHPAD | ||
68 | #if !defined(BUTTON_TOPLEFT) || !defined(BUTTON_TOPMIDDLE) \ | ||
69 | || !defined(BUTTON_TOPRIGHT) || !defined(BUTTON_MIDLEFT) \ | ||
70 | || !defined(BUTTON_CENTER) || !defined(BUTTON_MIDRIGHT) \ | ||
71 | || !defined(BUTTON_BOTTOMLEFT) || !defined(BUTTON_BOTTOMMIDDLE) \ | ||
72 | || !defined(BUTTON_BOTTOMRIGHT) | ||
73 | #error Touchpad button mode BUTTON_* defines not set up correctly | ||
74 | #endif | ||
75 | enum touchpad_mode { | ||
76 | TOUCHPAD_POINT = 0, /* touchpad returns pixel co-ords */ | ||
77 | TOUCHPAD_BUTTON, /* touchpad returns BUTTON_* area codes | ||
78 | actual pixel value will still be accessable | ||
79 | from button_get_data */ | ||
80 | }; | ||
81 | /* maybe define the number of buttons in button-target.h ? */ | ||
82 | void touchpad_set_mode(enum touchpad_mode mode); | ||
83 | enum touchpad_mode touchpad_get_mode(void); | ||
84 | #endif | ||
85 | |||
67 | #endif /* _BUTTON_H_ */ | 86 | #endif /* _BUTTON_H_ */ |
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index 9380de57ef..d3b23b225d 100644 --- a/firmware/export/config-cowond2.h +++ b/firmware/export/config-cowond2.h | |||
@@ -56,6 +56,7 @@ | |||
56 | 56 | ||
57 | /* define this to indicate your device's keypad */ | 57 | /* define this to indicate your device's keypad */ |
58 | #define CONFIG_KEYPAD COWOND2_PAD | 58 | #define CONFIG_KEYPAD COWOND2_PAD |
59 | #define HAVE_TOUCHPAD | ||
59 | 60 | ||
60 | /* define this if you have a real-time clock */ | 61 | /* define this if you have a real-time clock */ |
61 | //#define CONFIG_RTC RTC_TCC780X | 62 | //#define CONFIG_RTC RTC_TCC780X |
diff --git a/firmware/target/arm/tcc780x/cowond2/button-target.h b/firmware/target/arm/tcc780x/cowond2/button-target.h index 3ccf70cffd..573ab03a11 100644 --- a/firmware/target/arm/tcc780x/cowond2/button-target.h +++ b/firmware/target/arm/tcc780x/cowond2/button-target.h | |||
@@ -35,14 +35,25 @@ int button_read_device(void); | |||
35 | #define BUTTON_MINUS 0x00000004 | 35 | #define BUTTON_MINUS 0x00000004 |
36 | #define BUTTON_MENU 0x00000008 | 36 | #define BUTTON_MENU 0x00000008 |
37 | 37 | ||
38 | /* compatibility hacks | ||
39 | not mapped to the touchpad button areas because | ||
40 | the touchpad is not always in that mode */ | ||
41 | #define BUTTON_LEFT BUTTON_MINUS | ||
42 | #define BUTTON_RIGHT BUTTON_PLUS | ||
43 | |||
38 | /* Faked buttons based on touchscreen quadrants (not yet read) */ | 44 | /* Faked buttons based on touchscreen quadrants (not yet read) */ |
39 | #define BUTTON_UP 0x00000020 | 45 | /* Touchpad Screen Area Buttons */ |
40 | #define BUTTON_DOWN 0x00000040 | 46 | #define BUTTON_TOPLEFT 0x00000010 |
41 | #define BUTTON_LEFT 0x00000080 | 47 | #define BUTTON_TOPMIDDLE 0x00000020 |
42 | #define BUTTON_RIGHT 0x00000100 | 48 | #define BUTTON_TOPRIGHT 0x00000040 |
43 | #define BUTTON_SELECT 0x00000200 | 49 | #define BUTTON_MIDLEFT 0x00000080 |
50 | #define BUTTON_CENTER 0x00000100 | ||
51 | #define BUTTON_MIDRIGHT 0x00000200 | ||
52 | #define BUTTON_BOTTOMLEFT 0x00000400 | ||
53 | #define BUTTON_BOTTOMMIDDLE 0x00000800 | ||
54 | #define BUTTON_BOTTOMRIGHT 0x00001000 | ||
44 | 55 | ||
45 | #define BUTTON_MAIN 0x3FF | 56 | #define BUTTON_MAIN 0x1FFF |
46 | 57 | ||
47 | /* No remote */ | 58 | /* No remote */ |
48 | #define BUTTON_REMOTE 0 | 59 | #define BUTTON_REMOTE 0 |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 0eb1c07e74..d1fd2eb702 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -40,6 +40,22 @@ | |||
40 | static short last_x, last_y, last_z1, last_z2; /* for the touch screen */ | 40 | static short last_x, last_y, last_z1, last_z2; /* for the touch screen */ |
41 | static bool touch_available = false; | 41 | static bool touch_available = false; |
42 | 42 | ||
43 | static enum touchpad_mode current_mode = TOUCHPAD_POINT; | ||
44 | static int touchpad_buttons[3][3] = { | ||
45 | {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, | ||
46 | {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, | ||
47 | {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, | ||
48 | }; | ||
49 | |||
50 | void touchpad_set_mode(enum touchpad_mode mode) | ||
51 | { | ||
52 | current_mode = mode; | ||
53 | } | ||
54 | enum touchpad_mode touchpad_get_mode(void) | ||
55 | { | ||
56 | return current_mode; | ||
57 | } | ||
58 | |||
43 | static struct touch_calibration_point topleft, bottomright; | 59 | static struct touch_calibration_point topleft, bottomright; |
44 | 60 | ||
45 | /* Jd's tests.. These will hopefully work for everyone so we dont have to | 61 | /* Jd's tests.. These will hopefully work for everyone so we dont have to |
@@ -165,7 +181,19 @@ int button_read_device(int *data) | |||
165 | last_x = x; | 181 | last_x = x; |
166 | last_y = y; | 182 | last_y = y; |
167 | *data = touch_to_pixels(x, y); | 183 | *data = touch_to_pixels(x, y); |
168 | r_button |= BUTTON_TOUCHPAD; | 184 | switch (current_mode) |
185 | { | ||
186 | case TOUCHPAD_POINT: | ||
187 | r_button |= BUTTON_TOUCHPAD; | ||
188 | break; | ||
189 | case TOUCHPAD_BUTTON: | ||
190 | { | ||
191 | int px_x = ((*data&0xffff0000)>>16), px_y = ((*data&0x0000ffff)); | ||
192 | r_button |= touchpad_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; | ||
193 | oldbutton = r_button; | ||
194 | break; | ||
195 | } | ||
196 | } | ||
169 | } | 197 | } |
170 | last_touch = current_tick; | 198 | last_touch = current_tick; |
171 | touch_available = false; | 199 | touch_available = false; |
@@ -219,6 +247,6 @@ void GIO14(void) | |||
219 | read_battery_inputs(); | 247 | read_battery_inputs(); |
220 | break; | 248 | break; |
221 | } | 249 | } |
222 | touch_available = true; | 250 | //touch_available = true; |
223 | IO_INTC_IRQ2 = (1<<3); /* IRQ_GIO14 == 35 */ | 251 | IO_INTC_IRQ2 = (1<<3); /* IRQ_GIO14 == 35 */ |
224 | } | 252 | } |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-target.h b/firmware/target/arm/tms320dm320/mrobe-500/button-target.h index 1f17f3f3c8..ae23346814 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-target.h | |||
@@ -53,14 +53,30 @@ void use_calibration(bool enable); | |||
53 | 53 | ||
54 | #define BUTTON_TOUCH 0x00000200 | 54 | #define BUTTON_TOUCH 0x00000200 |
55 | 55 | ||
56 | /* compatibility hacks */ | 56 | /* Touchpad Screen Area Buttons */ |
57 | #define BUTTON_TOPLEFT 0x00004000 | ||
58 | #define BUTTON_TOPMIDDLE 0x00008000 | ||
59 | #define BUTTON_TOPRIGHT 0x00010000 | ||
60 | #define BUTTON_MIDLEFT 0x00020000 | ||
61 | #define BUTTON_CENTER 0x00040000 | ||
62 | #define BUTTON_MIDRIGHT 0x00080000 | ||
63 | #define BUTTON_BOTTOMLEFT 0x00100000 | ||
64 | #define BUTTON_BOTTOMMIDDLE 0x00200000 | ||
65 | #define BUTTON_BOTTOMRIGHT 0x00400000 | ||
66 | |||
67 | /* compatibility hacks | ||
68 | not mapped to the touchpad button areas because | ||
69 | the touchpad is not always in that mode */ | ||
57 | #define BUTTON_LEFT BUTTON_RC_REW | 70 | #define BUTTON_LEFT BUTTON_RC_REW |
58 | #define BUTTON_RIGHT BUTTON_RC_FF | 71 | #define BUTTON_RIGHT BUTTON_RC_FF |
59 | 72 | ||
60 | #define POWEROFF_BUTTON BUTTON_POWER | 73 | #define POWEROFF_BUTTON BUTTON_POWER |
61 | #define POWEROFF_COUNT 10 | 74 | #define POWEROFF_COUNT 10 |
62 | 75 | ||
63 | #define BUTTON_MAIN BUTTON_POWER | 76 | #define BUTTON_MAIN (BUTTON_POWER| \ |
77 | BUTTON_TOPLEFT|BUTTON_TOPMIDDLE|BUTTON_TOPRIGHT \ | ||
78 | BUTTON_MIDLEFT|BUTTON_CENTER|BUTTON_MIDRIGHT \ | ||
79 | BUTTON_BOTTOMLEFT|BUTTON_BOTTOMMIDDLE|BUTTON_BOTTOMRIGHT) | ||
64 | 80 | ||
65 | #define BUTTON_REMOTE (BUTTON_RC_HEART|BUTTON_RC_MODE| \ | 81 | #define BUTTON_REMOTE (BUTTON_RC_HEART|BUTTON_RC_MODE| \ |
66 | BUTTON_RC_VOL_DOWN|BUTTON_RC_VOL_UP| \ | 82 | BUTTON_RC_VOL_DOWN|BUTTON_RC_VOL_UP| \ |
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 15764da900..6672a4164e 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c | |||
@@ -32,6 +32,15 @@ static intptr_t button_data; /* data value from last message dequeued */ | |||
32 | 32 | ||
33 | #ifdef HAVE_TOUCHPAD | 33 | #ifdef HAVE_TOUCHPAD |
34 | static int mouse_coords = 0; | 34 | static int mouse_coords = 0; |
35 | static enum touchpad_mode touchpad_mode = TOUCHPAD_POINT; | ||
36 | void touchpad_set_mode(enum touchpad_mode mode) | ||
37 | { | ||
38 | touchpad_mode = mode; | ||
39 | } | ||
40 | enum touchpad_mode touchpad_get_mode(void) | ||
41 | { | ||
42 | return touchpad_mode; | ||
43 | } | ||
35 | #endif | 44 | #endif |
36 | /* how long until repeat kicks in */ | 45 | /* how long until repeat kicks in */ |
37 | #define REPEAT_START 6 | 46 | #define REPEAT_START 6 |
@@ -111,9 +120,53 @@ void button_event(int key, bool pressed) | |||
111 | 120 | ||
112 | #ifdef HAVE_TOUCHPAD | 121 | #ifdef HAVE_TOUCHPAD |
113 | case BUTTON_TOUCHPAD: | 122 | case BUTTON_TOUCHPAD: |
114 | new_btn = BUTTON_TOUCHPAD; | ||
115 | data = mouse_coords; | 123 | data = mouse_coords; |
124 | switch (touchpad_mode) | ||
125 | { | ||
126 | case TOUCHPAD_POINT: | ||
127 | new_btn = BUTTON_TOUCHPAD; | ||
128 | break; | ||
129 | case TOUCHPAD_BUTTON: | ||
130 | { | ||
131 | static int touchpad_buttons[3][3] = { | ||
132 | {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, | ||
133 | {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, | ||
134 | {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, | ||
135 | }; | ||
136 | int px_x = ((data&0xffff0000)>>16), px_y = ((data&0x0000ffff)); | ||
137 | new_btn = touchpad_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; | ||
138 | break; | ||
139 | } | ||
140 | } | ||
116 | break; | 141 | break; |
142 | case SDLK_KP7: | ||
143 | new_btn = BUTTON_TOPLEFT; | ||
144 | break; | ||
145 | case SDLK_KP8: | ||
146 | new_btn = BUTTON_TOPMIDDLE; | ||
147 | break; | ||
148 | case SDLK_KP9: | ||
149 | new_btn = BUTTON_TOPRIGHT; | ||
150 | break; | ||
151 | case SDLK_KP4: | ||
152 | new_btn = BUTTON_MIDLEFT; | ||
153 | break; | ||
154 | case SDLK_KP5: | ||
155 | new_btn = BUTTON_CENTER; | ||
156 | break; | ||
157 | case SDLK_KP6: | ||
158 | new_btn = BUTTON_MIDRIGHT; | ||
159 | break; | ||
160 | case SDLK_KP1: | ||
161 | new_btn = BUTTON_BOTTOMLEFT; | ||
162 | break; | ||
163 | case SDLK_KP2: | ||
164 | new_btn = BUTTON_BOTTOMMIDDLE; | ||
165 | break; | ||
166 | case SDLK_KP3: | ||
167 | new_btn = BUTTON_BOTTOMRIGHT; | ||
168 | break; | ||
169 | |||
117 | #endif | 170 | #endif |
118 | case SDLK_u: | 171 | case SDLK_u: |
119 | if (!pressed) | 172 | if (!pressed) |
@@ -665,43 +718,34 @@ void button_event(int key, bool pressed) | |||
665 | break; | 718 | break; |
666 | 719 | ||
667 | #elif CONFIG_KEYPAD == MROBE500_PAD | 720 | #elif CONFIG_KEYPAD == MROBE500_PAD |
668 | case SDLK_KP4: | 721 | case SDLK_F9: |
722 | new_btn = BUTTON_RC_HEART; | ||
723 | break; | ||
724 | case SDLK_F10: | ||
725 | new_btn = BUTTON_RC_MODE; | ||
726 | break; | ||
727 | case SDLK_F11: | ||
728 | new_btn = BUTTON_RC_VOL_DOWN; | ||
729 | break; | ||
730 | case SDLK_F12: | ||
731 | new_btn = BUTTON_RC_VOL_UP; | ||
732 | break; | ||
669 | case SDLK_LEFT: | 733 | case SDLK_LEFT: |
670 | new_btn = BUTTON_LEFT; | 734 | new_btn = BUTTON_LEFT; |
671 | break; | 735 | break; |
672 | case SDLK_KP6: | ||
673 | case SDLK_RIGHT: | 736 | case SDLK_RIGHT: |
674 | new_btn = BUTTON_RIGHT; | 737 | new_btn = BUTTON_RIGHT; |
675 | break; | 738 | break; |
676 | case SDLK_KP8: | ||
677 | case SDLK_UP: | 739 | case SDLK_UP: |
678 | new_btn = BUTTON_RC_PLAY; | 740 | new_btn = BUTTON_RC_PLAY; |
679 | break; | 741 | break; |
680 | case SDLK_KP2: | ||
681 | case SDLK_DOWN: | 742 | case SDLK_DOWN: |
682 | new_btn = BUTTON_RC_DOWN; | 743 | new_btn = BUTTON_RC_DOWN; |
683 | break; | 744 | break; |
684 | case SDLK_KP_PLUS: | ||
685 | case SDLK_F8: | 745 | case SDLK_F8: |
686 | new_btn = BUTTON_POWER; | ||
687 | break; | ||
688 | case SDLK_ESCAPE: | 746 | case SDLK_ESCAPE: |
689 | new_btn = BUTTON_POWER; | 747 | new_btn = BUTTON_POWER; |
690 | break; | 748 | break; |
691 | case SDLK_KP_ENTER: | ||
692 | case SDLK_RETURN: | ||
693 | case SDLK_a: | ||
694 | new_btn = BUTTON_RC_VOL_UP; | ||
695 | break; | ||
696 | case SDLK_KP5: | ||
697 | case SDLK_SPACE: | ||
698 | new_btn = BUTTON_RC_HEART; | ||
699 | break; | ||
700 | case SDLK_KP_PERIOD: | ||
701 | case SDLK_INSERT: | ||
702 | new_btn = BUTTON_RC_MODE; | ||
703 | break; | ||
704 | |||
705 | #elif CONFIG_KEYPAD == MROBE100_PAD | 749 | #elif CONFIG_KEYPAD == MROBE100_PAD |
706 | case SDLK_KP1: | 750 | case SDLK_KP1: |
707 | new_btn = BUTTON_DISPLAY; | 751 | new_btn = BUTTON_DISPLAY; |
@@ -739,37 +783,16 @@ void button_event(int key, bool pressed) | |||
739 | break; | 783 | break; |
740 | 784 | ||
741 | #elif CONFIG_KEYPAD == COWOND2_PAD | 785 | #elif CONFIG_KEYPAD == COWOND2_PAD |
742 | case SDLK_KP4: | 786 | case SDLK_ESCAPE: |
743 | case SDLK_LEFT: | ||
744 | new_btn = BUTTON_LEFT; | ||
745 | break; | ||
746 | case SDLK_KP6: | ||
747 | case SDLK_RIGHT: | ||
748 | new_btn = BUTTON_RIGHT; | ||
749 | break; | ||
750 | case SDLK_KP8: | ||
751 | case SDLK_UP: | ||
752 | new_btn = BUTTON_UP; | ||
753 | break; | ||
754 | case SDLK_KP2: | ||
755 | case SDLK_DOWN: | ||
756 | new_btn = BUTTON_DOWN; | ||
757 | break; | ||
758 | case SDLK_KP3: | ||
759 | new_btn = BUTTON_POWER; | 787 | new_btn = BUTTON_POWER; |
760 | break; | 788 | break; |
761 | case SDLK_KP5: | ||
762 | case SDLK_KP_ENTER: | ||
763 | case SDLK_RETURN: | ||
764 | new_btn = BUTTON_SELECT; | ||
765 | break; | ||
766 | case SDLK_KP_PLUS: | 789 | case SDLK_KP_PLUS: |
767 | new_btn = BUTTON_PLUS; | 790 | new_btn = BUTTON_PLUS; |
768 | break; | 791 | break; |
769 | case SDLK_KP_MINUS: | 792 | case SDLK_KP_MINUS: |
770 | new_btn = BUTTON_MINUS; | 793 | new_btn = BUTTON_MINUS; |
771 | break; | 794 | break; |
772 | case SDLK_KP9: | 795 | case SDLK_KP_ENTER: |
773 | new_btn = BUTTON_MENU; | 796 | new_btn = BUTTON_MENU; |
774 | break; | 797 | break; |
775 | #else | 798 | #else |
@@ -977,11 +1000,6 @@ void mouse_tick_task(void) | |||
977 | if (debug_wps) | 1000 | if (debug_wps) |
978 | printf("Mouse at: (%d, %d)\n", x, y); | 1001 | printf("Mouse at: (%d, %d)\n", x, y); |
979 | } | 1002 | } |
980 | else if (lastbtn == BUTTON_TOUCHPAD) | ||
981 | { | ||
982 | button_event(BUTTON_TOUCHPAD, false); | ||
983 | mouse_coords = 0; | ||
984 | } | ||
985 | } | 1003 | } |
986 | #endif | 1004 | #endif |
987 | void button_init(void) | 1005 | void button_init(void) |
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c index 09210926b5..28aaf59f82 100644 --- a/uisimulator/sdl/uisdl.c +++ b/uisimulator/sdl/uisdl.c | |||
@@ -83,6 +83,12 @@ void gui_message_loop(void) | |||
83 | printf("Mouse at: (%d, %d)\n", event.button.x, event.button.y); | 83 | printf("Mouse at: (%d, %d)\n", event.button.x, event.button.y); |
84 | } | 84 | } |
85 | break; | 85 | break; |
86 | #else | ||
87 | case SDL_MOUSEBUTTONUP: | ||
88 | sim_enter_irq_handler(); | ||
89 | button_event(BUTTON_TOUCHPAD, false); | ||
90 | sim_exit_irq_handler(); | ||
91 | break; | ||
86 | #endif | 92 | #endif |
87 | case SDL_QUIT: | 93 | case SDL_QUIT: |
88 | done = true; | 94 | done = true; |