From 558f3ec1eb325caf706efc15e2fab26121aba442 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 6 Sep 2016 23:19:01 -0500 Subject: Use keyboard config for nkro (#7) * removing nkro references - wip * changed NKRO to be defined by keymap_config --- tmk_core/common/action_util.c | 10 +++++++--- tmk_core/common/bootmagic.c | 4 ---- tmk_core/common/command.c | 6 +++--- tmk_core/common/host.c | 5 ----- tmk_core/common/host.h | 4 ---- tmk_core/common/keyboard.c | 4 +++- tmk_core/common/magic.c | 4 ---- 7 files changed, 13 insertions(+), 24 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index 61ff202bef..cb4b252648 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c @@ -20,6 +20,10 @@ along with this program. If not, see . #include "action_util.h" #include "action_layer.h" #include "timer.h" +#include "keycode_config.h" + +extern keymap_config_t keymap_config; + static inline void add_key_byte(uint8_t code); static inline void del_key_byte(uint8_t code); @@ -139,7 +143,7 @@ void send_keyboard_report(void) { void add_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { add_key_bit(key); return; } @@ -150,7 +154,7 @@ void add_key(uint8_t key) void del_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { del_key_bit(key); return; } @@ -231,7 +235,7 @@ uint8_t has_anymod(void) uint8_t get_first_key(void) { #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { uint8_t i = 0; for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) ; diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 6730a2a4aa..2c6bcbae56 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -83,10 +83,6 @@ void bootmagic(void) } eeconfig_update_keymap(keymap_config.raw); -#ifdef NKRO_ENABLE - keyboard_nkro = keymap_config.nkro; -#endif - /* default layer */ uint8_t default_layer = 0; if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 476fc6fe3c..54d6117fd1 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -238,7 +238,7 @@ static void print_status(void) print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); #ifdef NKRO_ENABLE - print_val_hex8(keyboard_nkro); + print_val_hex8(keymap_config.nkro); #endif print_val_hex32(timer_read32()); @@ -435,8 +435,8 @@ static bool command_common(uint8_t code) // NKRO toggle case MAGIC_KC(MAGIC_KEY_NKRO): clear_keyboard(); // clear to prevent stuck keys - keyboard_nkro = !keyboard_nkro; - if (keyboard_nkro) { + keymap_config.nkro = !keymap_config.nkro; + if (keymap_config.nkro) { print("NKRO: on\n"); } else { print("NKRO: off\n"); diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index 11a05c2ddd..e12b622165 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c @@ -22,11 +22,6 @@ along with this program. If not, see . #include "util.h" #include "debug.h" - -#ifdef NKRO_ENABLE -bool keyboard_nkro = true; -#endif - static host_driver_t *driver; static uint16_t last_system_report = 0; static uint16_t last_consumer_report = 0; diff --git a/tmk_core/common/host.h b/tmk_core/common/host.h index 9814b10d2d..aeabba7107 100644 --- a/tmk_core/common/host.h +++ b/tmk_core/common/host.h @@ -28,10 +28,6 @@ along with this program. If not, see . extern "C" { #endif -#ifdef NKRO_ENABLE -extern bool keyboard_nkro; -#endif - extern uint8_t keyboard_idle; extern uint8_t keyboard_protocol; diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index c46a701b3b..371d93f3e5 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -57,6 +57,8 @@ along with this program. If not, see . # include "visualizer/visualizer.h" #endif + + #ifdef MATRIX_HAS_GHOST static bool has_ghost_in_row(uint8_t row) { @@ -106,7 +108,7 @@ void keyboard_init(void) { rgblight_init(); #endif #if defined(NKRO_ENABLE) && defined(FORCE_NKRO) - keyboard_nkro = true; + keymap_config.nkro = 1; #endif } diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c index 194e4cc026..49617a3d10 100644 --- a/tmk_core/common/magic.c +++ b/tmk_core/common/magic.c @@ -27,10 +27,6 @@ void magic(void) /* keymap config */ keymap_config.raw = eeconfig_read_keymap(); -#ifdef NKRO_ENABLE - keyboard_nkro = keymap_config.nkro; -#endif - uint8_t default_layer = 0; default_layer = eeconfig_read_default_layer(); default_layer_set((uint32_t)default_layer); -- cgit v1.2.3