diff options
author | Ryan <fauxpark@gmail.com> | 2022-09-27 18:37:13 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 18:37:13 +1000 |
commit | be8907d634ac8967de1ae2ac8346b845f738c9e6 (patch) | |
tree | 5a56127946000bbd648f8a5f52d90eb6711be222 /tmk_core/protocol/chibios | |
parent | fb400f2ac2c57fa0fc82ca803f6450b818bb32f9 (diff) |
Further refactoring of joystick feature (#18437)
Diffstat (limited to 'tmk_core/protocol/chibios')
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 54 |
1 files changed, 3 insertions, 51 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 222a867e3c..7c44b87bc4 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -50,10 +50,6 @@ extern keymap_config_t keymap_config; #endif -#ifdef JOYSTICK_ENABLE -# include "joystick.h" -#endif - /* --------------------------------------------------------- * Global interface variables and declarations * --------------------------------------------------------- @@ -1151,59 +1147,15 @@ void virtser_task(void) { #endif +void send_joystick(report_joystick_t *report) { #ifdef JOYSTICK_ENABLE - -void send_joystick_packet(joystick_t *joystick) { - static joystick_report_t rep; - rep = (joystick_report_t) { -# if JOYSTICK_AXES_COUNT > 0 - .axes = - { joystick->axes[0], - -# if JOYSTICK_AXES_COUNT >= 2 - joystick->axes[1], -# endif -# if JOYSTICK_AXES_COUNT >= 3 - joystick->axes[2], -# endif -# if JOYSTICK_AXES_COUNT >= 4 - joystick->axes[3], -# endif -# if JOYSTICK_AXES_COUNT >= 5 - joystick->axes[4], -# endif -# if JOYSTICK_AXES_COUNT >= 6 - joystick->axes[5], -# endif - }, -# endif // JOYSTICK_AXES_COUNT>0 - -# if JOYSTICK_BUTTON_COUNT > 0 - .buttons = { - joystick->buttons[0], - -# if JOYSTICK_BUTTON_COUNT > 8 - joystick->buttons[1], -# endif -# if JOYSTICK_BUTTON_COUNT > 16 - joystick->buttons[2], -# endif -# if JOYSTICK_BUTTON_COUNT > 24 - joystick->buttons[3], -# endif - } -# endif // JOYSTICK_BUTTON_COUNT>0 - }; - - // chnWrite(&drivers.joystick_driver.driver, (uint8_t *)&rep, sizeof(rep)); osalSysLock(); if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { osalSysUnlock(); return; } - usbStartTransmitI(&USB_DRIVER, JOYSTICK_IN_EPNUM, (uint8_t *)&rep, sizeof(joystick_report_t)); + usbStartTransmitI(&USB_DRIVER, JOYSTICK_IN_EPNUM, (uint8_t *)report, sizeof(report_joystick_t)); osalSysUnlock(); -} - #endif +} |