summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english.lang34
-rw-r--r--apps/menus/settings_menu.c7
-rw-r--r--apps/settings.c4
-rw-r--r--apps/settings.h3
-rw-r--r--apps/settings_list.c5
-rw-r--r--firmware/export/config-gigabeat.h2
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c51
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/button-target.h1
8 files changed, 96 insertions, 11 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 2e3adc256e..757fa58bb6 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -11716,3 +11716,37 @@
11716 recording: "Stop Recording And Shutdown" 11716 recording: "Stop Recording And Shutdown"
11717 </voice> 11717 </voice>
11718</phrase> 11718</phrase>
11719<phrase>
11720 id: LANG_TOUCHPAD_SENSITIVITY
11721 desc: touchpad sensitivity setting
11722 user:
11723 <source>
11724 *: none
11725 gigabeatf: "Touchpad Sensitivity"
11726 </source>
11727 <dest>
11728 *: none
11729 gigabeatf: "Touchpad Sensitivity"
11730 </dest>
11731 <voice>
11732 *: none
11733 gigabeatf: "Touchpad Sensitivity"
11734 </voice>
11735</phrase>
11736<phrase>
11737 id: LANG_HIGH
11738 desc: in settings_menu
11739 user:
11740 <source>
11741 *: none
11742 gigabeatf: "High"
11743 </source>
11744 <dest>
11745 *: none
11746 gigabeatf: "High"
11747 </dest>
11748 <voice>
11749 *: none
11750 gigabeatf: "High"
11751 </voice>
11752</phrase>
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 0dbea54496..05cfd23e32 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -361,6 +361,10 @@ MENUITEM_SETTING(buttonlight_timeout, &global_settings.buttonlight_timeout, NULL
361MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL); 361MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL);
362#endif 362#endif
363 363
364#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
365MENUITEM_SETTING(touchpad_sensitivity, &global_settings.touchpad_sensitivity, NULL);
366#endif
367
364 368
365MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), 369MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
366 0, Icon_System_menu, 370 0, Icon_System_menu,
@@ -400,6 +404,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
400#if CONFIG_CODEC == SWCODEC 404#if CONFIG_CODEC == SWCODEC
401 &keyclick_menu, 405 &keyclick_menu,
402#endif 406#endif
407#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
408 &touchpad_sensitivity,
409#endif
403 ); 410 );
404 411
405/* SYSTEM MENU */ 412/* SYSTEM MENU */
diff --git a/apps/settings.c b/apps/settings.c
index 1a857eacd8..340adba5b8 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -929,6 +929,10 @@ void settings_apply(bool read_disk)
929#endif 929#endif
930#endif /* HAVE_BACKLIGHT */ 930#endif /* HAVE_BACKLIGHT */
931 931
932#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
933 touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
934#endif
935
932 /* This should stay last */ 936 /* This should stay last */
933#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC 937#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
934 enc_global_settings_apply(); 938 enc_global_settings_apply();
diff --git a/apps/settings.h b/apps/settings.h
index 320e2b0517..a7772a6937 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -740,6 +740,9 @@ struct user_settings
740 unsigned char playlist_catalog_dir[MAX_FILENAME+1]; 740 unsigned char playlist_catalog_dir[MAX_FILENAME+1];
741 bool study_mode; /* study mode enabled */ 741 bool study_mode; /* study mode enabled */
742 int study_hop_step; /* hop step in study mode, in seconds */ 742 int study_hop_step; /* hop step in study mode, in seconds */
743#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
744 int touchpad_sensitivity;
745#endif
743}; 746};
744 747
745/** global variables **/ 748/** global variables **/
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 8576c5b926..48e3758ef7 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1321,6 +1321,11 @@ const struct settings_list settings[] = {
1321#endif /* CONFIG_CODEC == SWCODEC */ 1321#endif /* CONFIG_CODEC == SWCODEC */
1322 FILENAME_SETTING(0, playlist_catalog_dir, "playlist catalog directory", 1322 FILENAME_SETTING(0, playlist_catalog_dir, "playlist catalog directory",
1323 PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL, MAX_FILENAME+1), 1323 PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL, MAX_FILENAME+1),
1324#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
1325 CHOICE_SETTING(0, touchpad_sensitivity, LANG_TOUCHPAD_SENSITIVITY, 0,
1326 "touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2,
1327 ID2P(LANG_NORMAL), ID2P(LANG_HIGH)),
1328#endif
1324}; 1329};
1325 1330
1326const int nb_settings = sizeof(settings)/sizeof(*settings); 1331const int nb_settings = sizeof(settings)/sizeof(*settings);
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 03cedd0049..cf64baab12 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -48,6 +48,8 @@
48/* We don't use a setting but a fixed delay after the backlight has 48/* We don't use a setting but a fixed delay after the backlight has
49 * turned off */ 49 * turned off */
50#define LCD_SLEEP_TIMEOUT (5*HZ) 50#define LCD_SLEEP_TIMEOUT (5*HZ)
51
52#define HAVE_TOUCHPAD_SENSITIVITY_SETTING
51#endif /* BOOTLOADER */ 53#endif /* BOOTLOADER */
52 54
53#define CONFIG_KEYPAD GIGABEAT_PAD 55#define CONFIG_KEYPAD GIGABEAT_PAD
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
index 9f6d54df9d..c43d1884f4 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
@@ -30,6 +30,20 @@
30static bool headphones_detect; 30static bool headphones_detect;
31static bool hold_button = false; 31static bool hold_button = false;
32 32
33#define TOUCHPAD_SENS_NORMAL ((1 << 12) | /* right++ */ \
34 (1 << 7) | /* left++ */ \
35 (1 << 6) | /* down++*/ \
36 (1 << 0) | /* up++ */ \
37 (1 << 3)) /* center */
38
39#define TOUCHPAD_SENS_HIGH (((1 << 12) | (1 << 11)) | /* right++, right+ */ \
40 ((1 << 8) | (1 << 7)) | /* left+, left++ */ \
41 ((1 << 6) | (1 << 5)) | /* down++, down+ */ \
42 ((1 << 1) | (1 << 0)) | /* up+, up++ */ \
43 (1 << 3)) /* Center */
44
45static int touchpad_mask = TOUCHPAD_SENS_NORMAL;
46
33static int const remote_buttons[] = 47static int const remote_buttons[] =
34{ 48{
35 BUTTON_NONE, /* Headphones connected - remote disconnected */ 49 BUTTON_NONE, /* Headphones connected - remote disconnected */
@@ -123,30 +137,31 @@ int button_read_device(void)
123 } 137 }
124 138
125 /* the touchpad - only watch the lines we actually read */ 139 /* the touchpad - only watch the lines we actually read */
126 touchpad = GPJDAT & (((1 << 12) | (1 << 11)) | /* right++, right+ */ 140 touchpad = GPJDAT & touchpad_mask;
127 ((1 << 8) | (1 << 7)) | /* left+, left++ */ 141
128 ((1 << 6) | (1 << 5)) | /* down++, down+ */
129 ((1 << 1) | (1 << 0)) | /* up+, up++ */
130 (1 << 3)); /* center */
131 if (touchpad) 142 if (touchpad)
132 { 143 {
133 if (touchpad & (1 << 3)) 144 if (touchpad & (1 << 3))
134 { 145 {
135 btn |= BUTTON_SELECT; 146 btn |= BUTTON_SELECT;
136 /* Desensitize middle (+) detectors one level */ 147 /* Desensitize all but outer detectors and still allow a combo if
137 touchpad &= ~((1 << 11) | (1 << 8) | (1 << 5) | (1 << 1)); 148 * that's really intended. */
149 touchpad &= TOUCHPAD_SENS_NORMAL;
138 } 150 }
139 151
140 if (touchpad & ((1 << 1) | (1 << 0))) 152 /* Simply include all lines in checks since "touchpad" has been
153 * masked to desired sensitivity already - allows any mask to be
154 * used without changing this code. */
155 if (touchpad & ((1 << 2) | (1 << 1) | (1 << 0)))
141 btn |= BUTTON_UP; 156 btn |= BUTTON_UP;
142 157
143 if (touchpad & ((1 << 12) | (1 << 11))) 158 if (touchpad & ((1 << 12) | (1 << 11) | (1 << 10)))
144 btn |= BUTTON_RIGHT; 159 btn |= BUTTON_RIGHT;
145 160
146 if (touchpad & ((1 << 6) | (1 << 5))) 161 if (touchpad & ((1 << 6) | (1 << 5) | (1 << 4)))
147 btn |= BUTTON_DOWN; 162 btn |= BUTTON_DOWN;
148 163
149 if (touchpad & ((1 << 8) | (1 << 7))) 164 if (touchpad & ((1 << 9) | (1 << 8) | (1 << 7)))
150 btn |= BUTTON_LEFT; 165 btn |= BUTTON_LEFT;
151 166
152 buttonlight_on(); 167 buttonlight_on();
@@ -155,6 +170,20 @@ int button_read_device(void)
155 return btn; 170 return btn;
156} 171}
157 172
173void touchpad_set_sensitivity(int level)
174{
175 static const int masks[] =
176 {
177 TOUCHPAD_SENS_NORMAL,
178 TOUCHPAD_SENS_HIGH
179 };
180
181 if ((unsigned)level >= ARRAYLEN(masks))
182 level = 0;
183
184 touchpad_mask = masks[level];
185}
186
158bool headphones_inserted(void) 187bool headphones_inserted(void)
159{ 188{
160 return headphones_detect; 189 return headphones_detect;
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h
index 7a39212de9..a5876aadde 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h
@@ -27,6 +27,7 @@
27bool button_hold(void); 27bool button_hold(void);
28void button_init_device(void); 28void button_init_device(void);
29int button_read_device(void); 29int button_read_device(void);
30void touchpad_set_sensitivity(int level);
30 31
31/* Toshiba Gigabeat specific button codes */ 32/* Toshiba Gigabeat specific button codes */
32 33