diff options
| author | Stefan Kerkmann <karlk90@pm.me> | 2021-06-07 07:16:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-06 22:16:55 -0700 |
| commit | 49fd3c0760e06b7eab3647098530f1a9bdfc5054 (patch) | |
| tree | fe39ef15dacb63d32f2a881af7fac364f02b32db /tmk_core | |
| parent | 415dd21206922fc69929d8ef5d7ab7f13e9c2fbc (diff) | |
| download | qmk_firmware-49fd3c0760e06b7eab3647098530f1a9bdfc5054.tar.gz qmk_firmware-49fd3c0760e06b7eab3647098530f1a9bdfc5054.zip | |
[Core] ChibiOS fix O3 and LTO breakage of extra keys and joystick (#12819)
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 34 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 34 | ||||
| -rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 3 |
3 files changed, 36 insertions, 35 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index d04302aca..407b8ea75 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c | |||
| @@ -903,7 +903,8 @@ static void send_extra(uint8_t report_id, uint16_t data) { | |||
| 903 | return; | 903 | return; |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | report_extra_t report = {.report_id = report_id, .usage = data}; | 906 | static report_extra_t report; |
| 907 | report = (report_extra_t){.report_id = report_id, .usage = data}; | ||
| 907 | 908 | ||
| 908 | usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t)); | 909 | usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t)); |
| 909 | osalSysUnlock(); | 910 | osalSysUnlock(); |
| @@ -1051,45 +1052,44 @@ void virtser_task(void) { | |||
| 1051 | #ifdef JOYSTICK_ENABLE | 1052 | #ifdef JOYSTICK_ENABLE |
| 1052 | 1053 | ||
| 1053 | void send_joystick_packet(joystick_t *joystick) { | 1054 | void send_joystick_packet(joystick_t *joystick) { |
| 1054 | joystick_report_t rep = { | 1055 | static joystick_report_t rep; |
| 1056 | rep = (joystick_report_t) { | ||
| 1055 | # if JOYSTICK_AXES_COUNT > 0 | 1057 | # if JOYSTICK_AXES_COUNT > 0 |
| 1056 | .axes = | 1058 | .axes = |
| 1057 | { | 1059 | { joystick->axes[0], |
| 1058 | joystick->axes[0], | ||
| 1059 | 1060 | ||
| 1060 | # if JOYSTICK_AXES_COUNT >= 2 | 1061 | # if JOYSTICK_AXES_COUNT >= 2 |
| 1061 | joystick->axes[1], | 1062 | joystick->axes[1], |
| 1062 | # endif | 1063 | # endif |
| 1063 | # if JOYSTICK_AXES_COUNT >= 3 | 1064 | # if JOYSTICK_AXES_COUNT >= 3 |
| 1064 | joystick->axes[2], | 1065 | joystick->axes[2], |
| 1065 | # endif | 1066 | # endif |
| 1066 | # if JOYSTICK_AXES_COUNT >= 4 | 1067 | # if JOYSTICK_AXES_COUNT >= 4 |
| 1067 | joystick->axes[3], | 1068 | joystick->axes[3], |
| 1068 | # endif | 1069 | # endif |
| 1069 | # if JOYSTICK_AXES_COUNT >= 5 | 1070 | # if JOYSTICK_AXES_COUNT >= 5 |
| 1070 | joystick->axes[4], | 1071 | joystick->axes[4], |
| 1071 | # endif | 1072 | # endif |
| 1072 | # if JOYSTICK_AXES_COUNT >= 6 | 1073 | # if JOYSTICK_AXES_COUNT >= 6 |
| 1073 | joystick->axes[5], | 1074 | joystick->axes[5], |
| 1074 | # endif | 1075 | # endif |
| 1075 | }, | 1076 | }, |
| 1076 | # endif // JOYSTICK_AXES_COUNT>0 | 1077 | # endif // JOYSTICK_AXES_COUNT>0 |
| 1077 | 1078 | ||
| 1078 | # if JOYSTICK_BUTTON_COUNT > 0 | 1079 | # if JOYSTICK_BUTTON_COUNT > 0 |
| 1079 | .buttons = | 1080 | .buttons = { |
| 1080 | { | 1081 | joystick->buttons[0], |
| 1081 | joystick->buttons[0], | ||
| 1082 | 1082 | ||
| 1083 | # if JOYSTICK_BUTTON_COUNT > 8 | 1083 | # if JOYSTICK_BUTTON_COUNT > 8 |
| 1084 | joystick->buttons[1], | 1084 | joystick->buttons[1], |
| 1085 | # endif | 1085 | # endif |
| 1086 | # if JOYSTICK_BUTTON_COUNT > 16 | 1086 | # if JOYSTICK_BUTTON_COUNT > 16 |
| 1087 | joystick->buttons[2], | 1087 | joystick->buttons[2], |
| 1088 | # endif | 1088 | # endif |
| 1089 | # if JOYSTICK_BUTTON_COUNT > 24 | 1089 | # if JOYSTICK_BUTTON_COUNT > 24 |
| 1090 | joystick->buttons[3], | 1090 | joystick->buttons[3], |
| 1091 | # endif | 1091 | # endif |
| 1092 | } | 1092 | } |
| 1093 | # endif // JOYSTICK_BUTTON_COUNT>0 | 1093 | # endif // JOYSTICK_BUTTON_COUNT>0 |
| 1094 | }; | 1094 | }; |
| 1095 | 1095 | ||
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 63619fdb3..4ac079e16 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -314,45 +314,44 @@ static void Console_Task(void) { | |||
| 314 | void send_joystick_packet(joystick_t *joystick) { | 314 | void send_joystick_packet(joystick_t *joystick) { |
| 315 | uint8_t timeout = 255; | 315 | uint8_t timeout = 255; |
| 316 | 316 | ||
| 317 | joystick_report_t r = { | 317 | static joystick_report_t; |
| 318 | r = (joystick_report_t) { | ||
| 318 | # if JOYSTICK_AXES_COUNT > 0 | 319 | # if JOYSTICK_AXES_COUNT > 0 |
| 319 | .axes = | 320 | .axes = |
| 320 | { | 321 | { joystick->axes[0], |
| 321 | joystick->axes[0], | ||
| 322 | 322 | ||
| 323 | # if JOYSTICK_AXES_COUNT >= 2 | 323 | # if JOYSTICK_AXES_COUNT >= 2 |
| 324 | joystick->axes[1], | 324 | joystick->axes[1], |
| 325 | # endif | 325 | # endif |
| 326 | # if JOYSTICK_AXES_COUNT >= 3 | 326 | # if JOYSTICK_AXES_COUNT >= 3 |
| 327 | joystick->axes[2], | 327 | joystick->axes[2], |
| 328 | # endif | 328 | # endif |
| 329 | # if JOYSTICK_AXES_COUNT >= 4 | 329 | # if JOYSTICK_AXES_COUNT >= 4 |
| 330 | joystick->axes[3], | 330 | joystick->axes[3], |
| 331 | # endif | 331 | # endif |
| 332 | # if JOYSTICK_AXES_COUNT >= 5 | 332 | # if JOYSTICK_AXES_COUNT >= 5 |
| 333 | joystick->axes[4], | 333 | joystick->axes[4], |
| 334 | # endif | 334 | # endif |
| 335 | # if JOYSTICK_AXES_COUNT >= 6 | 335 | # if JOYSTICK_AXES_COUNT >= 6 |
| 336 | joystick->axes[5], | 336 | joystick->axes[5], |
| 337 | # endif | 337 | # endif |
| 338 | }, | 338 | }, |
| 339 | # endif // JOYSTICK_AXES_COUNT>0 | 339 | # endif // JOYSTICK_AXES_COUNT>0 |
| 340 | 340 | ||
| 341 | # if JOYSTICK_BUTTON_COUNT > 0 | 341 | # if JOYSTICK_BUTTON_COUNT > 0 |
| 342 | .buttons = | 342 | .buttons = { |
| 343 | { | 343 | joystick->buttons[0], |
| 344 | joystick->buttons[0], | ||
| 345 | 344 | ||
| 346 | # if JOYSTICK_BUTTON_COUNT > 8 | 345 | # if JOYSTICK_BUTTON_COUNT > 8 |
| 347 | joystick->buttons[1], | 346 | joystick->buttons[1], |
| 348 | # endif | 347 | # endif |
| 349 | # if JOYSTICK_BUTTON_COUNT > 16 | 348 | # if JOYSTICK_BUTTON_COUNT > 16 |
| 350 | joystick->buttons[2], | 349 | joystick->buttons[2], |
| 351 | # endif | 350 | # endif |
| 352 | # if JOYSTICK_BUTTON_COUNT > 24 | 351 | # if JOYSTICK_BUTTON_COUNT > 24 |
| 353 | joystick->buttons[3], | 352 | joystick->buttons[3], |
| 354 | # endif | 353 | # endif |
| 355 | } | 354 | } |
| 356 | # endif // JOYSTICK_BUTTON_COUNT>0 | 355 | # endif // JOYSTICK_BUTTON_COUNT>0 |
| 357 | }; | 356 | }; |
| 358 | 357 | ||
| @@ -768,7 +767,8 @@ static void send_extra(uint8_t report_id, uint16_t data) { | |||
| 768 | 767 | ||
| 769 | if (USB_DeviceState != DEVICE_STATE_Configured) return; | 768 | if (USB_DeviceState != DEVICE_STATE_Configured) return; |
| 770 | 769 | ||
| 771 | report_extra_t r = {.report_id = report_id, .usage = data}; | 770 | static report_extra_t r; |
| 771 | r = (report_extra_t){.report_id = report_id, .usage = data}; | ||
| 772 | Endpoint_SelectEndpoint(SHARED_IN_EPNUM); | 772 | Endpoint_SelectEndpoint(SHARED_IN_EPNUM); |
| 773 | 773 | ||
| 774 | /* Check if write ready for a polling interval around 10ms */ | 774 | /* Check if write ready for a polling interval around 10ms */ |
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 9362fbde7..876a31378 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c | |||
| @@ -272,7 +272,8 @@ static void send_extra(uint8_t report_id, uint16_t data) { | |||
| 272 | last_id = report_id; | 272 | last_id = report_id; |
| 273 | last_data = data; | 273 | last_data = data; |
| 274 | 274 | ||
| 275 | report_extra_t report = {.report_id = report_id, .usage = data}; | 275 | static report_extra_t report; |
| 276 | report = (report_extra_t){.report_id = report_id, .usage = data}; | ||
| 276 | if (usbInterruptIsReadyShared()) { | 277 | if (usbInterruptIsReadyShared()) { |
| 277 | usbSetInterruptShared((void *)&report, sizeof(report_extra_t)); | 278 | usbSetInterruptShared((void *)&report, sizeof(report_extra_t)); |
| 278 | } | 279 | } |
