Magic Key Overrides / Keyboard Lock / Forced NKRO

Added Magic Key Overrides / Magic Key Cleanup / Added Keyboard Lock
option to template / Added forced NKRO option to template (disabled by
default)
This commit is contained in:
IBNobody
2016-03-28 00:03:21 -05:00
parent b7f0110d71
commit 577971ab07
7 changed files with 489 additions and 133 deletions

View File

@ -113,18 +113,19 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400) CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = yes # Commands for debug and configuration
KEYBOARD_LOCK_ENABLE = yes # Allow locking of keyboard via magic key
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend # SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
# MIDI_ENABLE = YES # MIDI controls # MIDI_ENABLE = YES # MIDI controls
# UNICODE_ENABLE = YES # Unicode # UNICODE_ENABLE = YES # Unicode
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
# Optimize size but this may cause error "relocation truncated to fit" # Optimize size but this may cause error "relocation truncated to fit"

View File

@ -53,11 +53,54 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Locking resynchronize hack */ /* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE #define LOCKING_RESYNC_ENABLE
/* key combination for command */
/* Force NKRO Mode - If forced on, must be disabled via magic key (default = LShift+RShift+N) */
#define FORCE_NKRO
/*
* Magic key options
* These options allow the magic key functionality to be changed. This is useful
* if your keyboard/keypad is missing keys and you want magic key support.
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \ #define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
) )
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* remap magic keys */
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
#define MAGIC_KEY_LOCK BSLS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/* /*
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.
@ -76,4 +119,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_MACRO //#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION //#define NO_ACTION_FUNCTION
#endif #endif

View File

@ -113,18 +113,19 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400) CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = yes # Commands for debug and configuration
KEYBOARD_LOCK_ENABLE = yes # Allow locking of keyboard via magic key
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend # SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work #NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
# MIDI_ENABLE = YES # MIDI controls # MIDI_ENABLE = YES # MIDI controls
# UNICODE_ENABLE = YES # Unicode # UNICODE_ENABLE = YES # Unicode
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
# Optimize size but this may cause error "relocation truncated to fit" # Optimize size but this may cause error "relocation truncated to fit"

View File

@ -55,11 +55,56 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Locking resynchronize hack */ /* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE #define LOCKING_RESYNC_ENABLE
/* key combination for command */ /* Force NKRO Mode - If forced on, must be disabled via magic key (default = LShift+RShift+N) */
//#define FORCE_NKRO
/*
* Magic key options
* These options allow the magic key functionality to be changed. This is useful
* if your keyboard/keypad is missing keys and you want magic key support.
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \ #define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
) )
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/* /*
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.

File diff suppressed because it is too large Load Diff

View File

@ -32,4 +32,125 @@ bool command_proc(uint8_t code);
#define command_proc(code) false #define command_proc(code) false
#endif #endif
#ifndef MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
#endif #endif
#ifndef MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
#endif
#ifndef MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
#endif
#ifndef MAGIC_KEY_HELP1
#define MAGIC_KEY_HELP1 H
#endif
#ifndef MAGIC_KEY_HELP2
#define MAGIC_KEY_HELP2 SLASH
#endif
#ifndef MAGIC_KEY_DEBUG
#define MAGIC_KEY_DEBUG D
#endif
#ifndef MAGIC_KEY_DEBUG_MATRIX
#define MAGIC_KEY_DEBUG_MATRIX X
#endif
#ifndef MAGIC_KEY_DEBUG_KBD
#define MAGIC_KEY_DEBUG_KBD K
#endif
#ifndef MAGIC_KEY_DEBUG_MOUSE
#define MAGIC_KEY_DEBUG_MOUSE M
#endif
#ifndef MAGIC_KEY_VERSION
#define MAGIC_KEY_VERSION V
#endif
#ifndef MAGIC_KEY_STATUS
#define MAGIC_KEY_STATUS S
#endif
#ifndef MAGIC_KEY_CONSOLE
#define MAGIC_KEY_CONSOLE C
#endif
#ifndef MAGIC_KEY_LAYER0_ALT1
#define MAGIC_KEY_LAYER0_ALT1 ESC
#endif
#ifndef MAGIC_KEY_LAYER0_ALT2
#define MAGIC_KEY_LAYER0_ALT2 GRAVE
#endif
#ifndef MAGIC_KEY_LAYER0
#define MAGIC_KEY_LAYER0 0
#endif
#ifndef MAGIC_KEY_LAYER1
#define MAGIC_KEY_LAYER1 1
#endif
#ifndef MAGIC_KEY_LAYER2
#define MAGIC_KEY_LAYER2 2
#endif
#ifndef MAGIC_KEY_LAYER3
#define MAGIC_KEY_LAYER3 3
#endif
#ifndef MAGIC_KEY_LAYER4
#define MAGIC_KEY_LAYER4 4
#endif
#ifndef MAGIC_KEY_LAYER5
#define MAGIC_KEY_LAYER5 5
#endif
#ifndef MAGIC_KEY_LAYER6
#define MAGIC_KEY_LAYER6 6
#endif
#ifndef MAGIC_KEY_LAYER7
#define MAGIC_KEY_LAYER7 7
#endif
#ifndef MAGIC_KEY_LAYER8
#define MAGIC_KEY_LAYER8 8
#endif
#ifndef MAGIC_KEY_LAYER9
#define MAGIC_KEY_LAYER9 9
#endif
#ifndef MAGIC_KEY_BOOTLOADER
#define MAGIC_KEY_BOOTLOADER PAUSE
#endif
#ifndef MAGIC_KEY_LOCK
#define MAGIC_KEY_LOCK CAPS
#endif
#ifndef MAGIC_KEY_EEPROM
#define MAGIC_KEY_EEPROM E
#endif
#ifndef MAGIC_KEY_NKRO
#define MAGIC_KEY_NKRO N
#endif
#ifndef MAGIC_KEY_SLEEP_LED
#define MAGIC_KEY_SLEEP_LED Z
#endif
#define XMAGIC_KC(key) KC_##key
#define MAGIC_KC(key) XMAGIC_KC(key)
#endif

View File

@ -70,6 +70,7 @@ void keyboard_setup(void)
void keyboard_init(void) void keyboard_init(void)
{ {
timer_init(); timer_init();
matrix_init(); matrix_init();
#ifdef PS2_MOUSE_ENABLE #ifdef PS2_MOUSE_ENABLE
@ -90,6 +91,11 @@ void keyboard_init(void)
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
backlight_init(); backlight_init();
#endif #endif
#ifdef FORCE_NKRO
keyboard_nkro = true;
#endif
} }
/* /*