core: Build option: NKRO_6KRO_ENABLE

This commit is contained in:
tmk 2021-06-22 20:54:34 +09:00
parent d5bdc55b17
commit 2b07c0bd00
7 changed files with 18 additions and 14 deletions

View file

@ -75,6 +75,10 @@ ifeq (yes,$(strip $(NKRO_ENABLE)))
OPT_DEFS += -DNKRO_ENABLE OPT_DEFS += -DNKRO_ENABLE
endif endif
ifeq (yes,$(strip $(NKRO_6KRO_ENABLE)))
OPT_DEFS += -DNKRO_6KRO_ENABLE
endif
ifeq (yes,$(strip $(USB_6KRO_ENABLE))) ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
OPT_DEFS += -DUSB_6KRO_ENABLE OPT_DEFS += -DUSB_6KRO_ENABLE
endif endif

View file

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static inline void add_key_byte(uint8_t code); static inline void add_key_byte(uint8_t code);
static inline void del_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 add_key_bit(uint8_t code);
static inline void del_key_bit(uint8_t code); static inline void del_key_bit(uint8_t code);
#endif #endif
@ -75,7 +75,7 @@ void send_keyboard_report(void) {
/* key */ /* key */
void add_key(uint8_t key) void add_key(uint8_t key)
{ {
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
if (keyboard_protocol && keyboard_nkro) { if (keyboard_protocol && keyboard_nkro) {
add_key_bit(key); add_key_bit(key);
return; return;
@ -86,7 +86,7 @@ void add_key(uint8_t key)
void del_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) { if (keyboard_protocol && keyboard_nkro) {
del_key_bit(key); del_key_bit(key);
return; return;
@ -159,7 +159,7 @@ uint8_t has_anymod(void)
uint8_t get_first_key(void) uint8_t get_first_key(void)
{ {
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
if (keyboard_protocol && keyboard_nkro) { if (keyboard_protocol && keyboard_nkro) {
uint8_t i = 0; uint8_t i = 0;
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) 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 #endif
} }
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
static inline void add_key_bit(uint8_t code) static inline void add_key_bit(uint8_t code)
{ {
if ((code>>3) < KEYBOARD_REPORT_BITS) { if ((code>>3) < KEYBOARD_REPORT_BITS) {

View file

@ -88,7 +88,7 @@ void bootmagic(void)
} }
eeconfig_write_keymap(keymap_config.raw); eeconfig_write_keymap(keymap_config.raw);
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
keyboard_nkro = keymap_config.nkro; keyboard_nkro = keymap_config.nkro;
#endif #endif

View file

@ -134,7 +134,7 @@ static void command_common_help(void)
"e: eeprom\n" "e: eeprom\n"
#endif #endif
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
"n: NKRO\n" "n: NKRO\n"
#endif #endif
@ -314,7 +314,7 @@ static bool command_common(uint8_t code)
#ifdef COMMAND_ENABLE #ifdef COMMAND_ENABLE
" COMMAND" " COMMAND"
#endif #endif
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
" NKRO" " NKRO"
#endif #endif
#ifdef KEYMAP_SECTION_ENABLE #ifdef KEYMAP_SECTION_ENABLE
@ -336,7 +336,7 @@ static bool command_common(uint8_t code)
print_val_hex8(host_keyboard_leds()); print_val_hex8(host_keyboard_leds());
print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_protocol);
print_val_hex8(keyboard_idle); print_val_hex8(keyboard_idle);
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
print_val_hex8(keyboard_nkro); print_val_hex8(keyboard_nkro);
#endif #endif
print_val_hex32(timer_read32()); print_val_hex32(timer_read32());
@ -355,7 +355,7 @@ static bool command_common(uint8_t code)
# endif # endif
#endif #endif
break; break;
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
case KC_N: case KC_N:
clear_keyboard(); //Prevents stuck keys. clear_keyboard(); //Prevents stuck keys.
keyboard_nkro = !keyboard_nkro; keyboard_nkro = !keyboard_nkro;

View file

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "debug.h" #include "debug.h"
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
bool keyboard_nkro = true; bool keyboard_nkro = true;
#endif #endif

View file

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern "C" { extern "C" {
#endif #endif
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
extern bool keyboard_nkro; extern bool keyboard_nkro;
#endif #endif

View file

@ -94,7 +94,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2) # define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2)
# define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1) # 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" # include "protocol/lufa/descriptor.h"
# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE # define KEYBOARD_REPORT_SIZE NKRO_EPSIZE
# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) # define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2)
@ -142,7 +142,7 @@ typedef union {
uint8_t reserved; uint8_t reserved;
uint8_t keys[KEYBOARD_REPORT_KEYS]; uint8_t keys[KEYBOARD_REPORT_KEYS];
}; };
#ifdef NKRO_ENABLE #if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
struct { struct {
uint8_t mods; uint8_t mods;
uint8_t bits[KEYBOARD_REPORT_BITS]; uint8_t bits[KEYBOARD_REPORT_BITS];