2002-06-15 13:29:03 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Daniel Stenberg
|
|
|
|
*
|
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.
|
2002-06-15 13:29:03 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
2003-06-29 16:33:04 +00:00
|
|
|
**************************************************************************/
|
|
|
|
#include "plugin.h"
|
2003-12-06 23:22:29 +00:00
|
|
|
#include "time.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/fixedpoint.h"
|
2002-06-15 13:29:03 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
PLUGIN_HEADER
|
|
|
|
|
2002-06-15 13:29:03 +00:00
|
|
|
#define SS_TITLE "Bouncer"
|
2002-10-29 10:45:29 +00:00
|
|
|
|
|
|
|
#define YSPEED 2
|
|
|
|
#define XSPEED 3
|
|
|
|
#define YADD -4
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2005-12-14 01:31:37 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
2004-10-17 00:54:09 +00:00
|
|
|
#define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define BOUNCE_MODE (BUTTON_ON | BUTTON_REL)
|
|
|
|
|
2007-01-14 13:48:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2007-01-14 13:48:09 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define BOUNCE_MODE (BUTTON_ON | BUTTON_REL)
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2005-12-14 01:31:37 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
2004-10-17 00:54:09 +00:00
|
|
|
#define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define BOUNCE_MODE (BUTTON_MENU | BUTTON_REL)
|
|
|
|
|
2005-06-29 12:47:24 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2005-12-14 01:31:37 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
2005-02-04 12:41:09 +00:00
|
|
|
#define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define BOUNCE_MODE (BUTTON_SELECT | BUTTON_REL)
|
2005-12-14 01:31:37 +00:00
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#define BOUNCE_RC_QUIT (BUTTON_RC_STOP | BUTTON_REL)
|
|
|
|
|
2006-02-24 20:54:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
2007-07-27 09:57:27 +00:00
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2005-12-14 01:31:37 +00:00
|
|
|
#define BOUNCE_UP BUTTON_SCROLL_BACK
|
|
|
|
#define BOUNCE_DOWN BUTTON_SCROLL_FWD
|
|
|
|
#define BOUNCE_QUIT (BUTTON_MENU | BUTTON_REL)
|
|
|
|
#define BOUNCE_MODE (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2006-01-19 12:44:46 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_PLAY
|
|
|
|
|
2006-02-24 15:42:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2006-02-24 15:42:52 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
2007-05-19 23:38:09 +00:00
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_A
|
2006-02-24 15:42:52 +00:00
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2008-01-10 08:08:31 +00:00
|
|
|
#define BOUNCE_UP BUTTON_SCROLL_BACK
|
|
|
|
#define BOUNCE_DOWN BUTTON_SCROLL_FWD
|
2006-10-26 13:38:09 +00:00
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_SELECT
|
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
|
|
|
#define BOUNCE_UP BUTTON_SCROLL_BACK
|
|
|
|
#define BOUNCE_DOWN BUTTON_SCROLL_FWD
|
|
|
|
#define BOUNCE_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
|
|
|
#define BOUNCE_MODE BUTTON_SELECT
|
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_C200_PAD || \
|
2009-01-04 23:33:15 +00:00
|
|
|
CONFIG_KEYPAD == SANSA_CLIP_PAD || \
|
|
|
|
CONFIG_KEYPAD == SANSA_M200_PAD
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2007-09-20 10:49:48 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_SELECT
|
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2006-08-03 20:17:25 +00:00
|
|
|
#define BOUNCE_UP BUTTON_SCROLL_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_SCROLL_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_PLAY
|
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2008-02-17 12:23:02 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_BACK
|
|
|
|
#define BOUNCE_MODE BUTTON_MENU
|
2008-03-01 22:55:09 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
2008-03-01 22:55:09 +00:00
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_DISPLAY
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define BOUNCE_LEFT BUTTON_RC_REW
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RC_FF
|
|
|
|
#define BOUNCE_UP BUTTON_RC_VOL_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_RC_REC
|
|
|
|
#define BOUNCE_MODE BUTTON_RC_MODE
|
|
|
|
|
2008-03-22 22:03:34 +00:00
|
|
|
#elif (CONFIG_KEYPAD == COWOND2_PAD)
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_MENU
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_BACK
|
|
|
|
#define BOUNCE_MODE BUTTON_MENU
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_MENU
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif (CONFIG_KEYPAD == ONDAVX747_PAD)
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
#define BOUNCE_MODE BUTTON_MENU
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif (CONFIG_KEYPAD == ONDAVX777_PAD)
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
|
2009-04-21 04:24:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
#define BOUNCE_QUIT BUTTON_POWER
|
|
|
|
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
#define BOUNCE_LEFT BUTTON_LEFT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_RIGHT
|
|
|
|
#define BOUNCE_UP BUTTON_UP
|
|
|
|
#define BOUNCE_DOWN BUTTON_DOWN
|
|
|
|
#define BOUNCE_QUIT BUTTON_FFWD
|
|
|
|
#define BOUNCE_MODE BUTTON_PLAY
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-10-17 00:54:09 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef BOUNCE_LEFT
|
|
|
|
#define BOUNCE_LEFT BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef BOUNCE_RIGHT
|
|
|
|
#define BOUNCE_RIGHT BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef BOUNCE_UP
|
|
|
|
#define BOUNCE_UP BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef BOUNCE_DOWN
|
|
|
|
#define BOUNCE_DOWN BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef BOUNCE_QUIT
|
|
|
|
#define BOUNCE_QUIT BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef BOUNCE_MODE
|
|
|
|
#define BOUNCE_MODE BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
#define LETTER_WIDTH 11
|
|
|
|
#define LETTER_HEIGHT 16
|
2005-07-14 11:55:55 +00:00
|
|
|
|
2002-09-13 06:32:25 +00:00
|
|
|
const unsigned char char_gen_12x16[][22] =
|
|
|
|
{
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
2004-05-14 22:55:05 +00:00
|
|
|
{ 0x00,0x00,0x00,0x7c,0xff,0xff,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x3c,0x3c,0x00,0x00,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x10,0x90,0xf0,0x7e,0x1e,0x90,0xf0,0x7e,0x1e,0x10,0x02,0x1e,0x1f,0x03,0x02,0x1e,0x1f,0x03,0x02,0x00,0x00 },
|
|
|
|
{ 0x00,0x78,0xfc,0xcc,0xff,0xff,0xcc,0xcc,0x88,0x00,0x00,0x00,0x04,0x0c,0x0c,0x3f,0x3f,0x0c,0x0f,0x07,0x00,0x00 },
|
|
|
|
{ 0x00,0x38,0x38,0x38,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x30,0x38,0x1c,0x0e,0x07,0x03,0x01,0x38,0x38,0x38,0x00 },
|
|
|
|
{ 0x00,0x00,0xb8,0xfc,0xc6,0xe2,0x3e,0x1c,0x00,0x00,0x00,0x00,0x1f,0x3f,0x31,0x21,0x37,0x1e,0x1c,0x36,0x22,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x27,0x3f,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0xf0,0xfc,0xfe,0x07,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x03,0x0f,0x1f,0x38,0x20,0x20,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x01,0x01,0x07,0xfe,0xfc,0xf0,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x38,0x1f,0x0f,0x03,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x98,0xb8,0xe0,0xf8,0xf8,0xe0,0xb8,0x98,0x00,0x00,0x00,0x0c,0x0e,0x03,0x0f,0x0f,0x03,0x0e,0x0c,0x00,0x00 },
|
|
|
|
{ 0x00,0x80,0x80,0x80,0xf0,0xf0,0x80,0x80,0x80,0x00,0x00,0x00,0x01,0x01,0x01,0x0f,0x0f,0x01,0x01,0x01,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0xf8,0x78,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x18,0x1c,0x0e,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0xf8,0xfe,0x06,0x03,0x83,0xc3,0x63,0x33,0x1e,0xfe,0xf8,0x07,0x1f,0x1e,0x33,0x31,0x30,0x30,0x30,0x18,0x1f,0x07 },
|
|
|
|
{ 0x00,0x00,0x0c,0x0c,0x0e,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x3f,0x3f,0x30,0x30,0x30,0x00 },
|
|
|
|
{ 0x1c,0x1e,0x07,0x03,0x03,0x83,0xc3,0xe3,0x77,0x3e,0x1c,0x30,0x38,0x3c,0x3e,0x37,0x33,0x31,0x30,0x30,0x30,0x30 },
|
|
|
|
{ 0x0c,0x0e,0x07,0xc3,0xc3,0xc3,0xc3,0xc3,0xe7,0x7e,0x3c,0x0c,0x1c,0x38,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0e },
|
|
|
|
{ 0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x07,0xff,0xff,0x00,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x3f,0x3f,0x03,0x03 },
|
|
|
|
{ 0x3f,0x7f,0x63,0x63,0x63,0x63,0x63,0x63,0xe3,0xc3,0x83,0x0c,0x1c,0x38,0x30,0x30,0x30,0x30,0x30,0x38,0x1f,0x0f },
|
|
|
|
{ 0xc0,0xf0,0xf8,0xdc,0xce,0xc7,0xc3,0xc3,0xc3,0x80,0x00,0x0f,0x1f,0x39,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f },
|
|
|
|
{ 0x03,0x03,0x03,0x03,0x03,0x03,0xc3,0xf3,0x3f,0x0f,0x03,0x00,0x00,0x00,0x30,0x3c,0x0f,0x03,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0xbc,0xfe,0xe7,0xc3,0xc3,0xc3,0xe7,0xfe,0xbc,0x00,0x0f,0x1f,0x39,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f },
|
|
|
|
{ 0x3c,0x7e,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xe7,0xfe,0xfc,0x00,0x00,0x30,0x30,0x30,0x38,0x1c,0x0e,0x07,0x03,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x1c,0x1c,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xfc,0x7c,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0xc0,0xe0,0xf0,0x38,0x1c,0x0e,0x07,0x03,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0e,0x1c,0x38,0x30,0x00,0x00 },
|
|
|
|
{ 0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00 },
|
|
|
|
{ 0x00,0x03,0x07,0x0e,0x1c,0x38,0xf0,0xe0,0xc0,0x00,0x00,0x00,0x30,0x38,0x1c,0x0e,0x07,0x03,0x01,0x00,0x00,0x00 },
|
|
|
|
{ 0x1c,0x1e,0x07,0x03,0x83,0xc3,0xe3,0x77,0x3e,0x1c,0x00,0x00,0x00,0x00,0x00,0x37,0x37,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0xf8,0xfe,0x07,0xf3,0xfb,0x1b,0xfb,0xfb,0x07,0xfe,0xf8,0x0f,0x1f,0x18,0x33,0x37,0x36,0x37,0x37,0x36,0x03,0x01 },
|
|
|
|
{ 0x00,0x00,0xe0,0xfc,0x1f,0x1f,0xfc,0xe0,0x00,0x00,0x00,0x38,0x3f,0x07,0x06,0x06,0x06,0x06,0x07,0x3f,0x38,0x00 },
|
|
|
|
{ 0xff,0xff,0xc3,0xc3,0xc3,0xc3,0xe7,0xfe,0xbc,0x00,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f,0x00 },
|
|
|
|
{ 0xf0,0xfc,0x0e,0x07,0x03,0x03,0x03,0x07,0x0e,0x0c,0x00,0x03,0x0f,0x1c,0x38,0x30,0x30,0x30,0x38,0x1c,0x0c,0x00 },
|
|
|
|
{ 0xff,0xff,0x03,0x03,0x03,0x03,0x07,0x0e,0xfc,0xf0,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x38,0x1c,0x0f,0x03,0x00 },
|
|
|
|
{ 0xff,0xff,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x03,0x03,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00 },
|
|
|
|
{ 0xff,0xff,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x03,0x03,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0xf0,0xfc,0x0e,0x07,0x03,0xc3,0xc3,0xc3,0xc7,0xc6,0x00,0x03,0x0f,0x1c,0x38,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00 },
|
|
|
|
{ 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xff,0xff,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00 },
|
|
|
|
{ 0x00,0x00,0x03,0x03,0xff,0xff,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x3f,0x3f,0x30,0x30,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x0e,0x1e,0x38,0x30,0x30,0x30,0x30,0x38,0x1f,0x07,0x00 },
|
|
|
|
{ 0xff,0xff,0xc0,0xe0,0xf0,0x38,0x1c,0x0e,0x07,0x03,0x00,0x3f,0x3f,0x00,0x01,0x03,0x07,0x0e,0x1c,0x38,0x30,0x00 },
|
|
|
|
{ 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00 },
|
|
|
|
{ 0xff,0xff,0x1e,0x78,0xe0,0xe0,0x78,0x1e,0xff,0xff,0x00,0x3f,0x3f,0x00,0x00,0x01,0x01,0x00,0x00,0x3f,0x3f,0x00 },
|
|
|
|
{ 0xff,0xff,0x0e,0x38,0xf0,0xc0,0x00,0x00,0xff,0xff,0x00,0x3f,0x3f,0x00,0x00,0x00,0x03,0x07,0x1c,0x3f,0x3f,0x00 },
|
|
|
|
{ 0xf0,0xfc,0x0e,0x07,0x03,0x03,0x07,0x0e,0xfc,0xf0,0x00,0x03,0x0f,0x1c,0x38,0x30,0x30,0x38,0x1c,0x0f,0x03,0x00 },
|
|
|
|
{ 0xff,0xff,0x83,0x83,0x83,0x83,0x83,0xc7,0xfe,0x7c,0x00,0x3f,0x3f,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00 },
|
|
|
|
{ 0xf0,0xfc,0x0e,0x07,0x03,0x03,0x07,0x0e,0xfc,0xf0,0x00,0x03,0x0f,0x1c,0x38,0x30,0x36,0x3e,0x1c,0x3f,0x33,0x00 },
|
|
|
|
{ 0xff,0xff,0x83,0x83,0x83,0x83,0x83,0xc7,0xfe,0x7c,0x00,0x3f,0x3f,0x01,0x01,0x03,0x07,0x0f,0x1d,0x38,0x30,0x00 },
|
|
|
|
{ 0x3c,0x7e,0xe7,0xc3,0xc3,0xc3,0xc3,0xc7,0x8e,0x0c,0x00,0x0c,0x1c,0x38,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f,0x00 },
|
|
|
|
{ 0x00,0x03,0x03,0x03,0xff,0xff,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x07,0x1f,0x38,0x30,0x30,0x30,0x30,0x38,0x1f,0x07,0x00 },
|
|
|
|
{ 0x07,0x3f,0xf8,0xc0,0x00,0x00,0xc0,0xf8,0x3f,0x07,0x00,0x00,0x00,0x01,0x0f,0x3e,0x3e,0x0f,0x01,0x00,0x00,0x00 },
|
|
|
|
{ 0xff,0xff,0x00,0x00,0x80,0x80,0x00,0x00,0xff,0xff,0x00,0x3f,0x3f,0x1c,0x06,0x03,0x03,0x06,0x1c,0x3f,0x3f,0x00 },
|
|
|
|
{ 0x03,0x0f,0x1c,0x30,0xe0,0xe0,0x30,0x1c,0x0f,0x03,0x00,0x30,0x3c,0x0e,0x03,0x01,0x01,0x03,0x0e,0x3c,0x30,0x00 },
|
|
|
|
{ 0x03,0x0f,0x3c,0xf0,0xc0,0xc0,0xf0,0x3c,0x0f,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x03,0x03,0x03,0x03,0xc3,0xe3,0x33,0x1f,0x0f,0x03,0x00,0x30,0x3c,0x3e,0x33,0x31,0x30,0x30,0x30,0x30,0x30,0x00 },
|
|
|
|
{ 0x00,0x00,0xff,0xff,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x00,0x00,0x00 },
|
|
|
|
{ 0x0e,0x1c,0x38,0x70,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0e,0x1c,0x18 },
|
|
|
|
{ 0x00,0x00,0x03,0x03,0x03,0x03,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00,0x00,0x00 },
|
|
|
|
{ 0x60,0x70,0x38,0x1c,0x0e,0x07,0x0e,0x1c,0x38,0x70,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x3e,0x7e,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x40,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0xc0,0x00,0x1c,0x3e,0x33,0x33,0x33,0x33,0x33,0x33,0x3f,0x3f,0x00 },
|
|
|
|
{ 0xff,0xff,0xc0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x38,0x1f,0x0f,0x00 },
|
|
|
|
{ 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xc0,0x80,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x30,0x18,0x08,0x00 },
|
|
|
|
{ 0x80,0xc0,0xe0,0x60,0x60,0x60,0xe0,0xc0,0xff,0xff,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00 },
|
|
|
|
{ 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xc0,0x80,0x00,0x0f,0x1f,0x3b,0x33,0x33,0x33,0x33,0x33,0x13,0x01,0x00 },
|
|
|
|
{ 0xc0,0xc0,0xfc,0xfe,0xc7,0xc3,0xc3,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x00,0x03,0xc7,0xce,0xcc,0xcc,0xcc,0xcc,0xe6,0x7f,0x3f,0x00 },
|
|
|
|
{ 0xff,0xff,0xc0,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x60,0xec,0xec,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x3f,0x3f,0x30,0x30,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0x00,0x60,0xec,0xec,0x00,0x00,0x00,0x00,0x00,0x60,0xe0,0xc0,0xc0,0xff,0x7f,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0xff,0xff,0x00,0x80,0xc0,0xe0,0x60,0x00,0x00,0x00,0x00,0x3f,0x3f,0x03,0x07,0x0f,0x1c,0x38,0x30,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x03,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x3f,0x3f,0x30,0x30,0x00,0x00,0x00 },
|
|
|
|
{ 0xe0,0xc0,0xe0,0xe0,0xc0,0xc0,0xe0,0xe0,0xc0,0x80,0x00,0x3f,0x3f,0x00,0x00,0x3f,0x3f,0x00,0x00,0x3f,0x3f,0x00 },
|
|
|
|
{ 0x00,0xe0,0xe0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00 },
|
|
|
|
{ 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x38,0x1f,0x0f,0x00 },
|
|
|
|
{ 0xe0,0xe0,0x60,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0xff,0xff,0x0c,0x18,0x18,0x18,0x18,0x1c,0x0f,0x07,0x00 },
|
|
|
|
{ 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x00,0x07,0x0f,0x1c,0x18,0x18,0x18,0x18,0x0c,0xff,0xff,0x00 },
|
|
|
|
{ 0x00,0xe0,0xe0,0xc0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0x40,0x00,0x00,0x00,0x11,0x33,0x33,0x33,0x33,0x33,0x3f,0x1e,0x00,0x00,0x00 },
|
|
|
|
{ 0x60,0x60,0xfe,0xfe,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x3f,0x30,0x30,0x30,0x30,0x00,0x00,0x00 },
|
|
|
|
{ 0xe0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x18,0x3f,0x3f,0x00 },
|
|
|
|
{ 0x60,0xe0,0x80,0x00,0x00,0x00,0x00,0x80,0xe0,0x60,0x00,0x00,0x01,0x07,0x1e,0x38,0x38,0x1e,0x07,0x01,0x00,0x00 },
|
|
|
|
{ 0xe0,0xe0,0x00,0x00,0xe0,0xe0,0x00,0x00,0xe0,0xe0,0x00,0x07,0x1f,0x38,0x1c,0x0f,0x0f,0x1c,0x38,0x1f,0x07,0x00 },
|
|
|
|
{ 0x60,0xe0,0xc0,0x80,0x00,0x80,0xc0,0xe0,0x60,0x00,0x00,0x30,0x38,0x1d,0x0f,0x07,0x0f,0x1d,0x38,0x30,0x00,0x00 },
|
|
|
|
{ 0x00,0x60,0xe0,0x80,0x00,0x00,0x80,0xe0,0x60,0x00,0x00,0x00,0x00,0x81,0xe7,0x7e,0x1e,0x07,0x01,0x00,0x00,0x00 },
|
|
|
|
{ 0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x60,0x20,0x00,0x00,0x30,0x38,0x3c,0x36,0x33,0x31,0x30,0x30,0x30,0x00,0x00 },
|
|
|
|
{ 0x00,0x80,0xc0,0xfc,0x7e,0x07,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x01,0x1f,0x3f,0x70,0x60,0x60,0x60,0x00,0x00 },
|
|
|
|
{ 0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0x00,0x03,0x03,0x03,0x07,0x7e,0xfc,0xc0,0x80,0x00,0x00,0x00,0x60,0x60,0x60,0x70,0x3f,0x1f,0x01,0x00,0x00,0x00 },
|
|
|
|
{ 0x10,0x18,0x0c,0x04,0x0c,0x18,0x10,0x18,0x0c,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
|
|
|
|
{ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00 }
|
2002-09-13 06:32:25 +00:00
|
|
|
};
|
2002-09-06 12:05:37 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
static signed char speed[]={
|
|
|
|
1,2,3,3,3,2,1,0,-1,-2,-2,-2,-1,0,0,1,
|
|
|
|
};
|
|
|
|
|
|
|
|
#if LCD_WIDTH > LCD_HEIGHT /* landscape LCD */
|
|
|
|
|
|
|
|
#define TABLE_SIZE LCD_HEIGHT
|
|
|
|
#define RADIUS_MINUTE (3*LCD_HEIGHT/8)
|
|
|
|
#define RADIUS_HOUR (LCD_HEIGHT/4)
|
|
|
|
|
|
|
|
#else /* portrait (or square) LCD */
|
|
|
|
|
|
|
|
#define TABLE_SIZE LCD_WIDTH
|
|
|
|
#define RADIUS_MINUTE (3*LCD_WIDTH/8)
|
|
|
|
#define RADIUS_HOUR (LCD_WIDTH/4)
|
|
|
|
|
|
|
|
#endif /* LCD orientation */
|
|
|
|
|
|
|
|
#define RADIUS_X ((LCD_WIDTH-LETTER_WIDTH)/2)
|
|
|
|
#define RADIUS_Y ((LCD_HEIGHT-LETTER_HEIGHT)/2)
|
|
|
|
|
|
|
|
#define PHASE_STEP (0xffffffff/TABLE_SIZE)
|
|
|
|
#define PHASE_FRAC (0xffffffff%TABLE_SIZE)
|
|
|
|
#define DIV_X (0x7ffffffe/RADIUS_X+1)
|
|
|
|
#define DIV_Y (0x7ffffffe/RADIUS_Y+1)
|
|
|
|
|
|
|
|
static int xtable[TABLE_SIZE];
|
|
|
|
static int ytable[TABLE_SIZE];
|
|
|
|
|
|
|
|
static void init_tables(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int pfrac;
|
|
|
|
unsigned long phase;
|
|
|
|
long sin;
|
2008-05-15 22:05:24 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
phase = pfrac = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < TABLE_SIZE; i++) {
|
2009-07-05 18:06:07 +00:00
|
|
|
sin = fp_sincos(phase, NULL);
|
2006-12-10 23:03:34 +00:00
|
|
|
xtable[i] = RADIUS_X + sin / DIV_X;
|
|
|
|
ytable[i] = RADIUS_Y + sin / DIV_Y;
|
2008-05-15 22:05:24 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
phase += PHASE_STEP;
|
|
|
|
pfrac += PHASE_FRAC;
|
|
|
|
if (pfrac >= TABLE_SIZE) {
|
|
|
|
pfrac -= TABLE_SIZE;
|
|
|
|
phase++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-06-15 13:29:03 +00:00
|
|
|
|
2002-09-06 12:05:37 +00:00
|
|
|
enum {
|
|
|
|
NUM_XSANKE,
|
|
|
|
NUM_YSANKE,
|
|
|
|
NUM_XADD,
|
|
|
|
NUM_YADD,
|
|
|
|
NUM_XDIST,
|
|
|
|
NUM_YDIST,
|
|
|
|
|
|
|
|
NUM_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
struct counter {
|
|
|
|
char *what;
|
|
|
|
int num;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct counter values[]={
|
|
|
|
{"xsanke", 1},
|
|
|
|
{"ysanke", 1},
|
|
|
|
{"xadd", 1},
|
2005-02-08 22:38:23 +00:00
|
|
|
{"yadd", 2},
|
2002-09-06 12:05:37 +00:00
|
|
|
{"xdist", -4},
|
2004-12-15 18:54:29 +00:00
|
|
|
{"ydist", -6},
|
2002-09-06 12:05:37 +00:00
|
|
|
};
|
|
|
|
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2002-10-11 20:15:22 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
#define CLOCK_STEP (0xffffffff/60)
|
|
|
|
#define CLOCK_FRAC (0xffffffff%60)
|
|
|
|
|
|
|
|
#define DIV_MY (0x7ffffffe/RADIUS_MINUTE+1)
|
|
|
|
#define DIV_HY (0x7ffffffe/RADIUS_HOUR+1)
|
|
|
|
|
|
|
|
#if LCD_WIDTH == 112 && LCD_HEIGHT == 64 /* Archos LCD: non-square pixels */
|
|
|
|
#define DIV_MX (0x7ffffffe/(5*RADIUS_MINUTE/4)+1)
|
|
|
|
#define DIV_HX (0x7ffffffe/(5*RADIUS_HOUR/4)+1)
|
|
|
|
#else /* Square pixels */
|
|
|
|
#define DIV_MX DIV_MY
|
|
|
|
#define DIV_HX DIV_HY
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static int xminute[60], yminute[60];
|
|
|
|
static int xhour[60], yhour[60];
|
|
|
|
|
|
|
|
static void init_clock(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int pfrac;
|
|
|
|
unsigned long phase;
|
|
|
|
long sin, cos;
|
2008-05-15 22:05:24 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
phase = pfrac = 0;
|
2008-05-15 22:05:24 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
for (i = 0; i < 60; i++) {
|
2009-07-05 18:06:07 +00:00
|
|
|
sin = fp_sincos(phase, &cos);
|
2006-12-10 23:03:34 +00:00
|
|
|
xminute[i] = LCD_WIDTH/2 + sin / DIV_MX;
|
|
|
|
yminute[i] = LCD_HEIGHT/2 - cos / DIV_MY;
|
|
|
|
xhour[i] = LCD_WIDTH/2 + sin / DIV_HX;
|
|
|
|
yhour[i] = LCD_HEIGHT/2 - cos / DIV_HY;
|
|
|
|
|
|
|
|
phase += CLOCK_STEP;
|
|
|
|
pfrac += CLOCK_FRAC;
|
|
|
|
if (pfrac >= 60) {
|
|
|
|
pfrac -= 60;
|
|
|
|
phase++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-10-11 20:15:22 +00:00
|
|
|
|
|
|
|
static void addclock(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int hour;
|
|
|
|
int minute;
|
|
|
|
|
2003-12-06 23:22:29 +00:00
|
|
|
struct tm* current_time = rb->get_time();
|
|
|
|
hour = current_time->tm_hour;
|
|
|
|
minute = current_time->tm_min;
|
2002-10-11 20:15:22 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
rb->lcd_drawline(LCD_WIDTH/2, LCD_HEIGHT/2,
|
|
|
|
xminute[minute], yminute[minute]);
|
2002-10-11 20:15:22 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
hour = (hour % 12) * 5 + minute / 12;
|
2002-10-11 20:15:22 +00:00
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
rb->lcd_drawline(LCD_WIDTH/2, LCD_HEIGHT/2, xhour[hour], yhour[hour]);
|
2002-10-11 20:15:22 +00:00
|
|
|
|
|
|
|
/* draw a circle */
|
2006-12-10 23:03:34 +00:00
|
|
|
for(i = 1; i < 60; i += 3)
|
|
|
|
rb->lcd_drawline(xminute[i], yminute[i],
|
|
|
|
xminute[(i+1)%60], yminute[(i+1)%60]);
|
2002-10-11 20:15:22 +00:00
|
|
|
}
|
2005-12-04 15:23:47 +00:00
|
|
|
#endif /* CONFIG_RTC */
|
2002-10-11 20:15:22 +00:00
|
|
|
|
2005-07-14 12:29:39 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2005-11-16 21:09:23 +00:00
|
|
|
static const unsigned face_colors[] =
|
2005-07-19 10:33:41 +00:00
|
|
|
{
|
2005-11-16 21:09:23 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
LCD_BLACK, LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(255, 0, 0)
|
2005-07-19 10:33:41 +00:00
|
|
|
#else
|
2005-11-16 21:09:23 +00:00
|
|
|
LCD_BLACK, LCD_LIGHTGRAY, LCD_DARKGRAY
|
2005-07-14 12:29:39 +00:00
|
|
|
#endif
|
2005-11-16 21:09:23 +00:00
|
|
|
};
|
2005-07-19 10:33:41 +00:00
|
|
|
#endif
|
2005-07-14 11:55:55 +00:00
|
|
|
|
2002-10-13 12:48:31 +00:00
|
|
|
static int scrollit(void)
|
|
|
|
{
|
|
|
|
int b;
|
|
|
|
unsigned int y=100;
|
2006-12-10 23:03:34 +00:00
|
|
|
unsigned int yy;
|
|
|
|
int x = LCD_WIDTH;
|
|
|
|
int xx;
|
2002-10-13 12:48:31 +00:00
|
|
|
unsigned int i;
|
2006-12-10 23:03:34 +00:00
|
|
|
unsigned int textpos=0;
|
2002-10-13 12:48:31 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) ";
|
2003-06-30 02:07:20 +00:00
|
|
|
unsigned int rocklen = rb->strlen(rock);
|
2002-10-13 12:48:31 +00:00
|
|
|
int letter;
|
2008-05-15 22:05:24 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
unsigned prev_color;
|
|
|
|
#endif
|
2002-10-13 12:48:31 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_clear_display();
|
2002-10-13 12:48:31 +00:00
|
|
|
while(1)
|
|
|
|
{
|
2003-06-29 16:33:04 +00:00
|
|
|
b = rb->button_get_w_tmo(HZ/10);
|
2006-06-30 16:43:47 +00:00
|
|
|
switch(b)
|
|
|
|
{
|
|
|
|
#ifdef BOUNCE_RC_QUIT
|
|
|
|
case BOUNCE_RC_QUIT :
|
|
|
|
#endif
|
|
|
|
case BOUNCE_QUIT :
|
|
|
|
return 0;
|
2008-05-15 22:05:24 +00:00
|
|
|
case BOUNCE_MODE :
|
2006-06-30 16:43:47 +00:00
|
|
|
return 1;
|
|
|
|
default:
|
|
|
|
if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
|
|
|
|
return -1;
|
|
|
|
}
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_clear_display();
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2006-12-10 23:03:34 +00:00
|
|
|
addclock();
|
|
|
|
#endif
|
2002-10-13 12:48:31 +00:00
|
|
|
|
2008-05-15 22:05:24 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
prev_color = rb->lcd_get_foreground();
|
|
|
|
#endif
|
|
|
|
|
2006-12-10 23:03:34 +00:00
|
|
|
for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) {
|
2003-06-30 02:07:20 +00:00
|
|
|
letter = rock[(i+textpos) % rocklen ];
|
2005-07-14 12:29:39 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-12-10 23:03:34 +00:00
|
|
|
rb->lcd_set_foreground(face_colors[letter % 3]);
|
2005-07-14 12:29:39 +00:00
|
|
|
#endif
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_mono_bitmap(char_gen_12x16[letter-0x20],
|
2006-12-10 23:03:34 +00:00
|
|
|
xx, ytable[yy % TABLE_SIZE],
|
|
|
|
LETTER_WIDTH, LETTER_HEIGHT);
|
2002-10-13 12:48:31 +00:00
|
|
|
yy += YADD;
|
2006-12-10 23:03:34 +00:00
|
|
|
xx += LETTER_WIDTH;
|
2002-10-13 12:48:31 +00:00
|
|
|
}
|
2006-12-10 23:03:34 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2008-05-15 22:05:24 +00:00
|
|
|
rb->lcd_set_foreground(prev_color);
|
2004-10-17 00:54:09 +00:00
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_update();
|
2002-10-13 12:48:31 +00:00
|
|
|
|
|
|
|
x-= XSPEED;
|
2008-05-15 22:05:24 +00:00
|
|
|
|
2005-07-14 11:55:55 +00:00
|
|
|
if(x < -LETTER_WIDTH) {
|
2006-12-10 23:03:34 +00:00
|
|
|
x += LETTER_WIDTH;
|
2002-10-13 12:48:31 +00:00
|
|
|
y += YADD;
|
|
|
|
textpos++;
|
|
|
|
}
|
|
|
|
|
|
|
|
y+=YSPEED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int loopit(void)
|
2002-06-15 13:29:03 +00:00
|
|
|
{
|
|
|
|
int b;
|
2002-09-06 12:05:37 +00:00
|
|
|
unsigned int y=100;
|
|
|
|
unsigned int x=100;
|
|
|
|
unsigned int yy,xx;
|
2002-06-15 13:29:03 +00:00
|
|
|
unsigned int i;
|
2002-09-06 12:05:37 +00:00
|
|
|
unsigned int ysanke=0;
|
|
|
|
unsigned int xsanke=0;
|
2002-06-15 13:29:03 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
char* rock="ROCKbox";
|
2003-06-30 02:07:20 +00:00
|
|
|
unsigned int rocklen = rb->strlen(rock);
|
2002-06-15 13:29:03 +00:00
|
|
|
|
2002-09-06 12:05:37 +00:00
|
|
|
int show=0;
|
|
|
|
int timeout=0;
|
|
|
|
char buffer[30];
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_clear_display();
|
2002-06-15 13:29:03 +00:00
|
|
|
while(1)
|
|
|
|
{
|
2003-06-29 16:33:04 +00:00
|
|
|
b = rb->button_get_w_tmo(HZ/10);
|
2004-10-17 00:54:09 +00:00
|
|
|
if ( b == BOUNCE_QUIT )
|
2004-08-30 17:21:15 +00:00
|
|
|
return 0;
|
2002-08-13 15:01:59 +00:00
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
if ( b == BOUNCE_MODE )
|
2008-05-15 22:05:24 +00:00
|
|
|
return 1;
|
2004-08-30 17:21:15 +00:00
|
|
|
|
|
|
|
if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ( b != BUTTON_NONE )
|
|
|
|
timeout=20;
|
2004-07-26 23:32:37 +00:00
|
|
|
|
2002-09-06 12:05:37 +00:00
|
|
|
y+= speed[ysanke&15] + values[NUM_YADD].num;
|
|
|
|
x+= speed[xsanke&15] + values[NUM_XADD].num;
|
2002-06-15 13:29:03 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_clear_display();
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2002-10-11 20:15:22 +00:00
|
|
|
addclock();
|
2004-10-17 00:54:09 +00:00
|
|
|
#endif
|
2002-09-06 12:05:37 +00:00
|
|
|
if(timeout) {
|
|
|
|
switch(b) {
|
2008-03-22 10:24:28 +00:00
|
|
|
case BOUNCE_LEFT:
|
|
|
|
case BOUNCE_LEFT|BUTTON_REPEAT:
|
2002-09-06 12:05:37 +00:00
|
|
|
values[show].num--;
|
|
|
|
break;
|
2008-03-22 10:24:28 +00:00
|
|
|
case BOUNCE_RIGHT:
|
|
|
|
case BOUNCE_RIGHT|BUTTON_REPEAT:
|
2002-09-06 12:05:37 +00:00
|
|
|
values[show].num++;
|
|
|
|
break;
|
2005-12-14 01:31:37 +00:00
|
|
|
case BOUNCE_UP:
|
2007-05-22 06:31:44 +00:00
|
|
|
case BOUNCE_UP|BUTTON_REPEAT:
|
2002-09-06 12:05:37 +00:00
|
|
|
if(++show == NUM_LAST)
|
|
|
|
show=0;
|
|
|
|
break;
|
2005-12-14 01:31:37 +00:00
|
|
|
case BOUNCE_DOWN:
|
2007-05-22 06:31:44 +00:00
|
|
|
case BOUNCE_DOWN|BUTTON_REPEAT:
|
2002-09-06 12:05:37 +00:00
|
|
|
if(--show < 0)
|
|
|
|
show=NUM_LAST-1;
|
|
|
|
break;
|
|
|
|
}
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->snprintf(buffer, 30, "%s: %d",
|
|
|
|
values[show].what, values[show].num);
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_putsxy(0, LCD_HEIGHT - 8, (unsigned char *)buffer);
|
2002-09-06 12:05:37 +00:00
|
|
|
timeout--;
|
|
|
|
}
|
|
|
|
for(i=0, yy=y, xx=x;
|
2003-06-30 02:07:20 +00:00
|
|
|
i<rocklen;
|
2002-09-06 12:05:37 +00:00
|
|
|
i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num)
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_mono_bitmap(char_gen_12x16[rock[i]-0x20],
|
2006-12-10 23:03:34 +00:00
|
|
|
xtable[xx % TABLE_SIZE],
|
|
|
|
ytable[yy % TABLE_SIZE],
|
|
|
|
LETTER_WIDTH, LETTER_HEIGHT);
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_update();
|
2002-06-15 13:29:03 +00:00
|
|
|
|
2002-09-06 12:05:37 +00:00
|
|
|
ysanke+= values[NUM_YSANKE].num;
|
|
|
|
xsanke+= values[NUM_XSANKE].num;
|
2002-06-15 13:29:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2002-06-15 13:29:03 +00:00
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
char *off = "[Off] to stop";
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
(void)(parameter);
|
2002-10-29 10:45:29 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2006-12-10 23:03:34 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
|
|
|
|
/* Get horizontel centering for text */
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_getstringsize((unsigned char *)SS_TITLE, &w, &h);
|
2006-12-10 23:03:34 +00:00
|
|
|
rb->lcd_putsxy((LCD_WIDTH/2) - w / 2, (LCD_HEIGHT/2) - h / 2,
|
|
|
|
(unsigned char *)SS_TITLE);
|
2002-06-15 13:29:03 +00:00
|
|
|
|
|
|
|
/* Get horizontel centering for text */
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_getstringsize((unsigned char *)off, &w, &h);
|
2006-12-10 23:03:34 +00:00
|
|
|
rb->lcd_putsxy((LCD_WIDTH/2) - w / 2, LCD_HEIGHT - 2 * h,
|
|
|
|
(unsigned char *)off);
|
2005-07-19 09:24:29 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(HZ);
|
2005-07-14 18:34:07 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2006-12-10 23:03:34 +00:00
|
|
|
init_tables();
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2006-12-10 23:03:34 +00:00
|
|
|
init_clock();
|
|
|
|
#endif
|
2005-07-14 18:34:07 +00:00
|
|
|
|
2002-10-13 12:48:31 +00:00
|
|
|
do {
|
2004-08-30 17:21:15 +00:00
|
|
|
h = loopit();
|
|
|
|
if (h > 0)
|
2002-10-29 10:45:29 +00:00
|
|
|
h = scrollit();
|
2004-08-30 17:21:15 +00:00
|
|
|
} while(h > 0);
|
2008-05-15 22:05:24 +00:00
|
|
|
|
2005-07-14 18:34:07 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_setfont(FONT_UI);
|
2006-12-10 23:03:34 +00:00
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
return (h == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED;
|
2002-06-15 13:29:03 +00:00
|
|
|
}
|