Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2002 Daniel Stenberg |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 20 | **************************************************************************/ |
| 21 | #include "plugin.h" |
Björn Stenberg | 4b9a267 | 2003-12-06 23:22:29 +0000 | [diff] [blame] | 22 | #include "time.h" |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 23 | #include "fixedpoint.h" |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 24 | |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 25 | PLUGIN_HEADER |
| 26 | |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 27 | #define SS_TITLE "Bouncer" |
Robert Hak | 8f11dc0 | 2002-10-29 10:45:29 +0000 | [diff] [blame] | 28 | |
| 29 | #define YSPEED 2 |
| 30 | #define XSPEED 3 |
| 31 | #define YADD -4 |
| 32 | |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 33 | /* variable button definitions */ |
| 34 | #if CONFIG_KEYPAD == RECORDER_PAD |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 35 | #define BOUNCE_LEFT BUTTON_LEFT |
| 36 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 37 | #define BOUNCE_UP BUTTON_UP |
| 38 | #define BOUNCE_DOWN BUTTON_DOWN |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 39 | #define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL) |
| 40 | #define BOUNCE_MODE (BUTTON_ON | BUTTON_REL) |
| 41 | |
Dave Chapman | d64e626 | 2007-01-14 13:48:09 +0000 | [diff] [blame] | 42 | #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 43 | #define BOUNCE_LEFT BUTTON_LEFT |
| 44 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Dave Chapman | d64e626 | 2007-01-14 13:48:09 +0000 | [diff] [blame] | 45 | #define BOUNCE_UP BUTTON_UP |
| 46 | #define BOUNCE_DOWN BUTTON_DOWN |
| 47 | #define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL) |
| 48 | #define BOUNCE_MODE (BUTTON_ON | BUTTON_REL) |
| 49 | |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 50 | #elif CONFIG_KEYPAD == ONDIO_PAD |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 51 | #define BOUNCE_LEFT BUTTON_LEFT |
| 52 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 53 | #define BOUNCE_UP BUTTON_UP |
| 54 | #define BOUNCE_DOWN BUTTON_DOWN |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 55 | #define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL) |
| 56 | #define BOUNCE_MODE (BUTTON_MENU | BUTTON_REL) |
| 57 | |
Daniel Stenberg | 01377e2 | 2005-06-29 12:47:24 +0000 | [diff] [blame] | 58 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
| 59 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 60 | #define BOUNCE_LEFT BUTTON_LEFT |
| 61 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 62 | #define BOUNCE_UP BUTTON_UP |
| 63 | #define BOUNCE_DOWN BUTTON_DOWN |
Daniel Stenberg | 6700ad8 | 2005-02-04 12:41:09 +0000 | [diff] [blame] | 64 | #define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL) |
| 65 | #define BOUNCE_MODE (BUTTON_SELECT | BUTTON_REL) |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 66 | |
Kevin Ferrare | 0e027bd | 2006-06-30 16:43:47 +0000 | [diff] [blame] | 67 | #define BOUNCE_RC_QUIT (BUTTON_RC_STOP | BUTTON_REL) |
| 68 | |
Dave Chapman | fb4e384 | 2006-02-24 20:54:09 +0000 | [diff] [blame] | 69 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
Jens Arnold | b701322 | 2007-07-27 09:57:27 +0000 | [diff] [blame] | 70 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ |
| 71 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 72 | #define BOUNCE_LEFT BUTTON_LEFT |
| 73 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 74 | #define BOUNCE_UP BUTTON_SCROLL_BACK |
| 75 | #define BOUNCE_DOWN BUTTON_SCROLL_FWD |
| 76 | #define BOUNCE_QUIT (BUTTON_MENU | BUTTON_REL) |
| 77 | #define BOUNCE_MODE (BUTTON_SELECT | BUTTON_REL) |
| 78 | |
Jens Arnold | 85a226d | 2007-03-16 23:02:39 +0000 | [diff] [blame] | 79 | #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 80 | #define BOUNCE_LEFT BUTTON_LEFT |
| 81 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Daniel Stenberg | acf7d5e | 2006-01-19 12:44:46 +0000 | [diff] [blame] | 82 | #define BOUNCE_UP BUTTON_UP |
| 83 | #define BOUNCE_DOWN BUTTON_DOWN |
| 84 | #define BOUNCE_QUIT BUTTON_POWER |
| 85 | #define BOUNCE_MODE BUTTON_PLAY |
| 86 | |
Marcoen Hirschberg | 338e2bb | 2006-02-24 15:42:52 +0000 | [diff] [blame] | 87 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 88 | #define BOUNCE_LEFT BUTTON_LEFT |
| 89 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Marcoen Hirschberg | 338e2bb | 2006-02-24 15:42:52 +0000 | [diff] [blame] | 90 | #define BOUNCE_UP BUTTON_UP |
| 91 | #define BOUNCE_DOWN BUTTON_DOWN |
Marcoen Hirschberg | a7168fe | 2007-05-19 23:38:09 +0000 | [diff] [blame] | 92 | #define BOUNCE_QUIT BUTTON_POWER |
| 93 | #define BOUNCE_MODE BUTTON_A |
Marcoen Hirschberg | 338e2bb | 2006-02-24 15:42:52 +0000 | [diff] [blame] | 94 | |
Barry Wardell | 24f4a2a | 2006-10-26 13:38:09 +0000 | [diff] [blame] | 95 | #elif CONFIG_KEYPAD == SANSA_E200_PAD |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 96 | #define BOUNCE_LEFT BUTTON_LEFT |
| 97 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Jonathan Gordon | 81ba146 | 2008-01-10 08:08:31 +0000 | [diff] [blame] | 98 | #define BOUNCE_UP BUTTON_SCROLL_BACK |
| 99 | #define BOUNCE_DOWN BUTTON_SCROLL_FWD |
Barry Wardell | 24f4a2a | 2006-10-26 13:38:09 +0000 | [diff] [blame] | 100 | #define BOUNCE_QUIT BUTTON_POWER |
| 101 | #define BOUNCE_MODE BUTTON_SELECT |
| 102 | |
Marianne Arnold | 12ddb8e | 2007-09-20 10:49:48 +0000 | [diff] [blame] | 103 | #elif CONFIG_KEYPAD == SANSA_C200_PAD |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 104 | #define BOUNCE_LEFT BUTTON_LEFT |
| 105 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Marianne Arnold | 12ddb8e | 2007-09-20 10:49:48 +0000 | [diff] [blame] | 106 | #define BOUNCE_UP BUTTON_UP |
| 107 | #define BOUNCE_DOWN BUTTON_DOWN |
| 108 | #define BOUNCE_QUIT BUTTON_POWER |
| 109 | #define BOUNCE_MODE BUTTON_SELECT |
| 110 | |
Daniel Stenberg | 1e88be5 | 2006-08-03 20:17:25 +0000 | [diff] [blame] | 111 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 112 | #define BOUNCE_LEFT BUTTON_LEFT |
| 113 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Daniel Stenberg | 1e88be5 | 2006-08-03 20:17:25 +0000 | [diff] [blame] | 114 | #define BOUNCE_UP BUTTON_SCROLL_UP |
| 115 | #define BOUNCE_DOWN BUTTON_SCROLL_DOWN |
| 116 | #define BOUNCE_QUIT BUTTON_POWER |
| 117 | #define BOUNCE_MODE BUTTON_PLAY |
| 118 | |
Will Robertson | 8215b34 | 2008-02-17 12:23:02 +0000 | [diff] [blame] | 119 | #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 120 | #define BOUNCE_LEFT BUTTON_LEFT |
| 121 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Will Robertson | 8215b34 | 2008-02-17 12:23:02 +0000 | [diff] [blame] | 122 | #define BOUNCE_UP BUTTON_UP |
| 123 | #define BOUNCE_DOWN BUTTON_DOWN |
| 124 | #define BOUNCE_QUIT BUTTON_BACK |
| 125 | #define BOUNCE_MODE BUTTON_MENU |
Robert Kukla | d6c8b57 | 2008-03-01 22:55:09 +0000 | [diff] [blame] | 126 | |
| 127 | #elif (CONFIG_KEYPAD == MROBE100_PAD) |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 128 | #define BOUNCE_LEFT BUTTON_LEFT |
| 129 | #define BOUNCE_RIGHT BUTTON_RIGHT |
Robert Kukla | d6c8b57 | 2008-03-01 22:55:09 +0000 | [diff] [blame] | 130 | #define BOUNCE_UP BUTTON_UP |
| 131 | #define BOUNCE_DOWN BUTTON_DOWN |
| 132 | #define BOUNCE_QUIT BUTTON_POWER |
| 133 | #define BOUNCE_MODE BUTTON_DISPLAY |
| 134 | |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 135 | #elif CONFIG_KEYPAD == IAUDIO_M3_PAD |
| 136 | #define BOUNCE_LEFT BUTTON_RC_REW |
| 137 | #define BOUNCE_RIGHT BUTTON_RC_FF |
| 138 | #define BOUNCE_UP BUTTON_RC_VOL_UP |
| 139 | #define BOUNCE_DOWN BUTTON_RC_VOL_DOWN |
| 140 | #define BOUNCE_QUIT BUTTON_RC_REC |
| 141 | #define BOUNCE_MODE BUTTON_RC_MODE |
| 142 | |
Rob Purchase | 554d7ed | 2008-03-22 22:03:34 +0000 | [diff] [blame] | 143 | #elif (CONFIG_KEYPAD == COWOND2_PAD) |
Rob Purchase | 554d7ed | 2008-03-22 22:03:34 +0000 | [diff] [blame] | 144 | #define BOUNCE_QUIT BUTTON_POWER |
| 145 | #define BOUNCE_MODE BUTTON_MENU |
| 146 | |
Robert Kukla | d6c8b57 | 2008-03-01 22:55:09 +0000 | [diff] [blame] | 147 | #else |
| 148 | #error No keymap defined! |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 149 | #endif |
| 150 | |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 151 | #ifdef HAVE_TOUCHPAD |
| 152 | #ifndef BOUNCE_LEFT |
| 153 | #define BOUNCE_LEFT BUTTON_MIDLEFT |
| 154 | #endif |
| 155 | #ifndef BOUNCE_RIGHT |
| 156 | #define BOUNCE_RIGHT BUTTON_MIDRIGHT |
| 157 | #endif |
| 158 | #ifndef BOUNCE_UP |
| 159 | #define BOUNCE_UP BUTTON_TOPMIDDLE |
| 160 | #endif |
| 161 | #ifndef BOUNCE_DOWN |
| 162 | #define BOUNCE_DOWN BUTTON_BOTTOMMIDDLE |
| 163 | #endif |
| 164 | #ifndef BOUNCE_QUIT |
| 165 | #define BOUNCE_QUIT BUTTON_TOPLEFT |
| 166 | #endif |
| 167 | #ifndef BOUNCE_MODE |
| 168 | #define BOUNCE_MODE BUTTON_CENTER |
| 169 | #endif |
| 170 | #endif |
| 171 | |
Steve Bavin | 6526577 | 2008-05-13 09:57:56 +0000 | [diff] [blame] | 172 | static const struct plugin_api* rb; |
Robert Hak | 8f11dc0 | 2002-10-29 10:45:29 +0000 | [diff] [blame] | 173 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 174 | #define LETTER_WIDTH 11 |
| 175 | #define LETTER_HEIGHT 16 |
Daniel Stenberg | e26d976 | 2005-07-14 11:55:55 +0000 | [diff] [blame] | 176 | |
Daniel Stenberg | 48c2350 | 2002-09-13 06:32:25 +0000 | [diff] [blame] | 177 | const unsigned char char_gen_12x16[][22] = |
| 178 | { |
| 179 | { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
Jens Arnold | 2d446fe | 2004-05-14 22:55:05 +0000 | [diff] [blame] | 180 | { 0x00,0x00,0x00,0x7c,0xff,0xff,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x00,0x00,0x00,0x00,0x00 }, |
| 181 | { 0x00,0x00,0x3c,0x3c,0x00,0x00,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 182 | { 0x00,0x10,0x90,0xf0,0x7e,0x1e,0x90,0xf0,0x7e,0x1e,0x10,0x02,0x1e,0x1f,0x03,0x02,0x1e,0x1f,0x03,0x02,0x00,0x00 }, |
| 183 | { 0x00,0x78,0xfc,0xcc,0xff,0xff,0xcc,0xcc,0x88,0x00,0x00,0x00,0x04,0x0c,0x0c,0x3f,0x3f,0x0c,0x0f,0x07,0x00,0x00 }, |
| 184 | { 0x00,0x38,0x38,0x38,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x30,0x38,0x1c,0x0e,0x07,0x03,0x01,0x38,0x38,0x38,0x00 }, |
| 185 | { 0x00,0x00,0xb8,0xfc,0xc6,0xe2,0x3e,0x1c,0x00,0x00,0x00,0x00,0x1f,0x3f,0x31,0x21,0x37,0x1e,0x1c,0x36,0x22,0x00 }, |
| 186 | { 0x00,0x00,0x00,0x27,0x3f,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 187 | { 0x00,0x00,0xf0,0xfc,0xfe,0x07,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x03,0x0f,0x1f,0x38,0x20,0x20,0x00,0x00,0x00 }, |
| 188 | { 0x00,0x00,0x01,0x01,0x07,0xfe,0xfc,0xf0,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x38,0x1f,0x0f,0x03,0x00,0x00,0x00 }, |
| 189 | { 0x00,0x98,0xb8,0xe0,0xf8,0xf8,0xe0,0xb8,0x98,0x00,0x00,0x00,0x0c,0x0e,0x03,0x0f,0x0f,0x03,0x0e,0x0c,0x00,0x00 }, |
| 190 | { 0x00,0x80,0x80,0x80,0xf0,0xf0,0x80,0x80,0x80,0x00,0x00,0x00,0x01,0x01,0x01,0x0f,0x0f,0x01,0x01,0x01,0x00,0x00 }, |
| 191 | { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0xf8,0x78,0x00,0x00,0x00,0x00,0x00 }, |
| 192 | { 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00 }, |
| 193 | { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00 }, |
| 194 | { 0x00,0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x18,0x1c,0x0e,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00 }, |
| 195 | { 0xf8,0xfe,0x06,0x03,0x83,0xc3,0x63,0x33,0x1e,0xfe,0xf8,0x07,0x1f,0x1e,0x33,0x31,0x30,0x30,0x30,0x18,0x1f,0x07 }, |
| 196 | { 0x00,0x00,0x0c,0x0c,0x0e,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x3f,0x3f,0x30,0x30,0x30,0x00 }, |
| 197 | { 0x1c,0x1e,0x07,0x03,0x03,0x83,0xc3,0xe3,0x77,0x3e,0x1c,0x30,0x38,0x3c,0x3e,0x37,0x33,0x31,0x30,0x30,0x30,0x30 }, |
| 198 | { 0x0c,0x0e,0x07,0xc3,0xc3,0xc3,0xc3,0xc3,0xe7,0x7e,0x3c,0x0c,0x1c,0x38,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0e }, |
| 199 | { 0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x07,0xff,0xff,0x00,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x3f,0x3f,0x03,0x03 }, |
| 200 | { 0x3f,0x7f,0x63,0x63,0x63,0x63,0x63,0x63,0xe3,0xc3,0x83,0x0c,0x1c,0x38,0x30,0x30,0x30,0x30,0x30,0x38,0x1f,0x0f }, |
| 201 | { 0xc0,0xf0,0xf8,0xdc,0xce,0xc7,0xc3,0xc3,0xc3,0x80,0x00,0x0f,0x1f,0x39,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f }, |
| 202 | { 0x03,0x03,0x03,0x03,0x03,0x03,0xc3,0xf3,0x3f,0x0f,0x03,0x00,0x00,0x00,0x30,0x3c,0x0f,0x03,0x00,0x00,0x00,0x00 }, |
| 203 | { 0x00,0xbc,0xfe,0xe7,0xc3,0xc3,0xc3,0xe7,0xfe,0xbc,0x00,0x0f,0x1f,0x39,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f }, |
| 204 | { 0x3c,0x7e,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xe7,0xfe,0xfc,0x00,0x00,0x30,0x30,0x30,0x38,0x1c,0x0e,0x07,0x03,0x00 }, |
| 205 | { 0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x1c,0x1c,0x00,0x00,0x00,0x00,0x00 }, |
| 206 | { 0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xfc,0x7c,0x00,0x00,0x00,0x00,0x00 }, |
| 207 | { 0x00,0xc0,0xe0,0xf0,0x38,0x1c,0x0e,0x07,0x03,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0e,0x1c,0x38,0x30,0x00,0x00 }, |
| 208 | { 0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00 }, |
| 209 | { 0x00,0x03,0x07,0x0e,0x1c,0x38,0xf0,0xe0,0xc0,0x00,0x00,0x00,0x30,0x38,0x1c,0x0e,0x07,0x03,0x01,0x00,0x00,0x00 }, |
| 210 | { 0x1c,0x1e,0x07,0x03,0x83,0xc3,0xe3,0x77,0x3e,0x1c,0x00,0x00,0x00,0x00,0x00,0x37,0x37,0x00,0x00,0x00,0x00,0x00 }, |
| 211 | { 0xf8,0xfe,0x07,0xf3,0xfb,0x1b,0xfb,0xfb,0x07,0xfe,0xf8,0x0f,0x1f,0x18,0x33,0x37,0x36,0x37,0x37,0x36,0x03,0x01 }, |
| 212 | { 0x00,0x00,0xe0,0xfc,0x1f,0x1f,0xfc,0xe0,0x00,0x00,0x00,0x38,0x3f,0x07,0x06,0x06,0x06,0x06,0x07,0x3f,0x38,0x00 }, |
| 213 | { 0xff,0xff,0xc3,0xc3,0xc3,0xc3,0xe7,0xfe,0xbc,0x00,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f,0x00 }, |
| 214 | { 0xf0,0xfc,0x0e,0x07,0x03,0x03,0x03,0x07,0x0e,0x0c,0x00,0x03,0x0f,0x1c,0x38,0x30,0x30,0x30,0x38,0x1c,0x0c,0x00 }, |
| 215 | { 0xff,0xff,0x03,0x03,0x03,0x03,0x07,0x0e,0xfc,0xf0,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x38,0x1c,0x0f,0x03,0x00 }, |
| 216 | { 0xff,0xff,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x03,0x03,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00 }, |
| 217 | { 0xff,0xff,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x03,0x03,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 218 | { 0xf0,0xfc,0x0e,0x07,0x03,0xc3,0xc3,0xc3,0xc7,0xc6,0x00,0x03,0x0f,0x1c,0x38,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00 }, |
| 219 | { 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xff,0xff,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00 }, |
| 220 | { 0x00,0x00,0x03,0x03,0xff,0xff,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x3f,0x3f,0x30,0x30,0x00,0x00,0x00 }, |
| 221 | { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x0e,0x1e,0x38,0x30,0x30,0x30,0x30,0x38,0x1f,0x07,0x00 }, |
| 222 | { 0xff,0xff,0xc0,0xe0,0xf0,0x38,0x1c,0x0e,0x07,0x03,0x00,0x3f,0x3f,0x00,0x01,0x03,0x07,0x0e,0x1c,0x38,0x30,0x00 }, |
| 223 | { 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00 }, |
| 224 | { 0xff,0xff,0x1e,0x78,0xe0,0xe0,0x78,0x1e,0xff,0xff,0x00,0x3f,0x3f,0x00,0x00,0x01,0x01,0x00,0x00,0x3f,0x3f,0x00 }, |
| 225 | { 0xff,0xff,0x0e,0x38,0xf0,0xc0,0x00,0x00,0xff,0xff,0x00,0x3f,0x3f,0x00,0x00,0x00,0x03,0x07,0x1c,0x3f,0x3f,0x00 }, |
| 226 | { 0xf0,0xfc,0x0e,0x07,0x03,0x03,0x07,0x0e,0xfc,0xf0,0x00,0x03,0x0f,0x1c,0x38,0x30,0x30,0x38,0x1c,0x0f,0x03,0x00 }, |
| 227 | { 0xff,0xff,0x83,0x83,0x83,0x83,0x83,0xc7,0xfe,0x7c,0x00,0x3f,0x3f,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00 }, |
| 228 | { 0xf0,0xfc,0x0e,0x07,0x03,0x03,0x07,0x0e,0xfc,0xf0,0x00,0x03,0x0f,0x1c,0x38,0x30,0x36,0x3e,0x1c,0x3f,0x33,0x00 }, |
| 229 | { 0xff,0xff,0x83,0x83,0x83,0x83,0x83,0xc7,0xfe,0x7c,0x00,0x3f,0x3f,0x01,0x01,0x03,0x07,0x0f,0x1d,0x38,0x30,0x00 }, |
| 230 | { 0x3c,0x7e,0xe7,0xc3,0xc3,0xc3,0xc3,0xc7,0x8e,0x0c,0x00,0x0c,0x1c,0x38,0x30,0x30,0x30,0x30,0x39,0x1f,0x0f,0x00 }, |
| 231 | { 0x00,0x03,0x03,0x03,0xff,0xff,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00 }, |
| 232 | { 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x07,0x1f,0x38,0x30,0x30,0x30,0x30,0x38,0x1f,0x07,0x00 }, |
| 233 | { 0x07,0x3f,0xf8,0xc0,0x00,0x00,0xc0,0xf8,0x3f,0x07,0x00,0x00,0x00,0x01,0x0f,0x3e,0x3e,0x0f,0x01,0x00,0x00,0x00 }, |
| 234 | { 0xff,0xff,0x00,0x00,0x80,0x80,0x00,0x00,0xff,0xff,0x00,0x3f,0x3f,0x1c,0x06,0x03,0x03,0x06,0x1c,0x3f,0x3f,0x00 }, |
| 235 | { 0x03,0x0f,0x1c,0x30,0xe0,0xe0,0x30,0x1c,0x0f,0x03,0x00,0x30,0x3c,0x0e,0x03,0x01,0x01,0x03,0x0e,0x3c,0x30,0x00 }, |
| 236 | { 0x03,0x0f,0x3c,0xf0,0xc0,0xc0,0xf0,0x3c,0x0f,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00 }, |
| 237 | { 0x03,0x03,0x03,0x03,0xc3,0xe3,0x33,0x1f,0x0f,0x03,0x00,0x30,0x3c,0x3e,0x33,0x31,0x30,0x30,0x30,0x30,0x30,0x00 }, |
| 238 | { 0x00,0x00,0xff,0xff,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x00,0x00,0x00 }, |
| 239 | { 0x0e,0x1c,0x38,0x70,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0e,0x1c,0x18 }, |
| 240 | { 0x00,0x00,0x03,0x03,0x03,0x03,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00,0x00,0x00 }, |
| 241 | { 0x60,0x70,0x38,0x1c,0x0e,0x07,0x0e,0x1c,0x38,0x70,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 242 | { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 }, |
| 243 | { 0x00,0x00,0x00,0x00,0x3e,0x7e,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 244 | { 0x00,0x40,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0xc0,0x00,0x1c,0x3e,0x33,0x33,0x33,0x33,0x33,0x33,0x3f,0x3f,0x00 }, |
| 245 | { 0xff,0xff,0xc0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30,0x38,0x1f,0x0f,0x00 }, |
| 246 | { 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xc0,0x80,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x30,0x18,0x08,0x00 }, |
| 247 | { 0x80,0xc0,0xe0,0x60,0x60,0x60,0xe0,0xc0,0xff,0xff,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00 }, |
| 248 | { 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xc0,0x80,0x00,0x0f,0x1f,0x3b,0x33,0x33,0x33,0x33,0x33,0x13,0x01,0x00 }, |
| 249 | { 0xc0,0xc0,0xfc,0xfe,0xc7,0xc3,0xc3,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 250 | { 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x00,0x03,0xc7,0xce,0xcc,0xcc,0xcc,0xcc,0xe6,0x7f,0x3f,0x00 }, |
| 251 | { 0xff,0xff,0xc0,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00 }, |
| 252 | { 0x00,0x00,0x00,0x60,0xec,0xec,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x3f,0x3f,0x30,0x30,0x00,0x00,0x00 }, |
| 253 | { 0x00,0x00,0x00,0x00,0x00,0x60,0xec,0xec,0x00,0x00,0x00,0x00,0x00,0x60,0xe0,0xc0,0xc0,0xff,0x7f,0x00,0x00,0x00 }, |
| 254 | { 0x00,0xff,0xff,0x00,0x80,0xc0,0xe0,0x60,0x00,0x00,0x00,0x00,0x3f,0x3f,0x03,0x07,0x0f,0x1c,0x38,0x30,0x00,0x00 }, |
| 255 | { 0x00,0x00,0x00,0x03,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x3f,0x3f,0x30,0x30,0x00,0x00,0x00 }, |
| 256 | { 0xe0,0xc0,0xe0,0xe0,0xc0,0xc0,0xe0,0xe0,0xc0,0x80,0x00,0x3f,0x3f,0x00,0x00,0x3f,0x3f,0x00,0x00,0x3f,0x3f,0x00 }, |
| 257 | { 0x00,0xe0,0xe0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00 }, |
| 258 | { 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x38,0x1f,0x0f,0x00 }, |
| 259 | { 0xe0,0xe0,0x60,0x60,0x60,0x60,0x60,0xe0,0xc0,0x80,0x00,0xff,0xff,0x0c,0x18,0x18,0x18,0x18,0x1c,0x0f,0x07,0x00 }, |
| 260 | { 0x80,0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x00,0x07,0x0f,0x1c,0x18,0x18,0x18,0x18,0x0c,0xff,0xff,0x00 }, |
| 261 | { 0x00,0xe0,0xe0,0xc0,0x60,0x60,0x60,0x60,0xe0,0xc0,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 262 | { 0xc0,0xe0,0x60,0x60,0x60,0x60,0x60,0x40,0x00,0x00,0x00,0x11,0x33,0x33,0x33,0x33,0x33,0x3f,0x1e,0x00,0x00,0x00 }, |
| 263 | { 0x60,0x60,0xfe,0xfe,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x3f,0x30,0x30,0x30,0x30,0x00,0x00,0x00 }, |
| 264 | { 0xe0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0x00,0x0f,0x1f,0x38,0x30,0x30,0x30,0x30,0x18,0x3f,0x3f,0x00 }, |
| 265 | { 0x60,0xe0,0x80,0x00,0x00,0x00,0x00,0x80,0xe0,0x60,0x00,0x00,0x01,0x07,0x1e,0x38,0x38,0x1e,0x07,0x01,0x00,0x00 }, |
| 266 | { 0xe0,0xe0,0x00,0x00,0xe0,0xe0,0x00,0x00,0xe0,0xe0,0x00,0x07,0x1f,0x38,0x1c,0x0f,0x0f,0x1c,0x38,0x1f,0x07,0x00 }, |
| 267 | { 0x60,0xe0,0xc0,0x80,0x00,0x80,0xc0,0xe0,0x60,0x00,0x00,0x30,0x38,0x1d,0x0f,0x07,0x0f,0x1d,0x38,0x30,0x00,0x00 }, |
| 268 | { 0x00,0x60,0xe0,0x80,0x00,0x00,0x80,0xe0,0x60,0x00,0x00,0x00,0x00,0x81,0xe7,0x7e,0x1e,0x07,0x01,0x00,0x00,0x00 }, |
| 269 | { 0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x60,0x20,0x00,0x00,0x30,0x38,0x3c,0x36,0x33,0x31,0x30,0x30,0x30,0x00,0x00 }, |
| 270 | { 0x00,0x80,0xc0,0xfc,0x7e,0x07,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x01,0x1f,0x3f,0x70,0x60,0x60,0x60,0x00,0x00 }, |
| 271 | { 0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00 }, |
| 272 | { 0x00,0x03,0x03,0x03,0x07,0x7e,0xfc,0xc0,0x80,0x00,0x00,0x00,0x60,0x60,0x60,0x70,0x3f,0x1f,0x01,0x00,0x00,0x00 }, |
| 273 | { 0x10,0x18,0x0c,0x04,0x0c,0x18,0x10,0x18,0x0c,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, |
| 274 | { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00 } |
Daniel Stenberg | 48c2350 | 2002-09-13 06:32:25 +0000 | [diff] [blame] | 275 | }; |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 276 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 277 | static signed char speed[]={ |
| 278 | 1,2,3,3,3,2,1,0,-1,-2,-2,-2,-1,0,0,1, |
| 279 | }; |
| 280 | |
| 281 | #if LCD_WIDTH > LCD_HEIGHT /* landscape LCD */ |
| 282 | |
| 283 | #define TABLE_SIZE LCD_HEIGHT |
| 284 | #define RADIUS_MINUTE (3*LCD_HEIGHT/8) |
| 285 | #define RADIUS_HOUR (LCD_HEIGHT/4) |
| 286 | |
| 287 | #else /* portrait (or square) LCD */ |
| 288 | |
| 289 | #define TABLE_SIZE LCD_WIDTH |
| 290 | #define RADIUS_MINUTE (3*LCD_WIDTH/8) |
| 291 | #define RADIUS_HOUR (LCD_WIDTH/4) |
| 292 | |
| 293 | #endif /* LCD orientation */ |
| 294 | |
| 295 | #define RADIUS_X ((LCD_WIDTH-LETTER_WIDTH)/2) |
| 296 | #define RADIUS_Y ((LCD_HEIGHT-LETTER_HEIGHT)/2) |
| 297 | |
| 298 | #define PHASE_STEP (0xffffffff/TABLE_SIZE) |
| 299 | #define PHASE_FRAC (0xffffffff%TABLE_SIZE) |
| 300 | #define DIV_X (0x7ffffffe/RADIUS_X+1) |
| 301 | #define DIV_Y (0x7ffffffe/RADIUS_Y+1) |
| 302 | |
| 303 | static int xtable[TABLE_SIZE]; |
| 304 | static int ytable[TABLE_SIZE]; |
| 305 | |
| 306 | static void init_tables(void) |
| 307 | { |
| 308 | int i; |
| 309 | int pfrac; |
| 310 | unsigned long phase; |
| 311 | long sin; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 312 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 313 | phase = pfrac = 0; |
| 314 | |
| 315 | for (i = 0; i < TABLE_SIZE; i++) { |
| 316 | sin = fsincos(phase, NULL); |
| 317 | xtable[i] = RADIUS_X + sin / DIV_X; |
| 318 | ytable[i] = RADIUS_Y + sin / DIV_Y; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 319 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 320 | phase += PHASE_STEP; |
| 321 | pfrac += PHASE_FRAC; |
| 322 | if (pfrac >= TABLE_SIZE) { |
| 323 | pfrac -= TABLE_SIZE; |
| 324 | phase++; |
| 325 | } |
| 326 | } |
| 327 | } |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 328 | |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 329 | enum { |
| 330 | NUM_XSANKE, |
| 331 | NUM_YSANKE, |
| 332 | NUM_XADD, |
| 333 | NUM_YADD, |
| 334 | NUM_XDIST, |
| 335 | NUM_YDIST, |
| 336 | |
| 337 | NUM_LAST |
| 338 | }; |
| 339 | |
| 340 | struct counter { |
| 341 | char *what; |
| 342 | int num; |
| 343 | }; |
| 344 | |
| 345 | struct counter values[]={ |
| 346 | {"xsanke", 1}, |
| 347 | {"ysanke", 1}, |
| 348 | {"xadd", 1}, |
Daniel Stenberg | aa3ab73 | 2005-02-08 22:38:23 +0000 | [diff] [blame] | 349 | {"yadd", 2}, |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 350 | {"xdist", -4}, |
Jens Arnold | 2a461eb | 2004-12-15 18:54:29 +0000 | [diff] [blame] | 351 | {"ydist", -6}, |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 352 | }; |
| 353 | |
Jens Arnold | 2c7b127 | 2007-03-16 23:47:03 +0000 | [diff] [blame] | 354 | #if CONFIG_RTC |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 355 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 356 | #define CLOCK_STEP (0xffffffff/60) |
| 357 | #define CLOCK_FRAC (0xffffffff%60) |
| 358 | |
| 359 | #define DIV_MY (0x7ffffffe/RADIUS_MINUTE+1) |
| 360 | #define DIV_HY (0x7ffffffe/RADIUS_HOUR+1) |
| 361 | |
| 362 | #if LCD_WIDTH == 112 && LCD_HEIGHT == 64 /* Archos LCD: non-square pixels */ |
| 363 | #define DIV_MX (0x7ffffffe/(5*RADIUS_MINUTE/4)+1) |
| 364 | #define DIV_HX (0x7ffffffe/(5*RADIUS_HOUR/4)+1) |
| 365 | #else /* Square pixels */ |
| 366 | #define DIV_MX DIV_MY |
| 367 | #define DIV_HX DIV_HY |
| 368 | #endif |
| 369 | |
| 370 | static int xminute[60], yminute[60]; |
| 371 | static int xhour[60], yhour[60]; |
| 372 | |
| 373 | static void init_clock(void) |
| 374 | { |
| 375 | int i; |
| 376 | int pfrac; |
| 377 | unsigned long phase; |
| 378 | long sin, cos; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 379 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 380 | phase = pfrac = 0; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 381 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 382 | for (i = 0; i < 60; i++) { |
| 383 | sin = fsincos(phase, &cos); |
| 384 | xminute[i] = LCD_WIDTH/2 + sin / DIV_MX; |
| 385 | yminute[i] = LCD_HEIGHT/2 - cos / DIV_MY; |
| 386 | xhour[i] = LCD_WIDTH/2 + sin / DIV_HX; |
| 387 | yhour[i] = LCD_HEIGHT/2 - cos / DIV_HY; |
| 388 | |
| 389 | phase += CLOCK_STEP; |
| 390 | pfrac += CLOCK_FRAC; |
| 391 | if (pfrac >= 60) { |
| 392 | pfrac -= 60; |
| 393 | phase++; |
| 394 | } |
| 395 | } |
| 396 | } |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 397 | |
| 398 | static void addclock(void) |
| 399 | { |
| 400 | int i; |
| 401 | int hour; |
| 402 | int minute; |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 403 | |
Björn Stenberg | 4b9a267 | 2003-12-06 23:22:29 +0000 | [diff] [blame] | 404 | struct tm* current_time = rb->get_time(); |
| 405 | hour = current_time->tm_hour; |
| 406 | minute = current_time->tm_min; |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 407 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 408 | rb->lcd_drawline(LCD_WIDTH/2, LCD_HEIGHT/2, |
| 409 | xminute[minute], yminute[minute]); |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 410 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 411 | hour = (hour % 12) * 5 + minute / 12; |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 412 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 413 | rb->lcd_drawline(LCD_WIDTH/2, LCD_HEIGHT/2, xhour[hour], yhour[hour]); |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 414 | |
| 415 | /* draw a circle */ |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 416 | for(i = 1; i < 60; i += 3) |
| 417 | rb->lcd_drawline(xminute[i], yminute[i], |
| 418 | xminute[(i+1)%60], yminute[(i+1)%60]); |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 419 | } |
Dave Chapman | 8c800cf | 2005-12-04 15:23:47 +0000 | [diff] [blame] | 420 | #endif /* CONFIG_RTC */ |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 421 | |
Daniel Stenberg | 4a53253 | 2005-07-14 12:29:39 +0000 | [diff] [blame] | 422 | #if LCD_DEPTH > 1 |
Jens Arnold | 5b2cba1 | 2005-11-16 21:09:23 +0000 | [diff] [blame] | 423 | static const unsigned face_colors[] = |
| 424 | { |
Jens Arnold | b0e056b | 2005-07-19 10:33:41 +0000 | [diff] [blame] | 425 | #ifdef HAVE_LCD_COLOR |
Jens Arnold | 5b2cba1 | 2005-11-16 21:09:23 +0000 | [diff] [blame] | 426 | LCD_BLACK, LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(255, 0, 0) |
Jens Arnold | b0e056b | 2005-07-19 10:33:41 +0000 | [diff] [blame] | 427 | #else |
Jens Arnold | 5b2cba1 | 2005-11-16 21:09:23 +0000 | [diff] [blame] | 428 | LCD_BLACK, LCD_LIGHTGRAY, LCD_DARKGRAY |
Daniel Stenberg | 4a53253 | 2005-07-14 12:29:39 +0000 | [diff] [blame] | 429 | #endif |
Jens Arnold | 5b2cba1 | 2005-11-16 21:09:23 +0000 | [diff] [blame] | 430 | }; |
Jens Arnold | b0e056b | 2005-07-19 10:33:41 +0000 | [diff] [blame] | 431 | #endif |
Daniel Stenberg | e26d976 | 2005-07-14 11:55:55 +0000 | [diff] [blame] | 432 | |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 433 | static int scrollit(void) |
| 434 | { |
| 435 | int b; |
| 436 | unsigned int y=100; |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 437 | unsigned int yy; |
| 438 | int x = LCD_WIDTH; |
| 439 | int xx; |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 440 | unsigned int i; |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 441 | unsigned int textpos=0; |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 442 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 443 | char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) "; |
Linus Nielsen Feltzing | 10ac8a8 | 2003-06-30 02:07:20 +0000 | [diff] [blame] | 444 | unsigned int rocklen = rb->strlen(rock); |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 445 | int letter; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 446 | #if LCD_DEPTH > 1 |
| 447 | unsigned prev_color; |
| 448 | #endif |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 449 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 450 | rb->lcd_clear_display(); |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 451 | while(1) |
| 452 | { |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 453 | b = rb->button_get_w_tmo(HZ/10); |
Kevin Ferrare | 0e027bd | 2006-06-30 16:43:47 +0000 | [diff] [blame] | 454 | switch(b) |
| 455 | { |
| 456 | #ifdef BOUNCE_RC_QUIT |
| 457 | case BOUNCE_RC_QUIT : |
| 458 | #endif |
| 459 | case BOUNCE_QUIT : |
| 460 | return 0; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 461 | case BOUNCE_MODE : |
Kevin Ferrare | 0e027bd | 2006-06-30 16:43:47 +0000 | [diff] [blame] | 462 | return 1; |
| 463 | default: |
| 464 | if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) |
| 465 | return -1; |
| 466 | } |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 467 | rb->lcd_clear_display(); |
Jens Arnold | 2c7b127 | 2007-03-16 23:47:03 +0000 | [diff] [blame] | 468 | #if CONFIG_RTC |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 469 | addclock(); |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 470 | #endif |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 471 | |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 472 | #if LCD_DEPTH > 1 |
| 473 | prev_color = rb->lcd_get_foreground(); |
| 474 | #endif |
| 475 | |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 476 | for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) { |
| 477 | letter = rock[(i+textpos) % rocklen ]; |
| 478 | #if LCD_DEPTH > 1 |
| 479 | rb->lcd_set_foreground(face_colors[letter % 3]); |
| 480 | #endif |
| 481 | rb->lcd_mono_bitmap(char_gen_12x16[letter-0x20], |
| 482 | xx, ytable[yy % TABLE_SIZE], |
| 483 | LETTER_WIDTH, LETTER_HEIGHT); |
| 484 | yy += YADD; |
| 485 | xx += LETTER_WIDTH; |
| 486 | } |
| 487 | #if LCD_DEPTH > 1 |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 488 | rb->lcd_set_foreground(prev_color); |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 489 | #endif |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 490 | rb->lcd_update(); |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 491 | |
| 492 | x-= XSPEED; |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 493 | |
Daniel Stenberg | e26d976 | 2005-07-14 11:55:55 +0000 | [diff] [blame] | 494 | if(x < -LETTER_WIDTH) { |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 495 | x += LETTER_WIDTH; |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 496 | y += YADD; |
| 497 | textpos++; |
| 498 | } |
| 499 | |
| 500 | y+=YSPEED; |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 501 | } |
| 502 | } |
| 503 | |
| 504 | static int loopit(void) |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 505 | { |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 506 | int b; |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 507 | unsigned int y=100; |
| 508 | unsigned int x=100; |
| 509 | unsigned int yy,xx; |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 510 | unsigned int i; |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 511 | unsigned int ysanke=0; |
| 512 | unsigned int xsanke=0; |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 513 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 514 | char* rock="ROCKbox"; |
Linus Nielsen Feltzing | 10ac8a8 | 2003-06-30 02:07:20 +0000 | [diff] [blame] | 515 | unsigned int rocklen = rb->strlen(rock); |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 516 | |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 517 | int show=0; |
| 518 | int timeout=0; |
| 519 | char buffer[30]; |
| 520 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 521 | rb->lcd_clear_display(); |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 522 | while(1) |
| 523 | { |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 524 | b = rb->button_get_w_tmo(HZ/10); |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 525 | if ( b == BOUNCE_QUIT ) |
Jens Arnold | 56fd6f9 | 2004-08-30 17:21:15 +0000 | [diff] [blame] | 526 | return 0; |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 527 | |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 528 | if ( b == BOUNCE_MODE ) |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 529 | return 1; |
Jens Arnold | 56fd6f9 | 2004-08-30 17:21:15 +0000 | [diff] [blame] | 530 | |
| 531 | if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) |
| 532 | return -1; |
| 533 | |
| 534 | if ( b != BUTTON_NONE ) |
| 535 | timeout=20; |
Linus Nielsen Feltzing | 5f8f4a3 | 2004-07-26 23:32:37 +0000 | [diff] [blame] | 536 | |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 537 | y+= speed[ysanke&15] + values[NUM_YADD].num; |
| 538 | x+= speed[xsanke&15] + values[NUM_XADD].num; |
Daniel Stenberg | 6f79d25 | 2002-08-13 15:01:59 +0000 | [diff] [blame] | 539 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 540 | rb->lcd_clear_display(); |
Jens Arnold | 2c7b127 | 2007-03-16 23:47:03 +0000 | [diff] [blame] | 541 | #if CONFIG_RTC |
Daniel Stenberg | 33adade | 2002-10-11 20:15:22 +0000 | [diff] [blame] | 542 | addclock(); |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 543 | #endif |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 544 | if(timeout) { |
| 545 | switch(b) { |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 546 | case BOUNCE_LEFT: |
| 547 | case BOUNCE_LEFT|BUTTON_REPEAT: |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 548 | values[show].num--; |
| 549 | break; |
Jens Arnold | 29361ab | 2008-03-22 10:24:28 +0000 | [diff] [blame] | 550 | case BOUNCE_RIGHT: |
| 551 | case BOUNCE_RIGHT|BUTTON_REPEAT: |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 552 | values[show].num++; |
| 553 | break; |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 554 | case BOUNCE_UP: |
Michael Sevakis | 8970055 | 2007-05-22 06:31:44 +0000 | [diff] [blame] | 555 | case BOUNCE_UP|BUTTON_REPEAT: |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 556 | if(++show == NUM_LAST) |
| 557 | show=0; |
| 558 | break; |
Dave Chapman | 54d44c8 | 2005-12-14 01:31:37 +0000 | [diff] [blame] | 559 | case BOUNCE_DOWN: |
Michael Sevakis | 8970055 | 2007-05-22 06:31:44 +0000 | [diff] [blame] | 560 | case BOUNCE_DOWN|BUTTON_REPEAT: |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 561 | if(--show < 0) |
| 562 | show=NUM_LAST-1; |
| 563 | break; |
| 564 | } |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 565 | rb->snprintf(buffer, 30, "%s: %d", |
| 566 | values[show].what, values[show].num); |
Daniel Stenberg | 72f4235 | 2005-12-02 08:08:54 +0000 | [diff] [blame] | 567 | rb->lcd_putsxy(0, LCD_HEIGHT - 8, (unsigned char *)buffer); |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 568 | timeout--; |
| 569 | } |
| 570 | for(i=0, yy=y, xx=x; |
Linus Nielsen Feltzing | 10ac8a8 | 2003-06-30 02:07:20 +0000 | [diff] [blame] | 571 | i<rocklen; |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 572 | i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num) |
Daniel Stenberg | 72f4235 | 2005-12-02 08:08:54 +0000 | [diff] [blame] | 573 | rb->lcd_mono_bitmap(char_gen_12x16[rock[i]-0x20], |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 574 | xtable[xx % TABLE_SIZE], |
| 575 | ytable[yy % TABLE_SIZE], |
| 576 | LETTER_WIDTH, LETTER_HEIGHT); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 577 | rb->lcd_update(); |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 578 | |
Daniel Stenberg | 9381765 | 2002-09-06 12:05:37 +0000 | [diff] [blame] | 579 | ysanke+= values[NUM_YSANKE].num; |
| 580 | xsanke+= values[NUM_XSANKE].num; |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 581 | } |
| 582 | } |
| 583 | |
| 584 | |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 585 | enum plugin_status plugin_start(const struct plugin_api* api, |
| 586 | const void* parameter) |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 587 | { |
| 588 | int w, h; |
| 589 | char *off = "[Off] to stop"; |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 590 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 591 | (void)(parameter); |
| 592 | rb = api; |
Robert Hak | 8f11dc0 | 2002-10-29 10:45:29 +0000 | [diff] [blame] | 593 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 594 | rb->lcd_setfont(FONT_SYSFIXED); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 595 | rb->lcd_clear_display(); |
Jens Arnold | 82ea7c3 | 2005-07-19 09:24:29 +0000 | [diff] [blame] | 596 | |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 597 | /* Get horizontel centering for text */ |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 598 | rb->lcd_getstringsize((unsigned char *)SS_TITLE, &w, &h); |
| 599 | rb->lcd_putsxy((LCD_WIDTH/2) - w / 2, (LCD_HEIGHT/2) - h / 2, |
| 600 | (unsigned char *)SS_TITLE); |
| 601 | |
| 602 | /* Get horizontel centering for text */ |
| 603 | rb->lcd_getstringsize((unsigned char *)off, &w, &h); |
| 604 | rb->lcd_putsxy((LCD_WIDTH/2) - w / 2, LCD_HEIGHT - 2 * h, |
| 605 | (unsigned char *)off); |
| 606 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 607 | rb->lcd_update(); |
| 608 | rb->sleep(HZ); |
Jens Arnold | 323c1ed | 2005-07-14 18:34:07 +0000 | [diff] [blame] | 609 | rb->lcd_set_drawmode(DRMODE_FG); |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 610 | init_tables(); |
Jens Arnold | 2c7b127 | 2007-03-16 23:47:03 +0000 | [diff] [blame] | 611 | #if CONFIG_RTC |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 612 | init_clock(); |
| 613 | #endif |
Jens Arnold | 323c1ed | 2005-07-14 18:34:07 +0000 | [diff] [blame] | 614 | |
Daniel Stenberg | f84d6bf | 2002-10-13 12:48:31 +0000 | [diff] [blame] | 615 | do { |
Jens Arnold | 56fd6f9 | 2004-08-30 17:21:15 +0000 | [diff] [blame] | 616 | h = loopit(); |
| 617 | if (h > 0) |
Robert Hak | 8f11dc0 | 2002-10-29 10:45:29 +0000 | [diff] [blame] | 618 | h = scrollit(); |
Jens Arnold | 56fd6f9 | 2004-08-30 17:21:15 +0000 | [diff] [blame] | 619 | } while(h > 0); |
Peter D'Hoye | 83e6be5 | 2008-05-15 22:05:24 +0000 | [diff] [blame] | 620 | |
Jens Arnold | 323c1ed | 2005-07-14 18:34:07 +0000 | [diff] [blame] | 621 | rb->lcd_set_drawmode(DRMODE_SOLID); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 622 | rb->lcd_setfont(FONT_UI); |
Jens Arnold | a4e06d3 | 2006-12-10 23:03:34 +0000 | [diff] [blame] | 623 | |
Jens Arnold | 79afbaf | 2004-10-17 00:54:09 +0000 | [diff] [blame] | 624 | return (h == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED; |
Daniel Stenberg | 733c99f | 2002-06-15 13:29:03 +0000 | [diff] [blame] | 625 | } |