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"
@@ -188,24 +189,24 @@ int dev_read_input(FAR struct input_state_s *dev)
188
189
189
190
/* Arrows keys return three bytes: 27 91 [65-68] */
190
191
191
- if ((ch = getch ()) == 27 )
192
+ if ((ch = getch ()) == ASCII_ESC )
192
193
{
193
- if ((ch = getch ()) == 91 )
194
+ if ((ch = getch ()) == ASCII_LBRACKET )
194
195
{
195
196
ch = getch ();
196
- if (ch == 65 )
197
+ if (ch == ASCII_A )
197
198
{
198
199
dev -> dir = DIR_UP ;
199
200
}
200
- else if (ch == 66 )
201
+ else if (ch == ASCII_B )
201
202
{
202
203
dev -> dir = DIR_DOWN ;
203
204
}
204
- else if (ch == 67 )
205
+ else if (ch == ASCII_C )
205
206
{
206
207
dev -> dir = DIR_RIGHT ;
207
208
}
208
- else if (ch == 68 )
209
+ else if (ch == ASCII_D )
209
210
{
210
211
dev -> dir = DIR_LEFT ;
211
212
}
You can’t perform that action at this time.
0 commit comments