summaryrefslogtreecommitdiffstats
path: root/apps/plugins/rockboy/sys_rockbox.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-05-22 06:31:44 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-05-22 06:31:44 +0000
commit8970055ec107a2387eedbb373889d0f540745121 (patch)
tree369d5eebe74858a6d767c1d039d8213097caa884 /apps/plugins/rockboy/sys_rockbox.c
parent1e8f0e7c6428cc8f11005b077e8c9e1551ca5f69 (diff)
downloadrockbox-8970055ec107a2387eedbb373889d0f540745121.tar.gz
rockbox-8970055ec107a2387eedbb373889d0f540745121.tar.bz2
rockbox-8970055ec107a2387eedbb373889d0f540745121.zip
Hopefully take care of the scrollwheel difficulties in plugins on e200.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13460 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/rockboy/sys_rockbox.c')
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index 783accd01b..6cbbe523f7 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -38,6 +38,16 @@
#define ROCKBOY_PAD_UP BUTTON_SCROLL_UP
#define ROCKBOY_PAD_DOWN BUTTON_SCROLL_DOWN
+#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
+
+#define ROCKBOY_SCROLLWHEEL
+#define ROCKBOY_SCROLLWHEEL_CC BUTTON_SCROLL_UP
+#define ROCKBOY_SCROLLWHEEL_CW BUTTON_SCROLL_DOWN
+#define ROCKBOY_PAD_LEFT BUTTON_LEFT
+#define ROCKBOY_PAD_RIGHT BUTTON_RIGHT
+#define ROCKBOY_PAD_UP BUTTON_UP
+#define ROCKBOY_PAD_DOWN BUTTON_DOWN
+
#else
#define ROCKBOY_PAD_LEFT BUTTON_LEFT
@@ -69,10 +79,35 @@ static int wheelmap[8] = {
int released, pressed;
+
+#ifdef ROCKBOY_SCROLLWHEEL
+/* Scrollwheel events are posted directly and not polled by the button
+ driver - synthesize polling */
+static inline unsigned int read_scroll_wheel(void)
+{
+ unsigned int buttons = BUTTON_NONE;
+ unsigned int btn;
+
+ /* Empty out the button queue and see if any scrollwheel events were
+ posted */
+ do
+ {
+ btn = rb->button_get_w_tmo(0);
+ buttons |= btn;
+ }
+ while (btn != BUTTON_NONE);
+
+ return buttons & (ROCKBOY_SCROLLWHEEL_CC | ROCKBOY_SCROLLWHEEL_CW);
+}
+#endif
+
void ev_poll(void)
{
event_t ev;
newbuttonstate = rb->button_status();
+#ifdef ROCKBOY_SCROLLWHEEL
+ newbuttonstate |= read_scroll_wheel();
+#endif
released = ~newbuttonstate & oldbuttonstate;
pressed = newbuttonstate & ~oldbuttonstate;
oldbuttonstate = newbuttonstate;