[Keymap] Add personal keymap to GMMK Pro ANSI (#15314)

Co-authored-by: Drashna Jaelre <drashna@live.com>
master
Choi Byungyoon 2022-01-13 13:59:45 +09:00 committed by GitHub
parent 731072fc5c
commit aa9577b371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 385 additions and 0 deletions

View File

@ -0,0 +1,72 @@
/* Copyright 2021 Choi Byungyoon <byungyoonc@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#define RGB_MATRIX_KEYPRESSES
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
// #define ENABLE_RGB_MATRIX_ALPHAS_MODS
// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
// #define ENABLE_RGB_MATRIX_BREATHING
#undef ENABLE_RGB_MATRIX_BAND_SAT
#undef ENABLE_RGB_MATRIX_BAND_VAL
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
// #define ENABLE_RGB_MATRIX_CYCLE_ALL
// #define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
// #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
// #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL
#undef ENABLE_RGB_MATRIX_DUAL_BEACON
#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON
#undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
// #define ENABLE_RGB_MATRIX_RAINDROPS
// #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
#undef ENABLE_RGB_MATRIX_HUE_BREATHING
#undef ENABLE_RGB_MATRIX_HUE_PENDULUM
#undef ENABLE_RGB_MATRIX_HUE_WAVE
// #define ENABLE_RGB_MATRIX_PIXEL_RAIN
#undef ENABLE_RGB_MATRIX_PIXEL_FLOW
#undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL
// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
// #define ENABLE_RGB_MATRIX_TYPING_HEATMAP
// #define ENABLE_RGB_MATRIX_DIGITAL_RAIN
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#undef ENABLE_RGB_MATRIX_SPLASH
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#undef ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
#undef DEBOUNCE
/* High debounce time is required to avoid key chattering because of the debouncing algorithm sym_eager_pk */
#define DEBOUNCE 40

View File

@ -0,0 +1,129 @@
/* Copyright 2021 Choi Byungyoon <byungyoonc@gmail.com>
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 <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "byungyoonc.h"
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Prt Rotary(Mic Mute)
// ~ 1 2 3 4 5 6 7 8 9 0 - (=) BackSpc TaskMgr
// Tab Q W E R T Y U I O P [ ] \ Del
// Caps A S D F G H J K L ; " Enter Home
// Sh_L Z X C V B N M , . ? Sh_R Up End
// Ct_L Win_L Alt_L SPACE Alt_R FN Ct_R Left Down Right
[0] = LAYOUT(
KC_ESC, 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_PSCR, KC_MMUT,
KC_GRV, 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_TASK,
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_BSLS, KC_DEL,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
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, KC_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
_______, KC_BRID, KC_BRIU, KC_CALC, KC_MSEL, RGB_VAD, RGB_VAI, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, KC_SEC1, KC_SEC2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DEBUG, _______,
_______, _______, _______, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, _______,
_______, _______, _______, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, RGB_HUI, RGB_HUD, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, RGB_MOD, _______,
_______, GUI_TOG, _______, _______, _______, _______, _______, RGB_SPD, RGB_RMOD, RGB_SPI
),
};
// clang-format on
bool process_record_user_kb(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
rgblight_increase_hue();
}
return true;
}
#if defined(ENCODER_ENABLE)
bool encoder_update_user(uint8_t index, bool clockwise) {
uint8_t mod_state = get_mods();
if (mod_state & MOD_MASK_CTRL) {
unregister_mods(MOD_MASK_CTRL);
if (clockwise) {
tap_code16(LCTL(KC_RGHT));
} else {
tap_code16(LCTL(KC_LEFT));
}
set_mods(mod_state);
} else {
if (clockwise) {
tap_code16(KC_VOLU);
} else {
tap_code16(KC_VOLD);
}
}
return true;
}
#endif // ENCODER_ENABLE
static void set_rgb_caps_leds(void);
static void set_rgb_caps_leds() {
rgb_matrix_set_color(73, 0xFF, 0x77, 0x77); // Left side LED 3
rgb_matrix_set_color(74, 0xFF, 0x77, 0x77); // Right side LED 3
rgb_matrix_set_color(76, 0xFF, 0x77, 0x77); // Left side LED 4
rgb_matrix_set_color(77, 0xFF, 0x77, 0x77); // Right side LED 4
rgb_matrix_set_color(80, 0xFF, 0x77, 0x77); // Left side LED 5
rgb_matrix_set_color(81, 0xFF, 0x77, 0x77); // Right side LED 5
rgb_matrix_set_color(83, 0xFF, 0x77, 0x77); // Left side LED 6
rgb_matrix_set_color(84, 0xFF, 0x77, 0x77); // Right side LED 6
rgb_matrix_set_color(3, 0xFF, 0x77, 0x77); // CAPS LED
}
static void set_rgb_nlck_notset_leds(void);
static void set_rgb_wlck_leds(void);
static void set_rgb_nlck_notset_leds() {
rgb_matrix_set_color(67, 0x77, 0x77, 0xFF); // Left side LED 1
rgb_matrix_set_color(68, 0x77, 0x77, 0xFF); // Right side LED 1
rgb_matrix_set_color(70, 0x77, 0x77, 0xFF); // Left side LED 2
rgb_matrix_set_color(71, 0x77, 0x77, 0xFF); // Right side LED 2
}
static void set_rgb_wlck_leds() {
rgb_matrix_set_color(87, 0x77, 0xFF, 0x77); // Left side LED 7
rgb_matrix_set_color(88, 0x77, 0xFF, 0x77); // Right side LED 7
rgb_matrix_set_color(91, 0x77, 0xFF, 0x77); // Left side LED 8
rgb_matrix_set_color(92, 0x77, 0xFF, 0x77); // Right side LED 8
}
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
set_rgb_caps_leds();
}
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) {
set_rgb_nlck_notset_leds();
}
if (keymap_config.no_gui) {
set_rgb_wlck_leds();
}
}
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
for (int i = 0; i < 20; i++) {
wait_cpuclock(STM32_SYSCLK / 1000000L);
}
}

View File

@ -0,0 +1,41 @@
byungyoonc's GMMK Pro Layout
============================
## Keymap
### Base Layer
![GMMK Pro Base Layer Layout Image](https://i.imgur.com/VvEL08Q.png)
Made a bit of a change on the leftmost side of the keyboard to set Home and End closer to the arrow keys. Also uses a shortcut for Windows Task Manager, Windows PowerToys microphone mute.
### Fn Layer
![GMMK Pro Fn Layer Layout Image](https://i.imgur.com/uQy2gSh.png)
F-row media functions roughly matches the Keychron keyboard's layout.
Added Debug key for faster debugging iteration.
Supports Secrets input by Fn + Numbers.
The rest are pretty self-explanatory RGB controls, a GUI toggle and an NKRO toggle.
## Rotary Encoder Rotation
Volume control when no mods, Ctrl+Left/Right when Ctrl is pressed while rotating the encoder.
## RGB Indicators
Uses side strap RGB as the RGB indicators.
- Top third lights on when the Num Lock is turned off.
- Middle third lights on when the Caps Lock is turned on.
- Bottom third lights on when the GUI is disabled (via `GUI_TOG`).
## Debounce
Uses the `DEBOUNCE_TYPE` of `sym_eager_pk` for the shortest response time possible, and `DEBOUNCE` time of `40` in order to eliminate any key chattering.
## NKRO
N-key rollover is turned on by default.
## RGB Matrix
Keypresses effects are enabled.
Disabled default several RGB effects.
Added custom RGB matrix effect `saturated_solid_multisplash`.
Every keypress increases the RGB hue value.

View File

@ -0,0 +1 @@
#include "saturated_solid_multisplash.h"

View File

@ -0,0 +1,2 @@
DEBOUNCE_TYPE = sym_eager_pk
RGB_MATRIX_CUSTOM_USER = yes

View File

@ -0,0 +1,48 @@
/* Copyright 2021 Choi Byungyoon <byungyoonc@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "byungyoonc.h"
#if (__has_include("secrets.h") && !defined(NO_SECRETS))
# include "secrets.h"
#else
static const char *const secrets[] = {"test1", "test2"};
#endif
#if !defined(MACRO_TIMER)
# define MACRO_TIMER 20
#endif
/* replicaJunction's process_record_user_kb */
__attribute__ ((weak))
bool process_record_user_kb(uint16_t keycode, keyrecord_t *record) {
return true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_SEC1 ... KC_SEC2: /* Secrets! Externally defined strings, not stored in repo */
if (!record->event.pressed) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
send_string_with_delay(secrets[keycode - KC_SEC1], MACRO_TIMER);
}
return false;
break;
}
return process_record_user_kb(keycode, record);
};

