public
Created

Diff1

  • Download Gist
lampPLA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
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:

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.