diff options
author | Ryan <fauxpark@gmail.com> | 2022-09-03 05:38:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 20:38:27 +0100 |
commit | 09d668eb0ed3ff6fa48ce1db98910b022bca2d90 (patch) | |
tree | da13eca69e7e24e439c4bccdd1296fc4de212085 /keyboards/annepro2 | |
parent | 0ceaaaae8e71f4713d232ac1b657906f4a45833f (diff) |
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
Diffstat (limited to 'keyboards/annepro2')
-rw-r--r-- | keyboards/annepro2/annepro2_ble.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/keyboards/annepro2/annepro2_ble.c b/keyboards/annepro2/annepro2_ble.c index 0336d6a76c..c75de6720c 100644 --- a/keyboards/annepro2/annepro2_ble.c +++ b/keyboards/annepro2/annepro2_ble.c @@ -24,15 +24,14 @@ /* -------------------- Static Function Prototypes -------------------------- */ static uint8_t ap2_ble_leds(void); static void ap2_ble_mouse(report_mouse_t *report); -static void ap2_ble_system(uint16_t data); -static void ap2_ble_consumer(uint16_t data); +static void ap2_ble_extra(uint8_t report_id, uint16_t data); static void ap2_ble_keyboard(report_keyboard_t *report); static void ap2_ble_swtich_ble_driver(void); /* -------------------- Static Local Variables ------------------------------ */ static host_driver_t ap2_ble_driver = { - ap2_ble_leds, ap2_ble_keyboard, ap2_ble_mouse, ap2_ble_system, ap2_ble_consumer, + ap2_ble_leds, ap2_ble_keyboard, ap2_ble_mouse, ap2_ble_extra }; static uint8_t ble_mcu_wakeup[11] = {0x7b, 0x12, 0x53, 0x00, 0x03, 0x00, 0x01, 0x7d, 0x02, 0x01, 0x02}; @@ -131,8 +130,6 @@ static uint8_t ap2_ble_leds(void) { static void ap2_ble_mouse(report_mouse_t *report) {} -static void ap2_ble_system(uint16_t data) {} - static inline uint16_t CONSUMER2AP2(uint16_t usage) { switch (usage) { case AUDIO_VOL_DOWN: @@ -152,12 +149,14 @@ static inline uint16_t CONSUMER2AP2(uint16_t usage) { } } -static void ap2_ble_consumer(uint16_t data) { - sdPut(&SD1, 0x0); - sdWrite(&SD1, ble_mcu_send_consumer_report, sizeof(ble_mcu_send_consumer_report)); - sdPut(&SD1, CONSUMER2AP2(data)); - static const uint8_t dummy[3] = {0}; - sdWrite(&SD1, dummy, sizeof(dummy)); +static void ap2_ble_extra(uint8_t report_id, uint16_t data) { + if (report_id == REPORT_ID_CONSUMER) { + sdPut(&SD1, 0x0); + sdWrite(&SD1, ble_mcu_send_consumer_report, sizeof(ble_mcu_send_consumer_report)); + sdPut(&SD1, CONSUMER2AP2(data)); + static const uint8_t dummy[3] = {0}; + sdWrite(&SD1, dummy, sizeof(dummy)); + } } /*! |