File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 25
25
****************************************************************************/
26
26
27
27
#include <nuttx/config.h>
28
+ #include <nuttx/ascii.h>
28
29
#include <termios.h>
29
30
30
31
#include "snake_inputs.h"
@@ -207,24 +208,24 @@ int dev_read_input(FAR struct input_state_s *dev)
207
208
208
209
/* Arrows keys return three bytes: 27 91 [65-68] */
209
210
210
- if ((ch = getch ()) == 27 )
211
+ if ((ch = getch ()) == ASCII_ESC )
211
212
{
212
- if ((ch = getch ()) == 91 )
213
+ if ((ch = getch ()) == ASCII_LBRACKET )
213
214
{
214
215
ch = getch ();
215
- if (ch == 65 )
216
+ if (ch == ASCII_A )
216
217
{
217
218
dev -> dir = DIR_UP ;
218
219
}
219
- else if (ch == 66 )
220
+ else if (ch == ASCII_B )
220
221
{
221
222
dev -> dir = DIR_DOWN ;
222
223
}
223
- else if (ch == 67 )
224
+ else if (ch == ASCII_C )
224
225
{
225
226
dev -> dir = DIR_RIGHT ;
226
227
}
227
- else if (ch == 68 )
228
+ else if (ch == ASCII_D )
228
229
{
229
230
dev -> dir = DIR_LEFT ;
230
231
}
You can’t perform that action at this time.
0 commit comments