1
0
Fork 0

[Keymap Removal] keyboard with most keymaps (#23092)

This commit is contained in:
Joel Challis 2024-02-16 13:25:44 +00:00 committed by GitHub
parent b8646bc40b
commit 78a74ca974
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
426 changed files with 0 additions and 27404 deletions

View file

@ -1,143 +0,0 @@
// Copyright 2021 Winston Durand (@R167)
// SPDX-License-Identifier: MIT
#include QMK_KEYBOARD_H
enum ctrl_keycodes {
U_T_AUTO = SAFE_RANGE, // USB Extra Port Toggle Auto Detect / Always Active
U_T_AGCR, // USB Toggle Automatic GCR control
DBG_TOG, // DEBUG Toggle On / Off
DBG_MTRX, // DEBUG Toggle Matrix Prints
DBG_KBD, // DEBUG Toggle Keyboard Prints
DBG_MOU, // DEBUG Toggle Mouse Prints
MD_BOOT, // Restart into bootloader after hold timeout
SLEEP, // Macro to send CMD+ALT+Ejct & turn off lights
};
enum r167_layers {
_QWERTY = 0, // Standard querty layout
_FN, // Simple function keys
};
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = 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_SCRL, KC_PAUS,
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_EJCT, KC_HOME, KC_VOLU,
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_END, KC_VOLD,
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_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_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[_FN] = LAYOUT(
SLEEP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, SLEEP, KC_MPLY, _______, _______,
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, _______,
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/*
[X] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
// clang-format on
#define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT)
#define MODS_CTRL (get_mods() & MOD_MASK_CTRL)
#define MODS_ALT (get_mods() & MOD_MASK_ALT)
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
static bool asleep = false;
if (asleep && record->event.pressed) {
asleep = false;
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
}
switch (keycode) {
case U_T_AUTO:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case DBG_TOG:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
}
return false;
case DBG_MTRX:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
}
return false;
case DBG_KBD:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
}
return false;
case DBG_MOU:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
rgb_matrix_set_color_all(0, 0, 0);
} break;
case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
} break;
case LED_FLAG_UNDERGLOW: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
} break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
} break;
}
}
return false;
case SLEEP:
if (record->event.pressed) {
// CMD+ALT+EJECT doesn't always reliably trigger. fall back mode
// tap_code16(G(A(KC_EJCT)));
tap_code16(LCTL(LGUI(KC_Q)));
asleep = true;
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
} else if (IS_RELEASED(record->event)) {
tap_code(KC_ESCAPE);
}
return false;
default:
return true; // Process all other keycodes normally
}
}

View file

@ -1,14 +0,0 @@
![Layer 0](https://i.imgur.com/iRwr7si.png)
![Layer 1](https://i.imgur.com/b2qwYdR.png)
# R167 massdrop ctrl
The main layer is a ~standard QWERTY layout with the ALT/GUI swap for macOS
in addition to shifting the `Fn` key one to the right so cmd/alt line up nicely.
Addionally, I rarely use PgUp/Dn, so I've remapped those to volume control.
The most interesting bit is the shortcut `Fn + Esc` which triggers the macOS sleep
shortcut (`CMD + ALT + Eject`) and then disables LEDs since the computer will wake up
peripherals even while the display is asleep. Keyboard is returned to all LEDs on after
pressing any key.

View file

@ -1,83 +0,0 @@
# Massdrop Ctrl Endgame
This keymap is here to show some love to the MD Ctrl.
## Layers
### Typing Layer
![Typing Layer](https://imgur.com/QUIU2SL.png)
### Function Layer
![Function Layer](https://imgur.com/4q4ld4X.png)
### Mouse Layer
![Mouse Layer](https://imgur.com/xXVFyEE.png)
### Git Layer
![Git Layer](https://imgur.com/WMMM0zz.png)
## Features
These are the features currently supported by this keymap:
### RGB Time Out
This allows setting a dynamic timeout for RGB to turn off. The following is supported:
1. Restores on the first click of any key.
2. Restores to its previous state before timeout. i.e. if it was edge only before timeout it will restore to edge only, same for all modes.
3. Doesn't interfere with RGB modes. You can set keyboard to All, Edge Only or Off and timeout will not interfere with these modes.
4. The time before RGB is turned off is dynamically adjustable using keycodes ROUT_VI to increase, ROUT_VD to decrease. They have a 10 second steps by default. Minimum value 10 seconds by default and maximum is 10 minutes.
5. Can be toggled on or off dyncamically with the ROUT_TG keycode.
6. Can be put in fast mode using ROUT_FM, for movie watching purposes. Default value is 3 seconds. Note that fast mode disabled ROUT_VD and ROUT_VI so to use them again you have to toggle fast mode off with ROUT_FM. It doesn't impact ROUT_TG and ROUT_TG will remember if fast mode was enabled when toggled back on, so it doesn't disable fast mode on its own, only ROUT_FM can disable or enable fast mode.
### Tapdance Keys
Not really a feature. I just want to document what tapdance keys this keymap has because there will be many of them.
1. LGUI is used for both LGUI and toggle mouse layer for double tap.
2. LCTRL sends LCTRL for single tap and LCTRL+LALT+T for double tap, which opens terminal in most environments.
## Future Work
By the time this is project has accomplished its original primary objectives, the following features will be available for the ctrl:
1. Automatic RGB timeout with all the options you would need. **DONE**
2. Macro and Shortcut layers for at least the following: Git **DONE**, IntelliJ, VIM **WIP**, Yakuake, KDE, Firefox, Slack, Discord. All using default program configuration. [This list may and probably will get longer]
3. Custom LED configs that offer all the RGB layouts I deem useful or having a unique feature, look or feel. **DONE**
4. Increased Dynamic Macro slots, because two simply isn't enough. This particular one falls outside Ctrl config and into QMK core modification. However, it is on the list of features I would like this keyboard to have and is a **TOP PRIORITY** for me. It won't be easy, but I will figure it out.
5. Porting from the Drop, Inc. way of doing things to the QMK way of doing things, wherever possible. Full QMK support of this keyboard is the goal, not that it's possible, but I'd like to get as close as it gets. **WIP**
6. An easier way to configure LED than both the QMK way and the Drop way. I'm thinking of a graphical LED config like Drop configurator that offers the advanced LED config features QMK offers. This may or may not get done depending on whether or not I get sick of QMK LED config at any point. If it does get done, it may or may not be added to QMK Configurator.
7. Better documentation of the MD Ctrl specifications, features, etc. This will be included here in the form of C and doxygen comments. The bigger portion will be included in QMK docs if and where possible. **WIP**
Additions:
8. Implement Raw HID. **WIP**
This list will most probably either expand or have some items removed if they're deemed not worthy, probably both. Nothing will be removed because it can't be done though, I am a firm believer in You Can Do It. Anything modified in this list will be clearly marked, for posterity.
## Motivation
I bought this keyboard because I believed and still believe that it offers the greatest possible value for money for any TKL fan. It was very disappointing to me after receiving it to see that this keyboard didn't get the love it should have in QMK, from either Drop, Inc. or users.
Granted, this is a TKL RGB board which means it is hated by every single enthusiast in the community. That doesn't mean it shouldn't be getting love form its users, or most importantly its maker.
Drop, Inc. have for some reason decided that they want to work on their own QMK stack. A stupid decision to say the least. Although having made this decision, they did very little actual work on this keyboard and have offered very little support and almost no time working on the firmware. To my knowledge, no one is currently working on it in a truly active fashion. A small handful of people work on the software and even then, they seem to think that their own way of doing things is better than the way chosen by the thousands in the community who have worked on QMK. Their QMK fork for the keyboard is abandoned for months. Updates are few and far between and it seems this keyboard has been forgotten in the annals of 2018 by both its maker and its users.
To their credit, at least they decided to abandon their idiotic RGB setup and have opted after taking their sweet time to use QMK RGB and they did make some much needed changes to mdloader. That being said, Drop, Inc. still don't show love to this keyboard and whether or not they are actually able is questionable.
So the aim of this work, starting with this Keymap, is to make the Massdrop Ctrl a true QMK keyboard instead of the marketing spiel "QMK Supported". As much as it can be made so of course within the bounds of what can be done with information openly available about the keyboard.
I am not of the opinion that a mechanical keyboard is inherently superior. I am of the opinion that a mechanical keyboard is a tool that boosts productivity, enjoyment and efficiency, if it fails at that then it is no longer superior. Programmability is a huge part of that and I can no longer use any keyboard that doesn't have a level of programmability less than QMK offers.
I will personally do my best for this keyboard for no reason other than it will likely be my main keyboard for years to come.
## Credits
RGB timeout functionality was originally inspired by the code in this [gist](https://gist.github.com/algernon/9182469e21894192017f2bb5d478c7df).
LED config code was mostly transferred from [matthewrobo keymap](https://github.com/qmk/qmk_firmware/tree/master/keyboards/massdrop/ctrl/keymaps/matthewrobo).
Rest of the information about RGB matrix, scan matrix, and whatever information I have used was made publicly available by many other awesome members of the community.

View file

@ -1,101 +0,0 @@
#pragma once
#define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT)
#define MODS_CTRL (get_mods() & MOD_MASK_CTRL)
#define MODS_ALT (get_mods() & MOD_MASK_ALT)
// #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT) // Key combination that allows the use of magic commands (useful for debugging)
// #define NO_DEBUG // Disable debugging
// #define NO_PRINT // Disable printing/debugging using hid_listen
// #define NO_ACTION_LAYER // Disable layers
// #define NO_ACTION_TAPPING // Disable tap dance and other tapping features
// #define NO_ACTION_ONESHOT // Disable one-shot modifiers
// #define NO_ACTION_MACRO // Disable old style macro handling: MACRO() & action_get_macro
#define TERMINAL_HELP
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 10
#define MOUSEKEY_WHEEL_DELAY 0
#define FORCE_NKRO // NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
// #define STRICT_LAYER_RELEASE // Force a key release to be evaluated using the current layer stack instead of remembering which layer it came from (used for advanced cases)
// #define LOCKING_SUPPORT_ENABLE // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
// #define LOCKING_RESYNC_ENABLE // Tries to keep switch state consistent with keyboard LED state
#define TAPPING_TERM 200 // How long before a tap becomes a hold, if set above 500, a key tapped during the tapping term will turn it into a hold too
// #define TAPPING_TERM_PER_KEY // Enables handling for per key TAPPING_TERM settings
// #define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release
#define TAPPING_TOGGLE 2 // How many taps before triggering the toggle
// #define PERMISSIVE_HOLD // Makes tap and hold keys trigger the hold if another key is pressed before releasing, even if it hasn't hit the TAPPING_TERM. See Permissive Hold for details
// #define QUICK_TAP_TERM 0 // Makes it possible to use a dual role key as modifier shortly after having been tapped. See Hold after tap. Breaks any Tap Toggle functionality (TT or the One Shot Tap Toggle)
// #define LEADER_TIMEOUT 300 // How long before the leader key times out. If you're having issues finishing the sequence before it times out, you may need to increase the timeout setting. Or you may want to enable the LEADER_PER_KEY_TIMING option, which resets the timeout after each key is tapped.
// #define LEADER_PER_KEY_TIMING // Sets the timer for leader key chords to run on each key press rather than overall
// #define LEADER_KEY_STRICT_KEY_PROCESSING // Disables keycode filtering for Mod-Tap and Layer-Tap keycodes. Eg, if you enable this, you would need to specify MT(MOD_CTL, KC_A) if you want to use KC_A.
// #define ONESHOT_TIMEOUT 300 // How long before oneshot times out
// #define ONESHOT_TAP_TOGGLE 2 // How many taps before oneshot toggle is triggered
// #define COMBO_TERM 200 // How long for the Combo keys to be detected. Defaults to TAPPING_TERM if not defined.
// #define TAP_CODE_DELAY 100 // Sets the delay between register_code and unregister_code, if you're having issues with it registering properly (common on VUSB boards). The value is in milliseconds.
// #define TAP_HOLD_CAPS_DELAY 80 // Sets the delay for Tap Hold keys (LT, MT) when using KC_CAPS_LOCK keycode, as this has some special handling on MacOS. The value is in milliseconds, and defaults to 80 ms if not defined. For macOS, you may want to set this to 200 or higher.
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_ALPHAS_MODS // Sets the default mode, if none has been set
// #define RGBLIGHT_HUE_STEP 12 // Units to step when in/decreasing hue
// #define RGBLIGHT_SAT_STEP 25 // Units to step when in/decreasing saturation
// #define RGBLIGHT_VAL_STEP 12 // Units to step when in/decreasing value (brightness)
// #define RGB_MATRIX_SLEEP // turn off effects when suspended
// #define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
// #define RGBLIGHT_EFFECT_BREATHE_CENTER // If defined, used to calculate the curve for the breathing animation. Valid values are 1.0 to 2.7
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // The maximum brightness for the breathing mode. Valid values are 1 to 255
// #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 // How long to wait between light changes for the "Christmas" animation, in milliseconds
// #define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 // The number of LEDs to group the red/green colors by for the "Christmas" animation
// #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM // The number of LEDs to have the "Knight" animation travel
// #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 // The number of LEDs to light up for the "Knight" animation
// #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 // The number of LEDs to start the "Knight" animation from the start of the strip by
// #define RGBLIGHT_RAINBOW_SWIRL_RANGE 255 // Range adjustment for the rainbow swirl effect to get different swirls
// #define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 // The number of LEDs to light up for the "Snake" animation
// This list in in the correct mode order. Next mode is the following line, previous mode is previous line. Loops around.
// #undef ENABLE_RGB_MATRIX_SOLID_COLOR // Static single hue, no speed support
// #undef ENABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue
// #undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN // Static gradient top to bottom, speed controls how much gradient changes
#undef ENABLE_RGB_MATRIX_BREATHING // Single hue brightness cycling animation
#undef ENABLE_RGB_MATRIX_BAND_SAT // Single hue band fading saturation scrolling left to right
#undef ENABLE_RGB_MATRIX_BAND_VAL // Single hue band fading brightness scrolling left to right
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT // Single hue 3 blade spinning pinwheel fades saturation
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL // Single hue 3 blade spinning pinwheel fades brightness
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT // Single hue spinning spiral fades saturation
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL // Single hue spinning spiral fades brightness
#undef ENABLE_RGB_MATRIX_CYCLE_ALL // Full keyboard solid hue cycling through full gradient
#undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT // Full gradient scrolling left to right
#undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN // Full gradient scrolling top to bottom
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN // Full gradient scrolling out to in
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL // Full dual gradients scrolling out to in
#undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Full gradent Chevron shapped scrolling left to right
#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL // Full gradient spinning pinwheel around center of keyboard
#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL // Full gradient spinning spiral around center of keyboard
#undef ENABLE_RGB_MATRIX_DUAL_BEACON // Full gradient spinning around center of keyboard
#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON // Full tighter gradient spinning around center of keyboard
#undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS // Full dual gradients spinning two halfs of keyboard
// #undef ENABLE_RGB_MATRIX_RAINDROPS // Randomly changes a single key's hue
// #undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS // Randomly changes a single key's hue and saturation
// =================================================== Requires RGB_MATRIX_FRAMEBUFFER_EFFECTS =============================================================
// #undef ENABLE_RGB_MATRIX_TYPING_HEATMAP // How hot is your WPM!
#undef ENABLE_RGB_MATRIX_DIGITAL_RAIN // That famous computer simulation
// =================================================== RGB_MATRIX_KEYPRESSES OR RGB_MATRIX_KEYRELEASES =====================================================
// #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE // Static single hue, pulses keys hit to shifted hue then fades to current hue
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Pulses keys hit to hue & value then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out
#undef ENABLE_RGB_MATRIX_SPLASH // Full gradient & value pulse away from a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_MULTISPLASH // Full gradient & value pulse away from multiple key hits then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_SPLASH // Hue & value pulse away from a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH // Hue & value pulse away from multiple key hits then fades value out

View file

@ -1,83 +0,0 @@
#ifdef RGB_MATRIX_ENABLE
#include "ctrl.h"
#include "md_rgb_matrix.h"
#include "rgb_matrix.h"
#include "config_led.h"
led_config_t g_led_config = { {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 33, 34, 35, 36, 37, 38, 39, 40 },
{ 50, 51, 52, 53, 54, 55, 56, 57 },
{ 63, 64, 65, 66, 67, 68, 69, 70 },
{ 76, 77, 78, 79, 80, 81, 82, 83 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 41, 42, 43, 44, 45, 46, 47, 48 },
{ 58, 59, 60, 61, 62, 75, 49, 32 },
{ 71, 72, 73, 74, 84, 85, 86, NO_LED }
}, {
// 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_SCRL, KC_PAUS
{ 7, 5 }, { 31, 5 }, { 43, 5 }, { 55, 5 }, { 67, 5 }, { 85, 5 }, { 97, 5 }, { 109, 5 },
{ 121, 5 }, { 139, 5 }, { 151, 5 }, { 163, 5 }, { 175, 5 }, { 193, 5 }, { 205, 5 }, { 217, 5 },
// 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_INS, KC_HOME, KC_PGUP
{ 7, 20 }, { 19, 20 }, { 31, 20 }, { 43, 20 }, { 55, 20 }, { 67, 20 }, { 79, 20 }, { 91, 20 },
{ 103, 20 }, { 115, 20 }, { 127, 20 }, { 139, 20 }, { 151, 20 }, { 169, 20 }, { 193, 20 }, { 205, 20 },
{ 217, 20 },
// 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_END, KC_PGDN
{ 10, 30 }, { 25, 30 }, { 37, 30 }, { 49, 30 }, { 61, 30 }, { 73, 30 }, { 85, 30 }, { 97, 30 },
{ 109, 30 }, { 121, 30 }, { 133, 30 }, { 145, 30 }, { 157, 30 }, { 172, 30 }, { 193, 30 }, { 205, 30 },
{ 217, 30 },
// 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
{ 11, 39 }, { 28, 39 }, { 40, 39 }, { 52, 39 }, { 64, 39 }, { 76, 39 }, { 88, 39 }, { 100, 39 },
{ 112, 39 }, { 124, 39 }, { 136, 39 }, { 148, 39 }, { 168, 39 },
// 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
{ 14, 49 }, { 34, 49 }, { 46, 49 }, { 58, 49 }, { 70, 49 }, { 82, 49 }, { 94, 49 }, { 106, 49 },
{ 118, 49 }, { 130, 49 }, { 142, 49 }, { 165, 49 }, { 205, 49 },
// KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
{ 8, 59 }, { 23, 59 }, { 38, 59 }, { 83, 59 }, { 129, 59 }, { 144, 59 }, { 159, 59 }, { 174, 59 },
{ 193, 59 }, { 205, 59 }, { 217, 59 },
// Underglow / Border
{ 224, 64 }, { 204, 64 }, { 186, 64 }, { 167, 64 }, { 149, 64 }, { 130, 64 }, { 112, 64 }, { 94, 64 },
{ 75, 64 }, { 57, 64 }, { 38, 64 }, { 20, 64 }, { 0, 64 }, { 0, 47 }, { 0, 32 }, { 0, 17 },
{ 0, 0 }, { 20, 0 }, { 38, 0 }, { 57, 0 }, { 75, 0 }, { 94, 0 }, { 112, 0 }, { 130, 0 },
{ 149, 0 }, { 167, 0 }, { 186, 0 }, { 204, 0 }, { 224, 0 }, { 224, 17 }, { 224, 32 }, { 224, 47 }
}, {
// 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_SCRL, KC_PAUS
1, 4, 4, 4, 4, 1, 1, 1,
1, 4, 4, 4, 4, 1, 1, 1,
// 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_INS, KC_HOME, KC_PGUP
4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 1, 1, 1,
1,
// 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_END, KC_PGDN
1, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 1, 1,
1,
// 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
1, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 1,
// 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
1, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 1, 1,
// KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
1, 1, 1, 4, 1, 1, 1, 1,
1, 1, 1,
// Underglow / Border
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2
} };
#ifdef USB_LED_INDICATOR_ENABLE
bool rgb_matrix_indicators_kb(void)
{
md_rgb_matrix_indicators();
return rgb_matrix_indicators_user();
}
#endif // USB_LED_INDICATOR_ENABLE
#endif

View file

@ -1,489 +0,0 @@
#include QMK_KEYBOARD_H
#include <string.h>
#define MILLISECONDS_IN_SECOND 1000
// These are just to make it neater to use builtin HSV values in the keymap
#define RED {HSV_RED}
#define CORAL {HSV_CORAL}
#define ORANGE {HSV_ORANGE}
#define GOLDEN {HSV_GOLDENROD}
#define GOLD {HSV_GOLD}
#define YELLOW {HSV_YELLOW}
#define CHART {HSV_CHARTREUSE}
#define GREEN {HSV_GREEN}
#define SPRING {HSV_SPRINGGREEN}
#define TURQ {HSV_TURQUOISE}
#define TEAL {HSV_TEAL}
#define CYAN {HSV_CYAN}
#define AZURE {HSV_AZURE}
#define BLUE {HSV_BLUE}
#define PURPLE {HSV_PURPLE}
#define MAGENT {HSV_MAGENTA}
#define PINK {HSV_PINK}
//========================================================== CONFIGURABLE DEFAULTS ==========================================================
#define RGB_DEFAULT_TIME_OUT 30
#define RGB_FAST_MODE_TIME_OUT 3
#define RGB_TIME_OUT_MAX 600
#define RGB_TIME_OUT_MIN 10
#define RGB_TIME_OUT_STEP 10
extern rgb_config_t rgb_matrix_config;
bool disable_layer_color;
bool rgb_enabled_flag; // Current LED state flag. If false then LED is off.
bool rgb_time_out_enable; // Idle LED toggle enable. If false then LED will not turn off after idle timeout.
bool rgb_time_out_fast_mode_enabled; // Enable flag for RGB timeout fast mode
bool rgb_time_out_user_value; // This holds the toggle value set by user with ROUT_TG. It's necessary as RGB_TOG changes timeout enable.
uint16_t rgb_time_out_seconds; // Idle LED timeout value, in seconds not milliseconds
uint16_t rgb_time_out_saved_seconds; // The saved user config for RGB timeout period
led_flags_t rgb_time_out_saved_flag; // Store LED flag before timeout so it can be restored when LED is turned on again.
enum layout_names {
_KL=0, // Keys Layout: The main keyboard layout that has all the characters
_FL, // Function Layout: The function key activated layout with default functions and some added ones
_ML, // Mouse Layout: Mouse Keys and mouse movement
_GL, // GIT Layout: GIT shortcuts and macros
_VL, // VIM Layout: VIM shorcuts and macros
_YL, // Yakuake Layout: Yakuake drop-down terminal shortcuts and macros
_EL, // KDE Layout: Shortcuts for KDE desktop using default KDE shortcuts settings
};
enum tapdance_keycodes {
TD_LGUI_ML = 0, // Tap dance key to switch to mouse layer _ML
TD_APP_YL,
TD_CTRL_TERM, // Tap dance key to open terminal on LCTRL double press
};
enum ctrl_keycodes {
U_T_AUTO = SAFE_RANGE, // USB Extra Port Toggle Auto Detect / Always Active
U_T_AGCR, // USB Toggle Automatic GCR control
DBG_TOG, // DEBUG Toggle On / Off
DBG_MTRX, // DEBUG Toggle Matrix Prints
DBG_KBD, // DEBUG Toggle Keyboard Prints
DBG_MOU, // DEBUG Toggle Mouse Prints
MD_BOOT, // Restart into bootloader after hold timeout
SEL_CPY, // Select Copy. Select the word cursor is pointed at and copy, using double mouse click and ctrl+c
ROUT_TG, // Timeout Toggle. Toggle idle LED time out on or off
ROUT_VI, // Timeout Value Increase. Increase idle time out before LED disabled
ROUT_VD, // Timeout Value Decrease. Decrease idle time out before LED disabled
ROUT_FM, // RGB timeout fast mode toggle
COPY_ALL, // Copy all text using ctrl(a+c)
TERMINAL, // CTRL+ALT+T
};
enum string_macro_keycodes {
// The start of this enum should always be equal to end of ctrl_keycodes + 1
G_INIT = TERMINAL + 1, // git init
G_CLONE, // git clone
G_CONF, // git config --global
G_ADD, // git add
G_DIFF, // git diff
G_RESET, // git reset
G_REBAS, // git rebase
G_BRANH, // git branch
G_CHECK, // git checkout
G_MERGE, // git merge
G_REMTE, // git remote add
G_FETCH, // git fetch
G_PULL, // git pull
G_PUSH, // git push
G_COMM, // git commit
G_STAT, // git status
G_LOG, // git log
};
static uint16_t idle_timer; // Idle LED timeout timer
static uint8_t idle_second_counter; // Idle LED seconds counter, counts seconds not milliseconds
static uint8_t key_event_counter; // This counter is used to check if any keys are being held
static const char * sendstring_commands[] = {
"git init ",
"git clone ",
"git config --global ",
"git add ",
"git diff ",
"git reset ",
"git rebase ",
"git branch -b \"",
"git checkout ",
"git merge ",
"git remote add ",
"git fetch ",
"git pull ",
"git push ",
"git commit ",
"git status ",
"git log ",
};
//Associate our tap dance key with its functionality
tap_dance_action_t tap_dance_actions[] = {
[TD_LGUI_ML] = ACTION_TAP_DANCE_LAYER_TOGGLE(KC_LGUI, _ML),
[TD_APP_YL] = ACTION_TAP_DANCE_LAYER_TOGGLE(KC_APP, _YL),
[TD_CTRL_TERM] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, LCA(KC_T)),
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
[DEFAULT] = 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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
*/
[_KL] = 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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SC_SENT, KC_UP,
TD(TD_CTRL_TERM), TD(TD_LGUI_ML), KC_LALT, KC_SPC, KC_RALT, TT(_FL), TD(TD_APP_YL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[_FL] = LAYOUT(
_______, DM_PLY1, DM_PLY2, _______, _______, DM_REC1, DM_REC2, _______, _______, DM_RSTP, _______, KC_WAKE, KC_SLEP, KC_MUTE, _______, _______,
_______, _______, TG(_ML), TG(_GL), TG(_VL), TG(_YL), _______, _______, _______, ROUT_FM, ROUT_TG, ROUT_VD, ROUT_VI, _______, KC_MSTP, KC_MPLY, KC_VOLU,
RGB_M_P, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO, U_T_AGCR, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, _______, COPY_ALL, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, KC_BRIU,
_______, _______, _______, _______, _______, TG(_FL), _______, _______, _______, KC_BRID, _______
),
[_ML] = LAYOUT(
_______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_BTN4, KC_BTN3, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_BTN1, KC_MS_U, KC_BTN2, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, SEL_CPY, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_U,
_______, TG(_ML), _______, _______, _______, TG(_ML), _______, _______, KC_MS_L, KC_MS_D, KC_MS_R
),
[_GL] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, G_REMTE, G_RESET, G_REBAS, _______, G_INIT, _______, G_PULL, G_PUSH, _______, _______, _______, _______, _______,
_______, G_ADD, G_STAT, G_DIFF, G_FETCH, _______, _______, _______, _______, G_LOG, _______, _______, _______,
_______, G_CONF, G_CHECK, G_CLONE, G_COMM, G_BRANH, _______, G_MERGE, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, TG(_GL), _______, _______, _______, _______, _______
),
// This layout doesn't have custom keycodes for now, just custom LED config
[_VL] = 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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SC_SENT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, TG(_VL), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
// Works with https://github.com/ash0x0/config/blob/master/yakuake.shortcuts
[_YL] = LAYOUT(
KC_ESC, 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_NO, KC_NO, KC_NO,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_PGUP,
KC_NO, KC_Q, KC_NO, KC_E, KC_NO, KC_T, KC_NO, KC_NO, KC_I, KC_NO, KC_P, KC_NO, KC_RBRC, KC_BSLS, KC_NO, KC_END, KC_PGDN,
KC_NO, KC_A, KC_NO, KC_D, KC_NO, KC_G, KC_NO, KC_J, KC_K, KC_L, KC_SCLN, KC_NO, KC_NO,
KC_NO, KC_Z, KC_X, KC_NO, KC_NO, KC_NO, KC_NO, KC_M, KC_COMM, KC_DOT, KC_NO, KC_NO, KC_UP,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TG(_YL), KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RGHT
),
/*
[X] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[RGB] = LAYOUT(
ESC: 0, F1: 1, F2: 2, F3: 3, F4: 4, F5: 5, F6: 6, F7: 7, F8: 8, F9: 9, F10: 10, F11: 11, F12: 12, PSCR: 13, SLCK: 14, PAUS: 15,
GRV: 16, 1: 17, 2: 18, 3: 19, 4: 20, 5: 21, 6: 22, 7: 23, 8: 24, 9: 25, 0: 26, MINS: 27, EQL: 28, BSPC: 29, INS: 30, HOME: 31, PGUP: 32,
TAB: 33, Q: 34, W: 35, E: 36, R: 37, T: 38, Y: 39, U: 40, I: 41, O: 42, P: 43, LBRC: 44, RBRC: 45, BSLS: 46, DEL: 47, END: 48, PGDN: 49,
CAPS: 50, A: 51, S: 52, D: 53, F: 54, G: 55, H: 56, J: 57, K: 58, L: 59, SCLN: 60, QUOT: 61, ENT: 62,
LSFT: 63, Z: 64, X: 65, C: 66, V: 67, B: 68, N: 69, M: 70, COMM: 71, DOT: 72, SLSH: 73, RSFT: 74, UP: 75,
LCTL: 76, LGUI: 77, LALT: 78, SPC: 79, RALT: 80, Fn: 81, APP: 82, RCTL: 83, LEFT: 84, DOWN: 85, RGHT: 86
),
[MATRIX] = LAYOUT(
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86
),
*/
};
#ifdef _______
#undef _______
#define _______ {0, 0, 0}
const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = {
[_FL] = {
_______, CORAL, CORAL, _______, _______, CORAL, CORAL, _______, _______, CORAL, _______, YELLOW, YELLOW, TEAL, GOLD, GOLD,
_______, _______, PINK, PINK, PINK, PINK, _______, _______, _______, GREEN, GREEN, GREEN, GREEN, _______, TEAL, TEAL, TEAL,
ORANGE, ORANGE, ORANGE, ORANGE, ORANGE, ORANGE, _______, AZURE, AZURE, _______, _______, _______, _______, _______, TEAL, TEAL, TEAL,
_______, ORANGE, ORANGE, ORANGE, ORANGE, ORANGE, _______, _______, _______, _______, _______, _______, _______,
_______, ORANGE, _______, CORAL, _______, AZURE, AZURE, _______, _______, _______, _______, AZURE, SPRING,
_______, _______, _______, _______, _______, PINK, _______, AZURE, _______, SPRING, _______
},
[_ML] = {
_______, GOLD, GOLD, GOLD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, MAGENT, MAGENT, MAGENT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, MAGENT, GOLD, MAGENT, GOLD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, GOLD, GOLD, GOLD, GOLD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, CORAL, _______, _______, _______, _______, _______, _______, _______, _______, GOLD,
_______, PINK, _______, _______, _______, PINK, _______, _______, GOLD, GOLD, GOLD
},
[_GL] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, BLUE, AZURE, AZURE, _______, CYAN, _______, TURQ, PURPLE, _______, _______, _______, _______, _______,
_______, CORAL, GREEN, GREEN, TURQ, _______, _______, _______, _______, GREEN, _______, _______, _______,
_______, CYAN, CHART, TURQ, ORANGE, CHART, _______, CHART, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, PINK, _______, _______, _______, _______, _______
},
[_VL] = {
PURPLE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, TURQ, _______, _______, _______, _______, TURQ, _______, _______, _______, _______, _______, _______, _______, _______,
_______, AZURE, AZURE, AZURE, PURPLE, _______, BLUE, PURPLE, PURPLE, PURPLE, BLUE, _______, _______, _______, _______, _______, _______,
_______, PURPLE, _______, BLUE, _______, GOLD, GOLDEN, GOLDEN, GOLDEN, GOLDEN, _______, _______, _______,
_______, _______, BLUE, BLUE, _______, _______, TURQ, _______, _______, _______, TURQ, _______, _______,
_______, _______, _______, _______, _______, PINK, _______, _______, _______, _______, _______
},
[_YL] = {
RED, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
CHART, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, _______, _______, _______, _______, PURPLE, PURPLE,
_______, RED, _______, BLUE, _______, GOLD, _______, _______, GREEN, _______, MAGENT, _______, GOLD, GOLD, _______, PURPLE, PURPLE,
_______, BLUE, _______, BLUE, _______, MAGENT, _______, GREEN, GREEN, GREEN, MAGENT, _______, _______,
_______, ORANGE, ORANGE, _______, _______, _______, _______, RED, MAGENT, MAGENT, _______, _______, GREEN,
_______, _______, _______, _______, _______, PINK, _______, _______, BLUE, GREEN, BLUE
},
};
#undef _______
#define _______ KC_TRNS
#endif
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
// Enable or disable debugging
debug_enable=true;
debug_matrix=true;
debug_keyboard=true;
debug_mouse=true;
idle_second_counter = 0; // Counter for number of seconds keyboard has been idle.
key_event_counter = 0; // Counter to determine if keys are being held, neutral at 0.
rgb_time_out_seconds = RGB_DEFAULT_TIME_OUT; // RGB timeout initialized to its default configure in keymap.h
rgb_time_out_enable = false; // Disable RGB timeout by default. Enable using toggle key.
rgb_time_out_user_value = false; // Has to have the same initial value as rgb_time_out_enable.
rgb_enabled_flag = true; // Initially, keyboard RGB is enabled. Change to false config.h initializes RGB disabled.
rgb_time_out_fast_mode_enabled = false; // RGB timeout fast mode disabled initially.
rgb_time_out_saved_flag = rgb_matrix_get_flags(); // Save RGB matrix state for when keyboard comes back from ide.
};
void keyboard_post_init_user(void) {
rgb_matrix_enable();
}
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
if(rgb_time_out_enable && rgb_enabled_flag) {
// If the key event counter is not zero then some key was pressed down but not released, thus reset the timeout counter.
if (key_event_counter) {
idle_second_counter = 0;
} else if (timer_elapsed(idle_timer) > MILLISECONDS_IN_SECOND) {
idle_second_counter++;
idle_timer = timer_read();
}
if (idle_second_counter >= rgb_time_out_seconds) {
rgb_time_out_saved_flag = rgb_matrix_get_flags();
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
rgb_enabled_flag = false;
idle_second_counter = 0;
}
}
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
// Increment key event counter for every press and decrement for every release.
if (record->event.pressed) {
key_event_counter++;
} else {
key_event_counter--;
}
if (rgb_time_out_enable) {
idle_timer = timer_read();
// Reset the seconds counter. Without this, something like press> leave x seconds> press, would be x seconds on the effective counter not 0 as it should.
idle_second_counter = 0;
if (!rgb_enabled_flag) {
rgb_matrix_enable_noeeprom();
rgb_matrix_set_flags(rgb_time_out_saved_flag);
rgb_enabled_flag = true;
}
}
switch (keycode) {
case U_T_AUTO:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
}
if (record->event.pressed) {
// The Yakuake config uses LGUI+Ctrl+Shift+<keycode>. KC_NO used for undesired key, all mapped ones get mods.
if (get_highest_layer(layer_state) == _YL && keycode != TG(_YL)) {
tap_code16(C(G(S(keycode))));
return false;
}
switch (keycode) {
case DBG_TOG:
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
return false;
case DBG_MTRX:
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
return false;
case DBG_KBD:
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
return false;
case DBG_MOU:
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
return false;
case RGB_TOG:
rgb_time_out_enable = rgb_time_out_user_value;
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_UNDERGLOW: {
// This line is for LED idle timer. It disables the toggle so you can turn off LED completely if you like
rgb_time_out_enable = false;
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
}
break;
}
return false;
// ======================================================== CUSTOM KEYCOADS BELOW ========================================================
case COPY_ALL:
// Selects all and text and copy
SEND_STRING(SS_LCTL("ac"));
return false;
case SEL_CPY:
// Select word under cursor and copy. Double mouse click then ctrl+c
tap_code16(KC_BTN1);
tap_code16(KC_BTN1);
tap_code16(C(KC_C));
return false;
case ROUT_TG:
// Toggle idle LED timeout on or off
rgb_time_out_enable = !rgb_time_out_enable;
rgb_time_out_user_value = rgb_time_out_enable;
return false;
case ROUT_VI:
// Increase idle LED timeout value in seconds
// Only increase if current value is lower than RGB_TIME_OUT_MAX. Don't care what value the result will be
// Modity RGB_TIME_OUT_STEP for bigger or smaller increments
if (!rgb_time_out_fast_mode_enabled && rgb_time_out_seconds <= RGB_TIME_OUT_MAX) {
rgb_time_out_seconds += RGB_TIME_OUT_STEP;
}
return false;
case ROUT_VD:
// Decrease idle LED timeout value in seconds
// Only decrease if current value is higher than minimum value and the result is larger than zero
// Modity RGB_TIME_OUT_STEP for bigger or smaller decrements
if (!rgb_time_out_fast_mode_enabled && rgb_time_out_seconds > RGB_TIME_OUT_MIN) {
rgb_time_out_seconds -= RGB_TIME_OUT_STEP;
}
return false;
case ROUT_FM:
if (rgb_time_out_fast_mode_enabled) {
rgb_time_out_seconds = rgb_time_out_saved_seconds;
} else {
rgb_time_out_saved_seconds = rgb_time_out_seconds;
rgb_time_out_seconds = RGB_FAST_MODE_TIME_OUT;
}
rgb_time_out_fast_mode_enabled = !rgb_time_out_fast_mode_enabled;
return false;
case G_INIT ... G_LOG:
send_string_with_delay(sendstring_commands[keycode - G_INIT], 5);
return false;
}
}
return true;
}
void set_layer_color(int layer) {
if (layer == 0) { return; }
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
HSV hsv = {
.h = pgm_read_byte(&ledmap[layer][i][0]),
.s = pgm_read_byte(&ledmap[layer][i][1]),
.v = pgm_read_byte(&ledmap[layer][i][2]),
};
if (hsv.h || hsv.s || hsv.v) {
RGB rgb = hsv_to_rgb(hsv);
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b);
} else if (layer != 1) {
// Only deactivate non-defined key LEDs at layers other than FN. Because at FN we have RGB adjustments and need to see them live.
// If the values are all false then it's a transparent key and deactivate LED at this layer
rgb_matrix_set_color(i, 0, 0, 0);
}
}
}
bool rgb_matrix_indicators_user(void) {
if (disable_layer_color ||
rgb_matrix_get_flags() == LED_FLAG_NONE ||
rgb_matrix_get_flags() == LED_FLAG_UNDERGLOW) {
return;
}
set_layer_color(get_highest_layer(layer_state));
return false;
}
/* This is a test function for Raw HID, which is currently not implemented for this keyboard */
/**
void raw_hid_receive(uint8_t *data, uint8_t length) {
uint8_t response[RAW_EPSIZE];
memset(response+1, 'C', 1);
memset(response+2, 'T', 1);
memset(response+3, 'R', 1);
memset(response+4, 'L', 1);
raw_hid_send(data, length);
}
*/

