]> git.donarmstrong.com Git - tmk_firmware.git/commitdiff
Change keymap of ADB converter.
authortmk <nobody@nowhere>
Thu, 20 Sep 2012 04:02:42 +0000 (13:02 +0900)
committertmk <nobody@nowhere>
Fri, 21 Sep 2012 01:51:44 +0000 (10:51 +0900)
converter/adb_usb/Makefile
converter/adb_usb/README [deleted file]
converter/adb_usb/README.md [new file with mode: 0644]
converter/adb_usb/config.h
converter/adb_usb/keymap.c

index e9a90695b106860fe674aa125bedcbc85e47cdbf..87b0f415b8ed401bc3f1dd569a6545be8d45d14c 100644 (file)
@@ -35,8 +35,7 @@ F_CPU = 16000000
 # Build Options
 #   comment out to disable the options.
 #
 # Build Options
 #   comment out to disable the options.
 #
-MOUSEKEY_ENABLE = yes  # Mouse keys
-#PS2_MOUSE_ENABLE = yes        # PS/2 mouse(TrackPoint) support
+#MOUSEKEY_ENABLE = yes # Mouse keys
 EXTRAKEY_ENABLE = yes  # Audio control and System control
 #NKRO_ENABLE = yes     # USB Nkey Rollover
 
 EXTRAKEY_ENABLE = yes  # Audio control and System control
 #NKRO_ENABLE = yes     # USB Nkey Rollover
 
