aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio/audio.c5
-rw-r--r--quantum/command.c5
-rw-r--r--quantum/led_matrix/led_matrix.c55
-rw-r--r--quantum/led_matrix/led_matrix.h4
-rw-r--r--quantum/pointing_device/pointing_device.c42
-rw-r--r--quantum/pointing_device/pointing_device.h27
-rw-r--r--quantum/process_keycode/process_oneshot.c25
-rw-r--r--quantum/process_keycode/process_oneshot.h10
-rw-r--r--quantum/process_keycode/process_quantum.c76
-rw-r--r--quantum/process_keycode/process_quantum.h10
-rw-r--r--quantum/process_keycode/process_underglow.c5
-rw-r--r--quantum/quantum.c107
-rw-r--r--quantum/quantum.h1
-rw-r--r--quantum/quantum_keycodes.h13
-rw-r--r--quantum/quantum_keycodes_legacy.h64
-rw-r--r--quantum/rgb_matrix/animations/starlight_smooth_anim.h2
-rw-r--r--quantum/rgb_matrix/rgb_matrix.c56
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h4
-rw-r--r--quantum/via.c8
19 files changed, 351 insertions, 168 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index 4e223f0c9a..247b737331 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -371,8 +371,9 @@ void audio_play_melody(float (*np)[][2], uint16_t n_count, bool n_repeat) {
melody_current_note_duration = audio_duration_to_ms((*notes_pointer)[current_note][1]);
}
-float click[2][2];
-void audio_play_click(uint16_t delay, float pitch, uint16_t duration) {
+void audio_play_click(uint16_t delay, float pitch, uint16_t duration) {
+ static float click[2][2];
+
uint16_t duration_tone = audio_ms_to_duration(duration);
uint16_t duration_delay = audio_ms_to_duration(delay);
diff --git a/quantum/command.c b/quantum/command.c
index 998d9b9aa1..ea2fd68e2b 100644
--- a/quantum/command.c
+++ b/quantum/command.c
@@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_layer.h"
#include "action_util.h"
#include "eeconfig.h"
-#include "sleep_led.h"
#include "led.h"
#include "command.h"
#include "quantum.h"
@@ -39,6 +38,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "backlight.h"
#endif
+#ifdef SLEEP_LED_ENABLE
+# include "sleep_led.h"
+#endif
+
#if defined(MOUSEKEY_ENABLE)
# include "mousekey.h"
#endif
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index 7a0e8a5ebb..9c8004cc17 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -107,7 +107,11 @@ void eeconfig_update_led_matrix_default(void) {
void eeconfig_debug_led_matrix(void) {
dprintf("led_matrix_eeconfig EEPROM\n");
dprintf("led_matrix_eeconfig.enable = %d\n", led_matrix_eeconfig.enable);
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+ dprintf("led_matrix_eeconfig.mode = %d (%s)\n", led_matrix_eeconfig.mode, led_matrix_get_mode_name(led_matrix_eeconfig.mode));
+#else
dprintf("led_matrix_eeconfig.mode = %d\n", led_matrix_eeconfig.mode);
+#endif // LED_MATRIX_MODE_NAME_ENABLE
dprintf("led_matrix_eeconfig.val = %d\n", led_matrix_eeconfig.val);
dprintf("led_matrix_eeconfig.speed = %d\n", led_matrix_eeconfig.speed);
dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags);
@@ -525,7 +529,11 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
}
led_task_state = STARTING;
eeconfig_flag_led_matrix(write_to_eeprom);
- dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode);
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+ dprintf("led matrix mode [%s]: %u (%s)\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)led_matrix_eeconfig.mode, led_matrix_get_mode_name(led_matrix_eeconfig.mode));
+#else
+ dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)led_matrix_eeconfig.mode);
+#endif // LED_MATRIX_MODE_NAME_ENABLE
}
void led_matrix_mode_noeeprom(uint8_t mode) {
led_matrix_mode_eeprom_helper(mode, false);
@@ -652,3 +660,48 @@ void led_matrix_set_flags(led_flags_t flags) {
void led_matrix_set_flags_noeeprom(led_flags_t flags) {
led_matrix_set_flags_eeprom_helper(flags, false);
}
+
+// LED Matrix naming
+#undef LED_MATRIX_EFFECT
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+const char *led_matrix_get_mode_name(uint8_t mode) {
+ switch (mode) {
+ case LED_MATRIX_NONE:
+ return "NONE";
+
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_##name: \
+ return #name;
+# include "led_matrix_effects.inc"
+# undef LED_MATRIX_EFFECT
+
+# ifdef COMMUNITY_MODULES_ENABLE
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_COMMUNITY_MODULE_##name: \
+ return #name;
+# include "led_matrix_community_modules.inc"
+# undef LED_MATRIX_EFFECT
+# endif // COMMUNITY_MODULES_ENABLE
+
+# if defined(LED_MATRIX_CUSTOM_KB) || defined(LED_MATRIX_CUSTOM_USER)
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_CUSTOM_##name: \
+ return #name;
+
+# ifdef LED_MATRIX_CUSTOM_KB
+# include "led_matrix_kb.inc"
+# endif // LED_MATRIX_CUSTOM_KB
+
+# ifdef LED_MATRIX_CUSTOM_USER
+# include "led_matrix_user.inc"
+# endif // LED_MATRIX_CUSTOM_USER
+
+# undef LED_MATRIX_EFFECT
+# endif // LED_MATRIX_CUSTOM_KB || LED_MATRIX_CUSTOM_USER
+
+ default:
+ return "UNKNOWN";
+ }
+}
+# undef LED_MATRIX_EFFECT
+#endif // LED_MATRIX_MODE_NAME_ENABLE
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index 0dfe33ffab..9a49515ab2 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -184,6 +184,10 @@ led_flags_t led_matrix_get_flags(void);
void led_matrix_set_flags(led_flags_t flags);
void led_matrix_set_flags_noeeprom(led_flags_t flags);
+#ifdef LED_MATRIX_MODE_NAME_ENABLE
+const char *led_matrix_get_mode_name(uint8_t mode);
+#endif // LED_MATRIX_MODE_NAME_ENABLE
+
static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
#if defined(LED_MATRIX_SPLIT)
if (is_keyboard_left()) {
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c
index 564c2d294c..fe88d5a1af 100644
--- a/quantum/pointing_device/pointing_device.c
+++ b/quantum/pointing_device/pointing_device.c
@@ -80,8 +80,10 @@ uint16_t pointing_device_get_shared_cpi(void) {
#endif // defined(SPLIT_POINTING_ENABLE)
-static report_mouse_t local_mouse_report = {};
-static bool pointing_device_force_send = false;
+static report_mouse_t local_mouse_report = {};
+static bool pointing_device_force_send = false;
+static pointing_device_status_t pointing_device_status = POINTING_DEVICE_STATUS_UNKNOWN;
+
#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
static uint16_t hires_scroll_resolution;
#endif
@@ -90,7 +92,9 @@ static uint16_t hires_scroll_resolution;
#define POINTING_DEVICE_DRIVER(name) POINTING_DEVICE_DRIVER_CONCAT(name)
#ifdef POINTING_DEVICE_DRIVER_custom
-__attribute__((weak)) void pointing_device_driver_init(void) {}
+__attribute__((weak)) bool pointing_device_driver_init(void) {
+ return false;
+}
__attribute__((weak)) report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) {
return mouse_report;
}
@@ -179,7 +183,11 @@ __attribute__((weak)) void pointing_device_init(void) {
if ((POINTING_DEVICE_THIS_SIDE))
#endif
{
- pointing_device_driver->init();
+ if (pointing_device_driver->init()) {
+ pointing_device_status = POINTING_DEVICE_STATUS_SUCCESS;
+ } else {
+ pointing_device_status = POINTING_DEVICE_STATUS_INIT_FAILED;
+ }
#ifdef POINTING_DEVICE_MOTION_PIN
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
gpio_set_pin_input_high(POINTING_DEVICE_MOTION_PIN);
@@ -201,6 +209,28 @@ __attribute__((weak)) void pointing_device_init(void) {
}
/**
+ * @brief Gets status of pointing device
+ *
+ * Returns current pointing device status
+ * @return pointing_device_status_t
+ */
+__attribute__((weak)) pointing_device_status_t pointing_device_get_status(void) {
+#ifdef SPLIT_POINTING_ENABLE
+ // Assume target side is always good, split transaction checksum should stop additional reports being generated.
+ return POINTING_DEVICE_THIS_SIDE ? pointing_device_status : POINTING_DEVICE_STATUS_SUCCESS;
+#else
+ return pointing_device_status;
+#endif
+}
+
+/**
+ * @brief Sets status of pointing device
+ */
+void pointing_device_set_status(pointing_device_status_t status) {
+ pointing_device_status = status;
+}
+
+/**
* @brief Sends processed mouse report to host
*
* This sends the mouse report generated by pointing_device_task if changed since the last report. Once send zeros mouse report except buttons.
@@ -281,6 +311,10 @@ __attribute__((weak)) bool pointing_device_task(void) {
last_exec = timer_read32();
#endif
+ if (pointing_device_get_status() != POINTING_DEVICE_STATUS_SUCCESS) {
+ return false;
+ }
+
// Gather report info
#ifdef POINTING_DEVICE_MOTION_PIN
# if defined(SPLIT_POINTING_ENABLE)
diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h
index e7a0819ed9..5dfb9ce196 100644
--- a/quantum/pointing_device/pointing_device.h
+++ b/quantum/pointing_device/pointing_device.h
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "report.h"
typedef struct {
- void (*init)(void);
+ bool (*init)(void);
report_mouse_t (*get_report)(report_mouse_t mouse_report);
void (*set_cpi)(uint16_t);
uint16_t (*get_cpi)(void);
@@ -75,7 +75,7 @@ typedef struct {
# include "drivers/sensors/pmw33xx_common.h"
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
#else
-void pointing_device_driver_init(void);
+bool pointing_device_driver_init(void);
report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report);
uint16_t pointing_device_driver_get_cpi(void);
void pointing_device_driver_set_cpi(uint16_t cpi);
@@ -92,6 +92,13 @@ typedef enum {
POINTING_DEVICE_BUTTON8,
} pointing_device_buttons_t;
+typedef enum {
+ POINTING_DEVICE_STATUS_UNKNOWN,
+ POINTING_DEVICE_STATUS_INIT_FAILED,
+ POINTING_DEVICE_STATUS_FAILED,
+ POINTING_DEVICE_STATUS_SUCCESS,
+} pointing_device_status_t;
+
#ifdef MOUSE_EXTENDED_REPORT
typedef int32_t xy_clamp_range_t;
#else
@@ -107,13 +114,15 @@ typedef int16_t hv_clamp_range_t;
#define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt)))
#define CONSTRAIN_HID_XY(amt) ((amt) < MOUSE_REPORT_XY_MIN ? MOUSE_REPORT_XY_MIN : ((amt) > MOUSE_REPORT_XY_MAX ? MOUSE_REPORT_XY_MAX : (amt)))
-void pointing_device_init(void);
-bool pointing_device_task(void);
-bool pointing_device_send(void);
-report_mouse_t pointing_device_get_report(void);
-void pointing_device_set_report(report_mouse_t mouse_report);
-uint16_t pointing_device_get_cpi(void);
-void pointing_device_set_cpi(uint16_t cpi);
+void pointing_device_init(void);
+bool pointing_device_task(void);
+bool pointing_device_send(void);
+report_mouse_t pointing_device_get_report(void);
+void pointing_device_set_report(report_mouse_t mouse_report);
+uint16_t pointing_device_get_cpi(void);
+void pointing_device_set_cpi(uint16_t cpi);
+pointing_device_status_t pointing_device_get_status(void);
+void pointing_device_set_status(pointing_device_status_t status);
void pointing_device_init_kb(void);
void pointing_device_init_user(void);
diff --git a/quantum/process_keycode/process_oneshot.c b/quantum/process_keycode/process_oneshot.c
new file mode 100644
index 0000000000..6c43da1011
--- /dev/null
+++ b/quantum/process_keycode/process_oneshot.c
@@ -0,0 +1,25 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "process_oneshot.h"
+#include "action_util.h"
+
+bool process_oneshot(uint16_t keycode, keyrecord_t *record) {
+#ifndef NO_ACTION_ONESHOT
+ if (record->event.pressed) {
+ switch (keycode) {
+ case QK_ONE_SHOT_TOGGLE:
+ oneshot_toggle();
+ return false;
+ case QK_ONE_SHOT_ON:
+ oneshot_enable();
+ return false;
+ case QK_ONE_SHOT_OFF:
+ oneshot_disable();
+ return false;
+ }
+ }
+#endif
+
+ return true;
+}
diff --git a/quantum/process_keycode/process_oneshot.h b/quantum/process_keycode/process_oneshot.h
new file mode 100644
index 0000000000..11445b9b38
--- /dev/null
+++ b/quantum/process_keycode/process_oneshot.h
@@ -0,0 +1,10 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "action.h"
+
+bool process_oneshot(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_quantum.c b/quantum/process_keycode/process_quantum.c
new file mode 100644
index 0000000000..703e00755b
--- /dev/null
+++ b/quantum/process_keycode/process_quantum.c
@@ -0,0 +1,76 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "process_quantum.h"
+#include "quantum.h"
+
+#ifdef ENABLE_COMPILE_KEYCODE
+/** \brief Compiles the firmware, and adds the flash command based on keyboard bootloader
+ */
+static void send_make_command(void) {
+# ifdef NO_ACTION_ONESHOT
+ const uint8_t temp_mod = mod_config(get_mods());
+# else
+ const uint8_t temp_mod = mod_config(get_mods() | get_oneshot_mods());
+ clear_oneshot_mods();
+# endif
+ clear_mods();
+
+ SEND_STRING_DELAY("qmk", TAP_CODE_DELAY);
+ if (temp_mod & MOD_MASK_SHIFT) { // if shift is held, flash rather than compile
+ SEND_STRING_DELAY(" flash ", TAP_CODE_DELAY);
+ } else {
+ SEND_STRING_DELAY(" compile ", TAP_CODE_DELAY);
+ }
+# if defined(CONVERTER_ENABLED)
+ SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP " -e CONVERT_TO=" CONVERTER_TARGET SS_TAP(X_ENTER), TAP_CODE_DELAY);
+# else
+ SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP SS_TAP(X_ENTER), TAP_CODE_DELAY);
+# endif
+ if (temp_mod & MOD_MASK_SHIFT && temp_mod & MOD_MASK_CTRL) {
+ reset_keyboard();
+ }
+}
+#endif
+
+bool process_quantum(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ switch (keycode) {
+#ifndef NO_RESET
+ case QK_BOOTLOADER:
+ reset_keyboard();
+ return false;
+ case QK_REBOOT:
+ soft_reset_keyboard();
+ return false;
+#endif
+#ifndef NO_DEBUG
+ case QK_DEBUG_TOGGLE:
+ debug_enable ^= 1;
+ if (debug_enable) {
+ print("DEBUG: enabled.\n");
+ } else {
+ print("DEBUG: disabled.\n");
+ }
+ return false;
+#endif
+ case QK_CLEAR_EEPROM:
+#ifdef NO_RESET
+ eeconfig_init();
+#else
+ eeconfig_disable();
+ soft_reset_keyboard();
+#endif
+ return false;
+#ifdef ENABLE_COMPILE_KEYCODE
+ case QK_MAKE:
+ send_make_command();
+ return false;
+#endif
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
diff --git a/quantum/process_keycode/process_quantum.h b/quantum/process_keycode/process_quantum.h
new file mode 100644
index 0000000000..5c2462be01
--- /dev/null
+++ b/quantum/process_keycode/process_quantum.h
@@ -0,0 +1,10 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "action.h"
+
+bool process_quantum(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_underglow.c b/quantum/process_keycode/process_underglow.c
index b8d8989ef3..78006ee099 100644
--- a/quantum/process_keycode/process_underglow.c
+++ b/quantum/process_keycode/process_underglow.c
@@ -200,6 +200,11 @@ bool process_underglow(uint16_t keycode, keyrecord_t *record) {
}
#endif
return false;
+#ifdef VELOCIKEY_ENABLE
+ case QK_VELOCIKEY_TOGGLE:
+ velocikey_toggle();
+ return false;
+#endif
}
}
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 0bb6ee0a91..09e5fe1dac 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -15,6 +15,11 @@
*/
#include "quantum.h"
+#include "process_quantum.h"
+
+#ifdef SLEEP_LED_ENABLE
+# include "sleep_led.h"
+#endif
#ifdef BACKLIGHT_ENABLE
# include "process_backlight.h"
@@ -84,6 +89,10 @@
# include "process_layer_lock.h"
#endif
+#ifndef NO_ACTION_ONESHOT
+# include "process_oneshot.h"
+#endif
+
#ifdef AUDIO_ENABLE
# ifndef GOODBYE_SONG
# define GOODBYE_SONG SONG(GOODBYE_SOUND)
@@ -174,10 +183,6 @@ __attribute__((weak)) bool pre_process_record_user(uint16_t keycode, keyrecord_t
return true;
}
-__attribute__((weak)) bool process_action_kb(keyrecord_t *record) {
- return true;
-}
-
__attribute__((weak)) bool process_record_modules(uint16_t keycode, keyrecord_t *record) {
return true;
}
@@ -292,9 +297,10 @@ void post_process_record_quantum(keyrecord_t *record) {
post_process_record_kb(keycode, record);
}
-/* Core keycode function, hands off handling to other functions,
- then processes internal quantum keycodes, and then processes
- ACTIONs. */
+/** \brief Core keycode function
+ *
+ * Hands off handling to other quantum/process_keycode/ functions
+ */
bool process_record_quantum(keyrecord_t *record) {
uint16_t keycode = get_record_keycode(record, true);
@@ -439,85 +445,14 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef CONNECTION_ENABLE
process_connection(keycode, record) &&
#endif
- true)) {
- return false;
- }
-
- if (record->event.pressed) {
- switch (keycode) {
-#ifndef NO_RESET
- case QK_BOOTLOADER:
- reset_keyboard();
- return false;
- case QK_REBOOT:
- soft_reset_keyboard();
- return false;
-#endif
-#ifndef NO_DEBUG
- case QK_DEBUG_TOGGLE:
- debug_enable ^= 1;
- if (debug_enable) {
- print("DEBUG: enabled.\n");
- } else {
- print("DEBUG: disabled.\n");
- }
-#endif
- return false;
- case QK_CLEAR_EEPROM:
-#ifdef NO_RESET
- eeconfig_init();
-#else
- eeconfig_disable();
- soft_reset_keyboard();
-#endif
- return false;
-#ifdef VELOCIKEY_ENABLE
- case QK_VELOCIKEY_TOGGLE:
- velocikey_toggle();
- return false;
-#endif
#ifndef NO_ACTION_ONESHOT
- case QK_ONE_SHOT_TOGGLE:
- oneshot_toggle();
- break;
- case QK_ONE_SHOT_ON:
- oneshot_enable();
- break;
- case QK_ONE_SHOT_OFF:
- oneshot_disable();
- break;
-#endif
-#ifdef ENABLE_COMPILE_KEYCODE
- case QK_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
- {
-# ifdef NO_ACTION_ONESHOT
- const uint8_t temp_mod = mod_config(get_mods());
-# else
- const uint8_t temp_mod = mod_config(get_mods() | get_oneshot_mods());
- clear_oneshot_mods();
-# endif
- clear_mods();
-
- SEND_STRING_DELAY("qmk", TAP_CODE_DELAY);
- if (temp_mod & MOD_MASK_SHIFT) { // if shift is held, flash rather than compile
- SEND_STRING_DELAY(" flash ", TAP_CODE_DELAY);
- } else {
- SEND_STRING_DELAY(" compile ", TAP_CODE_DELAY);
- }
-# if defined(CONVERTER_ENABLED)
- SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP " -e CONVERT_TO=" CONVERTER_TARGET SS_TAP(X_ENTER), TAP_CODE_DELAY);
-# else
- SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP SS_TAP(X_ENTER), TAP_CODE_DELAY);
-# endif
- if (temp_mod & MOD_MASK_SHIFT && temp_mod & MOD_MASK_CTRL) {
- reset_keyboard();
- }
- }
+ process_oneshot(keycode, record) &&
#endif
- }
+ process_quantum(keycode, record))) {
+ return false;
}
- return process_action_kb(record);
+ return true;
}
void set_single_default_layer(uint8_t default_layer) {
@@ -556,6 +491,10 @@ void suspend_power_down_quantum(void) {
backlight_level_noeeprom(0);
# endif
+# ifdef SLEEP_LED_ENABLE
+ sleep_led_enable();
+# endif
+
# ifdef LED_MATRIX_ENABLE
led_matrix_task();
# endif
@@ -602,6 +541,10 @@ __attribute__((weak)) void suspend_wakeup_init_quantum(void) {
backlight_init();
#endif
+#ifdef SLEEP_LED_ENABLE
+ sleep_led_disable();
+#endif
+
// Restore LED indicators
led_wakeup();
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 3a994e9a03..0036cd784b 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -263,7 +263,6 @@ uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
bool pre_process_record_quantum(keyrecord_t *record);
bool pre_process_record_kb(uint16_t keycode, keyrecord_t *record);
bool pre_process_record_user(uint16_t keycode, keyrecord_t *record);
-bool process_action_kb(keyrecord_t *record);
bool process_record_kb(uint16_t keycode, keyrecord_t *record);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 515386756d..a1ae7ed0be 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -66,10 +66,6 @@
#define LCAG(kc) (QK_LCTL | QK_LALT | QK_LGUI | (kc))
#define LSAG(kc) (QK_LSFT | QK_LALT | QK_LGUI | (kc))
-#define SGUI(kc) LSG(kc)
-#define SCMD(kc) LSG(kc)
-#define SWIN(kc) LSG(kc)
-
#define RCTL(kc) (QK_RCTL | (kc))
#define RSFT(kc) (QK_RSFT | (kc))
#define RALT(kc) (QK_RALT | (kc))
@@ -90,8 +86,6 @@
#define RCAG(kc) (QK_RCTL | QK_RALT | QK_RGUI | (kc))
#define RSAG(kc) (QK_RSFT | QK_RALT | QK_RGUI | (kc))
-#define SAGR(kc) RSA(kc)
-
#define HYPR(kc) (QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI | (kc))
#define MEH(kc) (QK_LCTL | QK_LSFT | QK_LALT | (kc))
@@ -206,10 +200,6 @@
#define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc)
#define LSAG_T(kc) MT(MOD_LSFT | MOD_LALT | MOD_LGUI, kc)
-#define SGUI_T(kc) LSG_T(kc)
-#define SCMD_T(kc) LSG_T(kc)
-#define SWIN_T(kc) LSG_T(kc)
-
#define RCTL_T(kc) MT(MOD_RCTL, kc)
#define RSFT_T(kc) MT(MOD_RSFT, kc)
#define RALT_T(kc) MT(MOD_RALT, kc)
@@ -230,11 +220,8 @@
#define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc)
#define RSAG_T(kc) MT(MOD_RSFT | MOD_RALT | MOD_RGUI, kc)
-#define SAGR_T(kc) RSA_T(kc)
-
#define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc)
#define HYPR_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc)
-#define ALL_T(kc) HYPR_T(kc)
// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap
#define KC_HYPR HYPR(KC_NO)
diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h
index 55b0fc3596..e417591fe2 100644
--- a/quantum/quantum_keycodes_legacy.h
+++ b/quantum/quantum_keycodes_legacy.h
@@ -3,59 +3,17 @@
// clang-format off
// Deprecated Quantum keycodes
-#define RGB_TOG QK_UNDERGLOW_TOGGLE
-#define RGB_MOD QK_UNDERGLOW_MODE_NEXT
-#define RGB_MODE_FORWARD QK_UNDERGLOW_MODE_NEXT
-#define RGB_RMOD QK_UNDERGLOW_MODE_PREVIOUS
-#define RGB_MODE_REVERSE QK_UNDERGLOW_MODE_PREVIOUS
-#define RGB_HUI QK_UNDERGLOW_HUE_UP
-#define RGB_HUD QK_UNDERGLOW_HUE_DOWN
-#define RGB_SAI QK_UNDERGLOW_SATURATION_UP
-#define RGB_SAD QK_UNDERGLOW_SATURATION_DOWN
-#define RGB_VAI QK_UNDERGLOW_VALUE_UP
-#define RGB_VAD QK_UNDERGLOW_VALUE_DOWN
-#define RGB_SPI QK_UNDERGLOW_SPEED_UP
-#define RGB_SPD QK_UNDERGLOW_SPEED_DOWN
-
-#define KC_MS_UP QK_MOUSE_CURSOR_UP
-#define KC_MS_U QK_MOUSE_CURSOR_UP
-#define KC_MS_DOWN QK_MOUSE_CURSOR_DOWN
-#define KC_MS_D QK_MOUSE_CURSOR_DOWN
-#define KC_MS_LEFT QK_MOUSE_CURSOR_LEFT
-#define KC_MS_L QK_MOUSE_CURSOR_LEFT
-#define KC_MS_RIGHT QK_MOUSE_CURSOR_RIGHT
-#define KC_MS_R QK_MOUSE_CURSOR_RIGHT
-#define KC_MS_BTN1 QK_MOUSE_BUTTON_1
-#define KC_BTN1 QK_MOUSE_BUTTON_1
-#define KC_MS_BTN2 QK_MOUSE_BUTTON_2
-#define KC_BTN2 QK_MOUSE_BUTTON_2
-#define KC_MS_BTN3 QK_MOUSE_BUTTON_3
-#define KC_BTN3 QK_MOUSE_BUTTON_3
-#define KC_MS_BTN4 QK_MOUSE_BUTTON_4
-#define KC_BTN4 QK_MOUSE_BUTTON_4
-#define KC_MS_BTN5 QK_MOUSE_BUTTON_5
-#define KC_BTN5 QK_MOUSE_BUTTON_5
-#define KC_MS_BTN6 QK_MOUSE_BUTTON_6
-#define KC_BTN6 QK_MOUSE_BUTTON_6
-#define KC_MS_BTN7 QK_MOUSE_BUTTON_7
-#define KC_BTN7 QK_MOUSE_BUTTON_7
-#define KC_MS_BTN8 QK_MOUSE_BUTTON_8
-#define KC_BTN8 QK_MOUSE_BUTTON_8
-#define KC_MS_WH_UP QK_MOUSE_WHEEL_UP
-#define KC_WH_U QK_MOUSE_WHEEL_UP
-#define KC_MS_WH_DOWN QK_MOUSE_WHEEL_DOWN
-#define KC_WH_D QK_MOUSE_WHEEL_DOWN
-#define KC_MS_WH_LEFT QK_MOUSE_WHEEL_LEFT
-#define KC_WH_L QK_MOUSE_WHEEL_LEFT
-#define KC_MS_WH_RIGHT QK_MOUSE_WHEEL_RIGHT
-#define KC_WH_R QK_MOUSE_WHEEL_RIGHT
-#define KC_MS_ACCEL0 QK_MOUSE_ACCELERATION_0
-#define KC_ACL0 QK_MOUSE_ACCELERATION_0
-#define KC_MS_ACCEL1 QK_MOUSE_ACCELERATION_1
-#define KC_ACL1 QK_MOUSE_ACCELERATION_1
-#define KC_MS_ACCEL2 QK_MOUSE_ACCELERATION_2
-#define KC_ACL2 QK_MOUSE_ACCELERATION_2
-
#define QK_OUTPUT_AUTO OU_AUTO
#define C_S_T(kc) LCS_T(kc)
+#define ALL_T(kc) HYPR_T(kc)
+
+#define SGUI(kc) LSG(kc)
+#define SCMD(kc) LSG(kc)
+#define SWIN(kc) LSG(kc)
+#define SGUI_T(kc) LSG_T(kc)
+#define SCMD_T(kc) LSG_T(kc)
+#define SWIN_T(kc) LSG_T(kc)
+
+#define SAGR(kc) RSA(kc)
+#define SAGR_T(kc) RSA_T(kc)
diff --git a/quantum/rgb_matrix/animations/starlight_smooth_anim.h b/quantum/rgb_matrix/animations/starlight_smooth_anim.h
index a87c06f9df..5467ea0a59 100644
--- a/quantum/rgb_matrix/animations/starlight_smooth_anim.h
+++ b/quantum/rgb_matrix/animations/starlight_smooth_anim.h
@@ -9,7 +9,7 @@ static uint8_t phase_offsets[RGB_MATRIX_LED_COUNT];
hsv_t STARLIGHT_SMOOTH_math(hsv_t hsv, uint8_t i, uint8_t time) {
if (phase_offsets[i] == 0) {
- phase_offsets[i] = rand() % 255;
+ phase_offsets[i] = random8();
}
hsv.v = scale8(abs8(sin8((time + phase_offsets[i]) / 2) - 128) * 2, hsv.v);
return hsv;
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 2679c48342..ab0aa17512 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -109,7 +109,11 @@ void eeconfig_update_rgb_matrix_default(void) {
void eeconfig_debug_rgb_matrix(void) {
dprintf("rgb_matrix_config EEPROM\n");
dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable);
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+ dprintf("rgb_matrix_config.mode = %d (%s)\n", rgb_matrix_config.mode, rgb_matrix_get_mode_name(rgb_matrix_config.mode));
+#else
dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode);
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
dprintf("rgb_matrix_config.hsv.h = %d\n", rgb_matrix_config.hsv.h);
dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s);
dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v);
@@ -560,7 +564,11 @@ void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
}
rgb_task_state = STARTING;
eeconfig_flag_rgb_matrix(write_to_eeprom);
- dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.mode);
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+ dprintf("rgb matrix mode [%s]: %u (%s)\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)rgb_matrix_config.mode, rgb_matrix_get_mode_name(rgb_matrix_config.mode));
+#else
+ dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", (unsigned)rgb_matrix_config.mode);
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
}
void rgb_matrix_mode_noeeprom(uint8_t mode) {
rgb_matrix_mode_eeprom_helper(mode, false);
@@ -738,3 +746,49 @@ void rgb_matrix_set_flags(led_flags_t flags) {
void rgb_matrix_set_flags_noeeprom(led_flags_t flags) {
rgb_matrix_set_flags_eeprom_helper(flags, false);
}
+
+//----------------------------------------------------------
+// RGB Matrix naming
+#undef RGB_MATRIX_EFFECT
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+const char *rgb_matrix_get_mode_name(uint8_t mode) {
+ switch (mode) {
+ case RGB_MATRIX_NONE:
+ return "NONE";
+
+# define RGB_MATRIX_EFFECT(name, ...) \
+ case RGB_MATRIX_##name: \
+ return #name;
+# include "rgb_matrix_effects.inc"
+# undef RGB_MATRIX_EFFECT
+
+# ifdef COMMUNITY_MODULES_ENABLE
+# define RGB_MATRIX_EFFECT(name, ...) \
+ case RGB_MATRIX_COMMUNITY_MODULE_##name: \
+ return #name;
+# include "rgb_matrix_community_modules.inc"
+# undef RGB_MATRIX_EFFECT
+# endif // COMMUNITY_MODULES_ENABLE
+
+# if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
+# define RGB_MATRIX_EFFECT(name, ...) \
+ case RGB_MATRIX_CUSTOM_##name: \
+ return #name;
+
+# ifdef RGB_MATRIX_CUSTOM_KB
+# include "rgb_matrix_kb.inc"
+# endif // RGB_MATRIX_CUSTOM_KB
+
+# ifdef RGB_MATRIX_CUSTOM_USER
+# include "rgb_matrix_user.inc"
+# endif // RGB_MATRIX_CUSTOM_USER
+
+# undef RGB_MATRIX_EFFECT
+# endif // RGB_MATRIX_CUSTOM_KB || RGB_MATRIX_CUSTOM_USER
+
+ default:
+ return "UNKNOWN";
+ }
+}
+# undef RGB_MATRIX_EFFECT
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index c6b302631e..a91dded4a8 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -220,6 +220,10 @@ void rgb_matrix_set_flags(led_flags_t flags);
void rgb_matrix_set_flags_noeeprom(led_flags_t flags);
void rgb_matrix_update_pwm_buffers(void);
+#ifdef RGB_MATRIX_MODE_NAME_ENABLE
+const char *rgb_matrix_get_mode_name(uint8_t mode);
+#endif // RGB_MATRIX_MODE_NAME_ENABLE
+
#ifndef RGBLIGHT_ENABLE
# define eeconfig_update_rgblight_current eeconfig_force_flush_rgb_matrix
# define rgblight_reload_from_eeprom rgb_matrix_reload_from_eeprom
diff --git a/quantum/via.c b/quantum/via.c
index 3682b4ab2b..9446811af6 100644
--- a/quantum/via.c
+++ b/quantum/via.c
@@ -22,6 +22,10 @@
# error "DYNAMIC_KEYMAP_ENABLE is not enabled"
#endif
+#ifdef VIA_INSECURE
+# pragma message "VIA_INSECURE is enabled - firmware is susceptible to keyloggers"
+#endif
+
#include "via.h"
#include "raw_hid.h"
@@ -318,7 +322,11 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
uint8_t rows = 28 / ((MATRIX_COLS + 7) / 8);
uint8_t i = 2;
for (uint8_t row = 0; row < rows && row + offset < MATRIX_ROWS; row++) {
+#ifdef VIA_INSECURE
matrix_row_t value = matrix_get_row(row + offset);
+#else
+ matrix_row_t value = 0;
+#endif
#if (MATRIX_COLS > 24)
command_data[i++] = (value >> 24) & 0xFF;
#endif