Adding NKRO virtual dip-switch, using existing bit in keymap byte.
authorShayne Holmes <simon.snth@xoxy.net>
Wed, 9 Apr 2014 22:54:16 +0000 (15:54 -0700)
committerShayne Holmes <simon.snth@xoxy.net>
Wed, 9 Apr 2014 22:54:16 +0000 (15:54 -0700)
This takes the last, reserved bit there, but doesn't necessitate
a revision to the magic number because it doesn't alter byte order.
Add reference to NKRO virtual dip-switch to documentation.

README.md
common/bootmagic.c
common/bootmagic.h
common/command.c
common/eeconfig.h
common/keymap.h

index 6596dc33256e4802db3c582f8199ab8c19d21029..a01de8c6f81a4d14b9340524f9f3d9c1f222aa7a 100644 (file)
--- 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`)
index 036d49044004156b5f4f313fbdaea81923bef31f..642d5face42e18bcc79fc17ae172d4224a49f98d 100644 (file)
@@ -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); }
index 7c1922397308ecf3593c4b0b3c53e2c215c549c8..8f6618f4bd0da0de18ea3ffc20d8cbab6f72c63f 100644 (file)
@@ -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
 
 
 /*
index f6f2769513ed9eff1c1cfe88134b52276f4b061c..872880eae2ee03ae1dc56a64509c2566b8c988de 100644 (file)
@@ -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;
index e1b5ae282f032ebcc9554ae17f67d61e32b8c70e..3cd1a174f6658b2e795e8b0980d9cddf8f93f6d6 100644 (file)
@@ -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);
index bf32acedad7fd08e05894f22e4607816277534cc..4c3019a364c2dfad5b6194409bf1bacfb71c3a64 100644 (file)
@@ -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;
Imprint / Impressum