View File

@ -0,0 +1,27 @@
/* Copyright 2021 Choi Byungyoon <byungyoonc@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
enum custom_keycodes {
KC_SEC1 = SAFE_RANGE,
KC_SEC2
};
#define KC_TASK LCTL(LSFT(KC_ESC))
#define KC_MMUT LSG(KC_A)
bool process_record_user_kb(uint16_t keycode, keyrecord_t *record);

View File

@ -0,0 +1,14 @@
byungyoonc QMK Userspace
========================
# Overview
Defines some custom keycodes, alongside with the Secrets feature. Also incorporates `process_record_user_kb()` for further controls.
Heavily influenced by the [Userspace code by replicaJunction](../replicaJunction/readme.md).
# Features
## Custom Keycodes
- `KC_SEC#` for the Secrets input
- `KC_TASK` for the Windows Task Manager shortcut `LCTL(LSFT(KC_ESC))`
- `KC_MMUT` for the Windows PowerToys Conference Mute microphone `LSG(KC_A)`

View File

@ -0,0 +1 @@
SRC += byungyoonc.c

View File

@ -0,0 +1,50 @@
/* Copyright 2021 Choi Byungyoon <byungyoonc@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#if defined(RGB_MATRIX_KEYPRESSES)
RGB_MATRIX_EFFECT(saturated_solid_multisplash)
# if defined(RGB_MATRIX_CUSTOM_EFFECT_IMPLS)
static bool saturated_solid_multisplash(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
uint8_t count = g_last_hit_tracker.count;
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
HSV hsv = rgb_matrix_config.hsv;
hsv.v = 0;
for (uint8_t j = 0; j < count; j++) {
int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
uint8_t dist = sqrt16(dx * dx + dy * dy);
uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], qadd8(rgb_matrix_config.speed, 1));
uint16_t effect = tick - dist;
if (effect > 255) effect = 255;
uint16_t vdiff = scale16by8(255 - effect, 255 - dist);
hsv.v = qadd8(hsv.v, vdiff);
hsv.s = qsub8(hsv.s, qsub8(127, effect));
}
hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
return led_max < DRIVER_LED_TOTAL;
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // RGB_MATRIX_KEYPRESSES