index

Key Matrix

Constructing the (orthogonal) grid (matrix) out of the keyboard layout.

i opened the keyboard, assigned the numbers to wires, followed them, and read off the keys on each one: Here's the result:

Rows:

   '(("space" "tlde" "f2" "f4" "5" "f6" "7" "8" "f8" "f10" "f12"  "numlock" "kpenter" "menu")
     ("right" "kp-" "print" "scroll" "pause" "f11" "f1" "f7" "f5" "6" "4" "6" "f3" "f1" "esc")
     ("rwin" "kp9" "kp*" "pgdown" "end" "bksp" "ae11" "p" "u" "t" "e" "tab" "lock")
     ("m" "-" "." "rctrl" "rshiftr" "enter" "down" "kp1" "kp0" "kp." "b" "z" "x")
     ("<" "s" "c" "v" "n" "ralt" "l" "minus" "bksl" "left" "kp2" "kp3" "kp+u")
                                        ; 6
     ("lalt" "a" "w" "d" "g" "j" "ac11" "ad11" "bksl" "kp4" "kp5" "kp6" "kp+d") ;
                                        ; 7
     ("lctrl" "lshift" "q" "2" "f" "h" "k" "o" "ac10" "ad12" "del" "kp7" "kp8")
                                        ; 8
     ("lwin" "1" "r" "y" "i" "9" "0" "ae12" "ins" "home" "pgup" "up" "kp/")
     )

Columns:

   '(
     ("v" "b" "f" "g" "t" "r" "4" "5")
                                        ; 2
     ("c" "d" "e" "3" "8" "i" "k" "-")
     ("lalt" "ralt" "numlock" "kp-")
     ("x" "s" "w" "2" "f1" "f2" "pgup" "pgdown") ;4
     ("lctrl" "lock" "rctrl")           ;5
     ("lwin" "scroll" "kp+d" "kpenter") ;kp+ seems to have 2 contacts.
     ("tab" "tlde" "esc" "1" "q" "a" "z" "<") ;7
     ("lshift" "rshiftr" "pause")
                                        ; 9
     ("menu" "kp+u" "kp7" "kp4" "kp1" "kp/" "kp*" "print")
     ("kp." "kp3" "kp6" "kp9" "ins" "del" "f3" "f4") ;a
     ("kp0" "kp2" "kp5" "kp8" "home" "end" "f12" "f11")
     ("space" "rwin" "rshiftl" "bksl" "right" "up" ) ;rshift has 2
                                        ; D
     ("f9" "f10" "0" "p" "ac10" "minus" "ac11" "down")
                                        ;e 
     ("f6" "f5" "ae12" "bksp" "enter" "ae11" "ad12"  "left")
                                        ; f
     ("m" "n" "h" "j" "y" "u" "7" "6")
     ("." "l" "o" "9" "f7" "f8" "=" "ad11")
     )

Now, you may have noticed, that i used a lispy syntax for the table: To get the table (i.e. combine the information on the row and the column of each key, to draw the table as ordered rows) i made this program:

;; works with  Gauche scheme:

(define (reconstruct-matrix rows columns)
  ;; make inverse mapping: element -> row
  (let ((inverse-mapping (make-hash-table 'equal?)))
    ; number the columns ?
    (let ((i -1))
      (set! columns (map (lambda (column)
                        (set! i (+ i 1))
                        (cons i column))
                   columns)))            ; sequentially
    ;; 
    (for-each (lambda (column)
                (let ((value (car column)))
                  (for-each (lambda (el)
                              (hash-table-put! inverse-mapping el value))
                      (cdr column))))
        columns)
  ;; (logformat "hash ready\n")
  ;; `then' modify each column:
    (map (lambda (row)
           (let ((temp-vector (make-vector 16))) ;(length row)
             (for-each (lambda (el)
                         (vector-set! temp-vector (hash-table-get inverse-mapping el) el))
                 row)
             (vector->list temp-vector)))
      rows)))


(define (print-table t width)
  (for-each 
      (lambda (row)
        (for-each 
            (lambda (atom)
              (format #t "~8a " atom))
            row)
        (display "\n"))
      t))

(define t
  (reconstruct-matrix
   x ;; here put the expression on 8 rows
   y ;;  ---''----                16 columns
   ))

(print-table t 5)

and this is the result: keyboard