Fix keymap of gh60 and hhkb

master
tmk 2013-02-21 10:15:08 +09:00
parent 59e073e82b
commit 75a92ff653
4 changed files with 40 additions and 52 deletions

View File

@ -90,30 +90,30 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP_ANSI(
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,FN4, FN4, FN1),
LCTL,A, S, D, F, G, H, J, K, L, FN2, QUOT, ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,FN3, FN3, FN0),
/* Keymap 1: colemak */
KEYMAP_ANSI(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \
BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \
LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN1),
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
/* Keymap 2: dvorak */
KEYMAP_ANSI(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \
TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \
CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \
LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN1),
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
/* Keymap: workman */
KEYMAP_ANSI(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \
BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \
LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN1),
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
};
static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {
@ -130,7 +130,7 @@ static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Shift | | | | | | +| -|End|PgD|Dow|Shift |
* |-----------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Gui |App |Fn0 |
* |Ctrl|Gui |Alt | Space |Alt |Gui |App | |
* `-----------------------------------------------------------'
*/
KEYMAP_ANSI(
@ -138,7 +138,7 @@ static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,INS, \
LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, \
LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, TRNS),
/* Overlay 1: Vi mode (Slash)
* ,-----------------------------------------------------------.
* | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
@ -147,7 +147,7 @@ static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
* |-----------------------------------------------------------|
* |Shift | | | | | |Hom|PgD|PgU|End|Fn0|Shift |
* |Shift | | | | | |Hom|PgD|PgU|End| |Shift |
* |-----------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
* `-----------------------------------------------------------'
@ -156,7 +156,7 @@ static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, TRNS,TRNS,TRNS,TRNS, \
LCTL,TRNS,LEFT,DOWN,RGHT,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS, ENT, \
LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, FN0, RSFT, \
LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, TRNS, RSFT, \
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL),
/* Overlay 2: Mouse mode (Semicolon/App)
* ,-----------------------------------------------------------.
@ -164,31 +164,30 @@ static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Tab | | | | | |MwL|MwD|MwU|MwR| | | | |
* |-----------------------------------------------------------|
* |Contro| |Ac0|Ac1|Ac1| |McL|McD|McU|McR|Fn0| |Return |
* |Contro| |Ac0|Ac1|Ac1| |McL|McD|McU|McR| | |Return |
* |-----------------------------------------------------------|
* |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift |
* |-----------------------------------------------------------|
* |Ctrl|Gui |Alt | Space | |Fn0 |Fn0 | |
* |Ctrl|Gui |Alt | Space | | | | |
* `-----------------------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/
KEYMAP_ANSI(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \
TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,TRNS, \
LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,FN0, TRNS, ENT, \
LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,TRNS, ENT, \
LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,TRNS, RSFT, \
LCTL,LGUI,LALT, BTN1, TRNS,FN0, FN0, RCTL),
LCTL,LGUI,LALT, BTN1, TRNS,TRNS,TRNS,RCTL),
};
/*
* Fn action definition
*/
static const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_DEFAULT, // FN0
ACTION_LAYER_SET(0), // FN1
ACTION_LAYER_SET_TAP_KEY(1, KC_SLASH), // FN2
ACTION_LAYER_SET_TAP_KEY(2, KC_SCLN), // FN3
ACTION_LAYER_SET(2), // FN4
ACTION_OVERLAY_TAP_TOGGLE(0), // FN0
ACTION_OVERLAY_TAP_KEY(1, KC_SLASH), // FN1
ACTION_OVERLAY_TAP_KEY(2, KC_SCLN), // FN2
ACTION_OVERLAY(2), // FN3
};
#endif

View File

@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 8
#define MATRIX_COLS 8
/* To use new keymap framework */
#define USE_KEYMAP_V2
/*
* Boot magic keys

View File

@ -31,6 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 8
#define MATRIX_COLS 8
/* To use new keymap framework */
#define USE_KEYMAP_V2
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))

View File

