Add new set of keycodes for RGB Matrix (#23463)

This commit is contained in:
Ryan 2024-05-04 16:49:19 +10:00 committed by GitHub
parent c8d1b6fefa
commit b7d5a6c50b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 150 additions and 17 deletions

View file

@ -62,6 +62,98 @@
"aliases": [ "aliases": [
"LM_SPDD" "LM_SPDD"
] ]
},
"0x7840": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_ON",
"aliases": [
"RM_ON"
]
},
"0x7841": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_OFF",
"aliases": [
"RM_OFF"
]
},
"0x7842": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_TOGGLE",
"aliases": [
"RM_TOGG"
]
},
"0x7843": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_MODE_NEXT",
"aliases": [
"RM_NEXT"
]
},
"0x7844": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_MODE_PREVIOUS",
"aliases": [
"RM_PREV"
]
},
"0x7845": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_HUE_UP",
"aliases": [
"RM_HUEU"
]
},
"0x7846": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_HUE_DOWN",
"aliases": [
"RM_HUED"
]
},
"0x7847": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_SATURATION_UP",
"aliases": [
"RM_SATU"
]
},
"0x7848": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_SATURATION_DOWN",
"aliases": [
"RM_SATD"
]
},
"0x7849": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_VALUE_UP",
"aliases": [
"RM_VALU"
]
},
"0x784A": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_VALUE_DOWN",
"aliases": [
"RM_VALD"
]
},
"0x784B": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_SPEED_UP",
"aliases": [
"RM_SPDU"
]
},
"0x784C": {
"group": "rgb_matrix",
"key": "QK_RGB_MATRIX_SPEED_DOWN",
"aliases": [
"RM_SPDD"
]
} }
} }
} }

View file

@ -15,53 +15,53 @@
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
enum my_keycodes { enum my_keycodes {
RM_TOGG = SAFE_RANGE, RMT = SAFE_RANGE,
RM_MOD, RMS,
RM_HUI, RMIH,
RM_HUD, RMDH,
RM_SAI, RMIS,
RM_SAD, RMDS,
RM_VAI, RMIV,
RM_VAD RMDV
}; };
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case RM_TOGG: case RMT:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_toggle(); {rgb_matrix_toggle();
} }
return false; return false;
case RM_MOD: case RMS:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_step(); {rgb_matrix_step();
} }
return false; return false;
case RM_HUI: case RMIH:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_increase_hue(); {rgb_matrix_increase_hue();
} }
return false; return false;
case RM_HUD: case RMDH:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_decrease_hue(); {rgb_matrix_decrease_hue();
} }
return false; return false;
case RM_SAI: case RMIS:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_increase_sat(); {rgb_matrix_increase_sat();
} }
return false; return false;
case RM_SAD: case RMDS:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_decrease_sat(); {rgb_matrix_decrease_sat();
} }
return false; return false;
case RM_VAI: case RMIV:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_increase_val(); {rgb_matrix_increase_val();
} }
return false; return false;
case RM_VAD: case RMDV:
if (record->event.pressed) if (record->event.pressed)
{rgb_matrix_decrease_val(); {rgb_matrix_decrease_val();
} }
@ -82,7 +82,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[1] = LAYOUT_65_ansi( [1] = LAYOUT_65_ansi(
QK_GESC, 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_DEL, QK_BOOT, QK_GESC, 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_DEL, QK_BOOT,
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD, _______, _______, _______, _______,
KC_CAPS, RM_TOGG, RM_MOD, RM_HUI, RM_HUD, RM_SAI, RM_SAD, RM_VAI, RM_VAD, _______, _______, _______, _______, _______, KC_CAPS, RMT, RMS, RMIH, RMDH, RMIS, RMDS, RMIV, RMDV, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, KC_VOLU, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, _______ _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, _______
), ),

View file

