LAMP plugin PLA integration (main code + manual)

1) this patch replace all keymaps with PLA ones. It also clean some optionnal
 compiling that are not needed anymore througt PLA
2) the patch also made required change to the manual in order to match code's
 change.

Change-Id: I54ec953f79a419a6bb2f78877ca8b82f572fb510
Reviewed-on: http://gerrit.rockbox.org/86
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Tested-by: Thomas Martitz <kugel@rockbox.org>
This commit is contained in:
Jean-Louis Biasini 2012-02-06 13:29:53 +01:00 committed by Thomas Martitz
parent 51912c840c
commit a869d4a9ac
2 changed files with 37 additions and 162 deletions

View file

@ -24,6 +24,10 @@
#include "plugin.h"
#include "lib/helper.h"
#include "lib/pluginlib_actions.h"
/* this set the context to use with PLA */
static const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
/* variable button definitions.
- only targets with a colour display
@ -33,140 +37,31 @@
LAMP_UP / LAMP_DOWN: change the brightness
*/
#if defined(HAVE_LCD_COLOR) || defined(HAVE_BACKLIGHT_BRIGHTNESS)
#if (CONFIG_KEYPAD == IRIVER_H300_PAD)
# 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 == 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
#elif CONFIG_KEYPAD == ONDAVX747_PAD
# define LAMP_LEFT BUTTON_VOL_DOWN
# define LAMP_RIGHT BUTTON_VOL_UP
#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
/* 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
# define LAMP_UP_REPEAT PLA_SCROLL_FWD_REPEAT
# define LAMP_DOWN_REPEAT PLA_SCROLL_BACK_REPEAT
#else
# define LAMP_LEFT PLA_LEFT
# define LAMP_RIGHT PLA_RIGHT
# define LAMP_UP PLA_UP
# define LAMP_DOWN PLA_DOWN
# define LAMP_UP_REPEAT PLA_UP_REPEAT
# define LAMP_DOWN_REPEAT PLA_DOWN_REPEAT
#endif/* HAVE_SCROLLWHEEL */
#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
# endif
# ifndef LAMP_RIGHT
# define LAMP_RIGHT BUTTON_MIDRIGHT
# endif
# ifndef LAMP_UP
# define LAMP_UP BUTTON_TOPMIDDLE
# endif
# ifndef LAMP_DOWN
# define LAMP_DOWN BUTTON_BOTTOMMIDDLE
# endif
#endif
#define LAMP_EXIT PLA_EXIT
#define LAMP_EXIT2 PLA_CANCEL
#ifdef HAVE_LCD_COLOR
/* RGB color sets */
@ -235,8 +130,10 @@ enum plugin_status plugin_start(const void* parameter)
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)))
switch(button)
{
#ifdef HAVE_LCD_COLOR
case LAMP_RIGHT:
@ -258,31 +155,30 @@ enum plugin_status plugin_start(const void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
case LAMP_UP:
case (LAMP_UP|BUTTON_REPEAT):
case (LAMP_UP_REPEAT):
if (current_brightness < MAX_BRIGHTNESS_SETTING)
backlight_brightness_set(++current_brightness);
break;
case LAMP_DOWN:
case (LAMP_DOWN|BUTTON_REPEAT):
case (LAMP_DOWN_REPEAT):
if (current_brightness > MIN_BRIGHTNESS_SETTING)
backlight_brightness_set(--current_brightness);
break;
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
case LAMP_EXIT:
case LAMP_EXIT2:
quit = true;
break;
case BUTTON_NONE:
/* time out */
break;
default:
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
{
status = PLUGIN_USB_CONNECTED;
quit = true;
}
if(!(button & (BUTTON_REL|BUTTON_REPEAT))
&& !IS_SYSEVENT(button))
quit = true;
break;
}
rb->reset_poweroff_timer();
} while (!quit);

View file

@ -4,43 +4,22 @@ Lamp is a simple plugin to use your player as a lamp (flashlight, torch).
You get an empty screen with maximum brightness.
\begin{btnmap}
\opt{lcd_color}{
\nopt{touchscreen}{\ButtonLeft{} / \ButtonRight}%
\opt{touchscreen}{\TouchMidLeft{} / \TouchMidRight}
\PluginLeft{} / \PluginRight
&
\opt{HAVEREMOTEKEYMAP}{
& }
Toggle between colours
\\
}
\opt{backlight_brightness}{
\nopt{IPOD_4G_PAD,SANSA_E200_PAD,SANSA_FUZE_PAD,MPIO_HD200_PAD,MPIO_HD300_PAD,touchscreen}
{\ButtonDown{} / \ButtonUp}%
\opt{IPOD_4G_PAD,SANSA_E200_PAD,SANSA_FUZE_PAD}{\ButtonScrollBack{} / \ButtonScrollFwd}
\opt{MPIO_HD200_PAD}{\ButtonRew / \ButtonFF}
\opt{MPIO_HD300_PAD}{\ButtonScrollDown / \ButtonScrollUp}
\opt{touchscreen}{\TouchBottomMiddle{} / \TouchTopMiddle}
\nopt{scrollwheel}{\PluginUp{} / \PluginDown}
\opt{scrollwheel}{\PluginScrollFwd{} / \PluginScrollBack}
&
\opt{HAVEREMOTEKEYMAP}{
& }
Change the brightness
\\
}
\opt{lcd_color,backlight_brightness}{
Any other key
&
\opt{HAVEREMOTEKEYMAP}{
& }
Quit
\\
}
\nopt{lcd_color,backlight_brightness}{
Any key
&
\opt{HAVEREMOTEKEYMAP}{
& }
Quit
\\
}
\PluginCancel{} or \PluginExit
& Exit to menu\\
\end{btnmap}