1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Tomasz Malesinski
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* Button Code Definitions for iriver iFP7xx target */
29 * The format of the list is as follows
30 * { Action Code, Button code, Prereq button code }
31 * if there's no need to check the previous button's value, use BUTTON_NONE
32 * Insert LAST_ITEM_IN_LIST at the end of each mapping
34 static const struct button_mapping button_context_standard
[] = {
35 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
36 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
37 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
38 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
40 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
41 { ACTION_STD_CANCEL
, BUTTON_PLAY
, BUTTON_NONE
},
42 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
,BUTTON_SELECT
},
44 { ACTION_STD_QUICKSCREEN
, BUTTON_MODE
|BUTTON_REPEAT
, BUTTON_MODE
},
45 { ACTION_STD_MENU
, BUTTON_MODE
|BUTTON_REL
, BUTTON_MODE
},
46 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
47 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
50 }; /* button_context_standard */
52 static const struct button_mapping button_context_wps
[] = {
53 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
54 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
55 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
56 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
57 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
58 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
59 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
60 { ACTION_WPS_ABSETB_NEXTDIR
, BUTTON_PLAY
|BUTTON_RIGHT
, BUTTON_PLAY
},
61 { ACTION_WPS_ABSETA_PREVDIR
, BUTTON_PLAY
|BUTTON_LEFT
, BUTTON_PLAY
},
62 { ACTION_WPS_STOP
, BUTTON_EQ
, BUTTON_NONE
},
63 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
64 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
, BUTTON_NONE
},
65 { ACTION_WPS_VOLUP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
66 { ACTION_WPS_VOLUP
, BUTTON_UP
, BUTTON_NONE
},
67 { ACTION_WPS_QUICKSCREEN
, BUTTON_MODE
|BUTTON_REPEAT
, BUTTON_MODE
},
68 { ACTION_WPS_MENU
, BUTTON_MODE
|BUTTON_REL
, BUTTON_MODE
},
69 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
70 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
71 { ACTION_WPS_ABRESET
, BUTTON_PLAY
|BUTTON_SELECT
, BUTTON_PLAY
},
72 { ACTION_WPS_ID3SCREEN
, BUTTON_PLAY
|BUTTON_MODE
, BUTTON_PLAY
},
75 }; /* button_context_wps */
77 static const struct button_mapping button_context_settings
[] = {
78 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
79 { ACTION_SETTINGS_INCREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
80 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
81 { ACTION_SETTINGS_DECREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
82 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
83 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
85 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
86 }; /* button_context_settings */
88 static const struct button_mapping button_context_settings_r_is_inc
[] = {
89 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
90 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
91 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
92 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
93 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
94 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
95 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
96 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
98 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
99 }; /* button_context_settingsgraphical */
101 static const struct button_mapping button_context_yesno
[] = {
102 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
103 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
104 }; /* button_context_settings_yesno */
106 static const struct button_mapping button_context_bmark
[] = {
107 { ACTION_BMS_DELETE
, BUTTON_MODE
, BUTTON_NONE
},
108 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
109 }; /* button_context_settings_bmark */
111 static const struct button_mapping button_context_quickscreen
[] = {
112 { ACTION_QS_DOWNINV
, BUTTON_UP
, BUTTON_NONE
},
113 { ACTION_QS_DOWNINV
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
114 { ACTION_QS_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
115 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
116 { ACTION_QS_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
117 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
118 { ACTION_QS_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
119 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
121 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
122 }; /* button_context_quickscreen */
124 static const struct button_mapping button_context_pitchscreen
[] = {
125 { ACTION_PS_INC_SMALL
, BUTTON_UP
, BUTTON_NONE
},
126 { ACTION_PS_INC_BIG
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
127 { ACTION_PS_DEC_SMALL
, BUTTON_DOWN
, BUTTON_NONE
},
128 { ACTION_PS_DEC_BIG
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
129 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
130 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
131 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
132 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
133 { ACTION_PS_RESET
, BUTTON_MODE
, BUTTON_NONE
},
134 { ACTION_PS_EXIT
, BUTTON_PLAY
, BUTTON_NONE
},
135 { ACTION_PS_SLOWER
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
136 { ACTION_PS_FASTER
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
138 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
139 }; /* button_context_pitchcreen */
141 static const struct button_mapping button_context_keyboard
[] = {
142 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
143 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
144 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
145 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
146 { ACTION_KBD_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
147 { ACTION_KBD_DONE
, BUTTON_MODE
, BUTTON_NONE
},
148 { ACTION_KBD_ABORT
, BUTTON_PLAY
, BUTTON_NONE
},
149 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
150 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
151 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
152 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
155 }; /* button_context_keyboard */
157 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
158 const struct button_mapping
* get_context_mapping(int context
)
163 return button_context_standard
;
165 return button_context_wps
;
166 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
167 case CONTEXT_SETTINGS_EQ
:
168 case CONTEXT_SETTINGS_COLOURCHOOSER
:
169 case CONTEXT_SETTINGS_TIME
:
170 return button_context_settings_r_is_inc
;
171 case CONTEXT_SETTINGS
:
172 return button_context_settings
;
173 case CONTEXT_YESNOSCREEN
:
174 return button_context_yesno
;
175 case CONTEXT_BOOKMARKSCREEN
:
176 return button_context_bmark
;
177 case CONTEXT_QUICKSCREEN
:
178 return button_context_quickscreen
;
179 case CONTEXT_PITCHSCREEN
:
180 return button_context_pitchscreen
;
181 case CONTEXT_KEYBOARD
:
182 return button_context_keyboard
;
184 return button_context_standard
;