|
/* |
|
* HHKB Layout |
|
*/ |
|
#include "keymap_common.h" |
|
|
|
|
|
#ifdef KEYMAP_SECTION_ENABLE |
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { |
|
#else |
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
|
#endif |
|
/* Layer 0: Default Layer |
|
* ,-----------------------------------------------------------. |
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]| \| `| |
|
* |-----------------------------------------------------------| |
|
* |Tab | '| ,| .| p| y| f| g| c| r| l| /| =|Backs| |
|
* |-----------------------------------------------------------| |
|
* |Contro| A| o| e| u| i| d| h| t| n| s| -| FN6 | |
|
* |-----------------------------------------------------------| |
|
* |FN4 |FN1| q| j| k| x| b| m| w| v| z|FN5 |Fn0 | |
|
* `-----------------------------------------------------------' |
|
* |Alt|Gui | Fn7 |FN2 |Alt| |
|
* `-------------------------------------------' |
|
*/ |
|
[0] = \ |
|
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC, BSLS,GRV, \ |
|
TAB, QUOT, COMM, DOT, P, Y, F, G, C, R, L, SLSH,EQL,BSPC, \ |
|
LCTL,A, O, E, U, I, D, H, T, N, S,MINS,FN6, \ |
|
FN4,FN1, Q, J, K, X, B, M, W,V, Z,FN5,FN0, \ |
|
LALT,LGUI, FN7, FN2,RALT), |
|
|
|
/* Layer 1: HHKB mode (HHKB Fn) |
|
* ,-----------------------------------------------------------. |
|
* |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| |
|
* |-----------------------------------------------------------| |
|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| |
|
* |-----------------------------------------------------------| |
|
* | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | |
|
* |-----------------------------------------------------------| |
|
* | | | | | | | +| -|End|PgD|Dow| | | |
|
* `-----------------------------------------------------------' |
|
* | | | | | | |
|
* `-------------------------------------------' |
|
*/ |
|
[1] = \ |
|
KEYMAP(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, BSPC, \ |
|
TRNS,VOLD,VOLU,MUTE,TRNS,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), |
|
|
|
/* 2: Mousekey |
|
* ,-----------------------------------------------------------. |
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| |
|
* |-----------------------------------------------------------| |
|
* |Tab | | | | | |MwL|MwD|MwU|MwR| | | |Backs| |
|
* |-----------------------------------------------------------| |
|
* |Contro| | | | | |McL|McD|McU|McR| | |Return | |
|
* |-----------------------------------------------------------| |
|
* |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | |
|
* `-----------------------------------------------------------' |
|
* |Gui |Alt |Mb1 |Alt | | |
|
* `--------------------------------------------' |
|
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel |
|
*/ |
|
[2] = \ |
|
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ |
|
TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,BSPC, \ |
|
LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \ |
|
LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,TRNS, \ |
|
LGUI,LALT, BTN1, RALT,TRNS), |
|
|
|
/* Layer 3: Qwerty |
|
* ,-----------------------------------------------------------. |
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| |
|
* |-----------------------------------------------------------| |
|
* |Tab | q| w| e| r| t| y| u| i| o| p| [| ]|Backs| |
|
* |-----------------------------------------------------------| |
|
* |Contro| a| s| d| f| g| h| j| k| l| ;| '|Enter | |
|
* |-----------------------------------------------------------| |
|
* |Shift |Fn8| x| c| v| b| n| m| ,| .| /|Shift |Fn3 | |
|
* `-----------------------------------------------------------' |
|
* |Alt|Gui | Space |FN2 |Alt| |
|
* `-------------------------------------------' |
|
*/ |
|
[3] = \ |
|
KEYMAP(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,FN8, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN3, \ |
|
LALT,LGUI, SPC, FN2,RALT), |
|
/* Layer 4: qwerty-Fn |
|
* ,-----------------------------------------------------------. |
|
* |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| |
|
* |-----------------------------------------------------------| |
|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| |
|
* |-----------------------------------------------------------| |
|
* | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | |
|
* |-----------------------------------------------------------| |
|
* | | | | | | | +| -|End|PgD|Dow| | | |
|
* `-----------------------------------------------------------' |
|
* | | | | | | |
|
* `-------------------------------------------' |
|
*/ |
|
[4] = \ |
|
KEYMAP(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, BSPC, \ |
|
TRNS,VOLD,VOLU,MUTE,TRNS,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), |
|
/* 5: Mousekey |
|
* ,-----------------------------------------------------------. |
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| |
|
* |-----------------------------------------------------------| |
|
* |Tab | | | | | |MwL|MwD|MwU|MwR| | | |Backs| |
|
* |-----------------------------------------------------------| |
|
* |Contro| | | | | |McL|McD|McU|McR| | |Return | |
|
* |-----------------------------------------------------------| |
|
* |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | |
|
* `-----------------------------------------------------------' |
|
* |Gui |Alt |Mb1 |Alt | | |
|
* `--------------------------------------------' |
|
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel |
|
*/ |
|
[5] = \ |
|
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ |
|
TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,BSPC, \ |
|
LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \ |
|
LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,TRNS, \ |
|
LGUI,LALT, BTN1, RALT,TRNS), |
|
}; |
|
|
|
|
|
/* id for user defined functions */ |
|
enum function_id { |
|
LSHIFT_LPAREN, |
|
}; |
|
|
|
/* |
|
* Fn action definition |
|
*/ |
|
#ifdef KEYMAP_SECTION_ENABLE |
|
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { |
|
#else |
|
const uint16_t fn_actions[] PROGMEM = { |
|
#endif |
|
[0] = ACTION_LAYER_MOMENTARY(1), // FN0 |
|
[1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1 |
|
[2] = ACTION_LAYER_TAP_TOGGLE(3), // FN2 |
|
[3] = ACTION_LAYER_MOMENTARY(4), // FN3 |
|
[4] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // Function: LShift with tap '(' |
|
/* [4] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_9), // Function: LShift with tap ‘9’ */ |
|
[5] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_LBRC), // right shift, with tap ‘[’ |
|
[6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // Enter as Ctrl when holding |
|
[7] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_SPC), // Space as Meta when holding |
|
[8] = ACTION_LAYER_TAP_KEY(5, KC_Z), // FN8 |
|
}; |
|
|
|
|
|
/* |
|
* user defined action function |
|
*/ |
|
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) |
|
{ |
|
if (record->event.pressed) dprint("P"); else dprint("R"); |
|
dprintf("%d", record->tap.count); |
|
if (record->tap.interrupted) dprint("i"); |
|
dprint("\n"); |
|
|
|
switch (id) { |
|
case LSHIFT_LPAREN: |
|
// Shift parentheses example: LShft + tap '(' |
|
// http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses |
|
// http://geekhack.org/index.php?topic=41989.msg1304899#msg1304899 |
|
if (record->event.pressed) { |
|
if (record->tap.count > 0 && !record->tap.interrupted) { |
|
if (record->tap.interrupted) { |
|
dprint("tap interrupted\n"); |
|
register_mods(MOD_BIT(KC_LSHIFT)); |
|
} |
|
} else { |
|
register_mods(MOD_BIT(KC_LSHIFT)); |
|
} |
|
} else { |
|
if (record->tap.count > 0 && !(record->tap.interrupted)) { |
|
add_weak_mods(MOD_BIT(KC_LSHIFT)); |
|
send_keyboard_report(); |
|
register_code(KC_9); |
|
unregister_code(KC_9); |
|
del_weak_mods(MOD_BIT(KC_LSHIFT)); |
|
send_keyboard_report(); |
|
record->tap.count = 0; // ad hoc: cancel tap |
|
} else { |
|
unregister_mods(MOD_BIT(KC_LSHIFT)); |
|
} |
|
} |
|
break; |
|
} |
|
} |