mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge 191914690f
into 46acfdce96
This commit is contained in:
commit
02fe8b6850
@ -63,10 +63,11 @@ Hello, ESP32 USB HID Keyboard is here!
|
||||
Mouse input data starts with the word "Mouse" and has the following structure.
|
||||
```
|
||||
Mouse
|
||||
X: -00343 Y: 000183 | |o|
|
||||
| | | |
|
||||
| | | +- Right mouse button pressed status ("o" - pressed, " " - not pressed)
|
||||
| | +--- Left mouse button pressed status ("o" - pressed, " " - not pressed)
|
||||
X: -00343 Y: 000183 Wheel: 000004 | |o| |
|
||||
| | | | | +- Right mouse button pressed status ("o" - pressed, " " - not pressed)
|
||||
| | | | +- Middle mouse button pressed status ("o" - pressed, " " - not pressed)
|
||||
| | | +--- Left mouse button pressed status ("o" - pressed, " " - not pressed)
|
||||
| | +---------- Mouse wheel scroll status
|
||||
| +---------- Y relative coordinate of the cursor
|
||||
+----------------------- X relative coordinate of the cursor
|
||||
```
|
||||
|
@ -329,16 +329,19 @@ static void hid_host_mouse_report_callback(const uint8_t *const data, const int
|
||||
|
||||
static int x_pos = 0;
|
||||
static int y_pos = 0;
|
||||
static int wheel_pos = 0;
|
||||
|
||||
// Calculate absolute position from displacement
|
||||
x_pos += mouse_report->x_displacement;
|
||||
y_pos += mouse_report->y_displacement;
|
||||
wheel_pos += mouse_report->scrollwheel;
|
||||
|
||||
hid_print_new_device_report_header(HID_PROTOCOL_MOUSE);
|
||||
|
||||
printf("X: %06d\tY: %06d\t|%c|%c|\r",
|
||||
x_pos, y_pos,
|
||||
printf("X: %06d\tY: %06d\tWheel: %06d\t|%c|%c|%c|\r",
|
||||
x_pos, y_pos, wheel_pos,
|
||||
(mouse_report->buttons.button1 ? 'o' : ' '),
|
||||
(mouse_report->buttons.button3 ? 'o' : ' '),
|
||||
(mouse_report->buttons.button2 ? 'o' : ' '));
|
||||
fflush(stdout);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user