2004-06-18 09:05:19 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Kjell Ericson
|
|
|
|
*
|
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-06-18 09:05:19 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "plugin.h"
|
2009-08-05 14:29:29 +00:00
|
|
|
#include "lib/playback_control.h"
|
2004-10-23 00:05:42 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
|
|
|
#define CHC_QUIT BUTTON_OFF
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_F1
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_OK2 BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_OFF
|
|
|
|
|
2007-01-14 13:48:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
|
|
|
#define CHC_QUIT BUTTON_OFF
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_F1
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_OK2 BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_OFF
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
#define CHC_QUIT BUTTON_OFF
|
|
|
|
#define CHC_STARTSTOP BUTTON_RIGHT
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_OK2 BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_MENU
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == PLAYER_PAD
|
|
|
|
#define CHC_QUIT BUTTON_ON
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_STOP
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_STOP
|
|
|
|
#define CHC_SETTINGS_CANCEL2 BUTTON_MENU
|
|
|
|
|
2005-06-29 12:47:24 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2005-02-04 08:36:19 +00:00
|
|
|
#define CHC_QUIT BUTTON_SELECT
|
|
|
|
#define CHC_STARTSTOP BUTTON_ON
|
|
|
|
#define CHC_RESET BUTTON_OFF
|
|
|
|
#define CHC_MENU BUTTON_REC
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_ON
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_OFF
|
|
|
|
#define CHC_SETTINGS_CANCEL2 BUTTON_REC
|
|
|
|
|
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)
|
2005-12-14 01:31:37 +00:00
|
|
|
#define CHC_QUIT BUTTON_PLAY
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_SCROLL_FWD
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_SCROLL_BACK
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_MENU
|
|
|
|
|
2006-01-12 00:35:50 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
|
|
|
#define CHC_QUIT BUTTON_PLAY
|
|
|
|
#define CHC_STARTSTOP BUTTON_MODE
|
|
|
|
#define CHC_RESET BUTTON_EQ
|
|
|
|
#define CHC_MENU BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_PLAY
|
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-01-18 11:09:06 +00:00
|
|
|
#define CHC_QUIT BUTTON_REC
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_POWER
|
2006-02-24 15:06:25 +00:00
|
|
|
#define CHC_MENU BUTTON_SELECT
|
2006-01-18 11:09:06 +00:00
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
2006-02-24 15:06:25 +00:00
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
2006-01-18 11:09:06 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_REC
|
|
|
|
|
2006-02-24 15:42:52 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
2007-05-19 23:38:09 +00:00
|
|
|
#define CHC_QUIT BUTTON_POWER
|
2006-02-24 15:42:52 +00:00
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
2007-05-19 23:38:09 +00:00
|
|
|
#define CHC_RESET BUTTON_A
|
2006-02-24 15:42:52 +00:00
|
|
|
#define CHC_MENU BUTTON_MENU
|
2007-05-19 23:38:09 +00:00
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
2006-02-24 15:42:52 +00:00
|
|
|
|
2007-09-20 10:49:48 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
2009-01-04 23:33:15 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
2009-04-10 17:28:26 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD)
|
2006-10-26 13:38:09 +00:00
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_DOWN
|
|
|
|
#define CHC_MENU BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_DOWN
|
|
|
|
#define CHC_MENU BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL (BUTTON_HOME|BUTTON_REPEAT)
|
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_FF
|
|
|
|
#define CHC_MENU BUTTON_REW
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2007-10-23 15:40:51 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_RC_PLAY
|
|
|
|
#define CHC_RESET BUTTON_RC_HEART
|
|
|
|
#define CHC_MENU BUTTON_RC_MODE
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RC_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_RC_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_RC_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
#define CHC_QUIT BUTTON_BACK
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_PREV
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_BACK
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE100_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_DISPLAY
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define CHC_QUIT BUTTON_RC_REC
|
|
|
|
#define CHC_STARTSTOP BUTTON_RC_PLAY
|
|
|
|
#define CHC_RESET BUTTON_RC_REW
|
|
|
|
#define CHC_MENU BUTTON_RC_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RC_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_RC_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_RC_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_RC_REC
|
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-04-27 15:30:19 +00:00
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_RESET (BUTTON_CENTER|BUTTON_MENU)
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_PLUS
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_MINUS
|
2008-03-22 22:03:34 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2008-10-07 16:38:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOLUP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOLDOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_OK2 BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define CHC_QUIT BUTTON_BACK
|
2008-12-08 09:51:42 +00:00
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
2008-12-04 21:28:56 +00:00
|
|
|
#define CHC_RESET BUTTON_CUSTOM
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
2008-12-08 09:51:42 +00:00
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
2008-12-04 21:28:56 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_BACK
|
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET (BUTTON_BACK|BUTTON_REPEAT)
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_VIEW
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2010-11-02 03:29:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_RIGHT
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_NEXT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_PREV
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2009-12-02 01:56:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_RIGHT
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_NEXT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_PREV
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
2009-12-04 11:41:31 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
2009-12-02 01:56:39 +00:00
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_RESET (BUTTON_VOL_UP|BUTTON_VOL_DOWN)
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2015-07-19 23:50:26 +00:00
|
|
|
#define CHC_QUIT BUTTON_REW
|
2009-08-04 03:08:32 +00:00
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_FFWD
|
|
|
|
#define CHC_MENU BUTTON_LEFT
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
2015-07-19 23:50:26 +00:00
|
|
|
#define CHC_SETTINGS_OK2 BUTTON_RIGHT
|
2009-08-04 03:08:32 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_REW
|
2015-07-19 23:50:26 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL2 BUTTON_LEFT
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-02-11 22:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
#define CHC_QUIT BUTTON_REC
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_PREV
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_OK
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_CANCEL
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
2012-02-02 13:42:42 +00:00
|
|
|
#define CHC_QUIT (BUTTON_REC|BUTTON_PLAY)
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_REW
|
|
|
|
#define CHC_MENU (BUTTON_FUNC|BUTTON_REPEAT)
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_FUNC
|
2010-04-26 21:40:00 +00:00
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_REC
|
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
2012-02-02 13:42:42 +00:00
|
|
|
#define CHC_QUIT (BUTTON_MENU|BUTTON_REPEAT)
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_REW
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_ENTER
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_REC
|
2010-11-30 10:52:14 +00:00
|
|
|
|
2011-10-02 15:39:19 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAYPAUSE
|
|
|
|
#define CHC_RESET BUTTON_BACK
|
2013-07-17 16:43:33 +00:00
|
|
|
#define CHC_MENU (BUTTON_SELECT|BUTTON_REPEAT)
|
2011-10-02 15:39:19 +00:00
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_BACK
|
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_NEXT
|
|
|
|
#define CHC_RESET BUTTON_PREV
|
|
|
|
#define CHC_MENU BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_LEFT
|
|
|
|
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
|
|
|
|
#define CHC_QUIT BUTTON_BACK
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_USER
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_BACK
|
|
|
|
|
2012-03-23 18:32:50 +00:00
|
|
|
#elif CONFIG_KEYPAD == HM60X_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif CONFIG_KEYPAD == HM801_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_PREV
|
|
|
|
|
2014-06-30 18:24:15 +00:00
|
|
|
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
|
|
|
|
#define CHC_QUIT BUTTON_BACK
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_LEFT
|
|
|
|
#define CHC_MENU BUTTON_POWER
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_BACK
|
|
|
|
|
2014-07-17 08:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
|
|
|
|
#define CHC_QUIT BUTTON_BACK
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAYPAUSE
|
|
|
|
#define CHC_RESET BUTTON_SHORTCUT
|
|
|
|
#define CHC_MENU BUTTON_MENU
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_BACK
|
|
|
|
|
2014-08-30 11:15:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == DX50_PAD
|
|
|
|
#define CHC_QUIT (BUTTON_POWER|BUTTON_REPEAT)
|
|
|
|
#define CHC_RESET (BUTTON_PLAY|BUTTON_REPEAT)
|
|
|
|
#define CHC_MENU BUTTON_RIGHT
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_RIGHT
|
|
|
|
|
2018-02-22 22:42:29 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_MENU
|
|
|
|
|
2018-03-02 20:53:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
|
|
|
#define CHC_QUIT (BUTTON_POWER|BUTTON_REPEAT)
|
|
|
|
#define CHC_RESET (BUTTON_LEFT)
|
|
|
|
#define CHC_MENU BUTTON_RIGHT
|
|
|
|
#define CHC_STARTSTOP BUTTON_SELECT
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOLUP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOLDOWN
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_RIGHT
|
|
|
|
#define CHC_SETTINGS_OK (BUTTON_SELECT|BUTTON_REPEAT)
|
|
|
|
|
2018-06-28 10:24:26 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET BUTTON_OPTION
|
|
|
|
#define CHC_MENU BUTTON_HOME
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_NEXT
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_PREV
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_POWER
|
|
|
|
|
2018-06-29 20:09:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IHIFI_770_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET (BUTTON_PLAY|BUTTON_REPEAT)
|
|
|
|
#define CHC_MENU BUTTON_HOME
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_HOME
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IHIFI_800_PAD
|
|
|
|
#define CHC_QUIT BUTTON_POWER
|
|
|
|
#define CHC_STARTSTOP BUTTON_PLAY
|
|
|
|
#define CHC_RESET (BUTTON_PLAY|BUTTON_REPEAT)
|
|
|
|
#define CHC_MENU BUTTON_HOME
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_VOL_UP
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_PLAY
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_HOME
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-10-23 00:05:42 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef CHC_SETTINGS_OK
|
|
|
|
#define CHC_SETTINGS_OK BUTTON_CENTER
|
|
|
|
#endif
|
2018-02-22 22:42:29 +00:00
|
|
|
#ifndef CHC_SETTINGS_CANCEL
|
|
|
|
#define CHC_SETTINGS_CANCEL BUTTON_TOPLEFT
|
|
|
|
#endif
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef CHC_STARTSTOP
|
|
|
|
#define CHC_STARTSTOP BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#ifndef CHC_SETTINGS_INC
|
|
|
|
#define CHC_SETTINGS_INC BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef CHC_SETTINGS_DEC
|
|
|
|
#define CHC_SETTINGS_DEC BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef CHC_RESET
|
|
|
|
#define CHC_RESET BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef CHC_MENU
|
|
|
|
#define CHC_MENU BUTTON_TOPRIGHT
|
|
|
|
#endif
|
|
|
|
#endif
|
2005-02-04 08:36:19 +00:00
|
|
|
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
/* leave first line blank on bitmap display, for pause icon */
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#define FIRST_LINE 1
|
|
|
|
#else
|
|
|
|
#define FIRST_LINE 0
|
|
|
|
#endif
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
#define MAX_PLAYERS 10
|
|
|
|
|
2009-07-25 12:39:00 +00:00
|
|
|
enum {
|
|
|
|
CHCL_OK,
|
|
|
|
CHCL_CANCEL,
|
|
|
|
CHCL_USB,
|
|
|
|
CHCL_NEXT,
|
|
|
|
CHCL_PREV,
|
|
|
|
};
|
|
|
|
|
2004-06-18 09:05:19 +00:00
|
|
|
static struct {
|
|
|
|
int nr_timers;
|
|
|
|
int total_time;
|
|
|
|
int round_time;
|
|
|
|
} settings;
|
|
|
|
|
|
|
|
static struct {
|
|
|
|
int total_time;
|
|
|
|
int used_time;
|
|
|
|
bool hidden;
|
|
|
|
} timer_holder[MAX_PLAYERS];
|
|
|
|
|
|
|
|
static int run_timer(int nr);
|
|
|
|
static int chessclock_set_int(char* string,
|
|
|
|
int* variable,
|
|
|
|
int step,
|
|
|
|
int min,
|
|
|
|
int max,
|
|
|
|
int flags);
|
|
|
|
#define FLAGS_SET_INT_SECONDS 1
|
|
|
|
|
|
|
|
static char * show_time(int secs);
|
|
|
|
|
2011-01-22 16:55:59 +00:00
|
|
|
static bool chesspause;
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
#define MAX_TIME 7200
|
|
|
|
|
|
|
|
/* this is the plugin entry point */
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2004-06-18 09:05:19 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
bool done;
|
|
|
|
int nr;
|
2009-08-05 14:29:29 +00:00
|
|
|
|
2004-06-18 09:05:19 +00:00
|
|
|
(void)parameter;
|
2009-07-25 12:39:00 +00:00
|
|
|
|
|
|
|
settings.nr_timers = 1;
|
|
|
|
settings.total_time = 10;
|
|
|
|
settings.round_time = 10;
|
2009-08-05 14:29:29 +00:00
|
|
|
|
2004-06-18 09:05:19 +00:00
|
|
|
/* now go ahead and have fun! */
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ, "Chess Clock");
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
i=0;
|
2009-07-25 12:39:00 +00:00
|
|
|
while (1) {
|
2004-06-18 09:05:19 +00:00
|
|
|
int res;
|
|
|
|
switch (i) {
|
|
|
|
case 0:
|
|
|
|
res=chessclock_set_int("Number of players",
|
|
|
|
&settings.nr_timers, 1, 1,
|
|
|
|
MAX_PLAYERS, 0);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
res=chessclock_set_int("Total time",
|
2009-07-25 12:39:00 +00:00
|
|
|
&settings.total_time, 10, 10, MAX_TIME,
|
2004-06-18 09:05:19 +00:00
|
|
|
FLAGS_SET_INT_SECONDS);
|
|
|
|
settings.round_time=settings.total_time;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
res=chessclock_set_int("Max round time", &settings.round_time,
|
2009-07-25 12:39:00 +00:00
|
|
|
10, 10, settings.round_time,
|
2004-06-18 09:05:19 +00:00
|
|
|
FLAGS_SET_INT_SECONDS);
|
|
|
|
break;
|
|
|
|
default:
|
2009-07-25 12:39:00 +00:00
|
|
|
res=-2; /* done */
|
2004-06-18 09:05:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-07-25 12:39:00 +00:00
|
|
|
if (res==CHCL_USB) {
|
2004-06-18 09:05:19 +00:00
|
|
|
return PLUGIN_USB_CONNECTED;
|
2009-07-25 12:39:00 +00:00
|
|
|
} else if (res==CHCL_CANCEL) {
|
2004-06-18 09:05:19 +00:00
|
|
|
i--;
|
|
|
|
if (i<0) {
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2009-07-25 12:39:00 +00:00
|
|
|
} else if (res==CHCL_OK) {
|
2004-06-18 09:05:19 +00:00
|
|
|
i++;
|
2009-07-25 12:39:00 +00:00
|
|
|
} else if (res==-2) { /* done */
|
|
|
|
break;
|
2004-06-18 09:05:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i=0; i<settings.nr_timers; i++) {
|
|
|
|
timer_holder[i].total_time=settings.total_time;
|
|
|
|
timer_holder[i].used_time=0;
|
|
|
|
timer_holder[i].hidden=false;
|
|
|
|
}
|
2009-08-05 14:29:29 +00:00
|
|
|
|
2011-01-22 16:55:59 +00:00
|
|
|
chesspause=true; /* We start paused */
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
nr=0;
|
|
|
|
do {
|
|
|
|
int ret=0;
|
|
|
|
done=true;
|
2009-07-09 13:36:22 +00:00
|
|
|
i = nr;
|
|
|
|
do {
|
2004-06-18 09:05:19 +00:00
|
|
|
if (!timer_holder[i].hidden)
|
2009-07-09 13:36:22 +00:00
|
|
|
{
|
|
|
|
nr = i;
|
|
|
|
done = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (++i == settings.nr_timers)
|
|
|
|
i = 0;
|
|
|
|
} while (i != nr);
|
|
|
|
|
2004-06-18 09:05:19 +00:00
|
|
|
if (done) {
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2009-07-25 12:39:00 +00:00
|
|
|
|
2009-07-09 13:36:22 +00:00
|
|
|
ret = run_timer(nr);
|
2004-06-18 09:05:19 +00:00
|
|
|
switch (ret) {
|
2009-07-25 12:39:00 +00:00
|
|
|
case CHCL_CANCEL: /* exit */
|
2004-06-18 09:05:19 +00:00
|
|
|
done=true;
|
|
|
|
break;
|
2009-07-25 12:39:00 +00:00
|
|
|
case CHCL_USB:
|
2004-06-18 09:05:19 +00:00
|
|
|
return PLUGIN_USB_CONNECTED;
|
2009-07-25 12:39:00 +00:00
|
|
|
case CHCL_NEXT:
|
2004-06-18 09:05:19 +00:00
|
|
|
nr++;
|
|
|
|
if (nr>=settings.nr_timers)
|
|
|
|
nr=0;
|
|
|
|
break;
|
2009-07-25 12:39:00 +00:00
|
|
|
case CHCL_PREV:
|
2009-07-09 13:36:22 +00:00
|
|
|
do {
|
|
|
|
nr--;
|
|
|
|
if (nr<0)
|
|
|
|
nr=settings.nr_timers-1;
|
|
|
|
} while (timer_holder[nr].hidden);
|
2004-06-18 09:05:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (!done);
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
static void show_pause_mode(bool enabled)
|
|
|
|
{
|
|
|
|
static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
|
2009-08-05 14:29:29 +00:00
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
if (enabled)
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8);
|
2004-10-23 00:05:42 +00:00
|
|
|
else
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(52, 0, 7, 8);
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
}
|
2004-10-23 00:05:42 +00:00
|
|
|
}
|
2009-07-25 12:39:00 +00:00
|
|
|
#else
|
|
|
|
#define show_pause_mode(enabled) rb->lcd_icon(ICON_PAUSE, enabled)
|
2004-10-23 00:05:42 +00:00
|
|
|
#endif
|
|
|
|
|
2004-06-18 09:05:19 +00:00
|
|
|
static int run_timer(int nr)
|
|
|
|
{
|
|
|
|
char buf[40];
|
|
|
|
char player_info[13];
|
|
|
|
long last_tick;
|
|
|
|
bool done=false;
|
2009-07-25 12:39:00 +00:00
|
|
|
int retval=CHCL_OK;
|
2004-06-18 09:05:19 +00:00
|
|
|
long max_ticks=timer_holder[nr].total_time*HZ-timer_holder[nr].used_time;
|
|
|
|
long ticks=0;
|
|
|
|
bool round_time=false;
|
2004-10-23 00:05:42 +00:00
|
|
|
|
2011-01-22 16:55:59 +00:00
|
|
|
show_pause_mode(chesspause);
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
if (settings.round_time*HZ<max_ticks) {
|
|
|
|
max_ticks=settings.round_time*HZ;
|
|
|
|
round_time=true;
|
|
|
|
}
|
|
|
|
rb->snprintf(player_info, sizeof(player_info), "Player %d", nr+1);
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE, (unsigned char *)player_info);
|
2004-06-18 09:05:19 +00:00
|
|
|
last_tick=*rb->current_tick;
|
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
int button;
|
2004-06-18 10:08:32 +00:00
|
|
|
long now;
|
2009-07-25 12:39:00 +00:00
|
|
|
if (ticks>=max_ticks) {
|
|
|
|
if (round_time)
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"ROUND UP!");
|
2004-06-18 09:05:19 +00:00
|
|
|
else
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"TIME OUT!");
|
2004-06-18 09:05:19 +00:00
|
|
|
rb->backlight_on();
|
2009-07-25 12:39:00 +00:00
|
|
|
ticks = max_ticks;
|
2004-06-18 09:05:19 +00:00
|
|
|
} else {
|
2004-06-18 10:08:32 +00:00
|
|
|
now=*rb->current_tick;
|
2011-01-22 16:55:59 +00:00
|
|
|
if (!chesspause) {
|
2004-06-18 09:05:19 +00:00
|
|
|
ticks+=now-last_tick;
|
|
|
|
if ((max_ticks-ticks)/HZ == 10) {
|
|
|
|
/* Backlight on if 10 seconds remain */
|
|
|
|
rb->backlight_on();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
last_tick=now;
|
|
|
|
if (round_time) {
|
|
|
|
rb->snprintf(buf, sizeof(buf), "%s/",
|
|
|
|
show_time((max_ticks-ticks+HZ-1)/HZ));
|
|
|
|
/* Append total time */
|
|
|
|
rb->strcpy(&buf[rb->strlen(buf)],
|
|
|
|
show_time((timer_holder[nr].total_time*HZ-
|
|
|
|
timer_holder[nr].used_time-
|
|
|
|
ticks+HZ-1)/HZ));
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)buf);
|
2004-06-18 09:05:19 +00:00
|
|
|
} else {
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE+1,
|
|
|
|
(unsigned char *)show_time((max_ticks-ticks+HZ-1)/HZ));
|
2004-06-18 09:05:19 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-23 00:05:42 +00:00
|
|
|
rb->lcd_update();
|
2007-04-06 22:55:00 +00:00
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
button = rb->button_get(false);
|
|
|
|
switch (button) {
|
|
|
|
/* OFF/ON key to exit */
|
|
|
|
case CHC_QUIT:
|
2009-07-25 12:39:00 +00:00
|
|
|
return CHCL_CANCEL; /* Indicate exit */
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
/* PLAY = Stop/Start toggle */
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_STARTSTOP:
|
2011-01-22 16:55:59 +00:00
|
|
|
chesspause=!chesspause;
|
|
|
|
show_pause_mode(chesspause);
|
2004-06-18 09:05:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* LEFT = Reset timer */
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_RESET:
|
2004-06-18 09:05:19 +00:00
|
|
|
ticks=0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* MENU */
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_MENU:
|
2004-06-18 09:05:19 +00:00
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Menu", NULL,
|
|
|
|
"Delete player", "Restart round",
|
2009-08-05 14:29:29 +00:00
|
|
|
"Set round time", "Set total time",
|
|
|
|
"Playback Control");
|
2009-06-16 04:25:21 +00:00
|
|
|
|
|
|
|
int val, res;
|
|
|
|
switch(rb->do_menu(&menu, NULL, NULL, false))
|
|
|
|
{
|
|
|
|
case 0:
|
2009-08-05 14:29:29 +00:00
|
|
|
/* delete player */
|
2009-06-16 04:25:21 +00:00
|
|
|
timer_holder[nr].hidden=true;
|
2009-07-25 12:39:00 +00:00
|
|
|
retval = CHCL_NEXT;
|
2004-06-18 09:05:19 +00:00
|
|
|
done=true;
|
2009-06-16 04:25:21 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
/* restart */
|
|
|
|
ticks=0;
|
2009-07-25 12:39:00 +00:00
|
|
|
last_tick=*rb->current_tick;
|
2009-06-16 04:25:21 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
/* set round time */
|
|
|
|
val=(max_ticks-ticks)/HZ;
|
|
|
|
res=chessclock_set_int("Round time",
|
2009-08-05 14:29:29 +00:00
|
|
|
&val, 10, 0, MAX_TIME,
|
2009-06-16 04:25:21 +00:00
|
|
|
FLAGS_SET_INT_SECONDS);
|
2009-07-25 12:39:00 +00:00
|
|
|
if (res==CHCL_USB) {
|
|
|
|
retval = CHCL_USB;
|
2009-06-16 04:25:21 +00:00
|
|
|
done=true;
|
2009-07-25 12:39:00 +00:00
|
|
|
} else if (res==CHCL_OK) {
|
2009-06-16 04:25:21 +00:00
|
|
|
ticks=max_ticks-val*HZ;
|
2009-07-25 12:39:00 +00:00
|
|
|
last_tick=*rb->current_tick;
|
2009-06-16 04:25:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
/* set total time */
|
|
|
|
val=timer_holder[nr].total_time;
|
|
|
|
res=chessclock_set_int("Total time",
|
|
|
|
&val,
|
|
|
|
10, 0, MAX_TIME,
|
|
|
|
FLAGS_SET_INT_SECONDS);
|
2009-07-25 12:39:00 +00:00
|
|
|
if (res==CHCL_USB) {
|
|
|
|
retval = CHCL_USB;
|
2009-06-16 04:25:21 +00:00
|
|
|
done=true;
|
2009-07-25 12:39:00 +00:00
|
|
|
} else if (res==CHCL_OK) {
|
2009-06-16 04:25:21 +00:00
|
|
|
timer_holder[nr].total_time=val;
|
|
|
|
}
|
|
|
|
break;
|
2009-08-05 14:29:29 +00:00
|
|
|
case 4:
|
|
|
|
playback_control(NULL);
|
|
|
|
break;
|
2009-06-16 04:25:21 +00:00
|
|
|
case MENU_ATTACHED_USB:
|
2009-07-25 12:39:00 +00:00
|
|
|
retval = CHCL_USB;
|
2004-06-18 09:05:19 +00:00
|
|
|
done=true;
|
2009-06-16 04:25:21 +00:00
|
|
|
break;
|
2004-06-18 09:05:19 +00:00
|
|
|
}
|
2009-06-16 04:25:21 +00:00
|
|
|
rb->lcd_clear_display();
|
2011-01-22 16:55:59 +00:00
|
|
|
show_pause_mode(chesspause);
|
2009-07-25 12:39:00 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE, (unsigned char *)player_info);
|
2004-06-18 09:05:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* UP (RIGHT/+) = Scroll Lap timer up */
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_SETTINGS_INC:
|
2009-07-25 12:39:00 +00:00
|
|
|
retval = CHCL_NEXT;
|
2004-06-18 09:05:19 +00:00
|
|
|
done = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* DOWN (LEFT/-) = Scroll Lap timer down */
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_SETTINGS_DEC:
|
2009-07-25 12:39:00 +00:00
|
|
|
retval = CHCL_PREV;
|
2004-06-18 09:05:19 +00:00
|
|
|
done = true;
|
|
|
|
break;
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
default:
|
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
2009-07-25 12:39:00 +00:00
|
|
|
retval = CHCL_USB;
|
2004-10-23 00:05:42 +00:00
|
|
|
done = true;
|
|
|
|
}
|
2004-06-18 09:05:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
rb->sleep(HZ/4); /* Sleep 1/4 of a second */
|
|
|
|
}
|
|
|
|
|
|
|
|
timer_holder[nr].used_time+=ticks;
|
2004-10-23 00:05:42 +00:00
|
|
|
|
2004-06-18 09:05:19 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int chessclock_set_int(char* string,
|
2005-12-02 08:08:54 +00:00
|
|
|
int* variable,
|
|
|
|
int step,
|
|
|
|
int min,
|
|
|
|
int max,
|
|
|
|
int flags)
|
2004-06-18 09:05:19 +00:00
|
|
|
{
|
|
|
|
bool done = false;
|
|
|
|
int button;
|
|
|
|
|
|
|
|
rb->lcd_clear_display();
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts_scroll(0, FIRST_LINE, (unsigned char *)string);
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
char str[32];
|
|
|
|
if (flags & FLAGS_SET_INT_SECONDS)
|
|
|
|
rb->snprintf(str, sizeof str,"%s (m:s)", show_time(*variable));
|
|
|
|
else
|
|
|
|
rb->snprintf(str, sizeof str,"%d", *variable);
|
2005-12-02 08:08:54 +00:00
|
|
|
rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)str);
|
2004-06-18 09:05:19 +00:00
|
|
|
rb->lcd_update();
|
2007-04-06 22:55:00 +00:00
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
button = rb->button_get(true);
|
2004-06-18 09:05:19 +00:00
|
|
|
switch(button) {
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_SETTINGS_INC:
|
|
|
|
case CHC_SETTINGS_INC | BUTTON_REPEAT:
|
2004-06-18 09:05:19 +00:00
|
|
|
*variable += step;
|
|
|
|
break;
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_SETTINGS_DEC:
|
|
|
|
case CHC_SETTINGS_DEC | BUTTON_REPEAT:
|
2004-06-18 09:05:19 +00:00
|
|
|
*variable -= step;
|
|
|
|
break;
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_SETTINGS_OK:
|
|
|
|
#ifdef CHC_SETTINGS_OK2
|
|
|
|
case CHC_SETTINGS_OK2:
|
2004-06-18 09:05:19 +00:00
|
|
|
#endif
|
|
|
|
done = true;
|
|
|
|
break;
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
case CHC_SETTINGS_CANCEL:
|
|
|
|
#ifdef CHC_SETTINGS_CANCEL2
|
|
|
|
case CHC_SETTINGS_CANCEL2:
|
2004-06-18 09:05:19 +00:00
|
|
|
#endif
|
2009-07-25 12:39:00 +00:00
|
|
|
return CHCL_CANCEL;
|
2004-06-18 09:05:19 +00:00
|
|
|
break;
|
|
|
|
|
2004-10-23 00:05:42 +00:00
|
|
|
default:
|
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
2009-07-25 12:39:00 +00:00
|
|
|
return CHCL_USB;
|
2004-10-23 00:05:42 +00:00
|
|
|
break;
|
2004-06-18 09:05:19 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
if(*variable > max )
|
|
|
|
*variable = max;
|
|
|
|
|
|
|
|
if(*variable < min )
|
|
|
|
*variable = min;
|
|
|
|
|
|
|
|
}
|
2013-04-03 14:33:23 +00:00
|
|
|
rb->lcd_scroll_stop();
|
2004-06-18 09:05:19 +00:00
|
|
|
|
2009-07-25 12:39:00 +00:00
|
|
|
return CHCL_OK;
|
2004-06-18 09:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static char * show_time(int seconds)
|
|
|
|
{
|
|
|
|
static char buf[]="00:00";
|
|
|
|
rb->snprintf(buf, sizeof(buf), "%02d:%02d", seconds/60, seconds%60);
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|