1
0
Fork 0

[Core] ChibiOS fix O3 and LTO breakage of extra keys and joystick (#12819)

This commit is contained in:
Stefan Kerkmann 2021-06-07 07:16:55 +02:00 committed by GitHub
parent 415dd21206
commit 49fd3c0760
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 35 deletions

View file

@ -903,7 +903,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
return; return;
} }
report_extra_t report = {.report_id = report_id, .usage = data}; static report_extra_t report;
report = (report_extra_t){.report_id = report_id, .usage = data};
usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t)); usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t));
osalSysUnlock(); osalSysUnlock();
@ -1051,45 +1052,44 @@ void virtser_task(void) {
#ifdef JOYSTICK_ENABLE #ifdef JOYSTICK_ENABLE
void send_joystick_packet(joystick_t *joystick) { void send_joystick_packet(joystick_t *joystick) {
joystick_report_t rep = { static joystick_report_t rep;
rep = (joystick_report_t) {
# if JOYSTICK_AXES_COUNT > 0 # if JOYSTICK_AXES_COUNT > 0
.axes = .axes =
{ { joystick->axes[0],
joystick->axes[0],
# if JOYSTICK_AXES_COUNT >= 2 # if JOYSTICK_AXES_COUNT >= 2
joystick->axes[1], joystick->axes[1],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 3 # if JOYSTICK_AXES_COUNT >= 3
joystick->axes[2], joystick->axes[2],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 4 # if JOYSTICK_AXES_COUNT >= 4
joystick->axes[3], joystick->axes[3],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 5 # if JOYSTICK_AXES_COUNT >= 5
joystick->axes[4], joystick->axes[4],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 6 # if JOYSTICK_AXES_COUNT >= 6
joystick->axes[5], joystick->axes[5],
# endif # endif
}, },
# endif // JOYSTICK_AXES_COUNT>0 # endif // JOYSTICK_AXES_COUNT>0
# if JOYSTICK_BUTTON_COUNT > 0 # if JOYSTICK_BUTTON_COUNT > 0
.buttons = .buttons = {
{ joystick->buttons[0],
joystick->buttons[0],
# if JOYSTICK_BUTTON_COUNT > 8 # if JOYSTICK_BUTTON_COUNT > 8
joystick->buttons[1], joystick->buttons[1],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 16 # if JOYSTICK_BUTTON_COUNT > 16
joystick->buttons[2], joystick->buttons[2],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 24 # if JOYSTICK_BUTTON_COUNT > 24
joystick->buttons[3], joystick->buttons[3],
# endif # endif
} }
# endif // JOYSTICK_BUTTON_COUNT>0 # endif // JOYSTICK_BUTTON_COUNT>0
}; };

View file

@ -314,45 +314,44 @@ static void Console_Task(void) {
void send_joystick_packet(joystick_t *joystick) { void send_joystick_packet(joystick_t *joystick) {
uint8_t timeout = 255; uint8_t timeout = 255;
joystick_report_t r = { static joystick_report_t;
r = (joystick_report_t) {
# if JOYSTICK_AXES_COUNT > 0 # if JOYSTICK_AXES_COUNT > 0
.axes = .axes =
{ { joystick->axes[0],
joystick->axes[0],
# if JOYSTICK_AXES_COUNT >= 2 # if JOYSTICK_AXES_COUNT >= 2
joystick->axes[1], joystick->axes[1],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 3 # if JOYSTICK_AXES_COUNT >= 3
joystick->axes[2], joystick->axes[2],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 4 # if JOYSTICK_AXES_COUNT >= 4
joystick->axes[3], joystick->axes[3],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 5 # if JOYSTICK_AXES_COUNT >= 5
joystick->axes[4], joystick->axes[4],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 6 # if JOYSTICK_AXES_COUNT >= 6
joystick->axes[5], joystick->axes[5],
# endif # endif
}, },
# endif // JOYSTICK_AXES_COUNT>0 # endif // JOYSTICK_AXES_COUNT>0
# if JOYSTICK_BUTTON_COUNT > 0 # if JOYSTICK_BUTTON_COUNT > 0
.buttons = .buttons = {
{ joystick->buttons[0],
joystick->buttons[0],
# if JOYSTICK_BUTTON_COUNT > 8 # if JOYSTICK_BUTTON_COUNT > 8
joystick->buttons[1], joystick->buttons[1],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 16 # if JOYSTICK_BUTTON_COUNT > 16
joystick->buttons[2], joystick->buttons[2],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 24 # if JOYSTICK_BUTTON_COUNT > 24
joystick->buttons[3], joystick->buttons[3],
# endif # endif
} }
# endif // JOYSTICK_BUTTON_COUNT>0 # endif // JOYSTICK_BUTTON_COUNT>0
}; };
@ -768,7 +767,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
if (USB_DeviceState != DEVICE_STATE_Configured) return; if (USB_DeviceState != DEVICE_STATE_Configured) return;
report_extra_t r = {.report_id = report_id, .usage = data}; static report_extra_t r;
r = (report_extra_t){.report_id = report_id, .usage = data};
Endpoint_SelectEndpoint(SHARED_IN_EPNUM); Endpoint_SelectEndpoint(SHARED_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */ /* Check if write ready for a polling interval around 10ms */

View file

@ -272,7 +272,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
last_id = report_id; last_id = report_id;
last_data = data; last_data = data;
report_extra_t report = {.report_id = report_id, .usage = data}; static report_extra_t report;
report = (report_extra_t){.report_id = report_id, .usage = data};
if (usbInterruptIsReadyShared()) { if (usbInterruptIsReadyShared()) {
usbSetInterruptShared((void *)&report, sizeof(report_extra_t)); usbSetInterruptShared((void *)&report, sizeof(report_extra_t));
} }