Added mouse clicks to RBG layer (#19105)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: syntax-magic <dkim.8881@gmail.com>
This commit is contained in:
syntax-magic 2022-12-08 08:09:43 -08:00 committed by GitHub
parent d30bf44a60
commit 261e7668c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 310 additions and 103 deletions

View File

@ -3,5 +3,5 @@
#pragma once #pragma once
#define TAPPING_TERM 168 #define TAPPING_TERM 136
#define TAPPING_TERM_PER_KEY #define TAPPING_TERM_PER_KEY

View File

@ -0,0 +1,76 @@
// Copyright 2021-2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file custom_shift_keys.c
* @brief Custom Shift Keys implementation
*
* For full documentation, see
* <https://getreuer.info/posts/keyboards/custom-shift-keys>
*/
#include "custom_shift_keys.h"
bool process_custom_shift_keys(uint16_t keycode, keyrecord_t *record) {
static uint16_t registered_keycode = KC_NO;
// If a custom shift key is registered, then this event is either releasing
// it or manipulating another key at the same time. Either way, we release
// the currently registered key.
if (registered_keycode != KC_NO)
{
unregister_code16(registered_keycode);
registered_keycode = KC_NO;
}
if (record->event.pressed)
{ // Press event.
const uint8_t mods = get_mods();
#ifndef NO_ACTION_ONESHOT
if ((mods | get_weak_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT)
{
#else
if ((mods | get_weak_mods()) & MOD_MASK_SHIFT)
{ // Shift is held.
#endif // NO_ACTION_ONESHOT
// Search for a custom key with keycode equal to `keycode`.
for (int i = 0; i < NUM_CUSTOM_SHIFT_KEYS; ++i)
{
if (keycode == custom_shift_keys[i].keycode)
{
// Continue default handling if this is a tap-hold key being held.
if (((QK_MOD_TAP <= keycode && keycode <= QK_MOD_TAP_MAX) || (QK_LAYER_TAP <= keycode && keycode <= QK_LAYER_TAP_MAX)) && record->tap.count == 0)
{
return true;
}
#ifndef NO_ACTION_ONESHOT
del_oneshot_mods(MOD_MASK_SHIFT);
#endif // NO_ACTION_ONESHOT
del_mods(MOD_MASK_SHIFT);
del_weak_mods(MOD_MASK_SHIFT);
send_keyboard_report();
registered_keycode = custom_shift_keys[i].shifted_keycode;
register_code16(registered_keycode);
set_mods(mods); // Restore the mods.
return false;
}
}
}
}
return true; // Continue with default handling.
}

View File

@ -0,0 +1,99 @@
// Copyright 2021-2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file custom_shift_keys.h
* @brief Custom shift keys: customize what keycode is produced when shifted.
*
* Overview
* --------
*
* This library implements custom shift keys, keys where you can customize
* what keycode is produced when shifted.
*
* Step 1: In your keymap.c, define a table of custom shift keys like
*
* #include "features/custom_shift_keys.h"
*
* const custom_shift_key_t custom_shift_keys[] = {
* {KC_DOT , KC_QUES}, // Shift . is ?
* {KC_COMM, KC_EXLM}, // Shift , is !
* {KC_MINS, KC_EQL }, // Shift - is =
* {KC_COLN, KC_SCLN}, // Shift : is ;
* };
*
* Each row defines one key. The first field is the keycode as it appears in
* your layout and determines what is typed normally. The second entry is what
* you want the key to type when shifted.
*
* Step 2: Handle custom shift keys from your `process_record_user` function as
*
* bool process_record_user(uint16_t keycode, keyrecord_t* record) {
* if (!process_custom_shift_keys(keycode, record)) { return false; }
* // Your macros ...
*
* return true;
* }
*
* Step 3: add `features/custom_shift_keys.c` to your rules.mk as
*
* SRC += features/custom_shift_keys.c
*
*
* For full documentation, see
* <https://getreuer.info/posts/keyboards/custom-shift-keys>
*/
#pragma once
#include "quantum.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Custom shift key entry. The `keycode` field is the keycode as it appears in
* your layout and determines what is typed normally. The `shifted_keycode` is
* what you want the key to type when shifted.
*/
typedef struct {
uint16_t keycode;
uint16_t shifted_keycode;
} custom_shift_key_t;
/** Table of custom shift keys. */
extern const custom_shift_key_t custom_shift_keys[];
/** Number of entries in the `custom_shift_keys` table. */
extern uint8_t NUM_CUSTOM_SHIFT_KEYS;
/**
* Handler function for custom shift keys.
*
* In keymap.c, call this function from your `process_record_user` function as
*
* #include "features/custom_shift_keys.h"
*
* bool process_record_user(uint16_t keycode, keyrecord_t* record) {
* if (!process_custom_shift_keys(keycode, record)) { return false; }
* // Your macros ...
*
* return true;
* }
*/
bool process_custom_shift_keys(uint16_t keycode, keyrecord_t *record);
#ifdef __cplusplus
}
#endif

View File

@ -14,44 +14,64 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "features/custom_shift_keys.h"
enum layers { enum layers {
_ALPHA, _ALPHA,
_LEFTFN, _LEFTFN,
_RIGHTFN,
_NUMPAD, _NUMPAD,
_LEAGUE, _RIGHTFN,
_PUBG, _MOBA,
_OVERWATCH, _FPS1,
_STARCRAFT, _FPS2,
_TETRIS, _STRAT,
_ARROWS,
_CLEAN, _CLEAN,
_RGB _RGB
}; };
#define ALPHA TO(_ALPHA) #define ALPHA TO(_ALPHA)
#define LEFTFN MO(_LEFTFN) #define LEFTFN MO(_LEFTFN)
#define RIGHTFN MO(_RIGHTFN)
#define NUMPAD MO(_NUMPAD) #define NUMPAD MO(_NUMPAD)
#define LEAGUE TG(_LEAGUE) #define RIGHTFN MO(_RIGHTFN)
#define PUBG TG(_PUBG) #define MOBA TG(_MOBA)
#define OVERWATCH TG(_OVERWATCH) #define FPS1 TG(_FPS1)
#define STARCRAFT TG(_STARCRAFT) #define FPS2 TG(_FPS2)
#define TETRIS TG(_TETRIS) #define STRAT TG(_STRAT)
#define ARROWS TG(_ARROWS)
#define CLEAN TG(_CLEAN) #define CLEAN TG(_CLEAN)
#define RGB MO(_RGB) #define RGB MO(_RGB)
// Tap dance declarations // Tap dance declarations
enum { enum {
TD_LNG1_LNG2, TD_PAST_PSLS,
TD_PAST_PSLS TD_PASTE_COPY
}; };
qk_tap_dance_action_t tap_dance_actions[] = { qk_tap_dance_action_t tap_dance_actions[] = {
[TD_LNG1_LNG2] = ACTION_TAP_DANCE_DOUBLE(KC_LNG1, KC_LNG2), [TD_PAST_PSLS] = ACTION_TAP_DANCE_DOUBLE(KC_PAST, KC_PSLS),
[TD_PAST_PSLS] = ACTION_TAP_DANCE_DOUBLE(KC_PAST, KC_PSLS) [TD_PASTE_COPY] = ACTION_TAP_DANCE_DOUBLE(LCTL(KC_V), LCTL(KC_C))
}; };
// Custom shift implementation
const custom_shift_key_t custom_shift_keys[] = {
{KC_LNG1, KC_LNG2},
{KC_LT, KC_COMM},
{KC_GT, KC_DOT},
{KC_LCBR, KC_LBRC},
{KC_RCBR, KC_RBRC}
};
uint8_t NUM_CUSTOM_SHIFT_KEYS = sizeof(custom_shift_keys) / sizeof(custom_shift_key_t);
bool process_record_user(uint16_t keycode, keyrecord_t* record)
{
if ( !process_custom_shift_keys(keycode, record)) { return false; }
return true;
}
// Keymaps
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* ALPHA /* ALPHA
@ -62,32 +82,50 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Return| * | Shift| Z | X | C | V | B | N | M | , | . | / |Return|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* |ESC/NU|KOR/HN| Win | Alt |LEFTFN| Space |RFN/- | = |Delete| \ | Enter| * | Esc |KOR/HN| Win | Alt |LEFTFN| Space |RFN/- | = |Delete| \ | Enter|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_ALPHA] = LAYOUT_planck_mit( [_ALPHA] = LAYOUT_planck_mit(
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_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_QUOT, KC_LCTL, 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, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
LT(NUMPAD, KC_ESC), TD(TD_LNG1_LNG2), KC_LGUI, KC_LALT, LEFTFN, KC_SPC, LT(RIGHTFN, KC_MINS), KC_EQL, KC_DEL, KC_BSLS, KC_PENT LT(NUMPAD, KC_ESC), KC_LNG1, KC_LGUI, KC_LALT, LEFTFN, KC_SPC, LT(RIGHTFN, KC_MINS), KC_EQL, KC_DEL, KC_BSLS, KC_PENT
), ),
/* LEFTFN /* LEFTFN
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Left | Down | Up |Right |Ctrl+/| PGUP | [ | ] | ) | : | " | * | Ctrl | Left | Down | Up |Right |Ctrl+/|PrntSc| { | } | ) | : | " |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift|CapLck| Ins | Home | End | PGDN |PrntSc| ( | , | . | / |Return| * | Shift| [ | ] | Home | End | PGUP | PGDN | ( | < | > | / |Return|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | RGB | [ | ] | Alt | Trns | Space | _ | + |Delete| | | Enter| * | RGB | Caps | Ins | Alt | Trns | Space | _ | + |Delete| | | Enter|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LEFTFN] = LAYOUT_planck_mit( [_LEFTFN] = LAYOUT_planck_mit(
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_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_LCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, LCTL(KC_SLSH), KC_PGUP, KC_LBRC, KC_RBRC, KC_RPRN, KC_COLN, KC_DQUO, KC_LCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, LCTL(KC_SLSH), KC_PSCR, KC_LCBR, KC_RCBR, KC_RPRN, KC_COLN, KC_DQUO,
KC_LSFT, KC_CAPS, KC_INS, KC_HOME, KC_END, KC_PGDN, KC_PSCR, KC_LPRN, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, KC_LSFT, KC_LBRC, KC_RBRC, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_LPRN, KC_LT, KC_GT, KC_SLSH, KC_ENT,
RGB, KC_LBRC, KC_RBRC, KC_LALT, KC_TRNS, KC_SPC, KC_UNDS, KC_PLUS, KC_DEL, KC_PIPE, KC_PENT RGB, KC_CAPS, KC_INS, KC_LALT, KC_TRNS, KC_SPC, KC_UNDS, KC_PLUS, KC_DEL, KC_PIPE, KC_PENT
),
/* NUMPAD
* ,-----------------------------------------------------------------------------------.
* | *or/ | 7 | 8 | 9 | NumLk| | | | | | | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Alt | 4 | 5 | 6 |Return| | | | | | Shift| |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | - | 1 | 2 | 3 | Bksp | | | | , | . | Ctrl |Return|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Trns | , | + | . | 0 | Space | MOBA | FPS1 | FPS2 | STRAT|ARROWS|
* `-----------------------------------------------------------------------------------'
*/
[_NUMPAD] = LAYOUT_planck_mit(
TD(TD_PAST_PSLS), KC_P7, KC_P8, KC_P9, KC_NUM, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSPC,
KC_LALT, KC_P4, KC_P5, KC_P6, KC_ENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LSFT, KC_NO,
KC_PMNS, KC_P1, KC_P2, KC_P3, KC_BSPC, KC_NO, KC_NO, KC_NO, KC_COMM, KC_DOT, KC_LCTL, KC_ENT,
KC_TRNS, KC_COMM, KC_PPLS, KC_PDOT, KC_P0, KC_SPC, MOBA, FPS1, FPS2, STRAT, ARROWS
), ),
/* RIGHTFN /* RIGHTFN
@ -108,25 +146,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_NO, KC_NO, KC_LALT, KC_NO, KC_SPC, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO KC_NO, KC_NO, KC_NO, KC_LALT, KC_NO, KC_SPC, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO
), ),
/* NUMPAD /* MOBA
* ,-----------------------------------------------------------------------------------.
* | *or/ | 7 | 8 | 9 | NumLk| | | | | | | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Alt | 4 | 5 | 6 |Return| | | | | | Shift| |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | - | 1 | 2 | 3 | Bksp | | | | , | . | Ctrl |Return|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Trns | , | + | . | 0 | Space |LEAGUE| PUBG | OVWCh| SC |TETRIS|
* `-----------------------------------------------------------------------------------'
*/
[_NUMPAD] = LAYOUT_planck_mit(
TD(TD_PAST_PSLS), KC_P7, KC_P8, KC_P9, KC_NUM, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSPC,
KC_LALT, KC_P4, KC_P5, KC_P6, KC_ENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LSFT, KC_NO,
KC_PMNS, KC_P1, KC_P2, KC_P3, KC_BSPC, KC_NO, KC_NO, KC_NO, KC_COMM, KC_DOT, KC_LCTL, KC_ENT,
KC_TRNS, KC_COMM, KC_PPLS, KC_PDOT, KC_P0, KC_SPC, LEAGUE, PUBG, OVERWATCH, STARCRAFT, TETRIS
),
/* LEAGUE
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | 5 | Y | | | O | P | ESC | * | Tab | Q | W | E | R | 5 | Y | | | O | P | ESC |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -137,14 +157,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | 3 | X | C | Alt | 2 | Space | | | | | ALPHA| * | 3 | X | C | Alt | 2 | Space | | | | | ALPHA|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LEAGUE] = LAYOUT_planck_mit( [_MOBA] = LAYOUT_planck_mit(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_5, KC_Y, KC_NO, KC_NO, KC_O, KC_P, KC_ESC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_5, KC_Y, KC_NO, KC_NO, KC_O, KC_P, KC_ESC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_NO, KC_NO, KC_NO, KC_NO, KC_L, KC_NO, KC_NO, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_NO, KC_NO, KC_NO, KC_NO, KC_L, KC_NO, KC_NO,
KC_LSFT, KC_Z, KC_6, KC_4, KC_1, KC_B, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT, KC_LSFT, KC_Z, KC_6, KC_4, KC_1, KC_B, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT,
KC_3, KC_X, KC_C, KC_LALT, KC_2, KC_SPC, KC_NO, KC_NO, KC_NO, KC_NO, ALPHA KC_3, KC_X, KC_C, KC_LALT, KC_2, KC_SPC, KC_NO, KC_NO, KC_NO, KC_NO, ALPHA
), ),
/* PUBG /* FPS1
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | ESC | * | Tab | Q | W | E | R | T | Y | U | I | O | P | ESC |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -155,14 +175,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Ctrl | 5 | 4 | Alt | 2 | Space | 6 | 8 | 7 | 9 | ALPHA| * | Ctrl | 5 | 4 | Alt | 2 | Space | 6 | 8 | 7 | 9 | ALPHA|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_PUBG] = LAYOUT_planck_mit( [_FPS1] = LAYOUT_planck_mit(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ESC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ESC,
KC_1, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_NO, KC_F7, KC_1, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_NO, KC_F7,
KC_LSFT, KC_Z, KC_3, KC_X, KC_C, KC_V, KC_B, KC_M, KC_COMM, KC_DOT, KC_NO, KC_F9, KC_LSFT, KC_Z, KC_3, KC_X, KC_C, KC_V, KC_B, KC_M, KC_COMM, KC_DOT, KC_NO, KC_F9,
KC_LCTL, KC_5, KC_4, KC_LALT, KC_2, KC_SPC, KC_6, KC_8, KC_7, KC_9, ALPHA KC_LCTL, KC_5, KC_4, KC_LALT, KC_2, KC_SPC, KC_6, KC_8, KC_7, KC_9, ALPHA
), ),
/* OVERWATCH /* FPS2
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | ESC | * | Tab | Q | W | E | R | T | Y | U | I | O | P | ESC |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -173,14 +193,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Ctrl | | | Alt | 2 | Space | Bksp | | | | ALPHA| * | Ctrl | | | Alt | 2 | Space | Bksp | | | | ALPHA|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_OVERWATCH] = LAYOUT_planck_mit( [_FPS2] = LAYOUT_planck_mit(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ESC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ESC,
KC_1, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_1, 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, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
KC_LCTL, KC_NO, KC_NO, KC_LALT, KC_2, KC_SPC, KC_BSPC, KC_NO, KC_NO, KC_NO, ALPHA KC_LCTL, KC_NO, KC_NO, KC_LALT, KC_2, KC_SPC, KC_BSPC, KC_NO, KC_NO, KC_NO, ALPHA
), ),
/* STARCRAFT /* STRAT
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -191,15 +211,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Esc | | | Alt | F1 | Space | F10 | Pause|Delete| | ALPHA| * | Esc | | | Alt | F1 | Space | F10 | Pause|Delete| | ALPHA|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_STARCRAFT] = LAYOUT_planck_mit( [_STRAT] = LAYOUT_planck_mit(
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_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_QUOT, KC_LCTL, 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, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
KC_ESC, KC_NO, KC_NO, KC_LALT, KC_F1, KC_SPC, KC_F10, KC_PAUS, KC_DEL, KC_NO, ALPHA KC_ESC, KC_NO, KC_NO, KC_LALT, KC_F1, KC_SPC, KC_F10, KC_PAUS, KC_DEL, KC_NO, ALPHA
), ),
/* TETRIS /* ARROWS
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Tab | Q | Up | E | R | | | | | | | | * | Tab | Q | Up | E | R | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -210,8 +229,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Ctrl | | | Alt | S | Space | | | | | ALPHA| * | Ctrl | | | Alt | S | Space | | | | | ALPHA|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_TETRIS] = LAYOUT_planck_mit( [_ARROWS] = LAYOUT_planck_mit(
KC_TAB, KC_Q, KC_UP, KC_E, KC_R, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TAB, KC_Q, KC_UP, KC_E, KC_R, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_A, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_A, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
@ -239,20 +257,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* RGB (LEFTFN + RGB) /* RGB (LEFTFN + RGB)
* v------------------------RGB CONTROL--------------------v * v------------------------RGB CONTROL--------------------v
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | CLEAN| * | Mute | Reset| MS_U | BR B | BR F | | | MOD R| MOD B| FX+ | |CLEAN |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | | * | Ctrl | MS_L | MS_D | MS_R |Return|PST/CO| | MOD P| MOD S| FX- | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* |RGBTGL| MOD+ | BRT+ | SAT+ | | | | FX+ | HUE+ | | MOD R| MODES| * | Shift| MCK | RCK | LCK | Bksp | | | BRT+ | MOD+ | SAT+ | HUE+ | MS 0 |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | MOD- | BRT- | SAT- | Trns | | FX- | HUE- | | MOD B| MOD P| * | Trns | VOL- | VOL+ | WL U | WL D | Space | BRT- | MOD- | SAT- | HUE- |RGBTGL|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_RGB] = LAYOUT_planck_mit( [_RGB] = LAYOUT_planck_mit(
KC_NO, QK_BOOT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, CLEAN, KC_MUTE, QK_BOOT, KC_MS_U, KC_WBAK, KC_WFWD, KC_NO, KC_NO, RGB_M_R, RGB_M_B, RGB_SPI, KC_NO, CLEAN,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LCTL, KC_MS_L, KC_MS_D, KC_MS_R, KC_ENT, TD(TD_PASTE_COPY), KC_NO, RGB_M_P, RGB_M_SW, RGB_SPD, KC_NO, KC_NO,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_SAI, KC_NO, KC_NO, KC_NO, RGB_SPI, RGB_HUI, KC_NO, RGB_M_R, RGB_M_SW, KC_LSFT, KC_BTN3, KC_BTN2, KC_BTN1, KC_BSPC, KC_NO, KC_NO, RGB_VAI, RGB_MOD, RGB_SAI, RGB_HUI, KC_ACL0,
KC_NO, RGB_RMOD, RGB_VAD, RGB_SAD, KC_TRNS, KC_NO, RGB_SPD, RGB_HUD, KC_NO, RGB_M_B, RGB_M_P KC_TRNS, KC_VOLD, KC_VOLU, KC_WH_U, KC_WH_D, KC_SPC, RGB_VAD, RGB_RMOD, RGB_SAD, RGB_HUD, RGB_TOG
) )
}; };
@ -270,9 +288,7 @@ bool rgb_matrix_indicators_user(void) {
uint8_t blue[3] = {0, 6, 20}; uint8_t blue[3] = {0, 6, 20};
uint8_t green[3] = {14, 22, 0}; uint8_t green[3] = {14, 22, 0};
uint8_t purple[3] = {6, 0, 22}; uint8_t purple[3] = {6, 0, 22};
uint8_t pink[3] = {17, 0, 22};
uint8_t white[3] = {255, 255, 255}; uint8_t white[3] = {255, 255, 255};
uint8_t wasd[4] = {2, 13, 14, 15};
switch (get_highest_layer(layer_state)) { switch (get_highest_layer(layer_state)) {
case _ALPHA: case _ALPHA:
@ -283,37 +299,36 @@ bool rgb_matrix_indicators_user(void) {
break; break;
case _NUMPAD: case _NUMPAD:
break; break;
case _LEAGUE: case _MOBA:
rgb_matrix_set_color(16, red[0], red[1], red[2]); rgb_matrix_set_color(16, red[0], red[1], red[2]);
rgb_matrix_set_color(15, yellow[0], yellow[1], yellow[2]); rgb_matrix_set_color(15, yellow[0], yellow[1], yellow[2]);
rgb_matrix_set_color(29, blue[0], blue[1], blue[2]); rgb_matrix_set_color(29, blue[0], blue[1], blue[2]);
rgb_matrix_set_color(10, purple[0], purple[1], purple[2]); rgb_matrix_set_color(10, purple[0], purple[1], purple[2]);
break; break;
case _PUBG: case _FPS1:
rgb_matrix_set_color(43, green[0], green[1], green[2]); rgb_matrix_set_color(43, green[0], green[1], green[2]);
break; break;
case _OVERWATCH: case _FPS2:
rgb_matrix_set_color(44, green[0], green[1], green[2]); rgb_matrix_set_color(44, green[0], green[1], green[2]);
break; break;
case _STARCRAFT: case _STRAT:
rgb_matrix_set_color(45, green[0], green[1], green[2]); rgb_matrix_set_color(45, green[0], green[1], green[2]);
break; break;
case _TETRIS: case _ARROWS:
for (int i = 0; i < sizeof wasd; i++) { rgb_matrix_set_color(46, green[0], green[1], green[2]);
rgb_matrix_set_color(wasd[i], pink[0], pink[1], pink[2]);
}
break; break;
case _CLEAN: case _CLEAN:
rgb_matrix_set_color_all(white[0], white[1], white[2]); rgb_matrix_set_color_all(white[0], white[1], white[2]);
break; break;
case _RGB: case _RGB:
rgb_matrix_set_color(1, blue[0], blue[1], blue[2]);
break; break;
} }
led_t led_state = host_keyboard_led_state(); led_t led_state = host_keyboard_led_state();
//Capslock led //Capslock led
if (led_state.caps_lock) { if (led_state.caps_lock) {
rgb_matrix_set_color(12, green[0], green[1], green[2]); rgb_matrix_set_color(0, green[0], green[1], green[2]);
} }
//Numlock led //Numlock led
if (led_state.num_lock) { if (led_state.num_lock) {

View File

@ -1,22 +1,17 @@
# Dan's KPrepublic BM40 Keymap # Dan's KPrepublic BM40 Keymap
> ** There isn't a qmk firmware for the new bm40 v2 pcb yet. Check with your vendor before purchasing.
>
>This is my personal keymap with an LED indicator support for num lock, caps lock and scroll lock. >This is my personal keymap with an LED indicator support for num lock, caps lock and scroll lock.
![](https://i.imgur.com/2yclc1B.jpg) ![](https://i.imgur.com/2yclc1B.jpg)
> * Case: Poseidon PSD40 Case > * Case: Poseidon PSD40 Case
> * Plate: Brass > * Plate: Brass
> * Keycaps: WOB ABS Cherry Profile > * Keycaps: WOB ABS Cherry Profile
> * Switches: Gazzew Boba u4t (62g 2 stage long spring) > * Switches: Gazzew Boba U4t (62g 2 stage long spring)
![](https://i.imgur.com/imqhjZW.jpg) <br />
> * Case: JJ40 Aluminium Acclive Case with Acrylic Diffuser
> * Keycaps: YMDK DSA Keycaps
> * Artisan: Rodríguez Cap by Polykeys
### BM40 LED INDEX ### BM40 LED INDEX
**_Numlock (11) Capslock (12) Scroll lock (23)_** **_Numlock ( 11 ) Capslock ( 0 or 12 ) Scroll lock ( 23 )_**
| | _A_ | _B_ | _C_ | _D_ | _E_ | _F_ | _G_ | _H_ | _I_ | _J_ | _K_ | _L_ | | | _A_ | _B_ | _C_ | _D_ | _E_ | _F_ | _G_ | _H_ | _I_ | _J_ | _K_ | _L_ |
|---------|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:| |---------|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
@ -25,16 +20,17 @@
| **_3_** | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | | **_3_** | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
| **_4_** | &nbsp;&nbsp;&nbsp;36 | &nbsp;&nbsp;&nbsp;37 | &nbsp;&nbsp;&nbsp;38 | &nbsp;&nbsp;&nbsp;&nbsp;39 | &nbsp;&nbsp;&nbsp;&nbsp;40 | &nbsp;&nbsp;&nbsp;41 | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;42 | &nbsp;&nbsp;&nbsp;43 | &nbsp;&nbsp;&nbsp;44 | &nbsp;&nbsp;&nbsp;45 | &nbsp;&nbsp;&nbsp;46 | | **_4_** | &nbsp;&nbsp;&nbsp;36 | &nbsp;&nbsp;&nbsp;37 | &nbsp;&nbsp;&nbsp;38 | &nbsp;&nbsp;&nbsp;&nbsp;39 | &nbsp;&nbsp;&nbsp;&nbsp;40 | &nbsp;&nbsp;&nbsp;41 | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;42 | &nbsp;&nbsp;&nbsp;43 | &nbsp;&nbsp;&nbsp;44 | &nbsp;&nbsp;&nbsp;45 | &nbsp;&nbsp;&nbsp;46 |
<br />
## LED INDICATOR EXAMPLES ## LED INDICATOR EXAMPLES
![](https://i.imgur.com/qpkRNio.jpg) ![](https://i.imgur.com/qpkRNio.jpg)
![](https://i.imgur.com/GfG252J.jpg) ![](https://i.imgur.com/GfG252J.jpg)
> * Case: SM Keyboards Planck/Niu Mini Acrylic Case > * Case: SM Keyboards Planck/Niu Mini Acrylic Case
> * Plate: Acrylic > * Plate: Acrylic
> * Keycaps: Drop + biip MT3 Extended 2048 Katakana > * Keycaps: Drop + biip MT3 Extended 2048 Katakana
> * Switches: Everglide Aqua King V3 (62g 2 stage long spring) > * Switches: Everglide Aqua King (62g 2 stage long spring)
<br />
<br /><br />
## KEYMAP LAYOUT EXAMPLES ## KEYMAP LAYOUT EXAMPLES
### ALPHA ### ALPHA
@ -44,19 +40,19 @@
| **_1_** | TAB | Q | W | E | R | T | Y | U | I | O | P | BSP | | **_1_** | TAB | Q | W | E | R | T | Y | U | I | O | P | BSP |
| **_2_** | CTL | A | S | D | F | G | H | J | K | L | ; | ' | | **_2_** | CTL | A | S | D | F | G | H | J | K | L | ; | ' |
| **_3_** | SFT | Z | X | C | V | B | N | M | , | . | / | RET | | **_3_** | SFT | Z | X | C | V | B | N | M | , | . | / | RET |
| **_4_** | &nbsp;ESC | KOR | WIN | &nbsp;&nbsp;ALT | &nbsp;&nbsp;&nbsp;FN | &nbsp;SPC | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- | &nbsp;&nbsp;&nbsp;&nbsp;= | DEL | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\ | ENT | | **_4_** | &nbsp;Esc | KOR | WIN | &nbsp;&nbsp;ALT | &nbsp;&nbsp;&nbsp;FN | &nbsp;SPC | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- | &nbsp;&nbsp;&nbsp;&nbsp;= | DEL | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\ | ENT |
>This is a base layer for typing. >This is a base layer for typing.
<br /> <br />
,
### LEFTFN MO(FN) ### LEFTFN MO(FN)
| | _A_ | _B_ | _C_ | _D_ | _E_ | _F_ | _G_ | _H_ | _I_ | _J_ | _K_ | _L_ | | | _A_ | _B_ | _C_ | _D_ | _E_ | _F_ | _G_ | _H_ | _I_ | _J_ | _K_ | _L_ |
|---------|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:| |---------|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|
| **_1_** | \` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BSP | | **_1_** | \` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BSP |
| **_2_** | CTL | LFT | DN | UP | RHT | C+/ | PGU | [ | ] | ) | : | " | | **_2_** | CTL | LFT | DN | UP | RHT | C+/ | PRN | [ | ] | ) | : | " |
| **_3_** | SFT | CAPS| INS | HOM | END | PGD | PRN | ( | , | . | / | RET | | **_3_** | SFT | [ | ]&nbsp; | HOM | END | PGU | PGD | ( | , | . | / | RET |
| **_4_** | RGB | [ | ]&nbsp; | ALT | TRN | &nbsp;SPC || &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_ | &nbsp;&nbsp;&nbsp;&nbsp;+ | &nbsp;DEL | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\| | ENT | | **_4_** | RGB | CAP | INS | ALT | TRN | &nbsp;SPC || &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_ | &nbsp;&nbsp;&nbsp;&nbsp;+ | &nbsp;DEL | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\| | ENT |
>This is the layer dedicated to number, symbol and navigation keys. ie) arrow keys >This is the layer dedicated to number, symbol and navigation keys. ie) arrow keys
<br /> <br />
@ -73,17 +69,37 @@
<br /> <br />
### NUMPAD MO(ESC) ### NUMPAD MO(Esc)
| | _A_ | _B_ | _C_ | _D_ | _E_ | _F_ | _G_ | _H_ | _I_ | _J_ | _K_ | _L_ | | | _A_ | _B_ | _C_ | _D_ | _E_ | _F_ | _G_ | _H_ | _I_ | _J_ | _K_ | _L_ |
|---------|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:| |---------|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|----:|
| **_1_** | *or/| 7 | 8 | 9 | NUM | | | | | | | BSP | | **_1_** | *or/| 7 | 8 | 9 | NUM | | | | | | | BSP |
| **_2_** | ALT | 4 | 5 | 6 | RET | | | | | | SFT | | | **_2_** | ALT | 4 | 5 | 6 | RET | | | | | | | |
| **_3_** | - | 1 | 2 | 3 | BSP | | | | , | . | CTL | RET | | **_3_** | - | 1 | 2 | 3 | BSP | | | | | | | RET |
| **_4_** | TRN | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;. | &nbsp;&nbsp;&nbsp;0 | SPC | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;LY1 | &nbsp;LY2 | &nbsp;LY3 | &nbsp;LY4 | &nbsp;LY5 | | **_4_** | TRN | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;. | &nbsp;&nbsp;&nbsp;0 | SPC | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;LY1 | &nbsp;LY2 | &nbsp;LY3 | &nbsp;LY4 | &nbsp;LY5 |
>This layer is the numpad. >This layer is the numpad.
<br /> <br />
There are other dedicated layers for gaming that are not included here. There are other dedicated layers for gaming that are not included here.
If you are interested, check out keymap.c! If you are interested, check out keymap.c!
<br />
## PHOTOS
![](https://imgur.com/ABblRwp.jpg)
> * Case: SM Keyboards Planck/Niu Mini Acrylic Case
> * Plate: Acrylic
> * Keycaps: Rama Works GRID Set A Keycaps ( Kuros )
> * Switches: Thic Thock Marshmallow Linear Switch ( 55g )
<br />
![](https://i.imgur.com/imqhjZW.jpg)
> * Case: JJ40 Aluminium Acclive Case with Acrylic Diffuser
> * Keycaps: YMDK DSA Keycaps
> * Artisan: Rodríguez Cap by Polykeys
<br />
<div style="text-align: right">- END -</div>

View File

@ -1 +1,2 @@
TAP_DANCE_ENABLE = yes TAP_DANCE_ENABLE = yes
SRC += features/custom_shift_keys.c