@@ -104,10 +104,10 @@ Also example of strings and string array in flash memory
104104#define RS 12
105105#define ENA 11
106106#define RW 10
107- #define D7 7
107+ #define D7 9
108108#define D6 8
109- #define D5 9
110- #define D4 10
109+ #define D5 7
110+ #define D4 6
111111
112112/* LCD Constants to match your display */
113113/* Columns in display */
@@ -123,10 +123,11 @@ int8_t rows = 0;
123123/* Key codes and strings for keys producing a string */
124124/* three arrays in same order ( keycode, string to display, length of string ) */
125125#if defined(ARDUINO_ARCH_AVR)
126- const uint8_t codes[] PROGMEM = { PS2_KEY_TAB, PS2_KEY_ESC, PS2_KEY_DELETE,
126+ const uint8_t codes[] PROGMEM = { PS2_KEY_SPACE, PS2_KEY_TAB, PS2_KEY_ESC, PS2_KEY_DELETE,
127127 PS2_KEY_F1, PS2_KEY_F2, PS2_KEY_F3, PS2_KEY_F4,
128128 PS2_KEY_F5, PS2_KEY_F6, PS2_KEY_F7, PS2_KEY_F8,
129129 PS2_KEY_F9, PS2_KEY_F10, PS2_KEY_F11, PS2_KEY_F12 };
130+ const char spacestr[] PROGMEM = " " ;
130131const char tabstr[] PROGMEM = " [Tab]" ;
131132const char escstr[] PROGMEM = " [ESC]" ;
132133const char delstr[] PROGMEM = " [Del]" ;
@@ -143,20 +144,25 @@ const char f10str[] PROGMEM = "[F10]";
143144const char f11str[] PROGMEM = " [F11]" ;
144145const char f12str[] PROGMEM = " [F12]" ;
145146
146- const int8_t sizes[] PROGMEM = { 5 , 5 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 };
147+ // Due to AVR Harvard architecture array of string pointers to actual strings
147148const char *const keys[] PROGMEM = {
148- tabstr, escstr, delstr, f1str, f2str, f3str ,
149- f4str, f5str, f6str, f7str, f8str,
149+ spacestr, tabstr, escstr, delstr, f1str, f2str,
150+ f3str, f4str, f5str, f6str, f7str, f8str,
150151 f9str, f10str, f11str, f12str };
152+ const int8_t sizes[] PROGMEM = { 1 , 5 , 5 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 };
151153char buffer[ 8 ];
154+
152155#elif defined(ARDUINO_ARCH_SAM)
153- const uint8_t codes[] = { PS2_KEY_TAB, PS2_KEY_ESC, PS2_KEY_DELETE, PS2_KEY_F1, PS2_KEY_F2,
154- PS2_KEY_F3, PS2_KEY_F4, PS2_KEY_F5, PS2_KEY_F6, PS2_KEY_F7,
155- PS2_KEY_F8, PS2_KEY_F9, PS2_KEY_F10, PS2_KEY_F11, PS2_KEY_F12 };
156- const char *const keys[] = { " [Tab]" , " [ESC]" , " [Del]" , " [F1]" , " [F2]" , " [F3]" ,
156+ const uint8_t codes[] = { PS2_KEY_SPACE, PS2_KEY_TAB, PS2_KEY_ESC,
157+ PS2_KEY_DELETE, PS2_KEY_F1, PS2_KEY_F2, PS2_KEY_F3,
158+ PS2_KEY_F4, PS2_KEY_F5, PS2_KEY_F6, PS2_KEY_F7,
159+ PS2_KEY_F8, PS2_KEY_F9, PS2_KEY_F10, PS2_KEY_F11,
160+ PS2_KEY_F12 };
161+ const char *const keys[] = { " " , " [Tab]" , " [ESC]" , " [Del]" , " [F1]" , " [F2]" , " [F3]" ,
157162 " [F4]" , " [F5]" , " [F6]" , " [F7]" , " [F8]" ,
158163 " [F9]" , " [F10]" , " [F11]" , " [F12]" };
159- const int8_t sizes[] = { 5 , 5 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 };
164+ const int8_t sizes[] = { 1 , 5 , 5 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 };
165+
160166#else
161167 #error “This library only supports boards with an AVR or SAM processor.”
162168#endif
@@ -231,6 +237,7 @@ if( keyboard.available() )
231237 switch ( c ) /* Cursor movements */
232238 {
233239 case PS2_KEY_ENTER: /* Cursor to beginning of next line or start */
240+ case PS2_KEY_KP_ENTER:
234241 cols = 0 ;
235242 rows++;
236243 if ( rows >= MAX_ROW )
0 commit comments