2003-11-04 00:19:51 +00:00
|
|
|
/***************************************************************************
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* __________ __ ___.
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* \/ \/ \/ \/ \/
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
*
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* Copyright (C) 2003 Lee Pilgrim
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
*
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
*
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
* KIND, either express or implied.
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
*
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
**************************************************************************/
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#ifndef SIMULATOR /* The simulator dosen't have a MAS */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#include "plugin.h"
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
static struct plugin_api* rb;
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
{
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
TEST_PLUGIN_API(api);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
(void) parameter;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb = api;
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
/*
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
I hope to make (left/right)_needle_top_y change some day (because it looks
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
like it is stretching) so that is why it is a int and not a #define.
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
*/
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define LEFT_NEEDLE_BOTTOM_X 28
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define LEFT_NEEDLE_BOTTOM_Y 53
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
int left_needle_top_x;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
int left_needle_top_y = 18;
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define RIGHT_NEEDLE_BOTTOM_X 84
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define RIGHT_NEEDLE_BOTTOM_Y 53
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
int right_needle_top_x;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
int right_needle_top_y = 18;
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
while (!PLUGIN_OK)
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
{
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
/* These are to define how far the tip of the needles can go to the
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
left and right. The names are a bit confusing. The LEFT/RIGHT tells
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
which needle it is for, and the L/R at the end tells which side
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
of the needle. */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define MAX_LEFT_L 2
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define MAX_LEFT_R 55
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define MAX_RIGHT_L 57
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#define MAX_RIGHT_R 111
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-10 22:00:27 +00:00
|
|
|
#define MAX_PEAK 0x7FFF
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
left_needle_top_x =
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
(rb->mas_codec_readreg(0xC) *
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
(MAX_LEFT_R - MAX_LEFT_L) / MAX_PEAK) + MAX_LEFT_L;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
right_needle_top_x =
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
(rb->mas_codec_readreg(0xD) *
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
(MAX_RIGHT_R - MAX_RIGHT_L) / MAX_PEAK) + MAX_RIGHT_L;
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
/* Time to draw all of the display stuff!
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
Could I move some of these out of the loop so they don't have to
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
be re-drawn everytime, but still be displayed, or would that
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
improve performance any at all? */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(LEFT_NEEDLE_BOTTOM_X, LEFT_NEEDLE_BOTTOM_Y,
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
left_needle_top_x, left_needle_top_y);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(RIGHT_NEEDLE_BOTTOM_X, RIGHT_NEEDLE_BOTTOM_Y,
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
right_needle_top_x, right_needle_top_y);
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_putsxy(30, 1, "VU Meter");
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
/* The first is the line under "VU Meter" and the second is under
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
the needles. */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(30, 9, 77, 9);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
rb->lcd_drawline(0, 53, 111, 53);
|
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
|
|
|
|
/* These are the needle "covers" - we're going for that
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-10 22:00:27 +00:00
|
|
|
"old fashioned" look */
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
/* The left needle cover - organized from the top line to the bottom */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(27, 48, 29, 48);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(25, 49, 31, 49);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(23, 50, 33, 50);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(22, 51, 34, 51);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(22, 52, 34, 52);
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
/* The right needle cover - organized from the top line to
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
the bottom */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(83, 48, 85, 48);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(81, 49, 87, 49);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(79, 50, 89, 50);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(78, 51, 90, 51);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_drawline(78, 52, 90, 52);
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
|
2003-12-23 22:24:48 +00:00
|
|
|
|
|
|
|
|
2003-11-10 22:00:27 +00:00
|
|
|
/* We must yield once in a while to make sure that the MPEG thread
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-10 22:00:27 +00:00
|
|
|
isn't starved, but we use the shortest possible timeout for best
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-10 22:00:27 +00:00
|
|
|
performance */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-11 11:03:59 +00:00
|
|
|
switch (rb->button_get_w_tmo(1))
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
{
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
case BUTTON_OFF:
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-10 22:00:27 +00:00
|
|
|
return PLUGIN_OK;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
}
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
}
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
}
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2003-11-04 00:19:51 +00:00
|
|
|
#endif /* #ifndef SIMULATOR */
|
2003-12-23 22:24:48 +00:00
|
|
|
|