games/snake: Change consolekey magic numbers with ASCII macros
Change consolekey magic numbers with ascii values to make it more understandable
Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
diff --git a/games/snake/snake_input_console.h b/games/snake/snake_input_console.h
index 9f6f2bb..03254f5 100644
--- a/games/snake/snake_input_console.h
+++ b/games/snake/snake_input_console.h
@@ -25,6 +25,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <nuttx/ascii.h>
#include <termios.h>
#include "snake_inputs.h"
@@ -188,24 +189,24 @@
/* Arrows keys return three bytes: 27 91 [65-68] */
- if ((ch = getch()) == 27)
+ if ((ch = getch()) == ASCII_ESC)
{
- if ((ch = getch()) == 91)
+ if ((ch = getch()) == ASCII_LBRACKET)
{
ch = getch();
- if (ch == 65)
+ if (ch == ASCII_A)
{
dev->dir = DIR_UP;
}
- else if (ch == 66)
+ else if (ch == ASCII_B)
{
dev->dir = DIR_DOWN;
}
- else if (ch == 67)
+ else if (ch == ASCII_C)
{
dev->dir = DIR_RIGHT;
}
- else if (ch == 68)
+ else if (ch == ASCII_D)
{
dev->dir = DIR_LEFT;
}