summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <tmk@users.noreply.github.com>2014-07-07 12:01:01 +0900
committertmk <tmk@users.noreply.github.com>2014-07-07 12:01:01 +0900
commit3eeb0a96232af825962fa1e9b05b80ac1cfd1868 (patch)
tree9efb1e78f73998755bfe49df9a2f99ffceada33b
parent326e559719505e64b4dd4cc4020c4656252cba64 (diff)
parente5bafff725f7b9cbfc364e64c74ea7f68bfc9900 (diff)
Merge pull request #112 from shayneholmes/ee_nkro_use_reserved_bit
Adding NKRO virtual dip-switch, using existing bit in keymap byte.
-rw-r--r--README.md1
-rw-r--r--common/bootmagic.c8
-rw-r--r--common/bootmagic.h3
-rw-r--r--common/command.c1
-rw-r--r--common/eeconfig.h1
-rw-r--r--common/keymap.h2
6 files changed, 15 insertions, 1 deletions
diff --git a/README.md b/README.md
index 6596dc3325..a01de8c6f8 100644
--- a/README.md
+++ b/README.md
@@ -151,6 +151,7 @@ To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be
- Disable Gui(`Left Gui`)
- Swap Grave and Escape(`Grave`)
- Swap BackSlash and BackSpace(`Back Slash`)
+- Enable NKRO on boot(`N`)
#### Default Layer
- Set Default Layer to 0(`0`)
diff --git a/common/bootmagic.c b/common/bootmagic.c
index 036d490440..642d5face4 100644
--- a/common/bootmagic.c
+++ b/common/bootmagic.c
@@ -5,6 +5,7 @@
#include "bootloader.h"
#include "debug.h"
#include "keymap.h"
+#include "host.h"
#include "action_layer.h"
#include "eeconfig.h"
#include "bootmagic.h"
@@ -76,8 +77,15 @@ void bootmagic(void)
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) {
keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace;
}
+ if (bootmagic_scan_keycode(BOOTMAGIC_HOST_NKRO)) {
+ keymap_config.nkro = !keymap_config.nkro;
+ }
eeconfig_write_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/common/bootmagic.h b/common/bootmagic.h
index 7c19223973..8f6618f4bd 100644
--- a/common/bootmagic.h
+++ b/common/bootmagic.h
@@ -60,6 +60,9 @@
#ifndef BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE
#define BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE KC_BSLASH
#endif
+#ifndef BOOTMAGIC_HOST_NKRO
+#define BOOTMAGIC_HOST_NKRO KC_N
+#endif
/*
diff --git a/common/command.c b/common/command.c
index d2f8eb8320..2c65f0da78 100644
--- a/common/command.c
+++ b/common/command.c
@@ -151,6 +151,7 @@ static void print_eeconfig(void)
print(".no_gui: "); print_dec(kc.no_gui); print("\n");
print(".swap_grave_esc: "); print_dec(kc.swap_grave_esc); print("\n");
print(".swap_backslash_backspace: "); print_dec(kc.swap_backslash_backspace); print("\n");
+ print(".nkro: "); print_dec(kc.nkro); print("\n");
#ifdef BACKLIGHT_ENABLE
backlight_config_t bc;
diff --git a/common/eeconfig.h b/common/eeconfig.h
index e1b5ae282f..3cd1a174f6 100644
--- a/common/eeconfig.h
+++ b/common/eeconfig.h
@@ -47,6 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EECONFIG_KEYMAP_NO_GUI (1<<4)
#define EECONFIG_KEYMAP_SWAP_GRAVE_ESC (1<<5)
#define EECONFIG_KEYMAP_SWAP_BACKSLASH_BACKSPACE (1<<6)
+#define EECONFIG_KEYMAP_NKRO (1<<7)
bool eeconfig_is_enabled(void);
diff --git a/common/keymap.h b/common/keymap.h
index bf32acedad..4c3019a364 100644
--- a/common/keymap.h
+++ b/common/keymap.h
@@ -35,7 +35,7 @@ typedef union {
bool no_gui:1;
bool swap_grave_esc:1;
bool swap_backslash_backspace:1;
- bool reserved:1;
+ bool nkro:1;
};
} keymap_config_t;
keymap_config_t keymap_config;