View file

@ -1,13 +0,0 @@
# RGBLIGHT_ENABLE = no # Not for MD boards. This is here in case you forget.
COMMAND_ENABLE = yes # Commands for debug and configuration
# AUTO_SHIFT_ENABLE = yes # Auto Shift
NKRO_ENABLE = yes # USB Nkey Rollover
DYNAMIC_MACRO_ENABLE = yes # Dynamic macro recording and play
MOUSEKEY_ENABLE = yes # Enable mouse control keycodes. Increases firmware size.
TAP_DANCE_ENABLE = yes # Enable tap dance keys
CONSOLE_ENABLE = yes # Enable debugging console. Increases firmware size.
SRC += config_led.c # Used to add files to the compilation/linking list.
EXTRAKEY_ENABLE = yes # Audio control and System control
# RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard
# COMBO_ENABLE # Key combo feature
# LEADER_ENABLE # Enable leader key chording

View file

@ -1,18 +0,0 @@
# Massdrop CTRL default layout with raw HID protocol
This represents my current layout, with filtered out effects, personal defaults,
added inactivity timeout (for rgbmatrix) and a HID protocol example.
To test that this is working, there's a user application I'm using to help with
development on [my GitHub](https://github.com/foxx1337/rawhid_io).
Currently all the HID operations defined in the protocol are callable from the
user application:
- hello: gets the string "CTRLHID 1.0.0"
- lights: toggles the rgbmatrix on/off
- led n #RRGGBB: colors the specified led. Valid n from 0 to 117 (87-117 are on
the edge)
- leds start #RRGGBB #RRGGBB #RRGGBB ...: colors the range of leds from start
- mode n: switches to the specific rgbmatrix mode. Use the last one, 11, to test
the led operations listed above

