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 2525 ****************************************************************************/
2626
2727#include <nuttx/config.h>
28+ #include <nuttx/ascii.h>
2829#include <termios.h>
2930
3031#include "snake_inputs.h"
@@ -188,24 +189,24 @@ int dev_read_input(FAR struct input_state_s *dev)
188189
189190 /* Arrows keys return three bytes: 27 91 [65-68] */
190191
191- if ((ch = getch ()) == 27 )
192+ if ((ch = getch ()) == ASCII_ESC )
192193 {
193- if ((ch = getch ()) == 91 )
194+ if ((ch = getch ()) == ASCII_LBRACKET )
194195 {
195196 ch = getch ();
196- if (ch == 65 )
197+ if (ch == ASCII_A )
197198 {
198199 dev -> dir = DIR_UP ;
199200 }
200- else if (ch == 66 )
201+ else if (ch == ASCII_B )
201202 {
202203 dev -> dir = DIR_DOWN ;
203204 }
204- else if (ch == 67 )
205+ else if (ch == ASCII_C )
205206 {
206207 dev -> dir = DIR_RIGHT ;
207208 }
208- else if (ch == 68 )
209+ else if (ch == ASCII_D )
209210 {
210211 dev -> dir = DIR_LEFT ;
211212 }
You can’t perform that action at this time.
0 commit comments