lufa: Boot support for mouse extended report #692

This commit is contained in:
tmk 2021-06-21 23:25:27 +09:00
parent 9b77bf9295
commit 4ed3e40fc0
3 changed files with 43 additions and 53 deletions

View file

@ -65,6 +65,11 @@ void host_keyboard_send(report_keyboard_t *report)
void host_mouse_send(report_mouse_t *report)
{
if (!driver) return;
#ifdef MOUSE_EXT_REPORT
// clip and copy to Boot protocol XY
report->boot_x = (report->x > 127) ? 127 : ((report->x < -127) ? -127 : report->x);
report->boot_y = (report->y > 127) ? 127 : ((report->y < -127) ? -127 : report->y);
#endif
(*driver->send_mouse)(report);
}

View file

@ -157,23 +157,20 @@ typedef struct {
} __attribute__ ((packed)) report_keyboard_t;
*/
#ifdef ENABLE_16_BIT_MOUSE_REPORT
typedef struct {
uint8_t buttons;
int16_t x;
int16_t y;
int16_t v;
int16_t h;
} __attribute__ ((packed)) report_mouse_t;
#else
typedef struct {
uint8_t buttons;
#ifndef MOUSE_EXT_REPORT
int8_t x;
int8_t y;
#else
int8_t boot_x;
int8_t boot_y;
int16_t x;
int16_t y;
#endif
int8_t v;
int8_t h;
} __attribute__ ((packed)) report_mouse_t;
#endif
/* keycode to system usage */