From 2b07c0bd00f24858aa3c4d40fbf8baa1f1fd8007 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 22 Jun 2021 20:54:34 +0900 Subject: [PATCH] core: Build option: NKRO_6KRO_ENABLE --- tmk_core/common.mk | 4 ++++ tmk_core/common/action_util.c | 10 +++++----- tmk_core/common/bootmagic.c | 2 +- tmk_core/common/command.c | 8 ++++---- tmk_core/common/host.c | 2 +- tmk_core/common/host.h | 2 +- tmk_core/common/report.h | 4 ++-- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 9c3425b4..f8e6f4cf 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -75,6 +75,10 @@ ifeq (yes,$(strip $(NKRO_ENABLE))) OPT_DEFS += -DNKRO_ENABLE endif +ifeq (yes,$(strip $(NKRO_6KRO_ENABLE))) + OPT_DEFS += -DNKRO_6KRO_ENABLE +endif + ifeq (yes,$(strip $(USB_6KRO_ENABLE))) OPT_DEFS += -DUSB_6KRO_ENABLE endif diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index f81877dd..7324bb27 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c @@ -22,7 +22,7 @@ along with this program. If not, see . static inline void add_key_byte(uint8_t code); static inline void del_key_byte(uint8_t code); -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) static inline void add_key_bit(uint8_t code); static inline void del_key_bit(uint8_t code); #endif @@ -75,7 +75,7 @@ void send_keyboard_report(void) { /* key */ void add_key(uint8_t key) { -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) if (keyboard_protocol && keyboard_nkro) { add_key_bit(key); return; @@ -86,7 +86,7 @@ void add_key(uint8_t key) void del_key(uint8_t key) { -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) if (keyboard_protocol && keyboard_nkro) { del_key_bit(key); return; @@ -159,7 +159,7 @@ uint8_t has_anymod(void) uint8_t get_first_key(void) { -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) if (keyboard_protocol && keyboard_nkro) { uint8_t i = 0; for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) @@ -286,7 +286,7 @@ static inline void del_key_byte(uint8_t code) #endif } -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) static inline void add_key_bit(uint8_t code) { if ((code>>3) < KEYBOARD_REPORT_BITS) { diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index eb06d787..220eb14f 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -88,7 +88,7 @@ void bootmagic(void) } eeconfig_write_keymap(keymap_config.raw); -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) keyboard_nkro = keymap_config.nkro; #endif diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 54050bd9..74255736 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -134,7 +134,7 @@ static void command_common_help(void) "e: eeprom\n" #endif -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) "n: NKRO\n" #endif @@ -314,7 +314,7 @@ static bool command_common(uint8_t code) #ifdef COMMAND_ENABLE " COMMAND" #endif -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) " NKRO" #endif #ifdef KEYMAP_SECTION_ENABLE @@ -336,7 +336,7 @@ static bool command_common(uint8_t code) print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) print_val_hex8(keyboard_nkro); #endif print_val_hex32(timer_read32()); @@ -355,7 +355,7 @@ static bool command_common(uint8_t code) # endif #endif break; -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index 27aa44a2..1f40aa49 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c @@ -23,7 +23,7 @@ along with this program. If not, see . #include "debug.h" -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) bool keyboard_nkro = true; #endif diff --git a/tmk_core/common/host.h b/tmk_core/common/host.h index fefb8141..e1359782 100644 --- a/tmk_core/common/host.h +++ b/tmk_core/common/host.h @@ -28,7 +28,7 @@ along with this program. If not, see . extern "C" { #endif -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) extern bool keyboard_nkro; #endif diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index 5f91550a..fcafbd5f 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h @@ -94,7 +94,7 @@ along with this program. If not, see . # define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2) # define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1) -#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE) +#elif defined(PROTOCOL_LUFA) && (defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)) # include "protocol/lufa/descriptor.h" # define KEYBOARD_REPORT_SIZE NKRO_EPSIZE # define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) @@ -142,7 +142,7 @@ typedef union { uint8_t reserved; uint8_t keys[KEYBOARD_REPORT_KEYS]; }; -#ifdef NKRO_ENABLE +#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE) struct { uint8_t mods; uint8_t bits[KEYBOARD_REPORT_BITS];