View file

@ -1,88 +0,0 @@
/*
* Copyright 2021 foxx1337 at yahoo dot 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 FORCE_NKRO // NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_REACTIVE // Sets the default mode, if none has been set
#define RGB_MATRIX_DEFAULT_HUE 12
#define RGB_MATRIX_DEFAULT_SPD (UINT8_MAX / 2 + 32)
#define RGB_MATRIX_DEFAULT_VAL 96
// #define RGBLIGHT_HUE_STEP 12 // Units to step when in/decreasing hue
// #define RGBLIGHT_SAT_STEP 25 // Units to step when in/decreasing saturation
// #define RGBLIGHT_VAL_STEP 12 // Units to step when in/decreasing value (brightness)
// #define RGB_MATRIX_SLEEP // turn off effects when suspended
// #define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
// #define RGBLIGHT_EFFECT_BREATHE_CENTER // If defined, used to calculate the curve for the breathing animation. Valid values are 1.0 to 2.7
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // The maximum brightness for the breathing mode. Valid values are 1 to 255
// #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 // How long to wait between light changes for the "Christmas" animation, in milliseconds
// #define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 // The number of LEDs to group the red/green colors by for the "Christmas" animation
// #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM // The number of LEDs to have the "Knight" animation travel
// #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 // The number of LEDs to light up for the "Knight" animation
// #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 // The number of LEDs to start the "Knight" animation from the start of the strip by
// #define RGBLIGHT_RAINBOW_SWIRL_RANGE 255 // Range adjustment for the rainbow swirl effect to get different swirls
// #define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 // The number of LEDs to light up for the "Snake" animation
// This list in in the correct mode order. Next mode is the following line, previous mode is previous line. Loops around.
// #define DISABLE_RGB_MATRIX_SOLID_COLOR // Static single hue, no speed support
// #define DISABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue
#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN // Static gradient top to bottom, speed controls how much gradient changes
#define DISABLE_RGB_MATRIX_BREATHING // Single hue brightness cycling animation
#define DISABLE_RGB_MATRIX_BAND_SAT // Single hue band fading saturation scrolling left to right
#define DISABLE_RGB_MATRIX_BAND_VAL // Single hue band fading brightness scrolling left to right
#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT // Single hue 3 blade spinning pinwheel fades saturation
#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL // Single hue 3 blade spinning pinwheel fades brightness
#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT // Single hue spinning spiral fades saturation
#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL // Single hue spinning spiral fades brightness
#define DISABLE_RGB_MATRIX_CYCLE_ALL // Full keyboard solid hue cycling through full gradient
#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT // Full gradient scrolling left to right
#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN // Full gradient scrolling top to bottom
#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN // Full gradient scrolling out to in
#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL // Full dual gradients scrolling out to in
#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Full gradent Chevron shapped scrolling left to right
#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL // Full gradient spinning pinwheel around center of keyboard
#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL // Full gradient spinning spiral around center of keyboard
#define DISABLE_RGB_MATRIX_DUAL_BEACON // Full gradient spinning around center of keyboard
#define DISABLE_RGB_MATRIX_RAINBOW_BEACON // Full tighter gradient spinning around center of keyboard
#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS // Full dual gradients spinning two halfs of keyboard
// #define DISABLE_RGB_MATRIX_RAINDROPS // Randomly changes a single key's hue
// #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS // Randomly changes a single key's hue and saturation
// =================================================== Requires RGB_MATRIX_FRAMEBUFFER_EFFECTS =============================================================
#define DISABLE_RGB_MATRIX_TYPING_HEATMAP // How hot is your WPM!
#define DISABLE_RGB_MATRIX_DIGITAL_RAIN // That famous computer simulation
// =================================================== RGB_MATRIX_KEYPRESSES OR RGB_MATRIX_KEYRELEASES =====================================================
// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE // Static single hue, pulses keys hit to shifted hue then fades to current hue
//#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Pulses keys hit to hue & value then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out
//#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out
//#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out
//#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out
#define DISABLE_RGB_MATRIX_SPLASH // Full gradient & value pulse away from a single key hit then fades value out
#define DISABLE_RGB_MATRIX_MULTISPLASH // Full gradient & value pulse away from multiple key hits then fades value out
#define DISABLE_RGB_MATRIX_SOLID_SPLASH // Hue & value pulse away from a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH // Hue & value pulse away from multiple key hits then fades value out

View file

@ -1,25 +0,0 @@
/*
* Copyright 2021 foxx1337 at yahoo dot 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 "hid_protocol.h"
uint8_t raw_hid_buffer[RAW_EPSIZE];
void raw_hid_perform_send(void) {
raw_hid_send(raw_hid_buffer, RAW_EPSIZE);
}

View file

@ -1,80 +0,0 @@
/*
* Copyright 2021 foxx1337 at yahoo dot 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
#include <color.h>
#include <raw_hid.h>
#define CTRL_HID_GREETING_VERSION "CTRLHID 1.0.0"
enum ctrl_hid_codes {
// Signals end of message. Not really that useful.
CTRL_HID_EOM = 0x00,
CTRL_HID_OK,
CTRL_HID_NOK,
/**
* to hid: CTRL_HID_HELLO
* from hid: CTRL_HID_HELLO, "CTRLHID 1.0.0", CTRL_HID_EOM
**/
CTRL_HID_HELLO,
/**
* to hid: CTRL_HID_LIGHTS_TOGGLE
* from hid: CTRL_HID_LIGHTS_TOGGLE, CTRL_HID_OK, is_led_timeout, CTRL_HID_EOM
*
* Toggles all the leds on the keyboard. is_led_timeout will be 1 if the new
* state is off, 0 if leds are on.
**/
CTRL_HID_LIGHTS_TOGGLE,
/**
* to hid: CTRL_HID_LED, led_id, r, g, b
* from hid: CTRL_HID_LED, CTRL_HID_OK, CTRL_HID_EOM
* on error: CTRL_HID_LED, CTRL_HID_NOK, num_leds, CTRL_HID_EOM
*
* Sets the specific led to r, g, b. It's only visible when the hid_effect mode is active.
**/
CTRL_HID_LED,
/**
* to hid: CTRL_HID_LEDS, start, count, r0, g0, b0, ..., r[count-1], g[count-1], b[count-1]
* from hid: CTRL_HID_LEDS, CTRL_HID_OK, affected_leds, CTRL_HID_EOM
*
* Sets affected_leds leds following start to the corresponding r, g, b value.
* It's only visible when the hid_effect mode is active.
**/
CTRL_HID_LEDS,
/**
* to hid: CTRL_HID_RGBMATRIX_MODE, mode
* from hid: CTRL_HID_RGBMATRIX_MODE, CTRL_HID_OK, CTRL_HID_EOM
* on error: CTRL_HID_RGBMATRIX_MODE, CTRL_HID_NOK, mode_max, CTRL_HID_EOM
*
* Changes light mode. mode_max is hid_effect for CTRL_HID_LED and CTRL_HID_LEDS.
*/
CTRL_HID_RGBMATRIX_MODE
};
extern uint8_t raw_hid_buffer[RAW_EPSIZE];
// Defined in rgb_matrix_user.inc
// It's 119 for Massdrop CTRL, 0 - 118.
extern RGB rgb_matrix_led_state[RGB_MATRIX_LED_COUNT];
void raw_hid_perform_send(void);

View file

@ -1,268 +0,0 @@
/*
* Copyright 2021 foxx1337 at yahoo dot 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 "hid_protocol.h"
enum ctrl_keycodes {
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
U_T_AGCR, //USB Toggle Automatic GCR control
DBG_TOG, //DEBUG Toggle On / Off
DBG_MTRX, //DEBUG Toggle Matrix Prints
DBG_KBD, //DEBUG Toggle Keyboard Prints
DBG_MOU, //DEBUG Toggle Mouse Prints
MD_BOOT, //Restart into bootloader after hold timeout
};
#define TIMEOUT_ACTIVITY 300000 // 300 seconds before lights go off
uint32_t time_last_activity;
bool is_led_timeout;
led_flags_t led_state;
keymap_config_t keymap_config;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU,
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/*
[X] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
void change_led_state(bool is_off) {
is_led_timeout = is_off;
if (is_led_timeout) {
led_state = rgb_matrix_get_flags();
if (led_state != LED_FLAG_NONE) {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
}
} else {
if (led_state != LED_FLAG_NONE) {
rgb_matrix_set_flags(led_state);
rgb_matrix_enable_noeeprom();
}
}
}
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
time_last_activity = timer_read32();
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
if (!is_led_timeout && timer_elapsed32(time_last_activity) > TIMEOUT_ACTIVITY) {
change_led_state(true);
}
};
#define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT)
#define MODS_CTRL (get_mods() & MOD_MASK_CTRL)
#define MODS_ALT (get_mods() & MOD_MASK_ALT)
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
time_last_activity = timer_read32();
if (is_led_timeout) {
change_led_state(false);
}
switch (keycode) {
case U_T_AUTO:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case DBG_TOG:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
}
return false;
case DBG_MTRX:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
}
return false;
case DBG_KBD:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
}
return false;
case DBG_MOU:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_UNDERGLOW: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
}
break;
}
}
return false;
default:
return true; //Process all other keycodes normally
}
}
void raw_hid_say_hello(void) {
const char *ctrl = CTRL_HID_GREETING_VERSION;
uint8_t i = 0;
while (ctrl[i] != 0 && i + 2 < RAW_EPSIZE) {
raw_hid_buffer[1 + i] = ctrl[i];
i++;
}
raw_hid_buffer[i] = CTRL_HID_EOM;
}
void raw_hid_lights_toggle(void) {
change_led_state(!is_led_timeout);
raw_hid_buffer[1] = CTRL_HID_OK;
raw_hid_buffer[2] = (uint8_t) is_led_timeout;
raw_hid_buffer[3] = CTRL_HID_EOM;
}
void raw_hid_led(uint8_t *data) {
//rgb_matrix_set_color(data[1], data[2], data[3], data[4]);
const uint8_t led = data[1];
if (led >= RGB_MATRIX_LED_COUNT) {
raw_hid_buffer[1] = CTRL_HID_NOK;
raw_hid_buffer[2] = RGB_MATRIX_LED_COUNT;
raw_hid_buffer[3] = CTRL_HID_EOM;
return;
}
rgb_matrix_led_state[led].r = data[2];
rgb_matrix_led_state[led].g = data[3];
rgb_matrix_led_state[led].b = data[4];
raw_hid_buffer[1] = CTRL_HID_OK;
raw_hid_buffer[2] = CTRL_HID_EOM;
}
void raw_hid_leds(uint8_t *data) {
const uint8_t first_led = data[1];
const uint8_t number_leds = data[2];
uint8_t i = 0;
while (i < number_leds && first_led + i < RGB_MATRIX_LED_COUNT && i * 3 + 5 < RAW_EPSIZE) {
rgb_matrix_led_state[first_led + i].r = data[3 + i * 3 + 0];
rgb_matrix_led_state[first_led + i].g = data[3 + i * 3 + 1];
rgb_matrix_led_state[first_led + i].b = data[3 + i * 3 + 2];
i++;
}
raw_hid_buffer[1] = CTRL_HID_OK;
raw_hid_buffer[2] = i;
raw_hid_buffer[3] = CTRL_HID_EOM;
}
void raw_hid_rgbmatrix_mode(uint8_t *data) {
const uint8_t mode = data[1];
if (mode >= RGB_MATRIX_EFFECT_MAX) {
raw_hid_buffer[1] = CTRL_HID_NOK;
raw_hid_buffer[2] = RGB_MATRIX_EFFECT_MAX - 1;
raw_hid_buffer[3] = CTRL_HID_EOM;
return;
}
rgb_matrix_mode_noeeprom(mode);
raw_hid_buffer[1] = CTRL_HID_OK;
raw_hid_buffer[2] = CTRL_HID_EOM;
}
void raw_hid_receive(uint8_t *data, uint8_t length) {
switch (*data) {
case CTRL_HID_HELLO:
raw_hid_say_hello();
break;
case CTRL_HID_LIGHTS_TOGGLE:
raw_hid_lights_toggle();
break;
case CTRL_HID_LED:
raw_hid_led(data);
break;
case CTRL_HID_LEDS:
raw_hid_leds(data);
break;
case CTRL_HID_RGBMATRIX_MODE:
raw_hid_rgbmatrix_mode(data);
break;
}
raw_hid_perform_send();
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2021 foxx1337 at yahoo dot 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/>.
*/
// !!! DO NOT ADD #pragma once !!! //
// Step 1.
// Declare custom effects using the RGB_MATRIX_EFFECT macro
// (note the lack of semicolon after the macro!)
RGB_MATRIX_EFFECT(hid_effect)
// Step 2.
// Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
RGB rgb_matrix_led_state[RGB_MATRIX_LED_COUNT];
// e.g: A simple effect, self-contained within a single method
static bool hid_effect(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
for (uint8_t i = led_min; i < led_max; i++) {
rgb_matrix_set_color(i,
rgb_matrix_led_state[i].r,
rgb_matrix_led_state[i].g,
rgb_matrix_led_state[i].b);
}
return led_max < RGB_MATRIX_LED_COUNT;
}
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS

