2004-05-19 08:21:30 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-01-04 23:42:38 +00:00
|
|
|
* Greyscale demo plugin
|
2004-05-19 08:21:30 +00:00
|
|
|
*
|
2008-01-04 23:42:38 +00:00
|
|
|
* Copyright (C) 2004-2008 Jens Arnold
|
2004-05-19 08:21:30 +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.
|
2004-05-19 08:21:30 +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"
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2006-08-07 01:46:42 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/grey.h"
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2004-10-12 22:49:51 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_ON
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_OFF
|
2006-02-05 19:27:23 +00:00
|
|
|
|
2004-10-12 22:49:51 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_MENU
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_OFF
|
2006-02-05 19:27:23 +00:00
|
|
|
|
2005-07-28 09:15:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_ON
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_OFF
|
2006-02-05 19:27:23 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GREYSCALE_RC_OFF BUTTON_RC_STOP
|
2006-06-30 16:43:47 +00:00
|
|
|
|
2008-04-07 22:09:14 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || (CONFIG_KEYPAD == MROBE100_PAD)
|
2008-01-13 12:30:11 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_PLAY /* won't work, but define it anyway */
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_POWER
|
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_SELECT
|
|
|
|
#define GREYSCALE_UP BUTTON_SCROLL_BACK
|
|
|
|
#define GREYSCALE_DOWN BUTTON_SCROLL_FWD
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_MENU
|
2007-09-22 23:37:58 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_PLAY
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_EQ
|
2008-03-25 23:21:36 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define GREYSCALE_SHIFT BUTTON_RC_PLAY /* somewhat dangerous... */
|
|
|
|
#define GREYSCALE_UP BUTTON_RC_VOL_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_RC_REW
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RC_FF
|
|
|
|
#define GREYSCALE_OFF BUTTON_RC_REC
|
|
|
|
|
|
|
|
#define GREYSCALE_RC_OFF BUTTON_REC
|
|
|
|
|
2009-01-24 10:41:42 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CLIP_PAD
|
|
|
|
#define GREYSCALE_SHIFT BUTTON_SELECT
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_POWER
|
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2009-08-04 03:08:32 +00:00
|
|
|
#define GREYSCALE_SHIFT BUTTON_FFWD
|
|
|
|
#define GREYSCALE_UP BUTTON_UP
|
|
|
|
#define GREYSCALE_DOWN BUTTON_DOWN
|
|
|
|
#define GREYSCALE_LEFT BUTTON_LEFT
|
|
|
|
#define GREYSCALE_RIGHT BUTTON_RIGHT
|
|
|
|
#define GREYSCALE_OFF BUTTON_PLAY
|
|
|
|
|
2005-07-28 09:15:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GFX_HEIGHT (LCD_HEIGHT-8)
|
|
|
|
#if LCD_WIDTH < 160
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GFX_GREYTONE_WIDTH 86
|
|
|
|
#define GFX_GREYTONE_STEP 3
|
2005-07-28 09:15:00 +00:00
|
|
|
#else
|
2008-01-04 23:42:38 +00:00
|
|
|
#define GFX_GREYTONE_WIDTH 128
|
|
|
|
#define GFX_GREYTONE_STEP 2
|
2004-10-12 22:49:51 +00:00
|
|
|
#endif
|
2004-05-19 08:21:30 +00:00
|
|
|
/******************************* Globals ***********************************/
|
|
|
|
|
2008-01-13 00:11:43 +00:00
|
|
|
GREY_INFO_STRUCT
|
2004-05-19 08:21:30 +00:00
|
|
|
static unsigned char *gbuf;
|
2007-04-21 18:38:25 +00:00
|
|
|
static size_t gbuf_size = 0;
|
2004-05-19 08:21:30 +00:00
|
|
|
|
|
|
|
/**************************** main function ********************************/
|
|
|
|
|
2004-10-12 22:49:51 +00:00
|
|
|
void cleanup(void *parameter)
|
|
|
|
{
|
|
|
|
(void)parameter;
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_release(); /* switch off overlay and deinitialize */
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn on backlight timeout (revert to settings) */
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_use_settings();
|
2004-10-12 22:49:51 +00:00
|
|
|
}
|
|
|
|
|
2004-05-19 08:21:30 +00:00
|
|
|
/* this is only a demo of what the framework can do */
|
|
|
|
int main(void)
|
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
int time;
|
2004-05-19 08:21:30 +00:00
|
|
|
int x, y, i;
|
|
|
|
int button, scroll_amount;
|
2005-07-25 20:50:34 +00:00
|
|
|
bool black_border = false;
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2004-08-03 20:57:06 +00:00
|
|
|
static const unsigned char rockbox[] = {
|
2004-05-19 08:21:30 +00:00
|
|
|
/* ...........................................
|
|
|
|
* .####...###...###..#...#.####...###..#...#.
|
|
|
|
* .#...#.#...#.#...#.#..#..#...#.#...#..#.#..
|
|
|
|
* .####..#...#.#.....###...####..#...#...#...
|
|
|
|
* .#..#..#...#.#...#.#..#..#...#.#...#..#.#..
|
|
|
|
* .#...#..###...###..#...#.####...###..#...#.
|
|
|
|
* ...........................................
|
|
|
|
* 43 x 7 pixel, 1 bpp
|
|
|
|
*/
|
|
|
|
0x00, 0x3E, 0x0A, 0x0A, 0x1A, 0x24, 0x00, 0x1C, 0x22, 0x22,
|
|
|
|
0x22, 0x1C, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x14, 0x00, 0x3E,
|
|
|
|
0x08, 0x08, 0x14, 0x22, 0x00, 0x3E, 0x2A, 0x2A, 0x2A, 0x14,
|
|
|
|
0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x22, 0x14, 0x08,
|
|
|
|
0x14, 0x22, 0x00
|
|
|
|
};
|
|
|
|
|
2004-08-03 20:57:06 +00:00
|
|
|
static const unsigned char showing[] = {
|
2004-05-19 08:21:30 +00:00
|
|
|
/* .......................................
|
|
|
|
* ..####.#...#..###..#...#.#.#...#..####.
|
|
|
|
* .#.....#...#.#...#.#...#.#.##..#.#.....
|
|
|
|
* ..###..#####.#...#.#.#.#.#.#.#.#.#..##.
|
|
|
|
* .....#.#...#.#...#.#.#.#.#.#..##.#...#.
|
|
|
|
* .####..#...#..###...#.#..#.#...#..####.
|
|
|
|
* .......................................
|
|
|
|
* 39 x 7 pixel, 1 bpp
|
|
|
|
*/
|
|
|
|
0x00, 0x24, 0x2A, 0x2A, 0x2A, 0x12, 0x00, 0x3E, 0x08, 0x08,
|
|
|
|
0x08, 0x3E, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x1E,
|
|
|
|
0x20, 0x18, 0x20, 0x1E, 0x00, 0x3E, 0x00, 0x3E, 0x04, 0x08,
|
|
|
|
0x10, 0x3E, 0x00, 0x1C, 0x22, 0x22, 0x2A, 0x3A, 0x00
|
|
|
|
};
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
static const unsigned char grayscale_grey[] = {
|
2004-05-19 08:21:30 +00:00
|
|
|
/* .......................................................
|
|
|
|
* ..####.####...###..#...#..####..###...###..#.....#####.
|
|
|
|
* .#.....#...#.#...#.#...#.#.....#...#.#...#.#.....#.....
|
|
|
|
* .#..##.####..#####..#.#...###..#.....#####.#.....####..
|
|
|
|
* .#...#.#..#..#...#...#.......#.#...#.#...#.#.....#.....
|
|
|
|
* ..####.#...#.#...#...#...####...###..#...#.#####.#####.
|
|
|
|
* .......................................................
|
|
|
|
* 55 x 7 pixel, 8 bpp
|
|
|
|
*/
|
|
|
|
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
|
|
|
|
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
|
|
|
|
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
|
|
|
|
110,110,110,110,110,110,110,
|
|
|
|
120,120, 20, 20, 20, 20,120,222,222,222,222,120,120,120, 24, 24,
|
|
|
|
24,120,120,226,120,120,120,226,120,120, 28, 28, 28, 28,120,120,
|
|
|
|
230,230,230,120,120,120, 32, 32, 32,120,120,234,120,120,120,120,
|
|
|
|
120, 36, 36, 36, 36, 36,120,
|
|
|
|
130, 20,130,130,130,130,130,222,130,130,130,222,130, 24,130,130,
|
|
|
|
130, 24,130,226,130,130,130,226,130, 28,130,130,130,130,130,230,
|
|
|
|
130,130,130,230,130, 32,130,130,130, 32,130,234,130,130,130,130,
|
|
|
|
130, 36,130,130,130,130,130,
|
|
|
|
140, 20,140,140, 20, 20,140,222,222,222,222,140,140, 24, 24, 24,
|
|
|
|
24, 24,140,140,226,140,226,140,140,140, 28, 28, 28,140,140,230,
|
|
|
|
140,140,140,140,140, 32, 32, 32, 32, 32,140,234,140,140,140,140,
|
|
|
|
140, 36, 36, 36, 36,140,140,
|
|
|
|
130, 20,130,130,130, 20,130,222,130,130,222,130,130, 24,130,130,
|
|
|
|
130, 24,130,130,130,226,130,130,130,130,130,130,130, 28,130,230,
|
|
|
|
130,130,130,230,130, 32,130,130,130, 32,130,234,130,130,130,130,
|
|
|
|
130, 36,130,130,130,130,130,
|
|
|
|
120,120, 20, 20, 20, 20,120,222,120,120,120,222,120, 24,120,120,
|
|
|
|
120, 24,120,120,120,226,120,120,120, 28, 28, 28, 28,120,120,120,
|
|
|
|
230,230,230,120,120, 32,120,120,120, 32,120,234,234,234,234,234,
|
|
|
|
120, 36, 36, 36, 36, 36,120,
|
|
|
|
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
|
|
|
|
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
|
|
|
|
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
|
|
|
|
110,110,110,110,110,110,110
|
|
|
|
};
|
|
|
|
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn off backlight timeout */
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_ignore_timeout();
|
2004-05-19 08:21:30 +00:00
|
|
|
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED); /* select default font */
|
|
|
|
|
|
|
|
/* get the remainder of the plugin buffer */
|
|
|
|
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
|
|
|
|
|
2005-07-25 20:50:34 +00:00
|
|
|
/* initialize the greyscale buffer:
|
2008-01-04 23:42:38 +00:00
|
|
|
Archos: 112 pixels wide, 7 rows (56 pixels) high.
|
|
|
|
H1x0: 160 pixels wide, 30 rows (120 pixels) high. */
|
2009-01-16 10:34:40 +00:00
|
|
|
if (!grey_init(gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP,
|
2008-03-02 23:31:09 +00:00
|
|
|
LCD_WIDTH, GFX_HEIGHT, NULL))
|
2008-01-04 23:42:38 +00:00
|
|
|
{
|
|
|
|
rb->splash(HZ, "Not enough memory.");
|
|
|
|
return PLUGIN_ERROR;
|
|
|
|
}
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2005-07-25 20:50:34 +00:00
|
|
|
/* place greyscale overlay 1 row down */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_position(0, 8);
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
rb->lcd_puts(0, 0, "Shades: 129");
|
2004-05-19 08:21:30 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
|
2006-04-09 15:00:30 +00:00
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2005-10-03 09:24:36 +00:00
|
|
|
rb->cpu_boost(true);
|
|
|
|
#endif
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_show(true); /* switch on greyscale overlay */
|
2004-05-19 08:21:30 +00:00
|
|
|
|
|
|
|
time = *rb->current_tick; /* start time measurement */
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_background(150);
|
|
|
|
grey_clear_display(); /* fill everything with grey 150 */
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2005-07-25 20:50:34 +00:00
|
|
|
/* draw a dark grey line star background */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_foreground(80);
|
2005-07-28 09:15:00 +00:00
|
|
|
for (y = 0; y < GFX_HEIGHT; y += 8) /* horizontal part */
|
2004-05-19 08:21:30 +00:00
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_drawline(0, y, (LCD_WIDTH-1), (GFX_HEIGHT-1) - y); /*grey lines */
|
2004-05-19 08:21:30 +00:00
|
|
|
}
|
2005-07-28 09:15:00 +00:00
|
|
|
for (x = 10; x <= LCD_WIDTH; x += 10) /* vertical part */
|
2004-05-19 08:21:30 +00:00
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_drawline(x, 0, (LCD_WIDTH-1) - x, (GFX_HEIGHT-1)); /*grey lines */
|
2004-05-19 08:21:30 +00:00
|
|
|
}
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_foreground(0);
|
|
|
|
grey_drawrect(0, 0, LCD_WIDTH, GFX_HEIGHT); /* black border */
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2005-07-25 20:50:34 +00:00
|
|
|
/* draw grey tones */
|
2008-01-04 23:42:38 +00:00
|
|
|
for (i = 0; i < GFX_GREYTONE_WIDTH; i++)
|
2004-05-19 08:21:30 +00:00
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
x = ((LCD_WIDTH-GFX_GREYTONE_WIDTH)/2) + i;
|
|
|
|
grey_set_foreground(GFX_GREYTONE_STEP * i);
|
2005-07-28 09:15:00 +00:00
|
|
|
/* vertical lines */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_vline(x, (GFX_HEIGHT/8), (GFX_HEIGHT-GFX_HEIGHT/8-1));
|
2004-05-19 08:21:30 +00:00
|
|
|
}
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_drawmode(DRMODE_COMPLEMENT);
|
2005-07-28 09:15:00 +00:00
|
|
|
/* invert rectangle (lower half) */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_fillrect((LCD_WIDTH-GFX_GREYTONE_WIDTH)/2, (GFX_HEIGHT/2+1),
|
|
|
|
GFX_GREYTONE_WIDTH, (GFX_HEIGHT/2-GFX_HEIGHT/8-1));
|
2005-07-28 09:15:00 +00:00
|
|
|
/* invert a line */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_hline((LCD_WIDTH-GFX_GREYTONE_WIDTH)/2,
|
|
|
|
(LCD_WIDTH+GFX_GREYTONE_WIDTH)/2, (GFX_HEIGHT/2-1));
|
2004-06-02 23:54:18 +00:00
|
|
|
|
2004-05-19 08:21:30 +00:00
|
|
|
/* show bitmaps (1 bit and 8 bit) */
|
2005-07-28 09:15:00 +00:00
|
|
|
/* opaque */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_drawinfo(DRMODE_SOLID, 255, 100);
|
|
|
|
grey_mono_bitmap(rockbox,
|
|
|
|
MAX((LCD_WIDTH/2-47), ((LCD_WIDTH-GFX_GREYTONE_WIDTH)/2)),
|
2005-07-28 09:15:00 +00:00
|
|
|
(5*GFX_HEIGHT/16-4), 43, 7);
|
|
|
|
/* transparent */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_drawinfo(DRMODE_FG, 0, 100);
|
|
|
|
grey_mono_bitmap(showing, (LCD_WIDTH/2+4) , (5*GFX_HEIGHT/16-4), 39, 7);
|
2005-07-28 09:15:00 +00:00
|
|
|
/* greyscale */
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_gray_bitmap(grayscale_grey, ((LCD_WIDTH-55)/2), (11*GFX_HEIGHT/16-4),
|
2005-07-28 09:15:00 +00:00
|
|
|
55, 7);
|
2004-06-02 23:54:18 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_update();
|
2004-05-19 08:21:30 +00:00
|
|
|
|
|
|
|
time = *rb->current_tick - time; /* end time measurement */
|
|
|
|
|
2010-08-28 21:46:45 +00:00
|
|
|
rb->lcd_putsf(0, 0, "Shades: 129, %d.%02ds", time / 100, time % 100);
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_deferred_lcd_update(); /* schedule an lcd_update() */
|
2006-04-09 15:00:30 +00:00
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2005-10-03 09:24:36 +00:00
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
2004-05-19 08:21:30 +00:00
|
|
|
|
|
|
|
/* drawing is now finished, play around with scrolling
|
|
|
|
* until you press OFF or connect USB
|
|
|
|
*/
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_background(255);
|
2004-05-19 08:21:30 +00:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
scroll_amount = 1;
|
|
|
|
|
|
|
|
button = rb->button_get(true);
|
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
exit_on_usb(button);
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
if (button & GREYSCALE_SHIFT)
|
2005-07-25 20:50:34 +00:00
|
|
|
{
|
|
|
|
if (!black_border)
|
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_background(0);
|
2005-07-25 20:50:34 +00:00
|
|
|
black_border = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (black_border)
|
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_set_background(255);
|
2005-07-25 20:50:34 +00:00
|
|
|
black_border = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-19 08:21:30 +00:00
|
|
|
if (button & BUTTON_REPEAT)
|
|
|
|
scroll_amount = 4;
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
switch (button & ~(GREYSCALE_SHIFT | BUTTON_REPEAT))
|
2004-05-19 08:21:30 +00:00
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
case GREYSCALE_LEFT:
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_scroll_left(scroll_amount); /* scroll left */
|
|
|
|
grey_update();
|
2004-05-19 08:21:30 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
case GREYSCALE_RIGHT:
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_scroll_right(scroll_amount); /* scroll right */
|
|
|
|
grey_update();
|
2004-05-19 08:21:30 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
case GREYSCALE_UP:
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_scroll_up(scroll_amount); /* scroll up */
|
|
|
|
grey_update();
|
2004-05-19 08:21:30 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
case GREYSCALE_DOWN:
|
2004-05-19 08:21:30 +00:00
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_scroll_down(scroll_amount); /* scroll down */
|
|
|
|
grey_update();
|
2004-05-19 08:21:30 +00:00
|
|
|
break;
|
2008-01-04 23:42:38 +00:00
|
|
|
#ifdef GREYSCALE_RC_OFF
|
|
|
|
case GREYSCALE_RC_OFF:
|
2006-06-30 16:43:47 +00:00
|
|
|
#endif
|
2008-01-04 23:42:38 +00:00
|
|
|
case GREYSCALE_OFF:
|
2004-05-19 08:21:30 +00:00
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************** Plugin entry point ****************************/
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2004-05-19 08:21:30 +00:00
|
|
|
{
|
|
|
|
(void)parameter;
|
2004-06-02 23:54:18 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
atexit(cleanup);
|
2004-10-12 22:49:51 +00:00
|
|
|
return main();
|
2004-05-19 08:21:30 +00:00
|
|
|
}
|
|
|
|
|
2006-03-03 08:14:44 +00:00
|
|
|
#endif /* #ifdef HAVE_LCD_BITMAP */
|
2004-05-19 08:21:30 +00:00
|
|
|
|