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
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
index 62a25e8..870aa52 100644
--- a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
+++ b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
@@ -254,7 +254,7 @@
         if (buf_rx != NULL)
             buf_rx[i] = rxdata & 0xFF;
 
-        //udelay(100);
+        udelay(100);
     }
 
     select_hid(false);
diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h
index 096908b..b5667ec 100644
--- a/firmware/target/hosted/sdl/sim-ui-defines.h
+++ b/firmware/target/hosted/sdl/sim-ui-defines.h
@@ -424,6 +424,13 @@
 #define UI_LCD_POSX                 64
 #define UI_LCD_POSY                 127
 
+#elif defined(SANSA_CONNECT)
+#define UI_TITLE                    "Sansa Connect"
+#define UI_WIDTH                    371 /* width of GUI window */
+#define UI_HEIGHT                   687 /* height of GUI window */
+#define UI_LCD_POSX                 68
+#define UI_LCD_POSY                 77
+
 #elif defined(APPLICATION)
 #define UI_TITLE                    "Rockbox"
 #define UI_LCD_POSX                 0
diff --git a/uisimulator/bitmaps/UI-sansaconnect.bmp b/uisimulator/bitmaps/UI-sansaconnect.bmp
new file mode 100644
index 0000000..90e524d
--- /dev/null
+++ b/uisimulator/bitmaps/UI-sansaconnect.bmp
Binary files differ
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES
index 4a2c8ff..7213d1c 100644
--- a/uisimulator/buttonmap/SOURCES
+++ b/uisimulator/buttonmap/SOURCES
@@ -67,5 +67,7 @@
 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 0000000..5e65544
--- /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" }
+};