Add a delete button to the keyboard.

Change-Id: I10e57f19a7edfb4a59fb3c2f48bc0f8a8a58643f
This commit is contained in:
Felix Raimundo
2016-04-01 14:50:58 +02:00
parent a9a522f29c
commit f9b7836e1e
4 changed files with 12 additions and 2 deletions

View File

@@ -153,6 +153,15 @@ char* get_text() {
}
// we want to be inside the parenthese if there are some.
index -= (tmp > 2) ? 2 : 0;
} else if (event == DELETE) {
// Nothing to delete.
if (index == max) {
continue;
}
for (int i=index; i<max+1; i++) {
input[i] = input[i+1];
}
max--;
}
}

View File

@@ -78,6 +78,7 @@ typedef enum {
UP_ARROW,
DOWN_ARROW,
TRIG_MENU,
DELETE,
ERROR = 0xffffffff,
} ion_event_t;

View File

@@ -49,7 +49,7 @@ static ion_key_event_t ion_get_key_event() {
// For now this is a bit silly but needed for instreface purpose.
static const ion_event_t kEventForKeyDown[ION_NUMBER_OF_KEYS] = {
UPPER_CASE_A, UPPER_CASE_B, UPPER_CASE_C, UPPER_CASE_D, UPPER_CASE_E,
UPPER_CASE_F, UPPER_CASE_G, UPPER_CASE_H, UP_ARROW, DOWN_ARROW,
UPPER_CASE_F, UPPER_CASE_G, DELETE, UP_ARROW, DOWN_ARROW,
UPPER_CASE_K, UPPER_CASE_L, TRIG_MENU, LEFT_ARROW, RIGHT_ARROW,
SEVEN, EIGHT, NINE, LEFT_PARENTHESIS, RIGHT_PARENTHESIS,
FOUR, FIVE, SIX, PRODUCT, DIVISION,

View File

@@ -6,7 +6,7 @@
static const char* kCharForKey[KEYBOARD_ROWS * KEYBOARD_COLUMNS] = {
"A", "B", "C", "D", "E",
"F", "G", "H", "UP", "DOWN",
"F", "G", "DEL", "UP", "DOWN",
"K", "L", "TRIG", "LEFT", "RIGHT",
"7", "8", "9", "(", ")",
"4", "5", "6", "*", "/",