From e9f82d7a7a2f13032b62d1b3372cfa528c463d18 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Thu, 21 Apr 2016 03:20:53 +0200 Subject: Add function layer with FN keys and mouse keys. --- keyboard/planck/keymaps/kj.c | 113 ------------------------------- keyboard/planck/keymaps/kj/kj.c | 118 +++++++++++++++++++++++++++++++++ keyboard/planck/keymaps/kj/makefile.mk | 2 + 3 files changed, 120 insertions(+), 113 deletions(-) delete mode 100644 keyboard/planck/keymaps/kj.c create mode 100644 keyboard/planck/keymaps/kj/kj.c create mode 100644 keyboard/planck/keymaps/kj/makefile.mk (limited to 'keyboard/planck/keymaps') diff --git a/keyboard/planck/keymaps/kj.c b/keyboard/planck/keymaps/kj.c deleted file mode 100644 index 2bc7186c8f..0000000000 --- a/keyboard/planck/keymaps/kj.c +++ /dev/null @@ -1,113 +0,0 @@ -// This is the canonical layout file for the Quantum project. If you want to add another keyboard, -// this is the style you want to emulate. - -#include "planck.h" -#ifdef BACKLIGHT_ENABLE - #include "backlight.h" -#endif - -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -#define _DV 0 -#define _QW 1 -#define _LW 2 -#define _RS 3 - -#define _SHIFT 1 -#define _AA 2 -#define _OE 3 -#define _AE 4 - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_DV] = { - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT}, - {M(_SHIFT), KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_SLSH }, - {KC_ESC, KC_LCTL, KC_LGUI, KC_LALT, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, - -[_QW] = { - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, - -[_LW] = { - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_PAUSE, KC_INSERT, KC_DELT, KC_ESC, KC_ENT, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END} -}, - -[_RS] = { - {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {KC_TRNS, M(_AA), M(_OE), M(_AE), KC_TRNS, KC_TRNS, KC_TRNS, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_TRNS}, - {KC_TRNS, KC_RALT, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_PGDN, KC_END, KC_PIPE}, - {DF(_DV), DF(_QW), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET} -}, -}; - -const uint16_t PROGMEM fn_actions[] = { - -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - static uint16_t shift_pressed = 0; - - // MACRODOWN only works in this function - switch(id) { - case 0: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - } else { - unregister_code(KC_RSFT); - } - break; - case _SHIFT: - if (record->event.pressed) { - register_code(KC_RSFT); - shift_pressed = 1; - } else { - unregister_code(KC_RSFT); - shift_pressed = 0; - } - break; - case _AA: - if (record->event.pressed) { - if (shift_pressed) { - return MACRO(I(10), U(RSFT), T(RALT), D(RSFT), T(A), T(A), END); - } else { - return MACRO(I(10), T(RALT), T(A), T(A), END); - } - } - break; - case _OE: - if (record->event.pressed) { - if (shift_pressed) { - return MACRO(I(10), U(RSFT), T(RALT), T(SLSH), D(RSFT), T(O), END); - } else { - return MACRO(I(10), T(RALT), T(SLSH), T(O), END); - } - } - break; - case _AE: - if (record->event.pressed) { - if (shift_pressed) { - return MACRO(I(10), U(RSFT), T(RALT), D(RSFT), T(A), T(E), END); - } else { - return MACRO(I(10), T(RALT), T(A), T(E), END); - } - } - break; - } - return MACRO_NONE; -}; - diff --git a/keyboard/planck/keymaps/kj/kj.c b/keyboard/planck/keymaps/kj/kj.c new file mode 100644 index 0000000000..c6c3d69c12 --- /dev/null +++ b/keyboard/planck/keymaps/kj/kj.c @@ -0,0 +1,118 @@ +#include "planck.h" +#ifdef BACKLIGHT_ENABLE + #include "backlight.h" +#endif + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _DV 0 +#define _QW 1 +#define _FN 3 +#define _LW 4 +#define _RS 5 + +#define _SHIFT 1 +#define _AA 2 +#define _OE 3 +#define _AE 4 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_DV] = { + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT}, + {M(_SHIFT), KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_SLSH }, + {TG(_FN), KC_LCTL, KC_LGUI, KC_LALT, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +[_QW] = { + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT}, + {M(_SHIFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT }, + {M(0), KC_LCTL, KC_LGUI, KC_LALT, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +[_FN] = { + {KC_ACL2, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,}, + {KC_ACL1, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_MS_BTN2,}, + {KC_ACL0, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG(_LW), KC_MS_BTN1, KC_TRNS, TG(_RS), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,}, +}, + +[_LW] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_PAUSE, KC_INSERT, KC_DELT, KC_ESC, KC_ENT, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END} +}, + +[_RS] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {KC_TRNS, M(_AA), M(_OE), M(_AE), KC_TRNS, KC_TRNS, KC_TRNS, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_TRNS}, + {KC_TRNS, KC_RALT, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_PGDN, KC_END, KC_PIPE}, + {DF(_DV), DF(_QW), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET} +}, +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + static uint16_t shift_pressed = 0; + + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + break; + case _SHIFT: + if (record->event.pressed) { + register_code(KC_RSFT); + shift_pressed = 1; + } else { + unregister_code(KC_RSFT); + shift_pressed = 0; + } + break; + case _AA: + if (record->event.pressed) { + if (shift_pressed) { + return MACRO(I(10), U(RSFT), T(RALT), D(RSFT), T(A), T(A), END); + } else { + return MACRO(I(10), T(RALT), T(A), T(A), END); + } + } + break; + case _OE: + if (record->event.pressed) { + if (shift_pressed) { + return MACRO(I(10), U(RSFT), T(RALT), T(SLSH), D(RSFT), T(O), END); + } else { + return MACRO(I(10), T(RALT), T(SLSH), T(O), END); + } + } + break; + case _AE: + if (record->event.pressed) { + if (shift_pressed) { + return MACRO(I(10), U(RSFT), T(RALT), D(RSFT), T(A), T(E), END); + } else { + return MACRO(I(10), T(RALT), T(A), T(E), END); + } + } + break; + } + return MACRO_NONE; +}; + diff --git a/keyboard/planck/keymaps/kj/makefile.mk b/keyboard/planck/keymaps/kj/makefile.mk new file mode 100644 index 0000000000..99fbfbd0bb --- /dev/null +++ b/keyboard/planck/keymaps/kj/makefile.mk @@ -0,0 +1,2 @@ +AUDIO_ENABLE = yes +NKRO_ENABLE = yes \ No newline at end of file -- cgit v1.2.3