diff options
Diffstat (limited to 'hid')
-rw-r--r-- | hid/src/main.cpp | 6 | ||||
-rw-r--r-- | hid/src/usb/hid.h | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/hid/src/main.cpp b/hid/src/main.cpp index 4eeb9838..1bcd2162 100644 --- a/hid/src/main.cpp +++ b/hid/src/main.cpp @@ -82,7 +82,7 @@ uint8_t cmdMouseButtonEvent(const uint8_t *buffer) { // 2 bytes # define MOUSE_PAIR(_state, _button) \ _state & PROTO_CMD_MOUSE_BUTTON_##_button##_SELECT, \ _state & PROTO_CMD_MOUSE_BUTTON_##_button##_STATE - hid_mouse.sendMouseButtons( + hid_mouse.sendButtons( MOUSE_PAIR(main_state, LEFT), MOUSE_PAIR(main_state, RIGHT), MOUSE_PAIR(main_state, MIDDLE), @@ -104,14 +104,14 @@ uint8_t cmdMouseMoveEvent(const uint8_t *buffer) { // 4 bytes y |= (int)buffer[3]; y = (y + 32768) / 2; // See /kvmd/apps/otg/hid/keyboard.py for details - hid_mouse.sendMouseMove(x, y); + hid_mouse.sendMove(x, y); # endif return PROTO_RESP_OK; } uint8_t cmdMouseWheelEvent(const uint8_t *buffer) { // 2 bytes # ifdef HID_USB_MOUSE - hid_mouse.sendMouseWheel(buffer[1]); // Y only, X is not supported + hid_mouse.sendWheel(buffer[1]); // Y only, X is not supported # endif return PROTO_RESP_OK; } diff --git a/hid/src/usb/hid.h b/hid/src/usb/hid.h index 6b729323..326e8cc5 100644 --- a/hid/src/usb/hid.h +++ b/hid/src/usb/hid.h @@ -71,31 +71,31 @@ class UsbHidMouse { SingleAbsoluteMouse.releaseAll(); } - void sendMouseButtons( + void sendButtons( bool left_select, bool left_state, bool right_select, bool right_state, bool middle_select, bool middle_state, bool up_select, bool up_state, bool down_select, bool down_state ) { - if (left_select) _sendMouseButton(MOUSE_LEFT, left_state); - if (right_select) _sendMouseButton(MOUSE_RIGHT, right_state); - if (middle_select) _sendMouseButton(MOUSE_MIDDLE, middle_state); - if (up_select) _sendMouseButton(MOUSE_PREV, up_state); - if (down_select) _sendMouseButton(MOUSE_NEXT, down_state); + if (left_select) _sendButton(MOUSE_LEFT, left_state); + if (right_select) _sendButton(MOUSE_RIGHT, right_state); + if (middle_select) _sendButton(MOUSE_MIDDLE, middle_state); + if (up_select) _sendButton(MOUSE_PREV, up_state); + if (down_select) _sendButton(MOUSE_NEXT, down_state); } - void sendMouseMove(int x, int y) { + void sendMove(int x, int y) { SingleAbsoluteMouse.moveTo(x, y); } - void sendMouseWheel(int delta_y) { + void sendWheel(int delta_y) { // delta_x is not supported by hid-project now SingleAbsoluteMouse.move(0, 0, delta_y); } private: - void _sendMouseButton(uint8_t button, bool state) { + void _sendButton(uint8_t button, bool state) { if (state) SingleAbsoluteMouse.press(button); else SingleAbsoluteMouse.release(button); } |