diff options
author | Hristo Kovachev <bger@rockbox.org> | 2006-03-21 09:36:13 +0000 |
---|---|---|
committer | Hristo Kovachev <bger@rockbox.org> | 2006-03-21 09:36:13 +0000 |
commit | f53f64a6159c0f17f09d18fad64ab2b09f7c0d36 (patch) | |
tree | 9e6cc6c2628fdf70b1d555ad589f25d8440acc33 /apps | |
parent | 16f7aa76d049681f1aa3b3ca778b1d2be77d2231 (diff) | |
download | rockbox-f53f64a6159c0f17f09d18fad64ab2b09f7c0d36.tar.gz rockbox-f53f64a6159c0f17f09d18fad64ab2b09f7c0d36.zip |
button.h cleanup, with the future "button action" thing in mind:
1) Main unit's button defines are from the LSB to the MSB (currently bits 0-9, 0x00000200), remote ones are from the 20th bit (0x00100000) downards to 10th(0x00000400);
2) Removed the BUTTON_REMOTE modifier, replaced with a bitmask of all of the remote buttons (where applicable, otherwise with 0), added a complementary BUTTON_MAIN bitmask;
3) Moved button modifiers:
- BUTTON_REPEAT: to bit 26 (0x04000000)
- BUTTON_REL: to bit 25 (0x02000000)
There are at least 4 bits free on all targets now: 21-24.
If we really need more free bits, it's possible to SHR remote buttons 1 bit more (freeing bit 20 too), and to change the SYS_EVENT bit with a bitmask (+2 bits).
4) Bumped up the min. plugin ver. (and sorted the plugin api struct), because the binary plugins with key input won't understand the new values
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9149 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugin.c | 10 | ||||
-rw-r--r-- | apps/plugin.h | 21 |
2 files changed, 10 insertions, 21 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 7aa30c9ea2..4395195d0f 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -179,7 +179,7 @@ static const struct plugin_api rockbox_api = { | |||
179 | button_get_w_tmo, | 179 | button_get_w_tmo, |
180 | button_status, | 180 | button_status, |
181 | button_clear_queue, | 181 | button_clear_queue, |
182 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 182 | #ifdef HAS_BUTTON_HOLD |
183 | button_hold, | 183 | button_hold, |
184 | #endif | 184 | #endif |
185 | 185 | ||
@@ -357,6 +357,7 @@ static const struct plugin_api rockbox_api = { | |||
357 | menu_draw, | 357 | menu_draw, |
358 | menu_insert, | 358 | menu_insert, |
359 | menu_set_cursor, | 359 | menu_set_cursor, |
360 | set_option, | ||
360 | 361 | ||
361 | /* power */ | 362 | /* power */ |
362 | battery_level, | 363 | battery_level, |
@@ -411,13 +412,6 @@ static const struct plugin_api rockbox_api = { | |||
411 | /* new stuff at the end, sort into place next time | 412 | /* new stuff at the end, sort into place next time |
412 | the API gets incompatible */ | 413 | the API gets incompatible */ |
413 | 414 | ||
414 | #if CONFIG_KEYPAD == IRIVER_H300_PAD || CONFIG_KEYPAD == IPOD_4G_PAD | ||
415 | /* NOTE: This is already in the plugin api for the H100 - but we put it | ||
416 | at the end for other targets to keep the plugin api compatible */ | ||
417 | button_hold, | ||
418 | #endif | ||
419 | /* options */ | ||
420 | set_option, | ||
421 | }; | 415 | }; |
422 | 416 | ||
423 | int plugin_load(const char* plugin, void* parameter) | 417 | int plugin_load(const char* plugin, void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index bf58542729..6584dbeed7 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -99,12 +99,12 @@ | |||
99 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 99 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
100 | 100 | ||
101 | /* increase this every time the api struct changes */ | 101 | /* increase this every time the api struct changes */ |
102 | #define PLUGIN_API_VERSION 12 | 102 | #define PLUGIN_API_VERSION 13 |
103 | 103 | ||
104 | /* update this to latest version if a change to the api struct breaks | 104 | /* update this to latest version if a change to the api struct breaks |
105 | backwards compatibility (and please take the opportunity to sort in any | 105 | backwards compatibility (and please take the opportunity to sort in any |
106 | new function which are "waiting" at the end of the function table) */ | 106 | new function which are "waiting" at the end of the function table) */ |
107 | #define PLUGIN_MIN_API_VERSION 11 | 107 | #define PLUGIN_MIN_API_VERSION 13 |
108 | 108 | ||
109 | /* plugin return codes */ | 109 | /* plugin return codes */ |
110 | enum plugin_status { | 110 | enum plugin_status { |
@@ -229,7 +229,7 @@ struct plugin_api { | |||
229 | long (*button_get_w_tmo)(int ticks); | 229 | long (*button_get_w_tmo)(int ticks); |
230 | int (*button_status)(void); | 230 | int (*button_status)(void); |
231 | void (*button_clear_queue)(void); | 231 | void (*button_clear_queue)(void); |
232 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 232 | #ifdef HAS_BUTTON_HOLD |
233 | bool (*button_hold)(void); | 233 | bool (*button_hold)(void); |
234 | #endif | 234 | #endif |
235 | 235 | ||
@@ -414,6 +414,11 @@ struct plugin_api { | |||
414 | void (*menu_insert)(int menu, int position, char *desc, bool (*function) (void)); | 414 | void (*menu_insert)(int menu, int position, char *desc, bool (*function) (void)); |
415 | void (*menu_set_cursor)(int menu, int position); | 415 | void (*menu_set_cursor)(int menu, int position); |
416 | 416 | ||
417 | bool (*set_option)(const char* string, void* variable, | ||
418 | enum optiontype type, const struct opt_items* options, | ||
419 | int numoptions, void (*function)(int)); | ||
420 | |||
421 | |||
417 | /* power */ | 422 | /* power */ |
418 | int (*battery_level)(void); | 423 | int (*battery_level)(void); |
419 | bool (*battery_level_safe)(void); | 424 | bool (*battery_level_safe)(void); |
@@ -476,16 +481,6 @@ struct plugin_api { | |||
476 | /* new stuff at the end, sort into place next time | 481 | /* new stuff at the end, sort into place next time |
477 | the API gets incompatible */ | 482 | the API gets incompatible */ |
478 | 483 | ||
479 | #if CONFIG_KEYPAD == IRIVER_H300_PAD || CONFIG_KEYPAD == IPOD_4G_PAD | ||
480 | /* NOTE: This is already in the plugin api for the H100 - but we put it | ||
481 | at the end for other targets to keep the plugin api compatible */ | ||
482 | bool (*button_hold)(void); | ||
483 | #endif | ||
484 | /* options */ | ||
485 | bool (*set_option)(const char* string, void* variable, | ||
486 | enum optiontype type, const struct opt_items* options, | ||
487 | int numoptions, void (*function)(int)); | ||
488 | |||
489 | }; | 484 | }; |
490 | 485 | ||
491 | /* plugin header */ | 486 | /* plugin header */ |