3x5_3 Add RGB indicators to via keymap

Change RGB Matrix flags to Indicator on the pinky columns.
Add per-layer underglow colours for each layer.
Add caps lock indication on the pinky columns.
Add full red RGB on bootloader entry.
This commit is contained in:
casuanoob 2023-10-03 01:08:41 +11:00
parent cb9ede0fed
commit e49b98c3e6
6 changed files with 68 additions and 11 deletions

View File

@ -118,9 +118,9 @@
{"matrix": [0, 3], "x": 56, "y": 9, "flags": 4},
{"matrix": [0, 2], "x": 39, "y": 5, "flags": 4},
{"matrix": [0, 1], "x": 22, "y": 10, "flags": 4},
{"matrix": [0, 0], "x": 5, "y": 15, "flags": 4},
{"matrix": [0, 0], "x": 5, "y": 15, "flags": 1},
{"matrix": [1, 0], "x": 5, "y": 30, "flags": 4},
{"matrix": [1, 0], "x": 5, "y": 30, "flags": 1},
{"matrix": [1, 1], "x": 22, "y": 25, "flags": 4},
{"matrix": [1, 2], "x": 39, "y": 20, "flags": 4},
{"matrix": [1, 3], "x": 56, "y": 24, "flags": 4},
@ -130,7 +130,7 @@
{"matrix": [2, 3], "x": 56, "y": 39, "flags": 4},
{"matrix": [2, 2], "x": 39, "y": 35, "flags": 4},
{"matrix": [2, 1], "x": 22, "y": 40, "flags": 4},
{"matrix": [2, 0], "x": 5, "y": 45, "flags": 4},
{"matrix": [2, 0], "x": 5, "y": 45, "flags": 1},
{"matrix": [3, 2], "x": 45, "y": 51, "flags": 4},
{"matrix": [3, 0], "x": 64, "y": 53, "flags": 4},
@ -163,9 +163,9 @@
{"matrix": [4, 3], "x": 168, "y": 9, "flags": 4},
{"matrix": [4, 2], "x": 185, "y": 5, "flags": 4},
{"matrix": [4, 1], "x": 202, "y": 10, "flags": 4},
{"matrix": [4, 0], "x": 219, "y": 15, "flags": 4},
{"matrix": [4, 0], "x": 219, "y": 15, "flags": 1},
{"matrix": [5, 0], "x": 219, "y": 30, "flags": 4},
{"matrix": [5, 0], "x": 219, "y": 30, "flags": 1},
{"matrix": [5, 1], "x": 202, "y": 25, "flags": 4},
{"matrix": [5, 2], "x": 185, "y": 20, "flags": 4},
{"matrix": [5, 3], "x": 168, "y": 24, "flags": 4},
@ -175,7 +175,7 @@
{"matrix": [6, 3], "x": 168, "y": 39, "flags": 4},
{"matrix": [6, 2], "x": 185, "y": 35, "flags": 4},
{"matrix": [6, 1], "x": 202, "y": 40, "flags": 4},
{"matrix": [6, 0], "x": 219, "y": 45, "flags": 4},
{"matrix": [6, 0], "x": 219, "y": 45, "flags": 1},
{"matrix": [7, 2], "x": 179, "y": 51, "flags": 4},
{"matrix": [7, 0], "x": 160, "y": 53, "flags": 4},

View File

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "keycodes.h"
#include QMK_KEYBOARD_H
enum dilemma_keymap_layers {

View File

@ -1 +0,0 @@
# Dilemma 3x5+3 default keymap

View File

@ -195,6 +195,58 @@ layer_state_t layer_state_set_user(layer_state_t state) {
# endif // DILEMMA_AUTO_SNIPING_ON_LAYER
#endif // POINTING_DEVICE_ENABLE
#ifdef RGB_MATRIX_ENABLE
// Forward-declare this helper function since it is defined in rgb_matrix.c.
void rgb_matrix_update_pwm_buffers(void);
// Layer state indicator
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (host_keyboard_led_state().caps_lock) {
for (int i = led_min; i <= led_max; i++) {
if (g_led_config.flags[i] & LED_FLAG_MODIFIER) {
rgb_matrix_set_color(i, RGB_RED);
}
}
}
uint8_t layer = get_highest_layer(layer_state);
if (layer > 0) {
RGB rgb;
switch (get_highest_layer(layer_state)) {
case 1:
rgb = (RGB){RGB_BLUE};
break;
case 2:
rgb = (RGB){RGB_CORAL};
break;
case 3:
rgb = (RGB){RGB_GREEN};
break;
case 4:
rgb = (RGB){RGB_YELLOW};
break;
case 5:
rgb = (RGB){RGB_PINK};
break;
case 6:
rgb = (RGB){RGB_MAGENTA};
break;
case 7:
default:
rgb = (RGB){RGB_RED};
break;
};
for (int i = led_min; i <= led_max; i++) {
if ( g_led_config.flags[i] & LED_FLAG_UNDERGLOW) {
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
};
}
return false;
};
#endif // RGB_MATRIX_ENABLE
#ifdef ENCODER_MAP_ENABLE
// clang-format off
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
@ -206,4 +258,12 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[LAYER_SYMBOLS] = {ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_LEFT, KC_RGHT)},
};
// clang-format on
#endif // ENCODER_MAP_ENABLE
#endif // ENCODER_MAP_ENABL
void shutdown_user(void) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_sethsv_noeeprom(HSV_RED);
rgb_matrix_update_pwm_buffers();
#endif // RGB_MATRIX_ENABLE
}

View File

@ -1,2 +1,2 @@
ENCODER_MAP_ENABLE = yes
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -2,7 +2,6 @@
* Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
* Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
* Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
* Copyright 2023 casuanoob <casuanoob@hotmail.com> (@casuanoob)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Publicw License as published by