Skip to content

Commit

Permalink
Remove RING_BUFFERED_6KRO_REPORT_ENABLE due to disuse. (qmk#24433)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc authored Sep 24, 2024
1 parent a7486a8 commit 9a8f5a8
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 102 deletions.
1 change: 0 additions & 1 deletion builddefs/show_options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 0 additions & 2 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 0 additions & 2 deletions tests/test_common/keyboard_report_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ std::vector<uint8_t> get_keys(const report_keyboard_t& report) {
std::vector<uint8_t> 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]) {
Expand Down
4 changes: 0 additions & 4 deletions tmk_core/protocol.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
93 changes: 0 additions & 93 deletions tmk_core/protocol/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
#include "util.h"
#include <string.h>

#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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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++) {
Expand All @@ -169,46 +104,18 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
keyboard_report->keys[empty] = code;
}
}
#endif
}

/** \brief del key byte
*
* 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
Expand Down

0 comments on commit 9a8f5a8

Please sign in to comment.