summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-05-13 20:35:49 -0700
committerGitHub <noreply@github.com>2022-05-14 13:35:49 +1000
commit787a68948fa0d5e251e22a623071082c8c0561b1 (patch)
treecc28d2caa680b8eef62e4cfdd232dde66e43416a /quantum
parent425c54cf8c459b1cc33deaa53955e2db41aa0b01 (diff)
[Core] Add Reboot keycode to core (#15990)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c17
-rw-r--r--quantum/quantum.h1
-rw-r--r--quantum/quantum_keycodes.h2
3 files changed, 19 insertions, 1 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 673ea91b11..c0e801a4bb 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -121,7 +121,7 @@ __attribute__((weak)) void post_process_record_kb(uint16_t keycode, keyrecord_t
__attribute__((weak)) void post_process_record_user(uint16_t keycode, keyrecord_t *record) {}
-void reset_keyboard(void) {
+void shutdown_quantum(void) {
clear_keyboard();
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
process_midi_all_notes_off();
@@ -143,9 +143,18 @@ void reset_keyboard(void) {
#ifdef HAPTIC_ENABLE
haptic_shutdown();
#endif
+}
+
+void reset_keyboard(void) {
+ shutdown_quantum();
bootloader_jump();
}
+void soft_reset_keyboard(void) {
+ shutdown_quantum();
+ mcu_reset();
+}
+
/* Convert record into usable keycode via the contained event. */
uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache) {
#ifdef COMBO_ENABLE
@@ -326,6 +335,9 @@ bool process_record_quantum(keyrecord_t *record) {
case QK_BOOTLOADER:
reset_keyboard();
return false;
+ case QK_REBOOT:
+ soft_reset_keyboard();
+ return false;
#endif
#ifndef NO_DEBUG
case QK_DEBUG_TOGGLE:
@@ -339,6 +351,9 @@ bool process_record_quantum(keyrecord_t *record) {
return false;
case QK_CLEAR_EEPROM:
eeconfig_init();
+#ifndef NO_RESET
+ soft_reset_keyboard();
+#endif
return false;
#ifdef VELOCIKEY_ENABLE
case VLK_TOG:
diff --git a/quantum/quantum.h b/quantum/quantum.h
index d021e7c05c..7829ec7e0c 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -254,6 +254,7 @@ void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
void post_process_record_user(uint16_t keycode, keyrecord_t *record);
void reset_keyboard(void);
+void soft_reset_keyboard(void);
void startup_user(void);
void shutdown_user(void);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index c7b4ea593f..5d5c4ed8c4 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -596,6 +596,7 @@ enum quantum_keycodes {
MAGIC_TOGGLE_CONTROL_CAPSLOCK,
QK_MAKE,
+ QK_REBOOT,
SECURE_LOCK,
SECURE_UNLOCK,
@@ -717,6 +718,7 @@ enum quantum_keycodes {
#define QK_BOOT QK_BOOTLOADER
#define DB_TOGG QK_DEBUG_TOGGLE
#define EE_CLR QK_CLEAR_EEPROM
+#define QK_RBT QK_REBOOT
// Audio Clicky aliases
#define CK_TOGG CLICKY_TOGGLE