aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-09-29 11:37:11 -0700
committerGitHub <noreply@github.com>2021-09-29 11:37:11 -0700
commit02ab7b1888e6572178543ca0b944e4fa14cdf974 (patch)
tree345253f0cd00476d31de5cd82eedc2b4354a58b9 /tmk_core
parent1e54796f0cf469e2c1fdd880cc288b04e7b83985 (diff)
downloadqmk_firmware-02ab7b1888e6572178543ca0b944e4fa14cdf974.tar.gz
qmk_firmware-02ab7b1888e6572178543ca0b944e4fa14cdf974.zip
[Core] Fix "6kro enable" and clarify naming (#14563)
* Fix USB_6KRO_ENABLE compilation errors * Add info to docs * Rename define to be more accurate * Remove unused rule * Refixe docs
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common.mk4
-rw-r--r--tmk_core/common/report.c16
2 files changed, 15 insertions, 5 deletions
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 7f7420059..e44ff2f0a 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -63,8 +63,8 @@ ifeq ($(strip $(NKRO_ENABLE)), yes)
63 endif 63 endif
64endif 64endif
65 65
66ifeq ($(strip $(USB_6KRO_ENABLE)), yes) 66ifeq ($(strip $(RING_BUFFERED_6KRO_REPORT_ENABLE)), yes)
67 TMK_COMMON_DEFS += -DUSB_6KRO_ENABLE 67 TMK_COMMON_DEFS += -DRING_BUFFERED_6KRO_REPORT_ENABLE
68endif 68endif
69 69
70ifeq ($(strip $(SLEEP_LED_ENABLE)), yes) 70ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
diff --git a/tmk_core/common/report.c b/tmk_core/common/report.c
index 1bcb6f2ad..2a7fc006c 100644
--- a/tmk_core/common/report.c
+++ b/tmk_core/common/report.c
@@ -21,6 +21,16 @@
21#include "util.h" 21#include "util.h"
22#include <string.h> 22#include <string.h>
23 23
24#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE
25# define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS)
26# define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS)
27# define RO_INC(a) RO_ADD(a, 1)
28# define RO_DEC(a) RO_SUB(a, 1)
29static int8_t cb_head = 0;
30static int8_t cb_tail = 0;
31static int8_t cb_count = 0;
32#endif
33
24/** \brief has_anykey 34/** \brief has_anykey
25 * 35 *
26 * FIXME: Needs doc 36 * FIXME: Needs doc
@@ -54,7 +64,7 @@ uint8_t get_first_key(report_keyboard_t* keyboard_report) {
54 return i << 3 | biton(keyboard_report->nkro.bits[i]); 64 return i << 3 | biton(keyboard_report->nkro.bits[i]);
55 } 65 }
56#endif 66#endif
57#ifdef USB_6KRO_ENABLE 67#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE
58 uint8_t i = cb_head; 68 uint8_t i = cb_head;
59 do { 69 do {
60 if (keyboard_report->keys[i] != 0) { 70 if (keyboard_report->keys[i] != 0) {
@@ -99,7 +109,7 @@ bool is_key_pressed(report_keyboard_t* keyboard_report, uint8_t key) {
99 * FIXME: Needs doc 109 * FIXME: Needs doc
100 */ 110 */
101void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { 111void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
102#ifdef USB_6KRO_ENABLE 112#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE
103 int8_t i = cb_head; 113 int8_t i = cb_head;
104 int8_t empty = -1; 114 int8_t empty = -1;
105 if (cb_count) { 115 if (cb_count) {
@@ -166,7 +176,7 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
166 * FIXME: Needs doc 176 * FIXME: Needs doc
167 */ 177 */
168void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { 178void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
169#ifdef USB_6KRO_ENABLE 179#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE
170 uint8_t i = cb_head; 180 uint8_t i = cb_head;
171 if (cb_count) { 181 if (cb_count) {
172 do { 182 do {