diff --git a/terminal_keyboard_emulator.ino b/terminal_keyboard_emulator.ino index 8706bc0..e0998e0 100644 --- a/terminal_keyboard_emulator.ino +++ b/terminal_keyboard_emulator.ino @@ -140,10 +140,78 @@ void onSlaveClockInterrupt() { } void setupKeyMapping() { + m[0] = 0; + m[223] = ' '; + // top letter row + m[246] = '\t'; + m[142] = 'q'; + m[136] = 'w'; + m[154] = 'e'; + m[141] = 'r'; + m[139] = 't'; + m[134] = 'y'; + m[138] = 'u'; + m[150] = 'i'; + m[144] = 'o'; + m[143] = 'p'; + m[191] = '@'; + m[164] = '['; + m[245] = 0x0A; + m[128] = 0x7F; + // middle letter row + /* + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + m[] = ''; + /**/ } char translateKeyToChar(int key) { - return key; //m[key]; if (sizeof(m) <= key) { return 0; } @@ -156,11 +224,13 @@ void printChar(char keyChar) { void processKbdByte(int data) { int key = data; - if (modConsoleLog) { - Serial.print("Key: <"); Serial.print(int(key)); Serial.print("> "); - } char keyChar = translateKeyToChar(key); + if (modConsoleLog) { + Serial.print("Key: <"); Serial.print(int(key)); Serial.print("> "); + Serial.print("Char: "); printChar(keyChar); + } + #ifdef KEYBOARD Keyboard.press(keyChar); delay(10); @@ -168,11 +238,6 @@ void processKbdByte(int data) { #endif typeKey(keyChar); - - if (modConsoleLog) { - Serial.print("Press: "); - printChar(keyChar); - } } // ----------------------