@ -657,6 +657,19 @@ enum qk_keycode_defines {
RGB_MODE_GRADIENT = 0x7832, RGB_MODE_GRADIENT = 0x7832,
RGB_MODE_RGBTEST = 0x7833, RGB_MODE_RGBTEST = 0x7833,
RGB_MODE_TWINKLE = 0x7834, RGB_MODE_TWINKLE = 0x7834,
QK_RGB_MATRIX_ON = 0x7840,
QK_RGB_MATRIX_OFF = 0x7841,
QK_RGB_MATRIX_TOGGLE = 0x7842,
QK_RGB_MATRIX_MODE_NEXT = 0x7843,
QK_RGB_MATRIX_MODE_PREVIOUS = 0x7844,
QK_RGB_MATRIX_HUE_UP = 0x7845,
QK_RGB_MATRIX_HUE_DOWN = 0x7846,
QK_RGB_MATRIX_SATURATION_UP = 0x7847,
QK_RGB_MATRIX_SATURATION_DOWN = 0x7848,
QK_RGB_MATRIX_VALUE_UP = 0x7849,
QK_RGB_MATRIX_VALUE_DOWN = 0x784A,
QK_RGB_MATRIX_SPEED_UP = 0x784B,
QK_RGB_MATRIX_SPEED_DOWN = 0x784C,
QK_BOOTLOADER = 0x7C00, QK_BOOTLOADER = 0x7C00,
QK_REBOOT = 0x7C01, QK_REBOOT = 0x7C01,
QK_DEBUG_TOGGLE = 0x7C02, QK_DEBUG_TOGGLE = 0x7C02,
@ -1311,6 +1324,19 @@ enum qk_keycode_defines {
RGB_M_G = RGB_MODE_GRADIENT, RGB_M_G = RGB_MODE_GRADIENT,
RGB_M_T = RGB_MODE_RGBTEST, RGB_M_T = RGB_MODE_RGBTEST,
RGB_M_TW = RGB_MODE_TWINKLE, RGB_M_TW = RGB_MODE_TWINKLE,
RM_ON = QK_RGB_MATRIX_ON,
RM_OFF = QK_RGB_MATRIX_OFF,
RM_TOGG = QK_RGB_MATRIX_TOGGLE,
RM_NEXT = QK_RGB_MATRIX_MODE_NEXT,
RM_PREV = QK_RGB_MATRIX_MODE_PREVIOUS,
RM_HUEU = QK_RGB_MATRIX_HUE_UP,
RM_HUED = QK_RGB_MATRIX_HUE_DOWN,
RM_SATU = QK_RGB_MATRIX_SATURATION_UP,
RM_SATD = QK_RGB_MATRIX_SATURATION_DOWN,
RM_VALU = QK_RGB_MATRIX_VALUE_UP,
RM_VALD = QK_RGB_MATRIX_VALUE_DOWN,
RM_SPDU = QK_RGB_MATRIX_SPEED_UP,
RM_SPDD = QK_RGB_MATRIX_SPEED_DOWN,
QK_BOOT = QK_BOOTLOADER, QK_BOOT = QK_BOOTLOADER,
QK_RBT = QK_REBOOT, QK_RBT = QK_REBOOT,
DB_TOGG = QK_DEBUG_TOGGLE, DB_TOGG = QK_DEBUG_TOGGLE,
@ -1436,6 +1462,7 @@ enum qk_keycode_defines {
#define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING) #define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING)
#define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN) #define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN)
#define IS_RGB_KEYCODE(code) ((code) >= RGB_TOG && (code) <= RGB_MODE_TWINKLE) #define IS_RGB_KEYCODE(code) ((code) >= RGB_TOG && (code) <= RGB_MODE_TWINKLE)
#define IS_RGB_MATRIX_KEYCODE(code) ((code) >= QK_RGB_MATRIX_ON && (code) <= QK_RGB_MATRIX_SPEED_DOWN)
#define IS_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_ALT_REPEAT_KEY) #define IS_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_ALT_REPEAT_KEY)
#define IS_KB_KEYCODE(code) ((code) >= QK_KB_0 && (code) <= QK_KB_31) #define IS_KB_KEYCODE(code) ((code) >= QK_KB_0 && (code) <= QK_KB_31)
#define IS_USER_KEYCODE(code) ((code) >= QK_USER_0 && (code) <= QK_USER_31) #define IS_USER_KEYCODE(code) ((code) >= QK_USER_0 && (code) <= QK_USER_31)
@ -1459,6 +1486,7 @@ enum qk_keycode_defines {
#define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING #define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING
#define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN #define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN
#define RGB_KEYCODE_RANGE RGB_TOG ... RGB_MODE_TWINKLE #define RGB_KEYCODE_RANGE RGB_TOG ... RGB_MODE_TWINKLE
#define RGB_MATRIX_KEYCODE_RANGE QK_RGB_MATRIX_ON ... QK_RGB_MATRIX_SPEED_DOWN
#define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_ALT_REPEAT_KEY #define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_ALT_REPEAT_KEY
#define KB_KEYCODE_RANGE QK_KB_0 ... QK_KB_31 #define KB_KEYCODE_RANGE QK_KB_0 ... QK_KB_31
#define USER_KEYCODE_RANGE QK_USER_0 ... QK_USER_31 #define USER_KEYCODE_RANGE QK_USER_0 ... QK_USER_31

View file

@ -599,6 +599,19 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
{RGB_MODE_GRADIENT, "RGB_MODE_GRADIENT"}, {RGB_MODE_GRADIENT, "RGB_MODE_GRADIENT"},
{RGB_MODE_RGBTEST, "RGB_MODE_RGBTEST"}, {RGB_MODE_RGBTEST, "RGB_MODE_RGBTEST"},
{RGB_MODE_TWINKLE, "RGB_MODE_TWINKLE"}, {RGB_MODE_TWINKLE, "RGB_MODE_TWINKLE"},
{QK_RGB_MATRIX_ON, "QK_RGB_MATRIX_ON"},
{QK_RGB_MATRIX_OFF, "QK_RGB_MATRIX_OFF"},
{QK_RGB_MATRIX_TOGGLE, "QK_RGB_MATRIX_TOGGLE"},
{QK_RGB_MATRIX_MODE_NEXT, "QK_RGB_MATRIX_MODE_NEXT"},
{QK_RGB_MATRIX_MODE_PREVIOUS, "QK_RGB_MATRIX_MODE_PREVIOUS"},
{QK_RGB_MATRIX_HUE_UP, "QK_RGB_MATRIX_HUE_UP"},
{QK_RGB_MATRIX_HUE_DOWN, "QK_RGB_MATRIX_HUE_DOWN"},
{QK_RGB_MATRIX_SATURATION_UP, "QK_RGB_MATRIX_SATURATION_UP"},
{QK_RGB_MATRIX_SATURATION_DOWN, "QK_RGB_MATRIX_SATURATION_DOWN"},
{QK_RGB_MATRIX_VALUE_UP, "QK_RGB_MATRIX_VALUE_UP"},
{QK_RGB_MATRIX_VALUE_DOWN, "QK_RGB_MATRIX_VALUE_DOWN"},
{QK_RGB_MATRIX_SPEED_UP, "QK_RGB_MATRIX_SPEED_UP"},
{QK_RGB_MATRIX_SPEED_DOWN, "QK_RGB_MATRIX_SPEED_DOWN"},
{QK_BOOTLOADER, "QK_BOOTLOADER"}, {QK_BOOTLOADER, "QK_BOOTLOADER"},
{QK_REBOOT, "QK_REBOOT"}, {QK_REBOOT, "QK_REBOOT"},
{QK_DEBUG_TOGGLE, "QK_DEBUG_TOGGLE"}, {QK_DEBUG_TOGGLE, "QK_DEBUG_TOGGLE"},