View file

@ -1,6 +0,0 @@
# Build Options
CONSOLE_ENABLE = no # Console for debug
RAW_ENABLE = yes # Raw device
RGB_MATRIX_CUSTOM_USER = yes # Custom rgb matrix effect
SRC += hid_protocol.c

View file

@ -1,126 +0,0 @@
#include QMK_KEYBOARD_H
enum ctrl_keycodes {
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
U_T_AGCR, //USB Toggle Automatic GCR control
DBG_TOG, //DEBUG Toggle On / Off
DBG_MTRX, //DEBUG Toggle Matrix Prints
DBG_KBD, //DEBUG Toggle Keyboard Prints
DBG_MOU, //DEBUG Toggle Mouse Prints
MD_BOOT, //Restart into bootloader after hold timeout
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_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_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU,
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/*
[X] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
};
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT))
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL))
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
switch (keycode) {
case U_T_AUTO:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case DBG_TOG:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
}
return false;
case DBG_MTRX:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
}
return false;
case DBG_KBD:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
}
return false;
case DBG_MOU:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_UNDERGLOW: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
}
break;
}
}
return false;
default:
return true; //Process all other keycodes normally
}
}

View file

@ -1,269 +0,0 @@
#include QMK_KEYBOARD_H
enum ctrl_keycodes {
L_BRI = SAFE_RANGE, //LED Brightness Increase //Working
L_BRD, //LED Brightness Decrease //Working
L_EDG_I, //LED Edge Brightness Increase
L_EDG_D, //LED Edge Brightness Decrease
L_EDG_M, //LED Edge lighting mode
L_PTN, //LED Pattern Select Next //Working
L_PTP, //LED Pattern Select Previous //Working
L_PSI, //LED Pattern Speed Increase //Working
L_PSD, //LED Pattern Speed Decrease //Working
L_RATIOD,
L_RATIOI,
L_T_MD, //LED Toggle Mode //Working
L_T_ONF, //LED Toggle On / Off //Broken
L_ON, //LED On //Broken
L_OFF, //LED Off //Broken
L_T_BR, //LED Toggle Breath Effect //Working
L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working
U_T_AGCR, //USB Toggle Automatic GCR control //Working
DBG_TOG, //DEBUG Toggle On / Off //
DBG_MTRX, //DEBUG Toggle Matrix Prints //
DBG_KBD, //DEBUG Toggle Keyboard Prints //
DBG_MOU, //DEBUG Toggle Mouse Prints //
DBG_FAC, //DEBUG Factory light testing (All on white)
MD_BOOT //Restart into bootloader after hold timeout //Working
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_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_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU,
L_T_BR, L_PSD, L_BRI, L_PSI, L_EDG_I, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
L_T_PTD, L_PTP, L_BRD, L_PTN, L_EDG_D, _______, _______, _______, _______, _______, _______, _______, _______,
_______, L_T_MD, L_T_ONF, _______, L_EDG_M, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, DBG_FAC, _______, _______, _______, _______, _______, _______, _______
),
/*
[X] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
};
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT))
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL))
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
static uint8_t scroll_effect = 0;
switch (keycode) {
case L_BRI:
if (record->event.pressed) {
if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX;
else gcr_desired += LED_GCR_STEP;
if (led_animation_breathing) gcr_breathe = gcr_desired;
}
return false;
case L_BRD:
if (record->event.pressed) {
if (LED_GCR_STEP > gcr_desired) gcr_desired = 0;
else gcr_desired -= LED_GCR_STEP;
if (led_animation_breathing) gcr_breathe = gcr_desired;
}
return false;
case L_EDG_M:
if (record->event.pressed) {
led_edge_mode++;
if (led_edge_mode > LED_EDGE_MODE_MAX) {
led_edge_mode = LED_EDGE_MODE_ALL;
}
}
return false;
case L_EDG_I:
if (record->event.pressed) {
led_edge_brightness += 0.1;
if (led_edge_brightness > 1) { led_edge_brightness = 1; }
}
return false;
case L_EDG_D:
if (record->event.pressed) {
led_edge_brightness -= 0.1;
if (led_edge_brightness < 0) { led_edge_brightness = 0; }
}
return false;
case L_RATIOI:
if (record->event.pressed) {
led_ratio_brightness += 0.2;
if (led_ratio_brightness > 2.0) { led_ratio_brightness = 2.0; }
}
return false;
case L_RATIOD:
if (record->event.pressed) {
led_ratio_brightness -= 0.2;
if (led_ratio_brightness < 0.0) { led_ratio_brightness = 0.0; }
}
return false;
case L_PTN:
if (record->event.pressed) {
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
else led_animation_id++;
}
return false;
case L_PTP:
if (record->event.pressed) {
if (led_animation_id == 0) led_animation_id = led_setups_count - 1;
else led_animation_id--;
}
return false;
case L_PSI:
if (record->event.pressed) {
led_animation_speed += ANIMATION_SPEED_STEP;
}
return false;
case L_PSD:
if (record->event.pressed) {
led_animation_speed -= ANIMATION_SPEED_STEP;
if (led_animation_speed < 0) led_animation_speed = 0;
}
return false;
case L_T_MD:
if (record->event.pressed) {
led_lighting_mode++;
if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL;
}
return false;
case L_T_ONF:
if (record->event.pressed) {
led_enabled = !led_enabled;
I2C3733_Control_Set(led_enabled);
}
return false;
case L_ON:
if (record->event.pressed) {
led_enabled = 1;
I2C3733_Control_Set(led_enabled);
}
return false;
case L_OFF:
if (record->event.pressed) {
led_enabled = 0;
I2C3733_Control_Set(led_enabled);
}
return false;
case L_T_BR:
if (record->event.pressed) {
led_animation_breathing = !led_animation_breathing;
if (led_animation_breathing) {
gcr_breathe = gcr_desired;
led_animation_breathe_cur = BREATHE_MIN_STEP;
breathe_dir = 1;
}
}
return false;
case L_T_PTD:
if (record->event.pressed) {
scroll_effect++;
if (scroll_effect == 1) { //Patterns with scroll move horizontal (Right to left)
led_animation_direction = 1;
led_animation_orientation = 0;
led_animation_circular = 0;
} else if (scroll_effect == 2) { //Patterns with scroll move vertical (Top to bottom)
led_animation_direction = 1;
led_animation_orientation = 1;
led_animation_circular = 0;
} else if (scroll_effect == 3) { //Patterns with scroll move vertical (Bottom to top)
led_animation_direction = 0;
led_animation_orientation = 1;
led_animation_circular = 0;
} else if (scroll_effect == 4) { //Patterns with scroll explode from center
led_animation_direction = 0;
led_animation_orientation = 0;
led_animation_circular = 1;
} else if (scroll_effect == 5) { //Patterns with scroll implode on center
led_animation_direction = 1;
led_animation_orientation = 0;
led_animation_circular = 1;
} else { //Patterns with scroll move horizontal (Left to right)
scroll_effect = 0;
led_animation_direction = 0;
led_animation_orientation = 0;
led_animation_circular = 0;
}
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case DBG_FAC:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
led_lighting_mode = LED_MODE_NORMAL;
led_edge_brightness = 1;
led_edge_mode = LED_EDGE_MODE_ALL;
led_animation_breathing = 0;
led_animation_id = 7; //led_programs.c led_setups leds_white index
gcr_desired = LED_GCR_MAX;
led_enabled = 1;
I2C3733_Control_Set(led_enabled);
}
return false;
case DBG_TOG:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
}
return false;
case DBG_MTRX:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
}
return false;
case DBG_KBD:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
}
return false;
case DBG_MOU:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
default:
return true; //Process all other keycodes normally
}
}
led_instruction_t led_instructions[] = {
//Please see ../default_md/keymap.c for examples
//All LEDs use the user's selected pattern (this is the factory default)
{ .flags = LED_FLAG_USE_ROTATE_PATTERN },
//end must be set to 1 to indicate end of instruction set
{ .end = 1 }
};

View file

@ -1,2 +0,0 @@
# This keymap requires Massdrop Configurator support
OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR

View file

@ -1,27 +0,0 @@
/*
Copyright 2015 Jun Wako <wakojun@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 FORCE_NKRO
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR
#define RGB_MATRIX_DEFAULT_VAL 100
#define HSV_BACKLIGHT_COLOR HSV_BLUE
#define HSV_GAME_COLOR 170, 255, 192 // darker blue
#define HSV_CONTROL_COLOR 0, 255, 192 // darker red

View file

@ -1,175 +0,0 @@
/* Copyright 2020 Robert Pufky <rpufky@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
#define BASE 0
#define GAME 1
#define CTRL 2
#define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT)
#define MODS_CTRL (get_mods() & MOD_MASK_CTRL)
#define MODS_ALT (get_mods() & MOD_MASK_ALT)
enum ctrl_keycodes {
U_T_AUTO = SAFE_RANGE, // USB Extra Port Toggle Auto Detect/Always Active
U_T_AGCR, // USB Toggle Automatic GCR control
L_BRI = SAFE_RANGE, // LED Brightness Increase
L_BRD, // LED Brightness Decrease
L_PTN, // LED Pattern Select Next
L_PTP, // LED Pattern Select Previous
L_PSI, // LED Pattern Speed Increase
L_PSD, // LED Pattern Speed Decrease
L_T_MD, // LED Toggle Mode
L_T_ONF, // LED Toggle On / Off //Broken
L_ON, // LED On //Broken
L_OFF, // LED Off //Broken
L_T_BR, // LED Toggle Breath Effect
L_T_PTD, // LED Toggle Scrolling Pattern Direction
DBG_TOG, // DEBUG Toggle On / Off
DBG_MTRX, // DEBUG Toggle Matrix Print
DBG_KBD, // DEBUG Toggle Keyboard Prints
DBG_MOU, // DEBUG Toggle Mouse Prints
MD_BOOT, // Restart into bootloader after hold timeout
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = 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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_ENT,
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_NUM, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(CTRL), KC_F24, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[GAME] = 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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_ENT,
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_HOME, KC_END, KC_LALT, KC_SPC, KC_RALT, MO(CTRL), KC_F24, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[CTRL] = LAYOUT(
KC_EJCT, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_MUTE, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU,
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, _______, _______, _______, TO(BASE), TO(GAME), _______, KC_MPRV, KC_MNXT, KC_VOLD,
KC_CAPS, RGB_RMOD, RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, KC_BRIU,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MRWD, KC_BRID, KC_MFFD
),
};
// Init keyboard static color with underglow off.
void matrix_init_user(void) {
rgblight_sethsv(HSV_BACKLIGHT_COLOR);
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
};
// Set backlight color based on active layer
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case GAME: {
rgblight_sethsv_noeeprom(HSV_GAME_COLOR);
break;
}
case CTRL: {
rgblight_sethsv_noeeprom(HSV_CONTROL_COLOR);
break;
}
default:
rgblight_sethsv_noeeprom(HSV_BACKLIGHT_COLOR);
break;
}
return state;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
switch (keycode) {
case U_T_AUTO:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case DBG_TOG:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
}
return false;
case DBG_MTRX:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
}
return false;
case DBG_KBD:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
}
return false;
case DBG_MOU:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
rgb_matrix_set_color_all(RGB_OFF);
}
break;
case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(RGB_OFF);
}
break;
case LED_FLAG_UNDERGLOW: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
}
break;
}
}
return false;
default:
return true; //Process all other keycodes normally
}
}

View file

@ -1,44 +0,0 @@
# Massdrop Ctrl r-pufky
Gaming QOL improvments; enabling useful keys for left hand & in-game overlay
usage.
## Layers
### Typing Layer
![Typing Layer](https://i.imgur.com/qEBaupV.png)
Layer optimized to enable useful keys for typing and casual gaming without
changing typing state, as well as specific in-game overlay keys.
* Left Ctrl: Easier control key usage without always setting capslock.
* Num Lock: Unique non visible character key for additional left-hand input
options in game.
* Fn: Enable Control layer, temporal.
* F24: Non-visible F24 key; no windows function. Map to in-game overlays.
### Gaming Layer
![Gaming Layer](https://i.imgur.com/q4wGbFQ.png)
Replaces super key with additional non-printing inputs.
* Home: Non visible character key for additional input options in game.
* End: Non visible character key for additional input options in game.
* Left Ctrl: Easier control key usage without always setting capslock.
* Fn: Enable Control layer, temporal.
* F24: Non-visible F24 key; no windows function. Map to in-game overlays.
### Control Layer
![Function Layer](https://i.imgur.com/7Nalcyp.png)
* Purple: Media keys. Note CD Eject on Escape, and OSX Prev/Next on Arrows.
* Blue: Keyboard adminstration. Toggle NKRO (N Key Rollover) and enable
bootloader.
* Orange: RGB Controls.
* Green: Toggle gaming layer.
* Capslock: Now requires the use of the function key.
* F13-F24: Extended function keys.
* Bright+/-: Monitor Brightness.

View file

@ -1,17 +0,0 @@
Fn + P + Esc, Fn + P + `: reset effect to default
Fn + P + Tab, Fn + P + Y: select previous color pattern
Fn + P + Caps, Fn + P + H: select next color pattern
Fn + P + A, Fn + P + J: (no effect for now)
Fn + P + D, Fn + P + L: (no effect for now)
Fn + P + Q, Fn + P + U: wave travel faster
Fn + P + E, Fn + P + O: wave travel slower
Fn + P + W, Fn + P + I: increase wave width
Fn + P + S, Fn + P + K: decrease wave width

View file

@ -1,764 +0,0 @@
#include QMK_KEYBOARD_H
#include <math.h> // sqrtf, powf
#ifdef CONSOLE_ENABLE
#include <print.h>
#endif
enum ctrl_keycodes {
L_BRI = SAFE_RANGE, //LED Brightness Increase //Working
L_BRD, //LED Brightness Decrease //Working
L_PTN, //LED Pattern Select Next //Working
L_PTP, //LED Pattern Select Previous //Working
L_PSI, //LED Pattern Speed Increase //Working
L_PSD, //LED Pattern Speed Decrease //Working
L_T_MD, //LED Toggle Mode //Working
L_T_ONF, //LED Toggle On / Off //Broken
L_ON, //LED On //Broken
L_OFF, //LED Off //Broken
L_T_BR, //LED Toggle Breath Effect //Working
L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working
U_T_AGCR, //USB Toggle Automatic GCR control //Working
DBG_TOG, //DEBUG Toggle On / Off //
DBG_MTRX, //DEBUG Toggle Matrix Prints //
DBG_KBD, //DEBUG Toggle Keyboard Prints //
DBG_MOU, //DEBUG Toggle Mouse Prints //
MD_BOOT, //Restart into bootloader after hold timeout //Working
L_SP_PR, //LED Splash Pattern Select Previous
L_SP_NE, //LED Splash Pattern Select Next
L_SP_WD, //LED Splash Widen Wavefront width
L_SP_NW, //LED Splash Narrow Wavefront width
L_SP_FA, //LED Splash wave travel speed faster (shorter period)
L_SP_SL, //LED Splash wave travel speed slower (longer period)
L_CP_PR, //LED Color Pattern Select Previous
L_CP_NX, //LEB Color Pattern Select Next
S_RESET // reset all parameters
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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_SCRL, KC_PAUS,
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_INS, KC_HOME, KC_PGUP,
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_END, KC_PGDN,
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_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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU,
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, MO(2), _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[2] = LAYOUT(
S_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
S_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
L_CP_NX, L_SP_SL, L_SP_WD, L_SP_FA, _______, _______, L_CP_NX, L_SP_SL, L_SP_WD, L_SP_FA, _______, _______, _______, _______, _______, _______, _______,
L_CP_PR, L_SP_PR, L_SP_NW, L_SP_NE, _______, _______, L_CP_PR, L_SP_PR, L_SP_NW, L_SP_NE, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
/*
[X] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
#define DISTANCE_NORAMLIZING_PARAMETER 3
struct {
uint8_t PATTERN_INDEX;
float WAVE_WIDTH;
float WAVE_SPEED;
int COLOR_PATTERN_INDEX;
float TRAVEL_DISTANCE;
} USER_CONFIG = {
.PATTERN_INDEX = 1,
.WAVE_WIDTH = 10, // width of the wave in keycaps
.WAVE_SPEED = 15, // travel how many keycaps per second
.COLOR_PATTERN_INDEX = 0,
.TRAVEL_DISTANCE = 25,
};
#define COLOR_PATTERN_RGB_COUNT 18
static uint8_t COLOR_PATTERNS[][COLOR_PATTERN_RGB_COUNT][3] = {
{ // default rainbow color
{255, 0, 0}, {255, 0, 0}, {255, 127, 0},
{255, 127, 0}, {255, 255, 0}, {255, 255, 0},
{120, 255, 0}, {120, 255, 0}, { 0, 255, 0},
{ 0, 255, 0}, { 0, 255, 120}, { 0, 255, 120},
{ 0, 0, 255}, { 0, 0, 255}, { 75, 0, 130},
{ 75, 0, 130}, { 43, 0, 130}, { 43, 0, 130},
}, { // light rainbow color
{248, 12, 18}, {238, 17, 0}, {255, 51, 17},
{255, 68, 32}, {255, 102, 68}, {255, 153, 51},
{254, 174, 45}, {204, 187, 51}, {208, 195, 16},
{170, 204, 34}, {105, 208, 37}, { 34, 204, 170},
{ 18, 189, 185}, { 17, 170, 187}, { 68, 68, 221},
{ 51, 17, 187}, { 59, 12, 189}, { 68, 34, 153},
}, { // white flat
{255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255},
}, { // white fade, cos curve
{255, 255, 255}, {255, 255, 255}, {252, 252, 252},
{247, 247, 247}, {240, 240, 240}, {232, 232, 232},
{221, 221, 221}, {209, 209, 209}, {196, 196, 196},
{181, 181, 181}, {164, 164, 164}, {147, 147, 147},
{128, 128, 128}, {108, 108, 108}, { 88, 88, 88},
{ 66, 66, 66}, { 45, 45, 45}, { 23, 23, 23},
},
};
static const uint8_t COLOR_PATTERNS_COUNT = ARRAY_SIZE(COLOR_PATTERNS);
/**
* trimed down version of `ISSI3733_LED_MAP`:
*
* `ISSI3733_LED_MAP` is defined in keyboards/massdrop/ctrl/config_led.h is not directly usable,
* the numbers inside this map could probably be related to the PCB layout instead of
* the actual physical layout,
*
* this `ISSI3733_LED_MAP` is used somewhere in protocol/ but is not globally accessible
* so one is created here
*
* x and y are coordinates of the physical layout
* KC_ESC is (0, 0), gap between function keys and number rows is 1.5
* +y is downwards
* 1 unit is width/height of 1 standard keycap
*/
#define MAX_LED_ID ISSI3733_LED_COUNT
typedef struct led_info_s {
uint16_t id;
uint16_t scan;
float x;
float y;
uint8_t distance_to[MAX_LED_ID + 1];
} led_info_t;
led_info_t led_info[MAX_LED_ID + 1] = {
{ .id = 0 },
{ .id = 1, .x = 0.0, .y = 0.0, .scan = 41 }, // ESC
{ .id = 2, .x = 2.0, .y = 0.0, .scan = 58 }, // F1
{ .id = 3, .x = 3.0, .y = 0.0, .scan = 59 }, // F2
{ .id = 4, .x = 3.5, .y = 0.0, .scan = 60 }, // F3
{ .id = 5, .x = 5.0, .y = 0.0, .scan = 61 }, // F4
{ .id = 6, .x = 6.5, .y = 0.0, .scan = 62 }, // F5
{ .id = 7, .x = 7.5, .y = 0.0, .scan = 63 }, // F6
{ .id = 8, .x = 8.5, .y = 0.0, .scan = 64 }, // F7
{ .id = 9, .x = 9.5, .y = 0.0, .scan = 65 }, // F8
{ .id = 10, .x = 11, .y = 0.0, .scan = 66 }, // F9
{ .id = 11, .x = 12, .y = 0.0, .scan = 67 }, // F10
{ .id = 12, .x = 13, .y = 0.0, .scan = 68 }, // F11
{ .id = 13, .x = 14, .y = 0.0, .scan = 69 }, // F12
{ .id = 14, .x = 15.5, .y = 0.0, .scan = 70 }, // Print
{ .id = 15, .x = 16.5, .y = 0.0, .scan = 71 }, // Scoll Lock
{ .id = 16, .x = 17.5, .y = 0.0, .scan = 72 }, // Pause
{ .id = 17, .x = 0.0, .y = 1.5, .scan = 53 }, // `
{ .id = 18, .x = 1.0, .y = 1.5, .scan = 30 }, // 1
{ .id = 19, .x = 2.0, .y = 1.5, .scan = 31 }, // 2
{ .id = 20, .x = 3.0, .y = 1.5, .scan = 32 }, // 3
{ .id = 21, .x = 3.5, .y = 1.5, .scan = 33 }, // 4
{ .id = 22, .x = 5.0, .y = 1.5, .scan = 34 }, // 5
{ .id = 23, .x = 6.0, .y = 1.5, .scan = 35 }, // 6
{ .id = 24, .x = 7.0, .y = 1.5, .scan = 36 }, // 7
{ .id = 25, .x = 8.0, .y = 1.5, .scan = 37 }, // 8
{ .id = 26, .x = 9.0, .y = 1.5, .scan = 38 }, // 9
{ .id = 27, .x = 10.0, .y = 1.5, .scan = 39 }, // 0
{ .id = 28, .x = 11.0, .y = 1.5, .scan = 45 }, // -
{ .id = 29, .x = 12.0, .y = 1.5, .scan = 46 }, // =
{ .id = 30, .x = 13.5, .y = 1.5, .scan = 42 }, // Backspace
{ .id = 31, .x = 15.5, .y = 1.5, .scan = 73 }, // Insert
{ .id = 32, .x = 16.6, .y = 1.5, .scan = 74 }, // Home
{ .id = 33, .x = 17.5, .y = 1.5, .scan = 75 }, // Page Up
{ .id = 34, .x = 0.2, .y = 2.5, .scan = 43 }, // Tab
{ .id = 35, .x = 1.5, .y = 2.5, .scan = 20 }, // Q
{ .id = 36, .x = 2.5, .y = 2.5, .scan = 26 }, // W
{ .id = 37, .x = 3.5, .y = 2.5, .scan = 8 }, // E
{ .id = 38, .x = 4.5, .y = 2.5, .scan = 21 }, // R
{ .id = 39, .x = 5.5, .y = 2.5, .scan = 23 }, // T
{ .id = 40, .x = 6.5, .y = 2.5, .scan = 28 }, // Y
{ .id = 41, .x = 7.5, .y = 2.5, .scan = 24 }, // U
{ .id = 42, .x = 8.5, .y = 2.5, .scan = 12 }, // I
{ .id = 43, .x = 9.5, .y = 2.5, .scan = 18 }, // O
{ .id = 44, .x = 10.5, .y = 2.5, .scan = 19 }, // P
{ .id = 45, .x = 11.5, .y = 2.5, .scan = 47 }, // [
{ .id = 46, .x = 12.5, .y = 2.5, .scan = 48 }, // ]
{ .id = 47, .x = 13.75, .y = 2.5, .scan = 49 }, /* \ */
{ .id = 48, .x = 15.5, .y = 2.5, .scan = 76 }, // Delete
{ .id = 49, .x = 16.5, .y = 2.5, .scan = 77 }, // End
{ .id = 50, .x = 17.5, .y = 2.5, .scan = 78 }, // Page Down
{ .id = 51, .x = 0.4, .y = 3.5, .scan = 57 }, // Caps Lock
{ .id = 52, .x = 2.5, .y = 3.5, .scan = 4 }, // A
{ .id = 53, .x = 3.5, .y = 3.5, .scan = 22 }, // S
{ .id = 54, .x = 4.5, .y = 3.5, .scan = 7 }, // D
{ .id = 55, .x = 5.5, .y = 3.5, .scan = 9 }, // F
{ .id = 56, .x = 6.5, .y = 3.5, .scan = 10 }, // G
{ .id = 57, .x = 7.5, .y = 3.5, .scan = 11 }, // H
{ .id = 58, .x = 8.5, .y = 3.5, .scan = 13 }, // J
{ .id = 59, .x = 9.5, .y = 3.5, .scan = 14 }, // K
{ .id = 60, .x = 10.5, .y = 3.5, .scan = 15 }, // L
{ .id = 61, .x = 11.5, .y = 3.5, .scan = 51 }, // ;
{ .id = 62, .x = 12.5, .y = 3.5, .scan = 52 }, // '
{ .id = 63, .x = 13.5, .y = 3.5, .scan = 40 }, // Enter
{ .id = 64, .x = 0.5, .y = 4.5, .scan = 225 }, // LSHIFT
{ .id = 65, .x = 2.25, .y = 4.5, .scan = 29 }, // Z
{ .id = 66, .x = 3.25, .y = 4.5, .scan = 27 }, // X
{ .id = 67, .x = 4.25, .y = 4.5, .scan = 6 }, // C
{ .id = 68, .x = 5.25, .y = 4.5, .scan = 25 }, // V
{ .id = 69, .x = 6.25, .y = 4.5, .scan = 5 }, // B
{ .id = 70, .x = 7.25, .y = 4.5, .scan = 17 }, // N
{ .id = 71, .x = 8.25, .y = 4.5, .scan = 16 }, // M
{ .id = 72, .x = 9.25, .y = 4.5, .scan = 54 }, // COMMA
{ .id = 73, .x = 10.25, .y = 4.5, .scan = 55 }, // DOT
{ .id = 74, .x = 11.25, .y = 4.5, .scan = 56 }, // SLASH
{ .id = 75, .x = 13.2, .y = 4.5, .scan = 229 }, // RSHIFT
{ .id = 76, .x = 16.5, .y = 4.5, .scan = 82 }, // UP
{ .id = 77, .x = 0.1, .y = 5.5, .scan = 224 }, // LCTRL
{ .id = 78, .x = 1.25, .y = 5.5, .scan = 227 }, // WIN
{ .id = 79, .x = 2.5, .y = 5.5, .scan = 226 }, // LALT
{ .id = 80, .x = 6.25, .y = 5.5, .scan = 44 }, // SPACE
#define MAX_CACHED_SCAN_CODE 231
{ .id = 81, .x = 10.25, .y = 5.5, .scan = 230 }, // RALT
#define FN_KEY_LED_ID 82
#define FN_KEY_SCAN_CODE 20737
{ .id = 82, .x = 11.5, .y = 5.5, .scan = 20737 }, // FN
{ .id = 83, .x = 12.7, .y = 5.5, .scan = 101 }, // APP
{ .id = 84, .x = 13.75, .y = 5.5, .scan = 228 }, // RCTRL
{ .id = 85, .x = 15.5, .y = 5.5, .scan = 80 }, // LEFT
{ .id = 86, .x = 16.5, .y = 5.5, .scan = 81 }, // DOWN
{ .id = 87, .x = 17.5, .y = 5.5, .scan = 79 }, // RIGHT
#define MAX_LED_ID_WITH_SCANCODE 87
{ .id = 88, .x = 18.5, .y = 6.5, .scan = 255 },
{ .id = 89, .x = 16.917, .y = 6.5, .scan = 255 },
{ .id = 90, .x = 15.333, .y = 6.5, .scan = 255 },
{ .id = 91, .x = 13.75, .y = 6.5, .scan = 255 },
{ .id = 92, .x = 12.167, .y = 6.5, .scan = 255 },
{ .id = 93, .x = 10.583, .y = 6.5, .scan = 255 },
{ .id = 94, .x = 9, .y = 6.5, .scan = 255 },
{ .id = 95, .x = 7.417, .y = 6.5, .scan = 255 },
{ .id = 96, .x = 5.833, .y = 6.5, .scan = 255 },
{ .id = 97, .x = 4.25, .y = 6.5, .scan = 255 },
{ .id = 98, .x = 2.667, .y = 6.5, .scan = 255 },
{ .id = 99, .x = 1.083, .y = 6.5, .scan = 255 },
{ .id = 100, .x = -0.5, .y = 6.5, .scan = 255 },
{ .id = 101, .x = -0.5, .y = 4.75, .scan = 255 },
{ .id = 102, .x = -0.5, .y = 3, .scan = 255 },
{ .id = 103, .x = -0.5, .y = 1.25, .scan = 255 },
{ .id = 104, .x = -0.5, .y = -0.5, .scan = 255 },
{ .id = 105, .x = 1.083, .y = -0.5, .scan = 255 },
{ .id = 106, .x = 2.667, .y = -0.5, .scan = 255 },
{ .id = 107, .x = 4.25, .y = -0.5, .scan = 255 },
{ .id = 108, .x = 5.833, .y = -0.5, .scan = 255 },
{ .id = 109, .x = 7.417, .y = -0.5, .scan = 255 },
{ .id = 110, .x = 9, .y = -0.5, .scan = 255 },
{ .id = 111, .x = 10.583, .y = -0.5, .scan = 255 },
{ .id = 112, .x = 12.167, .y = -0.5, .scan = 255 },
{ .id = 113, .x = 13.75, .y = -0.5, .scan = 255 },
{ .id = 114, .x = 15.333, .y = -0.5, .scan = 255 },
{ .id = 115, .x = 16.917, .y = -0.5, .scan = 255 },
{ .id = 116, .x = 18.5, .y = 1.25, .scan = 255 },
{ .id = 117, .x = 18.5, .y = 3, .scan = 255 },
{ .id = 118, .x = 18.5, .y = 4.75, .scan = 255 },
{ .id = 119, .x = 18.5, .y = 6.5, .scan = 255 },
};
/**
* there are a few variables are used here
* keycode, scancode, led id
*
* scancode relates to actual physical key press
*
* keycode is software key press, or scancode with modifiers (shift, ctrl, alt, etc.),
* keycode with the value less than 255 are usually the same with scan code (I hope so)
*
* the led pattern are running based on led id, because led on the keyboard
* are not limited to keys only
*/
led_info_t* get_led_info_by_scancode(uint16_t scancode){
static bool init = false;
static led_info_t* scancode_to_led_info[MAX_CACHED_SCAN_CODE + 1];
if(!init){
for(int i = 1; i <= MAX_LED_ID_WITH_SCANCODE; ++i){
uint16_t scan = led_info[i].scan;
if(scan <= MAX_CACHED_SCAN_CODE){
scancode_to_led_info[scan] = (led_info + i);
}
}
init = true;
}
if(scancode <= MAX_CACHED_SCAN_CODE){
return scancode_to_led_info[scancode];
} else if(scancode == FN_KEY_SCAN_CODE){ // FN
return (led_info + FN_KEY_LED_ID);
}
return led_info;
}
void init_led_info(void){
for(int i = 1; i <= MAX_LED_ID; ++i){
led_info_t *entry1 = led_info + i;
for(int j = i; j <= MAX_LED_ID; ++j){
led_info_t *entry2 = led_info + j;
/**
* distance is tripled because
* convertion from float to int reduces accuracy
*
*/
uint8_t distance = (uint8_t)sqrtf(
powf(entry1->x - entry2->x, 2.0) +
powf(entry1->y - entry2->y, 2.0)) *
DISTANCE_NORAMLIZING_PARAMETER;
entry1->distance_to[j] = distance;
entry2->distance_to[i] = distance;
}
}
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
init_led_info();
};
typedef struct keystroke_s {
uint16_t scancode;
uint32_t timer;
bool active;
} keystroke_t;
#define MAX_ACTIVE_KEYSTORKES 10
keystroke_t ACTIVE_KEYSTROKES[MAX_ACTIVE_KEYSTORKES];
void reset_led_for_instruction(int led_instruction_index){
led_instructions[led_instruction_index].id0 = 0;
led_instructions[led_instruction_index].id1 = 0;
led_instructions[led_instruction_index].id2 = 0;
led_instructions[led_instruction_index].id3 = 0;
};
void add_led_to_instruction(int led_instruction_index, int led_id){
if(32 >= led_id && led_id >= 1){
led_instructions[led_instruction_index].id0 += ( 1 << (led_id - 1) );
} else if(64 >= led_id){
led_instructions[led_instruction_index].id1 += ( 1 << (led_id - 33) );
} else if(96 >= led_id){
led_instructions[led_instruction_index].id2 += ( 1 << (led_id - 65) );
} else if(128 >= led_id){
led_instructions[led_instruction_index].id3 += ( 1 << (led_id - 97) );
}
};
void wave_effect(void);
void set_wave_color(int);
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
wave_effect();
set_wave_color(USER_CONFIG.PATTERN_INDEX);
};
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT))
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL))
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
void register_keystroke(uint16_t keycode){
if(get_led_info_by_scancode(keycode)->id){
uint32_t oldest_keystroke_lifespan = 0;
int8_t oldest_keystroke_index = -1;
bool registered = false;
keystroke_t *keystroke = ACTIVE_KEYSTROKES;
for(int i = 0; i < MAX_ACTIVE_KEYSTORKES; ++i){
if(!keystroke->active){
keystroke->scancode = keycode;
keystroke->timer = timer_read32();
keystroke->active = true;
registered = true;
break;
}
uint32_t lifespan = timer_elapsed32(keystroke->timer);
if(lifespan > oldest_keystroke_lifespan){
oldest_keystroke_index = i;
oldest_keystroke_lifespan = lifespan;
}
++keystroke;
}
// override the oldest keystroke
if(!registered){
keystroke = ACTIVE_KEYSTROKES + oldest_keystroke_index;
keystroke->scancode = keycode;
keystroke->timer = timer_read32();
keystroke->active = true; // presumably active already
}
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
switch (keycode) {
case L_BRI:
if (record->event.pressed) {
if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX;
else gcr_desired += LED_GCR_STEP;
if (led_animation_breathing) gcr_breathe = gcr_desired;
}
return false;
case L_BRD:
if (record->event.pressed) {
if (LED_GCR_STEP > gcr_desired) gcr_desired = 0;
else gcr_desired -= LED_GCR_STEP;
if (led_animation_breathing) gcr_breathe = gcr_desired;
}
return false;
case L_PTN:
if (record->event.pressed) {
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
else led_animation_id++;
}
return false;
case L_PTP:
if (record->event.pressed) {
if (led_animation_id == 0) led_animation_id = led_setups_count - 1;
else led_animation_id--;
}
return false;
case L_PSI:
if (record->event.pressed) {
led_animation_speed += ANIMATION_SPEED_STEP;
}
return false;
case L_PSD:
if (record->event.pressed) {
led_animation_speed -= ANIMATION_SPEED_STEP;
if (led_animation_speed < 0) led_animation_speed = 0;
}
return false;
case L_T_MD:
if (record->event.pressed) {
led_lighting_mode++;
if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL;
}
return false;
case L_T_ONF:
if (record->event.pressed) {
led_enabled = !led_enabled;
I2C3733_Control_Set(led_enabled);
}
return false;
case L_ON:
if (record->event.pressed) {
led_enabled = 1;
I2C3733_Control_Set(led_enabled);
}
return false;
case L_OFF:
if (record->event.pressed) {
led_enabled = 0;
I2C3733_Control_Set(led_enabled);
}
return false;
case L_T_BR:
if (record->event.pressed) {
led_animation_breathing = !led_animation_breathing;
if (led_animation_breathing) {
gcr_breathe = gcr_desired;
led_animation_breathe_cur = BREATHE_MIN_STEP;
breathe_dir = 1;
}
}
return false;
case L_T_PTD:
if (record->event.pressed) {
led_animation_direction = !led_animation_direction;
}
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
}
return false;
case DBG_TOG:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
}
return false;
case DBG_MTRX:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
}
return false;
case DBG_KBD:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
}
return false;
case DBG_MOU:
if (record->event.pressed) {
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
}
return false;
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
case S_RESET:
// reset all parameters
USER_CONFIG.PATTERN_INDEX = 1;
USER_CONFIG.WAVE_WIDTH = 10;
USER_CONFIG.WAVE_SPEED = 15;
USER_CONFIG.COLOR_PATTERN_INDEX = 0;
USER_CONFIG.TRAVEL_DISTANCE = 25;
return false;
case L_SP_PR: // previous dripple pattern
case L_SP_NE: // next dripple pattern
if (record->event.pressed) {
#define PATTERN_COUNT 7
uint8_t incre = keycode == L_SP_PR ? PATTERN_COUNT-1 : 1;
USER_CONFIG.PATTERN_INDEX += incre;
USER_CONFIG.PATTERN_INDEX %= PATTERN_COUNT;
if(USER_CONFIG.PATTERN_INDEX <= 4){
USER_CONFIG.TRAVEL_DISTANCE = 25;
USER_CONFIG.COLOR_PATTERN_INDEX = 0;
USER_CONFIG.WAVE_SPEED = 10;
}
switch(USER_CONFIG.PATTERN_INDEX){
case 0: // None
break;
case 1: // background off, wave on
USER_CONFIG.WAVE_WIDTH = 2;
break;
case 2: // background on, wave off
USER_CONFIG.WAVE_WIDTH = 5;
break;
case 3: // background off, rainbow wave
USER_CONFIG.WAVE_WIDTH = 10;
break;
case 4: // background on, rainbow wave
USER_CONFIG.WAVE_WIDTH = 10;
break;
case 5:
USER_CONFIG.WAVE_WIDTH = 10;
USER_CONFIG.COLOR_PATTERN_INDEX = 2;
USER_CONFIG.TRAVEL_DISTANCE = 0;
USER_CONFIG.WAVE_SPEED = 10;
break;
case 6:
USER_CONFIG.WAVE_WIDTH = 10;
USER_CONFIG.COLOR_PATTERN_INDEX = 3;
USER_CONFIG.TRAVEL_DISTANCE = 2;
USER_CONFIG.WAVE_SPEED = 10;
break;
}
// remove effect after changing pattern
for(int i = 0; i < MAX_ACTIVE_KEYSTORKES; ++i){
ACTIVE_KEYSTROKES[i].active = 0;
}
}
return false;
case L_SP_WD:
case L_SP_NW:
if(record->event.pressed){
short incre = keycode == L_SP_WD ? 1 : -1;
USER_CONFIG.WAVE_WIDTH += incre;
if(USER_CONFIG.WAVE_WIDTH < 1){
USER_CONFIG.WAVE_WIDTH = 1;
}
}
return false;
case L_SP_FA:
case L_SP_SL:
if(record->event.pressed){
short incre = keycode == L_SP_FA ? -1 : 1;
USER_CONFIG.WAVE_SPEED += incre;
if(USER_CONFIG.WAVE_SPEED > 50){
USER_CONFIG.WAVE_SPEED = 50;
} else if(USER_CONFIG.WAVE_SPEED < 1){
USER_CONFIG.WAVE_SPEED = 1;
}
}
return false;
// these are the keys not in range 0x04 - 0x52
case L_CP_PR:
case L_CP_NX:
if(record->event.pressed){
uint8_t incre = keycode == L_CP_PR ? COLOR_PATTERNS_COUNT - 1 : 1;
USER_CONFIG.COLOR_PATTERN_INDEX += incre;
USER_CONFIG.COLOR_PATTERN_INDEX %= COLOR_PATTERNS_COUNT;
set_wave_color(USER_CONFIG.COLOR_PATTERN_INDEX);
}
return false;
default:
if(record->event.pressed){
register_keystroke(keycode);
#ifdef CONSOLE_ENABLE
led_info_t *entry = get_led_info_by_scancode(keycode);
uprintf(("KL: kc: %u, led id: %u, x: %f, y: %f, "
"col: %u, row: %u, pressed: %u, time: %u\n"),
keycode, entry->id, entry->x, entry->y,
record->event.key.col, record->event.key.row,
record->event.pressed, record->event.time);
#endif
}
return true; //Process all other keycodes normally
}
}
led_instruction_t led_instructions[] = {
//LEDs are normally inactive, no processing is performed on them
//Flags are used in matching criteria for an LED to be active and indicate how to color it
//Flags can be found in tmk_core/protocol/arm_atsam/md_rgb_matrix.h (prefixed with LED_FLAG_)
//LED IDs can be found in config_led.h in the keyboard's directory
//Examples are below
//All LEDs use the user's selected pattern (this is the factory default)
{ .flags = LED_FLAG_USE_ROTATE_PATTERN },
//Specific LEDs use the user's selected pattern while all others are off
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN, .id0 = 0xFFFFFFFF, .id1 = 0xAAAAAAAA, .id2 = 0x55555555, .id3 = 0x11111111 },
//Specific LEDs use specified RGB values while all others are off
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFF, .id1 = 0x00FF, .id2 = 0x0000FF00, .id3 = 0xFF000000, .r = 75, .g = 150, .b = 225 },
//All LEDs use the user's selected pattern
//On layer 1, all key LEDs (except the top row which keeps active pattern) are red while all edge LEDs are green
//When layer 1 is active, key LEDs use red (id0 32 - 17: 1111 1111 1111 1111 0000 0000 0000 0000 = 0xFFFF0000) (except top row 16 - 1)
//When layer 1 is active, key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF)
//When layer 1 is active, key LEDs use red (id2 87 - 65: 0000 0000 0111 1111 1111 1111 1111 1111 = 0x007FFFFF)
//When layer 1 is active, edge LEDs use green (id2 95 - 88: 1111 1111 1000 0000 0000 0000 0000 0000 = 0xFF800000)
//When layer 1 is active, edge LEDs use green (id3 119 - 96: 0000 0000 1111 1111 1111 1111 1111 1111 = 0x00FFFFFF)
// { .flags = LED_FLAG_USE_ROTATE_PATTERN },
#define WAVE_LED_INSTRUCTION_START 1
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0, .id1 = 0, .id2 = 0, .g = 255 },
#define WAVE_LED_INSTRUCTION_END 18
//All key LEDs use red while edge LEDs use the active pattern
//All key LEDs use red (id0 32 - 1: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF)
//All key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF)
//All key LEDs use red (id2 87 - 65: 0000 0000 0111 1111 1111 1111 1111 1111 = 0x007FFFFF)
//Edge uses active pattern (id2 95 - 88: 1111 1111 1000 0000 0000 0000 0000 0000 = 0xFF800000)
//Edge uses active pattern (id3 119 - 96: 0000 0000 1111 1111 1111 1111 1111 1111 = 0x00FFFFFF)
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFFFFFFFF, .id1 = 0xFFFFFFFF, .id2 = 0x007FFFFF, .r = 255 },
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN , .id2 = 0xFF800000, .id3 = 0x00FFFFFF },
{ .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB | LED_FLAG_MATCH_LAYER,
.id1 = 0b00001111001111000000011110011110,
.r = 0, .g = 255, .b = 60, .layer = 2 },
//end must be set to 1 to indicate end of instruction set
{ .end = 1 }
};
void set_wave_color(int color_pattern_index){
for(int i = WAVE_LED_INSTRUCTION_START; i < WAVE_LED_INSTRUCTION_END; ++i){
for(int j = 0; j < COLOR_PATTERN_RGB_COUNT; ++j){
led_instructions[i].r = COLOR_PATTERNS[color_pattern_index][i][0];
led_instructions[i].g = COLOR_PATTERNS[color_pattern_index][i][1];
led_instructions[i].b = COLOR_PATTERNS[color_pattern_index][i][2];
}
}
};
void wave_effect(void){
for(int i = WAVE_LED_INSTRUCTION_START; i < WAVE_LED_INSTRUCTION_END; ++i){
reset_led_for_instruction(i);
}
int wave_led_instruction_span = WAVE_LED_INSTRUCTION_END - WAVE_LED_INSTRUCTION_START;
keystroke_t *keystroke = ACTIVE_KEYSTROKES;
for(int i = 0; i < MAX_ACTIVE_KEYSTORKES; ++i, ++keystroke){
if(!keystroke->active) continue;
bool active = false;
uint16_t keystroke_led_id = get_led_info_by_scancode(keystroke->scancode)->id;
float elapsed_s = timer_elapsed32(keystroke->timer) / 1000.0f;
float travel = elapsed_s * USER_CONFIG.WAVE_SPEED;
for(uint16_t id = 1; id <= MAX_LED_ID; ++id){
float normalized_distance =
led_info[id].distance_to[keystroke_led_id] /
(float)DISTANCE_NORAMLIZING_PARAMETER;
if(travel >= normalized_distance && travel - normalized_distance >= 0 &&
normalized_distance >= travel - USER_CONFIG.WAVE_WIDTH){
int portion = (travel - normalized_distance) *
wave_led_instruction_span / USER_CONFIG.WAVE_WIDTH;
add_led_to_instruction(portion, id);
active = true;
}
}
keystroke->active = active;
}
};