@ -85,7 +85,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \
LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \
LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,FN0, \
LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \
LGUI,LALT, SPC, RALT,RGUI),
/* Layer 2: Vi mode (Slash)
@ -104,7 +104,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN0, RSFT,NO, \
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,RSFT,NO, \
LGUI,LALT, SPC, RALT,RGUI),
/* Layer 3: Mouse mode (Semicolon)
@ -123,9 +123,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, INS, DEL, \
TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC, \
LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN0, QUOT,ENT, \
LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,NO, \
LGUI,LALT, BTN1, RALT,FN0),
LGUI,LALT, BTN1, RALT,TRNS),
/* Layer 4: Matias half keyboard style (Space)
* ,-----------------------------------------------------------.
@ -144,7 +144,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
BSPC,P, O, I, U, Y, T, R, E, W, Q, NO, NO, TAB, \
LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \
LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT,NO, \
LGUI,LALT, FN0, RALT,RGUI),
LGUI,LALT, TRNS, RALT,RGUI),
/* Layer5: another Mouse mode (Space)
* ,-----------------------------------------------------------.
@ -164,7 +164,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC, \
LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,NO, NO, ENT, \
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT,NO, \
LGUI,LALT, FN0, RALT,RGUI),
LGUI,LALT, TRNS, RALT,RGUI),
};
@ -182,26 +182,23 @@ enum function_id {
*/
// TODO: use [1] = KEYMAP(...) to prevent from changing index of element?
static const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_DEFAULT, // FN0
ACTION_LAYER_SET(1), // FN1
ACTION_LAYER_SET_TAP_KEY(2, KC_SLASH), // FN2 Layer with Slash
ACTION_LAYER_SET_TAP_KEY(3, KC_SCLN), // FN3 Layer with Semicolon
ACTION_DEFAULT_LAYER, // FN0
ACTION_KEYMAP(1), // FN1
ACTION_KEYMAP_TAP_KEY(2, KC_SLASH), // FN2 Layer with Slash
ACTION_KEYMAP_TAP_KEY(3, KC_SCLN), // FN3 Layer with Semicolon
ACTION_LAYER_SET(3), // FN4
// ACTION_LAYER_SET_TOGGLE(3), // FN4
ACTION_KEYMAP(3), // FN4
// ACTION_KEYMAP_TOGGLE(3), // FN4
// ACTION_FUNCTION(MACRO, 0), // FN4
ACTION_LAYER_SET_TAP_KEY(5, KC_SPC), // FN5
ACTION_KEYMAP_TAP_KEY(5, KC_SPC), // FN5
// ACTION_LMOD_TAP_KEY(KC_LCTL, KC_BSPC), // FN6 Control with tap Backspace
ACTION_LMOD_TAP_KEY(KC_LCTL, KC_ESC), // FN6 Control with tap Backspace
ACTION_RMOD_TAP_KEY(KC_RCTL, KC_ENT), // FN7 Control with tap Enter
ACTION_LMOD_ONESHOT(KC_LSFT), // FN8 Oneshot Shift
ACTION_LAYER_SET_TAP_TOGGLE(1), // FN9
ACTION_LAYER_BIT_TAP_KEY(1, KC_GRV), // FN10 Layer with Grave
//ACTION_LAYER_BIT(1), // FN10
//ACTION_LAYER_BIT_TAP_TOGGLE(1), // FN10
ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // FN11 Function: LShift with tap '('
ACTION_FUNCTION_TAP(RSHIFT_RPAREN), // FN12 Function: RShift with tap ')'
ACTION_FUNCTION(MACRO, 1), // FN13 Macro:
[9] = ACTION_KEYMAP_TAP_TOGGLE(1), // FN9
[11] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // FN11 Function: LShift with tap '('
[12] = ACTION_FUNCTION_TAP(RSHIFT_RPAREN), // FN12 Function: RShift with tap ')'
[13] = ACTION_FUNCTION(MACRO, 1), // FN13 Macro:
};
@ -230,7 +227,7 @@ static const prog_macro_t *get_macro(uint8_t id, bool pressed)
/*
* user defined action function
*/
void keymap_call_function(keyrecord_t *record, uint8_t id, uint8_t opt)
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
uint8_t tap_count = record->tap_count;
@ -328,15 +325,3 @@ action_t keymap_fn_to_action(uint8_t keycode)
}
return action;
}
/* convert key to action */
action_t action_for_key(uint8_t layer, key_t key)
{
uint8_t keycode = keymap_key_to_keycode(layer, key);
switch (keycode) {
case KC_FN0 ... KC_FN31:
return keymap_fn_to_action(keycode);
default:
return keymap_keycode_to_action(keycode);
}
}