diff options
author | Shayne Holmes <simon.snth@xoxy.net> | 2014-04-09 15:54:16 -0700 |
---|---|---|
committer | Shayne Holmes <simon.snth@xoxy.net> | 2014-04-09 15:54:16 -0700 |
commit | e5bafff725f7b9cbfc364e64c74ea7f68bfc9900 (patch) | |
tree | a83f4e5b6b181f2aed5b12b12f10ba43972aef64 /common | |
parent | 894a387d1fd8c823b5339e524e1f9336601ce2ef (diff) | |
download | qmk_firmware-e5bafff725f7b9cbfc364e64c74ea7f68bfc9900.tar.gz qmk_firmware-e5bafff725f7b9cbfc364e64c74ea7f68bfc9900.zip |
Adding NKRO virtual dip-switch, using existing bit in keymap byte.
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.
Diffstat (limited to 'common')
-rw-r--r-- | common/bootmagic.c | 8 | ||||
-rw-r--r-- | common/bootmagic.h | 3 | ||||
-rw-r--r-- | common/command.c | 1 | ||||
-rw-r--r-- | common/eeconfig.h | 1 | ||||
-rw-r--r-- | common/keymap.h | 2 |
5 files changed, 14 insertions, 1 deletions
diff --git a/common/bootmagic.c b/common/bootmagic.c index 036d49044..642d5face 100644 --- a/common/bootmagic.c +++ b/common/bootmagic.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "bootloader.h" | 5 | #include "bootloader.h" |
6 | #include "debug.h" | 6 | #include "debug.h" |
7 | #include "keymap.h" | 7 | #include "keymap.h" |
8 | #include "host.h" | ||
8 | #include "action_layer.h" | 9 | #include "action_layer.h" |
9 | #include "eeconfig.h" | 10 | #include "eeconfig.h" |
10 | #include "bootmagic.h" | 11 | #include "bootmagic.h" |
@@ -76,8 +77,15 @@ void bootmagic(void) | |||
76 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) { | 77 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) { |
77 | keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace; | 78 | keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace; |
78 | } | 79 | } |
80 | if (bootmagic_scan_keycode(BOOTMAGIC_HOST_NKRO)) { | ||
81 | keymap_config.nkro = !keymap_config.nkro; | ||
82 | } | ||
79 | eeconfig_write_keymap(keymap_config.raw); | 83 | eeconfig_write_keymap(keymap_config.raw); |
80 | 84 | ||
85 | #ifdef NKRO_ENABLE | ||
86 | keyboard_nkro = keymap_config.nkro; | ||
87 | #endif | ||
88 | |||
81 | /* default layer */ | 89 | /* default layer */ |
82 | uint8_t default_layer = 0; | 90 | uint8_t default_layer = 0; |
83 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } | 91 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } |
diff --git a/common/bootmagic.h b/common/bootmagic.h index 7c1922397..8f6618f4b 100644 --- a/common/bootmagic.h +++ b/common/bootmagic.h | |||
@@ -60,6 +60,9 @@ | |||
60 | #ifndef BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE | 60 | #ifndef BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE |
61 | #define BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE KC_BSLASH | 61 | #define BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE KC_BSLASH |
62 | #endif | 62 | #endif |
63 | #ifndef BOOTMAGIC_HOST_NKRO | ||
64 | #define BOOTMAGIC_HOST_NKRO KC_N | ||
65 | #endif | ||
63 | 66 | ||
64 | 67 | ||
65 | /* | 68 | /* |
diff --git a/common/command.c b/common/command.c index f6f276951..872880eae 100644 --- a/common/command.c +++ b/common/command.c | |||
@@ -151,6 +151,7 @@ static void print_eeconfig(void) | |||
151 | print(".no_gui: "); print_dec(kc.no_gui); print("\n"); | 151 | print(".no_gui: "); print_dec(kc.no_gui); print("\n"); |
152 | print(".swap_grave_esc: "); print_dec(kc.swap_grave_esc); print("\n"); | 152 | print(".swap_grave_esc: "); print_dec(kc.swap_grave_esc); print("\n"); |
153 | print(".swap_backslash_backspace: "); print_dec(kc.swap_backslash_backspace); print("\n"); | 153 | print(".swap_backslash_backspace: "); print_dec(kc.swap_backslash_backspace); print("\n"); |
154 | print(".nkro: "); print_dec(kc.nkro); print("\n"); | ||
154 | 155 | ||
155 | #ifdef BACKLIGHT_ENABLE | 156 | #ifdef BACKLIGHT_ENABLE |
156 | backlight_config_t bc; | 157 | backlight_config_t bc; |
diff --git a/common/eeconfig.h b/common/eeconfig.h index e1b5ae282..3cd1a174f 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/>. | |||
47 | #define EECONFIG_KEYMAP_NO_GUI (1<<4) | 47 | #define EECONFIG_KEYMAP_NO_GUI (1<<4) |
48 | #define EECONFIG_KEYMAP_SWAP_GRAVE_ESC (1<<5) | 48 | #define EECONFIG_KEYMAP_SWAP_GRAVE_ESC (1<<5) |
49 | #define EECONFIG_KEYMAP_SWAP_BACKSLASH_BACKSPACE (1<<6) | 49 | #define EECONFIG_KEYMAP_SWAP_BACKSLASH_BACKSPACE (1<<6) |
50 | #define EECONFIG_KEYMAP_NKRO (1<<7) | ||
50 | 51 | ||
51 | 52 | ||
52 | bool eeconfig_is_enabled(void); | 53 | bool eeconfig_is_enabled(void); |
diff --git a/common/keymap.h b/common/keymap.h index bf32aceda..4c3019a36 100644 --- a/common/keymap.h +++ b/common/keymap.h | |||
@@ -35,7 +35,7 @@ typedef union { | |||
35 | bool no_gui:1; | 35 | bool no_gui:1; |
36 | bool swap_grave_esc:1; | 36 | bool swap_grave_esc:1; |
37 | bool swap_backslash_backspace:1; | 37 | bool swap_backslash_backspace:1; |
38 | bool reserved:1; | 38 | bool nkro:1; |
39 | }; | 39 | }; |
40 | } keymap_config_t; | 40 | } keymap_config_t; |
41 | keymap_config_t keymap_config; | 41 | keymap_config_t keymap_config; |