1
0
Fork 0

Fix Per Key LED Indicator Callbacks (#18450)

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
Drashna Jael're 2022-10-04 15:24:22 -07:00 committed by GitHub
parent 09d3e27710
commit 64b1ed4550
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
218 changed files with 1430 additions and 1271 deletions

View file

@ -253,7 +253,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
#ifdef RGB_MATRIX_ENABLE
void rgb_matrix_indicators_user() {
bool rgb_matrix_indicators_user(void) {
if (effect_started_time > 0) {
/* Render blinking EFFECTS */
const uint16_t deltaTime = sync_timer_elapsed(effect_started_time);
@ -289,6 +289,7 @@ void rgb_matrix_indicators_user() {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds();
}
return false;
}
static void start_effects() {

View file

@ -76,7 +76,7 @@ void keyboard_post_init_user(void) {
val = rgb_matrix_get_val();
}
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color_all(val,0,0);
@ -84,4 +84,5 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
rgb_matrix_set_color_all(val, val, val);
val = rgb_matrix_get_val();
}
return false;
}

View file

@ -99,7 +99,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return false;
}
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
switch(get_highest_layer(layer_state)) {
// special handling per layer
case 0: //layer one
@ -124,4 +124,5 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
default:
break;
}
return false;
}

View file

@ -111,7 +111,7 @@ static void set_rgb_wlck_leds() {
rgb_matrix_set_color(92, 0x77, 0xFF, 0x77); // Right side LED 8
}
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
set_rgb_caps_leds();
}
@ -121,6 +121,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (keymap_config.no_gui) {
set_rgb_wlck_leds();
}
return false;
}
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {

View file

@ -107,7 +107,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}
// Capslock, Scroll lock and Numlock indicator on Left side lights.
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
loop_colorset(LED_REGION_A, ARRAY_SIZE(LED_REGION_A),
hsv_cl_blue);
loop_colorset(LED_REGION_B, ARRAY_SIZE(LED_REGION_B),
@ -158,5 +158,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
loop_colorset(LED_REGION_CAPS, ARRAY_SIZE(LED_REGION_CAPS),
hsv_cl_bad);
}
return false;
}
#endif

View file

@ -56,7 +56,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return false;
}
void rgb_matrix_indicators_user(void) {
bool rgb_matrix_indicators_user(void) {
if (IS_LAYER_ON(_TRAN)) {
rgb_matrix_set_color_all(_TRAN_COLOR_RGB);
} else if (IS_LAYER_ON(_GAME)) {
@ -72,4 +72,5 @@ void rgb_matrix_indicators_user(void) {
}
}
}
return false;
}

View file

@ -242,7 +242,7 @@ void hurt_paddle(void) {
#endif //GAME_ENABLE
// Capslock, Scroll lock and Numlock indicator on Left side lights.
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
// Scroll Lock RGB setup
@ -359,7 +359,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
#endif // GAME_ENABLE
// System NumLock warning indicator RGB setup
#ifdef INVERT_NUMLOCK_INDICATOR
#ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2);
}
@ -431,7 +431,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// Numpad & Mouse Keys overlay RGB
case _NUMPADMOUSE:
#ifdef INVERT_NUMLOCK_INDICATOR
#ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2);
}
@ -699,6 +699,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
#endif //GAME_ENABLE
break;
}
return false;
}
#endif
@ -707,4 +708,4 @@ void keyboard_post_init_keymap(void) {
#ifdef RGB_MATRIX_ENABLE
activate_rgb_nightmode(false); // Set to true if you want to startup in nightmode, otherwise use Fn + Z to toggle
#endif
}
}

View file

@ -220,7 +220,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
void rgb_matrix_indicators_user() {
bool rgb_matrix_indicators_user() {
#if RGB_CONFIRMATION_BLINKING_TIME > 0
if (effect_started_time > 0) {
/* Render blinking EFFECTS */
@ -258,6 +258,7 @@ void rgb_matrix_indicators_user() {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds();
}
return false;
}
#if RGB_CONFIRMATION_BLINKING_TIME > 0

View file

@ -119,7 +119,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE
// Capslock, Scroll lock and Numlock indicator on Left side lights.
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) {
rgb_matrix_set_color(LED_L1, RGB_GREEN);
@ -188,14 +188,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
default:
break;
}
}
void suspend_power_down_user(void) {
rgb_matrix_set_suspend_state(true);
}
void suspend_wakeup_init_user(void) {
rgb_matrix_set_suspend_state(false);
return false;
}
#endif

View file

