mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-22 08:27:56 +06:00
[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
This commit is contained in:
parent
1e54796f0c
commit
02ab7b1888
|
@ -418,6 +418,8 @@ Use these to enable or disable building certain features. The more you have enab
|
||||||
* Key combo feature
|
* Key combo feature
|
||||||
* `NKRO_ENABLE`
|
* `NKRO_ENABLE`
|
||||||
* USB N-Key Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
* 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`
|
* `AUDIO_ENABLE`
|
||||||
* Enable the audio subsystem.
|
* Enable the audio subsystem.
|
||||||
* `KEY_OVERRIDE_ENABLE`
|
* `KEY_OVERRIDE_ENABLE`
|
||||||
|
|
|
@ -16,7 +16,6 @@ CONSOLE_ENABLE = yes # Console for debug
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||||
USB_6KRO_ENABLE = no # USB 6key Rollover
|
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
SWAP_HANDS_ENABLE = no # Disable Onehand
|
SWAP_HANDS_ENABLE = no # Disable Onehand
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
|
|
|
@ -16,7 +16,6 @@ CONSOLE_ENABLE = no # Console for debug
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||||
USB_6KRO_ENABLE = no # USB 6key Rollover
|
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
SWAP_HANDS_ENABLE = no # Disable Onehand
|
SWAP_HANDS_ENABLE = no # Disable Onehand
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
|
|
|
@ -12,7 +12,6 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
USB_6KRO_ENABLE = no # 6key Rollover
|
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
@ -23,4 +22,3 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
USB_6KRO_ENABLE = no # 6key Rollover
|
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
@ -23,4 +22,3 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
USB_6KRO_ENABLE = no # 6key Rollover
|
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = yes # Audio output on port C6
|
AUDIO_ENABLE = yes # Audio output on port C6
|
||||||
|
@ -23,4 +22,3 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,6 @@ static uint8_t weak_override_mods = 0;
|
||||||
static uint8_t suppressed_mods = 0;
|
static uint8_t suppressed_mods = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USB_6KRO_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
|
|
||||||
|
|
||||||
// TODO: pointer variable is not needed
|
// TODO: pointer variable is not needed
|
||||||
// report_keyboard_t keyboard_report = {};
|
// report_keyboard_t keyboard_report = {};
|
||||||
report_keyboard_t *keyboard_report = &(report_keyboard_t){};
|
report_keyboard_t *keyboard_report = &(report_keyboard_t){};
|
||||||
|
|
|
@ -72,7 +72,7 @@ OTHER_OPTION_NAMES = \
|
||||||
PS2_MOUSE_ENABLE \
|
PS2_MOUSE_ENABLE \
|
||||||
RAW_ENABLE \
|
RAW_ENABLE \
|
||||||
SWAP_HANDS_ENABLE \
|
SWAP_HANDS_ENABLE \
|
||||||
USB_6KRO_ENABLE \
|
RING_BUFFERED_6KRO_REPORT_ENABLE \
|
||||||
WATCHDOG_ENABLE \
|
WATCHDOG_ENABLE \
|
||||||
XT_ENABLE \
|
XT_ENABLE \
|
||||||
ERGOINU \
|
ERGOINU \
|
||||||
|
|
|
@ -24,7 +24,7 @@ std::vector<uint8_t> get_keys(const report_keyboard_t& report) {
|
||||||
std::vector<uint8_t> result;
|
std::vector<uint8_t> result;
|
||||||
#if defined(NKRO_ENABLE)
|
#if defined(NKRO_ENABLE)
|
||||||
# error NKRO support not implemented yet
|
# error NKRO support not implemented yet
|
||||||
#elif defined(USB_6KRO_ENABLE)
|
#elif defined(RING_BUFFERED_6KRO_REPORT_ENABLE)
|
||||||
# error 6KRO support not implemented yet
|
# error 6KRO support not implemented yet
|
||||||
#else
|
#else
|
||||||
for (size_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
for (size_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||||
|
|
|
@ -63,8 +63,8 @@ ifeq ($(strip $(NKRO_ENABLE)), yes)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
|
ifeq ($(strip $(RING_BUFFERED_6KRO_REPORT_ENABLE)), yes)
|
||||||
TMK_COMMON_DEFS += -DUSB_6KRO_ENABLE
|
TMK_COMMON_DEFS += -DRING_BUFFERED_6KRO_REPORT_ENABLE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
|
ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
|
||||||
|
|
|
@ -21,6 +21,16 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <string.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
|
/** \brief has_anykey
|
||||||
*
|
*
|
||||||
* FIXME: Needs doc
|
* 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]);
|
return i << 3 | biton(keyboard_report->nkro.bits[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_6KRO_ENABLE
|
#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE
|
||||||
uint8_t i = cb_head;
|
uint8_t i = cb_head;
|
||||||
do {
|
do {
|
||||||
if (keyboard_report->keys[i] != 0) {
|
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
|
* FIXME: Needs doc
|
||||||
*/
|
*/
|
||||||
void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
|
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 i = cb_head;
|
||||||
int8_t empty = -1;
|
int8_t empty = -1;
|
||||||
if (cb_count) {
|
if (cb_count) {
|
||||||
|
@ -166,7 +176,7 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
|
||||||
* FIXME: Needs doc
|
* FIXME: Needs doc
|
||||||
*/
|
*/
|
||||||
void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) {
|
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;
|
uint8_t i = cb_head;
|
||||||
if (cb_count) {
|
if (cb_count) {
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user