summaryrefslogtreecommitdiff
path: root/hid
diff options
context:
space:
mode:
Diffstat (limited to 'hid')
-rw-r--r--hid/src/main.cpp18
-rw-r--r--hid/src/usb/hid.h6
2 files changed, 18 insertions, 6 deletions
diff --git a/hid/src/main.cpp b/hid/src/main.cpp
index 08ec3f65..cd3c245a 100644
--- a/hid/src/main.cpp
+++ b/hid/src/main.cpp
@@ -66,6 +66,11 @@
#define PROTO_CMD_MOUSE_BUTTON_MIDDLE_SELECT 0b00100000
#define PROTO_CMD_MOUSE_BUTTON_MIDDLE_STATE 0b00000010
+#define PROTO_CMD_MOUSE_BUTTON_EXTRA_UP_SELECT 0b10000000
+#define PROTO_CMD_MOUSE_BUTTON_EXTRA_UP_STATE 0b00001000
+#define PROTO_CMD_MOUSE_BUTTON_EXTRA_DOWN_SELECT 0b01000000
+#define PROTO_CMD_MOUSE_BUTTON_EXTRA_DOWN_STATE 0b00000100
+
// -----------------------------------------------------------------------------
#ifdef HID_USB_KBD
@@ -94,14 +99,17 @@ INLINE uint8_t cmdKeyEvent(const uint8_t *buffer) { // 2 bytes
return PROTO_RESP_OK;
}
-INLINE uint8_t cmdMouseButtonEvent(const uint8_t *buffer) { // 1 byte
+INLINE uint8_t cmdMouseButtonEvent(const uint8_t *buffer) { // 2 bytes
# ifdef HID_USB_MOUSE
- uint8_t state = buffer[0];
+ uint8_t main_state = buffer[0];
+ uint8_t extra_state = buffer[1];
hid_mouse.sendMouseButtons(
- state & PROTO_CMD_MOUSE_BUTTON_LEFT_SELECT, state & PROTO_CMD_MOUSE_BUTTON_LEFT_STATE,
- state & PROTO_CMD_MOUSE_BUTTON_RIGHT_SELECT, state & PROTO_CMD_MOUSE_BUTTON_RIGHT_STATE,
- state & PROTO_CMD_MOUSE_BUTTON_MIDDLE_SELECT, state & PROTO_CMD_MOUSE_BUTTON_MIDDLE_STATE
+ main_state & PROTO_CMD_MOUSE_BUTTON_LEFT_SELECT, main_state & PROTO_CMD_MOUSE_BUTTON_LEFT_STATE,
+ main_state & PROTO_CMD_MOUSE_BUTTON_RIGHT_SELECT, main_state & PROTO_CMD_MOUSE_BUTTON_RIGHT_STATE,
+ main_state & PROTO_CMD_MOUSE_BUTTON_MIDDLE_SELECT, main_state & PROTO_CMD_MOUSE_BUTTON_MIDDLE_STATE,
+ extra_state & PROTO_CMD_MOUSE_BUTTON_EXTRA_UP_SELECT, extra_state & PROTO_CMD_MOUSE_BUTTON_EXTRA_UP_STATE,
+ extra_state & PROTO_CMD_MOUSE_BUTTON_EXTRA_DOWN_SELECT, extra_state & PROTO_CMD_MOUSE_BUTTON_EXTRA_DOWN_STATE
);
# endif
return PROTO_RESP_OK;
diff --git a/hid/src/usb/hid.h b/hid/src/usb/hid.h
index 48e99d28..b4523a6b 100644
--- a/hid/src/usb/hid.h
+++ b/hid/src/usb/hid.h
@@ -76,11 +76,15 @@ class UsbHidMouse {
INLINE void sendMouseButtons(
bool left_select, bool left_state,
bool right_select, bool right_state,
- bool middle_select, bool middle_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);
}
INLINE void sendMouseMove(int x, int y) {