@ -80,12 +80,13 @@ static void set_rgb_side_leds() {
rgb_matrix_set_color(92, RGB_WHITE); // Right side LED 8
}
void rgb_matrix_indicators_user() {
bool rgb_matrix_indicators_user() {
rgb_matrix_set_color_all(0x0, 0x0, 0x0);
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color(3, RGB_WHITE); // CAPS
}
set_rgb_side_leds();
return false;
}
#endif
#endif

View file

@ -372,7 +372,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}
void rgb_matrix_indicators_user() {
bool rgb_matrix_indicators_user(void) {
#if RGB_CONFIRMATION_BLINKING_TIME > 0
if (effect_started_time > 0) {
/* Render blinking EFFECTS */
@ -410,6 +410,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds();
}
return false;
}
#if RGB_CONFIRMATION_BLINKING_TIME > 0

View file

@ -79,7 +79,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
// Runs constantly in the background, in a loop.
void rgb_matrix_indicators_user(void) {
bool rgb_matrix_indicators_user(void) {
if (rgb_matrix_get_flags() & (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER)) {
if (IS_LAYER_ON(_UTILITY)) {
@ -108,6 +108,7 @@ void rgb_matrix_indicators_user(void) {
}
}
return false;
}

View file

@ -19,7 +19,7 @@
static bool wpm_rgb_enabled = false;
static uint8_t rgb_mode;
void rgb_matrix_indicators_keymap(void) {
bool rgb_matrix_indicators_keymap(void) {
if (wpm_rgb_enabled && rgb_matrix_is_enabled()) {
uint8_t wpm = get_current_wpm();
dprintf("WPM = %d\n", wpm);
@ -28,6 +28,7 @@ void rgb_matrix_indicators_keymap(void) {
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color_all(rgb.r, rgb.g, rgb.b);
}
return false;
}
bool process_record_fun(uint16_t keycode, keyrecord_t *record) {

View file

@ -51,7 +51,7 @@ void suspend_wakeup_init_user(void) {
}
#ifdef RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
// Turn on sideglow when CAPS LOCK is activated
if (host_keyboard_led_state().caps_lock) {
HSV hsv = {CAPS_LOCK_COLOR};
@ -64,5 +64,6 @@ void rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
}
}
}
return false;
}
#endif // RGB_MATRIX_ENABLE

View file

@ -15,9 +15,9 @@
*/
#include "rgb_matrix_ledmaps.h"
__attribute__((weak)) void rgb_matrix_indicators_keymap(void) { return; }
__attribute__((weak)) void rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
return;
__attribute__((weak)) bool rgb_matrix_indicators_keymap(void) { return true; }
__attribute__((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
return true;
}
#ifdef RGB_MATRIX_LEDMAPS_ENABLED
@ -26,15 +26,15 @@ static bool enabled = true;
#endif // RGB_MATRIX_LEDMAPS_ENABLED
void rgb_matrix_indicators_user(void) { rgb_matrix_indicators_keymap(); }
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_user(void) { return rgb_matrix_indicators_keymap(); }
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
#ifdef RGB_MATRIX_LEDMAPS_ENABLED
if (rgb_matrix_is_enabled() && enabled) {
set_layer_rgb(led_min, led_max, get_highest_layer(layer_state | default_layer_state));
}
#endif // RGB_MATRIX_LEDMAPS_ENABLED
rgb_matrix_indicators_advanced_keymap(led_min, led_max);
return rgb_matrix_indicators_advanced_keymap(led_min, led_max);
}
#ifdef RGB_MATRIX_LEDMAPS_ENABLED

View file

@ -96,5 +96,5 @@ void rgb_matrix_layers_disable(void);
#endif // RGB_MATRIX_LEDMAPS_ENABLED
void rgb_matrix_indicators_keymap(void);
void rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max);
bool rgb_matrix_indicators_keymap(void);
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max);

View file

@ -77,11 +77,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_FN1] = LAYOUT(
KC_SLEP, KC_MYCM, KC_WHOM, KC_CALC, KC_MSEL, KC_MPRV, KC_MNXT, KC_MPLY, KC_MSTP, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_INS, _______,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_HUI, _______, RGB_M_P,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, TO(_MO2), RGB_SAD, RGB_SAI, QK_BOOT, RGB_M_B,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_MOD, _______, RGB_M_R,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_M_SW,
KC_SLEP, KC_MYCM, KC_WHOM, KC_CALC, KC_MSEL, KC_MPRV, KC_MNXT, KC_MPLY, KC_MSTP, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_INS, _______,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_HUI, _______, RGB_M_P,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, TO(_MO2), RGB_SAD, RGB_SAI, QK_BOOT, RGB_M_B,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_MOD, _______, RGB_M_R,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_M_SW,
_______, KC_WINLK, _______, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI
),
@ -180,7 +180,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}
// Capslock, Scroll lock and Numlock indicator on Left side lights.
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
switch(get_highest_layer(layer_state)) {
case _FN1:
// Light up FN layer keys
@ -201,11 +201,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
if (rgb_value.g > 0) { --rgb_value.g; }
else { ++rgb_value.r; }
}
for (uint8_t i=0; i<ARRAY_SIZE(LED_RGB); i++) {
rgb_matrix_set_color(LED_RGB[i], rgb_value.r, rgb_value.g, rgb_value.b);
}
for (uint8_t i=0; i<ARRAY_SIZE(LED_WHITE); i++) {
rgb_matrix_set_color(LED_WHITE[i], RGB_WHITE);
}
@ -459,6 +459,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
if (keymap_config.no_gui) {
rgb_matrix_set_color(LED_LWIN, RGB_RED); //light up Win key when disabled
}
return false;
}
#endif

