Last active
January 8, 2018 13:33
-
-
Save loggerhead/980bf3581e74baec5350e65f8659eca8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 1. git clone https://github.com/tmk/tmk_keyboard.git | |
* 2. cp keymap_loggerhead.* tmk_keyboard/keyboard/hhkb/ | |
* 3. make KEYMAP=loggerhead | |
* 4. run `dfu-programmer` commands with argument of "hhkb.hex", e.g: | |
* | |
* sudo dfu-programmer atmega32u4 erase | |
* dfu-programmer atmega32u4 flash hhkb.hex | |
* dfu-programmer atmega32u4 reset | |
*/ | |
#include "keymap_loggerhead.h" | |
// Macro definition | |
const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt) | |
{ | |
keyevent_t event = record->event; | |
/* I() => change interval of stroke. | |
* D() => press key | |
* U() => release key | |
* T() => type key(press and release) | |
* W() => wait | |
* END => end mark | |
*/ | |
switch (macro_id) { | |
case DEL_TO_START: | |
return (event.pressed ? | |
MACRO( D(LSFT), T(HOME), T(DEL), U(LSFT), END ) : | |
MACRO_NONE); | |
} | |
return MACRO_NONE; | |
} | |
#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 | |
* | |
* .-----------------------------------------------------------. | |
* | ` 1 2 3 4 5 6 7 8 9 0 - = \ Ins| | |
* |-----------------------------------------------------------| | |
* |Tab Q W E R T Y U I O P [ ] BS | | |
* |-----------------------------------------------------------| | |
* |Gui A S D F G H J K L ; ' Gui+Ent | | |
* |-----------------------------------------------------------| | |
* |Alt Z X C V B N M , . / Shift Ctrl| | |
* `-----------------------------------------------------------' | |
* | Fn Ctrl+Esc Shift+Space C+A+S Alt | | |
* `---------------------------------------------' | |
*/ | |
MY_KEYMAP(GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSLS, INS, | |
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSPC, | |
LGUI, A, S, D, F, G, H, J, K, L, SCLN, QUOT, GUI_ENT, | |
LALT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, RCTL, | |
L_FN, CTL_ESC, SFT_SPC, CTL_ALT_SFT, RALT), | |
/* Layer 1: Fn Layer | |
* | |
* ACL1: used to control the speed of mouse | |
* | |
* .-----------------------------------------------------------. | |
* | F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 VoD VoU | | |
* |-----------------------------------------------------------| | |
* | End ↑ Mut Del | | |
* |-----------------------------------------------------------| | |
* | Home Del → BS WH_D WH_U ACL1 Enter | | |
* |-----------------------------------------------------------| | |
* | ← ↓ | | |
* `-----------------------------------------------------------' | |
* | Space | | |
* `---------------------------------------------' | |
*/ | |
MY_KEYMAP( NO, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, VOLD, VOLU, | |
NO, NO, NO, END, NO, NO, NO, NO, NO, NO, UP, NO, MUTE, DEL, | |
NO, HOME, NO, DEL, RGHT, NO, BSPC, WH_D, WH_U, NO, ACL1, NO, ENT, | |
NO, NO, NO, NO, NO, LEFT, DOWN, NO, NO, NO, NO, NO, NO, | |
NO, NO, SPC, NO, NO), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "keymap_common.h" | |
#define MY_KEYMAP(...) KEYMAP(__VA_ARGS__) | |
enum macro_id { | |
DEL_TO_START, | |
}; | |
// Layer Index | |
#define DEF_IDX 0 | |
#define FN_IDX 1 | |
#ifdef KEYMAP_SECTION_ENABLE | |
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |
#else | |
const action_t fn_actions[] PROGMEM = { | |
#endif | |
// Layers | |
[0] = ACTION_LAYER_TOGGLE(DEF_IDX), | |
#define L_FN FN1 | |
[1] = ACTION_LAYER_MOMENTARY(FN_IDX), | |
// press or tap | |
#define CTL_ESC FN2 | |
[2] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), | |
#define SFT_SPC FN3 | |
[3] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), | |
#define GUI_ENT FN4 | |
[4] = ACTION_MODS_TAP_KEY(MOD_RGUI, KC_ENTER), | |
// mutiple modify key | |
#define CTL_ALT_SFT FN5 | |
[5] = ACTION_MODS(MOD_LCTL | MOD_LALT | MOD_LSFT), | |
// macro key | |
#define DEL_TO_START_KEY FN6 | |
[6] = ACTION_MACRO(DEL_TO_START), | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment