9
0
Fork 0

readkey: add define for Ascii keys

this will simplify the usage of gpio keyboard

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-02-13 01:59:21 +08:00
parent ef654d1617
commit 1f22d10f15
2 changed files with 7 additions and 3 deletions

View File

@ -296,7 +296,7 @@ int menu_show(struct menu *m)
do {
if (m->auto_select >= 0)
ch = '\n';
ch = KEY_ENTER;
else
ch = getc();
@ -339,8 +339,8 @@ int menu_show(struct menu *m)
m->selected->action(m, m->selected);
print_menu_entry(m, m->selected, 1);
break;
case '\n':
case '\r':
case KEY_ENTER:
case KEY_RETURN:
clear();
gotoXY(1,1);
m->selected->action(m, m->selected);

View File

@ -3,6 +3,10 @@
#define CTL_CH(c) ((c) - 'a' + 1)
/* Ascii keys */
#define KEY_ENTER '\n'
#define KEY_RETURN '\r'
/* Misc. non-Ascii keys */
#define KEY_UP CTL_CH('p') /* cursor key Up */
#define KEY_DOWN CTL_CH('n') /* cursor key Down */