View file

@ -1,2 +0,0 @@
# This keymap requires Massdrop Configurator support
OPT_DEFS += -DUSE_MASSDROP_CONFIGURATOR

View file

@ -1,117 +0,0 @@
/* Copyright 2022 Daniel Weeks (@xanimos)
*
* 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 MODS_SHIFT (get_mods() & MOD_MASK_SHIFT)
#define MODS_CTRL (get_mods() & MOD_MASK_CTRL)
#define MODS_ALT (get_mods() & MOD_MASK_ALT)
// #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT) // Key combination that allows the use of magic commands (useful for debugging)
// #define NO_DEBUG // Disable debugging
// #define NO_PRINT // Disable printing/debugging using hid_listen
// #define NO_ACTION_LAYER // Disable layers
// #define NO_ACTION_TAPPING // Disable tap dance and other tapping features
// #define NO_ACTION_ONESHOT // Disable one-shot modifiers
// #define NO_ACTION_MACRO // Disable old style macro handling: MACRO() & action_get_macro
#define TERMINAL_HELP
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 10
#define MOUSEKEY_WHEEL_DELAY 0
#define FORCE_NKRO // NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
// #define STRICT_LAYER_RELEASE // Force a key release to be evaluated using the current layer stack instead of remembering which layer it came from (used for advanced cases)
// #define LOCKING_SUPPORT_ENABLE // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
// #define LOCKING_RESYNC_ENABLE // Tries to keep switch state consistent with keyboard LED state
#define TAPPING_TERM 200 // How long before a tap becomes a hold, if set above 500, a key tapped during the tapping term will turn it into a hold too
// #define TAPPING_TERM_PER_KEY // Enables handling for per key TAPPING_TERM settings
// #define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release
#define TAPPING_TOGGLE 2 // How many taps before triggering the toggle
// #define PERMISSIVE_HOLD // Makes tap and hold keys trigger the hold if another key is pressed before releasing, even if it hasn't hit the TAPPING_TERM. See Permissive Hold for details
// #define QUICK_TAP_TERM 0 // Makes it possible to use a dual role key as modifier shortly after having been tapped. See Hold after tap. Breaks any Tap Toggle functionality (TT or the One Shot Tap Toggle)
// #define LEADER_TIMEOUT 300 // How long before the leader key times out. If you're having issues finishing the sequence before it times out, you may need to increase the timeout setting. Or you may want to enable the LEADER_PER_KEY_TIMING option, which resets the timeout after each key is tapped.
// #define LEADER_PER_KEY_TIMING // Sets the timer for leader key chords to run on each key press rather than overall
// #define LEADER_KEY_STRICT_KEY_PROCESSING // Disables keycode filtering for Mod-Tap and Layer-Tap keycodes. Eg, if you enable this, you would need to specify MT(MOD_CTL, KC_A) if you want to use KC_A.
// #define ONESHOT_TIMEOUT 300 // How long before oneshot times out
// #define ONESHOT_TAP_TOGGLE 2 // How many taps before oneshot toggle is triggered
// #define COMBO_TERM 200 // How long for the Combo keys to be detected. Defaults to TAPPING_TERM if not defined.
// #define TAP_CODE_DELAY 100 // Sets the delay between register_code and unregister_code, if you're having issues with it registering properly (common on VUSB boards). The value is in milliseconds.
// #define TAP_HOLD_CAPS_DELAY 80 // Sets the delay for Tap Hold keys (LT, MT) when using KC_CAPS_LOCK keycode, as this has some special handling on MacOS. The value is in milliseconds, and defaults to 80 ms if not defined. For macOS, you may want to set this to 200 or higher.
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_ALPHAS_MODS // Sets the default mode, if none has been set
// #define RGBLIGHT_HUE_STEP 12 // Units to step when in/decreasing hue
// #define RGBLIGHT_SAT_STEP 25 // Units to step when in/decreasing saturation
// #define RGBLIGHT_VAL_STEP 12 // Units to step when in/decreasing value (brightness)
// #define RGB_MATRIX_SLEEP // turn off effects when suspended
// #define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
// #define RGBLIGHT_EFFECT_BREATHE_CENTER // If defined, used to calculate the curve for the breathing animation. Valid values are 1.0 to 2.7
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // The maximum brightness for the breathing mode. Valid values are 1 to 255
// #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 // How long to wait between light changes for the "Christmas" animation, in milliseconds
// #define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 // The number of LEDs to group the red/green colors by for the "Christmas" animation
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM // The number of LEDs to have the "Knight" animation travel
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 // The number of LEDs to light up for the "Knight" animation
#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 // The number of LEDs to start the "Knight" animation from the start of the strip by
// #define RGBLIGHT_RAINBOW_SWIRL_RANGE 255 // Range adjustment for the rainbow swirl effect to get different swirls
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 // The number of LEDs to light up for the "Snake" animation
// This list in in the correct mode order. Next mode is the following line, previous mode is previous line. Loops around.
// #undef ENABLE_RGB_MATRIX_SOLID_COLOR // Static single hue, no speed support
// #undef ENABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue
// #undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN // Static gradient top to bottom, speed controls how much gradient changes
#undef ENABLE_RGB_MATRIX_BREATHING // Single hue brightness cycling animation
#undef ENABLE_RGB_MATRIX_BAND_SAT // Single hue band fading saturation scrolling left to right
#undef ENABLE_RGB_MATRIX_BAND_VAL // Single hue band fading brightness scrolling left to right
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT // Single hue 3 blade spinning pinwheel fades saturation
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL // Single hue 3 blade spinning pinwheel fades brightness
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT // Single hue spinning spiral fades saturation
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL // Single hue spinning spiral fades brightness
// #undef ENABLE_RGB_MATRIX_CYCLE_ALL // Full keyboard solid hue cycling through full gradient
#undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT // Full gradient scrolling left to right
#undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN // Full gradient scrolling top to bottom
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN // Full gradient scrolling out to in
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL // Full dual gradients scrolling out to in
// #undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Full gradent Chevron shapped scrolling left to right
#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL // Full gradient spinning pinwheel around center of keyboard
#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL // Full gradient spinning spiral around center of keyboard
#undef ENABLE_RGB_MATRIX_DUAL_BEACON // Full gradient spinning around center of keyboard
#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON // Full tighter gradient spinning around center of keyboard
#undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS // Full dual gradients spinning two halfs of keyboard
// #undef ENABLE_RGB_MATRIX_RAINDROPS // Randomly changes a single key's hue
// #undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS // Randomly changes a single key's hue and saturation
// =================================================== Requires RGB_MATRIX_FRAMEBUFFER_EFFECTS =============================================================
// #undef ENABLE_RGB_MATRIX_TYPING_HEATMAP // How hot is your WPM!
// #undef ENABLE_RGB_MATRIX_DIGITAL_RAIN // That famous computer simulation
// =================================================== RGB_MATRIX_KEYPRESSES OR RGB_MATRIX_KEYRELEASES =====================================================
// #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE // Static single hue, pulses keys hit to shifted hue then fades to current hue
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Pulses keys hit to hue & value then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out
// #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out
// #undef ENABLE_RGB_MATRIX_SPLASH // Full gradient & value pulse away from a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_MULTISPLASH // Full gradient & value pulse away from multiple key hits then fades value out
// #undef ENABLE_RGB_MATRIX_SOLID_SPLASH // Hue & value pulse away from a single key hit then fades value out
#undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH // Hue & value pulse away from multiple key hits then fades value out

View file

@ -1,98 +0,0 @@
/* Copyright 2022 Daniel Weeks (@xanimos)
*
* 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/>.
*/
#ifdef RGB_MATRIX_ENABLE
#include "ctrl.h"
#include "md_rgb_matrix.h"
#include "rgb_matrix.h"
#include "config_led.h"
led_config_t g_led_config = { {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 33, 34, 35, 36, 37, 38, 39, 40 },
{ 50, 51, 52, 53, 54, 55, 56, 57 },
{ 63, 64, 65, 66, 67, 68, 69, 70 },
{ 76, 77, 78, 79, 80, 81, 82, 83 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 41, 42, 43, 44, 45, 46, 47, 48 },
{ 58, 59, 60, 61, 62, 75, 49, 32 },
{ 71, 72, 73, 74, 84, 85, 86, NO_LED }
}, {
// 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_SCRL, KC_PAUS
{ 7, 5 }, { 31, 5 }, { 43, 5 }, { 55, 5 }, { 67, 5 }, { 85, 5 }, { 97, 5 }, { 109, 5 },
{ 121, 5 }, { 139, 5 }, { 151, 5 }, { 163, 5 }, { 175, 5 }, { 193, 5 }, { 205, 5 }, { 217, 5 },
// 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_INS, KC_HOME, KC_PGUP
{ 7, 20 }, { 19, 20 }, { 31, 20 }, { 43, 20 }, { 55, 20 }, { 67, 20 }, { 79, 20 }, { 91, 20 },
{ 103, 20 }, { 115, 20 }, { 127, 20 }, { 139, 20 }, { 151, 20 }, { 169, 20 }, { 193, 20 }, { 205, 20 },
{ 217, 20 },
// 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_END, KC_PGDN
{ 10, 30 }, { 25, 30 }, { 37, 30 }, { 49, 30 }, { 61, 30 }, { 73, 30 }, { 85, 30 }, { 97, 30 },
{ 109, 30 }, { 121, 30 }, { 133, 30 }, { 145, 30 }, { 157, 30 }, { 172, 30 }, { 193, 30 }, { 205, 30 },
{ 217, 30 },
// 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
{ 11, 39 }, { 28, 39 }, { 40, 39 }, { 52, 39 }, { 64, 39 }, { 76, 39 }, { 88, 39 }, { 100, 39 },
{ 112, 39 }, { 124, 39 }, { 136, 39 }, { 148, 39 }, { 168, 39 },
// 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
{ 14, 49 }, { 34, 49 }, { 46, 49 }, { 58, 49 }, { 70, 49 }, { 82, 49 }, { 94, 49 }, { 106, 49 },
{ 118, 49 }, { 130, 49 }, { 142, 49 }, { 165, 49 }, { 205, 49 },
// KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
{ 8, 59 }, { 23, 59 }, { 38, 59 }, { 83, 59 }, { 129, 59 }, { 144, 59 }, { 159, 59 }, { 174, 59 },
{ 193, 59 }, { 205, 59 }, { 217, 59 },
// Underglow / Border
{ 224, 64 }, { 204, 64 }, { 186, 64 }, { 167, 64 }, { 149, 64 }, { 130, 64 }, { 112, 64 }, { 94, 64 },
{ 75, 64 }, { 57, 64 }, { 38, 64 }, { 20, 64 }, { 0, 64 }, { 0, 47 }, { 0, 32 }, { 0, 17 },
{ 0, 0 }, { 20, 0 }, { 38, 0 }, { 57, 0 }, { 75, 0 }, { 94, 0 }, { 112, 0 }, { 130, 0 },
{ 149, 0 }, { 167, 0 }, { 186, 0 }, { 204, 0 }, { 224, 0 }, { 224, 17 }, { 224, 32 }, { 224, 47 }
}, {
// 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_SCRL, KC_PAUS
1, 4, 4, 4, 4, 1, 1, 1,
1, 4, 4, 4, 4, 1, 1, 1,
// 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_INS, KC_HOME, KC_PGUP
4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 1, 1, 1,
1,
// 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_END, KC_PGDN
1, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 1, 1,
1,
// 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
1, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 1,
// 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
1, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 1, 1,
// KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
1, 1, 1, 4, 1, 1, 1, 1,
1, 1, 1,
// Underglow / Border
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2
} };
#ifdef USB_LED_INDICATOR_ENABLE
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
md_rgb_matrix_indicators_advanced(led_min, led_max);
return rgb_matrix_indicators_advanced_user(led_min, led_max);
}
#endif // USB_LED_INDICATOR_ENABLE
#endif

