An Arduino Sketch for an NKRO (N-Key Rollover) XT -> USB adapter
================================================================

(by Sean Jensen, Summer 2016.)


NOTES:
======

The sketch targets the Arduino MICRO board.

The sketch should be compiled and deployed within the
Arduino IDE.

The sketch is compatible ONLY with the original 83-key
IBM XT Model F keyboard. (This is the only keyboard of the
family that doesn't have an xwhatsit controller.)

The sketch does NOT currently support the USB Boot/Legacy protocol,
so cannot be used to hack your BIOS settings. It needs the full
USB HID support provided by your OS.

Roll-over support is full: every key can be depressed simultaneously.

The scancode --> usage code conversion table can be hacked
in the XTUSBMAP.h file, if you would like an idiosyncratic key arrangement.

Permissive ISC license (see LICENSE file).

Sourcecode is heavily commented.


BOARD SETUP:
============

I used a breadboard, and a breadboard compatible PCB-mountable
5-pin DIN socket. A bit pricey for what it is, but my soldering
is crap.

As you look into the DIN socket, the pins are numbered clockwise
from 4 o'clock: 1, 4, 2, 5, 3.

As you look at the back (wiring side) of your PCB-mountable socket,
this translates into the pins going from left to right numbered as:
1, 4, 2, 5, 3.

The XT keyboard only uses four of the five pins, which should be
connected as follows:

  DIN pin 1  (CLOCK)  connects to Arduino MICRO pin 3 
  DIN pin 2  (DATA)   connects to Arduino MICRO pin 4 
  DIN pin 4  (GROUND) connects to Arduino MICRO Ground pin 
  DIN pin 5  (+5V)    connects to Arduino MICRO 5V pin 

DIN pin 3 (RESET) is not connected and is unused by the XT keyboard.

RIG.jpg shows my setup: Arduino MICRO pin 12 is
plugged into (30,h). Pin 1 of the DIN socket is plugged into
(1,l). The above connections are made as follows:

  CLOCK:  BLUE   from  (1,k) to (21,k)
  DATA:   YELLOW from  (4,k) to (22,k)
  GROUND: BLACK  from  (2,k) to (19,k)
  +5V:    RED    from  (6,k) to (19,b)

