1
0
Fork 0

Simplify extrakeys sending at the host driver level (#18230)

* Simplify extrakeys sending at the host driver level

* There are two arguments here

* Wrong syntax

* Adjust keyboards which use a custom host driver
This commit is contained in:
Ryan 2022-09-03 05:38:27 +10:00 committed by GitHub
parent 0ceaaaae8e
commit 09d668eb0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 70 additions and 149 deletions

View file

@ -101,10 +101,9 @@ static report_keyboard_t keyboard_report_sent;
static uint8_t keyboard_leds(void);
static void send_keyboard(report_keyboard_t *report);
static void send_mouse(report_mouse_t *report);
static void send_system(uint16_t data);
static void send_consumer(uint16_t data);
static void send_extra(uint8_t report_id, uint16_t data);
static void send_programmable_button(uint32_t data);
host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button};
host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra, send_programmable_button};
#ifdef VIRTSER_ENABLE
// clang-format off
@ -748,30 +747,8 @@ static void send_report(void *report, size_t size) {
*/
#ifdef EXTRAKEY_ENABLE
static void send_extra(uint8_t report_id, uint16_t data) {
static report_extra_t r;
r = (report_extra_t){.report_id = report_id, .usage = data};
send_report(&r, sizeof(r));
}
#endif
/** \brief Send System
*
* FIXME: Needs doc
*/
static void send_system(uint16_t data) {
#ifdef EXTRAKEY_ENABLE
send_extra(REPORT_ID_SYSTEM, data);
#endif
}
/** \brief Send Consumer
*
* FIXME: Needs doc
*/
static void send_consumer(uint16_t data) {
#ifdef EXTRAKEY_ENABLE
# ifdef BLUETOOTH_ENABLE
if (where_to_send() == OUTPUT_BLUETOOTH) {
if (report_id == REPORT_ID_CONSUMER && where_to_send() == OUTPUT_BLUETOOTH) {
# ifdef BLUETOOTH_BLUEFRUIT_LE
bluefruit_le_send_consumer_key(data);
# elif BLUETOOTH_RN42
@ -781,9 +758,11 @@ static void send_consumer(uint16_t data) {
}
# endif
send_extra(REPORT_ID_CONSUMER, data);
#endif
static report_extra_t r;
r = (report_extra_t){.report_id = report_id, .usage = data};
send_report(&r, sizeof(r));
}
#endif
static void send_programmable_button(uint32_t data) {
#ifdef PROGRAMMABLE_BUTTON_ENABLE