diff --git a/apps/action.h b/apps/action.h index ea15b536a7..cea9384ec2 100644 --- a/apps/action.h +++ b/apps/action.h @@ -75,6 +75,7 @@ enum { CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */ CONTEXT_RECSCREEN, CONTEXT_KEYBOARD, + CONTEXT_MORSE_INPUT, CONTEXT_FM, CONTEXT_USB_HID, CONTEXT_USB_HID_MODE_MULTIMEDIA, diff --git a/apps/keymaps/keymap-creativezv.c b/apps/keymaps/keymap-creativezv.c index b88c1409cd..fb8e542520 100644 --- a/apps/keymaps/keymap-creativezv.c +++ b/apps/keymaps/keymap-creativezv.c @@ -251,6 +251,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; } return button_context_standard; diff --git a/apps/keymaps/keymap-creativezvm.c b/apps/keymaps/keymap-creativezvm.c index b355018892..37563248a1 100644 --- a/apps/keymaps/keymap-creativezvm.c +++ b/apps/keymaps/keymap-creativezvm.c @@ -250,6 +250,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; } return button_context_standard; diff --git a/apps/keymaps/keymap-e200.c b/apps/keymaps/keymap-e200.c index 2deac631ac..f6972223fd 100644 --- a/apps/keymaps/keymap-e200.c +++ b/apps/keymaps/keymap-e200.c @@ -425,6 +425,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_RECSCREEN: return button_context_recscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; #ifdef USB_ENABLE_HID case CONTEXT_USB_HID: diff --git a/apps/keymaps/keymap-fuze.c b/apps/keymaps/keymap-fuze.c index 3e89cc595f..0f7937abb1 100644 --- a/apps/keymaps/keymap-fuze.c +++ b/apps/keymaps/keymap-fuze.c @@ -325,6 +325,7 @@ const struct button_mapping* get_context_mapping(int context) return button_context_recscreen; #endif case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; default: diff --git a/apps/keymaps/keymap-gigabeat-s.c b/apps/keymaps/keymap-gigabeat-s.c index cf150bb6d9..0793f7bfbf 100644 --- a/apps/keymaps/keymap-gigabeat-s.c +++ b/apps/keymaps/keymap-gigabeat-s.c @@ -691,6 +691,7 @@ static const struct button_mapping* get_context_mapping_remote( int context ) return remote_button_context_recscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return ACTION_NONE; /* Any sensible mapping for this remote? */ case CONTEXT_FM: @@ -769,6 +770,7 @@ const struct button_mapping* get_context_mapping(int context) return button_context_settings_right_is_inc; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; case CONTEXT_FM: diff --git a/apps/keymaps/keymap-gigabeat.c b/apps/keymaps/keymap-gigabeat.c index a1a38a9600..ccb6084ada 100644 --- a/apps/keymaps/keymap-gigabeat.c +++ b/apps/keymaps/keymap-gigabeat.c @@ -378,6 +378,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; } return button_context_standard; diff --git a/apps/keymaps/keymap-h10.c b/apps/keymaps/keymap-h10.c index c1f3033a2b..315f28c213 100644 --- a/apps/keymaps/keymap-h10.c +++ b/apps/keymaps/keymap-h10.c @@ -506,6 +506,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; case CONTEXT_RECSCREEN: return button_context_recscreen; diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c index 62cd940460..d3b76ee3ad 100644 --- a/apps/keymaps/keymap-h1x0_h3x0.c +++ b/apps/keymaps/keymap-h1x0_h3x0.c @@ -918,6 +918,7 @@ static const struct button_mapping* get_context_mapping_remote(int context) case CONTEXT_RECSCREEN: return remote_btn_ctxt_recscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return remote_btn_ctxt_keyboard; case CONTEXT_FM: return remote_btn_ctxt_radio; @@ -973,6 +974,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_RECSCREEN: return button_context_recscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; case CONTEXT_FM: return button_context_radio; diff --git a/apps/keymaps/keymap-hdd1630.c b/apps/keymaps/keymap-hdd1630.c index f6f9ab9c8c..d43fcd837d 100644 --- a/apps/keymaps/keymap-hdd1630.c +++ b/apps/keymaps/keymap-hdd1630.c @@ -441,6 +441,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; #if CONFIG_TUNER case CONTEXT_FM: diff --git a/apps/keymaps/keymap-hdd6330.c b/apps/keymaps/keymap-hdd6330.c index f6f9ab9c8c..d43fcd837d 100644 --- a/apps/keymaps/keymap-hdd6330.c +++ b/apps/keymaps/keymap-hdd6330.c @@ -441,6 +441,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; #if CONFIG_TUNER case CONTEXT_FM: diff --git a/apps/keymaps/keymap-ipod.c b/apps/keymaps/keymap-ipod.c index d49f95b66c..4f987777b4 100644 --- a/apps/keymaps/keymap-ipod.c +++ b/apps/keymaps/keymap-ipod.c @@ -414,6 +414,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; #ifdef HAVE_RECORDING case CONTEXT_RECSCREEN: diff --git a/apps/keymaps/keymap-m200.c b/apps/keymaps/keymap-m200.c index e3aa093a81..d1e6f626fd 100644 --- a/apps/keymaps/keymap-m200.c +++ b/apps/keymaps/keymap-m200.c @@ -333,6 +333,7 @@ const struct button_mapping* get_context_mapping(int context) return button_context_recscreen; #endif case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; default: diff --git a/apps/keymaps/keymap-meizu-m6sl.c b/apps/keymaps/keymap-meizu-m6sl.c index 988f8a21fe..2dcb81bec0 100644 --- a/apps/keymaps/keymap-meizu-m6sl.c +++ b/apps/keymaps/keymap-meizu-m6sl.c @@ -301,6 +301,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; } return button_context_standard; diff --git a/apps/keymaps/keymap-mr100.c b/apps/keymaps/keymap-mr100.c index ede3d5ef1b..dd2539f381 100644 --- a/apps/keymaps/keymap-mr100.c +++ b/apps/keymaps/keymap-mr100.c @@ -582,6 +582,7 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; #ifdef USB_ENABLE_HID case CONTEXT_USB_HID: diff --git a/apps/keymaps/keymap-mr500.c b/apps/keymaps/keymap-mr500.c index 11e1e60d61..b35c9c1dfc 100644 --- a/apps/keymaps/keymap-mr500.c +++ b/apps/keymaps/keymap-mr500.c @@ -238,6 +238,7 @@ const struct button_mapping* target_get_context_mapping(int context) case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; } return button_context_standard; diff --git a/apps/keymaps/keymap-ondio.c b/apps/keymaps/keymap-ondio.c index 5e56117298..45938138ed 100644 --- a/apps/keymaps/keymap-ondio.c +++ b/apps/keymaps/keymap-ondio.c @@ -155,7 +155,7 @@ static const struct button_mapping button_context_recscreen[] = { static const struct button_mapping button_context_keyboard[] = { { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, - { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_KBD_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, @@ -169,6 +169,22 @@ static const struct button_mapping button_context_keyboard[] = { LAST_ITEM_IN_LIST }; /* button_context_keyboard */ +static const struct button_mapping button_context_morse_input[] = { + { ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + { ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_ABORT, BUTTON_OFF, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_UP, BUTTON_NONE }, + { ACTION_KBD_MORSE_SELECT, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_morse_input */ + #if CONFIG_TUNER static const struct button_mapping button_context_radio[] = { { ACTION_FM_MENU, BUTTON_MENU | BUTTON_REPEAT, BUTTON_NONE }, @@ -223,6 +239,8 @@ const struct button_mapping* get_context_mapping( int context ) #endif case CONTEXT_KEYBOARD: return button_context_keyboard; + case CONTEXT_MORSE_INPUT: + return button_context_morse_input; #if CONFIG_TUNER case CONTEXT_FM: return button_context_radio; diff --git a/apps/keymaps/keymap-recorder.c b/apps/keymaps/keymap-recorder.c index 0ab0e5f8c6..859f4feeb4 100644 --- a/apps/keymaps/keymap-recorder.c +++ b/apps/keymaps/keymap-recorder.c @@ -302,6 +302,7 @@ const struct button_mapping* get_context_mapping( int context ) case CONTEXT_SETTINGS_RECTRIGGER: return button_context_recscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; case CONTEXT_FM: return button_context_radio; diff --git a/apps/keymaps/keymap-sa9200.c b/apps/keymaps/keymap-sa9200.c index 6df9d6c1ed..d7405588b5 100644 --- a/apps/keymaps/keymap-sa9200.c +++ b/apps/keymaps/keymap-sa9200.c @@ -270,7 +270,7 @@ static const struct button_mapping button_context_keyboard[] = { { ACTION_KBD_PAGE_FLIP, BUTTON_VOL_DOWN, BUTTON_NONE }, - { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_PLAY, BUTTON_NONE }, { ACTION_KBD_MORSE_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, LAST_ITEM_IN_LIST @@ -427,7 +427,9 @@ const struct button_mapping* get_context_mapping(int context) return button_context_pitchscreen; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; + #ifdef USB_ENABLE_HID case CONTEXT_USB_HID: return button_context_usb_hid; diff --git a/apps/keymaps/keymap-x5.c b/apps/keymaps/keymap-x5.c index 69602d7ca7..059a3f25b5 100644 --- a/apps/keymaps/keymap-x5.c +++ b/apps/keymaps/keymap-x5.c @@ -433,6 +433,7 @@ static const struct button_mapping* get_context_mapping_remote( int context ) return remote_button_context_radio; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return remote_button_context_keyboard; case CONTEXT_PITCHSCREEN: @@ -489,9 +490,9 @@ const struct button_mapping* get_context_mapping( int context ) return button_context_radio; case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: return button_context_keyboard; - case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 1ca0069735..5bfb1024b3 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -735,7 +735,11 @@ int kbd_input(char* text, int buflen) FOR_NB_SCREENS(l) screens[l].update(); - button = get_action(CONTEXT_KEYBOARD, HZ/2); + button = get_action( +#ifdef HAVE_MORSE_INPUT + morse_mode? CONTEXT_MORSE_INPUT: +#endif + CONTEXT_KEYBOARD, HZ/2); #if NB_SCREENS > 1 button_screen = (get_action_statuscode(NULL) & ACTION_REMOTE) ? 1 : 0; #endif diff --git a/firmware/export/config/archosondiofm.h b/firmware/export/config/archosondiofm.h index b14f113244..c49f11a473 100644 --- a/firmware/export/config/archosondiofm.h +++ b/firmware/export/config/archosondiofm.h @@ -38,6 +38,9 @@ /* define this if you have an Ondio style 6-key keyboard */ #define CONFIG_KEYPAD ONDIO_PAD +/* Define this to enable morse code input */ +#define HAVE_MORSE_INPUT + #define AB_REPEAT_ENABLE 1 #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE diff --git a/firmware/export/config/archosondiosp.h b/firmware/export/config/archosondiosp.h index 452b47b78e..867bc1358c 100644 --- a/firmware/export/config/archosondiosp.h +++ b/firmware/export/config/archosondiosp.h @@ -31,6 +31,9 @@ /* define this if you have an Ondio style 6-key keyboard */ #define CONFIG_KEYPAD ONDIO_PAD +/* Define this to enable morse code input */ +#define HAVE_MORSE_INPUT + #define AB_REPEAT_ENABLE 1 #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE diff --git a/manual/platform/keymap-archosondio.tex b/manual/platform/keymap-archosondio.tex index dd0cf25061..9eefe691f7 100644 --- a/manual/platform/keymap-archosondio.tex +++ b/manual/platform/keymap-archosondio.tex @@ -51,6 +51,7 @@ \newcommand{\ActionKbdAbort}{\ButtonOff} \newcommand{\ActionKbdUp}{\ButtonUp} \newcommand{\ActionKbdDown}{\ButtonDown} +\newcommand{\ActionKbdMorseSelect}{\ButtonUp} %Button actions, Pitch Screen context \newcommand{\ActionPsToggleMode}{Long \ButtonMenu}