summaryrefslogtreecommitdiff
path: root/uisimulator/buttonmap/ihifi2.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/buttonmap/ihifi2.c')
-rw-r--r--uisimulator/buttonmap/ihifi2.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/uisimulator/buttonmap/ihifi2.c b/uisimulator/buttonmap/ihifi2.c
new file mode 100644
index 0000000000..a197ab8ac2
--- /dev/null
+++ b/uisimulator/buttonmap/ihifi2.c
@@ -0,0 +1,90 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2016 by Roman Stolyarov
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#include <SDL.h>
24#include "button.h"
25#include "buttonmap.h"
26
27int key_to_button(int keyboard_button)
28{
29 int new_btn = BUTTON_NONE;
30 switch (keyboard_button)
31 {
32 case SDLK_KP8:
33 case SDLK_ESCAPE:
34 new_btn = BUTTON_POWER;
35 break;
36 case SDLK_KP4:
37 case SDLK_KP_ENTER:
38 case SDLK_SPACE:
39 case SDLK_RETURN:
40 new_btn = BUTTON_PLAY;
41 break;
42 case SDLK_KP5:
43 case SDLK_UP:
44 new_btn = BUTTON_PREV;
45 break;
46 case SDLK_KP6:
47 case SDLK_PAGEUP:
48 new_btn = BUTTON_VOL_UP;
49 break;
50 case SDLK_KP1:
51 case SDLK_BACKSPACE:
52 new_btn = BUTTON_HOME;
53 break;
54 case SDLK_KP2:
55 case SDLK_DOWN:
56 new_btn = BUTTON_NEXT;
57 break;
58 case SDLK_KP3:
59 case SDLK_PAGEDOWN:
60 new_btn = BUTTON_VOL_DOWN;
61 break;
62 }
63 return new_btn;
64}
65
66#if (CONFIG_KEYPAD == IHIFI_770_PAD)
67struct button_map bm[] = {
68 { SDLK_KP8, 210, 0, 20, "Power" },
69 { SDLK_KP4, 94, 430, 40, "Play" },
70 { SDLK_KP5, 190, 430, 40, "Prev" },
71 { SDLK_KP6, 285, 430, 40, "Vol Up" },
72 { SDLK_KP1, 94, 508, 40, "Home" },
73 { SDLK_KP2, 190, 508, 40, "Next" },
74 { SDLK_KP3, 285, 508, 40, "Vol Down" },
75 { 0, 0, 0, 0, "None" }
76};
77#elif (CONFIG_KEYPAD == IHIFI_800_PAD)
78struct button_map bm[] = {
79 { SDLK_KP8, 214, 468, 25, "Power" },
80 { SDLK_KP4, 168, 580, 25, "Play" },
81 { SDLK_KP5, 60, 524, 25, "Prev" },
82 { SDLK_KP6, 102, 455, 25, "Vol Up" },
83 { SDLK_KP1, 246, 580, 25, "Home" },
84 { SDLK_KP2, 60, 580, 25, "Next" },
85 { SDLK_KP3, 50, 455, 25, "Vol Down" },
86 { 0, 0, 0, 0, "None" }
87};
88#else
89#error please define button map
90#endif