From b87014c544e2f4f2f7ee3905d1c5becb637e54c1 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 25 Jul 2017 11:09:58 -0700 Subject: [PATCH] Port to the new HID facade --- src/Kaleidoscope-MouseKeys.cpp | 4 ++-- src/MouseWrapper.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Kaleidoscope-MouseKeys.cpp b/src/Kaleidoscope-MouseKeys.cpp index 4b7041b2..927d2e9d 100644 --- a/src/Kaleidoscope-MouseKeys.cpp +++ b/src/Kaleidoscope-MouseKeys.cpp @@ -26,9 +26,9 @@ void MouseKeys_::scrollWheel(uint8_t keyCode) { wheelEndTime = millis() + wheelDelay; if (keyCode & KEY_MOUSE_UP) - Mouse.move(0, 0, wheelSpeed); + kaleidoscope::hid::moveMouse(0, 0, wheelSpeed); else if (keyCode & KEY_MOUSE_DOWN) - Mouse.move(0, 0, -wheelSpeed); + kaleidoscope::hid::moveMouse(0, 0, -wheelSpeed); } void MouseKeys_::loopHook(bool postClear) { diff --git a/src/MouseWrapper.cpp b/src/MouseWrapper.cpp index 697def1d..a0b7e993 100644 --- a/src/MouseWrapper.cpp +++ b/src/MouseWrapper.cpp @@ -3,6 +3,7 @@ // // #include "MouseWrapper.h" +#include "kaleidoscope/hid.h" uint16_t MouseWrapper_::next_width; uint16_t MouseWrapper_::next_height; @@ -13,23 +14,23 @@ boolean MouseWrapper_::is_warping; uint8_t MouseWrapper_::accelStep; MouseWrapper_::MouseWrapper_(void) { - Mouse.begin(); - AbsoluteMouse.begin(); + kaleidoscope::hid::initializeMouse(); + kaleidoscope::hid::initializeAbsoluteMouse(); } void MouseWrapper_::pressButton(uint8_t button) { - Mouse.press(button); + kaleidoscope::hid::pressMouseButtons(button); end_warping(); } void MouseWrapper_::release_button(uint8_t button) { - Mouse.release(button); + kaleidoscope::hid::releaseMouseButtons(button); } void MouseWrapper_::warp_jump(uint16_t left, uint16_t top, uint16_t height, uint16_t width) { uint16_t x_center = left + width / 2; uint16_t y_center = top + height / 2; - AbsoluteMouse.moveTo(x_center, y_center); + kaleidoscope::hid::moveAbsoluteMouseTo(x_center, y_center, 0); } void MouseWrapper_::begin_warping() { @@ -107,7 +108,7 @@ void MouseWrapper_::move(int8_t x, int8_t y) { } end_warping(); - Mouse.move(moveX, moveY, 0); + kaleidoscope::hid::moveMouse(moveX, moveY, 0); } MouseWrapper_ MouseWrapper;