summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIBNobody <ibnobody@gmail.com>2016-09-06 18:02:43 -0500
committerIBNobody <ibnobody@gmail.com>2016-09-06 18:02:43 -0500
commite571d4656cd283ce8d793fe3dd2ac176b84b0bf5 (patch)
treea39c5b9671e82068fe0bd5ab640257f3c6dda6d6
parent91e0f62417d20e08031c2f8d7bf568566526f427 (diff)
downloadqmk_firmware-e571d4656cd283ce8d793fe3dd2ac176b84b0bf5.tar.gz
qmk_firmware-e571d4656cd283ce8d793fe3dd2ac176b84b0bf5.zip
Set keyboard_nkro (used by TMK) w/ MAGIC_HOST_NKRO
If NKRO is enabled, also set keyboard_nkro with MAGIC_HOST_NKRO and MAGIC_UNHOST_NKRO.
-rw-r--r--quantum/quantum.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index e3a20f43e0..fa86b6220f 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -27,6 +27,10 @@ static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
f(KC_RGUI);
}
+#ifdef NKRO_ENABLE
+ extern bool keyboard_nkro;
+#endif
+
void register_code16 (uint16_t code) {
do_code16 (code, register_code);
register_code (code);
@@ -223,6 +227,11 @@ bool process_record_quantum(keyrecord_t *record) {
keymap_config.swap_backslash_backspace = 1;
} else if (keycode == MAGIC_HOST_NKRO) {
keymap_config.nkro = 1;
+
+#ifdef NKRO_ENABLE
+ clear_keyboard(); // clear to prevent stuck keys
+ keyboard_nkro = keymap_config.nkro;
+#endif
} else if (keycode == MAGIC_SWAP_ALT_GUI) {
keymap_config.swap_lalt_lgui = 1;
keymap_config.swap_ralt_rgui = 1;
@@ -244,6 +253,10 @@ bool process_record_quantum(keyrecord_t *record) {
keymap_config.swap_backslash_backspace = 0;
} else if (keycode == MAGIC_UNHOST_NKRO) {
keymap_config.nkro = 0;
+#ifdef NKRO_ENABLE
+ clear_keyboard(); // clear to prevent stuck keys
+ keyboard_nkro = keymap_config.nkro;
+#endif
} else if (keycode == MAGIC_UNSWAP_ALT_GUI) {
keymap_config.swap_lalt_lgui = 0;
keymap_config.swap_ralt_rgui = 0;