├── PS-2_Tester.ino ├── README.md ├── images ├── FEMALE_DIN_5_Keyboard_Connector.png ├── PS2-Pinout.jpg ├── README.MD ├── converter_mockup.jpg ├── keyboard_adapter_scam.jpg ├── male_din_5_XT_AT_Connector_Keyboard.jpg ├── pinout_ps2_cable_male.gif ├── pinout_usb_PS2_conversion_keyboard.png ├── prototype_ps2_keyboard_tester_serial.jpg └── serial_test.png ├── libraries └── todo.txt ├── megaxt.ino └── tinyxt.ino /PS-2_Tester.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const int DataPin = 8; 4 | const int IRQpin = 3; 5 | 6 | PS2Keyboard keyboard; 7 | 8 | void setup() { 9 | delay(1000); 10 | keyboard.begin(DataPin, IRQpin); 11 | Serial.begin(9600); 12 | Serial.println("Keyboard Test:"); 13 | } 14 | 15 | void loop() { 16 | if (keyboard.available()) { 17 | 18 | // read the next key 19 | char c = keyboard.read(); 20 | 21 | // check for some of the special keys 22 | if (c == PS2_ENTER) { 23 | Serial.println(); 24 | } else if (c == PS2_TAB) { 25 | Serial.print("[Tab]"); 26 | } else if (c == PS2_ESC) { 27 | Serial.print("[ESC]"); 28 | } else if (c == PS2_PAGEDOWN) { 29 | Serial.print("[PgDn]"); 30 | } else if (c == PS2_PAGEUP) { 31 | Serial.print("[PgUp]"); 32 | } else if (c == PS2_LEFTARROW) { 33 | Serial.print("[Left]"); 34 | } else if (c == PS2_RIGHTARROW) { 35 | Serial.print("[Right]"); 36 | } else if (c == PS2_UPARROW) { 37 | Serial.print("[Up]"); 38 | } else if (c == PS2_DOWNARROW) { 39 | Serial.print("[Down]"); 40 | } else if (c == PS2_DELETE) { 41 | Serial.print("[Del]"); 42 | } else { 43 | 44 | // otherwise, just print all normal characters 45 | Serial.print(c); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TinyXTConverter 2 | 3 | Minimal documentation and hardware schematics to build a working tiny PS/2 keyboard converter. 4 | 5 | PC -> XT or AT (PS/2 & DIN5) 6 | 7 | This project is available as an affordable kit or finished product that ships worldwide: [buy to support my work]() 8 | 9 | Firmware by: https://github.com/kesrut/pcxtkbd (GPL 2.0 License, see his repo for latest updates, may break the stable and working specific code for Uno, Nano and Tiny) 10 | 11 | # Tested on 12 | - Amstrad PC5086 (XT Clone) 13 | 14 | ![Mockup of the converter](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/converter_mockup.jpg) 15 | 16 | Or you can build it yourself! It's not that hard, no worries! 17 | 18 | Using this nifty piece of gear you'll be able to use a normal PS/2 or sometimes USB keyboard on your old machines such as: 19 | 20 | - Pentium 1 machines 286 / 386 / ... 21 | - Amstrad PC1512, PC4086, PC5086 22 | - Commodore Amiga 1000 / 2000 Computers 23 | - Old Bull Micral, Goupil, Olivetti, Thomson, IBM ... computers 24 | 25 | ## BOM: 26 | - Arduino (eg: Nano) or ATTiny85 + IC Socket (ATTiny45 may be compatible) 27 | - Breadboard or PCB 28 | - DIN5 or PS/2 male connector (for the XT PC eg: a mouse or keyboard cable) 29 | - PS/2 or USB female connector (for the keyboard) 30 | - Cables/Jumpers if breadboard 31 | 32 | # Testing your USB keyboard with PS/2 capabilities (optional) 33 | ![keyboard test arduino](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/prototype_ps2_keyboard_tester_serial.jpg) 34 | 35 | If you have an USB keyboard, follow this pinout schematic to connect it to the duino/PCB. 36 | 37 | There is a dependency which is the ```PS2Keyboard.h``` library. 38 | 39 | You can then test that the communication is occuring with the script ```PS-2_Tester.ino``` 40 | 41 | You may copy the code directly from [here](https://raw.githubusercontent.com/nazmifr/TinyXT/master/PS-2_Tester.ino) 42 | 43 | (open Tools>Serial Monitor to see the key presses) 44 | 45 | Pins for the KB tester: 46 | - D3 = Data 47 | - D8 = Clock 48 | - 5V = 5V 49 | - GND = GND 50 | 51 | /!\ This converter uses a microcontroller that doesn't have USB Host capabilities, thus it will be unable to convert an USB keyboard that doesn't have legacy protocol fallback to PS/2 (many commercial USB keyboards have this feature). 52 | 53 | See [this]() project for an USB to AT Keyboard converter. (it does USB -> Apple ADB as well :p) 54 | 55 | Tested on Arduino Nano. Adapt accordingly. 56 | 57 | Numlock and Capslock are not implemented on this test script, no worries! 58 | 59 | This should be the result: 60 | ![Serial keyboard test arduino](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/serial_test.png) 61 | 62 | # Arduino prototype 63 | 64 | Once you've tested your keyboard, you can take it to the next level: creating a prototype converter. Considering the price of an arduino these days (<5€) this is a perfectly okay solution compared to the converters currently available that cost between 25-30€ for less functionality (the arduino can be reused in another project, those converters can't) 65 | 66 | I strongly advise reusing old connectors for the build as well as avoiding to use a breadboard, flying wire mounting is perfectly fine for such a low voltage, low current, low speed project. 67 | 68 | The only con of using an arduino is the power consumption that jumps from 5mW to 150mW, it should be fine in most cases but for some really old computers, a more finely engineered setup might be preferable. 69 | 70 | ## Pins and pinouts 71 | 72 | ### Pinouts 73 | 74 | #### USB 75 | If you have an USB keyboard, here's the pinout for the converter input: 76 | 77 | ![USB to PS/2 Pinout](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/pinout_usb_PS2_conversion_keyboard.png) 78 | 79 | #### PS/2 (Mini-Din6) 80 | If you have a PS/2 mini-din keyboard, here's the pinout for the input (colors are just indicative and may vary if you salvaged a cable): 81 | ![PS/2 Pinout Mini-din 6](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/PS2-Pinout.jpg) 82 | ![PS/2 Pinout Minidin cable male](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/pinout_ps2_cable_male.gif) 83 | 84 | #### XT / AT (DIN 5) 85 | On the motherboard side, please wire accordingly to your connector or cable either just over here for a mini-din or here for DIN 5 (don't forget to flip depending if you have a male or female connector): 86 | ![](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/FEMALE_DIN_5_Keyboard_Connector.png) 87 | ![](https://raw.githubusercontent.com/nazmifr/TinyXT/master/images/male_din_5_XT_AT_Connector_Keyboard.jpg) 88 | 89 | ### Pins 90 | The pins can be edited in the code to suit your board! 91 | 92 | - Keyboard 5V = VCC = Computer 5V 93 | - Keyboard Clock = Pin D3 94 | - Keyboard Data = Pin D4 95 | - Computer Clock = Pin D2 96 | - Computer Data = Pin D5 97 | - Computer Ground = Keyboard Ground = Arduino GND 98 | 99 | **When programming the arduino board (or everytime it is plugged on the USB port of another PC, please remove the lead that wires VCC with the 5V coming from the old computer)** 100 | 101 | Don't forget to install the ```PS2KeyAdvanced``` library and configure your board and serial com port accordingly. 102 | 103 | Here's the [code](https://raw.githubusercontent.com/nazmifr/TinyXT/master/megaxt.ino). 104 | 105 | Program your board, THEN ONLY connect the VCC to the 5V that will be coming from the old computer AND disconnect the USB from your modern PC. 106 | 107 | It's time to try!!! If it doesn't work raise an issue with some details and please investigate and report on your side when it works and when it doesn't and your hypotheses about why it's like that. 108 | 109 | When raising an issue, include your arduino platform, version of arduino IDE, brand and model of keyboard (+if you tried the serial tester or not), and machine you're trying to get the converter working on. 110 | 111 | the megaxt.ino script is for Arduino Uno or Nano or ProMini328 ! 112 | 113 | # Embedded active converter 114 | Coming soon! 115 | Coming soon! 116 | Coming soon! 117 | 118 | You want to build your own version of TinyXT, well you CAN! (you can even sell them if you want to) 119 | 120 | ## BOM 121 | - Attiny85 122 | - PCB 123 | - DIN5 or minidin6 male connector (or cable, can be salvaged from old electronics) 124 | - minidin6 or USB female connector (can be salvaged) 125 | - DIP8 IC socket 126 | 127 | - USB to Serial converter (CH340, FTDI, ...), must support 5V Levels such as the advertised CH340 128 | - Some female-female jumper leads 129 | 130 | ## Programming the attiny 131 | You need to install the board definitions for the AtTiny chip. 132 | 133 | Then please download 134 | 135 | Pins 136 | 137 | 138 | # Tutorials and insights for the newbie 139 | 140 | Configuring the proper board and com_port ([Windows]() [Linux]()) 141 | Installing new board definitions 142 | Etching a PCB 143 | Setting up the Arduino IDE 144 | Installing an arduino library 145 | Using a breadboard 146 | 147 | # Followup projects (coming soon) 148 | 149 | Attiny keylogger 150 | Attiny wifi wireless keylogger 151 | PS/2 TO ADB 152 | PS/2 TO A 153 | 154 | # Made possible by: 155 | 156 | [arduino community](https://arduino.orgcc) 157 | 158 | [techpaul's ps/2 advanced library](https://github.com/techpaul/PS2KeyAdvanced) 159 | 160 | [PJRC's ps/2 library](https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html), 161 | 162 | [djsadeepa's instructables on interfacing a PS/2 keyboard and an arduino](https://www.instructables.com/id/Connect-PS2-Keyboard-to-Arduino/) 163 | 164 | [Pedro Umbelino Hackaday article on the old PIC solution](https://hackaday.com/2017/01/21/attoxtkeyboard/) 165 | 166 | [kesrut software implementation on Arduino ATMega/ATTiny platform](https://github.com/kesrut/pcxtkbd) 167 | 168 | & [Kicad's creators and contributors (CERN)](https://www.kicad-pcb.org/) 169 | 170 | also thanks to [pinouts.ru](https://pinouts.ru/InputCables/usb_ps2_mouse_pinout.shtml) 171 | 172 | -------------------------------------------------------------------------------- /images/FEMALE_DIN_5_Keyboard_Connector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/FEMALE_DIN_5_Keyboard_Connector.png -------------------------------------------------------------------------------- /images/PS2-Pinout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/PS2-Pinout.jpg -------------------------------------------------------------------------------- /images/README.MD: -------------------------------------------------------------------------------- 1 | Images for the tutorial 2 | -------------------------------------------------------------------------------- /images/converter_mockup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/converter_mockup.jpg -------------------------------------------------------------------------------- /images/keyboard_adapter_scam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/keyboard_adapter_scam.jpg -------------------------------------------------------------------------------- /images/male_din_5_XT_AT_Connector_Keyboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/male_din_5_XT_AT_Connector_Keyboard.jpg -------------------------------------------------------------------------------- /images/pinout_ps2_cable_male.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/pinout_ps2_cable_male.gif -------------------------------------------------------------------------------- /images/pinout_usb_PS2_conversion_keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/pinout_usb_PS2_conversion_keyboard.png -------------------------------------------------------------------------------- /images/prototype_ps2_keyboard_tester_serial.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/prototype_ps2_keyboard_tester_serial.jpg -------------------------------------------------------------------------------- /images/serial_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nazmifr/TinyXT/4266a5536a579df189dada1b17138917e923e33d/images/serial_test.png -------------------------------------------------------------------------------- /libraries/todo.txt: -------------------------------------------------------------------------------- 1 | download the two libraries + add kicad libs 2 | -------------------------------------------------------------------------------- /megaxt.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define ps_clk 2 // PS CLOCK DATA 4 | #define ps_data 4 // PS DATA PIN 5 | 6 | uint16_t c; 7 | 8 | PS2KeyAdvanced keyboard; 9 | 10 | unsigned char translationTable [256]; 11 | 12 | #define xt_clk 3 // XT CLOCK PIN 13 | #define xt_data 5 // XT DATA PIN 14 | 15 | void setupTable () { 16 | for (int i=0;i<256;i++) { 17 | translationTable[i]=0xff; 18 | } 19 | translationTable[PS2_KEY_SCROLL]=0x46; 20 | translationTable[PS2_KEY_CAPS]=0x3A; 21 | translationTable[PS2_KEY_PAUSE]=0x5f; 22 | translationTable[PS2_KEY_L_SHIFT]=0x2A; 23 | translationTable[PS2_KEY_R_SHIFT]=0x36; 24 | translationTable[PS2_KEY_L_ALT] = 0x38 ; 25 | translationTable[PS2_KEY_L_CTRL]=0x1D; 26 | translationTable[PS2_KEY_L_ARROW]=0x4B; 27 | translationTable[PS2_KEY_R_ARROW]=0x4D; 28 | translationTable[PS2_KEY_UP_ARROW]=0x48; 29 | translationTable[PS2_KEY_DN_ARROW]=0x50; 30 | translationTable[PS2_KEY_DELETE]=0x53; 31 | translationTable[PS2_KEY_ESC]=0x01; 32 | translationTable[PS2_KEY_BS]=0x0E; 33 | translationTable[PS2_KEY_TAB]=0x0F; 34 | translationTable[PS2_KEY_ENTER]=0x1C; 35 | translationTable[PS2_KEY_SPACE]=0x39; 36 | translationTable[PS2_KEY_SEMI] = 0x27 ; 37 | translationTable[PS2_KEY_KP0]=0x52; 38 | translationTable[PS2_KEY_KP1]=0x4F; 39 | translationTable[PS2_KEY_KP2]=0x50; 40 | translationTable[PS2_KEY_KP3]=0x51; 41 | translationTable[PS2_KEY_KP4]=0x4B; 42 | translationTable[PS2_KEY_KP5]=0x4C; 43 | translationTable[PS2_KEY_KP6]=0x4D; 44 | translationTable[PS2_KEY_KP7]=0x47; 45 | translationTable[PS2_KEY_KP8]=0x48; 46 | translationTable[PS2_KEY_KP9]=0x49; 47 | translationTable[PS2_KEY_OPEN_SQ]=0x1A; 48 | translationTable[PS2_KEY_CLOSE_SQ]=0x1B; 49 | translationTable[PS2_LOCK_NUM]=0x45; 50 | //translationTable[PS2_KEY_KP_DOT]=0x53; 51 | translationTable[PS2_KEY_KP_PLUS]=0x4E; 52 | translationTable[PS2_KEY_KP_MINUS]=0x4A; 53 | translationTable[PS2_KEY_KP_TIMES]=0x37; 54 | translationTable[PS2_KEY_KP_DIV]=0x35; 55 | translationTable[PS2_KEY_KP_ENTER]=0x01; 56 | translationTable[PS2_KEY_0]=0x0B; 57 | translationTable[PS2_KEY_1]=0x02; 58 | translationTable[PS2_KEY_2]=0x03; 59 | translationTable[PS2_KEY_3]=0x04; 60 | translationTable[PS2_KEY_4]=0x05; 61 | translationTable[PS2_KEY_5]=0x06; 62 | translationTable[PS2_KEY_6]=0x07; 63 | translationTable[PS2_KEY_7]=0x08; 64 | translationTable[PS2_KEY_8]=0x09; 65 | translationTable[PS2_KEY_9]=0x0A; 66 | translationTable[PS2_KEY_APOS]=0x28; 67 | translationTable[PS2_KEY_COMMA]=0x33; 68 | translationTable[PS2_KEY_MINUS]=0x0C; 69 | translationTable[PS2_KEY_SCROLL] = 0x46 ; 70 | translationTable[PS2_KEY_DOT]=0x34; 71 | translationTable[PS2_KEY_BACK] =0x2B ; 72 | translationTable[PS2_KEY_SINGLE] = 0x29 ; 73 | translationTable[PS2_KEY_DIV]=0x35; 74 | translationTable[PS2_KEY_SINGLE]=28; 75 | translationTable[PS2_KEY_A]=0x1E; 76 | translationTable[PS2_KEY_B]=0x30; 77 | translationTable[PS2_KEY_C]=0x2E; 78 | translationTable[PS2_KEY_D]=0x20; 79 | translationTable[PS2_KEY_E]=0x12; 80 | translationTable[PS2_KEY_F]=0x21; 81 | translationTable[PS2_KEY_G]=0x22; 82 | translationTable[PS2_KEY_H]=0x23; 83 | translationTable[PS2_KEY_I]=0x17; 84 | translationTable[PS2_KEY_J]=0x24; 85 | translationTable[PS2_KEY_K]=0x25; 86 | translationTable[PS2_KEY_L]=0x26; 87 | translationTable[PS2_KEY_M]=0x32; 88 | translationTable[PS2_KEY_N]=0x31; 89 | translationTable[PS2_KEY_O]=0x18; 90 | translationTable[PS2_KEY_P]=0x19; 91 | translationTable[PS2_KEY_Q]=0x10; 92 | translationTable[PS2_KEY_R]=0x13; 93 | translationTable[PS2_KEY_S]=0x1F; 94 | translationTable[PS2_KEY_T]=0x14; 95 | translationTable[PS2_KEY_U]=0x16; 96 | translationTable[PS2_KEY_V]=0x2F; 97 | translationTable[PS2_KEY_W]=0x11; 98 | translationTable[PS2_KEY_X]=0x2D; 99 | translationTable[PS2_KEY_Y]=0x15; 100 | translationTable[PS2_KEY_Z]=0x2c; 101 | translationTable[PS2_KEY_EQUAL]=0x0D; 102 | translationTable[PS2_KEY_F1]=0x3B; 103 | translationTable[PS2_KEY_F2]=0x3C; 104 | translationTable[PS2_KEY_F3]=0x3D; 105 | translationTable[PS2_KEY_F4]=0x3E; 106 | translationTable[PS2_KEY_F5]=0x3F; 107 | translationTable[PS2_KEY_F6]=0x40; 108 | translationTable[PS2_KEY_F7]=0x41; 109 | translationTable[PS2_KEY_F8]=0x42; 110 | translationTable[PS2_KEY_F9]=0x43; 111 | translationTable[PS2_KEY_F10]=0x44; 112 | translationTable[PS2_KEY_F11]=0x85; 113 | translationTable[PS2_KEY_F12]=0x86; 114 | } 115 | 116 | void setup() 117 | { 118 | setupTable () ; 119 | keyboard.begin( ps_data, ps_clk ); 120 | #ifdef DEBUG 121 | Serial.begin(9600) ; 122 | #endif 123 | pinMode(xt_clk, OUTPUT) ; 124 | pinMode(xt_data, OUTPUT) ; 125 | digitalWrite(xt_clk, HIGH) ; 126 | digitalWrite(xt_data, HIGH) ; 127 | } 128 | 129 | void _write(unsigned char value) 130 | { 131 | while (digitalRead(xt_clk) != HIGH) ; 132 | unsigned char bits[8] ; 133 | byte p = 0 ; 134 | byte j = 0 ; 135 | for (j=0 ; j < 8; j++) 136 | { 137 | if (value & 1) bits[j] = 1 ; 138 | else bits[j] = 0 ; 139 | value = value >> 1 ; 140 | } 141 | digitalWrite(xt_clk, LOW) ; 142 | digitalWrite(xt_data, HIGH) ; 143 | delayMicroseconds(120) ; 144 | digitalWrite(xt_clk, HIGH) ; 145 | delayMicroseconds(66) ; 146 | digitalWrite(xt_clk, LOW) ; 147 | delayMicroseconds(30) ; 148 | digitalWrite(xt_clk, HIGH) ; 149 | byte i = 0 ; 150 | for (i=0; i < 8; i++) 151 | { 152 | digitalWrite(xt_clk, HIGH) ; 153 | digitalWrite(xt_data, bits[p]) ; 154 | delayMicroseconds(95) ; 155 | digitalWrite(xt_clk, LOW) ; 156 | digitalWrite(xt_data, LOW) ; 157 | p++ ; 158 | } 159 | digitalWrite(xt_clk, HIGH) ; 160 | digitalWrite(xt_data, LOW) ; 161 | delay(1) ; 162 | } 163 | 164 | byte i = 0 ; 165 | unsigned char ascan; 166 | 167 | void loop() 168 | { 169 | if( keyboard.available() ) 170 | { 171 | c = keyboard.read(); 172 | 173 | if( c > 0 ) 174 | { 175 | #if defined(ARDUINO_ARCH_AVR) 176 | Serial.print( F( "Value " ) ); 177 | Serial.print( c, HEX ); 178 | Serial.print( F( " - Status Bits " ) ); 179 | Serial.print( c >> 8, HEX ); 180 | Serial.print( F( " Code " ) ); 181 | #elif defined(ARDUINO_ARCH_SAM) 182 | Serial.print( "Value " ); 183 | Serial.print( c, HEX ); 184 | Serial.print( " - Status Bits " ); 185 | Serial.print( c >> 8, HEX ); 186 | Serial.print( " Code " ); 187 | #endif 188 | Serial.println( c & 0xFF, HEX ); 189 | } 190 | 191 | if( !( c & PS2_BREAK ) ) 192 | { 193 | switch (c & 0xff) 194 | { 195 | case PS2_KEY_L_CTRL: _write(0xE0); _write(0x1D); break ; 196 | case PS2_KEY_R_ALT: _write(0xE0); _write(0x38); break ; 197 | case PS2_KEY_INSERT: _write(0xE0); _write(0x52); break ; 198 | case PS2_KEY_HOME: _write(0xE0); _write(0x47); break ; 199 | case PS2_KEY_END: _write(0xE0); _write(0x4F); break ; 200 | case PS2_KEY_DN_ARROW: _write(0xE0); _write(0x50); break ; 201 | case PS2_KEY_PGDN: _write(0xE0); _write(0x51); break ; 202 | case PS2_KEY_L_ARROW: _write(0xE0); _write(0x4B); break ; 203 | case PS2_KEY_R_ARROW: _write(0xE0); _write(0x4D); break ; 204 | case PS2_KEY_UP_ARROW: _write(0xE0); _write(0x48); break ; 205 | case PS2_KEY_PGUP: _write(0xE0); _write(0x49); break ; 206 | case PS2_KEY_DELETE: _write(0xE0); _write(0x53); break ; 207 | default: 208 | { 209 | ascan = translationTable[c & 0xff]; 210 | _write(ascan) ; break ; 211 | } 212 | } 213 | 214 | } 215 | 216 | if( ( c & PS2_BREAK ) ) 217 | { 218 | switch (c & 0xff) 219 | { 220 | case PS2_KEY_L_CTRL: _write(0xE0); _write(0x1D | 0x80); break ; 221 | case PS2_KEY_R_ALT: _write(0xE0); _write(0x38 | 0x80); break ; 222 | case PS2_KEY_INSERT: _write(0xE0); _write(0x52 | 0x80); break ; 223 | case PS2_KEY_HOME: _write(0xE0); _write(0x47 | 0x80); break ; 224 | case PS2_KEY_END: _write(0xE0); _write(0x4F | 0x80); break ; 225 | case PS2_KEY_DN_ARROW: _write(0xE0); _write(0x50 | 0x80); break ; 226 | case PS2_KEY_PGDN: _write(0xE0); _write(0x51 | 0x80); break ; 227 | case PS2_KEY_L_ARROW: _write(0xE0); _write(0x4B | 0x80); break ; 228 | case PS2_KEY_R_ARROW: _write(0xE0); _write(0x4D | 0x80); break ; 229 | case PS2_KEY_UP_ARROW: _write(0xE0); _write(0x48 | 0x80); break ; 230 | case PS2_KEY_PGUP: _write(0xE0); _write(0x49 | 0x80); break ; 231 | case PS2_KEY_DELETE: _write(0xE0); _write(0x53 | 0x80); break ; 232 | default: 233 | { 234 | ascan = translationTable[c & 0xff]; 235 | _write(ascan | 0x80) ; 236 | } 237 | } 238 | 239 | } 240 | } 241 | 242 | if (digitalRead(xt_clk) == LOW) // power-on self test 243 | { 244 | delay(20) ; 245 | _write(0xAA) ; 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /tinyxt.ino: -------------------------------------------------------------------------------- 1 | Coming soon 2 | --------------------------------------------------------------------------------