View file

@ -1,517 +0,0 @@
/* Copyright 2022 Daniel Weeks (@xanimos)
*
* 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 <string.h>
#define MILLISECONDS_IN_SECOND 1000
// These are just to make it neater to use builtin HSV values in the keymap
#define RED {HSV_RED}
#define CORAL {HSV_CORAL}
#define ORANGE {HSV_ORANGE}
#define GOLDEN {HSV_GOLDENROD}
#define GOLD {HSV_GOLD}
#define YELLOW {HSV_YELLOW}
#define CHART {HSV_CHARTREUSE}
#define GREEN {HSV_GREEN}
#define SPRING {HSV_SPRINGGREEN}
#define TURQ {HSV_TURQUOISE}
#define TEAL {HSV_TEAL}
#define CYAN {HSV_CYAN}
#define AZURE {HSV_AZURE}
#define BLUE {HSV_BLUE}
#define PURPLE {HSV_PURPLE}
#define MAGENT {HSV_MAGENTA}
#define PINK {HSV_PINK}
//========================================================== CONFIGURABLE DEFAULTS ==========================================================
#define RGB_DEFAULT_TIME_OUT 30
#define RGB_FAST_MODE_TIME_OUT 3
#define RGB_TIME_OUT_MAX 600
#define RGB_TIME_OUT_MIN 10
#define RGB_TIME_OUT_STEP 10
extern rgb_config_t rgb_matrix_config;
bool disable_layer_color;
bool rgb_enabled_flag; // Current LED state flag. If false then LED is off.
bool rgb_time_out_enable; // Idle LED toggle enable. If false then LED will not turn off after idle timeout.
bool rgb_time_out_fast_mode_enabled; // Enable flag for RGB timeout fast mode
bool rgb_time_out_user_value; // This holds the toggle value set by user with ROUT_TG. It's necessary as RGB_TOG changes timeout enable.
uint16_t rgb_time_out_seconds; // Idle LED timeout value, in seconds not milliseconds
uint16_t rgb_time_out_saved_seconds; // The saved user config for RGB timeout period
led_flags_t rgb_time_out_saved_flag; // Store LED flag before timeout so it can be restored when LED is turned on again.
enum layout_names {
_KL=0, // Keys Layout: The main keyboard layout that has all the characters
_FL, // Function Layout: The function key activated layout with default functions and some added ones
_GL, // GIT Layout: GIT shortcuts and macros
_NUMPAD, // Numpad Layout: Adds a numpad to the keys
};
// Tap Dance keycodes
enum td_keycodes {
TD_FN_SWITCH = 0
};
// Define a type containing as many tapdance states as you need
typedef enum {
TD_NONE,
TD_UNKNOWN,
TD_SINGLE_HOLD,
TD_DOUBLE_HOLD
} td_state_t;
typedef struct {
bool is_press_action;
td_state_t state;
} td_tap_t;
// Declare your tapdance functions:
// Function to determine the current tapdance state
td_state_t cur_dance(tap_dance_state_t *state);
// `finished` and `reset` functions for each tapdance keycode
void fn_tap_finished(tap_dance_state_t *state, void *user_data);
void fn_tap_reset(tap_dance_state_t *state, void *user_data);
enum ctrl_keycodes {
MD_BOOT = SAFE_RANGE, // Restart into bootloader after hold timeout
ROUT_TG, // Timeout Toggle. Toggle idle LED time out on or off
ROUT_VI, // Timeout Value Increase. Increase idle time out before LED disabled
ROUT_VD, // Timeout Value Decrease. Decrease idle time out before LED disabled
ROUT_FM, // RGB timeout fast mode toggle
TOG_NPD, // Toggle Numpad On/Off
COPY_ALL, // Copy all text using ctrl(a+c)
};
enum string_macro_keycodes {
// The start of this enum should always be equal to end of ctrl_keycodes + 1
G_INIT = COPY_ALL + 1, // git init
G_CLONE, // git clone
G_ADD, // git add
G_DIFF, // git diff
G_RESET, // git reset --soft
G_BRANH, // git branch list
G_CHECK, // git checkout
G_REMTE, // git remote add
G_FETCH, // git fetch
G_PULL, // git pull
G_PUPST, // git pull upstream
G_PUSH, // git push
G_PSORG, // git push -u origin
G_PSFWL, // git push --force-with-lease
G_COMM, // git commit
G_COMSG, // git commit -m ": [TFS-]"
G_STAT, // git status
G_LOG, // git log
};
static uint16_t idle_timer; // Idle LED timeout timer
static uint8_t idle_second_counter; // Idle LED seconds counter, counts seconds not milliseconds
static uint8_t key_event_counter; // This counter is used to check if any keys are being held
static const char * sendstring_commands[] = {
"git init",
"git clone ",
"git add ",
"git diff ",
"git reset --soft ",
"git branch --list",
"git checkout ",
"git remote add ",
"git fetch ",
"git pull",
"git pull upstream ",
"git push",
"git push -u origin ",
"git push --force-with-lease",
"git commit ",
"git commit -m \": [TFS-]\"",
"git status",
"git log",
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_KL] = LAYOUT(
// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRINT SCLCK PAUSE
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_SCRL,RCS(KC_M),
// ~ 1 2 3 4 5 6 7 8 9 0 - = BCKSP INS HOME PGUP
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_INS , KC_HOME, KC_PGUP,
// TAB Q W E R T Y U I O P [ ] \ DEL END PGDN
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_END , KC_PGDN,
// CAPS A S D F G H J K L ; ' ENTER
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 ,
// SHIFT Z X C V B N M , . / RSHIFT UP
SC_LSPO, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, SC_RSPC, KC_UP ,
// CTRL GUI ALT SPACE RALT MENU RGUI RCTRL LEFT DOWN RIGHT
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, TD(TD_FN_SWITCH), KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[_FL] = LAYOUT(
// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRINT SCLCK PAUSE
_______, ROUT_TG, ROUT_FM, ROUT_VD, ROUT_VI, _______, _______, _______, _______, _______, _______, KC_WAKE, KC_SLEP, KC_PAUS, _______, KC_MUTE,
// ~ 1 2 3 4 5 6 7 8 9 0 - = BCKSP INS HOME PGUP
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPLY, KC_VOLU,
// TAB Q W E R T Y U I O P [ ] \ DEL END PGDN
_______, RGB_MOD, RGB_SPI, RGB_VAI, RGB_HUI, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
// CAPS A S D F G H J K L ; ' ENTER
_______,RGB_RMOD, RGB_SPD, RGB_VAD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
// SHIFT Z X C V B N M , . / RSHIFT UP
_______, _______, _______,COPY_ALL, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, TOG_NPD, KC_BRIU,
// CTRL GUI ALT SPACE RALT MENU RGUI RCTRL LEFT DOWN RIGHT
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BRID, _______
),
[_GL] = LAYOUT(
// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRINT SCLCK PAUSE
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// ~ 1 2 3 4 5 6 7 8 9 0 - = BCKSP INS HOME PGUP
G_INIT, G_CLONE, G_REMTE, G_RESET, G_PSFWL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// TAB Q W E R T Y U I O P [ ] \ DEL END PGDN
_______, G_PUPST, G_PULL, G_PSORG, G_PUSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// CAPS A S D F G H J K L ; ' ENTER
_______, G_ADD, G_STAT, G_DIFF, G_FETCH, _______, _______, _______, _______, _______, _______, _______, _______,
// SHIFT Z X C V B N M , . / RSHIFT UP
_______, G_LOG, G_CHECK, G_COMM, G_COMSG, G_BRANH, _______, _______, _______, _______, _______, _______, _______,
// CTRL GUI ALT SPACE RALT MENU RGUI RCTRL LEFT DOWN RIGHT
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_NUMPAD] = LAYOUT(
// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRINT SCLCK PAUSE
TOG_NPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// ~ 1 2 3 4 5 6 7 8 9 0 - = BCKSP INS HOME PGUP
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// TAB Q W E R T Y U I O P [ ] \ DEL END PGDN
_______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______, _______, _______, _______, _______, _______, _______, _______,
// CAPS A S D F G H J K L ; ' ENTER
_______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______,
// SHIFT Z X C V B N M , . / RSHIFT UP
_______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PDOT, _______, _______, _______, _______,
// CTRL GUI ALT SPACE RALT MENU RGUI RCTRL LEFT DOWN RIGHT
_______, _______, _______, KC_P0, _______, _______, _______, _______, _______, _______, _______
),
/*
[X] = LAYOUT(
// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRINT SCLCK PAUSE
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// ~ 1 2 3 4 5 6 7 8 9 0 - = BCKSP INS HOME PGUP
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// TAB Q W E R T Y U I O P [ ] \ DEL END PGDN
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// CAPS A S D F G H J K L ; ' ENTER
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// SHIFT Z X C V B N M , . / RSHIFT UP
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// CTRL GUI ALT SPACE RALT MENU RGUI RCTRL LEFT DOWN RIGHT
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
#define __OFF__ {0, 0, 0}
const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = {
[_FL] = {
// These remain on base layer rgb to see adjustments ;)
// |----------------------------------|
// _______, ROUT_TG, ROUT_FM, ROUT_VD, ROUT_VI, _______, _______, _______, _______, _______, _______, KC_WAKE, KC_SLEP, KC_PAUS, _______, KC_MUTE,
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, YELLOW, YELLOW, ORANGE, __OFF__, GOLD,
// RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPLY, KC_VOLU,
GOLD, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, RED, SPRING, ORANGE,
// _______, RGB_MOD, RGB_SPI, RGB_VAI, RGB_HUI, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
__OFF__, ORANGE, GREEN, AZURE, GOLDEN, MAGENT, __OFF__, AZURE, AZURE, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, TEAL, TEAL, ORANGE,
// _______,RGB_RMOD, RGB_SPD, RGB_VAD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
__OFF__, ORANGE, GREEN, AZURE, GOLDEN, MAGENT, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______,COPY_ALL, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, TO(_NUMPAD), KC_BRIU,
__OFF__, __OFF__, __OFF__, CORAL, __OFF__, RED, TURQ, __OFF__, __OFF__, __OFF__, __OFF__, CYAN, SPRING,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BRID, _______
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, SPRING, __OFF__
},
[_GL] = {
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// G_INIT, G_CLONE, G_REMTE, G_RESET, G_PSFWL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
AZURE, CHART, CHART, RED, CORAL, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, G_PUPST, G_PULL, G_PSORG, G_PUSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
__OFF__, BLUE, PURPLE, MAGENT, PINK, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, G_ADD, G_STAT, G_DIFF, G_FETCH, _______, _______, _______, _______, _______, _______, _______, _______,
__OFF__, SPRING, GREEN, TURQ, TEAL, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, G_LOG, G_CHECK, G_COMM, G_COMSG, G_BRANH, _______, _______, _______, _______, _______, _______, _______,
__OFF__, CYAN, GOLDEN, YELLOW, GOLD, CHART, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__
},
[_NUMPAD] = {
// TO(_KL), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RED, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______, _______, _______, _______, _______, _______, _______, _______,
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, GREEN, GREEN, GREEN, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______,
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, TURQ, TURQ, TURQ, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PDOT, _______, _______, _______,
__OFF__, __OFF__, __OFF__, __OFF__, __OFF__, CYAN, CYAN, CYAN, AZURE, __OFF__, __OFF__, __OFF__, __OFF__,
// _______, _______, _______, KC_P0, _______, _______, _______, _______, _______, _______, _______
__OFF__, __OFF__, __OFF__, CYAN, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__, __OFF__
},
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
// Enable or disable debugging
debug_enable = false;
debug_matrix = false;
debug_keyboard = false;
debug_mouse = false;
idle_second_counter = 0; // Counter for number of seconds keyboard has been idle.
key_event_counter = 0; // Counter to determine if keys are being held, neutral at 0.
rgb_time_out_seconds = RGB_DEFAULT_TIME_OUT; // RGB timeout initialized to its default configure in keymap.h
rgb_time_out_enable = false; // Disable RGB timeout by default. Enable using toggle key.
rgb_time_out_user_value = false; // Has to have the same initial value as rgb_time_out_enable.
rgb_enabled_flag = true; // Initially, keyboard RGB is enabled. Change to false config.h initializes RGB disabled.
rgb_time_out_fast_mode_enabled = false; // RGB timeout fast mode disabled initially.
rgb_time_out_saved_flag = rgb_matrix_get_flags(); // Save RGB matrix state for when keyboard comes back from ide.
};
void keyboard_post_init_user(void) {
rgb_matrix_enable();
}
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
if(rgb_time_out_enable && rgb_enabled_flag) {
// If the key event counter is not zero then some key was pressed down but not released, thus reset the timeout counter.
if (key_event_counter) {
idle_second_counter = 0;
} else if (timer_elapsed(idle_timer) > MILLISECONDS_IN_SECOND) {
idle_second_counter++;
idle_timer = timer_read();
}
if (idle_second_counter >= rgb_time_out_seconds) {
rgb_time_out_saved_flag = rgb_matrix_get_flags();
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
rgb_enabled_flag = false;
idle_second_counter = 0;
}
}
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
// Increment key event counter for every press and decrement for every release.
if (record->event.pressed) {
key_event_counter++;
} else {
key_event_counter--;
}
if (rgb_time_out_enable) {
idle_timer = timer_read();
// Reset the seconds counter. Without this, something like press> leave x seconds> press, would be x seconds on the effective counter not 0 as it should.
idle_second_counter = 0;
if (!rgb_enabled_flag) {
rgb_matrix_enable_noeeprom();
rgb_matrix_set_flags(rgb_time_out_saved_flag);
rgb_enabled_flag = true;
}
}
switch (keycode) {
case MD_BOOT:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
reset_keyboard();
}
}
return false;
}
if (record->event.pressed) {
switch (keycode) {
case RGB_TOG:
rgb_time_out_enable = rgb_time_out_user_value;
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
}
break;
case LED_FLAG_UNDERGLOW: {
// This line is for LED idle timer. It disables the toggle so you can turn off LED completely if you like
rgb_time_out_enable = false;
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
}
break;
}
return false;
// ======================================================== CUSTOM KEYCOADS BELOW ========================================================
case COPY_ALL:
// Selects all and text and copy
SEND_STRING(SS_LCTL("ac"));
return false;
case ROUT_TG:
// Toggle idle LED timeout on or off
rgb_time_out_enable = !rgb_time_out_enable;
rgb_time_out_user_value = rgb_time_out_enable;
return false;
case ROUT_VI:
// Increase idle LED timeout value in seconds
// Only increase if current value is lower than RGB_TIME_OUT_MAX. Don't care what value the result will be
// Modity RGB_TIME_OUT_STEP for bigger or smaller increments
if (!rgb_time_out_fast_mode_enabled && rgb_time_out_seconds <= RGB_TIME_OUT_MAX) {
rgb_time_out_seconds += RGB_TIME_OUT_STEP;
}
return false;
case ROUT_VD:
// Decrease idle LED timeout value in seconds
// Only decrease if current value is higher than minimum value and the result is larger than zero
// Modity RGB_TIME_OUT_STEP for bigger or smaller decrements
if (!rgb_time_out_fast_mode_enabled && rgb_time_out_seconds > RGB_TIME_OUT_MIN) {
rgb_time_out_seconds -= RGB_TIME_OUT_STEP;
}
return false;
case ROUT_FM:
if (rgb_time_out_fast_mode_enabled) {
rgb_time_out_seconds = rgb_time_out_saved_seconds;
} else {
rgb_time_out_saved_seconds = rgb_time_out_seconds;
rgb_time_out_seconds = RGB_FAST_MODE_TIME_OUT;
}
rgb_time_out_fast_mode_enabled = !rgb_time_out_fast_mode_enabled;
return false;
case G_INIT ... G_LOG:
send_string_with_delay(sendstring_commands[keycode - G_INIT], 5);
return false;
case TOG_NPD:
if (get_highest_layer(layer_state) != _NUMPAD) {
layer_move(_NUMPAD);
} else {
layer_move(_KL);
}
return false;
}
}
return true;
}
void set_layer_color(int layer) {
if (layer == 0) { return; }
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
HSV hsv = {
.h = pgm_read_byte(&ledmap[layer][i][0]),
.s = pgm_read_byte(&ledmap[layer][i][1]),
.v = pgm_read_byte(&ledmap[layer][i][2]),
};
if (hsv.h || hsv.s || hsv.v) {
RGB rgb = hsv_to_rgb(hsv);
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b);
continue;
}
if(layer == _FL && i <= 4 && i >= 1) {
continue; // Leave RGB for F1-F4 of function layer to adjust RGB settings
}
rgb_matrix_set_color(i, 0, 0, 0);
}
}
bool rgb_matrix_indicators_user(void) {
if (disable_layer_color ||
rgb_matrix_get_flags() == LED_FLAG_NONE ||
rgb_matrix_get_flags() == LED_FLAG_UNDERGLOW) {
return;
}
set_layer_color(get_highest_layer(layer_state));
return false;
}
td_state_t cur_dance(tap_dance_state_t *state) {
if (state->pressed && !state->interrupted) {
if (state->count == 1) { return TD_SINGLE_HOLD; }
return TD_DOUBLE_HOLD;
}
return TD_UNKNOWN;
}
static td_tap_t fn_tap_state = {
.is_press_action = true,
.state = TD_NONE
};
void fn_tap_finished(tap_dance_state_t *state, void *user_data) {
fn_tap_state.state = cur_dance(state);
switch (fn_tap_state.state) {
case TD_SINGLE_HOLD:
// set function layer
layer_move(_FL);
break;
case TD_DOUBLE_HOLD:
// set git layer
layer_move(_GL);
break;
case TD_UNKNOWN:
register_code(KC_APP);
break;
default:
break;
}
}
void fn_tap_reset(tap_dance_state_t *state, void *user_data) {
switch (fn_tap_state.state) {
case TD_UNKNOWN:
unregister_code(KC_APP);
break;
case TD_DOUBLE_HOLD:
case TD_SINGLE_HOLD:
// Set default layer if we didn't activate numpad layer in function
if (get_highest_layer(layer_state) != _NUMPAD) {
layer_move(_KL);
}
break;
break;
default:
break;
}
fn_tap_state.state = TD_NONE;
}
tap_dance_action_t tap_dance_actions[] = {
[TD_FN_SWITCH] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, fn_tap_finished, fn_tap_reset)
};

View file

@ -1,200 +0,0 @@
# Massdrop Ctrl Xanimos
This keymap is the one I use on my MD CTRL, as a professional software engineer I like to make things my own. I'm also up for spreading the love.
Massdrop has had a pretty bad rap with qmk the past but recently it's not too bad once you put a little pizzazz into it.
I started with the Endgame keymap and have re-written most of and expanded upon it.
## Layers
### Typing Layer
_I physically switched around my RALT and Menu keys as my personal preference. The label is still in default location but you can see they are mapped to my liking._
```
__________ ___________________________________________ ___________________________________________ ___________________________________________ ________________________________
| ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 | F10 | F11 | F12 | | PRINT | SCLCK | PAUSE |
| ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| 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_SCRL | RCS(M) |
|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|
____________________________________________________________________________________________________________________________________________________________________ ________________________________
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BCKSP | | INS | HOME | PGUP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| 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_INS | KC_HOME | KC_PGUP |
|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_____________________| |__________|__________|__________|
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | | DEL | END | PGDN |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| 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_END | KC_PGDN |
|_______________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|________________| |__________|__________|__________|
| CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
| 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 |
|_________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________| __________
| SHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | | UP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ |
| SC_LSPO | KC_Z | KC_X | KC_C | KC_V | KC_B | KC_N | KC_M | KC_COMM | KC_DOT | KC_SLSH | SC_RSPC | | KC_UP |
|____________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________________| __________|__________|__________
| CTRL | GUI | ALT | SPACE | RALT | MENU | RGUI | RCTRL | | LEFT | DOWN | RIGHT |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| KC_LCTL | KC_LGUI | KC_LALT | KC_SPC | FN_SWTCH | KC_RALT | KC_RGUI | KC_RCTL | | KC_LEFT | KC_DOWN | KC_RGHT |
|_____________|_____________|_____________|_________________________________________________________________|______________|_____________|_____________|_____________| |__________|__________|__________|
```
### Function Layer
```
__________ ___________________________________________ ___________________________________________ ___________________________________________ ________________________________
| ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 | F10 | F11 | F12 | | PRINT | SCLCK | PAUSE |
| ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | ROUT_TG | ROUT_RM | ROUT_VD | ROUT_VI | | | | | | | | KC_WAKE | KC_SLEP | | | KC_PAUS | | KC_MUTE |
|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|
____________________________________________________________________________________________________________________________________________________________________ ________________________________
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BCKSP | | INS | HOME | PGUP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | | | | | | | | | | | | | KC_MSTP | KC_MPLY | KC_VOLU |
|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_____________________| |__________|__________|__________|
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | | DEL | END | PGDN |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | RGB_MOD | RGB_SPI | RBG_VAI | RGB_HUI | | | | | | | | | | | KC_MPRV | KC_MNXT | KC_VOLD |
|_______________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|________________| |__________|__________|__________|
| CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
| | RGB_RMOD | RGB_SPD | RGB_VAD | RGB_HUD | | | | | | | | |
|_________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________| __________
| SHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | | UP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ |
| | | | COPY_ALL | | MD_BOOT | NK_TOGG | | | | | TOGGLE_NUMPAD | | KC_BRIU |
|____________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________________| __________|__________|__________
| CTRL | GUI | ALT | SPACE | RALT | MENU | RGUI | RCTRL | | LEFT | DOWN | RIGHT |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | | | | | | | | KC_BRID | |
|_____________|_____________|_____________|_________________________________________________________________|______________|_____________|_____________|_____________| |__________|__________|__________|
```
### Git Layer
```
__________ ___________________________________________ ___________________________________________ ___________________________________________ ________________________________
| ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 | F10 | F11 | F12 | | PRINT | SCLCK | PAUSE |
| ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | | | | | | | | | | | | | | | | | |
|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|
____________________________________________________________________________________________________________________________________________________________________ ________________________________
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BCKSP | | INS | HOME | PGUP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| G_INIT | G_CLONE | G_REMTE | G_RESET | G_PSFWL | | | | | | | | | | | | | |
|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_____________________| |__________|__________|__________|
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | | DEL | END | PGDN |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | G_PUPST | G_PULL | G_PSORG | G_PUSH | | | | | | | | | | | | | |
|_______________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|________________| |__________|__________|__________|
| CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
| | G_ADD | G_STAT | G_DIFF | G_FETCH | | | | | | | | |
|_________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________| __________
| SHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | | UP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ |
| | G_LOG | G_CHECK | G_COMM | G_COMSG | G_BRANH | | | | | | | | |
|____________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________________| __________|__________|__________
| CTRL | GUI | ALT | SPACE | RALT | MENU | RGUI | RCTRL | | LEFT | DOWN | RIGHT |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | | | | | | | | | |
|_____________|_____________|_____________|_________________________________________________________________|______________|_____________|_____________|_____________| |__________|__________|__________|
```
- These are the strings that are dumped/keyed in for each associated keycode
```
G_INIT "git init"
G_CLONE "git clone "
G_ADD "git add "
G_DIFF "git diff "
G_RESET "git reset --soft "
G_BRANH "git branch --list"
G_CHECK "git checkout "
G_REMTE "git remote add "
G_FETCH "git fetch "
G_PULL "git pull"
G_PUPST "git pull upstream "
G_PUSH "git push"
G_PSORG "git push -u origin "
G_PSFWL "git push --force-with-lease"
G_COMM "git commit "
G_COMSG "git commit -m \": [TFS-]\""
G_STAT "git status"
G_LOG "git log"
```
### Numpad Layer
*activated via the __Function Layer__ and stays active until you escape*
```
__________ ___________________________________________ ___________________________________________ ___________________________________________ ________________________________
| ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 | F10 | F11 | F12 | | PRINT | SCLCK | PAUSE |
| ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| TOG_NPD | | | | | | | | | | | | | | | | | | | |
|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|__________| |__________|__________|__________|
____________________________________________________________________________________________________________________________________________________________________ ________________________________
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BCKSP | | INS | HOME | PGUP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | | | | | | | | | | | | | | | |
|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_____________________| |__________|__________|__________|
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | | DEL | END | PGDN |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | | | | KC_P7 | KC_P8 | KC_P9 | | | | | | | | | |
|_______________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|________________| |__________|__________|__________|
| CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
| | | | | | | KC_P4 | KC_P5 | KC_P6 | | | | |
|_________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________| __________
| SHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | | UP |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ |
| | | | | | KC_P1 | KC_P2 | KC_P3 | KC_PDOT | | | | | |
|____________________|__________|__________|__________|__________|__________|__________|__________|__________|__________|__________|_________________________________| __________|__________|__________
| CTRL | GUI | ALT | SPACE | RALT | MENU | RGUI | RCTRL | | LEFT | DOWN | RIGHT |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ |
| | | | KC_P0 | | | | | | | | |
|_____________|_____________|_____________|_________________________________________________________________|______________|_____________|_____________|_____________| |__________|__________|__________|
```
## Features
These are the features currently used by this keymap:
### RGB Time Out
This allows setting a dynamic timeout for RGB to turn off. The following is supported:
1. Restores on the first click of any key.
2. Restores to its previous state before timeout. i.e. if it was edge only before timeout it will restore to edge only, same for all modes.
3. Doesn't interfere with RGB modes. You can set keyboard to All, Edge Only or Off and timeout will not interfere with these modes.
4. The time before RGB is turned off is dynamically adjustable using keycodes ROUT_VI to increase, ROUT_VD to decrease. They have a 10 second steps by default. Minimum value 10 seconds by default and maximum is 10 minutes.
5. Can be toggled on or off dyncamically with the ROUT_TG keycode.
6. Can be put in fast mode using ROUT_FM, for movie watching purposes. Default value is 3 seconds. Note that fast mode disabled ROUT_VD and ROUT_VI so to use them again you have to toggle fast mode off with ROUT_FM. It doesn't impact ROUT_TG and ROUT_TG will remember if fast mode was enabled when toggled back on, so it doesn't disable fast mode on its own, only ROUT_FM can disable or enable fast mode.
### Tapdance Keys
Created a tapdance setup to use the same key to switch between the layers, aka a function key. ;)
Layers are temporary while holding the function key down.
- Single tap and hold: Activates the Function Layer.
- Double tap and hold: Activates the Git Layer.
### Numpad
Activated in the *Function Layer* by holding down the fn key and pressing the toggle key (RSHIFT). The keeps the layer activated without needing to hold the fn key anymore.
To leave the numpad layer press the ESC key or hold and let go of the fn key.
### Space Cadet Shift
The typing layer is setup to use the [Space Cadet Shift](https://docs.qmk.fm/#/feature_space_cadet). As a software engineer this is massively useful :)
_Sorry ISO users, you'll need to configure it for your own setup or disable it._
## Credits
- [endgame](https://github.com/qmk/qmk_firmware/tree/master/keyboards/massdrop/ctrl/keymaps/endgame) by [ash0x0](https://github.com/ash0x0)
For the base keymap I started with.

View file

@ -1,13 +0,0 @@
# RGBLIGHT_ENABLE = no # Not for MD boards. This is here in case you forget.
COMMAND_ENABLE = no # Commands for debug and configuration
# AUTO_SHIFT_ENABLE = yes # Auto Shift
NKRO_ENABLE = yes # USB Nkey Rollover
DYNAMIC_MACRO_ENABLE = no # Dynamic macro recording and play
MOUSEKEY_ENABLE = no # Enable mouse control keycodes. Increases firmware size.
TAP_DANCE_ENABLE = yes # Enable tap dance keys
CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size.
SRC += config_led.c # Used to add files to the compilation/linking list.
EXTRAKEY_ENABLE = yes # Audio control and System control
# RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard
# COMBO_ENABLE # Key combo feature
# LEADER_ENABLE # Enable leader key chording