summaryrefslogtreecommitdiffstats
path: root/uisimulator/buttonmap
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2011-12-01 13:41:59 +0000
committerTomasz Moń <desowin@gmail.com>2011-12-01 13:41:59 +0000
commit39f4408b63112f2e8186f8196aa1db3192feee77 (patch)
treefab1367e948edd45c355594a1c2190ac6ae38925 /uisimulator/buttonmap
parentf0bab2ff9a8da18e2e5ea6d18138b048e7469c68 (diff)
downloadrockbox-39f4408b63112f2e8186f8196aa1db3192feee77.tar.gz
rockbox-39f4408b63112f2e8186f8196aa1db3192feee77.zip
Sansa Connect: Make simulator compile. UI-sansaconnect.bmp by Martin Sägmüller (based on press image).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31102 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/buttonmap')
-rw-r--r--uisimulator/buttonmap/SOURCES2
-rw-r--r--uisimulator/buttonmap/sansa-connect.c96
2 files changed, 98 insertions, 0 deletions
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES
index 4a2c8ff2e1..7213d1cff3 100644
--- a/uisimulator/buttonmap/SOURCES
+++ b/uisimulator/buttonmap/SOURCES
@@ -67,5 +67,7 @@ mpio-hd200.c
mpio-hd300.c
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
sansa-fuzeplus.c
+#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
+sansa-connect.c
#endif
#endif /* SIMULATOR */
diff --git a/uisimulator/buttonmap/sansa-connect.c b/uisimulator/buttonmap/sansa-connect.c
new file mode 100644
index 0000000000..5e65544ab0
--- /dev/null
+++ b/uisimulator/buttonmap/sansa-connect.c
@@ -0,0 +1,96 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id: $
+ *
+ * Copyright (C) 2011 by Tomasz Moń
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+
+#include <SDL.h>
+#include "button.h"
+#include "buttonmap.h"
+
+int key_to_button(int keyboard_button)
+{
+ int new_btn = BUTTON_NONE;
+ switch (keyboard_button)
+ {
+ case SDLK_KP4:
+ case SDLK_LEFT:
+ new_btn = BUTTON_LEFT;
+ break;
+ case SDLK_KP6:
+ case SDLK_RIGHT:
+ new_btn = BUTTON_RIGHT;
+ break;
+ case SDLK_KP8:
+ case SDLK_UP:
+ new_btn = BUTTON_UP;
+ break;
+ case SDLK_KP2:
+ case SDLK_DOWN:
+ new_btn = BUTTON_DOWN;
+ break;
+ case SDLK_KP7:
+ new_btn = BUTTON_PREV;
+ break;
+ case SDLK_PAGEUP:
+ case SDLK_KP9:
+ new_btn = BUTTON_NEXT;
+ break;
+ case SDLK_KP0:
+ new_btn = BUTTON_POWER;
+ break;
+ case SDLK_KP5:
+ case SDLK_SPACE:
+ case SDLK_KP_ENTER:
+ case SDLK_RETURN:
+ new_btn = BUTTON_SELECT;
+ break;
+ case SDLK_KP_PLUS:
+ new_btn = BUTTON_VOL_UP;
+ break;
+ case SDLK_KP_MINUS:
+ new_btn = BUTTON_VOL_DOWN;
+ break;
+ case SDL_BUTTON_WHEELDOWN:
+ case SDLK_KP3:
+ new_btn = BUTTON_SCROLL_FWD;
+ break;
+ case SDL_BUTTON_WHEELUP:
+ case SDLK_KP1:
+ new_btn = BUTTON_SCROLL_BACK;
+ break;
+ }
+ return new_btn;
+}
+
+struct button_map bm[] = {
+ { SDLK_UP, 191, 505, 36, "Up" },
+ { SDLK_DOWN, 191, 630, 36, "Down" },
+ { SDLK_LEFT, 130, 568, 36, "Left" },
+ { SDLK_RIGHT, 256, 568, 36, "Right" },
+ { SDLK_KP7, 107, 443, 40, "Prev" },
+ { SDLK_KP9, 271, 443, 40, "Next" },
+ { SDLK_KP5, 191, 568, 36, "Select" },
+ { SDLK_KP0, 220, 43, 30, "Power" },
+ { SDLK_KP3, 231, 520, 20, "Scroll Fwd" },
+ { SDLK_KP1, 149, 520, 20, "Scroll Back" },
+ { SDLK_KP_MINUS, 3, 377, 50, "Volume -" },
+ { SDLK_KP_PLUS, 6, 175, 50, "Volume +" },
+ { 0, 0, 0, 0, "None" }
+};