config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

commit cc23e1b4597409093dcbf6c45891c0fe91dc8136
parent c8e30c2004b25f859ed6e7046ed8aa7d62c05282
Author: dwrz <dwrz@dwrz.net>
Date:   Tue,  9 Apr 2024 17:19:30 +0000

Update keymap

Diffstat:
Mqmk/equals48/keymap.c | 92++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
Mqmk/equals48/rules.mk | 1+
2 files changed, 64 insertions(+), 29 deletions(-)

diff --git a/qmk/equals48/keymap.c b/qmk/equals48/keymap.c @@ -1,25 +1,32 @@ #include QMK_KEYBOARD_H +#define LT_FUN LT(_FUNC, KC_MENU) #define LT_MOU LT(_MOUSE, KC_COMM) #define LT_NAV LT(_NAV, KC_A) #define LT_NUM LT(_NUM, KC_E) #define LT_SYM LT(_SYMBOL, KC_O) +#define RED 0 +#define YELLOW 43 +#define PURPLE 191 +#define GREEN 85 +#define BLUE 170 + enum layers { - _MAIN, - _NAV, - _MOUSE, - _NUM, - _SYMBOL, - _FUNC, + _MAIN, + _NAV, + _MOUSE, + _NUM, + _SYMBOL, + _FUNC, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_MAIN] = LAYOUT_ortho_4x12( - KC_ESC, KC_QUOT, LT_MOU, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, - KC_TAB, LT_NAV, LT_SYM, LT_NUM, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT, - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINS, - TG(_FUNC), KC_ALGR, KC_HYPR, KC_LALT, KC_LGUI, KC_BSPC, KC_SPC, KC_RCTL, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN + KC_ESC, KC_QUOT, LT_MOU, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, + KC_TAB, LT_NAV, LT_SYM, LT_NUM, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINS, + KC_HYPR, KC_ALGR, LT_FUN, KC_LALT, KC_LGUI, KC_BSPC, KC_SPC, KC_RCTL, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN ), [_NAV] = LAYOUT_ortho_4x12( KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_UP, KC_END, KC_PGUP, @@ -46,10 +53,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_NO, KC_NO, KC_NO, KC_LGUI, KC_NO, KC_NO, KC_ASTR, KC_SLSH, KC_ASTR, KC_PLUS, KC_MINS ), [_FUNC] = LAYOUT_ortho_4x12( - 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_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, - RGB_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_NO, KC_MUTE, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_VOLU, KC_VOLD + 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_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + RGB_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_NO, KC_MUTE, + KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_VOLU, KC_VOLD ), }; @@ -106,37 +113,69 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // KC_LAUNCHPAD KC_LPAD Open Launchpad // https://docs.qmk.fm/#/feature_rgb_matrix -void set_led_color(uint8_t i, uint8_t highest_layer, bool unused) { +void set_led_color(uint8_t layer, + uint8_t row, + uint8_t col, + uint8_t led_min, + uint8_t led_max) { + uint8_t i = g_led_config.matrix_co[row][col]; + if (i >= led_min && i < led_max && i == NO_LED) { + return; + } + + bool unused = keymap_key_to_keycode(layer, (keypos_t){col,row}) <= KC_TRNS; if (unused) { rgb_matrix_set_color(i, RGB_OFF); return; } // Determine the hue and value of the layer. - HSV hsv = {0, 255, 0}; + HSV hsv = {0, 0, 0}; // Limit brightness to current value. hsv.v = rgb_matrix_get_val(); // Set the color (hue and saturation). - switch (highest_layer) { + switch (layer) { case _NAV: - hsv.h = 0; // RED + hsv.h = RED; + hsv.s = 255; break; case _MOUSE: - hsv.h = 43; // YELLOW + hsv.h = YELLOW; + hsv.s = 255; break; case _NUM: - hsv.h = 85; // GREEN + hsv.h = GREEN; + hsv.s = 255; break; case _SYMBOL: - hsv.h = 191; // PURPLE + hsv.h = PURPLE; + hsv.s = 255; break; case _FUNC: - hsv.h = 170; // BLUE + hsv.h = BLUE; + hsv.s = 255; break; default: - hsv.s = 0; + if (keymap_key_to_keycode(layer, (keypos_t){col,row}) == LT_NAV) { + hsv.h = RED; + hsv.s = 255; + } else if (keymap_key_to_keycode(layer, (keypos_t){col,row}) == LT_MOU) { + hsv.h = YELLOW; + hsv.s = 255; + } else if (keymap_key_to_keycode(layer, (keypos_t){col,row}) == LT_SYM) { + hsv.h = PURPLE; + hsv.s = 255; + } else if (keymap_key_to_keycode(layer, (keypos_t){col,row}) == LT_NUM) { + hsv.h = GREEN; + hsv.s = 255; + } else if (keymap_key_to_keycode(layer, (keypos_t){col,row}) == LT_FUN) { + hsv.h = BLUE; + hsv.s = 255; + } else { + hsv.s = 0; + } } RGB rgb = hsv_to_rgb(hsv); @@ -149,14 +188,9 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { return false; } - uint8_t highest_layer = get_highest_layer(layer_state | default_layer_state); for (uint8_t row = 0; row < MATRIX_ROWS; ++row) { for (uint8_t col = 0; col < MATRIX_COLS; ++col) { - uint8_t i = g_led_config.matrix_co[row][col]; - if (i >= led_min && i < led_max && i != NO_LED) { - bool unused = keymap_key_to_keycode(layer, (keypos_t){col,row}) <= KC_TRNS; - set_led_color(i, highest_layer, unused); - } + set_led_color(layer, row, col, led_min, led_max); } } diff --git a/qmk/equals48/rules.mk b/qmk/equals48/rules.mk @@ -1,3 +1,4 @@ +# CONSOLE_ENABLE = yes # REPEAT_KEY_ENABLE = yes CAPS_WORD_ENABLE = yes MOUSEKEY_ENABLE = yes