From 4e36159be226e544dfebbe06b1955261951209a4 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 25 Nov 2013 09:27:25 +0900 Subject: [PATCH] Add HHKB keymap file on gh60 --- keyboard/gh60/Makefile | 1 + keyboard/gh60/Makefile.pjrc | 8 ++- keyboard/gh60/README.md | 103 ++++++++++++++++++++++------------ keyboard/gh60/keymap_common.h | 19 ++++++- keyboard/gh60/keymap_hhkb.c | 52 +++++++++++++++++ 5 files changed, 143 insertions(+), 40 deletions(-) create mode 100644 keyboard/gh60/keymap_hhkb.c diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile index 6be0c1071..fd202c179 100644 --- a/keyboard/gh60/Makefile +++ b/keyboard/gh60/Makefile @@ -51,6 +51,7 @@ TARGET_DIR = . SRC = keymap_common.c \ matrix.c \ led.c + ifdef KEYMAP SRC := keymap_$(KEYMAP).c $(SRC) else diff --git a/keyboard/gh60/Makefile.pjrc b/keyboard/gh60/Makefile.pjrc index 0ea33ea30..9655ff65a 100644 --- a/keyboard/gh60/Makefile.pjrc +++ b/keyboard/gh60/Makefile.pjrc @@ -48,10 +48,16 @@ TOP_DIR = ../.. TARGET_DIR = . # project specific files -SRC = keymap.c \ +SRC = keymap_common.c \ matrix.c \ led.c +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_poker.c $(SRC) +endif + CONFIG_H = config.h diff --git a/keyboard/gh60/README.md b/keyboard/gh60/README.md index 07ed40d8e..5e0fc244f 100644 --- a/keyboard/gh60/README.md +++ b/keyboard/gh60/README.md @@ -2,9 +2,14 @@ GH60 keyboard firmware ====================== DIY compact keyboard designed and run by komar007 and Geekhack community. -## Threads on Geekhack.org +- Both Rev.A and Rev.B PCB are supported by one firmware binary(issue #64) + +## GH60 Resources +- [KOMAR's project page](http://blog.komar.be/projects/gh60-programmable-keyboard/) - [Prototyping](http://geekhack.org/index.php?topic=34959.0) -- [Beta-test](http://geekhack.org/index.php?topic=37570.0) +- [Rev.A PCB test](http://geekhack.org/index.php?topic=37570.0) +- [Rev.B PCB test](http://geekhack.org/index.php?topic=50685.0) +- [Group buy](http://geekhack.org/index.php?topic=41464.0) ## Build @@ -16,39 +21,21 @@ Use `make -f Makefile.pjrc` if you want to use PJRC stack but I find no reason t ## Keymap -Several version of keymap are available; `plain`, `poker_bit`, `poker_set`, `hasu`, `spacefn` and `poker`(default). See keymap document(you can find in README.md of top) and `keymap_*.c` to define your own favourite keymap. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_.c` and see keymap document(you can find in top README.md) and existent keymap files. - $ make KEYMAP=[poker|plain|poker_set|poker_bit|hasu|spacefn] +To build firmware binary hex file with a certain keymap just do `make` with `KEYMAP` option like: -### 1. Plain keymap -Even without any Fn layer. This will be useful if you want to use key mapping tool like AHK. + $ make KEYMAP=[poker|poker_set|poker_bit|plain|hasu|spacefn|hhkb|] -See [keymap_plain.c](keymap_plain.c) for detail. -#### 1.0 Plain Default Layer - ,-----------------------------------------------------------. - |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | - |-----------------------------------------------------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - |-----------------------------------------------------------| - |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | - |-----------------------------------------------------------| - |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - |-----------------------------------------------------------| - |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl| - `-----------------------------------------------------------' - -### 2 Poker keymap - -[keymap_poker.c](keymap_poker.c) emulates original Poker layer emulation. -[keymap_poker_bit.c](keymap_poker_bit.c) and [keymap_poker_set.c](keymap_poker_set.c) offers better support of Esc and arrow like: +### 1 Poker +[keymap_poker.c](keymap_poker.c) emulates original Poker layers +while both [keymap_poker_bit.c](keymap_poker_bit.c) and [keymap_poker_set.c](keymap_poker_set.c) implements same layout in different way and they fix a minor issue of original Poker and enhance arrow keys. Fn + Esc = ` Fn + {left, down, up, right} = {home, pgdown, pgup, end} - `poker` keymap supports Colemak, Dvorak and Workmans, use `Magic` + {`1`, `2`, `3`} to switch and `Magic` + `0` to return to Qwerty, where `Magic` is `LShift` + `RShift`. - -#### 2.0 Poker Default Layer +#### 1.0 Default layer ,-----------------------------------------------------------. | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |-----------------------------------------------------------| @@ -60,8 +47,7 @@ See [keymap_plain.c](keymap_plain.c) for detail. |-----------------------------------------------------------| |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl| `-----------------------------------------------------------' - -#### 2.1 Poker Fn Layer +#### 1.1 Poker Fn layer ,-----------------------------------------------------------. |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |-----------------------------------------------------------| @@ -75,14 +61,32 @@ See [keymap_plain.c](keymap_plain.c) for detail. `-----------------------------------------------------------' -### 3. Hasu keymap -This is my keymap with HHKB, Vi cursor and Mousekey layer. See [keymap_hasu.c](keymap_hasu.c) for detail. +### 2. Plain +Without any Fn layer this will be useful if you want to use key remapping tool like AHK on host. +See [keymap_plain.c](keymap_plain.c) for detail. + +#### 1.0 Plain Default layer + ,-----------------------------------------------------------. + |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | + |-----------------------------------------------------------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| + |-----------------------------------------------------------| + |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | + |-----------------------------------------------------------| + |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | + |-----------------------------------------------------------| + |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl| + `-----------------------------------------------------------' -### 4. SpaceFN keymap -See [keymap_spacefn.c](keymap_spacefn.c) and [SpaceFN discussion](http://geekhack.org/index.php?topic=51069.0). +### 3. Hasu +This is my favourite keymap with HHKB Fn, Vi cursor and Mousekey layer. See [keymap_hasu.c](keymap_hasu.c) for detail. -#### 4.0 SpaceFN Default Layer + +### 4. SpaceFN +This layout proposed by spiceBar uses space bar to change layer with using Dual role key technique. See [keymap_spacefn.c](keymap_spacefn.c) and [SpaceFN discussion](http://geekhack.org/index.php?topic=51069.0). + +#### 4.0 Default layer ,-----------------------------------------------------------. |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |-----------------------------------------------------------| @@ -94,8 +98,7 @@ See [keymap_spacefn.c](keymap_spacefn.c) and [SpaceFN discussion](http://geekhac |-----------------------------------------------------------| |Ctrl|Gui |Alt | Space/Fn |Alt |Gui |App |Ctrl| `-----------------------------------------------------------' - -#### 4.1 SpaceFN +#### 4.1 SpaceFN layer ,-----------------------------------------------------------. |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | |-----------------------------------------------------------| @@ -107,6 +110,32 @@ See [keymap_spacefn.c](keymap_spacefn.c) and [SpaceFN discussion](http://geekhac |-----------------------------------------------------------| | | | | Fn | | | | | `-----------------------------------------------------------' - +### 5. HHKB +[keymap_hhkb.c](keymap_hhkb.c) emulates original HHKB layers. +#### 5.0: Default layer + ,-----------------------------------------------------------. + |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| + |-----------------------------------------------------------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc | + |-----------------------------------------------------------| + |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|Return | + |-----------------------------------------------------------| + |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn | + |-----------------------------------------------------------| + | |Gui |Alt | Space | |Alt |Gui | | + `-----------------------------------------------------------' +#### 5.1: HHKB Fn layer + ,-----------------------------------------------------------. + |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + |-----------------------------------------------------------| + |Caps | | | | | | | |Psc|Slk|Pus|Up | | | + |-----------------------------------------------------------| + | |VoD|VoU|Mut|Ejc| | *| /|Hom|PgU|Lef|Rig|Enter | + |-----------------------------------------------------------| + | | | | | | | +| -|End|PgD|Dow| | | + |-----------------------------------------------------------| + | | | | | | | | | + `-----------------------------------------------------------' + diff --git a/keyboard/gh60/keymap_common.h b/keyboard/gh60/keymap_common.h index 2105caabd..896badd74 100644 --- a/keyboard/gh60/keymap_common.h +++ b/keyboard/gh60/keymap_common.h @@ -42,13 +42,13 @@ extern const uint16_t fn_actions[]; K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ - K40, K41, K42, K45, K4A, K4B, K4C, K4D \ + K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \ - { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \ + { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \ } /* ANSI valiant. No extra keys for ISO */ @@ -63,7 +63,22 @@ extern const uint16_t fn_actions[]; K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \ K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \ + K40, K41, K42, K45, NO, K4A, K4B, K4C, K4D \ +) + + +#define KEYMAP_HHKB( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3C, \ K40, K41, K42, K45, K4A, K4B, K4C, K4D \ +) KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \ + K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \ ) #endif diff --git a/keyboard/gh60/keymap_hhkb.c b/keyboard/gh60/keymap_hhkb.c new file mode 100644 index 000000000..ce1b816ec --- /dev/null +++ b/keyboard/gh60/keymap_hhkb.c @@ -0,0 +1,52 @@ +#include "keymap_common.h" + +/* + * HHKB Layout + */ +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: Default layer + * ,-----------------------------------------------------------. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc | + * |-----------------------------------------------------------| + * |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn | + * |-----------------------------------------------------------| + * | |Gui |Alt | Space | |Alt |Gui | | + * `-----------------------------------------------------------' + */ + KEYMAP_HHKB( + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, GRV, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT,FN0, \ + NO, LGUI,LALT, SPC, NO, RALT,RGUI,NO), + /* 1: HHKB Fn layer + * ,-----------------------------------------------------------. + * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Caps | | | | | | | |Psc|Slk|Pus|Up | | | + * |-----------------------------------------------------------| + * | |VoD|VoU|Mut|Ejc| | *| /|Hom|PgU|Lef|Rig|Enter | + * |-----------------------------------------------------------| + * | | | | | | | +| -|End|PgD|Dow| | | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + */ + KEYMAP_HHKB( + PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,TRNS, \ + TRNS,VOLD,VOLU,MUTE,EJCT,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT, PENT, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN, TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), +}; + +/* + * Fn action definition + */ +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), +};