diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index 8d5746677f90..920199c848fa 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -613,23 +613,22 @@ ifeq ($(strip $(LED_TABLES)), yes)
endif
ifeq ($(strip $(SIGNALRGB_SUPPORT_ENABLE)), yes)
- HIDRGB_ENABLE := yes
+ GEEKRGB_ENABLE := yes
SRC += $(QUANTUM_DIR)/signalrgb.c
OPT_DEFS += -DSIGNALRGB_SUPPORT_ENABLE
endif
ifeq ($(strip $(OPENRGB_ENABLE)), yes)
- HIDRGB_ENABLE := yes
+ GEEKRGB_ENABLE := yes
SRC += $(QUANTUM_DIR)/openrgb.c
OPT_DEFS += -DOPENRGB_ENABLE
endif
-ifeq ($(strip $(HIDRGB_ENABLE)), yes)
- SRC += $(QUANTUM_DIR)/hidrgb.c
- OPT_DEFS += -DHIDRGB_ENABLE
+ifeq ($(strip $(GEEKRGB_ENABLE)), yes)
+ SRC += $(QUANTUM_DIR)/geekrgb.c
+ OPT_DEFS += -DGEEKRGB_ENABLE
endif
-
ifeq ($(strip $(VIA_ENABLE)), yes)
DYNAMIC_KEYMAP_ENABLE := yes
RAW_ENABLE := yes
@@ -800,8 +799,8 @@ ifeq ($(strip $(UNICODE_COMMON)), yes)
OPT_DEFS += -DUNICODE_COMMON_ENABLE
COMMON_VPATH += $(QUANTUM_DIR)/unicode
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c \
- $(QUANTUM_DIR)/unicode/unicode.c \
- $(QUANTUM_DIR)/utf8.c
+ $(QUANTUM_DIR)/unicode/unicode.c \
+ $(QUANTUM_DIR)/unicode/utf8.c
endif
MAGIC_ENABLE ?= yes
diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk
index 815222c57abc..456f1d9e4b80 100644
--- a/builddefs/show_options.mk
+++ b/builddefs/show_options.mk
@@ -11,7 +11,8 @@ BUILD_OPTION_NAMES = \
DYNAMIC_KEYMAP_ENABLE \
USB_HID_ENABLE \
VIA_ENABLE \
- OPENRGB_ENABLE
+ OPENRGB_ENABLE \
+ SIGNALRGB_SUPPORT_ENABLE
HARDWARE_OPTION_NAMES = \
SLEEP_LED_ENABLE \
diff --git a/keyboards/keychron/q1/config.h b/keyboards/keychron/q1/config.h
index 0eb865c0dc5c..47508b86924f 100644
--- a/keyboards/keychron/q1/config.h
+++ b/keyboards/keychron/q1/config.h
@@ -25,9 +25,6 @@
/* Disable DIP switch in matrix data */
#define MATRIX_MASKED
-/* Disable RGB lighting when PC is in suspend */
-#define RGB_DISABLE_WHEN_USB_SUSPENDED
-
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
@@ -80,8 +77,15 @@
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
-#define HIDRGB_USE_UNIVERSAL_BRIGHTNESS
+#ifdef RGB_MATRIX_ENABLE
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // Disable RGB lighting when PC is in suspend
+# undef RGB_DISABLE_TIMEOUT
+# define RGB_DISABLE_TIMEOUT 900000 // 15 minutes (15 * 60 * 1000ms)
+#endif
+/* GEEKRGB config */
+#define GEEKRGB_USE_UNIVERSAL_BRIGHTNESS
+#define GEEKRGB_WELCOME_ANIM_SPD 170
#define OPENRGB_DEFAULT_KEYMAP_ID 2 //read windows keymap for openrgb
/* Enable receive custom command from host */
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/geekrgb/keymap.c b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/geekrgb/keymap.c
new file mode 100644
index 000000000000..84c1afca7ff8
--- /dev/null
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/geekrgb/keymap.c
@@ -0,0 +1,108 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include QMK_KEYBOARD_H
+
+// clang-format off
+enum custom_keycodes {
+#ifdef VIA_ENABLE
+ KC_GEEKRGB_MODE = USER00,
+#else
+ KC_GEEKRGB_MODE = SAFE_RANGE,
+#endif
+ KC_MISSION_CONTROL,
+ KC_LAUNCHPAD
+};
+
+#define KC_GR_MO KC_GEEKRGB_MODE
+#define KC_MCTL KC_MISSION_CONTROL
+#define KC_LPAD KC_LAUNCHPAD
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+enum layers{
+ MAC_BASE,
+ MAC_FN,
+ WIN_BASE,
+ WIN_FN
+};
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [MAC_BASE] = LAYOUT_ansi_82(
+ KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [MAC_FN] = LAYOUT_ansi_82(
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+
+ [WIN_BASE] = LAYOUT_ansi_82(
+ KC_ESC, 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, KC_INS,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [WIN_FN] = LAYOUT_ansi_82(
+ _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case KC_GEEKRGB_MODE:
+ if (record->event.pressed) {
+ rgb_matrix_mode(RGB_MATRIX_GEEKRGB);
+ geekrgb_reload_openrgb_anim();
+ }
+ return false;
+
+ case KC_MISSION_CONTROL:
+ if (record->event.pressed) {
+ host_consumer_send(0x29F);
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ case KC_LAUNCHPAD:
+ if (record->event.pressed) {
+ host_consumer_send(0x2A0);
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+
+ default:
+ return true;
+ }
+}
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/geekrgb/rules.mk b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/geekrgb/rules.mk
new file mode 100644
index 000000000000..9c466f1bf018
--- /dev/null
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/geekrgb/rules.mk
@@ -0,0 +1,3 @@
+OPENRGB_ENABLE = yes
+SIGNALRGB_SUPPORT_ENABLE = yes
+VIA_ENABLE = yes
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/keychron/rules.mk b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/keychron/rules.mk
index 1e6ffcc69367..cb2fd27459e2 100644
--- a/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/keychron/rules.mk
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/keychron/rules.mk
@@ -1,4 +1,3 @@
-OPENRGB_ENABLE = yes
VIA_ENABLE = yes
VPATH += keyboards/keychron/common
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/via/rules.mk b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/via/rules.mk
index 5df51bf54ec9..1e5b99807cb7 100644
--- a/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/via/rules.mk
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/via/rules.mk
@@ -1,2 +1 @@
-OPENRGB_ENABLE = yes
VIA_ENABLE = yes
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/info.json b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/info.json
index e68bcdbed400..aca62e7645d6 100644
--- a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/info.json
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/info.json
@@ -1,5 +1,5 @@
{
- "keyboard_name": "Keychron Q1",
+ "keyboard_name": "Keychron Q1 Knob",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/geekrgb/keymap.c b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/geekrgb/keymap.c
new file mode 100644
index 000000000000..0fabd4cc02b3
--- /dev/null
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/geekrgb/keymap.c
@@ -0,0 +1,120 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include QMK_KEYBOARD_H
+
+// clang-format off
+enum custom_keycodes {
+#ifdef VIA_ENABLE
+ KC_GEEKRGB_MODE = USER00,
+#else
+ KC_GEEKRGB_MODE = SAFE_RANGE,
+#endif
+ KC_MISSION_CONTROL,
+ KC_LAUNCHPAD
+};
+
+#define KC_GR_MO KC_GEEKRGB_MODE
+#define KC_MCTL KC_MISSION_CONTROL
+#define KC_LPAD KC_LAUNCHPAD
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+enum layers{
+ MAC_BASE,
+ MAC_FN,
+ WIN_BASE,
+ WIN_FN
+};
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [MAC_BASE] = LAYOUT_ansi_82(
+ KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [MAC_FN] = LAYOUT_ansi_82(
+ _______, 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_GR_MO,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+
+ [WIN_BASE] = LAYOUT_ansi_82(
+ KC_ESC, 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, KC_MUTE,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [WIN_FN] = LAYOUT_ansi_82(
+ _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_GR_MO,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+};
+
+// clang-format on
+
+#if defined(ENCODER_MAP_ENABLE)
+const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
+ [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
+ [MAC_FN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
+ [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
+ [WIN_FN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}
+};
+#endif // ENCODER_MAP_ENABLE
+
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case KC_GEEKRGB_MODE:
+ if (record->event.pressed) {
+ rgb_matrix_mode(RGB_MATRIX_GEEKRGB);
+ geekrgb_reload_openrgb_anim();
+ }
+ return false;
+
+ case KC_MISSION_CONTROL:
+ if (record->event.pressed) {
+ host_consumer_send(0x29F);
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ case KC_LAUNCHPAD:
+ if (record->event.pressed) {
+ host_consumer_send(0x2A0);
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+
+ default:
+ return true;
+ }
+}
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/geekrgb/rules.mk b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/geekrgb/rules.mk
new file mode 100644
index 000000000000..2023d3bfe70b
--- /dev/null
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/geekrgb/rules.mk
@@ -0,0 +1,4 @@
+OPENRGB_ENABLE = yes
+SIGNALRGB_SUPPORT_ENABLE = yes
+VIA_ENABLE = yes
+ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/keychron/rules.mk b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/keychron/rules.mk
index 21062032a353..f33d4174440f 100644
--- a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/keychron/rules.mk
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/keychron/rules.mk
@@ -1,4 +1,3 @@
-OPENRGB_ENABLE = yes
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/via/rules.mk b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/via/rules.mk
index ad0da96fb958..f1adcab005e8 100644
--- a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/via/rules.mk
+++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/keymaps/via/rules.mk
@@ -1,3 +1,2 @@
-OPENRGB_ENABLE = yes
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/melgeek/tegic/config.h b/keyboards/melgeek/tegic/config.h
index e3a3b2fa05ef..a96eead93044 100755
--- a/keyboards/melgeek/tegic/config.h
+++ b/keyboards/melgeek/tegic/config.h
@@ -25,21 +25,33 @@
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 3
-#define RGB_ENABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-#define RGB_ENABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
+// #define RGB_ENABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
#define RGB_MATRIX_KEYPRESSES
-#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+// #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+
#define RGB_MATRIX_LED_PROCESS_LIMIT 4
#define RGB_MATRIX_LED_FLUSH_LIMIT 26
-//#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
-#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL
+
+#ifdef GEEKRGB_ENABLE
+# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_GEEKRGB
+#else
+# define RGB_MATRIX_STARTUP_MODE RGB_CYCLE_LEFT_RIGHT
+#endif
+
#define RGB_MATRIX_STARTUP_SPD 40
-// #define RGB_MATRIX_STARTUP_HUE 200
-// #define RGB_MATRIX_STARTUP_SAT 200
-// #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS / 2
+
+#ifdef RGB_MATRIX_ENABLE
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // Disable RGB lighting when PC is in suspend
+# undef RGB_DISABLE_TIMEOUT
+# define RGB_DISABLE_TIMEOUT 900000 // 15 minutes (15 * 60 * 1000ms)
+#endif
+
#define DRIVER_ADDR_1 0b0110000
#define DRIVER_COUNT 1
+// RGB Matrix Animation modes. Explicitly enabled
+// For full list of effects, see:
+// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
// #define ENABLE_RGB_MATRIX_ALPHAS_MODS
// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
@@ -55,7 +67,7 @@
#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
-#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+// #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
#define ENABLE_RGB_MATRIX_DUAL_BEACON
@@ -86,9 +98,10 @@
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
//new effects
-#define ENABLE_RGB_MATRIX_PIXEL_RAIN
+// #define ENABLE_RGB_MATRIX_PIXEL_RAIN
// #define ENABLE_RGB_MATRIX_PIXEL_FLOW
// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
-#define HIDRGB_USE_UNIVERSAL_BRIGHTNESS //no use OPENRGB_DIRECT_MODE_USE_UNIVERSAL_BRIGHTNESS
-
+/* GEEKRGB config */
+#define GEEKRGB_USE_UNIVERSAL_BRIGHTNESS //no use OPENRGB_DIRECT_MODE_USE_UNIVERSAL_BRIGHTNESS
+#define GEEKRGB_WELCOME_ANIM_SPD 170
diff --git a/keyboards/melgeek/tegic/info.json b/keyboards/melgeek/tegic/info.json
index 5526ec080ce8..899a565639dd 100755
--- a/keyboards/melgeek/tegic/info.json
+++ b/keyboards/melgeek/tegic/info.json
@@ -1,5 +1,5 @@
{
- "keyboard_name": "tegic",
+ "keyboard_name": "Tegic Framism",
"manufacturer": "MelGeek",
"url": "",
"maintainer": "melgeek001365",
diff --git a/keyboards/melgeek/tegic/keymaps/geekrgb/keymap.c b/keyboards/melgeek/tegic/keymaps/geekrgb/keymap.c
new file mode 100644
index 000000000000..39f6a3d7b0a1
--- /dev/null
+++ b/keyboards/melgeek/tegic/keymaps/geekrgb/keymap.c
@@ -0,0 +1,109 @@
+/* Copyright 2020 MelGeek
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include QMK_KEYBOARD_H
+
+enum custom_keycodes {
+#ifdef VIA_ENABLE
+ KC_GEEKRGB_MODE = USER00,
+#else
+ KC_GEEKRGB_MODE = SAFE_RANGE,
+#endif
+ KC_MISSION_CONTROL,
+ KC_LAUNCHPAD
+};
+
+#define KC_GR_MO KC_GEEKRGB_MODE
+#define KC_MCTL KC_MISSION_CONTROL
+#define KC_LPAD KC_LAUNCHPAD
+
+#define WIN DF(WIN_BASE)
+#define MACOS DF(MAC_BASE)
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+enum layers{
+ WIN_BASE,
+ WIN_FN,
+ MAC_BASE,
+ MAC_FN
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [WIN_BASE] = LAYOUT_tegic_ansi( /* Base */
+ KC_ESC, 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_PSCR, KC_SLCK,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
+ ),
+ [WIN_FN] = LAYOUT_tegic_ansi( /* FN */
+ MACOS , KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, KC_END, _______,
+ KC_GR_MO, _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_MOD, _______, _______, _______, KC_INS, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, KC_VOLU,
+ _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT
+ ),
+ [MAC_BASE] = LAYOUT_tegic_ansi(
+ KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_SLCK,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
+ ),
+ [MAC_FN] = LAYOUT_tegic_ansi(
+ WIN , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, KC_END, _______,
+ KC_GR_MO, _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_MOD, _______, _______, _______, KC_INS, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, KC_VOLU,
+ _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT
+ )
+};
+
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case KC_GEEKRGB_MODE:
+ if (record->event.pressed) {
+ rgb_matrix_mode(RGB_MATRIX_GEEKRGB);
+ geekrgb_reload_openrgb_anim();
+ }
+ return false;
+
+ case KC_MISSION_CONTROL:
+ if (record->event.pressed) {
+ host_consumer_send(0x29F);
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ case KC_LAUNCHPAD:
+ if (record->event.pressed) {
+ host_consumer_send(0x2A0);
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+
+ default:
+ return true;
+ }
+}
diff --git a/keyboards/melgeek/tegic/keymaps/signalrgb/rules.mk b/keyboards/melgeek/tegic/keymaps/geekrgb/rules.mk
similarity index 55%
rename from keyboards/melgeek/tegic/keymaps/signalrgb/rules.mk
rename to keyboards/melgeek/tegic/keymaps/geekrgb/rules.mk
index 3ca471d0579a..3fc50e70a663 100644
--- a/keyboards/melgeek/tegic/keymaps/signalrgb/rules.mk
+++ b/keyboards/melgeek/tegic/keymaps/geekrgb/rules.mk
@@ -1,2 +1,5 @@
+OPENRGB_ENABLE = yes
SIGNALRGB_SUPPORT_ENABLE = yes
+VIA_ENABLE = yes
LTO_ENABLE = yes
+
diff --git a/keyboards/melgeek/tegic/keymaps/openrgb/keymap.c b/keyboards/melgeek/tegic/keymaps/openrgb/keymap.c
deleted file mode 100644
index 948a438c3ecb..000000000000
--- a/keyboards/melgeek/tegic/keymaps/openrgb/keymap.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright 2020 MelGeek
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include QMK_KEYBOARD_H
-
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_tegic_ansi( /* Base */
- KC_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_PSCR, KC_SLCK,
- KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
- KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
- KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
- KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
- ),
- [1] = LAYOUT_tegic_ansi( /* FN */
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EEP_RST,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, KC_END, _______,
- _______, RGB_TOG, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_MOD, _______, QK_BOOT, _______, KC_INS, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI, RGB_SPD, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, KC_VOLU,
- _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT
- ),
- [2] = LAYOUT_tegic_ansi(
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
- ),
- [3] = LAYOUT_tegic_ansi(
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
- )
-};
diff --git a/keyboards/melgeek/tegic/keymaps/openrgb/rules.mk b/keyboards/melgeek/tegic/keymaps/openrgb/rules.mk
deleted file mode 100644
index 57dce32cffd9..000000000000
--- a/keyboards/melgeek/tegic/keymaps/openrgb/rules.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-OPENRGB_ENABLE = yes
-LTO_ENABLE = yes
diff --git a/keyboards/melgeek/tegic/keymaps/signalrgb/keymap.c b/keyboards/melgeek/tegic/keymaps/signalrgb/keymap.c
deleted file mode 100644
index 948a438c3ecb..000000000000
--- a/keyboards/melgeek/tegic/keymaps/signalrgb/keymap.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright 2020 MelGeek
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include QMK_KEYBOARD_H
-
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_tegic_ansi( /* Base */
- KC_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_PSCR, KC_SLCK,
- KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
- KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
- KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
- KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
- ),
- [1] = LAYOUT_tegic_ansi( /* FN */
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EEP_RST,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, KC_END, _______,
- _______, RGB_TOG, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_MOD, _______, QK_BOOT, _______, KC_INS, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI, RGB_SPD, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, KC_VOLU,
- _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT
- ),
- [2] = LAYOUT_tegic_ansi(
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
- ),
- [3] = LAYOUT_tegic_ansi(
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
- )
-};
diff --git a/keyboards/melgeek/tegic/keymaps/via/rules.mk b/keyboards/melgeek/tegic/keymaps/via/rules.mk
index 3fc50e70a663..5f615ff62b74 100755
--- a/keyboards/melgeek/tegic/keymaps/via/rules.mk
+++ b/keyboards/melgeek/tegic/keymaps/via/rules.mk
@@ -1,5 +1,3 @@
-OPENRGB_ENABLE = yes
-SIGNALRGB_SUPPORT_ENABLE = yes
VIA_ENABLE = yes
LTO_ENABLE = yes
diff --git a/keyboards/melgeek/tegic/rev1/config.h b/keyboards/melgeek/tegic/rev1/config.h
index 49d4550be993..49538d0b7ab9 100755
--- a/keyboards/melgeek/tegic/rev1/config.h
+++ b/keyboards/melgeek/tegic/rev1/config.h
@@ -38,4 +38,3 @@
#define RGB_MATRIX_CENTER { 84, 24 }
-
diff --git a/keyboards/melgeek/tegic/rev1/rev1.c b/keyboards/melgeek/tegic/rev1/rev1.c
index e3ede57b336c..f54518159d1f 100755
--- a/keyboards/melgeek/tegic/rev1/rev1.c
+++ b/keyboards/melgeek/tegic/rev1/rev1.c
@@ -127,19 +127,19 @@ led_config_t g_led_config = {
{ 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, NO_LED, 78, NO_LED }, /* R4 */
{ 79, 80, 81, NO_LED, NO_LED, 83, NO_LED, NO_LED, NO_LED, 85, 86, 87, 88, 89, 90 }, /* R5 */
}, {
- {0, 0}, {12, 0}, {24, 0}, {36, 0}, {48, 0}, {60, 0}, {72, 0}, {84, 0}, {96, 0}, {108, 0}, {120, 0}, {132, 0}, {144, 0}, {156, 0}, {168, 0}, //15
- {0, 12}, {12, 12}, {24, 12}, {36, 12}, {48, 12}, {60, 12}, {72, 12}, {84, 12}, {96, 12}, {108, 12}, {120, 12}, {132, 12}, {144, 12}, {156, 12}, {168, 12}, {180, 12}, {192, 12}, //17
- {0, 24}, {12, 24}, {24, 24}, {36, 24}, {48, 24}, {60, 24}, {72, 24}, {84, 24}, {96, 24}, {108, 24}, {120, 24}, {132, 24}, {144, 24}, {156, 24}, {168, 24}, //15
- {0, 36}, {12, 36}, {24, 36}, {36, 36}, {48, 36}, {60, 36}, {72, 36}, {84, 36}, {96, 36}, {108, 36}, {120, 36}, {132, 36}, {144, 36}, {156, 36}, {168, 36}, //15
+ {0, 0}, {12, 0}, {24, 0}, {36, 0}, {48, 0}, {60, 0}, {72, 0}, {84, 0}, {96, 0}, {108, 0}, {120, 0}, {132, 0}, {144, 0}, {168, 0}, {204, 0}, //15
+ {0, 12}, {12, 12}, {24, 12}, {36, 12}, {48, 12}, {60, 12}, {72, 12}, {84, 12}, {96, 12}, {108, 12}, {120, 12}, {132, 12}, {144, 12}, {156, 12}, {168, 12}, {180, 12}, {204, 12}, //17
+ {0, 24}, {12, 24}, {24, 24}, {36, 24}, {48, 24}, {60, 24}, {72, 24}, {84, 24}, {96, 24}, {108, 24}, {120, 24}, {132, 24}, {144, 24}, {156, 24}, {204, 24}, //15
+ {0, 36}, {12, 36}, {24, 36}, {36, 36}, {48, 36}, {60, 36}, {72, 36}, {84, 36}, {96, 36}, {108, 36}, {120, 36}, {132, 36}, {156, 36}, {168, 36}, {180, 36}, //15
{0, 48}, {12, 48}, {24, 48}, {36, 48}, {48, 48}, {60, 48}, {72, 48}, {84, 48}, {96, 48}, {108, 48}, {120, 48}, {132, 48}, {144, 48}, {156, 48}, {168, 48}, {180, 48}, {192, 48}, //17
- {0, 60}, {12, 60}, {24, 60}, {36, 60}, {48, 60}, {60, 60}, {72, 60}, {84, 60}, {96, 60}, {108, 60}, {120, 60}, {132, 60}, //12
- }, {
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ {0, 60}, {12, 60}, {24, 60}, {36, 60}, {84, 60}, {132, 60}, {144, 60}, {156, 60}, {168, 60}, {180, 60}, {192, 60}, {204, 60}, //12
+ }, {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
}
};
diff --git a/keyboards/melgeek/tegic/rev1/rules.mk b/keyboards/melgeek/tegic/rev1/rules.mk
index 313b87e8ffec..ef072b38583b 100755
--- a/keyboards/melgeek/tegic/rev1/rules.mk
+++ b/keyboards/melgeek/tegic/rev1/rules.mk
@@ -7,16 +7,15 @@ BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
-BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
+BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
-NKRO_ENABLE = yes # Enable N-Key Rollover
+NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
RGB_MATRIX_ENABLE = yes # Use RGB matrix
RGB_MATRIX_DRIVER = IS31FL3741
LTO_ENABLE = yes
-
diff --git a/keyboards/melgeek/tegic/rev2/config.h b/keyboards/melgeek/tegic/rev2/config.h
deleted file mode 100644
index 49538d0b7ab9..000000000000
--- a/keyboards/melgeek/tegic/rev2/config.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright 2020 MelGeek
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-/*
- * Keyboard Matrix Assignments
- *
- * Change this to how you wired your keyboard
- * COLS: AVR pins used for columns, left to right
- * ROWS: AVR pins used for rows, top to bottom
- * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
- * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
- *
- */
-
-#define MATRIX_ROW_PINS { F0, F1, F4, F5, F6, D3 }
-#define MATRIX_COL_PINS { B0, B1, B2, B3, D2, D5, D4, D6, D7, B4, B5, B6, C6, C7, F7 }
-
-/* COL2ROW, ROW2COL*/
-#define DIODE_DIRECTION COL2ROW
-
-#define DRIVER_LED_TOTAL 91
-//#define DRIVER_INDICATOR_LED_TOTAL 3
-
-
-#define RGB_MATRIX_CENTER { 84, 24 }
diff --git a/keyboards/melgeek/tegic/rev2/rev2.c b/keyboards/melgeek/tegic/rev2/rev2.c
deleted file mode 100644
index f54518159d1f..000000000000
--- a/keyboards/melgeek/tegic/rev2/rev2.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Copyright 2020 MelGeek
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "tegic.h"
-
-#ifdef RGB_MATRIX_ENABLE
-
-
-const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
- {0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
- {0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB2 */
- {0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB3 */
- {0, CS9_SW4, CS8_SW4, CS7_SW4}, /* RGB4 */
- {0, CS9_SW5, CS8_SW5, CS7_SW5}, /* RGB5 */
- {0, CS9_SW6, CS8_SW6, CS7_SW6}, /* RGB6 */
- {0, CS9_SW7, CS8_SW7, CS7_SW7}, /* RGB7 */
- {0, CS9_SW8, CS8_SW8, CS7_SW8}, /* RGB8 */
- {0, CS9_SW9, CS8_SW9, CS7_SW9}, /* RGB9 */
- {0, CS27_SW1, CS26_SW1, CS25_SW1}, /* RGB55 */
- {0, CS27_SW2, CS26_SW2, CS25_SW2}, /* RGB56 */
- {0, CS27_SW3, CS26_SW3, CS25_SW3}, /* RGB57 */
- {0, CS27_SW4, CS26_SW4, CS25_SW4}, /* RGB58 */
- {0, CS27_SW5, CS26_SW5, CS25_SW5}, /* RGB59 */
- {0, CS27_SW6, CS26_SW6, CS25_SW6}, /* RGB60 */
-
- {0, CS12_SW1, CS11_SW1, CS10_SW1}, /* RGB10 */
- {0, CS12_SW2, CS11_SW2, CS10_SW2}, /* RGB11 */
- {0, CS12_SW3, CS11_SW3, CS10_SW3}, /* RGB12 */
- {0, CS12_SW4, CS11_SW4, CS10_SW4}, /* RGB13 */
- {0, CS12_SW5, CS11_SW5, CS10_SW5}, /* RGB14 */
- {0, CS12_SW6, CS11_SW6, CS10_SW6}, /* RGB15 */
- {0, CS12_SW7, CS11_SW7, CS10_SW7}, /* RGB16 */
- {0, CS12_SW8, CS11_SW8, CS10_SW8}, /* RGB17 */
- {0, CS12_SW9, CS11_SW9, CS10_SW9}, /* RGB18 */
- {0, CS27_SW7, CS26_SW7, CS25_SW7}, /* RGB61 */
- {0, CS27_SW8, CS26_SW8, CS25_SW8}, /* RGB62 */
- {0, CS27_SW9, CS26_SW9, CS25_SW9}, /* RGB63 */
- {0, CS30_SW1, CS29_SW1, CS28_SW1}, /* RGB64 */
- {0, CS30_SW2, CS29_SW2, CS28_SW2}, /* RGB65 */
- {0, CS30_SW3, CS29_SW3, CS28_SW3}, /* RGB66 */
- {0, CS30_SW4, CS29_SW4, CS28_SW4}, /* RGB67 */
- {0, CS30_SW5, CS29_SW5, CS28_SW5}, /* RGB68 */
-
- {0, CS15_SW1, CS14_SW1, CS13_SW1}, /* RGB19 */
- {0, CS15_SW2, CS14_SW2, CS13_SW2}, /* RGB20 */
- {0, CS15_SW3, CS14_SW3, CS13_SW3}, /* RGB21 */
- {0, CS15_SW4, CS14_SW4, CS13_SW4}, /* RGB22 */
- {0, CS15_SW5, CS14_SW5, CS13_SW5}, /* RGB23 */
- {0, CS15_SW6, CS14_SW6, CS13_SW6}, /* RGB24 */
- {0, CS15_SW7, CS14_SW7, CS13_SW7}, /* RGB25 */
- {0, CS15_SW8, CS14_SW8, CS13_SW8}, /* RGB26 */
- {0, CS15_SW9, CS14_SW9, CS13_SW9}, /* RGB27 */
- {0, CS30_SW6, CS29_SW6, CS28_SW6}, /* RGB127 */
- {0, CS30_SW7, CS29_SW7, CS28_SW7}, /* RGB128 */
- {0, CS30_SW8, CS29_SW8, CS28_SW8}, /* RGB129 */
- {0, CS30_SW9, CS29_SW9, CS28_SW9}, /* RGB130 */
- {0, CS33_SW1, CS32_SW1, CS31_SW1}, /* RGB136 */
- {0, CS33_SW2, CS32_SW2, CS31_SW2}, /* RGB135 */
-
- {0, CS18_SW1, CS17_SW1, CS16_SW1}, /* RGB28 */
- {0, CS18_SW2, CS17_SW2, CS16_SW2}, /* RGB29 */
- {0, CS18_SW3, CS17_SW3, CS16_SW3}, /* RGB30 */
- {0, CS18_SW4, CS17_SW4, CS16_SW4}, /* RGB31 */
- {0, CS18_SW5, CS17_SW5, CS16_SW5}, /* RGB32 */
- {0, CS18_SW6, CS17_SW6, CS16_SW6}, /* RGB33 */
- {0, CS18_SW7, CS17_SW7, CS16_SW7}, /* RGB34 */
- {0, CS18_SW8, CS17_SW8, CS16_SW8}, /* RGB35 */
- {0, CS18_SW9, CS17_SW9, CS16_SW9}, /* RGB36 */
- {0, CS33_SW3, CS32_SW3, CS31_SW3}, /* RGB138 */
- {0, CS33_SW4, CS32_SW4, CS31_SW4}, /* RGB139 */
- {0, CS33_SW5, CS32_SW5, CS31_SW5}, /* RGB137 */
- {0, CS33_SW6, CS32_SW6, CS31_SW6}, /* RGB131 */
- {0, CS33_SW7, CS32_SW7, CS31_SW7}, /* RGB132 */
- {0, CS33_SW8, CS32_SW8, CS31_SW8}, /* RGB133*/
-
- {0, CS21_SW1, CS20_SW1, CS19_SW1}, /* RGB37 */
- {0, CS21_SW2, CS20_SW2, CS19_SW2}, /* RGB38 */
- {0, CS21_SW3, CS20_SW3, CS19_SW3}, /* RGB39 */
- {0, CS21_SW4, CS20_SW4, CS19_SW4}, /* RGB40 */
- {0, CS21_SW5, CS20_SW5, CS19_SW5}, /* RGB41 */
- {0, CS21_SW6, CS20_SW6, CS19_SW6}, /* RGB42 */
- {0, CS21_SW7, CS20_SW7, CS19_SW7}, /* RGB43 */
- {0, CS21_SW8, CS20_SW8, CS19_SW8}, /* RGB44 */
- {0, CS21_SW9, CS20_SW9, CS19_SW9}, /* RGB45 */
- {0, CS33_SW9, CS32_SW9, CS31_SW9}, /* RGB134 */
- {0, CS36_SW1, CS35_SW1, CS34_SW1}, /* RGB145 */
- {0, CS36_SW2, CS35_SW2, CS34_SW2}, /* RGB144*/
- {0, CS36_SW3, CS35_SW3, CS34_SW3}, /* RGB148 */
- {0, CS36_SW4, CS35_SW4, CS34_SW4}, /* RGB147 */
- {0, CS36_SW5, CS35_SW5, CS34_SW5}, /* RGB146 */
- {0, CS36_SW6, CS35_SW6, CS34_SW6}, /* RGB140 */
- {0, CS36_SW7, CS35_SW7, CS34_SW7}, /* RGB141 */
-
- {0, CS24_SW1, CS23_SW1, CS22_SW1}, /* RGB46 */
- {0, CS24_SW2, CS23_SW2, CS22_SW2}, /* RGB47 */
- {0, CS24_SW3, CS23_SW3, CS22_SW3}, /* RGB48 */
- {0, CS24_SW4, CS23_SW4, CS22_SW4}, /* RGB49 */
- {0, CS24_SW5, CS23_SW5, CS22_SW5}, /* RGB50 */
- {0, CS24_SW6, CS23_SW6, CS22_SW6}, /* RGB51 */
- {0, CS24_SW7, CS23_SW7, CS22_SW7}, /* RGB52 */
- {0, CS24_SW8, CS23_SW8, CS22_SW8}, /* RGB53 */
- {0, CS24_SW9, CS23_SW9, CS22_SW9}, /* RGB54 */
- {0, CS36_SW8, CS35_SW8, CS34_SW8}, /* RGB142 */
- {0, CS36_SW9, CS35_SW9, CS34_SW9}, /* RGB143 */
- {0, CS39_SW1, CS38_SW1, CS37_SW1}, /* RGB149 */
-};
-led_config_t g_led_config = {
- {
- /* C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 */
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* R0 */
- { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31 }, /* R1 */
- { 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46 }, /* R2 */
- { 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, NO_LED, NO_LED }, /* R3 */
- { 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, NO_LED, 78, NO_LED }, /* R4 */
- { 79, 80, 81, NO_LED, NO_LED, 83, NO_LED, NO_LED, NO_LED, 85, 86, 87, 88, 89, 90 }, /* R5 */
- }, {
- {0, 0}, {12, 0}, {24, 0}, {36, 0}, {48, 0}, {60, 0}, {72, 0}, {84, 0}, {96, 0}, {108, 0}, {120, 0}, {132, 0}, {144, 0}, {168, 0}, {204, 0}, //15
- {0, 12}, {12, 12}, {24, 12}, {36, 12}, {48, 12}, {60, 12}, {72, 12}, {84, 12}, {96, 12}, {108, 12}, {120, 12}, {132, 12}, {144, 12}, {156, 12}, {168, 12}, {180, 12}, {204, 12}, //17
- {0, 24}, {12, 24}, {24, 24}, {36, 24}, {48, 24}, {60, 24}, {72, 24}, {84, 24}, {96, 24}, {108, 24}, {120, 24}, {132, 24}, {144, 24}, {156, 24}, {204, 24}, //15
- {0, 36}, {12, 36}, {24, 36}, {36, 36}, {48, 36}, {60, 36}, {72, 36}, {84, 36}, {96, 36}, {108, 36}, {120, 36}, {132, 36}, {156, 36}, {168, 36}, {180, 36}, //15
- {0, 48}, {12, 48}, {24, 48}, {36, 48}, {48, 48}, {60, 48}, {72, 48}, {84, 48}, {96, 48}, {108, 48}, {120, 48}, {132, 48}, {144, 48}, {156, 48}, {168, 48}, {180, 48}, {192, 48}, //17
- {0, 60}, {12, 60}, {24, 60}, {36, 60}, {84, 60}, {132, 60}, {144, 60}, {156, 60}, {168, 60}, {180, 60}, {192, 60}, {204, 60}, //12
- }, {
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- }
-};
-
-
-
-
-#endif
-
-void keyboard_pre_init_kb(void) {
- setPinOutput(B7);
- writePinHigh(B7);
- keyboard_pre_init_user();
-}
diff --git a/keyboards/melgeek/tegic/rev2/rules.mk b/keyboards/melgeek/tegic/rev2/rules.mk
deleted file mode 100644
index ef072b38583b..000000000000
--- a/keyboards/melgeek/tegic/rev2/rules.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# MCU name
-MCU = atmega32u4
-
-# Bootloader selection
-BOOTLOADER = atmel-dfu
-
-# Build Options
-# change yes to no to disable
-#
-BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = yes # Mouse keys
-EXTRAKEY_ENABLE = yes # Audio control and System control
-CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = no # Commands for debug and configuration
-NKRO_ENABLE = yes # Enable N-Key Rollover
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
-RGB_MATRIX_ENABLE = yes # Use RGB matrix
-RGB_MATRIX_DRIVER = IS31FL3741
-
-LTO_ENABLE = yes
diff --git a/quantum/action_code.h b/quantum/action_code.h
index 14cfd025f1e3..e107f0a740fc 100644
--- a/quantum/action_code.h
+++ b/quantum/action_code.h
@@ -192,11 +192,7 @@ enum mods_codes {
/** \brief Other Keys
*/
-enum usage_pages {
- PAGE_SYSTEM,
- PAGE_CONSUMER,
-};
-
+enum usage_pages { PAGE_SYSTEM, PAGE_CONSUMER };
#define ACTION_USAGE_SYSTEM(id) ACTION(ACT_USAGE, PAGE_SYSTEM << 10 | (id))
#define ACTION_USAGE_CONSUMER(id) ACTION(ACT_USAGE, PAGE_CONSUMER << 10 | (id))
#define ACTION_MOUSEKEY(key) ACTION(ACT_MOUSEKEY, key)
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 6ab8a2aa7db3..d93477b27e03 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -24,6 +24,4 @@
#define COL2ROW 0
#define ROW2COL 1
-#ifdef AUDIO_ENABLE
-# include "song_list.h"
-#endif
+#include "song_list.h"
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index 01be9806e473..eb841254e1a0 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -24,7 +24,9 @@
# include "via.h" // for VIA_EEPROM_CONFIG_END
# define DYNAMIC_KEYMAP_EEPROM_START (VIA_EEPROM_CONFIG_END)
#else
-# define DYNAMIC_KEYMAP_EEPROM_START (EECONFIG_SIZE)
+# ifndef DYNAMIC_KEYMAP_EEPROM_START
+# define DYNAMIC_KEYMAP_EEPROM_START (EECONFIG_SIZE)
+# endif
#endif
#ifdef ENCODER_ENABLE
@@ -135,10 +137,14 @@ uint16_t dynamic_keymap_get_encoder(uint8_t layer, uint8_t encoder_id, bool cloc
// Big endian, so we can read/write EEPROM directly from host if we want
uint16_t keycode = ((uint16_t)eeprom_read_byte(address + (clockwise ? 0 : 2))) << 8;
keycode |= eeprom_read_byte(address + (clockwise ? 0 : 2) + 1);
+
+ dprintf("encoder keycode: %d\n",keycode);
return keycode;
}
void dynamic_keymap_set_encoder(uint8_t layer, uint8_t encoder_id, bool clockwise, uint16_t keycode) {
+ dprintf("layer: %d, encoderid: %d, clockwise: %d , keycode: %d\n",layer,encoder_id,clockwise,keycode);
+
if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || encoder_id >= NUM_ENCODERS) return;
void *address = dynamic_keymap_encoder_to_eeprom_address(layer, encoder_id);
// Big endian, so we can read/write EEPROM directly from host if we want
@@ -153,7 +159,7 @@ void dynamic_keymap_reset(void) {
for (int row = 0; row < MATRIX_ROWS; row++) {
for (int column = 0; column < MATRIX_COLS; column++) {
if (layer < keymap_layer_count()) {
- dynamic_keymap_set_keycode(layer, row, column, pgm_read_word(&keymaps[layer][row][column]));
+ dynamic_keymap_set_keycode(layer, row, column, keycode_at_keymap_location_raw(layer, row, column));
} else {
dynamic_keymap_set_keycode(layer, row, column, KC_TRANSPARENT);
}
@@ -162,8 +168,8 @@ void dynamic_keymap_reset(void) {
#ifdef ENCODER_MAP_ENABLE
for (int encoder = 0; encoder < NUM_ENCODERS; encoder++) {
if (layer < encodermap_layer_count()) {
- dynamic_keymap_set_encoder(layer, encoder, true, pgm_read_word(&encoder_map[layer][encoder][0]));
- dynamic_keymap_set_encoder(layer, encoder, false, pgm_read_word(&encoder_map[layer][encoder][1]));
+ dynamic_keymap_set_encoder(layer, encoder, true, keycode_at_encodermap_location_raw(layer, encoder, true));
+ dynamic_keymap_set_encoder(layer, encoder, false, keycode_at_encodermap_location_raw(layer, encoder, false));
} else {
dynamic_keymap_set_encoder(layer, encoder, true, KC_TRANSPARENT);
dynamic_keymap_set_encoder(layer, encoder, false, KC_TRANSPARENT);
@@ -201,20 +207,21 @@ void dynamic_keymap_set_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
}
}
-// This overrides the one in quantum/keymap_common.c
-uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
- if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
- return dynamic_keymap_get_keycode(layer, key.row, key.col);
+uint16_t keycode_at_keymap_location(uint8_t layer_num, uint8_t row, uint8_t column) {
+ if (layer_num < DYNAMIC_KEYMAP_LAYER_COUNT && row < MATRIX_ROWS && column < MATRIX_COLS) {
+ return dynamic_keymap_get_keycode(layer_num, row, column);
}
+ return KC_NO;
+}
+
#ifdef ENCODER_MAP_ENABLE
- else if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) {
- return dynamic_keymap_get_encoder(layer, key.col, true);
- } else if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row == KEYLOC_ENCODER_CCW && key.col < NUM_ENCODERS) {
- return dynamic_keymap_get_encoder(layer, key.col, false);
+uint16_t keycode_at_encodermap_location(uint8_t layer_num, uint8_t encoder_idx, bool clockwise) {
+ if (layer_num < DYNAMIC_KEYMAP_LAYER_COUNT && encoder_idx < NUM_ENCODERS) {
+ return dynamic_keymap_get_encoder(layer_num, encoder_idx, clockwise);
}
-#endif // ENCODER_MAP_ENABLE
return KC_NO;
}
+#endif // ENCODER_MAP_ENABLE
uint8_t dynamic_keymap_macro_get_count(void) {
return DYNAMIC_KEYMAP_MACRO_COUNT;
diff --git a/quantum/eeconfig.c b/quantum/eeconfig.c
index 0ff9996ca413..195a0ecf0a69 100644
--- a/quantum/eeconfig.c
+++ b/quantum/eeconfig.c
@@ -46,7 +46,8 @@ void eeconfig_init_quantum(void) {
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0);
default_layer_state = 0;
eeprom_update_byte(EECONFIG_KEYMAP_LOWER_BYTE, 0);
- eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0x4);
+ // Enable oneshot and autocorrect by default: 0b0001 0100
+ eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0x14);
eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0);
eeprom_update_byte(EECONFIG_BACKLIGHT, 0);
eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default
diff --git a/quantum/encoder.c b/quantum/encoder.c
index bbe7d875c09b..6d8e3b724a18 100644
--- a/quantum/encoder.c
+++ b/quantum/encoder.c
@@ -144,14 +144,9 @@ void encoder_init(void) {
static void encoder_exec_mapping(uint8_t index, bool clockwise) {
// The delays below cater for Windows and its wonderful requirements.
action_exec(clockwise ? ENCODER_CW_EVENT(index, true) : ENCODER_CCW_EVENT(index, true));
-# if ENCODER_MAP_KEY_DELAY > 0
wait_ms(ENCODER_MAP_KEY_DELAY);
-# endif // ENCODER_MAP_KEY_DELAY > 0
-
action_exec(clockwise ? ENCODER_CW_EVENT(index, false) : ENCODER_CCW_EVENT(index, false));
-# if ENCODER_MAP_KEY_DELAY > 0
wait_ms(ENCODER_MAP_KEY_DELAY);
-# endif // ENCODER_MAP_KEY_DELAY > 0
}
#endif // ENCODER_MAP_ENABLE
diff --git a/quantum/geekrgb.c b/quantum/geekrgb.c
new file mode 100644
index 000000000000..4965c6ec20b6
--- /dev/null
+++ b/quantum/geekrgb.c
@@ -0,0 +1,124 @@
+/* Copyright 2022 puterjam
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "quantum.h"
+#include "geekrgb.h"
+#include "raw_hid.h"
+
+#if !defined(GEEKRGB_STARTUP_RED)
+# define GEEKRGB_STARTUP_RED 20
+#endif
+
+#if !defined(GEEKRGB_STARTUP_GREEN)
+# define GEEKRGB_STARTUP_GREEN 120
+#endif
+
+#if !defined(GEEKRGB_STARTUP_BLUE)
+# define GEEKRGB_STARTUP_BLUE 190
+#endif
+
+
+// global
+uint16_t g_geekrgb_timer = 0;
+bool g_geekrgb_anim_playing = false;
+
+// internals
+static uint8_t geekrgb_mode = HID_MODE_OPENRGB;
+static RGB last_openrgb_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] = {GEEKRGB_STARTUP_GREEN, GEEKRGB_STARTUP_RED, GEEKRGB_STARTUP_BLUE}};
+
+
+//set one matrix led color
+void geekrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue){
+ if (rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) { // if matrix mode not signalrgb, do not streaming led.
+ return;
+ }
+
+ //cache openRGB colors
+ if (geekrgb_get_mode() == HID_MODE_OPENRGB) {
+ last_openrgb_colors[index].r = red;
+ last_openrgb_colors[index].g = green;
+ last_openrgb_colors[index].b = blue;
+ }else{
+# ifdef GEEKRGB_USE_UNIVERSAL_BRIGHTNESS
+ float brightness = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
+ rgb_matrix_set_color(index,brightness * red,brightness * green,brightness * blue);
+ #else
+ rgb_matrix_set_color(index, red , green, blue);
+# endif
+ }
+}
+
+ //set openrgb colors
+void geekrgb_reload_openrgb_colors(void){
+ if (geekrgb_get_mode() == HID_MODE_OPENRGB) {
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
+ geekrgb_set_color(i,last_openrgb_colors[i].r,last_openrgb_colors[i].g,last_openrgb_colors[i].b);
+ }
+ }
+}
+
+void geekrgb_reload_openrgb_anim(void){
+ if (!g_geekrgb_anim_playing) g_geekrgb_timer = 0;
+ rgb_matrix_set_color_all(0,0,0);
+}
+
+ //get openrgb colors
+RGB* geekrgb_get_openrgb_colors(void){
+ return last_openrgb_colors;
+}
+
+RGB geekrgb_get_openrgb_color(int index){
+ return last_openrgb_colors[index];
+}
+
+//set hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB
+void geekrgb_set_mode(int mode){
+ geekrgb_mode = mode;
+}
+
+//get hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB
+uint8_t geekrgb_get_mode(void){
+ return geekrgb_mode;
+}
+
+//receive HIDRGB usbhid raw data.
+void rgb_hid_receive(uint8_t *data, uint8_t length) {
+ bool send = false;
+
+ switch (*data) {
+#ifdef OPENRGB_ENABLE
+ case 1 ... 9: {
+ send = openrgb_command_handler(data, length);
+ break;
+ }
+#endif
+
+#ifdef SIGNALRGB_SUPPORT_ENABLE
+ case 0x21 ... 0x28: {
+ send = signal_rgb_command_handler(data, length);
+ break;
+ }
+#endif
+ default: {
+ // id_unhandled
+ break;
+ }
+ }
+
+ if (send) {
+ rgb_hid_send(data, length);
+ }
+}
diff --git a/quantum/geekrgb.h b/quantum/geekrgb.h
new file mode 100644
index 000000000000..9101f1b43b64
--- /dev/null
+++ b/quantum/geekrgb.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 PuterJam (puterjam@gmail.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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+#include "color.h"
+
+
+enum hidrgb_mode {
+ HID_MODE_OPENRGB = 1,
+ HID_MODE_SIGNALRGB,
+};
+
+extern uint16_t g_geekrgb_timer;
+extern bool g_geekrgb_anim_playing;
+
+void geekrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); //set one led color
+void geekrgb_set_mode(int mode); //set hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB
+uint8_t geekrgb_get_mode(void); //get software mode
+
+void geekrgb_reload_openrgb_colors(void); //reload openrgb colors
+void geekrgb_reload_openrgb_anim(void);//reload openrgb colors in animation
+RGB* geekrgb_get_openrgb_colors(void); //get openrgb colors
+RGB geekrgb_get_openrgb_color(int index);
+
diff --git a/quantum/hidrgb.c b/quantum/hidrgb.c
deleted file mode 100644
index adc9a3419874..000000000000
--- a/quantum/hidrgb.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "quantum.h"
-#include "raw_hid.h"
-
-void rgb_hid_receive(uint8_t *data, uint8_t length) {
- bool send = false;
-
- switch (*data) {
-#ifdef OPENRGB_ENABLE
- case 1 ... 9: {
- send = openrgb_command_handler(data, length);
- break;
- }
-#endif
-#ifdef SIGNALRGB_SUPPORT_ENABLE
- case 0x21 ... 0x28: {
- send = signal_rgb_command_handler(data, length);
- break;
- }
-#endif
- default: {
- // id_unhandled
- break;
- }
- }
-
- if (send) {
- rgb_hid_send(data, length);
- }
-}
diff --git a/quantum/keyboard.c b/quantum/keyboard.c
index 1c62a43d9d78..17651a9e98d8 100644
--- a/quantum/keyboard.c
+++ b/quantum/keyboard.c
@@ -170,12 +170,11 @@ uint32_t get_matrix_scan_rate(void) {
#endif
#ifdef MATRIX_HAS_GHOST
-extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata) {
matrix_row_t out = 0;
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
// read each key in the row data and check if the keymap defines it as a real key
- if (pgm_read_byte(&keymaps[0][row][col]) && (rowdata & (1 << col))) {
+ if (keycode_at_keymap_location(0, row, col) && (rowdata & (1 << col))) {
// this creates new row data, if a key is defined in the keymap, it will be set here
out |= 1 << col;
}
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 8d7a8bda9a5c..9a916b8a0256 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -147,13 +147,13 @@ action_t action_for_keycode(uint16_t keycode) {
// translates key to keycode
__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
- return pgm_read_word(&keymaps[layer][key.row][key.col]);
+ return keycode_at_keymap_location(layer, key.row, key.col);
}
#ifdef ENCODER_MAP_ENABLE
else if (key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) {
- return pgm_read_word(&encoder_map[layer][key.col][0]);
+ return keycode_at_encodermap_location(layer, key.col, true);
} else if (key.row == KEYLOC_ENCODER_CCW && key.col < NUM_ENCODERS) {
- return pgm_read_word(&encoder_map[layer][key.col][1]);
+ return keycode_at_encodermap_location(layer, key.col, false);
}
#endif // ENCODER_MAP_ENABLE
return KC_NO;
diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c
index 179b5eb03762..93aab82fcccf 100644
--- a/quantum/keymap_introspection.c
+++ b/quantum/keymap_introspection.c
@@ -19,6 +19,17 @@ uint8_t keymap_layer_count(void) {
_Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT");
+uint16_t keycode_at_keymap_location_raw(uint8_t layer_num, uint8_t row, uint8_t column) {
+ if (layer_num < NUM_KEYMAP_LAYERS && row < MATRIX_ROWS && column < MATRIX_COLS) {
+ return pgm_read_word(&keymaps[layer_num][row][column]);
+ }
+ return KC_NO;
+}
+
+__attribute__((weak)) uint16_t keycode_at_keymap_location(uint8_t layer_num, uint8_t row, uint8_t column) {
+ return keycode_at_keymap_location_raw(layer_num, row, column);
+}
+
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
# define NUM_ENCODERMAP_LAYERS ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (2) * sizeof(uint16_t))))
@@ -29,4 +40,15 @@ uint8_t encodermap_layer_count(void) {
_Static_assert(NUM_KEYMAP_LAYERS == NUM_ENCODERMAP_LAYERS, "Number of encoder_map layers doesn't match the number of keymap layers");
+uint16_t keycode_at_encodermap_location_raw(uint8_t layer_num, uint8_t encoder_idx, bool clockwise) {
+ if (layer_num < NUM_ENCODERMAP_LAYERS && encoder_idx < NUM_ENCODERS) {
+ return pgm_read_word(&encoder_map[layer_num][encoder_idx][clockwise ? 0 : 1]);
+ }
+ return KC_NO;
+}
+
+__attribute__((weak)) uint16_t keycode_at_encodermap_location(uint8_t layer_num, uint8_t encoder_idx, bool clockwise) {
+ return keycode_at_encodermap_location_raw(layer_num, encoder_idx, clockwise);
+}
+
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
diff --git a/quantum/keymap_introspection.h b/quantum/keymap_introspection.h
index 23f6f2016fae..9de706a02196 100644
--- a/quantum/keymap_introspection.h
+++ b/quantum/keymap_introspection.h
@@ -7,9 +7,19 @@
// Get the number of layers defined in the keymap
uint8_t keymap_layer_count(void);
+// Get the keycode for the keymap location, stored in firmware rather than any other persistent storage
+uint16_t keycode_at_keymap_location_raw(uint8_t layer_num, uint8_t row, uint8_t column);
+// Get the keycode for the keymap location, potentially stored dynamically
+uint16_t keycode_at_keymap_location(uint8_t layer_num, uint8_t row, uint8_t column);
+
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
// Get the number of layers defined in the encoder map
uint8_t encodermap_layer_count(void);
+// Get the keycode for the encoder mapping location, stored in firmware rather than any other persistent storage
+uint16_t keycode_at_encodermap_location_raw(uint8_t layer_num, uint8_t encoder_idx, bool clockwise);
+// Get the keycode for the encoder mapping location, potentially stored dynamically
+uint16_t keycode_at_encodermap_location(uint8_t layer_num, uint8_t encoder_idx, bool clockwise);
+
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
diff --git a/quantum/openrgb.c b/quantum/openrgb.c
index 510aba39f948..34d997d98dcf 100644
--- a/quantum/openrgb.c
+++ b/quantum/openrgb.c
@@ -14,13 +14,14 @@
* along with this program. If not, see .
*/
-#ifndef HIDRGB_ENABLE
+#ifndef GEEKRGB_ENABLE
# error "HID RGB Communication is not enabled" //This should be impossible to run into afaik. Common_features ensures RAWHID is enabled.
#endif
#include "version.h"
#include "quantum.h"
#include "openrgb.h"
+#include "geekrgb.h"
#include "raw_hid.h"
#include "string.h"
#include
@@ -31,19 +32,6 @@
# define OPENRGB_DEFAULT_KEYMAP_ID 0 // default keyamp id,read keymap by id from u keyboard
#endif
-#if !defined(OPENRGB_DIRECT_MODE_STARTUP_RED)
-# define OPENRGB_DIRECT_MODE_STARTUP_RED 40
-#endif
-
-#if !defined(OPENRGB_DIRECT_MODE_STARTUP_GREEN)
-# define OPENRGB_DIRECT_MODE_STARTUP_GREEN 40
-#endif
-
-#if !defined(OPENRGB_DIRECT_MODE_STARTUP_BLUE)
-# define OPENRGB_DIRECT_MODE_STARTUP_BLUE 240
-#endif
-
-RGB g_openrgb_direct_mode_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] = {OPENRGB_DIRECT_MODE_STARTUP_GREEN, OPENRGB_DIRECT_MODE_STARTUP_RED, OPENRGB_DIRECT_MODE_STARTUP_BLUE}};
static const uint8_t openrgb_rgb_matrix_effects_indexes[] = {
1, 2,
@@ -275,6 +263,7 @@ void openrgb_get_mode_info(void) {
void openrgb_get_led_info(uint8_t *data) {
const uint8_t first_led = data[1];
const uint8_t number_leds = data[2];
+ const RGB* openrgb_colors = geekrgb_get_openrgb_colors();
raw_hid_buffer[0] = OPENRGB_GET_LED_INFO;
@@ -288,9 +277,10 @@ void openrgb_get_led_info(uint8_t *data) {
raw_hid_buffer[data_idx + 1] = g_led_config.point[led_idx].x;
raw_hid_buffer[data_idx + 2] = g_led_config.point[led_idx].y;
raw_hid_buffer[data_idx + 3] = g_led_config.flags[led_idx];
- raw_hid_buffer[data_idx + 4] = g_openrgb_direct_mode_colors[led_idx].r;
- raw_hid_buffer[data_idx + 5] = g_openrgb_direct_mode_colors[led_idx].g;
- raw_hid_buffer[data_idx + 6] = g_openrgb_direct_mode_colors[led_idx].b;
+
+ raw_hid_buffer[data_idx + 4] = openrgb_colors[led_idx].r;
+ raw_hid_buffer[data_idx + 5] = openrgb_colors[led_idx].g;
+ raw_hid_buffer[data_idx + 6] = openrgb_colors[led_idx].b;
}
uint8_t row = 0;
@@ -311,7 +301,7 @@ void openrgb_get_led_info(uint8_t *data) {
}
if (col >= MATRIX_COLS || row >= MATRIX_ROWS) {
- raw_hid_buffer[data_idx + 7] = KC_NO;
+ raw_hid_buffer[data_idx + 7] = KC_UNDEFINED; // fix some kb, has no keymap led
}
else {
raw_hid_buffer[data_idx + 7] = pgm_read_byte(&keymaps[OPENRGB_DEFAULT_KEYMAP_ID][row][col]);
@@ -340,8 +330,7 @@ void openrgb_set_mode(uint8_t *data) {
return;
}
- dprintf("set mode :%d\n",mode);
-
+ geekrgb_set_mode(HID_MODE_OPENRGB);
if (save == 1) {
rgb_matrix_mode(mode);
@@ -349,19 +338,23 @@ void openrgb_set_mode(uint8_t *data) {
rgb_matrix_sethsv(h, s, v);
}
else {
- // if (mode == 0){
- // rgb_matrix_mode_noeeprom(RGB_MATRIX_OPENRGB_DIRECT);
- // }else{
- rgb_matrix_mode_noeeprom(mode);
- // }
-
+ rgb_matrix_mode_noeeprom(mode);
rgb_matrix_set_speed_noeeprom(speed);
rgb_matrix_sethsv_noeeprom(h, s, v);
}
+ if (rgb_matrix_get_mode() == RGB_MATRIX_GEEKRGB) { // if matrix mode not signalrgb, do not streaming led.
+ geekrgb_reload_openrgb_anim();
+ }
+
raw_hid_buffer[OPENRGB_EPSIZE - 2] = OPENRGB_SUCCESS;
}
void openrgb_direct_mode_set_single_led(uint8_t *data) {
+ if (geekrgb_get_mode() != HID_MODE_OPENRGB || rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) {
+ raw_hid_buffer[OPENRGB_EPSIZE - 2] = OPENRGB_FAILURE;
+ return;
+ }
+
const uint8_t led = data[1];
const uint8_t r = data[2];
const uint8_t g = data[3];
@@ -374,21 +367,21 @@ void openrgb_direct_mode_set_single_led(uint8_t *data) {
return;
}
- g_openrgb_direct_mode_colors[led].r = r;
- g_openrgb_direct_mode_colors[led].g = g;
- g_openrgb_direct_mode_colors[led].b = b;
+ geekrgb_set_color(led,r,g,b);
raw_hid_buffer[OPENRGB_EPSIZE - 2] = OPENRGB_SUCCESS;
}
void openrgb_direct_mode_set_leds(uint8_t *data) {
+ if (geekrgb_get_mode() != HID_MODE_OPENRGB || rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) {
+ return;
+ }
+
const uint8_t number_leds = data[1];
for (uint8_t i = 0; i < number_leds; i++) {
const uint8_t data_idx = i * 4;
const uint8_t color_idx = data[data_idx + 2];
- g_openrgb_direct_mode_colors[color_idx].r = data[data_idx + 3];
- g_openrgb_direct_mode_colors[color_idx].g = data[data_idx + 4];
- g_openrgb_direct_mode_colors[color_idx].b = data[data_idx + 5];
+ geekrgb_set_color(color_idx,data[data_idx + 3],data[data_idx + 4],data[data_idx + 5]);
}
}
diff --git a/quantum/openrgb.h b/quantum/openrgb.h
index d8525dff1712..0ec5223faee3 100644
--- a/quantum/openrgb.h
+++ b/quantum/openrgb.h
@@ -39,7 +39,7 @@ enum openrgb_responses {
OPENRGB_END_OF_MESSAGE = 100,
};
-extern RGB g_openrgb_direct_mode_colors[DRIVER_LED_TOTAL];
+// extern RGB g_openrgb_direct_mode_colors[DRIVER_LED_TOTAL];
bool openrgb_command_handler(uint8_t *data, uint8_t length);
void openrgb_get_protocol_version(void);
void openrgb_get_qmk_version(void);
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 092209f873a6..0eb69be06cd8 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -210,18 +210,22 @@ extern layer_state_t layer_state;
# include "joystick.h"
#endif
-#ifdef SIGNALRGB_SUPPORT_ENABLE
-# include "signalrgb.h"
-#endif
-
#ifdef VIA_ENABLE
# include "via.h"
#endif
+#ifdef SIGNALRGB_SUPPORT_ENABLE
+# include "signalrgb.h"
+#endif
+
#ifdef OPENRGB_ENABLE
# include "openrgb.h"
#endif
+#ifdef GEEKRGB_ENABLE
+# include "geekrgb.h"
+#endif
+
#ifdef WPM_ENABLE
# include "wpm.h"
#endif
diff --git a/quantum/raw_hid.h b/quantum/raw_hid.h
index 06bd41c1a1aa..ec55458e520c 100644
--- a/quantum/raw_hid.h
+++ b/quantum/raw_hid.h
@@ -4,6 +4,7 @@ void raw_hid_receive(uint8_t *data, uint8_t length);
void raw_hid_send(uint8_t *data, uint8_t length);
+// HIDRGB RAW HID
void rgb_hid_send(uint8_t *data, uint8_t length);
void rgb_hid_receive(uint8_t *data, uint8_t length);
diff --git a/quantum/rgb_matrix/animations/geek_rgb_anim.h b/quantum/rgb_matrix/animations/geek_rgb_anim.h
new file mode 100644
index 000000000000..42fb4f5d2df3
--- /dev/null
+++ b/quantum/rgb_matrix/animations/geek_rgb_anim.h
@@ -0,0 +1,60 @@
+#ifdef GEEKRGB_ENABLE
+RGB_MATRIX_EFFECT(GEEKRGB)
+# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
+
+#if !defined(GEEKRGB_WELCOME_ANIM_SPD)
+# define GEEKRGB_WELCOME_ANIM_SPD 255
+#endif
+
+
+static void set_openrgb_color(uint8_t led_index, uint8_t val){
+ RGB rgb = geekrgb_get_openrgb_color(led_index);
+
+# ifdef GEEKRGB_USE_UNIVERSAL_BRIGHTNESS
+ float brightness = (float) val / UINT8_MAX;
+ rgb_matrix_set_color(led_index, rgb.r * brightness, rgb.g * brightness, rgb.b * brightness);
+ #else
+ rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b);
+# endif
+
+
+
+}
+
+bool GEEKRGB(effect_params_t* params){
+ RGB_MATRIX_USE_LIMITS(led_min, led_max);
+
+ void set_openrgb_colors(effect_params_t * params) {
+ uint8_t time = scale16by8(g_geekrgb_timer, GEEKRGB_WELCOME_ANIM_SPD); //FIXED SPEED
+ HSV hsv = rgb_matrix_config.hsv;
+ g_geekrgb_anim_playing = (time != UINT8_MAX);
+
+ for (uint8_t i = led_min; i < led_max; i++) {
+ RGB_MATRIX_TEST_LED_FLAGS();
+ if (g_geekrgb_anim_playing) { //play loop loading animation
+ int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
+ int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
+ hsv.v = 0;
+
+ int16_t effect = time - sqrt16(dx * dx + dy * dy);
+ if (effect < 0) effect = 0;
+
+ hsv.v = qadd8(hsv.v, effect);
+ hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
+ }
+
+ set_openrgb_color(i, hsv.v);
+ }
+
+ if (g_geekrgb_anim_playing) g_geekrgb_timer++; //tick counter
+ }
+
+ if (geekrgb_get_mode() == HID_MODE_OPENRGB) {
+ set_openrgb_colors(params);
+ }
+
+ return rgb_matrix_check_finished_leds(led_max);
+}
+
+# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif
diff --git a/quantum/rgb_matrix/animations/openrgb_direct_anim.h b/quantum/rgb_matrix/animations/openrgb_direct_anim.h
deleted file mode 100644
index 11740c2a1306..000000000000
--- a/quantum/rgb_matrix/animations/openrgb_direct_anim.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifdef OPENRGB_ENABLE
-RGB_MATRIX_EFFECT(OPENRGB_DIRECT)
-# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
-
-bool OPENRGB_DIRECT(effect_params_t* params) {
- RGB_MATRIX_USE_LIMITS(led_min, led_max);
-
- for (uint8_t i = led_min; i < led_max; i++) {
- #ifdef HIDRGB_USE_UNIVERSAL_BRIGHTNESS
- float brightness = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
- rgb_matrix_set_color(
- i,
- brightness * g_openrgb_direct_mode_colors[i].r,
- brightness * g_openrgb_direct_mode_colors[i].g,
- brightness * g_openrgb_direct_mode_colors[i].b
- );
- #else
- rgb_matrix_set_color(
- i,
- g_openrgb_direct_mode_colors[i].r,
- g_openrgb_direct_mode_colors[i].g,
- g_openrgb_direct_mode_colors[i].b
- );
- #endif
- }
- return rgb_matrix_check_finished_leds(led_max);
-}
-# endif
-#endif
diff --git a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc
index 3d5511e13681..5ed09786cc61 100644
--- a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc
+++ b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc
@@ -38,6 +38,4 @@
#include "pixel_rain_anim.h"
#include "pixel_flow_anim.h"
#include "pixel_fractal_anim.h"
-#include "openrgb_direct_anim.h"
-#include "signalrgb_anim.h"
-
+#include "geek_rgb_anim.h"
diff --git a/quantum/rgb_matrix/animations/signalrgb_anim.h b/quantum/rgb_matrix/animations/signalrgb_anim.h
deleted file mode 100644
index a0edb62c6c06..000000000000
--- a/quantum/rgb_matrix/animations/signalrgb_anim.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifdef SIGNALRGB_SUPPORT_ENABLE
-RGB_MATRIX_EFFECT(SIGNALRGB)
-# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
-
-bool SIGNALRGB(effect_params_t* params)
-{
- RGB_MATRIX_USE_LIMITS(led_min, led_max);
-
- for (uint8_t i = led_min; i < led_max; i++) {
- #ifdef HIDRGB_USE_UNIVERSAL_BRIGHTNESS
- float brightness = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
- rgb_matrix_set_color(
- i,
- brightness * g_signalrgb_mode_colors[i].r,
- brightness * g_signalrgb_mode_colors[i].g,
- brightness * g_signalrgb_mode_colors[i].b
- );
- #else
- rgb_matrix_set_color(
- i,
- g_signalrgb_mode_colors[i].r,
- g_signalrgb_mode_colors[i].g,
- g_signalrgb_mode_colors[i].b
- );
- #endif
- }
-
- return rgb_matrix_check_finished_leds(led_max);
-}
-
-# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
-#endif
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 43ed2f2795f8..28a03668a603 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -86,15 +86,11 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
#endif
#if !defined(RGB_MATRIX_STARTUP_MODE)
-# ifdef OPENRGB_ENABLE
-# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_OPENRGB_DIRECT
+# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
# else
-# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
-# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
-# else
// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace
-# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
-# endif
+# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
# endif
#endif
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 2fd8c7c3b114..07540c47d7f0 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -81,7 +81,7 @@
#endif
#define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \
- if (i >= led_min && i < led_max) { \
+ if (i >= led_min && i <= led_max) { \
rgb_matrix_set_color(i, r, g, b); \
}
diff --git a/quantum/signalrgb.c b/quantum/signalrgb.c
index bd9ac586324e..59840c305624 100644
--- a/quantum/signalrgb.c
+++ b/quantum/signalrgb.c
@@ -1,4 +1,4 @@
-#ifndef HIDRGB_ENABLE
+#ifndef GEEKRGB_ENABLE
# error "HID RGB Communication is not enabled" //This should be impossible to run into afaik. Common_features ensures RAWHID is enabled.
#endif
@@ -7,9 +7,9 @@
#include "signalrgb.h"
#include "color.h"
#include "string.h"
+#include "geekrgb.h"
static uint8_t packet[32];
-RGB g_signalrgb_mode_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] ={0,0,0}};
void get_qmk_version(void) //Grab the QMK Version the board's firmware is built off of
{
@@ -44,6 +44,10 @@ void led_streaming(uint8_t *data) //Stream data from HID Packets to Keyboard.
uint8_t index = data[1];
uint8_t numberofleds = data[2];
+ if (geekrgb_get_mode() != HID_MODE_SIGNALRGB) {
+ return;
+ }
+
// float brightness = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
if(numberofleds >= 10)
@@ -59,22 +63,26 @@ void led_streaming(uint8_t *data) //Stream data from HID Packets to Keyboard.
uint8_t g = data[offset + 1];
uint8_t b = data[offset + 2];
- g_signalrgb_mode_colors[index + i].r = r;
- g_signalrgb_mode_colors[index + i].g = g;
- g_signalrgb_mode_colors[index + i].b = b;
-
- //rgb_matrix_set_color(index + i, r, g, b);
+ geekrgb_set_color(index + i,r,g,b);
}
}
void signalrgb_mode_enable(void)
{
- rgb_matrix_mode_noeeprom(RGB_MATRIX_SIGNALRGB); //Set RGB Matrix to SignalRGB Compatible Mode
+ geekrgb_set_mode(HID_MODE_SIGNALRGB);
+ rgb_matrix_mode_noeeprom(RGB_MATRIX_GEEKRGB); //Set RGB Matrix to SignalRGB Compatible Mode
}
void signalrgb_mode_disable(void)
{
+ geekrgb_set_mode(HID_MODE_OPENRGB); //switch to OpenRGB mode
+#ifdef OPENRGB_ENABLE
+ geekrgb_reload_openrgb_anim();
+ #else
rgb_matrix_reload_from_eeprom(); //Reloading last effect from eeprom
+#endif
+
+
}
void signalrgb_total_leds(void)//Grab total number of leds that a board has.
diff --git a/quantum/signalrgb.h b/quantum/signalrgb.h
index afe98f4f064c..0296ef924360 100644
--- a/quantum/signalrgb.h
+++ b/quantum/signalrgb.h
@@ -3,13 +3,13 @@
enum signalrgb_commands
{
GET_QMK_VERSION = 0x21,
- GET_PROTOCOL_VERSION = 0x22,
- GET_UNIQUE_IDENTIFIER = 0x23,
- STREAM_RGB_DATA = 0x24,
- SET_SIGNALRGB_MODE_ENABLE = 0x25,
- SET_SIGNALRGB_MODE_DISABLE = 0x26,
- GET_TOTAL_LEDS = 0x27,
- GET_FIRMWARE_TYPE = 0x28,
+ GET_PROTOCOL_VERSION,
+ GET_UNIQUE_IDENTIFIER,
+ STREAM_RGB_DATA,
+ SET_SIGNALRGB_MODE_ENABLE,
+ SET_SIGNALRGB_MODE_DISABLE,
+ GET_TOTAL_LEDS,
+ GET_FIRMWARE_TYPE,
};
enum signalrgb_responses //These are a bit clunky right now. Could use improvement.
@@ -27,10 +27,9 @@ enum signalrgb_responses //These are a bit clunky right now. Could use improveme
DEVICE_ERROR_LEDS = 255, //Error code to show that there are more leds than a packet will allow.
};
-extern RGB g_signalrgb_mode_colors[DRIVER_LED_TOTAL];
+// extern RGB g_signalrgb_mode_colors[DRIVER_LED_TOTAL];
bool signal_rgb_command_handler(uint8_t *data, uint8_t length);
-
void get_qmk_version(void);
void get_signalrgb_protocol_version(void);
void get_unique_identifier(void);
diff --git a/quantum/unicode/unicode.c b/quantum/unicode/unicode.c
new file mode 100644
index 000000000000..e2bfd68a3ae5
--- /dev/null
+++ b/quantum/unicode/unicode.c
@@ -0,0 +1,386 @@
+/* Copyright 2022
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "unicode.h"
+
+#include "eeprom.h"
+#include "eeconfig.h"
+#include "action.h"
+#include "action_util.h"
+#include "host.h"
+#include "keycode.h"
+#include "wait.h"
+#include "send_string.h"
+#include "utf8.h"
+
+#if defined(AUDIO_ENABLE)
+# include "audio.h"
+#endif
+
+#if defined(UNICODE_ENABLE) + defined(UNICODEMAP_ENABLE) + defined(UCIS_ENABLE) > 1
+# error "Cannot enable more than one Unicode method (UNICODE, UNICODEMAP, UCIS) at the same time"
+#endif
+
+// Keycodes used for starting Unicode input on different platforms
+#ifndef UNICODE_KEY_MAC
+# define UNICODE_KEY_MAC KC_LEFT_ALT
+#endif
+#ifndef UNICODE_KEY_LNX
+# define UNICODE_KEY_LNX LCTL(LSFT(KC_U))
+#endif
+#ifndef UNICODE_KEY_WINC
+# define UNICODE_KEY_WINC KC_RIGHT_ALT
+#endif
+
+// Comma-delimited, ordered list of input modes selected for use (e.g. in cycle)
+// Example: #define UNICODE_SELECTED_MODES UC_WINC, UC_LNX
+#ifndef UNICODE_SELECTED_MODES
+# define UNICODE_SELECTED_MODES -1
+#endif
+
+// Whether input mode changes in cycle should be written to EEPROM
+#ifndef UNICODE_CYCLE_PERSIST
+# define UNICODE_CYCLE_PERSIST true
+#endif
+
+// Delay between starting Unicode input and sending a sequence, in ms
+#ifndef UNICODE_TYPE_DELAY
+# define UNICODE_TYPE_DELAY 10
+#endif
+
+unicode_config_t unicode_config;
+uint8_t unicode_saved_mods;
+led_t unicode_saved_led_state;
+
+#if UNICODE_SELECTED_MODES != -1
+static uint8_t selected[] = {UNICODE_SELECTED_MODES};
+static int8_t selected_count = ARRAY_SIZE(selected);
+static int8_t selected_index;
+#endif
+
+/** \brief unicode input mode set at user level
+ *
+ * Run user code on unicode input mode change
+ */
+__attribute__((weak)) void unicode_input_mode_set_user(uint8_t input_mode) {}
+
+/** \brief unicode input mode set at keyboard level
+ *
+ * Run keyboard code on unicode input mode change
+ */
+__attribute__((weak)) void unicode_input_mode_set_kb(uint8_t input_mode) {
+ unicode_input_mode_set_user(input_mode);
+}
+
+#ifdef AUDIO_ENABLE
+# ifdef UNICODE_SONG_MAC
+static float song_mac[][2] = UNICODE_SONG_MAC;
+# endif
+# ifdef UNICODE_SONG_LNX
+static float song_lnx[][2] = UNICODE_SONG_LNX;
+# endif
+# ifdef UNICODE_SONG_WIN
+static float song_win[][2] = UNICODE_SONG_WIN;
+# endif
+# ifdef UNICODE_SONG_BSD
+static float song_bsd[][2] = UNICODE_SONG_BSD;
+# endif
+# ifdef UNICODE_SONG_WINC
+static float song_winc[][2] = UNICODE_SONG_WINC;
+# endif
+# ifdef UNICODE_SONG_EMACS
+static float song_emacs[][2] = UNICODE_SONG_EMACS;
+# endif
+
+static void unicode_play_song(uint8_t mode) {
+ switch (mode) {
+# ifdef UNICODE_SONG_MAC
+ case UC_MAC:
+ PLAY_SONG(song_mac);
+ break;
+# endif
+# ifdef UNICODE_SONG_LNX
+ case UC_LNX:
+ PLAY_SONG(song_lnx);
+ break;
+# endif
+# ifdef UNICODE_SONG_WIN
+ case UC_WIN:
+ PLAY_SONG(song_win);
+ break;
+# endif
+# ifdef UNICODE_SONG_BSD
+ case UC_BSD:
+ PLAY_SONG(song_bsd);
+ break;
+# endif
+# ifdef UNICODE_SONG_WINC
+ case UC_WINC:
+ PLAY_SONG(song_winc);
+ break;
+# endif
+# ifdef UNICODE_SONG_EMACS
+ case UC_EMACS:
+ PLAY_SONG(song_emacs);
+ break;
+# endif
+ }
+}
+#endif
+
+void unicode_input_mode_init(void) {
+ unicode_config.raw = eeprom_read_byte(EECONFIG_UNICODEMODE);
+#if UNICODE_SELECTED_MODES != -1
+# if UNICODE_CYCLE_PERSIST
+ // Find input_mode in selected modes
+ int8_t i;
+ for (i = 0; i < selected_count; i++) {
+ if (selected[i] == unicode_config.input_mode) {
+ selected_index = i;
+ break;
+ }
+ }
+ if (i == selected_count) {
+ // Not found: input_mode isn't selected, change to one that is
+ unicode_config.input_mode = selected[selected_index = 0];
+ }
+# else
+ // Always change to the first selected input mode
+ unicode_config.input_mode = selected[selected_index = 0];
+# endif
+#endif
+ unicode_input_mode_set_kb(unicode_config.input_mode);
+ dprintf("Unicode input mode init to: %u\n", unicode_config.input_mode);
+}
+
+uint8_t get_unicode_input_mode(void) {
+ return unicode_config.input_mode;
+}
+
+void set_unicode_input_mode(uint8_t mode) {
+ unicode_config.input_mode = mode;
+ persist_unicode_input_mode();
+#ifdef AUDIO_ENABLE
+ unicode_play_song(mode);
+#endif
+ unicode_input_mode_set_kb(mode);
+ dprintf("Unicode input mode set to: %u\n", unicode_config.input_mode);
+}
+
+void cycle_unicode_input_mode(int8_t offset) {
+#if UNICODE_SELECTED_MODES != -1
+ selected_index = (selected_index + offset) % selected_count;
+ if (selected_index < 0) {
+ selected_index += selected_count;
+ }
+ unicode_config.input_mode = selected[selected_index];
+# if UNICODE_CYCLE_PERSIST
+ persist_unicode_input_mode();
+# endif
+# ifdef AUDIO_ENABLE
+ unicode_play_song(unicode_config.input_mode);
+# endif
+ unicode_input_mode_set_kb(unicode_config.input_mode);
+ dprintf("Unicode input mode cycle to: %u\n", unicode_config.input_mode);
+#endif
+}
+
+void persist_unicode_input_mode(void) {
+ eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode);
+}
+
+__attribute__((weak)) void unicode_input_start(void) {
+ unicode_saved_led_state = host_keyboard_led_state();
+
+ // Note the order matters here!
+ // Need to do this before we mess around with the mods, or else
+ // UNICODE_KEY_LNX (which is usually Ctrl-Shift-U) might not work
+ // correctly in the shifted case.
+ if (unicode_config.input_mode == UC_LNX && unicode_saved_led_state.caps_lock) {
+ tap_code(KC_CAPS_LOCK);
+ }
+
+ unicode_saved_mods = get_mods(); // Save current mods
+ clear_mods(); // Unregister mods to start from a clean state
+ clear_weak_mods();
+
+ switch (unicode_config.input_mode) {
+ case UC_MAC:
+ register_code(UNICODE_KEY_MAC);
+ break;
+ case UC_LNX:
+ tap_code16(UNICODE_KEY_LNX);
+ break;
+ case UC_WIN:
+ // For increased reliability, use numpad keys for inputting digits
+ if (!unicode_saved_led_state.num_lock) {
+ tap_code(KC_NUM_LOCK);
+ }
+ register_code(KC_LEFT_ALT);
+ wait_ms(UNICODE_TYPE_DELAY);
+ tap_code(KC_KP_PLUS);
+ break;
+ case UC_WINC:
+ tap_code(UNICODE_KEY_WINC);
+ tap_code(KC_U);
+ break;
+ case UC_EMACS:
+ // The usual way to type unicode in emacs is C-x-8 then the unicode number in hex
+ tap_code16(LCTL(KC_X));
+ tap_code16(KC_8);
+ tap_code16(KC_ENTER);
+ break;
+ }
+
+ wait_ms(UNICODE_TYPE_DELAY);
+}
+
+__attribute__((weak)) void unicode_input_finish(void) {
+ switch (unicode_config.input_mode) {
+ case UC_MAC:
+ unregister_code(UNICODE_KEY_MAC);
+ break;
+ case UC_LNX:
+ tap_code(KC_SPACE);
+ if (unicode_saved_led_state.caps_lock) {
+ tap_code(KC_CAPS_LOCK);
+ }
+ break;
+ case UC_WIN:
+ unregister_code(KC_LEFT_ALT);
+ if (!unicode_saved_led_state.num_lock) {
+ tap_code(KC_NUM_LOCK);
+ }
+ break;
+ case UC_WINC:
+ tap_code(KC_ENTER);
+ break;
+ case UC_EMACS:
+ tap_code16(KC_ENTER);
+ break;
+ }
+
+ set_mods(unicode_saved_mods); // Reregister previously set mods
+}
+
+__attribute__((weak)) void unicode_input_cancel(void) {
+ switch (unicode_config.input_mode) {
+ case UC_MAC:
+ unregister_code(UNICODE_KEY_MAC);
+ break;
+ case UC_LNX:
+ tap_code(KC_ESCAPE);
+ if (unicode_saved_led_state.caps_lock) {
+ tap_code(KC_CAPS_LOCK);
+ }
+ break;
+ case UC_WINC:
+ tap_code(KC_ESCAPE);
+ break;
+ case UC_WIN:
+ unregister_code(KC_LEFT_ALT);
+ if (!unicode_saved_led_state.num_lock) {
+ tap_code(KC_NUM_LOCK);
+ }
+ break;
+ case UC_EMACS:
+ tap_code16(LCTL(KC_G)); // C-g cancels
+ break;
+ }
+
+ set_mods(unicode_saved_mods); // Reregister previously set mods
+}
+
+// clang-format off
+
+static void send_nibble_wrapper(uint8_t digit) {
+ if (unicode_config.input_mode == UC_WIN) {
+ uint8_t kc = digit < 10
+ ? KC_KP_1 + (10 + digit - 1) % 10
+ : KC_A + (digit - 10);
+ tap_code(kc);
+ return;
+ }
+ send_nibble(digit);
+}
+
+// clang-format on
+
+void register_hex(uint16_t hex) {
+ for (int i = 3; i >= 0; i--) {
+ uint8_t digit = ((hex >> (i * 4)) & 0xF);
+ send_nibble_wrapper(digit);
+ }
+}
+
+void register_hex32(uint32_t hex) {
+ bool first_digit = true;
+ bool needs_leading_zero = (unicode_config.input_mode == UC_WINC);
+ for (int i = 7; i >= 0; i--) {
+ // Work out the digit we're going to transmit
+ uint8_t digit = ((hex >> (i * 4)) & 0xF);
+
+ // If we're still searching for the first digit, and found one
+ // that needs a leading zero sent out, send the zero.
+ if (first_digit && needs_leading_zero && digit > 9) {
+ send_nibble_wrapper(0);
+ }
+
+ // Always send digits (including zero) if we're down to the last
+ // two bytes of nibbles.
+ bool must_send = i < 4;
+
+ // If we've found a digit worth transmitting, do so.
+ if (digit != 0 || !first_digit || must_send) {
+ send_nibble_wrapper(digit);
+ first_digit = false;
+ }
+ }
+}
+
+void register_unicode(uint32_t code_point) {
+ if (code_point > 0x10FFFF || (code_point > 0xFFFF && unicode_config.input_mode == UC_WIN)) {
+ // Code point out of range, do nothing
+ return;
+ }
+
+ unicode_input_start();
+ if (code_point > 0xFFFF && unicode_config.input_mode == UC_MAC) {
+ // Convert code point to UTF-16 surrogate pair on macOS
+ code_point -= 0x10000;
+ uint32_t lo = code_point & 0x3FF, hi = (code_point & 0xFFC00) >> 10;
+ register_hex32(hi + 0xD800);
+ register_hex32(lo + 0xDC00);
+ } else {
+ register_hex32(code_point);
+ }
+ unicode_input_finish();
+}
+
+void send_unicode_string(const char *str) {
+ if (!str) {
+ return;
+ }
+
+ while (*str) {
+ int32_t code_point = 0;
+ str = decode_utf8(str, &code_point);
+
+ if (code_point >= 0) {
+ register_unicode(code_point);
+ }
+ }
+}
diff --git a/quantum/unicode/unicode.h b/quantum/unicode/unicode.h
new file mode 100644
index 000000000000..b3e43799ffae
--- /dev/null
+++ b/quantum/unicode/unicode.h
@@ -0,0 +1,165 @@
+/* Copyright 2022
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include
+
+#include "quantum.h"
+
+typedef union {
+ uint32_t raw;
+ struct {
+ uint8_t input_mode : 8;
+ };
+} unicode_config_t;
+
+extern unicode_config_t unicode_config;
+
+enum unicode_input_modes {
+ UC_MAC, // macOS using Unicode Hex Input
+ UC_LNX, // Linux using IBus
+ UC_WIN, // Windows using EnableHexNumpad
+ UC_BSD, // BSD (not implemented)
+ UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose)
+ UC_EMACS, // Emacs is an operating system in search of a good text editor
+ UC__COUNT // Number of available input modes (always leave at the end)
+};
+
+void unicode_input_mode_init(void);
+uint8_t get_unicode_input_mode(void);
+void set_unicode_input_mode(uint8_t mode);
+void cycle_unicode_input_mode(int8_t offset);
+void persist_unicode_input_mode(void);
+
+void unicode_input_mode_set_user(uint8_t input_mode);
+void unicode_input_mode_set_kb(uint8_t input_mode);
+
+void unicode_input_start(void);
+void unicode_input_finish(void);
+void unicode_input_cancel(void);
+
+void register_hex(uint16_t hex);
+void register_hex32(uint32_t hex);
+void register_unicode(uint32_t code_point);
+
+void send_unicode_string(const char *str);
+
+// clang-format off
+
+#define UC_BSPC UC(0x0008) // (backspace)
+
+#define UC_SPC UC(0x0020) // (space)
+#define UC_EXLM UC(0x0021) // !
+#define UC_DQUT UC(0x0022) // "
+#define UC_HASH UC(0x0023) // #
+#define UC_DLR UC(0x0024) // $
+#define UC_PERC UC(0x0025) // %
+#define UC_AMPR UC(0x0026) // &
+#define UC_QUOT UC(0x0027) // '
+#define UC_LPRN UC(0x0028) // (
+#define UC_RPRN UC(0x0029) // )
+#define UC_ASTR UC(0x002A) // *
+#define UC_PLUS UC(0x002B) // +
+#define UC_COMM UC(0x002C) // ,
+#define UC_DASH UC(0x002D) // -
+#define UC_DOT UC(0x002E) // .
+#define UC_SLSH UC(0x002F) // /
+
+#define UC_0 UC(0x0030) // 0
+#define UC_1 UC(0x0031) // 1
+#define UC_2 UC(0x0032) // 2
+#define UC_3 UC(0x0033) // 3
+#define UC_4 UC(0x0034) // 4
+#define UC_5 UC(0x0035) // 5
+#define UC_6 UC(0x0036) // 6
+#define UC_7 UC(0x0037) // 7
+#define UC_8 UC(0x0038) // 8
+#define UC_9 UC(0x0039) // 9
+#define UC_COLN UC(0x003A) // :
+#define UC_SCLN UC(0x003B) // ;
+#define UC_LT UC(0x003C) // <
+#define UC_EQL UC(0x003D) // =
+#define UC_GT UC(0x003E) // >
+#define UC_QUES UC(0x003F) // ?
+
+#define UC_AT UC(0x0040) // @
+#define UC_A UC(0x0041) // A
+#define UC_B UC(0x0042) // B
+#define UC_C UC(0x0043) // C
+#define UC_D UC(0x0044) // D
+#define UC_E UC(0x0045) // E
+#define UC_F UC(0x0046) // F
+#define UC_G UC(0x0047) // G
+#define UC_H UC(0x0048) // H
+#define UC_I UC(0x0049) // I
+#define UC_J UC(0x004A) // J
+#define UC_K UC(0x004B) // K
+#define UC_L UC(0x004C) // L
+#define UC_M UC(0x004D) // M
+#define UC_N UC(0x004E) // N
+#define UC_O UC(0x004F) // O
+
+#define UC_P UC(0x0050) // P
+#define UC_Q UC(0x0051) // Q
+#define UC_R UC(0x0052) // R
+#define UC_S UC(0x0053) // S
+#define UC_T UC(0x0054) // T
+#define UC_U UC(0x0055) // U
+#define UC_V UC(0x0056) // V
+#define UC_W UC(0x0057) // W
+#define UC_X UC(0x0058) // X
+#define UC_Y UC(0x0059) // Y
+#define UC_Z UC(0x005A) // Z
+#define UC_LBRC UC(0x005B) // [
+#define UC_BSLS UC(0x005C) // (backslash)
+#define UC_RBRC UC(0x005D) // ]
+#define UC_CIRM UC(0x005E) // ^
+#define UC_UNDR UC(0x005F) // _
+
+#define UC_GRV UC(0x0060) // `
+#define UC_a UC(0x0061) // a
+#define UC_b UC(0x0062) // b
+#define UC_c UC(0x0063) // c
+#define UC_d UC(0x0064) // d
+#define UC_e UC(0x0065) // e
+#define UC_f UC(0x0066) // f
+#define UC_g UC(0x0067) // g
+#define UC_h UC(0x0068) // h
+#define UC_i UC(0x0069) // i
+#define UC_j UC(0x006A) // j
+#define UC_k UC(0x006B) // k
+#define UC_l UC(0x006C) // l
+#define UC_m UC(0x006D) // m
+#define UC_n UC(0x006E) // n
+#define UC_o UC(0x006F) // o
+
+#define UC_p UC(0x0070) // p
+#define UC_q UC(0x0071) // q
+#define UC_r UC(0x0072) // r
+#define UC_s UC(0x0073) // s
+#define UC_t UC(0x0074) // t
+#define UC_u UC(0x0075) // u
+#define UC_v UC(0x0076) // v
+#define UC_w UC(0x0077) // w
+#define UC_x UC(0x0078) // x
+#define UC_y UC(0x0079) // y
+#define UC_z UC(0x007A) // z
+#define UC_LCBR UC(0x007B) // {
+#define UC_PIPE UC(0x007C) // |
+#define UC_RCBR UC(0x007D) // }
+#define UC_TILD UC(0x007E) // ~
+#define UC_DEL UC(0x007F) // (delete)
diff --git a/quantum/utf8.c b/quantum/unicode/utf8.c
similarity index 100%
rename from quantum/utf8.c
rename to quantum/unicode/utf8.c
diff --git a/quantum/utf8.h b/quantum/unicode/utf8.h
similarity index 91%
rename from quantum/utf8.h
rename to quantum/unicode/utf8.h
index fb10910944c2..521dd1918c36 100644
--- a/quantum/utf8.h
+++ b/quantum/unicode/utf8.h
@@ -18,4 +18,4 @@
#include
-const char *decode_utf8(const char *str, int32_t *code_point);
\ No newline at end of file
+const char *decode_utf8(const char *str, int32_t *code_point);
diff --git a/quantum/via.c b/quantum/via.c
index 37e2046a1010..60763796b896 100644
--- a/quantum/via.c
+++ b/quantum/via.c
@@ -397,6 +397,12 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
dynamic_keymap_set_buffer(offset, size, &command_data[3]);
break;
}
+#ifdef RAW_HID_CMD
+ case RAW_HID_CMD: {
+ raw_hid_receive_kb(data, length);
+ return;
+ }
+#endif
#ifdef ENCODER_MAP_ENABLE
case id_dynamic_keymap_get_encoder: {
uint16_t keycode = dynamic_keymap_get_encoder(command_data[0], command_data[1], command_data[2] != 0);
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
index 8b6c7fe2370d..a210416d98c8 100644
--- a/tmk_core/protocol/chibios/chibios.c
+++ b/tmk_core/protocol/chibios/chibios.c
@@ -74,7 +74,7 @@ void virtser_task(void);
void raw_hid_task(void);
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
void hidrgb_hid_task(void);
#endif
@@ -222,7 +222,7 @@ void protocol_post_task(void) {
#ifdef RAW_ENABLE
raw_hid_task();
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
hidrgb_hid_task();
#endif
}
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 0b41368462b2..1d3a844535cc 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -313,7 +313,7 @@ typedef struct {
#ifdef RAW_ENABLE
usb_driver_config_t raw_driver;
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
usb_driver_config_t hidrgb_driver;
#endif
#ifdef MIDI_ENABLE
@@ -352,7 +352,7 @@ static usb_driver_configs_t drivers = {
# define RAW_OUT_MODE USB_EP_MODE_TYPE_INTR
.raw_driver = QMK_USB_DRIVER_CONFIG(RAW, 0, false),
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
# define HIDRGB_IN_CAPACITY 4
# define HIDRGB_OUT_CAPACITY 4
# define HIDRGB_IN_MODE USB_EP_MODE_TYPE_INTR
@@ -1124,7 +1124,7 @@ void raw_hid_task(void) {
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
void rgb_hid_send(uint8_t *data, uint8_t length) {
// TODO: implement variable size packet
if (length != HIDRGB_EPSIZE) {
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index fb29bbf31b91..5c7967354ca9 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -86,7 +86,7 @@ extern keymap_config_t keymap_config;
# include "raw_hid.h"
#endif
-#if (defined(HIDRGB_ENABLE) && !defined(RAW_ENABLE))
+#if (defined(GEEKRGB_ENABLE) && !defined(RAW_ENABLE))
# include "raw_hid.h"
#endif
@@ -213,7 +213,7 @@ static void raw_hid_task(void) {
}
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
void rgb_hid_send(uint8_t *data, uint8_t length) {
// TODO: implement variable size packet
@@ -547,7 +547,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
ConfigSuccess &= Endpoint_ConfigureEndpoint((RAW_OUT_EPNUM | ENDPOINT_DIR_OUT), EP_TYPE_INTERRUPT, RAW_EPSIZE, 1);
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
ConfigSuccess &= Endpoint_ConfigureEndpoint((HIDRGB_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, HIDRGB_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint((HIDRGB_OUT_EPNUM | ENDPOINT_DIR_OUT), EP_TYPE_INTERRUPT, HIDRGB_EPSIZE, 1);
#endif
@@ -1177,7 +1177,7 @@ void protocol_post_task(void) {
raw_hid_task();
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
hidrgb_hid_task();
#endif
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 7d3e1276853d..9857d6638985 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -338,7 +338,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM RawReport[] = {
};
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM HIDRGBReport[] = {
HID_RI_USAGE_PAGE(16, HIDRGB_USAGE_PAGE), // Vendor Defined
HID_RI_USAGE(8, HIDRGB_USAGE_ID), // Vendor Defined
@@ -594,7 +594,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
},
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
.HIDRGB_Interface = {
.Header = {
.Size = sizeof(USB_Descriptor_Interface_t),
@@ -1235,7 +1235,7 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const
break;
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
case HIDRGB_INTERFACE:
Address = &ConfigurationDescriptor.HIDRGB_HID;
Size = sizeof(USB_HID_Descriptor_HID_t);
@@ -1300,7 +1300,7 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const
break;
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
case HIDRGB_INTERFACE:
Address = &HIDRGBReport;
Size = sizeof(HIDRGBReport);
diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h
index 073510f76609..8913abc2325e 100644
--- a/tmk_core/protocol/usb_descriptor.h
+++ b/tmk_core/protocol/usb_descriptor.h
@@ -78,7 +78,7 @@ typedef struct {
USB_Descriptor_Endpoint_t Raw_OUTEndpoint;
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
USB_Descriptor_Interface_t HIDRGB_Interface;
USB_HID_Descriptor_HID_t HIDRGB_HID;
USB_Descriptor_Endpoint_t HIDRGB_INEndpoint;
@@ -172,7 +172,7 @@ enum usb_interfaces {
RAW_INTERFACE,
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
HIDRGB_INTERFACE,
#endif
@@ -237,9 +237,9 @@ enum usb_endpoints {
# endif
#endif
-#ifdef HIDRGB_ENABLE
+#ifdef GEEKRGB_ENABLE
HIDRGB_IN_EPNUM = NEXT_EPNUM,
-# if STM32_USB_USE_OTG1
+# if USB_ENDPOINTS_ARE_REORDERABLE
# define HIDRGB_OUT_EPNUM HIDRGB_IN_EPNUM
# else
HIDRGB_OUT_EPNUM = NEXT_EPNUM,
diff --git a/tmk_core/protocol/usb_descriptor_common.h b/tmk_core/protocol/usb_descriptor_common.h
index 2809d31097c4..92f278967884 100644
--- a/tmk_core/protocol/usb_descriptor_common.h
+++ b/tmk_core/protocol/usb_descriptor_common.h
@@ -31,6 +31,12 @@
# define RAW_USAGE_ID 0x61
#endif
+#define RAW_USAGE_PAGE_HI ((uint8_t)(RAW_USAGE_PAGE >> 8))
+#define RAW_USAGE_PAGE_LO ((uint8_t)(RAW_USAGE_PAGE & 0xFF))
+
+/////////////////////
+// HIDRGB Usage page and ID configuration
+
#ifndef HIDRGB_USAGE_PAGE
# define HIDRGB_USAGE_PAGE 0xFF59
#endif
@@ -39,8 +45,5 @@
# define HIDRGB_USAGE_ID 0x60
#endif
-#define RAW_USAGE_PAGE_HI ((uint8_t)(RAW_USAGE_PAGE >> 8))
-#define RAW_USAGE_PAGE_LO ((uint8_t)(RAW_USAGE_PAGE & 0xFF))
-
#define HIDRGB_USAGE_PAGE_HI ((uint8_t)(HIDRGB_USAGE_PAGE >> 8))
#define HIDRGB_USAGE_PAGE_LO ((uint8_t)(HIDRGB_USAGE_PAGE & 0xFF))
diff --git a/users/dshields/config.h b/users/dshields/config.h
index 1420a9178f14..21a5c3500d6b 100644
--- a/users/dshields/config.h
+++ b/users/dshields/config.h
@@ -13,13 +13,9 @@
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
-#ifndef MOUSEKEY_TIME_TO_MAX
#define MOUSEKEY_TIME_TO_MAX 40
-#endif
#define MOUSEKEY_MAX_SPEED 7
-#ifndef MOUSEKEY_WHEEL_DELAY
#define MOUSEKEY_WHEEL_DELAY 0
-#endif
#undef ENABLE_RGB_MATRIX_ALPHAS_MODS
#undef ENABLE_RGB_MATRIX_BREATHING
diff --git a/users/dshields/dshields.h b/users/dshields/dshields.h
index 9ed0310645cf..34544b02600e 100644
--- a/users/dshields/dshields.h
+++ b/users/dshields/dshields.h
@@ -26,35 +26,22 @@
#define MT_L RALT_T(KC_L)
#define MT_SCLN RGUI_T(KC_SCLN)
-// layer-tap keys
-#if defined KEYBOARD_planck_light \
- || defined KEYBOARD_planck_rev3 \
- || defined KEYBOARD_planck_rev6 \
- || defined KEYBOARD_keyboardio_atreus
- #define LT_G LT(LWR, KC_G)
- #define LT_H LT(RSE, KC_H)
-#elif defined KEYBOARD_keyboardio_model01
- #define LT_G LT(FUN, KC_G)
- #define LT_H LT(FUN, KC_H)
-#else
- #define LT_G KC_G
- #define LT_H KC_H
-#endif
-
// LED/RGB controls
-#if defined KEYBOARD_planck_light
+#ifdef KEYBOARD_planck_light
#define LGT_TOG RGB_TOG
#define LGT_MOD RGB_MOD
#define LGT_BRT _______
#define LGT_INC RGB_HUI
#define LGT_DEC RGB_HUD
-#elif defined KEYBOARD_planck_rev3
+#endif
+#ifdef KEYBOARD_planck_rev3
#define LGT_TOG BL_TOGG
#define LGT_MOD BL_STEP
#define LGT_BRT BL_BRTG
#define LGT_INC BL_INC
#define LGT_DEC BL_DEC
-#else
+#endif
+#ifdef KEYBOARD_planck_rev6
#define LGT_TOG _______
#define LGT_MOD _______
#define LGT_BRT _______