From: tmk Date: Thu, 20 Sep 2012 04:02:42 +0000 (+0900) Subject: Change keymap of ADB converter. X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=9f05dc6f444e159af3805baf5117be4d0da2d349;p=max%2Ftmk_keyboard.git Change keymap of ADB converter. --- diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile index e9a90695..87b0f415 100644 --- a/converter/adb_usb/Makefile +++ b/converter/adb_usb/Makefile @@ -35,8 +35,7 @@ F_CPU = 16000000 # 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 diff --git a/converter/adb_usb/README b/converter/adb_usb/README.md similarity index 69% rename from converter/adb_usb/README rename to converter/adb_usb/README.md index 5d0e1bc8..a41d84eb 100644 --- a/converter/adb_usb/README +++ b/converter/adb_usb/README.md @@ -1,34 +1,39 @@ ADB to USB keyboard converter ============================= -http://geekhack.org/showwiki.php?title=Island:14290 - 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). - 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 +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. +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. +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. @@ -59,6 +64,11 @@ effort at this time. ), +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, @@ -66,5 +76,6 @@ 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 diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h index 52d5925a..875c48ce 100644 --- a/converter/adb_usb/config.h +++ b/converter/adb_usb/config.h @@ -35,12 +35,8 @@ along with this program. If not, see . /* 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 */ @@ -49,19 +45,6 @@ along with this program. If not, see . #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 @@ -69,4 +52,10 @@ along with this program. If not, see . #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 diff --git a/converter/adb_usb/keymap.c b/converter/adb_usb/keymap.c index 2d165793..c6827f1d 100644 --- a/converter/adb_usb/keymap.c +++ b/converter/adb_usb/keymap.c @@ -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[] = { - KB_NO, // Fn0 + KB_BSLS, // Fn0 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 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. - * |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| =| /| *| @@ -124,9 +124,9 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------' `-----------' `---------------' */ 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, - 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 @@ -134,12 +134,12 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 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| * |-----------------------------------------------------------| |-----------| |---------------| - * |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| * |-----------------------------------------------------------| ,---. |---------------| @@ -149,9 +149,9 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------' `-----------' `---------------' */ 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, - 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