diff --git a/converter/adb_usb/README b/converter/adb_usb/README
deleted file mode 100644 (file)
index 5d0e1bc..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-ADB to USB keyboard converter
-=============================
-http://geekhack.org/showwiki.php?title=Island:14290
-
-This firmware converts ADB keyboard protocol to USB.
-
-
-Build
------
-0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data).
-   You need a external pull-up resistor on DATA line in most case,
-   in particular when you want to use a long or coiled cable.
-   This converter uses AVR's internal pull-up, but it seems to be too weak.
-   The external pull-up resistor is strongly recommended.
-   PSW line is optional. See ADB.txt for details.
-1. Define following macros for ADB connection in config.h:
-   ADB_PORT
-   ADB_PIN
-   ADB_DDR
-   ADB_DATA_BIT
-   ADB_PSW_BIT
-2. make
-3. program Teensy.
-
-
-Keymap
-------
-You can change a keymap by editing code of keymap.c like following.
-This is a keymap for AEK, however, also used for other keyboards.
-How to define the keymap is probably obvious. You can find  key
-symbols in usb_keycodes.h.
-If you want to define some keymaps than just one, see hhkb/keymap.c and
-macway/keymap.c as examples. Keymap(layer) switching may needs a bit of
-effort at this time.
-
-    /* Default Layer: plain keymap
-     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
-     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Pwr|
-     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
-     * ,-----------------------------------------------------------. ,-----------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
-     * |-----------------------------------------------------------| |-----------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
-     * |-----------------------------------------------------------| `-----------' |---------------|
-     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|  +|
-     * |-----------------------------------------------------------|     ,---.     |---------------|
-     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
-     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
-     * |Ctrl |Gui |Alt |         Space           |     |    |      | |Lef|Dow|Rig| |      0|  .|   |
-     * `-----------------------------------------------------------' `-----------' `---------------'
-     */
-    KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    PWR,
-    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
-    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
-    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
-    LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
-    ),
-
-
-Notes
------
-Many ADB keyboards has no discrimination between right modifier and left one,
-you will always see left control even if you press right control key.
-Apple Extended Keyboard and Apple Extended Keyboard II are the examples.
-Though ADB protocol itsef has the ability of distinction between right and left.
-And most ADB keyboard has no NKRO functionality, though ADB protocol itsef has that. 
-
-EOF
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
new file mode 100644 (file)
index 0000000..a41d84e
--- /dev/null
@@ -0,0 +1,81 @@
+ADB to USB keyboard converter
+=============================
+This firmware converts ADB keyboard protocol to USB.
+You can use PJRC Teensy for this converter, though, other USB AVR(ATMega32U4, AT90USB64/128 or etc) should work.
+But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U2.
+
+Discuss: http://geekhack.org/showwiki.php?title=Island:14290
+
+
+Build
+-----
+0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port F0.
+   This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable.
+   The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.
+1. Define following macros for ADB connection in config.h if you use other than port F0.
+   ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
+2. make
+3. program Teensy
+
+
+LOCKING CAPSLOCK
+----------------
+Many old ADB keyboards have mechanical push-lock switch for Capslock key. This converter support the locking Capslock key by default.
+This feature will prevent you from remaping as normal key. You can disable the feature by *commenting out* a macro in config.h like this:
+
+    //#define MATRIX_HAS_LOCKING_CAPS
+
+Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
+http://www.youtube.com/watch?v=9wqnt2mGJ2Y
+
+
+Keymap
+------
+You can change a keymap by editing code of keymap.c like following.
+This is a keymap for AEK, however, also used for other keyboards.
+How to define the keymap is probably obvious. You can find key symbols in usb_keycodes.h.
+If you want to define some keymaps than just one, see hhkb/keymap.c and
+macway/keymap.c as examples. Keymap(layer) switching may needs a bit of
+effort at this time.
+
+    /* Default Layer: plain keymap
+     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
+     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Pwr|
+     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
+     * ,-----------------------------------------------------------. ,-----------. ,---------------.
+     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
+     * |-----------------------------------------------------------| |-----------| |---------------|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
+     * |-----------------------------------------------------------| `-----------' |---------------|
+     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|  +|
+     * |-----------------------------------------------------------|     ,---.     |---------------|
+     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
+     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+     * |Ctrl |Gui |Alt |         Space           |     |    |      | |Lef|Dow|Rig| |      0|  .|   |
+     * `-----------------------------------------------------------' `-----------' `---------------'
+     */
+    KEYMAP(
+    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    PWR,
+    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
+    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
+    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
+    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
+    LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
+    ),
+
+
+Magic command
+-------------
+To get help press `h` holding Magic key. Magic key is `Power key`.
+
+
+Notes
+-----
+Many ADB keyboards has no discrimination between right modifier and left one,
+you will always see left control even if you press right control key.
+Apple Extended Keyboard and Apple Extended Keyboard II are the examples.
+Though ADB protocol itsef has the ability of distinction between right and left.
+And most ADB keyboard has no NKRO functionality, though ADB protocol itsef has that. 
+See protocol/adb.c for more info.
+
+EOF
index 52d5925a508e43bd9c50da1a5f10bc6e64bf0fd7..875c48ce84de9e2482eb7ff3de20bf524c91860f 100644 (file)
@@ -35,12 +35,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* Locking Caps Lock support */
 #define MATRIX_HAS_LOCKING_CAPS
 
 /* Locking Caps Lock support */
 #define MATRIX_HAS_LOCKING_CAPS
 
-
-/* key combination for command */
-#define IS_COMMAND() ( \
-    keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_LCTRL) | MOD_BIT(KB_LALT) | MOD_BIT(KB_LGUI)) || \
-    keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)) \
-)
+#define MATRIX_ROW(code)    ((code)>>3&0x0F)
+#define MATRIX_COL(code)    ((code)&0x07)
 
 
 /* mouse keys */
 
 
 /* mouse keys */
@@ -49,19 +45,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #endif
 
 
 #endif
 
 
-/* PS/2 mouse */
-#ifdef PS2_MOUSE_ENABLE
-#   define PS2_CLOCK_PORT  PORTF
-#   define PS2_CLOCK_PIN   PINF
-#   define PS2_CLOCK_DDR   DDRF
-#   define PS2_CLOCK_BIT   0
-#   define PS2_DATA_PORT   PORTF
-#   define PS2_DATA_PIN    PINF
-#   define PS2_DATA_DDR    DDRF
-#   define PS2_DATA_BIT    1
-#endif
-
-
 /* ADB port setting */
 #define ADB_PORT        PORTF
 #define ADB_PIN         PINF
 /* ADB port setting */
 #define ADB_PORT        PORTF
 #define ADB_PIN         PINF
