From 9f1f43bb8620cc8fe6715019c3dc58cd4f79cf17 Mon Sep 17 00:00:00 2001 From: M-AS Date: Sun, 18 Oct 2020 19:30:24 -0400 Subject: [Keymap] Updated personal Massdrop CTRL keymap (#10649) * initial port of keymap to latest qmk version * forgot to add space cadet shift, fixed * corrected colors and added color macros * added custom rgb matrix effects * enabled extrakey * updated readme * Added GPL3 License Headers * Added images to readme * clang-format * Apply suggestions from code review Co-authored-by: Ryan * renamed README.md to readme.md Co-authored-by: Ryan --- .../massdrop/ctrl/keymaps/matthewrobo/config.h | 181 ++++-- .../massdrop/ctrl/keymaps/matthewrobo/config_led.c | 39 +- .../massdrop/ctrl/keymaps/matthewrobo/keymap.c | 660 +++++++++------------ .../massdrop/ctrl/keymaps/matthewrobo/keymap.h | 86 +++ .../massdrop/ctrl/keymaps/matthewrobo/readme.md | 14 + .../ctrl/keymaps/matthewrobo/rgb_matrix_user.inc | 51 ++ .../massdrop/ctrl/keymaps/matthewrobo/rules.mk | 20 +- 7 files changed, 594 insertions(+), 457 deletions(-) create mode 100644 keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.h create mode 100644 keyboards/massdrop/ctrl/keymaps/matthewrobo/readme.md create mode 100644 keyboards/massdrop/ctrl/keymaps/matthewrobo/rgb_matrix_user.inc diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/config.h b/keyboards/massdrop/ctrl/keymaps/matthewrobo/config.h index b7a469208d..6e16c3a5f9 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/config.h +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/config.h @@ -1,67 +1,134 @@ -#pragma once +/* +QMK Firmware Massdrop CTRL M-AS Keymap +Copyright (C) 2020 matthewrobo -#define FORCE_NKRO +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 3 of the License, or +(at your option) any later version. -#define PERMISSIVE_HOLD -#define TAPPING_TERM 150 +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. -#define TAP_HOLD_CAPS_DELAY 0 +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#pragma once -// #define DISABLE_RGB_MATRIX_SOLID_COLOR -// #define DISABLE_RGB_MATRIX_ALPHAS_MODS -// #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define DISABLE_RGB_MATRIX_BREATHING -#define DISABLE_RGB_MATRIX_BAND_SAT -// #define DISABLE_RGB_MATRIX_BAND_VAL -#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#define DISABLE_RGB_MATRIX_CYCLE_ALL -#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN -#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN -#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL -// #define DISABLE_RGB_MATRIX_CYCLE_SPIRAL -#define DISABLE_RGB_MATRIX_DUAL_BEACON -#define DISABLE_RGB_MATRIX_RAINBOW_BEACON -#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS -#define DISABLE_RGB_MATRIX_RAINDROPS -#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define DISABLE_RGB_MATRIX_TYPING_HEATMAP -#define DISABLE_RGB_MATRIX_DIGITAL_RAIN -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -#define DISABLE_RGB_MATRIX_SOLID_REACTIVE -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -// #define DISABLE_RGB_MATRIX_SPLASH -// #define DISABLE_RGB_MATRIX_MULTISPLASH -// #define DISABLE_RGB_MATRIX_SOLID_SPLASH -// #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH +#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 QMK_KEYS_PER_SCAN 4 +// #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT) // Key combination that allows the use of magic commands (useful for debugging) -// #define RGB_MATRIX_KEYRELEASES +// #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 QMK_KEYS_PER_SCAN 4 // Allows sending more than one key per scan. By default, only one key event gets sent via process_record() per scan. This has little impact on most typing, but if you're doing a lot of chords, or your scan rate is slow to begin with, you can have some delay in processing key events. Each press and release is a separate event. For a keyboard with 1ms or so scan times, even a very fast typist isn't going to produce the 500 keystrokes a second needed to actually get more than a few ms of delay from this. But if you're doing chording on something with 3-4ms scan times? You probably want this. +// #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 PERMISSIVE_HOLD +// #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 IGNORE_MOD_TAP_INTERRUPT // Makes it possible to do rolling combos (zx) with keys that convert to other keys on hold, by enforcing the TAPPING_TERM for both keys. See Mod tap interrupt for details +// #define TAPPING_FORCE_HOLD // 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_COUNT 2 // Set this to the number of combos that you're using in the Combo feature. +// #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_CAPSLOCK 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. -// some speed shit -#define NO_ACTION_MACRO -#define NO_ACTION_FUNCTION +#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_STARTUP_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_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +// #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended +// #define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 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_ANIMATIONS // Run RGB animations +// #define RGBLIGHT_ANIMATIONS // Enable all additional animation modes. +// #define RGBLIGHT_EFFECT_ALTERNATING // Enable alternating animation mode. +// #define RGBLIGHT_EFFECT_BREATHING // Enable breathing animation mode. +// #define RGBLIGHT_EFFECT_CHRISTMAS // Enable christmas animation mode. +// #define RGBLIGHT_EFFECT_KNIGHT // Enable knight animation mode. +// #define RGBLIGHT_EFFECT_RAINBOW_MOOD // Enable rainbow mood animation mode. +// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL // Enable rainbow swirl animation mode. +// #define RGBLIGHT_EFFECT_RGB_TEST // Enable RGB test animation mode. +// #define RGBLIGHT_EFFECT_SNAKE // Enable snake animation mode. +// #define RGBLIGHT_EFFECT_STATIC_GRADIENT // Enable static gradient mode. -#ifndef NO_DEBUG -#define NO_DEBUG -#endif // !NO_DEBUG -#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) -#define NO_PRINT -#endif // !NO_PRINT +// #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 -#define NO_ACTION_ONESHOT -#define TAPPING_FORCE_HOLD -#define IGNORE_MOD_TAP_INTERRUPT +// 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 diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c b/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c index 448793cf5d..a4ce649d3b 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c @@ -1,10 +1,28 @@ -#ifdef RGB_MATRIX_ENABLE -#include "ctrl.h" +/* +QMK Firmware Massdrop CTRL M-AS Keymap +Copyright (C) 2020 matthewrobo + +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 3 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. -#include "led_matrix.h" -#include "rgb_matrix.h" -#include "config_led.h" +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#ifdef RGB_MATRIX_ENABLE +# include "ctrl.h" + +# include "led_matrix.h" +# include "rgb_matrix.h" +# include "config_led.h" +// clang-format off led_config_t g_led_config = { { { 0, 1, 2, 3, 4, 5, 6, 7 }, { 16, 17, 18, 19, 20, 21, 22, 23 }, @@ -70,13 +88,10 @@ led_config_t g_led_config = { { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }; +// clang-format on - -#ifdef USB_LED_INDICATOR_ENABLE -void rgb_matrix_indicators_kb(void) -{ - led_matrix_indicators(); -} -#endif // USB_LED_INDICATOR_ENABLE +# ifdef USB_LED_INDICATOR_ENABLE +void rgb_matrix_indicators_kb(void) { led_matrix_indicators(); } +# endif // USB_LED_INDICATOR_ENABLE #endif diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c index 447b0aca1a..c89607b3f3 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c @@ -1,396 +1,286 @@ -#include QMK_KEYBOARD_H - -enum ctrl_layers { - _QWERTY, - _NAV, - _FNC -}; - -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 - MAS_TOG, - MAS_CRM, - MAS_PRP, - MAS_RED, - MAS_GRN, - MAS_BLU, - MAS_CYN, - MAS_MGT, - MAS_YEL, - MAS_KEY, - MAS_WHT, -}; - -#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode -#define LT_CAPS LT(_NAV, KC_CAPS) -#define _V_V_V_ KC_TRNS -extern bool autoshift_enabled; - - -keymap_config_t keymap_config; - +/* +QMK Firmware Massdrop CTRL M-AS Keymap +Copyright (C) 2020 matthewrobo + +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 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "keymap.h" +// 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_SLCK, 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, \ - LT_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_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_UP, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FNC), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ - ), - [_NAV] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PAST, KC_PMNS, KC_PPLS, _______, _______, _______, _______, \ - _______, KC_PGUP, KC_HOME, KC_UP, KC_END, _______, _______, KC_P4, KC_P5, KC_P6, KC_PSLS, _______, _______, KC_EQL, _______, _______, _______, \ - _V_V_V_, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_PPLS, _______, \ - _______, _______, _______, _______, _______, _______, KC_P0, KC_P0, KC_P0, KC_PDOT, KC_PSLS, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ - ), - [_FNC] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_MSEL, KC_ASTG, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPLY, KC_VOLU, \ - _______, RGB_MOD, RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, MAS_MGT, MAS_BLU, MAS_WHT, RGB_RMOD, RGB_MOD, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ - _______, RGB_RMOD, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, MAS_RED, MAS_KEY, MAS_CYN, MAS_PRP, _______, _______, \ - MAS_TOG, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, MAS_YEL, MAS_GRN, MAS_CRM, _______, _______, RGB_VAI, \ - _______, _______, _______, _______, _______, _V_V_V_, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI \ - ), - /* - [X] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ - ), - [X] = 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 \ - ), - */ + [_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_SLCK, 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, + LT_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_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FL), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_NL] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PAST, KC_PMNS, KC_PPLS, _______, _______, _______, _______, + _______, KC_PGUP, KC_HOME, KC_UP, KC_END, _______, _______, KC_P4, KC_P5, KC_P6, KC_PSLS, _______, _______, KC_EQL, _______, _______, _______, + _LAYER_, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_PPLS, _______, + _______, _______, _______, _______, _______, _______, KC_P0, KC_P0, KC_P0, KC_PDOT, KC_PSLS, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [_FL] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_MSEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPLY, KC_VOLU, + _______, RGB_MOD, RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, MAS_MGT, MAS_BLU, MAS_WHT, RGB_RMOD,RGB_MOD, _______, KC_MPRV, KC_MNXT, KC_VOLD, + _______, RGB_RMOD,RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, MAS_RED, MAS_KEY, MAS_CYN, MAS_PRP, _______, _______, + _______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, MAS_YEL, MAS_GRN, MAS_CRM, _______, _______, RGB_VAI, + _______, _______, _______, _______, _______, _LAYER_, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI + ), + /* + [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_SLCK, 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 + ), + [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 + ), + */ }; - -void rgb_matrix_indicators_user(void) -{ - uint8_t this_led = host_keyboard_leds(); - - if (!g_suspend_state && rgb_matrix_config.enable) { - switch (biton32(layer_state)) { - case _NAV: - if (this_led & (1 << USB_LED_NUM_LOCK)) { - rgb_matrix_set_color(41, 0xFF, 0x00, 0x00); - } else { - rgb_matrix_set_color(41, 0x00, 0x00, 0x00); - } - - // layer indicator - rgb_matrix_set_color(50, 0xFF, 0xFF, 0xFF); - rgb_matrix_set_color(101, 0xFF, 0xFF, 0xFF); - // ESDF - rgb_matrix_set_color(36, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(52, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(53, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(54, 0xFF, 0x00, 0x00); - // home/end - rgb_matrix_set_color(35, 0x00, 0xFF, 0x00); - rgb_matrix_set_color(37, 0x00, 0xFF, 0x00); - // pgup/dn - rgb_matrix_set_color(34, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(51, 0x00, 0x00, 0xFF); - // numpad - rgb_matrix_set_color(23, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(24, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(25, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(40, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(42, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(57, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(58, 0xFF, 0xFF, 0x00); - rgb_matrix_set_color(59, 0xFF, 0xFF, 0x00); - // zero - rgb_matrix_set_color(69, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(70, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(71, 0xFF, 0x00, 0x00); - // dot - rgb_matrix_set_color(72, 0x00, 0x00, 0xFF); - // math shit - rgb_matrix_set_color(26, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(27, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(28, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(43, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(46, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(60, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(61, 0x00, 0x00, 0xFF); - rgb_matrix_set_color(73, 0x00, 0x00, 0xFF); - break; - - case _FNC: { - HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v }; - HSV hui = hsv; - HSV hud = hsv; - HSV sai = hsv; - HSV sad = hsv; - HSV vai = hsv; - HSV vad = hsv; - hui.h = hsv.h + 8; - hud.h = hsv.h - 8; - sai.s = hsv.s + 16 > 255 ? 255u : hsv.s + 16; - sad.s = hsv.s - 16 < 0 ? 0 : hsv.s - 16; - vai.v = hsv.v + 16 > 255 ? 255 : hsv.v + 16; - vad.v = hsv.v - 16 < 0 ? 0 : hsv.v - 16; - RGB rgb = hsv_to_rgb(hsv); - RGB rgbHUI = hsv_to_rgb(hui); - RGB rgbHUD = hsv_to_rgb(hud); - RGB rgbSAI = hsv_to_rgb(sai); - RGB rgbSAD = hsv_to_rgb(sad); - RGB rgbVAI = hsv_to_rgb(vai); - RGB rgbVAD = hsv_to_rgb(vad); - rgb_matrix_set_color(81, 0xFF, 0xFF, 0xFF); // layer indicator - rgb_matrix_set_color(91, 0xFF, 0xFF, 0xFF); - rgb_matrix_set_color(93, 0x00, 0x00, 0x00); - rgb_matrix_set_color(94, rgb.r, rgb.g, rgb.b); - rgb_matrix_set_color(95, rgb.r, rgb.g, rgb.b); - rgb_matrix_set_color(96, 0x00, 0x00, 0x00); - rgb_matrix_set_color(68, 0xFF, 0x00, 0x00); // MD_BOOT - rgb_matrix_set_color(69, 0xFF, 0x00, 0x40); // TG_NKRO - rgb_matrix_set_color(32, 0x00, 0x80, 0xFF); // KC_VOLU - rgb_matrix_set_color(49, 0x00, 0x80, 0xFF); - rgb_matrix_set_color(13, 0xFF, 0x00, 0x00); // KC_MUTE - rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // KC_MSTP - rgb_matrix_set_color(47, 0xFF, 0x40, 0x00); // KC_MPRV - rgb_matrix_set_color(48, 0xFF, 0x40, 0x00); - rgb_matrix_set_color(14, 0x00, 0xFF, 0x00); // KC_MSEL - rgb_matrix_set_color(31, 0x00, 0xFF, 0x00); // KC_MPLY - - if (this_led & (1 << !autoshift_enabled)) { - rgb_matrix_set_color(15, 0xFF, 0x00, 0x00); // KC_ASTG - } else { - rgb_matrix_set_color(15, 0xFF, 0xFF, 0x00); - } - - rgb_matrix_set_color(44, 0xFF, 0x80, 0x00); //RGB_MOD - rgb_matrix_set_color(45, 0xFF, 0x80, 0x00); - rgb_matrix_set_color(34, 0xFF, 0x80, 0x00); //RGB_MOD - rgb_matrix_set_color(51, 0xFF, 0x80, 0x00); - rgb_matrix_set_color(63, 0xFF, 0x40, 0x00); //RGB_TOG - rgb_matrix_set_color(64, rgb.r, rgb.g, rgb.b); //MAS_TOG - rgb_matrix_set_color(36, rgbHUI.r, rgbHUI.g, rgbHUI.b); //RGB_HUI - rgb_matrix_set_color(53, rgbHUD.r, rgbHUD.g, rgbHUD.b); - rgb_matrix_set_color(37, rgbSAI.r, rgbSAI.g, rgbSAI.b); //RGB_SAI - rgb_matrix_set_color(54, rgbSAD.r, rgbSAD.g, rgbSAD.b); - rgb_matrix_set_color(38, rgbVAI.r, rgbVAI.g, rgbVAI.b); //RGB_VAI - rgb_matrix_set_color(55, rgbVAD.r, rgbVAD.g, rgbVAD.b); - rgb_matrix_set_color(79, rgb.r, rgb.g, rgb.b); // config display - rgb_matrix_set_color(75, rgbVAI.r, rgbVAI.g, rgbVAI.b); //RGB_VAI - rgb_matrix_set_color(85, rgbVAD.r, rgbVAD.g, rgbVAD.b); - rgb_matrix_set_color(35, 0x80, 0x80, 0x80); //RGB_SPI - rgb_matrix_set_color(52, 0x80, 0x80, 0x80); - rgb_matrix_set_color(84, 0x80, 0x80, 0x80); //RGB_SPI - rgb_matrix_set_color(86, 0x80, 0x80, 0x80); - rgb_matrix_set_color(41, 0xF0, 0x00, 0xFF); //MAS_MGT - rgb_matrix_set_color(42, 0x00, 0x02, 0xFF); //MAS_BLU - rgb_matrix_set_color(57, 0xFF, 0x00, 0x00); //MAS_RED - rgb_matrix_set_color(58, 0x00, 0x00, 0x00); //MAS_KEY - rgb_matrix_set_color(59, 0x00, 0xFF, 0xF7); //MAS_CYN - rgb_matrix_set_color(70, 0xFF, 0xDA, 0x00); //MAS_YEL - rgb_matrix_set_color(71, 0x00, 0xFF, 0x01); //MAS_GRN - rgb_matrix_set_color(72, 0xFF, 0xA5, 0x18); //MAS_CRM - rgb_matrix_set_color(60, 0x81, 0x3C, 0xFF); //MAS_PRP - rgb_matrix_set_color(43, 0xFF, 0xFF, 0xFF); //MAS_WHT - } - break; - } - } -} - -// Runs just one time when the keyboard initializes. -void matrix_init_user(void) -{ - autoshift_disable(); - rgb_matrix_sethsv(128, 255, 255); - // rgb_matrix_sethsv(192, 112, 255); - // rgb_matrix_mode(4); +#ifdef _______ +# undef _______ +# define _______ {0,0,0} + +const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = { + [_NL] = { + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, GOLD, GOLD, GOLD, GREEN, GREEN, GREEN, _______, _______, _______, _______, + _______, TEAL, CYAN, AZURE, CYAN, _______, _______, GOLD, RED, GOLD, GREEN, _______, _______, GREEN, _______, _______, _______, + WHITE, TEAL, AZURE, AZURE, AZURE, _______, _______, GOLD, GOLD, GOLD, GREEN, GREEN, _______, + _______, _______, _______, _______, _______, _______, RED, RED, RED, GREEN, GREEN, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + }, + [_FL] = { + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RED, GREEN, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RED, GREEN, AZURE, + _______, GOLD, CORAL, _______, _______, _______, _______, _______, MAGENT, BLUE, WHITE, GOLD, GOLD, _______, ORANGE, ORANGE, AZURE, + _______, GOLD, CORAL, _______, _______, _______, _______, RED, {1,0,0}, CYAN, M9B59B5, _______, _______, + _______, RED, _______, _______, _______, RED, PINK, YELLOW, GREEN, CREAM, _______, _______, _______, + _______, _______, _______, _______, _______, WHITE, _______, _______, CORAL, _______, CORAL + }, }; +# undef _______ +# define _______ KC_TRNS +#endif +// clang-format on -// Runs constantly in the background, in a loop. -void matrix_scan_user(void) -{ +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + rgb_enabled_flag = true; // Initially, keyboard RGB is enabled. Change to false config.h initializes RGB disabled. }; -#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) -#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) -#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"); - } +void keyboard_post_init_user(void) { rgb_matrix_enable(); } - 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 MAS_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_KEYLIGHT); - rgb_matrix_set_color_all(0, 0, 0); - } - break; - - case LED_FLAG_KEYLIGHT: { - 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); - } - break; - } - } - - return false; - - case MAS_CRM: - if (record->event.pressed) { - rgb_matrix_sethsv(32, 160, 255); - } - - return false; - - case MAS_PRP: - if (record->event.pressed) { - rgb_matrix_sethsv(192, 112, 255); - } - - return false; - - case MAS_RED: - if (record->event.pressed) { - rgb_matrix_sethsv(0, 255, 255); - } - - return false; - - case MAS_GRN: - if (record->event.pressed) { - rgb_matrix_sethsv(88, 255, 255); - } - - return false; - - case MAS_BLU: - if (record->event.pressed) { - rgb_matrix_sethsv(168, 255, 255); - } - - return false; - - case MAS_CYN: - if (record->event.pressed) { - rgb_matrix_sethsv(128, 255, 255); - } - - return false; - - case MAS_MGT: - if (record->event.pressed) { - rgb_matrix_sethsv(216, 255, 255); - } - - return false; - - case MAS_YEL: - if (record->event.pressed) { - rgb_matrix_sethsv(40, 255, 255); - } - - return false; - - case MAS_KEY: - if (record->event.pressed) { - rgb_matrix_sethsv(0, 0, 0); - } - - return false; - - case MAS_WHT: - if (record->event.pressed) { - rgb_matrix_sethsv(128, 0, 255); - } - - return false; +// Runs constantly in the background, in a loop. +void matrix_scan_user(void){}; + +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 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 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: + 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_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 MAS_CRM: + rgb_matrix_sethsv(HSV_CREAM); + return false; + case MAS_PRP: + rgb_matrix_sethsv(HSV_9B59B5); + return false; + case MAS_RED: + rgb_matrix_sethsv(HSV_RED); + return false; + case MAS_GRN: + rgb_matrix_sethsv(HSV_GREEN); + return false; + case MAS_BLU: + rgb_matrix_sethsv(HSV_BLUE); + return false; + case MAS_CYN: + rgb_matrix_sethsv(HSV_CYAN); + return false; + case MAS_MGT: + rgb_matrix_sethsv(HSV_MAGENTA); + return false; + case MAS_YEL: + rgb_matrix_sethsv(HSV_YELLOW); + return false; + case MAS_KEY: + rgb_matrix_sethsv(0, 0, 0); + return false; + case MAS_WHT: + rgb_matrix_sethsv(128, 0, 255); + return false; + default: + return true; // Process all other keycodes normally + } + } + return true; +} - default: - return true; //Process all other keycodes normally - } +void set_layer_color(int layer) { + if (layer == 0) { + return; + } + for (int i = 0; i < DRIVER_LED_TOTAL; 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 == _FL) { + HSV hsv2 = {rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + HSV hui = hsv2; + HSV hud = hsv2; + HSV sai = hsv2; + HSV sad = hsv2; + HSV vai = hsv2; + HSV vad = hsv2; + hui.h = hsv2.h + 8; + hud.h = hsv2.h - 8; + sai.s = hsv2.s + 16 > 255 ? 255 : hsv2.s + 16; + sad.s = hsv2.s - 16 < 0 ? 0 : hsv2.s - 16; + vai.v = hsv2.v + 16 > 255 ? 255 : hsv2.v + 16; + vad.v = hsv2.v - 16 < 0 ? 0 : hsv2.v - 16; + RGB rgbHUI = hsv_to_rgb(hui); + RGB rgbHUD = hsv_to_rgb(hud); + RGB rgbSAI = hsv_to_rgb(sai); + RGB rgbSAD = hsv_to_rgb(sad); + RGB rgbVAI = hsv_to_rgb(vai); + RGB rgbVAD = hsv_to_rgb(vad); + + switch (i) { + case 36: + rgb_matrix_set_color(i, rgbHUI.r, rgbHUI.g, rgbHUI.b); + break; + case 53: + rgb_matrix_set_color(i, rgbHUD.r, rgbHUD.g, rgbHUD.b); + break; + case 54: + rgb_matrix_set_color(i, rgbSAI.r, rgbSAI.g, rgbSAI.b); + break; + case 37: + rgb_matrix_set_color(i, rgbSAD.r, rgbSAD.g, rgbSAD.b); + break; + case 38: + rgb_matrix_set_color(i, rgbVAI.r, rgbVAI.g, rgbVAI.b); + break; + case 55: + rgb_matrix_set_color(i, rgbVAD.r, rgbVAD.g, rgbVAD.b); + break; + case 75: + rgb_matrix_set_color(i, rgbVAI.r, rgbVAI.g, rgbVAI.b); + break; + case 85: + rgb_matrix_set_color(i, rgbVAD.r, rgbVAD.g, rgbVAD.b); + break; + } + } + } } +void rgb_matrix_indicators_user(void) { + if (g_suspend_state || 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)); +} diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.h b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.h new file mode 100644 index 0000000000..e37f0d60f2 --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.h @@ -0,0 +1,86 @@ +/* +QMK Firmware Massdrop CTRL M-AS Keymap +Copyright (C) 2020 matthewrobo + +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 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include QMK_KEYBOARD_H + +// HID has not yet been implemented for this keyboard +// #include "raw_hid.h" + +#define MILLISECONDS_IN_SECOND 1000 + +// These are just to make it neater to use builtin HSV values in the keymap +// clang-format off +#define WHITE {HSV_WHITE} +#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} +#define HSV_CREAM 24, 240, 255 +#define CREAM {HSV_CREAM} +#define HSV_9B59B5 208, 192, 255 +#define M9B59B5 {HSV_9B59B5} +// clang-format on + +#define LT_CAPS LT(_NL, KC_CAPS) +#define _LAYER_ KC_TRNS + +//========================================================== CONFIGURABLE DEFAULTS ========================================================== +extern bool g_suspend_state; +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. + +enum layout_names { + _KL = 0, // Keys Layout: The main keyboard layout that has all the characters + _NL, // Navigation Layout: Cursor keys and numpad inputs + _FL, // Function Layout: The function key activated layout with default functions and some added ones +}; + +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 + MAS_CRM, + MAS_PRP, + MAS_RED, + MAS_GRN, + MAS_BLU, + MAS_CYN, + MAS_MGT, + MAS_YEL, + MAS_KEY, + MAS_WHT, +}; diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/readme.md b/keyboards/massdrop/ctrl/keymaps/matthewrobo/readme.md new file mode 100644 index 0000000000..380d078e2c --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/readme.md @@ -0,0 +1,14 @@ +# Massdrop CTRL - M-AS + +Based on the ["endgame" keymap](https://github.com/qmk/qmk_firmware/tree/master/keyboards/massdrop/ctrl/keymaps/endgame). + +## Layers + +### Base Layer +![Base Layer](https://i.imgur.com/qMXpYUb.png) + +### Navigation Layer +![Navigation Layer](https://i.imgur.com/RSp12Sh.png) + +### Function Layer +![Function Layer](https://i.imgur.com/dp7zs0I.png) diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/rgb_matrix_user.inc b/keyboards/massdrop/ctrl/keymaps/matthewrobo/rgb_matrix_user.inc new file mode 100644 index 0000000000..d837502ca5 --- /dev/null +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/rgb_matrix_user.inc @@ -0,0 +1,51 @@ +/* +QMK Firmware Massdrop CTRL M-AS Keymap +Copyright (C) 2020 matthewrobo + +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 3 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 . +*/ + +// !!! 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(SOLID_REACTIVE_WIDE2) +RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE2) +RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS2) +RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS2) + +// Step 2. +// Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +static HSV SOLID_REACTIVE_WIDE_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { + uint16_t effect = tick - dist > 255 || dist > 32 ? 255 : tick - dist; + hsv.v = qadd8(hsv.v, 255 - effect); + return hsv; +} + +static HSV SOLID_REACTIVE_NEXUS_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { + uint16_t effect = tick - dist > 255 || ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) ? 255 : tick - dist; + hsv.v = qadd8(hsv.v, 255 - effect); + hsv.h = rgb_matrix_config.hsv.h + dy / 4; + return hsv; +} + +bool SOLID_REACTIVE_WIDE2(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math2); } +bool SOLID_REACTIVE_MULTIWIDE2(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math2); } +bool SOLID_REACTIVE_NEXUS2(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math2); } +bool SOLID_REACTIVE_MULTINEXUS2(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math2); } + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk b/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk index 063d135a06..1eb11fded7 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/rules.mk @@ -1,3 +1,17 @@ -NKRO_ENABLE = yes # USB Nkey Rollover -AUTO_SHIFT_ENABLE = yes # Auto Shift -SRC += config_led.c +#RGBLIGHT_ENABLE = no #Not for MD boards.This is here in case you forget. +COMMAND_ENABLE = no # Commands for debug and configuration +#BOOTMAGIC_ENABLE = full #Virtual DIP switch configuration +#BOOTMAGIC_ENABLE = lite +#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 = no # 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. +TERMINAL_ENABLE = no +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 +RGB_MATRIX_CUSTOM_USER = yes -- cgit v1.2.3