Acorn Electron keyboard scanner, turns an old Acorn Electron into a USB keyboard.

Dependencies:   USBDevice mbed

Revision:
2:9352b1232e6d
Parent:
1:84cd616cc684
--- a/main.cpp	Mon May 12 20:15:52 2014 +0000
+++ b/main.cpp	Wed Jun 18 07:42:47 2014 +0000
@@ -1,3 +1,86 @@
+/*
+ * This is a simple mbed program for driving 
+ * an Acorn Electron keyboard from a KL25Z mbed
+ * board.
+ *
+ * It is placed in the public domain by its author,
+ * Ian Harvey. Note that there is NO WARRANTY.
+ */
+ 
+/* About the Electron keyboard -----------------
+
+The keyboard itself has 14 'columns' and 4 'rows'.
+The column being scanned is driven low and four row
+bits are read out. The keyboard has diodes on the columns
+and pull-ups on the rows, so there's no need to tri-state
+un-driven columns or activate pullups. The break key
+is wired separately and connects directly to ground
+when preseed. Connections are as follows:
+
+1.  Break key       PTE5
+2.  Caps lock LED   PTE4
+3.  Ground
+4.  V+ for LED 
+5.  Row 3           PTE3
+6.  Row 2           PTE2
+7.  Row 1           PTB11
+8.  Row 0           PTB10
+9.  Col 13          PTA1
+10. Col 12          PTC7
+11. Col 11          PTA2
+12. Col 10          PTC0
+13. Col 9           PTD4
+14. Col 8           PTC3
+15. Col 7           PTA12
+16. Col 6           PTC4
+17. Col 5           PTA4
+18. Col 4           PTC5
+19. Col 3           PTA5
+20. Col 2           PTC6
+21. Col 1           PTC8
+22. Col 0           PTC10
+
+Pin "1" (my numbering) is closest to the corner
+of the board, and pin "22" is next to the space
+bar. The connections of the keys follow the 
+layout in 'hid_keys' below, so KEY_PERIOD is 
+col 0 row 0, KEY_L is col 0 row 1, and so on.
+We're using the following modifications:
+
+"CAPS LK"  -> KEY_TAB
+"[ ] COPY" -> KEY_OPEN_SQUARE
+"DELETE" -> KEY_LEFT_ALT
+": *" -> KEY_SINGLE_QUOTE
+
+The firmware also treats the 'break' key as
+'row 4' all on its own (mapped to KEY_BACKSPACE).
+
+When 'DELETE' (the LEFT_ALT key) is pressed,
+the keyboard map in 'alt_keys' is used, so
+e.g. KEY_MINUS becomes KEY_EQUALS.
+
+Keyboard layout
+---------------
+
+Note that the keycaps on the Electron keyboard
+are considerably different to those on a regular
+PC-style one: shift-6 is labelled '&' not '^',
+shift-';' is labelled '+' not ':', and so on.
+The code here *doesn't* change which key code
+is sent when shift is pressed, so the characters
+you get are those you'd get on a PC keyboard -
+after some experimentation I personally preferred
+this. If this isn't to your taste, creating a
+custom keyboard layout on the PC/Pi may be the best
+way to fix this.
+
+I tend to use a 'US' keyboard layout with this
+keyboard, so shift-3 generates a '#', not a
+UK pound sign, and the single/double quotes are
+next to the ';' key (labelled ': *' on the Electron).
+
+---------------------------------------------- */
+
 #include "mbed.h"
 #include "USBKeyboard.h"
 #include "hid_keys.h"