@@ -69,4 +52,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define ADB_DATA_BIT    0
 //#define ADB_PSW_BIT     1       // optional
 
 #define ADB_DATA_BIT    0
 //#define ADB_PSW_BIT     1       // optional
 
+/* key combination for command */
+#include "adb.h"
+#define IS_COMMAND() ( \
+    matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
+)
+
 #endif
 #endif
index 2d16579336dfb8f639f5d80b2d00b3563f28c73b..c6827f1d5931400890f56e4959c1e9074fd58d29 100644 (file)
@@ -96,7 +96,7 @@ static const uint8_t PROGMEM fn_layer[] = {
 // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
 // See layer.c for details.
 static const uint8_t PROGMEM fn_keycode[] = {
 // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
 // See layer.c for details.
 static const uint8_t PROGMEM fn_keycode[] = {
-    KB_NO,          // Fn0
+    KB_BSLS,        // Fn0
     KB_NO,          // Fn1
     KB_NO,          // Fn2
     KB_NO,          // Fn3
     KB_NO,          // Fn1
     KB_NO,          // Fn2
     KB_NO,          // Fn3
@@ -109,7 +109,7 @@ static const uint8_t PROGMEM fn_keycode[] = {
 static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     /* Default Layer: plain keymap
      * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
 static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     /* Default Layer: plain keymap
      * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
-     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Fn0|
+     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Pwr|
      * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
      * ,-----------------------------------------------------------. ,-----------. ,---------------.
      * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
      * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
      * ,-----------------------------------------------------------. ,-----------. ,---------------.
      * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
@@ -124,9 +124,9 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      * `-----------------------------------------------------------' `-----------' `---------------'
      */
     KEYMAP(
      * `-----------------------------------------------------------' `-----------' `---------------'
      */
     KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    FN0,
+    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
+    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,FN0,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
     CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
     LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
     LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
@@ -134,12 +134,12 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
     /* Default Layer: plain keymap
      * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
 
     /* Default Layer: plain keymap
      * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
-     * |`  |   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Fn0|
+     * |`  |   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Pwr|
      * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
      * ,-----------------------------------------------------------. ,-----------. ,---------------.
      * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
      * |-----------------------------------------------------------| |-----------| |---------------|
      * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
      * ,-----------------------------------------------------------. ,-----------. ,---------------.
      * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
      * |-----------------------------------------------------------| |-----------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|PrS|ScL|Pau|Up |Ins|    \| |Del|End|PgD| |MwD|McU|MwU|MwD|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|PrS|ScL|Pau|Up |Ins|  Fn0| |Del|End|PgD| |MwD|McU|MwU|MwD|
      * |-----------------------------------------------------------| `-----------' |---------------|
      * |CapsLo|VoD|VoU|Mut|  F|  G|  H|  J|Hom|PgU|Lef|Rig|Return  |               |McL|McD|McR|MwU|
      * |-----------------------------------------------------------|     ,---.     |---------------|
      * |-----------------------------------------------------------| `-----------' |---------------|
      * |CapsLo|VoD|VoU|Mut|  F|  G|  H|  J|Hom|PgU|Lef|Rig|Return  |               |McL|McD|McR|MwU|
      * |-----------------------------------------------------------|     ,---.     |---------------|
@@ -149,9 +149,9 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      * `-----------------------------------------------------------' `-----------' `---------------'
      */
     KEYMAP(
      * `-----------------------------------------------------------' `-----------' `---------------'
      */
     KEYMAP(
-    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    FN0,
+    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO, 
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, BSLS,     DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
+    TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, FN0,      DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
     CAPS,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   END, PGDN,DOWN,          RSFT,          PGUP,         WH_L,MS_D,WH_R,
     LCTL,LGUI,LALT,          SPC,                                              HOME,PGDN,END,     BTN1,     BTN2,BTN3
     CAPS,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   END, PGDN,DOWN,          RSFT,          PGUP,         WH_L,MS_D,WH_R,
     LCTL,LGUI,LALT,          SPC,                                              HOME,PGDN,END,     BTN1,     BTN2,BTN3