Separate 6KRO and NKRO report structs (#22267)

This commit is contained in:
Ryan 2023-10-23 14:43:46 +10:00 committed by GitHub
parent bf6f13a2b0
commit 0c160e1fba
Failed to generate hash of commit
20 changed files with 187 additions and 165 deletions

View file

@ -55,12 +55,6 @@
#include "usb_device_state.h"
#include <util/atomic.h>
#ifdef NKRO_ENABLE
# include "keycode_config.h"
extern keymap_config_t keymap_config;
#endif
#ifdef VIRTSER_ENABLE
# include "virtser.h"
#endif
@ -83,9 +77,10 @@ static report_keyboard_t keyboard_report_sent;
/* Host driver */
static uint8_t keyboard_leds(void);
static void send_keyboard(report_keyboard_t *report);
static void send_nkro(report_nkro_t *report);
static void send_mouse(report_mouse_t *report);
static void send_extra(report_extra_t *report);
host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra};
host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_nkro, send_mouse, send_extra};
void send_report(uint8_t endpoint, void *report, size_t size) {
uint8_t timeout = 255;
@ -559,27 +554,26 @@ static uint8_t keyboard_leds(void) {
* FIXME: Needs doc
*/
static void send_keyboard(report_keyboard_t *report) {
/* Select the Keyboard Report Endpoint */
uint8_t ep = KEYBOARD_IN_EPNUM;
uint8_t size = KEYBOARD_REPORT_SIZE;
/* If we're in Boot Protocol, don't send any report ID or other funky fields */
if (!keyboard_protocol) {
send_report(ep, &report->mods, 8);
send_report(KEYBOARD_IN_EPNUM, &report->mods, 8);
} else {
#ifdef NKRO_ENABLE
if (keymap_config.nkro) {
ep = SHARED_IN_EPNUM;
size = sizeof(struct nkro_report);
}
#endif
send_report(ep, report, size);
send_report(KEYBOARD_IN_EPNUM, report, KEYBOARD_REPORT_SIZE);
}
keyboard_report_sent = *report;
}
/** \brief Send NKRO
*
* FIXME: Needs doc
*/
static void send_nkro(report_nkro_t *report) {
#ifdef NKRO_ENABLE
send_report(SHARED_IN_EPNUM, report, sizeof(report_nkro_t));
#endif
}
/** \brief Send Mouse
*
* FIXME: Needs doc