From 9a8f5a80e47815aefef1420f37078b7ff204e1c0 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 24 Sep 2024 21:53:55 +1000 Subject: [PATCH] Remove `RING_BUFFERED_6KRO_REPORT_ENABLE` due to disuse. (#24433) --- builddefs/show_options.mk | 1 - docs/config_options.md | 2 - tests/test_common/keyboard_report_util.cpp | 2 - tmk_core/protocol.mk | 4 - tmk_core/protocol/report.c | 93 ---------------------- 5 files changed, 102 deletions(-) diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk index 81d8400a80..1c1a3ebf8e 100644 --- a/builddefs/show_options.mk +++ b/builddefs/show_options.mk @@ -67,7 +67,6 @@ OTHER_OPTION_NAMES = \ PS2_DRIVER \ RAW_ENABLE \ SWAP_HANDS_ENABLE \ - RING_BUFFERED_6KRO_REPORT_ENABLE \ WATCHDOG_ENABLE \ ERGOINU \ NO_USB_STARTUP_CHECK \ diff --git a/docs/config_options.md b/docs/config_options.md index fec6b22b13..90a708dd99 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -426,8 +426,6 @@ Use these to enable or disable building certain features. The more you have enab * Key combo feature * `NKRO_ENABLE` * USB N-Key Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -* `RING_BUFFERED_6KRO_REPORT_ENABLE` - * USB 6-Key Rollover - Instead of stopping any new input once 6 keys are pressed, the oldest key is released and the new key is pressed. * `AUDIO_ENABLE` * Enable the audio subsystem. * `KEY_OVERRIDE_ENABLE` diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index 5676483539..18e0574277 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp @@ -29,8 +29,6 @@ std::vector get_keys(const report_keyboard_t& report) { std::vector result; #if defined(NKRO_ENABLE) # error NKRO support not implemented yet -#elif defined(RING_BUFFERED_6KRO_REPORT_ENABLE) -# error 6KRO support not implemented yet #else for (size_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { if (report.keys[i]) { diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index 796b4e8787..8f01976548 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk @@ -54,10 +54,6 @@ ifeq ($(strip $(NKRO_ENABLE)), yes) endif endif -ifeq ($(strip $(RING_BUFFERED_6KRO_REPORT_ENABLE)), yes) - OPT_DEFS += -DRING_BUFFERED_6KRO_REPORT_ENABLE -endif - ifeq ($(strip $(NO_SUSPEND_POWER_DOWN)), yes) OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif diff --git a/tmk_core/protocol/report.c b/tmk_core/protocol/report.c index 0166bf654f..056921d6a0 100644 --- a/tmk_core/protocol/report.c +++ b/tmk_core/protocol/report.c @@ -22,16 +22,6 @@ #include "util.h" #include -#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE -# define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) -# define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS) -# define RO_INC(a) RO_ADD(a, 1) -# define RO_DEC(a) RO_SUB(a, 1) -static int8_t cb_head = 0; -static int8_t cb_tail = 0; -static int8_t cb_count = 0; -#endif - /** \brief has_anykey * * FIXME: Needs doc @@ -65,18 +55,7 @@ uint8_t get_first_key(void) { return i << 3 | biton(nkro_report->bits[i]); } #endif -#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE - uint8_t i = cb_head; - do { - if (keyboard_report->keys[i] != 0) { - break; - } - i = RO_INC(i); - } while (i != cb_tail); - return keyboard_report->keys[i]; -#else return keyboard_report->keys[0]; -#endif } /** \brief Checks if a key is pressed in the report @@ -110,50 +89,6 @@ bool is_key_pressed(uint8_t key) { * FIXME: Needs doc */ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { -#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE - int8_t i = cb_head; - int8_t empty = -1; - if (cb_count) { - do { - if (keyboard_report->keys[i] == code) { - return; - } - if (empty == -1 && keyboard_report->keys[i] == 0) { - empty = i; - } - i = RO_INC(i); - } while (i != cb_tail); - if (i == cb_tail) { - if (cb_tail == cb_head) { - // buffer is full - if (empty == -1) { - // pop head when has no empty space - cb_head = RO_INC(cb_head); - cb_count--; - } else { - // left shift when has empty space - uint8_t offset = 1; - i = RO_INC(empty); - do { - if (keyboard_report->keys[i] != 0) { - keyboard_report->keys[empty] = keyboard_report->keys[i]; - keyboard_report->keys[i] = 0; - empty = RO_INC(empty); - } else { - offset++; - } - i = RO_INC(i); - } while (i != cb_tail); - cb_tail = RO_SUB(cb_tail, offset); - } - } - } - } - // add to tail - keyboard_report->keys[cb_tail] = code; - cb_tail = RO_INC(cb_tail); - cb_count++; -#else int8_t i = 0; int8_t empty = -1; for (; i < KEYBOARD_REPORT_KEYS; i++) { @@ -169,7 +104,6 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { keyboard_report->keys[empty] = code; } } -#endif } /** \brief del key byte @@ -177,38 +111,11 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { * FIXME: Needs doc */ void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { -#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE - uint8_t i = cb_head; - if (cb_count) { - do { - if (keyboard_report->keys[i] == code) { - keyboard_report->keys[i] = 0; - cb_count--; - if (cb_count == 0) { - // reset head and tail - cb_tail = cb_head = 0; - } - if (i == RO_DEC(cb_tail)) { - // left shift when next to tail - do { - cb_tail = RO_DEC(cb_tail); - if (keyboard_report->keys[RO_DEC(cb_tail)] != 0) { - break; - } - } while (cb_tail != cb_head); - } - break; - } - i = RO_INC(i); - } while (i != cb_tail); - } -#else for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { if (keyboard_report->keys[i] == code) { keyboard_report->keys[i] = 0; } } -#endif } #ifdef NKRO_ENABLE