summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/keyboard.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 1ab04e705d..83ead7b91f 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -150,12 +150,12 @@ static const char * const kbdpages[KEYBOARD_PAGES][KEYBOARD_LINES] = {
150#ifdef HAVE_MORSE_INPUT 150#ifdef HAVE_MORSE_INPUT
151/* FIXME: We should put this to a configuration file. */ 151/* FIXME: We should put this to a configuration file. */
152static const char *morse_alphabets = 152static const char *morse_alphabets =
153 "abcdefghijklmnopqrstuwvxyzåäö1234567890,"; 153 "abcdefghijklmnopqrstuwvxyzåäö1234567890,.?-@ ";
154static const unsigned char morse_codes[] = { 154static const unsigned char morse_codes[] = {
155 0x05,0x18,0x1a,0x0c,0x02,0x12,0x0e,0x10,0x04,0x17,0x0d,0x14,0x07, 155 0x05,0x18,0x1a,0x0c,0x02,0x12,0x0e,0x10,0x04,0x17,0x0d,0x14,0x07,
156 0x06,0x0f,0x16,0x1d,0x0a,0x08,0x03,0x09,0x11,0x0b,0x19,0x1b,0x1c, 156 0x06,0x0f,0x16,0x1d,0x0a,0x08,0x03,0x09,0x11,0x0b,0x19,0x1b,0x1c,
157 0x2d,0x15,0x1e,0x2f,0x27,0x23,0x21,0x20,0x30,0x38,0x3c,0x3f,0x3f, 157 0x2d,0x15,0x1e,0x2f,0x27,0x23,0x21,0x20,0x30,0x38,0x3c,0x3e,0x3f,
158 0x73 }; 158 0x73,0x55,0x4c,0x61,0x5a,0x80 };
159 159
160static bool morse_mode = false; 160static bool morse_mode = false;
161#endif 161#endif
@@ -208,7 +208,12 @@ int kbd_input(char* text, int buflen)
208 font_w = font->maxwidth; 208 font_w = font->maxwidth;
209 font_h = font->height; 209 font_h = font->height;
210 210
211 main_y = (KEYBOARD_LINES + 1) * font_h + (2*KEYBOARD_MARGIN); 211#ifdef HAVE_MORSE_INPUT
212 if (morse_mode)
213 main_y = LCD_HEIGHT - font_h;
214 else
215#endif
216 main_y = (KEYBOARD_LINES + 1) * font_h + (2*KEYBOARD_MARGIN);
212 main_x = 0; 217 main_x = 0;
213 status_y1 = LCD_HEIGHT - font_h; 218 status_y1 = LCD_HEIGHT - font_h;
214 status_y2 = LCD_HEIGHT; 219 status_y2 = LCD_HEIGHT;
@@ -316,6 +321,16 @@ int kbd_input(char* text, int buflen)
316 redraw = true; 321 redraw = true;
317 322
318 button = button_get_w_tmo(HZ/2); 323 button = button_get_w_tmo(HZ/2);
324#ifdef HAVE_MORSE_INPUT
325 if (morse_mode)
326 {
327 /* Remap some buttons for morse mode. */
328 if (button == KBD_LEFT || button == (KBD_LEFT | BUTTON_REPEAT))
329 button = KBD_CURSOR_LEFT;
330 if (button == KBD_RIGHT || button == (KBD_RIGHT | BUTTON_REPEAT))
331 button = KBD_CURSOR_RIGHT;
332 }
333#endif
319 334
320 switch ( button ) { 335 switch ( button ) {
321 336
@@ -331,6 +346,7 @@ int kbd_input(char* text, int buflen)
331 { 346 {
332 main_y = (KEYBOARD_LINES + 1) * font_h + (2*KEYBOARD_MARGIN); 347 main_y = (KEYBOARD_LINES + 1) * font_h + (2*KEYBOARD_MARGIN);
333 morse_mode = false; 348 morse_mode = false;
349 x = y = 0;
334 } 350 }
335 else 351 else
336#endif 352#endif