View file

@ -218,7 +218,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void rgb_matrix_indicators_user(void) {
bool rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds_on();
} else {
@ -233,6 +233,7 @@ void rgb_matrix_indicators_user(void) {
set_rgb_scroll_leds_off();
}
}
return false;
}
// RGB led number layout, function of the key

View file

@ -54,7 +54,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
// 80, led 05 4, Sh_L 10, Z 16, X 22, C 27, V 32, B 38, N 43, M 48, ,< 54, .< 60, /? 90, Sh_R 94, Up 82, End 81, led 16
// 83, led 06 5, Ct_L 11,Win_L 17, Alt_L 33, SPACE 49, Alt_R 55, FN 65, Ct_R 95, Left 97, Down 79, Right 84, led 17
// 87, led 07 88, led 18
// 91, led 08
// 91, led 08
#ifdef RGB_MATRIX_ENABLE
static void set_rgb_caps_leds_on(void);
@ -132,15 +132,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
rgb_matrix_set_color(43, 0, 0, 0); // M
}
static void set_rgb_scroll_leds_on() {
static void set_rgb_scroll_leds_on() {
rgb_matrix_set_color(72, 255, 255, 255); // Under Rotary (HOME)
}
static void set_rgb_scroll_leds_off() {
static void set_rgb_scroll_leds_off() {
rgb_matrix_set_color(72, 0, 0, 0); // Under Rotary (HOME)
}
void rgb_matrix_indicators_user(void) {
bool rgb_matrix_indicators_user(void) {
// Left side rainbow
rgb_matrix_set_color(67, 255, 0, 0); // Left LED 01
rgb_matrix_set_color(70, 255, 127, 0); // Left LED 02
@ -175,6 +175,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
set_rgb_scroll_leds_off();
}
}
return false;
}
#endif // RGB_MATRIX_ENABLE
#endif // RGB_MATRIX_ENABLE

View file

@ -71,7 +71,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}
#endif
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
static uint32_t cycle_led_timer = 0;
static uint8_t current_value = 0;
static uint8_t left_side_leds[8] = {68, 71, 74, 77, 81, 84, 88, 92};
@ -103,4 +103,5 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
break;
break;
}
return false;
}

View file

@ -2,7 +2,7 @@
Copyright 2021 Jonavin Eng @Jonavin
Copyright 2022 RustyBrakes (ISO conversion)
Copyright 2022 gourdo1 <gourdo1@outlook.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
@ -243,7 +243,7 @@ void hurt_paddle(void) {
#endif //GAME_ENABLE
// Capslock, Scroll lock and Numlock indicator on Left side lights.
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
// Scroll Lock RGB setup
@ -367,7 +367,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
#endif // GAME_ENABLE
// System NumLock warning indicator RGB setup
#ifdef INVERT_NUMLOCK_INDICATOR
#ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2);
}
@ -444,7 +444,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// Numpad & Mouse Keys overlay RGB
case _NUMPADMOUSE:
#ifdef INVERT_NUMLOCK_INDICATOR
#ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2);
}
@ -712,6 +712,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
#endif //GAME_ENABLE
break;
}
return false;
}
#endif
@ -720,4 +721,4 @@ void keyboard_post_init_keymap(void) {
#ifdef RGB_MATRIX_ENABLE
activate_rgb_nightmode(false); // Set to true if you want to startup in nightmode, otherwise use Fn + Z to toggle
#endif
}
}

View file

@ -109,7 +109,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE
// Capslock, Scroll lock and Numlock indicator on Left side lights.
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) {
rgb_matrix_set_color(LED_L1, RGB_GREEN);
@ -178,6 +178,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
default:
break;
}
return false;
}
#endif