Puzzling behavior while connecting a PS/2 keyboard to Kindle


I'm attempting to connect a PS/2 keyboard to Kindle 3, replacing Kindle's own keyboard, which is a 20-pin row-column matrix of switches. Basically to trigger a key you need to cross a row pin with a column pin. So crossing pin 2 with pin 12 should produce "q". Here is row/column map for reference: http://breadboardconfessions.blogspot.com/2011/06/by-request-kindle-3-keyboard-map.html

I have the PS/2 keyboard connected to Teensy++, then 20 pins going out into Kindle's own keyboard port.

I didn't think it would even work without a multiplexer (switchboard to control which pins get crossed with which), but somehow the five-way controller works totally fine just by putting pins 15-19 into OUTPUT mode. They're supposed to only activate when they are crossed with Pin 20, but even if I disconnect that pin, they still work.

If I put the other pins into OUTPUT mode, I get gibberish (albeit, consistent gibberish):

1 2 3 4 5 6: ^[OH2tdz 7: 1^[OS%^[[24~, 8: 9: 3^-$ (enter) 10: 4ug5c 11: ^[6ih7v 12: qoj8b 13: wpk9n 14: 0ealm

(Pins 1-6 & 20 are rows, 7-19 are columns)

I'm fairly new to this and it's a bit of an electrical puzzle for me at the moment.

If none of them worked, it would make sense and I would just get a multiplexer, but the fact that some of them work as expected while others cause kindle to do crazy stuff (series of nonsensical operations) makes me wonder whether it would be possible to do this with Teensy alone.

Can Teensy++ act as a multiplexer/switchboard?

Is kindle perhaps interpreting all row switches as crossed and pin 20 only registers because it's the last one?

Anything else that I should try?

Here's the code I use for activating the pins (currently mapped to T, Y, U, I and O):

      if (c == 't') { // 15 [up arrow] ^[[A
        pinMode(PIN_C0, OUTPUT);
        digitalWrite(PIN_C0, LOW);
        pinMode(PIN_C0, INPUT); 
      if (c == 'y') { // 16 [down arrow] ^[[B
        pinMode(PIN_E7, OUTPUT);
        digitalWrite(PIN_E7, LOW);
        pinMode(PIN_E7, INPUT); 
      if (c == 'u') { // 17 [left arrow] ^[[D
        pinMode(PIN_E1, OUTPUT);
        digitalWrite(PIN_E1, LOW);
        pinMode(PIN_E1, INPUT); 
      if (c == 'i') { // 18 - [right arrow] ^[[C
        pinMode(PIN_E6, OUTPUT);
        digitalWrite(PIN_E6, LOW);
        pinMode(PIN_E6, INPUT); 
      if (c == 'o') { // 19 - center button
        pinMode(PIN_E0, OUTPUT);
        digitalWrite(PIN_E0, LOW);
        pinMode(PIN_E0, INPUT);