diff options
| author | eatmyvenom <eat.my.venomm@gmail.com> | 2023-05-06 13:32:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-06 14:32:51 -0600 |
| commit | db229d7341ae0b0f04a25870350b817cfb966943 (patch) | |
| tree | 0d1d00d1957fa997ea5b684804e34380836d6f90 /users | |
| parent | 88780bf710a0f9a3a204d0feebac90755a2f3fff (diff) | |
Add vnmm keymaps and userspace (#20446)
Co-authored-by: Pablo MartÃnez <58857054+elpekenin@users.noreply.github.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users')
| -rw-r--r-- | users/vnmm/config.h | 70 | ||||
| -rw-r--r-- | users/vnmm/keymap_user.h | 41 | ||||
| -rw-r--r-- | users/vnmm/readme.md | 10 | ||||
| -rw-r--r-- | users/vnmm/rgb_matrix_user.c | 140 | ||||
| -rw-r--r-- | users/vnmm/rgb_matrix_user.h | 28 | ||||
| -rw-r--r-- | users/vnmm/rules.mk | 5 | ||||
| -rw-r--r-- | users/vnmm/vnmm.c | 23 | ||||
| -rw-r--r-- | users/vnmm/vnmm.h | 21 |
8 files changed, 338 insertions, 0 deletions
diff --git a/users/vnmm/config.h b/users/vnmm/config.h new file mode 100644 index 0000000000..3642c5784c --- /dev/null +++ b/users/vnmm/config.h | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software: you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License as published by | ||
| 4 | * the Free Software Foundation, either version 2 of the License, or | ||
| 5 | * (at your option) any later version. | ||
| 6 | * | ||
| 7 | * This program is distributed in the hope that it will be useful, | ||
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 10 | * GNU General Public License for more details. | ||
| 11 | * | ||
| 12 | * You should have received a copy of the GNU General Public License | ||
| 13 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #pragma once | ||
| 17 | |||
| 18 | // All of these config options can be changed by keyboard in their config.h | ||
| 19 | // These are all just the defaults I like for most of my keyboards | ||
| 20 | |||
| 21 | #ifndef RGB_MATRIX_TIMEOUT | ||
| 22 | // If the keyboard is unused for 20 minutes then just turn off RGB | ||
| 23 | # define RGB_MATRIX_TIMEOUT 1200000 // 20 minutes (20 * 60 * 1000ms) | ||
| 24 | |||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifndef CAPS_LOCK_INDICATOR_COLOR | ||
| 28 | // When caps lock is pressed, the letter keys, caps lock, and both shift keys, will light up this color. | ||
| 29 | # define CAPS_LOCK_INDICATOR_COLOR RGB_RED | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #ifndef SHIFT_INDICATOR_COLOR | ||
| 33 | // If defined also light up alphabet keys when either shift is held | ||
| 34 | # define SHIFT_INDICATOR_COLOR RGB_WHITE | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #ifndef CAPS_LOCK_INDICATOR_OTHER | ||
| 38 | // When caps lock is pressed, all other keys will light up this color | ||
| 39 | // #define CAPS_LOCK_INDICATOR_OTHER RGB_WHITE | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #ifndef CAPS_LOCK_INDICATOR_LIGHT_ALPHAS | ||
| 43 | // All alphabet keys will light up, othe rwise just caps lock. | ||
| 44 | # define CAPS_LOCK_INDICATOR_LIGHT_ALPHAS | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifndef FN_LAYER_TRANSPARENT_KEYS_COLOR | ||
| 48 | // Keys not defined in the current layer will use this color | ||
| 49 | # define FN_LAYER_TRANSPARENT_KEYS_COLOR RGB_OFF | ||
| 50 | #endif | ||
| 51 | |||
| 52 | // Keys defined in the current layer will use this color | ||
| 53 | #ifndef FN_LAYER_KEYS_COLOR | ||
| 54 | // #define FN_LAYER_KEYS_COLOR RGB_WHITE | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #ifndef CURRENT_LAYER_INDICATOR_COLOR | ||
| 58 | // If a key on a FN layer changes the default layer to the current layer, light up this color | ||
| 59 | # define CURRENT_LAYER_INDICATOR_COLOR RGB_WHITE | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #ifndef NKRO_INDICATOR_COLOR | ||
| 63 | // If NKRO is enabled, the key on the fn layer that toggles it will light up this color | ||
| 64 | # define NKRO_INDICATOR_COLOR RGB_WHITE | ||
| 65 | #endif | ||
| 66 | |||
| 67 | // Don't light up my whole room when the pc is asleep | ||
| 68 | #ifndef RGB_DISABLE_WHEN_USB_SUSPENDED | ||
| 69 | # define RGB_DISABLE_WHEN_USB_SUSPENDED | ||
| 70 | #endif | ||
diff --git a/users/vnmm/keymap_user.h b/users/vnmm/keymap_user.h new file mode 100644 index 0000000000..2262910bcc --- /dev/null +++ b/users/vnmm/keymap_user.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* Copyright 2021 | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #ifdef DYNAMIC_KEYMAP_LAYER_COUNT | ||
| 20 | #undef DYNAMIC_KEYMAP_LAYER_COUNT | ||
| 21 | #endif | ||
| 22 | #define DYNAMIC_KEYMAP_LAYER_COUNT 5 | ||
| 23 | |||
| 24 | #define WIN_F MO(WIN_FN) | ||
| 25 | #define MAC_F MO(MAC_FN) | ||
| 26 | #define EXT_F MO(EXTRA_FN) | ||
| 27 | |||
| 28 | #define DF_WIN DF(WIN_BASE) | ||
| 29 | #define DF_MAC DF(MAC_BASE) | ||
| 30 | |||
| 31 | // clang-format off | ||
| 32 | |||
| 33 | enum layers { | ||
| 34 | WIN_BASE, | ||
| 35 | MAC_BASE, | ||
| 36 | WIN_FN, | ||
| 37 | MAC_FN, | ||
| 38 | EXTRA_FN | ||
| 39 | }; | ||
| 40 | |||
| 41 | // clang-format on | ||
diff --git a/users/vnmm/readme.md b/users/vnmm/readme.md new file mode 100644 index 0000000000..637e92c063 --- /dev/null +++ b/users/vnmm/readme.md | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # Vnmm's stuff | ||
| 2 | |||
| 3 | This keymap builds on archrovisual's but with some changes and uses the default key placements | ||
| 4 | |||
| 5 | ## Features | ||
| 6 | |||
| 7 | - Alphabet keys light up red when caps lock is on or shift is on | ||
| 8 | - Pressing FN shows keys that have a definition | ||
| 9 | - Via enabled | ||
| 10 | - Quick reset with fn+space | ||
diff --git a/users/vnmm/rgb_matrix_user.c b/users/vnmm/rgb_matrix_user.c new file mode 100644 index 0000000000..c85f86782e --- /dev/null +++ b/users/vnmm/rgb_matrix_user.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | #include "rgb_matrix_user.h" | ||
| 19 | #include "keymap_user.h" | ||
| 20 | |||
| 21 | keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; | ||
| 22 | |||
| 23 | #ifdef SHIFT_INDICATOR_COLOR | ||
| 24 | # define is_shift_pressed (get_mods() & MOD_MASK_SHIFT) | ||
| 25 | #else | ||
| 26 | # define is_shift_pressed false | ||
| 27 | #endif | ||
| 28 | |||
| 29 | void rgb_matrix_init_user(void) { | ||
| 30 | // Set up led_index_key_position | ||
| 31 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 32 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
| 33 | uint8_t led_index = g_led_config.matrix_co[row][col]; | ||
| 34 | if (led_index != NO_LED) { | ||
| 35 | led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | ||
| 42 | uint8_t current_layer = get_highest_layer(layer_state); | ||
| 43 | bool caps = host_keyboard_led_state().caps_lock; | ||
| 44 | switch (current_layer) { | ||
| 45 | case WIN_BASE: | ||
| 46 | case MAC_BASE: | ||
| 47 | // Light up letters if caps and light up letters and numbers if shift. If shift and caps light up just numbers. | ||
| 48 | #ifdef CAPS_LOCK_INDICATOR_COLOR | ||
| 49 | if (caps && !is_shift_pressed) { | ||
| 50 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); | ||
| 51 | # ifdef CAPS_LOCK_INDICATOR_OTHER | ||
| 52 | rgb_matrix_set_color_by_not_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_OTHER); | ||
| 53 | # endif | ||
| 54 | } | ||
| 55 | # ifdef SHIFT_INDICATOR_COLOR | ||
| 56 | else if (is_shift_pressed && !caps) { | ||
| 57 | // Light up letters and other shift affected keys | ||
| 58 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_shift_indicator, SHIFT_INDICATOR_COLOR); | ||
| 59 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); | ||
| 60 | } else if (is_shift_pressed && caps) { | ||
| 61 | // Only shift affected keys light up | ||
| 62 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_shift_indicator, SHIFT_INDICATOR_COLOR); | ||
| 63 | } | ||
| 64 | # endif // SHIFT_INDICATOR_COLOR | ||
| 65 | #endif // CAPS_LOCK_INDICATOR_COLOR | ||
| 66 | break; | ||
| 67 | default: | ||
| 68 | #ifdef FN_LAYER_TRANSPARENT_KEYS_COLOR | ||
| 69 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, FN_LAYER_TRANSPARENT_KEYS_COLOR); | ||
| 70 | #endif | ||
| 71 | #ifdef FN_LAYER_KEYS_COLOR | ||
| 72 | rgb_matrix_set_color_by_not_keycode(led_min, led_max, current_layer, is_transparent, FN_LAYER_KEYS_COLOR); | ||
| 73 | #endif | ||
| 74 | #ifdef CURRENT_LAYER_INDICATOR_COLOR | ||
| 75 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_default_layer, CURRENT_LAYER_INDICATOR_COLOR); | ||
| 76 | #endif | ||
| 77 | #ifdef NKRO_INDICATOR_COLOR | ||
| 78 | if (keymap_config.nkro) { | ||
| 79 | rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_nkro_indicator, NKRO_INDICATOR_COLOR); | ||
| 80 | } | ||
| 81 | #endif | ||
| 82 | break; | ||
| 83 | } | ||
| 84 | return false; | ||
| 85 | } | ||
| 86 | |||
| 87 | // set color of keys that match the keycode | ||
| 88 | void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { | ||
| 89 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 90 | uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); | ||
| 91 | if ((*is_keycode)(keycode)) { | ||
| 92 | rgb_matrix_set_color(i, red, green, blue); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | // set color of all leds that are not a certain keycode | ||
| 98 | void rgb_matrix_set_color_by_not_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { | ||
| 99 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 100 | uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); | ||
| 101 | if (!(*is_keycode)(keycode)) { | ||
| 102 | rgb_matrix_set_color(i, red, green, blue); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | } | ||
| 106 | |||
| 107 | // check if keycode is a letter or shift or caps lock | ||
| 108 | bool is_caps_lock_indicator(uint16_t keycode) { | ||
| 109 | #ifdef CAPS_LOCK_INDICATOR_LIGHT_ALPHAS | ||
| 110 | return (KC_A <= keycode && keycode <= KC_Z) || keycode == KC_CAPS || keycode == KC_LSFT || keycode == KC_RSFT; | ||
| 111 | #else | ||
| 112 | return keycode == KC_CAPS; | ||
| 113 | #endif | ||
| 114 | } | ||
| 115 | |||
| 116 | // check if keycode is the DF to default layer | ||
| 117 | #ifdef CURRENT_LAYER_INDICATOR_COLOR | ||
| 118 | bool is_default_layer(uint16_t keycode) { | ||
| 119 | return keycode == DF(get_highest_layer(default_layer_state)); | ||
| 120 | } | ||
| 121 | #endif | ||
| 122 | |||
| 123 | // check if keycode is the NKRO toggle | ||
| 124 | #ifdef NKRO_INDICATOR_COLOR | ||
| 125 | bool is_nkro_indicator(uint16_t keycode) { | ||
| 126 | return keycode == NK_TOGG; | ||
| 127 | } | ||
| 128 | #endif | ||
| 129 | |||
| 130 | // check if keycode is transparent | ||
| 131 | bool is_transparent(uint16_t keycode) { | ||
| 132 | return keycode == KC_TRNS; | ||
| 133 | } | ||
| 134 | |||
| 135 | // check if keycode is affected by shift on the number row | ||
| 136 | #ifdef SHIFT_INDICATOR_COLOR | ||
| 137 | bool is_shift_indicator(uint16_t keycode) { | ||
| 138 | return (KC_1 <= keycode && keycode <= KC_0) || keycode == KC_MINS || keycode == KC_EQL || keycode == KC_GRV || keycode == KC_BSLS || keycode == KC_LBRC || keycode == KC_RBRC || keycode == KC_SCLN || keycode == KC_QUOT || keycode == KC_COMM || keycode == KC_DOT || keycode == KC_SLSH || keycode == QK_GESC || keycode == KC_LSFT || keycode == KC_RSFT; | ||
| 139 | } | ||
| 140 | #endif | ||
diff --git a/users/vnmm/rgb_matrix_user.h b/users/vnmm/rgb_matrix_user.h new file mode 100644 index 0000000000..7fe3d8229a --- /dev/null +++ b/users/vnmm/rgb_matrix_user.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | void rgb_matrix_init_user(void); | ||
| 20 | |||
| 21 | void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); | ||
| 22 | void rgb_matrix_set_color_by_not_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); | ||
| 23 | |||
| 24 | bool is_default_layer(uint16_t keycode); | ||
| 25 | bool is_nkro_indicator(uint16_t keycode); | ||
| 26 | bool is_caps_lock_indicator(uint16_t keycode); | ||
| 27 | bool is_transparent(uint16_t keycode); | ||
| 28 | bool is_shift_indicator(uint16_t keycode); | ||
diff --git a/users/vnmm/rules.mk b/users/vnmm/rules.mk new file mode 100644 index 0000000000..2b601fd3e5 --- /dev/null +++ b/users/vnmm/rules.mk | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | SRC += vnmm.c | ||
| 2 | |||
| 3 | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | ||
| 4 | SRC += rgb_matrix_user.c | ||
| 5 | endif | ||
diff --git a/users/vnmm/vnmm.c b/users/vnmm/vnmm.c new file mode 100644 index 0000000000..a4d4a7928e --- /dev/null +++ b/users/vnmm/vnmm.c | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "vnmm.h" | ||
| 18 | |||
| 19 | void keyboard_post_init_user(void) { | ||
| 20 | #ifdef RGB_MATRIX_ENABLE | ||
| 21 | rgb_matrix_init_user(); | ||
| 22 | #endif | ||
| 23 | } \ No newline at end of file | ||
diff --git a/users/vnmm/vnmm.h b/users/vnmm/vnmm.h new file mode 100644 index 0000000000..03723c3deb --- /dev/null +++ b/users/vnmm/vnmm.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 18 | #include "keymap_user.h" | ||
| 19 | #ifdef RGB_MATRIX_ENABLE | ||
| 20 | # include "rgb_matrix_user.h" | ||
| 21 | #endif \ No newline at end of file | ||
