Backward compatibility for new RGB keycode handling (#24490)
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
This commit is contained in:
parent
e66fce38b2
commit
9c86583981
@ -456,6 +456,10 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
|
||||
POST_CONFIG_H += $(QUANTUM_DIR)/rgb_matrix/post_config.h
|
||||
|
||||
# TODO: Remove this
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_underglow.c
|
||||
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_rgb_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/color.c
|
||||
SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
|
||||
|
@ -59,6 +59,10 @@ Changing the **Value** sets the overall brightness.<br>
|
||||
|
||||
## Keycodes
|
||||
|
||||
::: warning
|
||||
These keycodes also simultaneously control [RGB Matrix](rgb_matrix), if enabled. This behaviour is in the process of being deprecated, so during this time it is recommended to additionally include the dedicated RGB Matrix keycodes to your keymap, and add `#define RGB_MATRIX_DISABLE_SHARED_KEYCODES` to `config.h`.
|
||||
:::
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------------------------|----------|---------------------------------------------------------------------|
|
||||
|`QK_UNDERGLOW_TOGGLE` |`UG_TOGG` |Toggle RGB lighting on or off |
|
||||
|
@ -20,3 +20,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -20,3 +20,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -16,3 +16,5 @@
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -17,3 +17,5 @@
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -2,3 +2,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -2,3 +2,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -30,3 +30,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_DI_PIN E6
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -9,3 +9,5 @@
|
||||
#define WORK_LOUDER_LED_PIN_1 B6
|
||||
#define WORK_LOUDER_LED_PIN_2 B7
|
||||
#define WORK_LOUDER_LED_PIN_3 B5
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_DI_PIN C7
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -5,3 +5,5 @@
|
||||
|
||||
#define RGBLIGHT_DI_PIN D2
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -20,3 +20,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define RGBLIGHT_DI_PIN D2
|
||||
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -2,87 +2,200 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "process_underglow.h"
|
||||
#include "rgblight.h"
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
# include "rgblight.h"
|
||||
#endif
|
||||
#include "action_util.h"
|
||||
#include "keycodes.h"
|
||||
#include "modifiers.h"
|
||||
|
||||
// TODO: Remove this
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
# include "rgb_matrix.h"
|
||||
#endif
|
||||
|
||||
bool process_underglow(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
|
||||
switch (keycode) {
|
||||
case QK_UNDERGLOW_TOGGLE:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
rgblight_toggle();
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
rgb_matrix_toggle();
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_MODE_NEXT:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_step_reverse();
|
||||
} else {
|
||||
rgblight_step();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_step_reverse();
|
||||
} else {
|
||||
rgb_matrix_step();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_MODE_PREVIOUS:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_step();
|
||||
} else {
|
||||
rgblight_step_reverse();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_step();
|
||||
} else {
|
||||
rgb_matrix_step_reverse();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_HUE_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_hue();
|
||||
} else {
|
||||
rgblight_increase_hue();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_hue();
|
||||
} else {
|
||||
rgb_matrix_increase_hue();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_HUE_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_hue();
|
||||
} else {
|
||||
rgblight_decrease_hue();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_hue();
|
||||
} else {
|
||||
rgb_matrix_decrease_hue();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SATURATION_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_sat();
|
||||
} else {
|
||||
rgblight_increase_sat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_sat();
|
||||
} else {
|
||||
rgb_matrix_increase_sat();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SATURATION_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_sat();
|
||||
} else {
|
||||
rgblight_decrease_sat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_sat();
|
||||
} else {
|
||||
rgb_matrix_decrease_sat();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_VALUE_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_val();
|
||||
} else {
|
||||
rgblight_increase_val();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_val();
|
||||
} else {
|
||||
rgb_matrix_increase_val();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_VALUE_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_hue();
|
||||
rgblight_increase_val();
|
||||
} else {
|
||||
rgblight_decrease_hue();
|
||||
rgblight_decrease_val();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_val();
|
||||
} else {
|
||||
rgb_matrix_decrease_val();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SPEED_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_speed();
|
||||
} else {
|
||||
rgblight_increase_speed();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_speed();
|
||||
} else {
|
||||
rgb_matrix_increase_speed();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SPEED_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_speed();
|
||||
} else {
|
||||
rgblight_decrease_speed();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_speed();
|
||||
} else {
|
||||
rgb_matrix_decrease_speed();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
# include "process_rgb_matrix.h"
|
||||
#endif
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
# include "process_underglow.h"
|
||||
#endif
|
||||
|
||||
@ -382,7 +382,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
#ifdef GRAVE_ESC_ENABLE
|
||||
process_grave_esc(keycode, record) &&
|
||||
#endif
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
process_underglow(keycode, record) &&
|
||||
#endif
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user