@@ -122,7 +122,7 @@ int8_t rows = 0;
122122/* messages constants */
123123/* Key codes and strings for keys producing a string */
124124/* three arrays in same order ( keycode, string to display, length of string ) */
125- #if defined(ARDUINO_ARCH_AVR )
125+ #if defined(PS2_REQUIRES_PROGMEM )
126126const 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,
@@ -152,7 +152,7 @@ const char *const keys[] PROGMEM = {
152152const int8_t sizes[] PROGMEM = { 1 , 5 , 5 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 };
153153char buffer[ 8 ];
154154
155- #elif defined(ARDUINO_ARCH_SAM)
155+ #else
156156const uint8_t codes[] = { PS2_KEY_SPACE, PS2_KEY_TAB, PS2_KEY_ESC,
157157 PS2_KEY_DELETE, PS2_KEY_F1, PS2_KEY_F2, PS2_KEY_F3,
158158 PS2_KEY_F4, PS2_KEY_F5, PS2_KEY_F6, PS2_KEY_F7,
@@ -162,9 +162,6 @@ const char *const keys[] = { " ", "[Tab]", "[ESC]", "[Del]", "[F1]", "[F2]", "
162162 " [F4]" , " [F5]" , " [F6]" , " [F7]" , " [F8]" ,
163163 " [F9]" , " [F10]" , " [F11]" , " [F12]" };
164164const int8_t sizes[] = { 1 , 5 , 5 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 };
165-
166- #else
167- #error “This library only supports boards with an AVR or SAM processor.”
168165#endif
169166
170167// initialize the keyboard library with the numbers of the interface pins
@@ -187,15 +184,9 @@ lcd.begin( MAX_COL, MAX_ROW );
187184lcd.clear (); // clear the screen
188185lcd.cursor (); // Enable Cursor
189186lcd.blink (); // Blinking cursor
190- #if defined(ARDUINO_ARCH_AVR)
191- lcd.print ( F ( " PC Services" ) ); // Display sign-on text
192- lcd.setCursor ( 0 ,1 );
193- lcd.print ( F ( " Keyboard to LCD" ) );
194- #elif defined(ARDUINO_ARCH_SAM)
195187lcd.print ( " PC Services" ); // Display sign-on text
196188lcd.setCursor ( 0 ,1 );
197189lcd.print ( " Keyboard to LCD" );
198- #endif
199190lcd.setCursor ( 12 ,0 );
200191cols = 12 ; // update cursor position
201192rows = 0 ;
@@ -312,27 +303,27 @@ if( keyboard.available() )
312303 if ( c != PS2_KEY_EUROPE2 && ( c < PS2_KEY_KP0 || c >= PS2_KEY_F1 ) )
313304 { // Non printable sort which ones we can print
314305 for ( idx = 0 ; idx < sizeof ( codes ); idx++ )
315- #if defined(ARDUINO_ARCH_AVR )
306+ #if defined(PS2_REQUIRES_PROGMEM )
316307 if ( c == pgm_read_byte ( codes + idx ) )
317- #elif defined(ARDUINO_ARCH_SAM)
308+ #else
318309 if ( c == codes[ idx ] )
319310#endif
320311 { /* String outputs */
321312 mode = 1 ;
322- #if defined(ARDUINO_ARCH_AVR )
313+ #if defined(PS2_REQUIRES_PROGMEM )
323314 c = pgm_read_byte ( sizes + idx );
324- #elif defined(ARDUINO_ARCH_SAM)
315+ #else
325316 c = sizes[ idx ];
326317#endif
327318 cols += c - 1 ;
328319 check_cursor ( );
329320 /* when cursor reset keep track */
330321 if ( cols == 0 )
331322 cols = c;
332- #if defined(ARDUINO_ARCH_AVR )
323+ #if defined(PS2_REQUIRES_PROGMEM )
333324 strcpy_P ( buffer, (char *)pgm_read_word ( &( keys[ idx ] ) ) );
334325 lcd.print ( buffer );
335- #elif defined(ARDUINO_ARCH_SAM)
326+ #else
336327 lcd.print ( keys[ idx ] );
337328#endif
338329 cols++;
0 commit comments