Index: docs/CREDITS
===================================================================
--- docs/CREDITS (revision 23894)
+++ docs/CREDITS (working copy)
@@ -508,6 +508,8 @@
Pavel Rzehák
Diego Herranz
Viktor Varga
+Andrew Beveridge
+Koptelov Nikita
The libmad team
The wavpack team
Index: apps/action.h
===================================================================
--- apps/action.h (revision 23894)
+++ apps/action.h (working copy)
@@ -143,7 +143,16 @@
ACTION_LIST_VOLUP,
ACTION_LIST_VOLDOWN,
#endif
-
+#ifdef HAVE_PLAYBACK_CONTROL_IN_LIST
+ ACTION_LIST_PLAY,
+ ACTION_LIST_SKIPPREV,
+ ACTION_LIST_SKIPNEXT,
+ ACTION_LIST_NEXTDIR,
+ ACTION_LIST_SEEKBACK,
+ ACTION_LIST_SEEKFWD,
+ ACTION_LIST_STOPSEEK,
+#endif
+
/* tree */
ACTION_TREE_ROOT_INIT,
ACTION_TREE_PGLEFT,/* optional */
Index: apps/settings.c
===================================================================
--- apps/settings.c (revision 23894)
+++ apps/settings.c (working copy)
@@ -1019,6 +1019,10 @@
memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));
#endif
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+ button_use_hold_buttons(global_settings.use_hold_buttons);
+#endif
+
/* This should stay last */
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
enc_global_settings_apply();
Index: apps/lang/russian.lang
===================================================================
--- apps/lang/russian.lang (revision 23894)
+++ apps/lang/russian.lang (working copy)
@@ -12370,3 +12370,20 @@
touchscreen: "Режим сенсороного экрана"
+
+ id: LANG_HOLD_PLAYBACK_CONTROL
+ desc: in the Playback settings menu
+ user: core
+
+ *: none
+ buttons_in_hold: "Playback Control in Hold Mode"
+
+
+ *: none
+ buttons_in_hold: "Включить кнопки при блоке?"
+
+
+ *: none
+ buttons_in_hold: "Включить кнопки при блоке?"
+
+
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 23894)
+++ apps/lang/english.lang (working copy)
@@ -13287,3 +13287,20 @@
*: "of"
+
+ id: LANG_HOLD_PLAYBACK_CONTROL
+ desc: in the Playback settings menu
+ user: core
+
+ *: none
+ buttons_in_hold: "Playback Control in Hold Mode"
+
+
+ *: none
+ buttons_in_hold: "Playback Control in Hold Mode"
+
+
+ *: none
+ buttons_in_hold: "Playback Control in Hold Mode"
+
+
Index: apps/gui/list.c
===================================================================
--- apps/gui/list.c (revision 23894)
+++ apps/gui/list.c (working copy)
@@ -40,6 +40,11 @@
#include "viewport.h"
#include "appevents.h"
+#ifdef HAVE_PLAYBACK_CONTROL_IN_LIST
+#include "playback.h"
+#include "wps.h" /* for ffwd_rew() */
+#endif
+
#ifdef HAVE_LCD_CHARCELLS
#define SCROLL_LIMIT 1
#else
@@ -637,6 +642,40 @@
setvol();
return true;
#endif
+#ifdef HAVE_PLAYBACK_CONTROL_IN_LIST
+ case ACTION_LIST_PLAY:
+ if (audio_status() & AUDIO_STATUS_PAUSE) {
+ audio_resume();
+ } else {
+ audio_pause();
+ }
+ return true;
+
+ case ACTION_LIST_SKIPPREV:
+ audio_prev();
+ return true;
+
+ case ACTION_LIST_SKIPNEXT:
+ audio_next();
+ return true;
+
+ case ACTION_LIST_NEXTDIR:
+ audio_next_dir();
+ return true;
+
+ case ACTION_LIST_SEEKFWD:
+ ffwd_rew(ACTION_WPS_SEEKFWD);
+ return true;
+
+ case ACTION_LIST_SEEKBACK:
+ ffwd_rew(ACTION_WPS_SEEKBACK);
+ return true;
+
+ case ACTION_LIST_STOPSEEK:
+ ffwd_rew(ACTION_WPS_STOPSEEK);
+ return true;
+#endif
+
case ACTION_STD_PREV:
case ACTION_STD_PREVREPEAT:
gui_list_select_at_offset(lists, -next_item_modifier);
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 23894)
+++ apps/settings.h (working copy)
@@ -807,6 +807,9 @@
bool morse_input; /* text input method setting */
#endif
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+ bool use_hold_buttons;
+#endif
};
/** global variables **/
Index: apps/menus/playback_menu.c
===================================================================
--- apps/menus/playback_menu.c (revision 23894)
+++ apps/menus/playback_menu.c (working copy)
@@ -178,6 +178,10 @@
MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+MENUITEM_SETTING(use_hold_buttons, &global_settings.use_hold_buttons, NULL);
+#endif
+
MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
Icon_Playback_menu,
&shuffle_item, &repeat_mode, &play_selected,
@@ -203,6 +207,9 @@
,&unplug_menu
#endif
,&skip_length, &prevent_skip,
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+ &use_hold_buttons
+#endif
);
static int playback_callback(int action,const struct menu_item_ex *this_item)
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 23894)
+++ apps/settings_list.c (working copy)
@@ -1639,6 +1639,11 @@
#ifdef HAVE_MORSE_INPUT
OFFON_SETTING(0, morse_input, LANG_MORSE_INPUT, false, "morse input", NULL),
#endif
+
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+ OFFON_SETTING(0, use_hold_buttons, LANG_HOLD_PLAYBACK_CONTROL, false,
+ "buttons in hold mode", button_use_hold_buttons),
+#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);
Index: apps/features.txt
===================================================================
--- apps/features.txt (revision 23894)
+++ apps/features.txt (working copy)
@@ -224,3 +224,7 @@
#if (PLUGIN_BUFFER_SIZE >= 0x80000)
large_plugin_buffer
#endif
+
+#if defined(HAVE_BUTTONS_IN_HOLD_MODE)
+buttons_in_hold
+#endif
Index: apps/keymaps/keymap-cowond2.c
===================================================================
--- apps/keymaps/keymap-cowond2.c (revision 23894)
+++ apps/keymaps/keymap-cowond2.c (working copy)
@@ -63,10 +63,35 @@
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+ /* Make the player more usable whilst in your pocket, with the hold switch on */
+ { ACTION_WPS_VOLDOWN, BUTTON_HOLDMINUS|BUTTON_REL, BUTTON_HOLDMINUS },
+ { ACTION_WPS_VOLUP, BUTTON_HOLDPLUS|BUTTON_REL, BUTTON_HOLDPLUS },
+ { ACTION_WPS_PLAY, BUTTON_HOLDMENU|BUTTON_REL, BUTTON_HOLDMENU },
+ { ACTION_WPS_SKIPPREV, BUTTON_HOLDMINUS|BUTTON_REL, BUTTON_HOLDMINUS|BUTTON_REPEAT },
+ { ACTION_WPS_SKIPNEXT, BUTTON_HOLDPLUS|BUTTON_REL, BUTTON_HOLDPLUS|BUTTON_REPEAT },
+ { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_HOLDMENU|BUTTON_REPEAT, BUTTON_HOLDMENU },
+#endif
+
LAST_ITEM_IN_LIST
}; /* button_context_wps */
static const struct button_mapping button_context_list[] = {
+
+ /* Make the player more usable whilst in your pocket, with the hold switch on */
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+#ifdef HAVE_VOLUME_IN_LIST
+ { ACTION_LIST_VOLDOWN, BUTTON_HOLDMINUS|BUTTON_REL, BUTTON_HOLDMINUS },
+ { ACTION_LIST_VOLUP, BUTTON_HOLDPLUS|BUTTON_REL, BUTTON_HOLDPLUS },
+#endif
+#ifdef HAVE_PLAYBACK_CONTROL_IN_LIST
+ { ACTION_LIST_PLAY, BUTTON_HOLDMENU|BUTTON_REL, BUTTON_HOLDMENU },
+ { ACTION_LIST_SKIPPREV, BUTTON_HOLDMINUS|BUTTON_REL, BUTTON_HOLDMINUS|BUTTON_REPEAT },
+ { ACTION_LIST_SKIPNEXT, BUTTON_HOLDPLUS|BUTTON_REL, BUTTON_HOLDPLUS|BUTTON_REPEAT },
+ { ACTION_LIST_NEXTDIR, BUTTON_HOLDMENU|BUTTON_REPEAT, BUTTON_HOLDMENU },
+#endif
+#endif /* HAVE_BUTTONS_IN_HOLD_MODE */
+
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_list */
Index: firmware/export/config/cowond2.h
===================================================================
--- firmware/export/config/cowond2.h (revision 23894)
+++ firmware/export/config/cowond2.h (working copy)
@@ -55,6 +55,15 @@
/* define this if you would like tagcache to build on this target */
#define HAVE_TAGCACHE
+/* define this if you have volume keys that can be used in lists */
+#define HAVE_VOLUME_IN_LIST
+
+/* define this if you have playback control keys that can be used in lists */
+#define HAVE_PLAYBACK_CONTROL_IN_LIST
+
+/* define this if you can make button combinations using the hold switch */
+#define HAVE_BUTTONS_IN_HOLD_MODE
+
/* FM Tuner */
#define CONFIG_TUNER LV24020LP
#define HAVE_TUNER_PWR_CTRL
Index: firmware/target/arm/tcc780x/cowond2/button-cowond2.c
===================================================================
--- firmware/target/arm/tcc780x/cowond2/button-cowond2.c (revision 23894)
+++ firmware/target/arm/tcc780x/cowond2/button-cowond2.c (working copy)
@@ -27,6 +27,13 @@
#include "touchscreen-target.h"
#include
+static bool use_hold_buttons = false;
+
+void button_use_hold_buttons(bool yesno)
+{
+ use_hold_buttons = yesno;
+}
+
void button_init_device(void)
{
/* Configure GPIOA 4 (POWER) and 8 (HOLD) for input */
@@ -62,9 +69,6 @@
backlight_hold_changed(hold_button);
#endif
- if (hold_button)
- return BUTTON_NONE;
-
if (GPIOB & 0x4)
{
adc = adc_read(ADC_BUTTONS);
@@ -87,6 +91,23 @@
}
}
+ /* Hold mode is software controlled so we can make combination buttons */
+ if (button_hold())
+ {
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+ if (use_hold_buttons)
+ {
+ if (btn == BUTTON_MINUS)
+ return BUTTON_HOLDMINUS;
+ else if (btn == BUTTON_PLUS)
+ return BUTTON_HOLDPLUS;
+ else if (btn == BUTTON_MENU)
+ return BUTTON_HOLDMENU;
+ }
+#endif
+ return BUTTON_NONE;
+ }
+
btn |= touchscreen_read_device(data, &old_data);
if (!(GPIOA & 0x4))
Index: firmware/target/arm/tcc780x/cowond2/button-target.h
===================================================================
--- firmware/target/arm/tcc780x/cowond2/button-target.h (revision 23894)
+++ firmware/target/arm/tcc780x/cowond2/button-target.h (working copy)
@@ -30,6 +30,7 @@
bool button_hold(void);
void button_init_device(void);
int button_read_device(int *data);
+void button_use_hold_buttons(bool yesno);
/* Main unit's buttons */
#define BUTTON_POWER 0x00000001
@@ -54,7 +55,18 @@
#define BUTTON_BOTTOMMIDDLE 0x00000800
#define BUTTON_BOTTOMRIGHT 0x00001000
+/* Main unit's buttons whilst hold switch is on */
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+#define BUTTON_HOLDPLUS 0x00002000
+#define BUTTON_HOLDMINUS 0x00004000
+#define BUTTON_HOLDMENU 0x00008000
+#endif
+
+#ifdef HAVE_BUTTONS_IN_HOLD_MODE
+#define BUTTON_MAIN 0xFFFF
+#else
#define BUTTON_MAIN 0x1FFF
+#endif
/* No remote */
#define BUTTON_REMOTE 0