diff --git a/apps/bookmark.h b/apps/bookmark.h index f6f6bc8019..2d1dc3e27f 100644 --- a/apps/bookmark.h +++ b/apps/bookmark.h @@ -44,7 +44,7 @@ #define BOOKMARK_DOWN BUTTON_DOWN #elif CONFIG_KEYPAD == IAUDIO_X5_PAD -#define BOOKMARK_SELECT BUTTON_MENU +#define BOOKMARK_SELECT BUTTON_SELECT #define BOOKMARK_DELETE BUTTON_REC | BUTTON_REPEAT #define BOOKMARK_DOWN BUTTON_DOWN diff --git a/apps/eq_menu.c b/apps/eq_menu.c index 80cdec3f65..0e754dd979 100644 --- a/apps/eq_menu.c +++ b/apps/eq_menu.c @@ -74,7 +74,7 @@ #define EQ_BTN_NEXT_BAND BUTTON_DOWN #define EQ_BTN_PREV_BAND BUTTON_UP #define EQ_BTN_CHANGE_MODE BUTTON_REC -#define EQ_BTN_EXIT BUTTON_MENU +#define EQ_BTN_EXIT BUTTON_SELECT #elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 2f63a4d1e4..dc6841b881 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -228,10 +228,10 @@ #define WPS_DECVOL BUTTON_DOWN #define WPS_PAUSE BUTTON_PLAY /* #define WPS_MENU iAudioX5 can't have both main menu and context menu in wps (unless we use BUTTON_REC?) */ -#define WPS_BROWSE (BUTTON_MENU | BUTTON_REL) -#define WPS_BROWSE_PRE BUTTON_MENU +#define WPS_BROWSE (BUTTON_SELECT | BUTTON_REL) +#define WPS_BROWSE_PRE BUTTON_SELECT #define WPS_EXIT (BUTTON_PLAY | BUTTON_REPEAT) -#define WPS_CONTEXT (BUTTON_MENU | BUTTON_REPEAT) +#define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) #endif diff --git a/apps/gui/select.h b/apps/gui/select.h index d0e545bd51..ff552950d7 100644 --- a/apps/gui/select.h +++ b/apps/gui/select.h @@ -88,7 +88,7 @@ #elif CONFIG_KEYPAD == IAUDIO_X5_PAD #define SELECT_INC BUTTON_UP #define SELECT_DEC BUTTON_DOWN -#define SELECT_OK BUTTON_MENU +#define SELECT_OK BUTTON_SELECT #define SELECT_OK2 BUTTON_LEFT #define SELECT_CANCEL BUTTON_PLAY #define SELECT_CANCEL2 BUTTON_POWER diff --git a/apps/menu.h b/apps/menu.h index 2130a00683..31e8730831 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -92,7 +92,7 @@ #define MENU_NEXT BUTTON_DOWN #define MENU_PREV BUTTON_UP #define MENU_EXIT BUTTON_LEFT -#define MENU_EXIT_MENU BUTTON_MENU +#define MENU_EXIT_MENU BUTTON_REC #define MENU_ENTER BUTTON_RIGHT #endif diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 2584062fd7..fb31d3d516 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -148,8 +148,8 @@ PLUGIN_HEADER #define CALCULATOR_UP BUTTON_UP #define CALCULATOR_DOWN BUTTON_DOWN #define CALCULATOR_QUIT BUTTON_POWER -#define CALCULATOR_INPUT_CALC_PRE BUTTON_MENU -#define CALCULATOR_INPUT (BUTTON_MENU | BUTTON_REL) +#define CALCULATOR_INPUT_CALC_PRE BUTTON_SELECT +#define CALCULATOR_INPUT (BUTTON_SELECT | BUTTON_REL) #define CALCULATOR_CALC BUTTON_PLAY #define CALCULATOR_CLEAR BUTTON_REC diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index 6f1837ca2b..84979ab401 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c @@ -90,10 +90,10 @@ PLUGIN_HEADER #define CHC_QUIT BUTTON_REC #define CHC_STARTSTOP BUTTON_PLAY #define CHC_RESET BUTTON_POWER -#define CHC_MENU BUTTON_MENU +#define CHC_MENU BUTTON_SELECT #define CHC_SETTINGS_INC BUTTON_RIGHT #define CHC_SETTINGS_DEC BUTTON_LEFT -#define CHC_SETTINGS_OK BUTTON_MENU +#define CHC_SETTINGS_OK BUTTON_SELECT #define CHC_SETTINGS_CANCEL BUTTON_REC #endif diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index 66a2bfd70e..1be48823ed 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c @@ -988,7 +988,7 @@ STATIC void chip8 (void) #define CHIP8_OFF BUTTON_POWER #define CHIP8_KEY2 BUTTON_UP #define CHIP8_KEY4 BUTTON_LEFT -#define CHIP8_KEY5 BUTTON_MENU +#define CHIP8_KEY5 BUTTON_SELECT #define CHIP8_KEY6 BUTTON_RIGHT #define CHIP8_KEY8 BUTTON_DOWN diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index d37eb41c09..63dcce4c33 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c @@ -115,7 +115,7 @@ PLUGIN_HEADER #define CUBE_Y_DEC BUTTON_DOWN #define CUBE_Z_INC (BUTTON_PLAY | BUTTON_UP) #define CUBE_Z_DEC (BUTTON_PLAY | BUTTON_DOWN) -#define CUBE_MODE BUTTON_MENU +#define CUBE_MODE BUTTON_SELECT #define CUBE_PAUSE_PRE BUTTON_PLAY #define CUBE_PAUSE (BUTTON_PLAY | BUTTON_REL) #define CUBE_HIGHSPEED (BUTTON_REC | BUTTON_REL) diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c index 996134d37d..d7e6f28ccb 100644 --- a/apps/plugins/databox/databox.c +++ b/apps/plugins/databox/databox.c @@ -41,7 +41,7 @@ PLUGIN_HEADER #define DBX_SELECT BUTTON_SELECT #define DBX_STOP BUTTON_PLAY #elif CONFIG_KEYPAD == IAUDIO_X5_PAD -#define DBX_SELECT BUTTON_MENU +#define DBX_SELECT BUTTON_SELECT #define DBX_STOP BUTTON_PLAY #endif diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index 13efac18a1..4b7ef42376 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c @@ -71,8 +71,8 @@ PLUGIN_HEADER #define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_LEFT) #define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_RIGHT) #define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_UP) -#define FLIPIT_TOGGLE_PRE BUTTON_MENU -#define FLIPIT_TOGGLE (BUTTON_MENU | BUTTON_REL) +#define FLIPIT_TOGGLE_PRE BUTTON_SELECT +#define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL) #endif diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index eb44e4bd81..9e4ab66cbf 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -73,7 +73,7 @@ PLUGIN_HEADER #define BEJEWELED_DOWN BUTTON_DOWN #define BEJEWELED_LEFT BUTTON_LEFT #define BEJEWELED_RIGHT BUTTON_RIGHT -#define BEJEWELED_SELECT BUTTON_MENU +#define BEJEWELED_SELECT BUTTON_SELECT #define BEJEWELED_CANCEL BUTTON_PLAY #else diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index d574bdada8..ecd42b6234 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c @@ -86,9 +86,9 @@ PLUGIN_HEADER #define JPEG_PREVIOUS (BUTTON_SELECT |BUTTON_LEFT) #elif CONFIG_KEYPAD == IAUDIO_X5_PAD -#define JPEG_ZOOM_IN_PRE BUTTON_MENU -#define JPEG_ZOOM_IN (BUTTON_MENU | BUTTON_REL) -#define JPEG_ZOOM_OUT (BUTTON_MENU | BUTTON_REPEAT) +#define JPEG_ZOOM_IN_PRE BUTTON_SELECT +#define JPEG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL) +#define JPEG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT) #define JPEG_UP BUTTON_UP #define JPEG_DOWN BUTTON_DOWN #define JPEG_LEFT BUTTON_LEFT diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c index 7fa00ee3b8..1a16e5d2a3 100644 --- a/apps/plugins/logo.c +++ b/apps/plugins/logo.c @@ -196,13 +196,7 @@ const unsigned char rockbox16x7[] = { #define LP_DEC_Y BUTTON_DOWN #define LP_INC_Y BUTTON_UP #elif CONFIG_KEYPAD == IAUDIO_X5_PAD -#define LP_QUIT BUTTON_MENU -#define LP_DEC_X BUTTON_LEFT -#define LP_INC_X BUTTON_RIGHT -#define LP_DEC_Y BUTTON_DOWN -#define LP_INC_Y BUTTON_UP -#elif CONFIG_KEYPAD == IAUDIO_X5_PAD -#define LP_QUIT BUTTON_MENU +#define LP_QUIT BUTTON_SELECT #define LP_DEC_X BUTTON_LEFT #define LP_INC_X BUTTON_RIGHT #define LP_DEC_Y BUTTON_DOWN diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c index db478d5e25..4054ef35d9 100644 --- a/apps/plugins/mandelbrot.c +++ b/apps/plugins/mandelbrot.c @@ -84,9 +84,9 @@ PLUGIN_HEADER #define MANDELBROT_DOWN BUTTON_DOWN #define MANDELBROT_LEFT BUTTON_LEFT #define MANDELBROT_RIGHT BUTTON_RIGHT -#define MANDELBROT_ZOOM_IN_PRE BUTTON_MENU -#define MANDELBROT_ZOOM_IN (BUTTON_MENU | BUTTON_REL) -#define MANDELBROT_ZOOM_OUT (BUTTON_MENU | BUTTON_REPEAT) +#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT +#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL) +#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT) #define MANDELBROT_MAXITER_INC (BUTTON_PLAY | BUTTON_RIGHT) #define MANDELBROT_MAXITER_DEC (BUTTON_PLAY | BUTTON_LEFT) #define MANDELBROT_RESET BUTTON_REC diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index b6a6172f51..149bf92ed6 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c @@ -86,7 +86,7 @@ PLUGIN_HEADER #define MINESWP_QUIT BUTTON_POWER #define MINESWP_START BUTTON_REC #define MINESWP_TOGGLE BUTTON_PLAY -#define MINESWP_DISCOVER BUTTON_MENU +#define MINESWP_DISCOVER BUTTON_SELECT #define MINESWP_INFO (BUTTON_REC | BUTTON_PLAY) #endif diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 56c6a18921..12f35e40c8 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c @@ -65,7 +65,7 @@ PLUGIN_HEADER #elif CONFIG_KEYPAD == IAUDIO_X5_PAD #define MOSAIQUE_QUIT BUTTON_POWER -#define MOSAIQUE_SPEED BUTTON_MENU +#define MOSAIQUE_SPEED BUTTON_SELECT #define MOSAIQUE_RESTART BUTTON_PLAY #endif diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 6e3a6e375e..d1a967b1a3 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c @@ -1889,7 +1889,7 @@ char *get_mp3_filename(char *wav_name) #define MP3ENC_PREV BUTTON_UP #define MP3ENC_NEXT BUTTON_DOWN #define MP3ENC_DONE BUTTON_POWER -#define MP3ENC_SELECT BUTTON_MENU +#define MP3ENC_SELECT BUTTON_SELECT #endif enum plugin_status plugin_start(struct plugin_api* api, void* parameter) diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c index 71039f8bb2..83aef91890 100644 --- a/apps/plugins/plasma.c +++ b/apps/plugins/plasma.c @@ -55,6 +55,10 @@ static int plasma_frequency; #define PLASMA_QUIT BUTTON_MENU #define PLASMA_INCREASE_FREQUENCY BUTTON_SCROLL_FWD #define PLASMA_DECREASE_FREQUENCY BUTTON_SCROLL_BACK +#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) +#define PLASMA_QUIT BUTTON_REC +#define PLASMA_INCREASE_FREQUENCY BUTTON_UP +#define PLASMA_DECREASE_FREQUENCY BUTTON_DOWN #else #define PLASMA_QUIT BUTTON_OFF #define PLASMA_INCREASE_FREQUENCY BUTTON_UP diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 6093da0f7e..23b60734df 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c @@ -111,7 +111,7 @@ PLUGIN_HEADER #define SNAKE2_LEVEL_DOWN BUTTON_PLAY #define SNAKE2_SELECT_MAZE BUTTON_LEFT #define SNAKE2_SELECT_TYPE BUTTON_RIGHT -#define SNAKE2_PLAYPAUSE BUTTON_MENU +#define SNAKE2_PLAYPAUSE BUTTON_SELECT #else #error "lacks keymapping" diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 31b74ec2a2..73b014f457 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -80,8 +80,8 @@ PLUGIN_HEADER #define SOKOBAN_UP BUTTON_UP #define SOKOBAN_DOWN BUTTON_DOWN #define SOKOBAN_QUIT BUTTON_POWER -#define SOKOBAN_UNDO_PRE BUTTON_MENU -#define SOKOBAN_UNDO (BUTTON_MENU | BUTTON_REL) +#define SOKOBAN_UNDO_PRE BUTTON_SELECT +#define SOKOBAN_UNDO (BUTTON_SELECT | BUTTON_REL) #define SOKOBAN_LEVEL_UP (BUTTON_PLAY | BUTTON_UP) #define SOKOBAN_LEVEL_DOWN (BUTTON_PLAY | BUTTON_DOWN) #define SOKOBAN_LEVEL_REPEAT BUTTON_REC diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 83f203c4aa..9dc6c52b62 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -129,12 +129,12 @@ static struct plugin_api* rb; #define SOL_DOWN BUTTON_DOWN #define SOL_LEFT BUTTON_LEFT #define SOL_RIGHT BUTTON_RIGHT -#define SOL_MOVE BUTTON_MENU +#define SOL_MOVE BUTTON_SELECT #define SOL_DRAW BUTTON_PLAY #define SOL_REM2CUR (BUTTON_REC | BUTTON_LEFT) #define SOL_CUR2STACK (BUTTON_REC | BUTTON_UP) #define SOL_REM2STACK (BUTTON_REC | BUTTON_DOWN) -#define SOL_MENU_RUN BUTTON_MENU +#define SOL_MENU_RUN BUTTON_SELECT #define SOL_MENU_INFO BUTTON_PLAY #endif diff --git a/apps/plugins/star.c b/apps/plugins/star.c index ddacfbcae2..a6d30eefec 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c @@ -115,8 +115,8 @@ PLUGIN_HEADER #define STAR_QUIT BUTTON_POWER #define STAR_UP BUTTON_UP #define STAR_DOWN BUTTON_DOWN -#define STAR_TOGGLE_CONTROL_PRE BUTTON_MENU -#define STAR_TOGGLE_CONTROL (BUTTON_MENU | BUTTON_REL) +#define STAR_TOGGLE_CONTROL_PRE BUTTON_SELECT +#define STAR_TOGGLE_CONTROL (BUTTON_SELECT | BUTTON_REL) #define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_UP) #define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_DOWN) #define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_RIGHT) diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index bccca7ea36..c5b22404ed 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c @@ -81,7 +81,7 @@ PLUGIN_HEADER #define STOPWATCH_QUIT BUTTON_POWER #define STOPWATCH_START_STOP BUTTON_PLAY #define STOPWATCH_RESET_TIMER BUTTON_REC -#define STOPWATCH_LAP_TIMER BUTTON_MENU +#define STOPWATCH_LAP_TIMER BUTTON_SELECT #define STOPWATCH_SCROLL_UP BUTTON_UP #define STOPWATCH_SCROLL_DOWN BUTTON_DOWN #endif diff --git a/apps/plugins/sudoku.c b/apps/plugins/sudoku.c index 767a33fec7..7894877e23 100644 --- a/apps/plugins/sudoku.c +++ b/apps/plugins/sudoku.c @@ -107,7 +107,7 @@ PLUGIN_HEADER #define SUDOKU_BUTTON_QUIT BUTTON_POWER #define SUDOKU_BUTTON_UP BUTTON_UP #define SUDOKU_BUTTON_DOWN BUTTON_DOWN -#define SUDOKU_BUTTON_TOGGLE BUTTON_MENU +#define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT #define SUDOKU_BUTTON_MENU BUTTON_PLAY #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 7ab0d39447..8e72229c5a 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -150,7 +150,7 @@ PLUGIN_HEADER #define VIEWER_SCREEN_RIGHT BUTTON_RIGHT #define VIEWER_MODE_WRAP (BUTTON_PLAY | BUTTON_REL) #define VIEWER_MODE_LINE (BUTTON_PLAY | BUTTON_REPEAT) -#define VIEWER_MODE_WIDTH BUTTON_MENU +#define VIEWER_MODE_WIDTH BUTTON_SELECT #endif diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 13e7625bc4..d45717c6dd 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -133,8 +133,8 @@ /* TODO: Check keyboard mappings */ #define KBD_MODES /* iAudio X5 uses 2 modes, picker and line edit */ -#define KBD_SELECT (BUTTON_MENU | BUTTON_REL) /* backspace in line edit */ -#define KBD_SELECT_PRE BUTTON_MENU +#define KBD_SELECT (BUTTON_SELECT | BUTTON_REL) /* backspace in line edit */ +#define KBD_SELECT_PRE BUTTON_SELECT #define KBD_DONE BUTTON_PLAY #define KBD_ABORT BUTTON_REC #define KBD_LEFT BUTTON_LEFT diff --git a/apps/settings.h b/apps/settings.h index 9220f79595..c7f70c3a19 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -113,7 +113,7 @@ #elif CONFIG_KEYPAD == IAUDIO_X5_PAD #define SETTINGS_INC BUTTON_UP #define SETTINGS_DEC BUTTON_DOWN -#define SETTINGS_OK BUTTON_MENU +#define SETTINGS_OK BUTTON_SELECT #define SETTINGS_CANCEL BUTTON_REC #define SETTINGS_PREV BUTTON_LEFT #define SETTINGS_NEXT BUTTON_RIGHT diff --git a/apps/tree.h b/apps/tree.h index d1b57d6991..92a2fcf770 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -149,11 +149,11 @@ #define TREE_ABORT BUTTON_PLAY #define TREE_RUN (BUTTON_RIGHT | BUTTON_REL) #define TREE_RUN_PRE BUTTON_RIGHT -#define TREE_MENU (BUTTON_MENU | BUTTON_REPEAT) -#define TREE_MENU_PRE BUTTON_MENU -#define TREE_WPS (BUTTON_MENU | BUTTON_REL) -#define TREE_WPS_PRE BUTTON_MENU -#define TREE_CONTEXT (BUTTON_RIGHT | BUTTON_REPEAT) +#define TREE_MENU (BUTTON_REC | BUTTON_REPEAT) +#define TREE_MENU_PRE BUTTON_REC +#define TREE_WPS (BUTTON_REC | BUTTON_REL) +#define TREE_WPS_PRE BUTTON_REC +#define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) #define TREE_POWER_BTN (BUTTON_PLAY | BUTTON_REPEAT) #endif diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 3d14eb147c..f47df82e8c 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -70,6 +70,9 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */ (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) #define POWEROFF_BUTTON BUTTON_PLAY #define POWEROFF_COUNT 40 +#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 #else #define POWEROFF_BUTTON BUTTON_OFF #define POWEROFF_COUNT 10 @@ -530,6 +533,11 @@ void button_init(void) /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs */ GPIO1_ENABLE &= ~0x00100060; GPIO1_FUNCTION |= 0x00100062; +#elif CONFIG_KEYPAD == IAUDIO_X5_PAD + /* Hold switch */ + GPIO_FUNCTION |= 0x08000000; + GPIO_ENABLE &= ~0x08000000; + #elif CONFIG_KEYPAD == RECORDER_PAD /* Set PB4 and PB8 as input pins */ PBCR1 &= 0xfffc; /* PB8MD = 00 */ @@ -698,6 +706,7 @@ void button_set_flip(bool flip) #endif /* CONFIG_KEYPAD */ +int counter; /* * Get button pressed from hardware */ @@ -1039,6 +1048,40 @@ static int button_read(void) (void)data; /* The int_btn variable is set in the button interrupt handler */ btn = int_btn; +#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) + static bool hold_button = false; + static bool remote_hold_button = false; + + counter ++; + + hold_button = button_hold(); + remote_hold_button = remote_button_hold(); + + /* normal buttons */ + if (!hold_button) + { + data = adc_scan(ADC_BUTTONS); + if(data < 0x7c) + if(data < 0x42) + btn = BUTTON_LEFT; + else + if(data < 0x62) + btn = BUTTON_RIGHT; + else + btn = BUTTON_SELECT; + else + if(data < 0xb6) + if(data < 0x98) + btn = BUTTON_PLAY; + else + btn = BUTTON_REC; + else + if(data < 0xd3) + btn = BUTTON_DOWN; + else + if(data < 0xf0) + btn = BUTTON_UP; + } #endif /* CONFIG_KEYPAD */ @@ -1100,7 +1143,7 @@ bool button_hold(void) #if (CONFIG_KEYPAD == IAUDIO_X5_PAD) bool button_hold(void) { - return (GPIO_READ & 0x08000000)?true:false; + return (GPIO_READ & 0x08000000)?false:true; } bool remote_button_hold(void) diff --git a/firmware/export/adc.h b/firmware/export/adc.h index 027c7154f0..454c102403 100644 --- a/firmware/export/adc.h +++ b/firmware/export/adc.h @@ -92,7 +92,8 @@ unsigned short adc_read(int channel); void adc_init(void); -#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) +#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)\ + || defined(IAUDIO_X5) unsigned char adc_scan(int channel); #endif diff --git a/firmware/export/button.h b/firmware/export/button.h index 1d6acfa275..484698e492 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -23,7 +23,8 @@ #include #include "config.h" #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ - (CONFIG_KEYPAD == IRIVER_H300_PAD) + (CONFIG_KEYPAD == IRIVER_H300_PAD) || \ + (CONFIG_KEYPAD == IAUDIO_X5_PAD) #define HAS_BUTTON_HOLD #define HAS_REMOTE_BUTTON_HOLD #elif (CONFIG_KEYPAD == IPOD_4G_PAD) @@ -192,8 +193,7 @@ bool button_hold(void); #define BUTTON_POWER 0x0004 #define BUTTON_UP 0x0008 #define BUTTON_DOWN 0x0010 -#define BUTTON_MENU 0x0020 -#define BUTTON_OFF 0x0040 /* DOES NOT EXIST!!! */ +#define BUTTON_SELECT 0x0020 #define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000)