mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-12-11 20:58:15 +06:00
Remove RING_BUFFERED_6KRO_REPORT_ENABLE
due to disuse. (#24433)
This commit is contained in:
parent
a7486a8d87
commit
9a8f5a80e4
|
@ -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 \
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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]) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user