2008-04-23 21:15:07 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// __ \_/ ___\| |/ /| __ \ / __ \ \/ /
|
|
|
|
* Jukebox | | ( (__) ) \___| ( | \_\ ( (__) ) (
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Vuong Minh Hiep (vmh)
|
|
|
|
* Copyright (C) 2008 Thomas Martitz (kugel.)
|
|
|
|
* Copyright (C) 2008 Alexander Papst
|
2008-05-07 21:59:45 +00:00
|
|
|
* Copyright (C) 2008 Peter D'Hoye
|
2008-04-23 21:15:07 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2008-04-23 21:15:07 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "plugin.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/helper.h"
|
2008-04-23 21:15:07 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
/* variable button definitions - only targets with a colour display */
|
|
|
|
#if defined(HAVE_LCD_COLOR)
|
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
|
|
|
# define LAMP_NEXT BUTTON_SCROLL_FWD
|
|
|
|
# define LAMP_PREV BUTTON_SCROLL_BACK
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
2008-04-23 21:15:07 +00:00
|
|
|
|
2009-01-04 23:33:15 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
|
|
|
# define LAMP_NEXT BUTTON_SCROLL_FWD
|
|
|
|
# define LAMP_PREV BUTTON_SCROLL_BACK
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == SANSA_C200_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
|
|
|
# define LAMP_NEXT BUTTON_SCROLL_UP
|
|
|
|
# define LAMP_PREV BUTTON_SCROLL_DOWN
|
2008-04-23 21:15:07 +00:00
|
|
|
|
2008-04-23 21:43:18 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
2008-05-07 21:59:45 +00:00
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
2008-04-23 21:43:18 +00:00
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-04-23 21:43:18 +00:00
|
|
|
|
2008-10-07 16:38:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
|
|
|
|
2009-12-02 01:56:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
# define LAMP_LEFT BUTTON_PREV
|
|
|
|
# define LAMP_RIGHT BUTTON_NEXT
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
# define LAMP_LEFT BUTTON_VOL_DOWN
|
|
|
|
# define LAMP_RIGHT BUTTON_VOL_UP
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
# define LAMP_LEFT BUTTON_LEFT
|
|
|
|
# define LAMP_RIGHT BUTTON_RIGHT
|
|
|
|
|
2010-02-11 22:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
# define LAMP_LEFT BUTTON_PREV
|
|
|
|
# define LAMP_RIGHT BUTTON_NEXT
|
|
|
|
|
2008-04-23 21:15:07 +00:00
|
|
|
#else
|
|
|
|
# error Missing key definitions for this keypad
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-05-07 21:59:45 +00:00
|
|
|
# ifndef LAMP_LEFT
|
|
|
|
# define LAMP_LEFT BUTTON_MIDLEFT
|
2008-04-27 15:30:19 +00:00
|
|
|
# endif
|
2008-05-07 21:59:45 +00:00
|
|
|
# ifndef LAMP_RIGHT
|
|
|
|
# define LAMP_RIGHT BUTTON_MIDRIGHT
|
2008-04-27 15:30:19 +00:00
|
|
|
# endif
|
2008-05-07 21:59:45 +00:00
|
|
|
# ifndef LAMP_NEXT
|
|
|
|
# define LAMP_NEXT BUTTON_TOPMIDDLE
|
2008-04-27 15:30:19 +00:00
|
|
|
# endif
|
2008-05-07 21:59:45 +00:00
|
|
|
# ifndef LAMP_PREV
|
|
|
|
# define LAMP_PREV BUTTON_BOTTOMMIDDLE
|
2008-04-27 15:30:19 +00:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2008-04-23 21:15:07 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2008-04-24 00:06:45 +00:00
|
|
|
/* RGB color sets */
|
|
|
|
#define NUM_COLORSETS 2
|
|
|
|
static int colorset[NUM_COLORSETS][3] = { { 255, 255, 255 } , /* white */
|
|
|
|
{ 255, 0, 0 } }; /* red */
|
|
|
|
#endif /* HAVE_LCD_COLOR */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
/* this is the plugin entry point */
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2008-04-23 21:15:07 +00:00
|
|
|
{
|
2009-01-03 13:27:19 +00:00
|
|
|
long button;
|
2008-04-23 21:15:07 +00:00
|
|
|
(void)parameter;
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2008-04-24 00:06:45 +00:00
|
|
|
int cs = 0;
|
2008-04-23 21:15:07 +00:00
|
|
|
bool quit = false;
|
|
|
|
#endif /* HAVE_LCD_COLOR */
|
|
|
|
|
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
short old_brightness = rb->global_settings->brightness;
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
2008-05-08 21:23:31 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
short old_buttonlight_brightness =
|
|
|
|
rb->global_settings->buttonlight_brightness;
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
unsigned bg_color=rb->lcd_get_background();
|
2008-04-24 00:06:45 +00:00
|
|
|
rb->lcd_set_backdrop(NULL);
|
2008-04-23 21:15:07 +00:00
|
|
|
rb->lcd_set_background(LCD_WHITE);
|
|
|
|
#endif
|
2008-04-24 00:06:45 +00:00
|
|
|
|
2008-04-23 21:15:07 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
rb->backlight_set_brightness(MAX_BRIGHTNESS_SETTING);
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
2008-05-08 21:23:31 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
rb->buttonlight_set_brightness(MAX_BRIGHTNESS_SETTING);
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
2008-04-24 00:06:45 +00:00
|
|
|
#ifdef HAVE_LCD_INVERT
|
2010-03-15 15:28:38 +00:00
|
|
|
#ifdef HAVE_NEGATIVE_LCD
|
2008-04-24 00:21:08 +00:00
|
|
|
rb->lcd_set_invert_display(true);
|
2008-04-24 00:06:45 +00:00
|
|
|
#else
|
2008-04-24 00:21:08 +00:00
|
|
|
rb->lcd_set_invert_display(false);
|
2010-03-15 15:28:38 +00:00
|
|
|
#endif /* HAVE_NEGATIVE_LCD */
|
2008-04-24 00:06:45 +00:00
|
|
|
#endif /* HAVE_LCD_INVERT */
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_force_on();
|
2008-05-08 21:23:31 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2009-01-16 10:34:40 +00:00
|
|
|
buttonlight_force_on();
|
2008-05-08 21:23:31 +00:00
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2008-05-08 21:23:31 +00:00
|
|
|
do
|
2008-04-23 21:15:07 +00:00
|
|
|
{
|
2008-05-03 14:55:34 +00:00
|
|
|
if(cs < 0)
|
|
|
|
cs = NUM_COLORSETS-1;
|
|
|
|
if(cs >= NUM_COLORSETS)
|
2008-04-24 00:06:45 +00:00
|
|
|
cs = 0;
|
|
|
|
rb->lcd_set_background( LCD_RGBPACK( colorset[cs][0],
|
|
|
|
colorset[cs][1],
|
|
|
|
colorset[cs][2] ) );
|
2008-04-23 21:15:07 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->lcd_update();
|
|
|
|
|
2009-01-03 13:27:19 +00:00
|
|
|
switch((button = rb->button_get(true)))
|
2008-04-23 21:15:07 +00:00
|
|
|
{
|
2008-05-07 21:59:45 +00:00
|
|
|
case LAMP_RIGHT:
|
|
|
|
#ifdef LAMP_NEXT
|
|
|
|
case LAMP_NEXT:
|
|
|
|
#endif /* LAMP_NEXT */
|
2008-04-24 00:06:45 +00:00
|
|
|
cs++;
|
2008-04-23 21:15:07 +00:00
|
|
|
break;
|
2008-04-24 00:06:45 +00:00
|
|
|
|
2008-05-07 21:59:45 +00:00
|
|
|
case LAMP_LEFT:
|
|
|
|
#ifdef LAMP_PREV
|
|
|
|
case LAMP_PREV:
|
|
|
|
#endif /* LAMP_PREV */
|
2008-04-24 00:06:45 +00:00
|
|
|
cs--;
|
|
|
|
break;
|
|
|
|
|
2008-05-07 21:59:45 +00:00
|
|
|
case (LAMP_RIGHT|BUTTON_REPEAT):
|
|
|
|
case (LAMP_RIGHT|BUTTON_REL):
|
|
|
|
case (LAMP_LEFT|BUTTON_REPEAT):
|
|
|
|
case (LAMP_LEFT|BUTTON_REL):
|
|
|
|
#ifdef LAMP_NEXT
|
|
|
|
case (LAMP_NEXT|BUTTON_REPEAT):
|
|
|
|
case (LAMP_NEXT|BUTTON_REL):
|
|
|
|
#endif /* LAMP_NEXT */
|
|
|
|
#ifdef LAMP_PREV
|
|
|
|
case (LAMP_PREV|BUTTON_REPEAT):
|
|
|
|
case (LAMP_PREV|BUTTON_REL):
|
|
|
|
#endif /* LAMP_PREV */
|
2008-04-24 00:06:45 +00:00
|
|
|
/* eat these... */
|
2009-01-03 13:27:19 +00:00
|
|
|
break;
|
2008-04-23 21:15:07 +00:00
|
|
|
default:
|
2009-01-03 13:27:19 +00:00
|
|
|
quit = true;
|
2008-04-23 21:15:07 +00:00
|
|
|
}
|
|
|
|
} while (!quit);
|
|
|
|
|
|
|
|
#else /* HAVE_LCD_COLOR */
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->lcd_update();
|
|
|
|
/* wait */
|
2009-01-03 14:00:23 +00:00
|
|
|
do
|
2008-04-23 21:15:07 +00:00
|
|
|
{
|
2009-01-03 14:00:23 +00:00
|
|
|
button = rb->button_get(false);
|
|
|
|
if (button && !IS_SYSEVENT(button))
|
|
|
|
break;
|
2008-04-23 21:15:07 +00:00
|
|
|
rb->yield();
|
2009-01-03 14:00:23 +00:00
|
|
|
} while (1);
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#endif /*HAVE_LCD_COLOR */
|
|
|
|
|
|
|
|
/* restore */
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_use_settings();
|
2008-05-08 21:23:31 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2009-01-16 10:34:40 +00:00
|
|
|
buttonlight_use_settings();
|
2008-05-08 21:23:31 +00:00
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
2008-04-24 00:06:45 +00:00
|
|
|
#ifdef HAVE_LCD_INVERT
|
2008-04-24 00:21:08 +00:00
|
|
|
rb->lcd_set_invert_display(rb->global_settings->invert);
|
2008-04-24 00:06:45 +00:00
|
|
|
#endif /* HAVE_LCD_INVERT */
|
|
|
|
|
2008-04-23 21:15:07 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
rb->backlight_set_brightness(old_brightness);
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
2008-05-08 21:23:31 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
rb->buttonlight_set_brightness(old_buttonlight_brightness);
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
rb->lcd_set_background(bg_color);
|
|
|
|
#endif
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2009-03-28 16:59:31 +00:00
|
|
|
|