|
|
|
@ -21,6 +21,16 @@ |
|
|
|
|
#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 |
|
|
|
@ -54,7 +64,7 @@ uint8_t get_first_key(report_keyboard_t* keyboard_report) { |
|
|
|
|
return i << 3 | biton(keyboard_report->nkro.bits[i]); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
#ifdef USB_6KRO_ENABLE |
|
|
|
|
#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE |
|
|
|
|
uint8_t i = cb_head; |
|
|
|
|
do { |
|
|
|
|
if (keyboard_report->keys[i] != 0) { |
|
|
|
@ -99,7 +109,7 @@ bool is_key_pressed(report_keyboard_t* keyboard_report, uint8_t key) { |
|
|
|
|
* FIXME: Needs doc |
|
|
|
|
*/ |
|
|
|
|
void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { |
|
|
|
|
#ifdef USB_6KRO_ENABLE |
|
|
|
|
#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE |
|
|
|
|
int8_t i = cb_head; |
|
|
|
|
int8_t empty = -1; |
|
|
|
|
if (cb_count) { |
|
|
|
@ -166,7 +176,7 @@ 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 USB_6KRO_ENABLE |
|
|
|
|
#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE |
|
|
|
|
uint8_t i = cb_head; |
|
|
|
|
if (cb_count) { |
|
|
|
|
do { |
|
|
|
|