Port to the new HID facade

pull/365/head
Jesse Vincent 7 years ago
parent 2c08dd867b
commit b87014c544
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -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) {

@ -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;

Loading…
Cancel
Save