Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Diff1
Index: apps/plugins/lamp.c
===================================================================
--- apps/plugins/lamp.c (révision 31584)
+++ apps/plugins/lamp.c (copie de travail)
@@ -24,6 +24,7 @@
#include "plugin.h"
#include "lib/helper.h"
+#include "lib/pluginlib_actions.h"
/* variable button definitions.
- only targets with a colour display
@@ -33,138 +34,46 @@
LAMP_UP / LAMP_DOWN: change the brightness
*/
#if defined(HAVE_LCD_COLOR) || defined(HAVE_BACKLIGHT_BRIGHTNESS)
-#if (CONFIG_KEYPAD == IRIVER_H300_PAD)
+/* those do no have much in PLA */
+#if CONFIG_KEYPAD == MROBE500_PAD /* or does the touchscreen works on this? */
# define LAMP_LEFT BUTTON_LEFT
# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_SCROLL_FWD
-# define LAMP_DOWN BUTTON_SCROLL_BACK
-
-#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
- (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
- (CONFIG_KEYPAD == SANSA_FUZE_PAD) || \
- (CONFIG_KEYPAD == SANSA_CONNECT_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_SCROLL_FWD
-# define LAMP_DOWN BUTTON_SCROLL_BACK
-
-#elif (CONFIG_KEYPAD == SANSA_C200_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_NEXT BUTTON_SCROLL_UP
-# define LAMP_PREV BUTTON_SCROLL_DOWN
-
-#elif CONFIG_KEYPAD == MROBE500_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-
+#elif CONFIG_KEYPAD == ONDAVX777_PAD
#elif CONFIG_KEYPAD == COWON_D2_PAD
-
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-
-#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
-# define LAMP_LEFT BUTTON_PREV
-# define LAMP_RIGHT BUTTON_NEXT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
+/* those need other keymaps than PLA */
#elif CONFIG_KEYPAD == ONDAVX747_PAD
# define LAMP_LEFT BUTTON_VOL_DOWN
# define LAMP_RIGHT BUTTON_VOL_UP
+#endif /* weird devices */
+/* we use PLA */
+#ifdef HAVE_SCROLLWHEEL
+# define LAMP_LEFT PLA_LEFT
+# define LAMP_RIGHT PLA_RIGHT
+# define LAMP_UP PLA_SCROLL_FWD
+# define LAMP_DOWN PLA_SCROLL_BACK
+#else
+# define LAMP_LEFT PLA_LEFT
+# define LAMP_RIGHT PLA_RIGHT
+# define LAMP_UP PLA_UP
+# define LAMP_DOWN PLA_DOWN
+#endif/* HAVE_SCROLLWHEEL */
-#elif CONFIG_KEYPAD == ONDAVX777_PAD
-
-#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-
-#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
-# define LAMP_LEFT BUTTON_PREV
-# define LAMP_RIGHT BUTTON_NEXT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == MPIO_HD200_PAD
-# define LAMP_UP BUTTON_REW
-# define LAMP_DOWN BUTTON_FF
-
-#elif CONFIG_KEYPAD == MPIO_HD300_PAD
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == SANSA_CLIP_PAD
-# define LAMP_LEFT BUTTON_LEFT
-# define LAMP_RIGHT BUTTON_RIGHT
-# define LAMP_UP BUTTON_UP
-# define LAMP_DOWN BUTTON_DOWN
-
#else
# error Missing key definitions for this keypad
-#endif
#endif /* HAVE_LCD_COLOR || HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_TOUCHSCREEN
# ifndef LAMP_LEFT
-# define LAMP_LEFT BUTTON_MIDLEFT
+# define LAMP_LEFT PLA_LEFT
# endif
# ifndef LAMP_RIGHT
-# define LAMP_RIGHT BUTTON_MIDRIGHT
+# define LAMP_RIGHT PLA_RIGHT
# endif
# ifndef LAMP_UP
-# define LAMP_UP BUTTON_TOPMIDDLE
+# define LAMP_UP PLA_UP
# endif
# ifndef LAMP_DOWN
-# define LAMP_DOWN BUTTON_BOTTOMMIDDLE
+# define LAMP_DOWN PLA_DOWN
# endif
#endif
@@ -220,6 +129,7 @@
rb->lcd_clear_display();
rb->lcd_update();
+const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
do
{
#ifdef HAVE_LCD_COLOR
@@ -235,8 +145,13 @@
update = false;
}
#endif /* HAVE_LCD_COLOR */
+ button = pluginlib_getaction(HZ*30, plugin_contexts,
+ ARRAYLEN(plugin_contexts));
- switch((button = rb->button_get_w_tmo(HZ*30)))
+ if(button == BUTTON_NONE)
+ button = (rb->button_get_w_tmo(HZ*30));
+
+ switch(button)
{
#ifdef HAVE_LCD_COLOR
case LAMP_RIGHT:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.