From f4c1e066ba4064bf2c20c9ced84fd11aa1c274ae Mon Sep 17 00:00:00 2001 From: dnsnrk Date: Tue, 11 Feb 2020 03:05:25 +0100 Subject: [Keymap] User keymap for KBDfans KBD67 MKII RGB (hot-swap) (#7697) * initial custom keymap * initial code for caps lock LED * added debounce overrides * override caps lock handler * finished up on CAPS LOCK LED customization * lowered debounce * layer lightning fx * Added layer tap-toggle * reformatting * refined keymap * copyright and more clean-up * increased DEBOUNCE * initial custom keymap * initial code for caps lock LED * added debounce overrides * override caps lock handler * finished up on CAPS LOCK LED customization * lowered debounce * layer lightning fx * Added layer tap-toggle * reformatting * refined keymap * copyright and more clean-up * increased DEBOUNCE * added readme and some more clean-up * incorporated pull request feedback --- .../kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/config.h | 24 ++++++ .../kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/keymap.c | 95 ++++++++++++++++++++++ .../kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/readme.md | 41 ++++++++++ 3 files changed, 160 insertions(+) create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/config.h create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/keymap.c create mode 100644 keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/readme.md (limited to 'keyboards') diff --git a/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/config.h b/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/config.h new file mode 100644 index 000000000..25f645f73 --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/config.h @@ -0,0 +1,24 @@ +/* Copyright 2019 dnsnrk + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* place overrides here */ +#undef QMK_KEYS_PER_SCAN +#define QMK_KEYS_PER_SCAN 4 +#undef DEBOUNCE +#define DEBOUNCE 8 +#undef TAPPING_TOGGLE +#define TAPPING_TOGGLE 2 diff --git a/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/keymap.c b/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/keymap.c new file mode 100644 index 000000000..889a1e5f1 --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/keymap.c @@ -0,0 +1,95 @@ +/* Copyright 2019 dnsnrk + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +#define RC_ENT RCTL_T(KC_ENT) +#define LC_CPS LCTL_T(KC_CAPS) + +enum { + _LAYER0 = 0, + _LAYER1, + _LAYER2 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_LAYER0] = LAYOUT_65_ansi_blocker( /* Base Layer */ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLASH, KC_PGUP, + LC_CPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, RC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, TT(2), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, TT(1), KC_LEFT, KC_DOWN, KC_RIGHT), + [_LAYER1] = LAYOUT_65_ansi_blocker( /* FN, RGB Controls */ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_POWER, + _______, RGB_TOG, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, + _______, RGB_RMOD, RGB_SPD, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, + _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAD, RGB_SAI, _______, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_VAD, RGB_HUI), + [_LAYER2] = LAYOUT_65_ansi_blocker( /* Media, Programming */ + _______, KC_BRMD, KC_BRMU, _______, _______, _______, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC__MUTE, KC_VOLD, KC_VOLU, KC_EJCT, _______, + _______, _______, _______, EEP_RST, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; + +void set_hsv_at(HSV hsv, uint8_t index); + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void rgb_matrix_indicators_user(void) { + if (rgb_matrix_config.enable) { + HSV hsv = rgb_matrix_config.hsv; + if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { + HSV hsv_inv_hue = {hsv.h + 128, hsv.s, hsv.v}; + set_hsv_at(hsv_inv_hue, 30); + } + // indicate which higher layer is currently active on which key + HSV hsv1 = {hsv.h - 64, hsv.s, hsv.v}; + HSV hsv2 = {hsv.h + 64, hsv.s, hsv.v}; + // except when we are in any animated LED mode + if (rgb_matrix_config.mode < RGB_MATRIX_BREATHING || rgb_matrix_config.mode > RGB_MATRIX_JELLYBEAN_RAINDROPS) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + keypos_t pos = {col, row}; + uint8_t key_layer = layer_switch_get_layer(pos); + uint8_t key_led = g_led_config.matrix_co[row][col]; + if (key_led != NO_LED) { + switch(key_layer) { + case _LAYER2: + set_hsv_at(hsv2, key_led); + break; + case _LAYER1: + set_hsv_at(hsv1, key_led); + break; + default: + break; + } + } + } + } + } + // sticky layer indicators regardless of RGB mode. Hardcoded for lack of better idea. + set_hsv_at(hsv1, 63); + set_hsv_at(hsv2, 57); + } +} + +void set_hsv_at(HSV hsv, uint8_t index) { + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(index, rgb.r, rgb.g, rgb.b); +} diff --git a/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/readme.md b/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/readme.md new file mode 100644 index 000000000..5554b03e5 --- /dev/null +++ b/keyboards/kbdfans/kbd67/mkiirgb/keymaps/dnsnrk/readme.md @@ -0,0 +1,41 @@ +# dnsnrk's KDB67 MKII Layout + +* This is a three layer layout wih some consolidated functionality in the second and third layer. +* The keyboard is mostly used on macOS, but also on Linux and therefore it can swap ALT/CMD. +* There are additional CTRL keys for left and right when caps lock or enter key is held. +* Layers can be toggled (tap twice) or actived momentarily (hold). +* There are 2 seperate FN keys to activate layer 1 and 2 separately, indicated by different RGB colors. +* The main custom feature is using RGB to indicate the current active layer for each key. This is best achieved in solid color RGB modes. + +## Layer 0 + +This is the base QUERTY layer. + +* Grave is provided in the top right corner. +* Caps lock is tapped once on and off and indicated by hue inverted LED when on. +* Caps lock and enter become CTRL when held. +* Primary Fn in the last row activates layer 1, indicated by hue shifted LED color. +* Secondary Fn right to the up arrow key activates layer 2, indicated by 2nd hue shifted LED color. +* Toggle layers by tapping Fn twice or switch on by holding Fn. + +## Layer 1 + +This layer activates function keys and provides RGB controls. Keys acting on this layer are indicated by an LED color matching the current Fn key's LED color. + +* Number keys become equivalent function keys. +* ESC becomes Grave. +* Grave becomes POWER (very useful on macOS only). +* Q toggles RGB. +* WASD for navigating through RGB modes and adjusting speed. +* <> control RGB saturation. +* Arrow keys shift hue and adjust brightness. +* PgUp, PgDown become HOME and END respectively. +* Backspace acts as delete, pipe as insert. + +## Layer 2 + +This layer comprises most macOS media keys at the top row and some additional programming options. Keys acting on this layer are indicated by an LED color matching the current Fn key's LED color. + +* N, M swap ALT/CMD for (N)ormal or (M)acOS. +* E resets (E)EPROM. +* R (R)esets keyboard. -- cgit v1.2.3