2004-11-07 10:31:39 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2006-03-11 01:13:51 +00:00
|
|
|
* Oscilloscope, with many different modes of operation.
|
2004-11-07 10:31:39 +00:00
|
|
|
*
|
2006-03-09 07:52:26 +00:00
|
|
|
* Copyright (C) 2004-2006 Jens Arnold
|
2004-11-07 10:31:39 +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-11-07 10:31:39 +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-11-07 10:31:39 +00:00
|
|
|
|
2006-03-09 07:52:26 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/xlcd.h"
|
|
|
|
#include "lib/configfile.h"
|
2004-11-07 10:31:39 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
PLUGIN_HEADER
|
|
|
|
|
2004-11-07 10:31:39 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_OFF
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_F1
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_F2
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_F3
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_PLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
2004-11-07 10:31:39 +00:00
|
|
|
|
2007-01-14 13:48:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_OFF
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_F1
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_F2
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_F3
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
|
|
|
|
2004-11-07 10:31:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_OFF
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_MENU
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_MENU | BUTTON_REL)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE (BUTTON_MENU | BUTTON_RIGHT)
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION (BUTTON_MENU | BUTTON_LEFT)
|
|
|
|
#define OSCILLOSCOPE_PAUSE (BUTTON_MENU | BUTTON_OFF)
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
2006-03-09 07:52:26 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_OFF
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_MODE
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_REC
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_ON
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
2006-06-30 16:43:47 +00:00
|
|
|
#define OSCILLOSCOPE_RC_QUIT BUTTON_RC_STOP
|
2007-04-09 17:03:48 +00:00
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_SELECT | BUTTON_PLAY)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_PLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_SCROLL_FWD
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_SCROLL_BACK
|
2006-03-09 07:52:26 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_DOWN
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_A
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
2006-03-09 07:52:26 +00:00
|
|
|
|
2006-10-26 13:38:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_DOWN
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_REC
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
2008-01-10 08:08:31 +00:00
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_SCROLL_FWD
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_SCROLL_BACK
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2009-01-04 23:33:15 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_DOWN
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_SCROLL_FWD
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_SCROLL_BACK
|
|
|
|
|
2007-09-20 10:49:48 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_C200_PAD)
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_DOWN
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_REC
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
2008-11-28 00:37:28 +00:00
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == SANSA_CLIP_PAD)
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_DOWN
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_HOME
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
2007-09-20 10:49:48 +00:00
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_M200_PAD)
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_DOWN
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_PAUSE (BUTTON_SELECT | BUTTON_UP)
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_REC
|
2007-04-09 17:03:48 +00:00
|
|
|
#define OSCILLOSCOPE_ORIENTATION_PRE BUTTON_SELECT
|
2006-03-11 01:13:51 +00:00
|
|
|
#define OSCILLOSCOPE_ORIENTATION (BUTTON_SELECT | BUTTON_REPEAT)
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_PLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
2004-11-07 10:31:39 +00:00
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_REW
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_REW | BUTTON_REL)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_FF
|
2007-04-09 17:03:48 +00:00
|
|
|
#define OSCILLOSCOPE_ORIENTATION_PRE BUTTON_REW
|
2006-08-03 20:17:25 +00:00
|
|
|
#define OSCILLOSCOPE_ORIENTATION (BUTTON_REW | BUTTON_REPEAT)
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_PLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_SCROLL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_SCROLL_DOWN
|
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_BACK
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_PREV
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_NEXT
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_MENU
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_PLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_MENU
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_PLAY
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_DISPLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
2008-02-17 12:23:02 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_RC_REC
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_RC_MODE
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE (BUTTON_RC_MODE|BUTTON_REL)
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_RC_MENU
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION_PRE BUTTON_RC_MODE
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION (BUTTON_RC_MODE|BUTTON_REPEAT)
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_RC_PLAY
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RC_FF
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_RC_REW
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_RC_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
|
2008-03-22 22:03:34 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWOND2_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_PLUS
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_MINUS
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_BACK
|
2008-12-08 09:51:42 +00:00
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_SELECT
|
2008-12-04 21:28:56 +00:00
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_CUSTOM
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_MENU
|
2008-12-08 09:51:42 +00:00
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_PLAY
|
2008-12-04 21:28:56 +00:00
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_MENU
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_VIEW
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_UP
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_SELECT
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
2009-04-07 23:41:44 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_POWER
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-11-07 10:31:39 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef OSCILLOSCOPE_QUIT
|
|
|
|
#define OSCILLOSCOPE_QUIT BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_DRAWMODE
|
|
|
|
#define OSCILLOSCOPE_DRAWMODE BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_ADVMODE
|
|
|
|
#define OSCILLOSCOPE_ADVMODE BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_ORIENTATION
|
|
|
|
#define OSCILLOSCOPE_ORIENTATION BUTTON_BOTTOMLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_PAUSE
|
|
|
|
#define OSCILLOSCOPE_PAUSE BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_SPEED_UP
|
|
|
|
#define OSCILLOSCOPE_SPEED_UP BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_SPEED_DOWN
|
|
|
|
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_VOL_UP
|
|
|
|
#define OSCILLOSCOPE_VOL_UP BUTTON_TOPRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef OSCILLOSCOPE_VOL_DOWN
|
|
|
|
#define OSCILLOSCOPE_VOL_DOWN BUTTON_BOTTOMRIGHT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
/* colours */
|
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
#define BACKG_COLOR LCD_BLACK
|
|
|
|
#define GRAPH_COLOR LCD_RGBPACK(128, 255, 0)
|
|
|
|
#define CURSOR_COLOR LCD_RGBPACK(255, 0, 0)
|
|
|
|
#else
|
|
|
|
#define BACKG_COLOR LCD_WHITE
|
|
|
|
#define GRAPH_COLOR LCD_BLACK
|
|
|
|
#define CURSOR_COLOR LCD_DARKGRAY
|
|
|
|
#endif
|
2006-03-09 07:52:26 +00:00
|
|
|
#endif
|
2004-11-07 10:31:39 +00:00
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
enum { DRAW_FILLED, DRAW_LINE, DRAW_PIXEL, MAX_DRAW };
|
|
|
|
enum { ADV_SCROLL, ADV_WRAP, MAX_ADV };
|
|
|
|
enum { OSC_HORIZ, OSC_VERT, MAX_OSC };
|
2006-03-10 00:18:58 +00:00
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
#define CFGFILE_VERSION 0 /* Current config file version */
|
|
|
|
#define CFGFILE_MINVERSION 0 /* Minimum config file version to accept */
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_PEAK 0x8000
|
|
|
|
|
|
|
|
#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
|
|
|
|
#define mas_codec_readreg(x) rand()%MAX_PEAK
|
|
|
|
#endif
|
2006-03-10 00:18:58 +00:00
|
|
|
|
2004-11-07 10:31:39 +00:00
|
|
|
/* global variables */
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
/* settings */
|
2006-03-11 08:35:45 +00:00
|
|
|
struct osc_config {
|
|
|
|
int delay; /* in ticks */
|
|
|
|
int draw;
|
|
|
|
int advance;
|
|
|
|
int orientation;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct osc_config osc_disk = { 2, DRAW_FILLED, ADV_SCROLL, OSC_HORIZ };
|
|
|
|
struct osc_config osc; /* running config */
|
2006-03-11 01:13:51 +00:00
|
|
|
|
|
|
|
static const char cfg_filename[] = "oscilloscope.cfg";
|
|
|
|
static char *draw_str[3] = { "filled", "line", "pixel" };
|
|
|
|
static char *advance_str[2] = { "scroll", "wrap" };
|
|
|
|
static char *orientation_str[2] = { "horizontal", "vertical" };
|
|
|
|
|
2006-03-11 08:35:45 +00:00
|
|
|
struct configdata disk_config[] = {
|
2009-01-17 22:53:12 +00:00
|
|
|
{ TYPE_INT, 1, 99, { .int_p = &osc_disk.delay }, "delay", NULL },
|
|
|
|
{ TYPE_ENUM, 0, MAX_DRAW, { .int_p = &osc_disk.draw }, "draw", draw_str },
|
|
|
|
{ TYPE_ENUM, 0, MAX_ADV, { .int_p = &osc_disk.advance }, "advance",
|
|
|
|
advance_str },
|
|
|
|
{ TYPE_ENUM, 0, MAX_OSC, { .int_p = &osc_disk.orientation }, "orientation",
|
|
|
|
orientation_str }
|
2006-03-11 01:13:51 +00:00
|
|
|
};
|
2006-03-10 00:18:58 +00:00
|
|
|
|
2006-03-11 08:35:45 +00:00
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
long last_tick = 0; /* time of last drawing */
|
|
|
|
int last_pos = 0; /* last x or y drawing position. Reset for aspect switch. */
|
|
|
|
int last_left; /* last channel values */
|
|
|
|
int last_right;
|
|
|
|
|
|
|
|
unsigned char message[16]; /* message to display */
|
|
|
|
bool displaymsg = false;
|
|
|
|
int font_height = 8;
|
2004-11-07 10:31:39 +00:00
|
|
|
|
|
|
|
/* implementation */
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
void anim_horizontal(int cur_left, int cur_right)
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
2006-03-09 07:52:26 +00:00
|
|
|
int cur_x, x;
|
|
|
|
int left, right, dl, dr;
|
|
|
|
long cur_tick = *rb->current_tick;
|
2006-03-11 08:35:45 +00:00
|
|
|
long d = (cur_tick - last_tick) / osc.delay;
|
2004-11-07 10:31:39 +00:00
|
|
|
bool full_update = false;
|
|
|
|
|
2006-03-09 07:52:26 +00:00
|
|
|
if (d == 0) /* too early, bail out */
|
|
|
|
return;
|
|
|
|
|
|
|
|
last_tick = cur_tick;
|
|
|
|
|
|
|
|
if (d > HZ) /* first call or too much delay, (re)start */
|
|
|
|
{
|
|
|
|
last_left = cur_left;
|
|
|
|
last_right = cur_right;
|
|
|
|
return;
|
|
|
|
}
|
2006-03-10 00:18:58 +00:00
|
|
|
cur_x = last_pos + d;
|
2006-03-09 07:52:26 +00:00
|
|
|
|
|
|
|
if (cur_x >= LCD_WIDTH)
|
|
|
|
{
|
2006-03-11 08:35:45 +00:00
|
|
|
if (osc.advance == ADV_SCROLL)
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
|
|
|
int shift = cur_x - (LCD_WIDTH-1);
|
|
|
|
xlcd_scroll_left(shift);
|
|
|
|
full_update = true;
|
|
|
|
cur_x -= shift;
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos -= shift;
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
2006-03-11 01:13:51 +00:00
|
|
|
else
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
2006-03-09 07:52:26 +00:00
|
|
|
cur_x -= LCD_WIDTH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
if (cur_x > last_pos)
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
rb->lcd_fillrect(last_pos + 1, 0, d, LCD_HEIGHT);
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
rb->lcd_fillrect(last_pos + 1, 0, LCD_WIDTH - last_pos, LCD_HEIGHT);
|
|
|
|
rb->lcd_fillrect(0, 0, cur_x + 1, LCD_HEIGHT);
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
|
2006-03-11 08:35:45 +00:00
|
|
|
switch (osc.draw)
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
case DRAW_FILLED:
|
2006-03-09 07:52:26 +00:00
|
|
|
left = last_left;
|
|
|
|
right = last_right;
|
|
|
|
dl = (cur_left - left) / d;
|
|
|
|
dr = (cur_right - right) / d;
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
for (x = last_pos + 1; d > 0; x++, d--)
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
2006-03-09 07:52:26 +00:00
|
|
|
if (x == LCD_WIDTH)
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
left += dl;
|
|
|
|
right += dr;
|
|
|
|
|
|
|
|
rb->lcd_vline(x, LCD_HEIGHT/2-1,
|
2006-03-10 00:18:58 +00:00
|
|
|
LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * left) >> 16));
|
|
|
|
rb->lcd_vline(x, LCD_HEIGHT/2+1,
|
|
|
|
LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * right) >> 16));
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
case DRAW_LINE:
|
2006-03-10 00:18:58 +00:00
|
|
|
if (cur_x > last_pos)
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
|
|
|
rb->lcd_drawline(
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * last_left) >> 16),
|
|
|
|
cur_x, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * cur_left) >> 16)
|
2006-03-09 07:52:26 +00:00
|
|
|
);
|
|
|
|
rb->lcd_drawline(
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * last_right) >> 16),
|
|
|
|
cur_x, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * cur_right) >> 16)
|
2006-03-09 07:52:26 +00:00
|
|
|
);
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
|
|
|
else
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
|
|
|
left = last_left
|
2006-03-10 00:18:58 +00:00
|
|
|
+ (LCD_WIDTH - last_pos) * (last_left - cur_left) / d;
|
2006-03-09 07:52:26 +00:00
|
|
|
right = last_right
|
2006-03-10 00:18:58 +00:00
|
|
|
+ (LCD_WIDTH - last_pos) * (last_right - cur_right) / d;
|
2006-03-09 07:52:26 +00:00
|
|
|
|
|
|
|
rb->lcd_drawline(
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * last_left) >> 16),
|
|
|
|
LCD_WIDTH, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * left) >> 16)
|
2006-03-09 07:52:26 +00:00
|
|
|
);
|
|
|
|
rb->lcd_drawline(
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * last_right) >> 16),
|
|
|
|
LCD_WIDTH, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * right) >> 16)
|
2006-03-09 07:52:26 +00:00
|
|
|
);
|
2006-03-11 01:13:51 +00:00
|
|
|
if (cur_x > 0)
|
|
|
|
{
|
|
|
|
rb->lcd_drawline(
|
|
|
|
0, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * left) >> 16),
|
|
|
|
cur_x, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * cur_left) >> 16)
|
|
|
|
);
|
|
|
|
rb->lcd_drawline(
|
|
|
|
0, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * right) >> 16),
|
|
|
|
cur_x, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * cur_right) >> 16)
|
|
|
|
);
|
|
|
|
}
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
case DRAW_PIXEL:
|
2006-03-09 07:52:26 +00:00
|
|
|
left = last_left;
|
|
|
|
right = last_right;
|
|
|
|
dl = (cur_left - left) / d;
|
|
|
|
dr = (cur_right - right) / d;
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
for (x = last_pos + 1; d > 0; x++, d--)
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
|
|
|
if (x == LCD_WIDTH)
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
left += dl;
|
|
|
|
right += dr;
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
rb->lcd_drawpixel(x, LCD_HEIGHT/2-1 - (((LCD_HEIGHT-2) * left) >> 16));
|
|
|
|
rb->lcd_drawpixel(x, LCD_HEIGHT/2+1 + (((LCD_HEIGHT-2) * right) >> 16));
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
2006-03-09 07:52:26 +00:00
|
|
|
}
|
|
|
|
last_left = cur_left;
|
|
|
|
last_right = cur_right;
|
2006-03-11 01:13:51 +00:00
|
|
|
|
2006-03-12 13:44:51 +00:00
|
|
|
if (displaymsg)
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
|
|
|
|
rb->lcd_getstringsize(message, &width, NULL);
|
|
|
|
last_pos -= width - 1;
|
|
|
|
rb->lcd_putsxy(last_pos, 0, message);
|
|
|
|
displaymsg = false;
|
|
|
|
|
|
|
|
if (last_pos < 0)
|
|
|
|
last_pos = 0;
|
|
|
|
}
|
|
|
|
|
2006-03-09 07:52:26 +00:00
|
|
|
if (full_update)
|
|
|
|
{
|
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
#if LCD_DEPTH > 1 /* cursor bar */
|
|
|
|
rb->lcd_set_foreground(CURSOR_COLOR);
|
|
|
|
rb->lcd_vline(cur_x + 1, 0, LCD_HEIGHT-1);
|
|
|
|
rb->lcd_set_foreground(GRAPH_COLOR);
|
|
|
|
#else
|
|
|
|
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
|
|
|
|
rb->lcd_vline(cur_x + 1, 0, LCD_HEIGHT-1);
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
#endif
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
if (cur_x > last_pos)
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
2006-03-10 00:18:58 +00:00
|
|
|
rb->lcd_update_rect(last_pos, 0, cur_x - last_pos + 2, LCD_HEIGHT);
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
|
|
|
else
|
2006-03-09 07:52:26 +00:00
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
rb->lcd_update_rect(last_pos, 0, LCD_WIDTH - last_pos, LCD_HEIGHT);
|
2006-03-09 07:52:26 +00:00
|
|
|
rb->lcd_update_rect(0, 0, cur_x + 2, LCD_HEIGHT);
|
|
|
|
}
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos = cur_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void anim_vertical(int cur_left, int cur_right)
|
|
|
|
{
|
|
|
|
int cur_y, y;
|
|
|
|
int left, right, dl, dr;
|
|
|
|
long cur_tick = *rb->current_tick;
|
2006-03-11 08:35:45 +00:00
|
|
|
long d = (cur_tick - last_tick) / osc.delay;
|
2006-03-10 00:18:58 +00:00
|
|
|
bool full_update = false;
|
|
|
|
|
|
|
|
if (d == 0) /* too early, bail out */
|
|
|
|
return;
|
|
|
|
|
|
|
|
last_tick = cur_tick;
|
|
|
|
|
|
|
|
if (d > HZ) /* first call or too much delay, (re)start */
|
|
|
|
{
|
|
|
|
last_left = cur_left;
|
|
|
|
last_right = cur_right;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cur_y = last_pos + d;
|
|
|
|
|
|
|
|
if (cur_y >= LCD_HEIGHT)
|
|
|
|
{
|
2006-03-11 08:35:45 +00:00
|
|
|
if (osc.advance == ADV_SCROLL)
|
2006-03-10 00:18:58 +00:00
|
|
|
{
|
|
|
|
int shift = cur_y - (LCD_HEIGHT-1);
|
|
|
|
xlcd_scroll_up(shift);
|
|
|
|
full_update = true;
|
|
|
|
cur_y -= shift;
|
|
|
|
last_pos -= shift;
|
|
|
|
}
|
2006-03-11 01:13:51 +00:00
|
|
|
else
|
2006-03-10 00:18:58 +00:00
|
|
|
{
|
|
|
|
cur_y -= LCD_HEIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
|
|
|
|
if (cur_y > last_pos)
|
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
rb->lcd_fillrect(0, last_pos + 1, LCD_WIDTH, d);
|
2006-03-10 00:18:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
rb->lcd_fillrect(0, last_pos + 1, LCD_WIDTH, LCD_HEIGHT - last_pos);
|
|
|
|
rb->lcd_fillrect(0, 0, LCD_WIDTH, cur_y + 1);
|
2006-03-10 00:18:58 +00:00
|
|
|
}
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
|
2006-03-11 08:35:45 +00:00
|
|
|
switch (osc.draw)
|
2006-03-10 00:18:58 +00:00
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
case DRAW_FILLED:
|
2006-03-10 00:18:58 +00:00
|
|
|
left = last_left;
|
|
|
|
right = last_right;
|
|
|
|
dl = (cur_left - left) / d;
|
|
|
|
dr = (cur_right - right) / d;
|
|
|
|
|
|
|
|
for (y = last_pos + 1; d > 0; y++, d--)
|
|
|
|
{
|
|
|
|
if (y == LCD_HEIGHT)
|
|
|
|
y = 0;
|
|
|
|
|
|
|
|
left += dl;
|
|
|
|
right += dr;
|
|
|
|
|
|
|
|
rb->lcd_hline(LCD_WIDTH/2-1,
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * left) >> 16), y);
|
|
|
|
rb->lcd_hline(LCD_WIDTH/2+1,
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * right) >> 16), y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
case DRAW_LINE:
|
2006-03-10 00:18:58 +00:00
|
|
|
if (cur_y > last_pos)
|
|
|
|
{
|
|
|
|
rb->lcd_drawline(
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * last_left) >> 16), last_pos,
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * cur_left) >> 16), cur_y
|
|
|
|
);
|
|
|
|
rb->lcd_drawline(
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * last_right) >> 16), last_pos,
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * cur_right) >> 16), cur_y
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
left = last_left
|
|
|
|
+ (LCD_HEIGHT - last_pos) * (last_left - cur_left) / d;
|
|
|
|
right = last_right
|
|
|
|
+ (LCD_HEIGHT - last_pos) * (last_right - cur_right) / d;
|
|
|
|
|
|
|
|
rb->lcd_drawline(
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * last_left) >> 16), last_pos,
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * left) >> 16), LCD_HEIGHT
|
|
|
|
);
|
|
|
|
rb->lcd_drawline(
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * last_right) >> 16), last_pos,
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * right) >> 16), LCD_HEIGHT
|
|
|
|
);
|
2006-03-11 01:13:51 +00:00
|
|
|
if (cur_y > 0)
|
|
|
|
{
|
|
|
|
rb->lcd_drawline(
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * left) >> 16), 0,
|
|
|
|
LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * cur_left) >> 16), cur_y
|
|
|
|
);
|
|
|
|
rb->lcd_drawline(
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * right) >> 16), 0,
|
|
|
|
LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * cur_right) >> 16), cur_y
|
|
|
|
);
|
|
|
|
}
|
2006-03-10 00:18:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
case DRAW_PIXEL:
|
2006-03-10 00:18:58 +00:00
|
|
|
left = last_left;
|
|
|
|
right = last_right;
|
|
|
|
dl = (cur_left - left) / d;
|
|
|
|
dr = (cur_right - right) / d;
|
|
|
|
|
|
|
|
for (y = last_pos + 1; d > 0; y++, d--)
|
|
|
|
{
|
|
|
|
if (y == LCD_HEIGHT)
|
|
|
|
y = 0;
|
|
|
|
|
|
|
|
left += dl;
|
|
|
|
right += dr;
|
|
|
|
|
|
|
|
rb->lcd_drawpixel(LCD_WIDTH/2-1 - (((LCD_WIDTH-2) * left) >> 16), y);
|
|
|
|
rb->lcd_drawpixel(LCD_WIDTH/2+1 + (((LCD_WIDTH-2) * right) >> 16), y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
last_left = cur_left;
|
|
|
|
last_right = cur_right;
|
|
|
|
|
|
|
|
if (displaymsg)
|
|
|
|
{
|
|
|
|
last_pos -= font_height - 1;
|
|
|
|
rb->lcd_putsxy(0, last_pos, message);
|
|
|
|
displaymsg = false;
|
2006-03-12 13:44:51 +00:00
|
|
|
|
|
|
|
if (last_pos < 0)
|
|
|
|
last_pos = 0;
|
2006-03-10 00:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (full_update)
|
|
|
|
{
|
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
#if LCD_DEPTH > 1 /* cursor bar */
|
|
|
|
rb->lcd_set_foreground(CURSOR_COLOR);
|
|
|
|
rb->lcd_hline(0, LCD_WIDTH-1, cur_y + 1);
|
|
|
|
rb->lcd_set_foreground(GRAPH_COLOR);
|
|
|
|
#else
|
|
|
|
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
|
|
|
|
rb->lcd_hline(0, LCD_WIDTH-1, cur_y + 1);
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
#endif
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
if (cur_y > last_pos)
|
|
|
|
{
|
|
|
|
rb->lcd_update_rect(0, last_pos, LCD_WIDTH, cur_y - last_pos + 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-11 01:13:51 +00:00
|
|
|
rb->lcd_update_rect(0, last_pos, LCD_WIDTH, LCD_HEIGHT - last_pos);
|
2006-03-10 00:18:58 +00:00
|
|
|
rb->lcd_update_rect(0, 0, LCD_WIDTH, cur_y + 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
last_pos = cur_y;
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void cleanup(void *parameter)
|
|
|
|
{
|
|
|
|
(void)parameter;
|
2006-03-11 01:13:51 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-03-09 07:52:26 +00:00
|
|
|
rb->lcd_set_foreground(LCD_DEFAULT_FG);
|
|
|
|
rb->lcd_set_background(LCD_DEFAULT_BG);
|
2006-03-11 01:13:51 +00:00
|
|
|
#endif
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn on backlight timeout (revert to settings) */
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_use_settings(); /* backlight control in lib/helper.c */
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
|
|
|
int button, vol;
|
2006-03-09 07:52:26 +00:00
|
|
|
int lastbutton = BUTTON_NONE;
|
2004-11-07 10:31:39 +00:00
|
|
|
bool exit = false;
|
|
|
|
bool paused = false;
|
2006-03-10 00:18:58 +00:00
|
|
|
bool tell_speed;
|
2004-11-07 10:31:39 +00:00
|
|
|
|
|
|
|
(void)parameter;
|
2006-03-11 01:13:51 +00:00
|
|
|
|
2006-03-11 08:35:45 +00:00
|
|
|
configfile_load(cfg_filename, disk_config,
|
|
|
|
sizeof(disk_config) / sizeof(disk_config[0]),
|
2006-03-11 01:13:51 +00:00
|
|
|
CFGFILE_MINVERSION);
|
2006-03-11 08:35:45 +00:00
|
|
|
rb->memcpy(&osc, &osc_disk, sizeof(osc)); /* copy to running config */
|
2006-03-11 01:13:51 +00:00
|
|
|
|
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
rb->lcd_set_foreground(GRAPH_COLOR);
|
|
|
|
rb->lcd_set_background(BACKG_COLOR);
|
2006-11-15 06:14:27 +00:00
|
|
|
rb->lcd_set_backdrop(NULL);
|
2006-03-09 07:52:26 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->lcd_update();
|
2006-03-11 01:13:51 +00:00
|
|
|
#endif
|
2007-08-15 12:42:09 +00:00
|
|
|
|
|
|
|
/* Turn off backlight timeout */
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_force_on(); /* backlight control in lib/helper.c */
|
2007-08-15 12:42:09 +00:00
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
rb->lcd_getstringsize("A", NULL, &font_height);
|
|
|
|
|
2004-11-07 10:31:39 +00:00
|
|
|
while (!exit)
|
|
|
|
{
|
|
|
|
if (!paused)
|
|
|
|
{
|
2006-03-09 07:52:26 +00:00
|
|
|
int left, right;
|
|
|
|
|
2006-03-11 08:35:45 +00:00
|
|
|
rb->sleep(MAX(last_tick + osc.delay - *rb->current_tick - 1, 0));
|
2006-03-09 07:52:26 +00:00
|
|
|
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
|
|
left = rb->mas_codec_readreg(0xC);
|
|
|
|
right = rb->mas_codec_readreg(0xD);
|
|
|
|
#elif (CONFIG_CODEC == SWCODEC)
|
|
|
|
rb->pcm_calculate_peaks(&left, &right);
|
|
|
|
#endif
|
2006-03-11 08:35:45 +00:00
|
|
|
if (osc.orientation == OSC_HORIZ)
|
2006-03-11 01:13:51 +00:00
|
|
|
anim_horizontal(left, right);
|
|
|
|
else
|
|
|
|
anim_vertical(left, right);
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
|
|
|
|
2006-03-10 00:18:58 +00:00
|
|
|
tell_speed = false;
|
2004-11-12 21:40:57 +00:00
|
|
|
button = rb->button_get(paused);
|
2004-11-07 10:31:39 +00:00
|
|
|
switch (button)
|
|
|
|
{
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef OSCILLOSCOPE_RC_QUIT
|
|
|
|
case OSCILLOSCOPE_RC_QUIT:
|
|
|
|
#endif
|
2004-11-07 10:31:39 +00:00
|
|
|
case OSCILLOSCOPE_QUIT:
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
case OSCILLOSCOPE_ADVMODE:
|
2006-03-11 08:35:45 +00:00
|
|
|
if (++osc.advance >= MAX_ADV)
|
|
|
|
osc.advance = 0;
|
2004-11-07 10:31:39 +00:00
|
|
|
break;
|
|
|
|
|
2006-03-11 01:13:51 +00:00
|
|
|
case OSCILLOSCOPE_DRAWMODE:
|
|
|
|
#ifdef OSCILLOSCOPE_DRAWMODE_PRE
|
|
|
|
if (lastbutton != OSCILLOSCOPE_DRAWMODE_PRE)
|
2006-03-09 07:52:26 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2006-03-11 08:35:45 +00:00
|
|
|
if (++osc.draw >= MAX_DRAW)
|
|
|
|
osc.draw = 0;
|
2004-11-07 10:31:39 +00:00
|
|
|
break;
|
2006-03-10 00:18:58 +00:00
|
|
|
|
|
|
|
case OSCILLOSCOPE_ORIENTATION:
|
2007-04-09 17:03:48 +00:00
|
|
|
#ifdef OSCILLOSCOPE_ORIENTATION_PRE
|
|
|
|
if (lastbutton != OSCILLOSCOPE_ORIENTATION_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2006-03-11 08:35:45 +00:00
|
|
|
if (++osc.orientation >= MAX_OSC)
|
|
|
|
osc.orientation = 0;
|
2006-03-10 00:18:58 +00:00
|
|
|
last_pos = 0;
|
2006-03-11 01:13:51 +00:00
|
|
|
last_tick = 0;
|
2006-03-10 00:18:58 +00:00
|
|
|
displaymsg = false;
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->lcd_update();
|
|
|
|
break;
|
2004-11-07 10:31:39 +00:00
|
|
|
|
|
|
|
case OSCILLOSCOPE_PAUSE:
|
|
|
|
paused = !paused;
|
2006-03-09 07:52:26 +00:00
|
|
|
last_tick = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSCILLOSCOPE_SPEED_UP:
|
|
|
|
case OSCILLOSCOPE_SPEED_UP | BUTTON_REPEAT:
|
2006-03-11 08:35:45 +00:00
|
|
|
if (osc.delay > 1)
|
2006-03-10 00:18:58 +00:00
|
|
|
{
|
2006-03-11 08:35:45 +00:00
|
|
|
osc.delay--;
|
2006-03-10 00:18:58 +00:00
|
|
|
tell_speed = true;
|
|
|
|
}
|
2004-11-07 10:31:39 +00:00
|
|
|
break;
|
|
|
|
|
2006-03-09 07:52:26 +00:00
|
|
|
case OSCILLOSCOPE_SPEED_DOWN:
|
|
|
|
case OSCILLOSCOPE_SPEED_DOWN | BUTTON_REPEAT:
|
2006-03-11 08:35:45 +00:00
|
|
|
osc.delay++;
|
2006-03-10 00:18:58 +00:00
|
|
|
tell_speed = true;
|
2006-03-09 07:52:26 +00:00
|
|
|
break;
|
|
|
|
|
2004-11-07 10:31:39 +00:00
|
|
|
case OSCILLOSCOPE_VOL_UP:
|
|
|
|
case OSCILLOSCOPE_VOL_UP | BUTTON_REPEAT:
|
|
|
|
vol = rb->global_settings->volume;
|
2005-12-17 21:13:30 +00:00
|
|
|
if (vol < rb->sound_max(SOUND_VOLUME))
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
|
|
|
vol++;
|
2005-04-01 13:41:03 +00:00
|
|
|
rb->sound_set(SOUND_VOLUME, vol);
|
2004-11-07 10:31:39 +00:00
|
|
|
rb->global_settings->volume = vol;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSCILLOSCOPE_VOL_DOWN:
|
|
|
|
case OSCILLOSCOPE_VOL_DOWN | BUTTON_REPEAT:
|
|
|
|
vol = rb->global_settings->volume;
|
2005-12-17 21:13:30 +00:00
|
|
|
if (vol > rb->sound_min(SOUND_VOLUME))
|
2004-11-07 10:31:39 +00:00
|
|
|
{
|
|
|
|
vol--;
|
2005-04-01 13:41:03 +00:00
|
|
|
rb->sound_set(SOUND_VOLUME, vol);
|
2004-11-07 10:31:39 +00:00
|
|
|
rb->global_settings->volume = vol;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (rb->default_event_handler_ex(button, cleanup, NULL)
|
|
|
|
== SYS_USB_CONNECTED)
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
|
|
|
break;
|
|
|
|
}
|
2006-03-09 07:52:26 +00:00
|
|
|
if (button != BUTTON_NONE)
|
|
|
|
lastbutton = button;
|
2006-03-10 00:18:58 +00:00
|
|
|
|
|
|
|
if (tell_speed)
|
|
|
|
{
|
2006-03-12 13:44:51 +00:00
|
|
|
rb->snprintf(message, sizeof(message), "%s%d",
|
|
|
|
(osc.orientation == OSC_VERT) ? "Speed: " : "",
|
|
|
|
100 / osc.delay);
|
2006-03-10 00:18:58 +00:00
|
|
|
displaymsg = true;
|
|
|
|
}
|
2004-11-07 10:31:39 +00:00
|
|
|
}
|
|
|
|
cleanup(NULL);
|
2006-03-11 08:35:45 +00:00
|
|
|
if (rb->memcmp(&osc, &osc_disk, sizeof(osc))) /* save settings if changed */
|
|
|
|
{
|
|
|
|
rb->memcpy(&osc_disk, &osc, sizeof(osc));
|
|
|
|
configfile_save(cfg_filename, disk_config,
|
|
|
|
sizeof(disk_config) / sizeof(disk_config[0]),
|
|
|
|
CFGFILE_VERSION);
|
|
|
|
}
|
2004-11-07 10:31:39 +00:00
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2006-03-10 00:18:58 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|