diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h index 80f1e5ed..28beb92b 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h @@ -26,6 +26,7 @@ #define CRGB(r,g,b) (cRGB){b, g, r} #include "kaleidoscope/driver/keyscanner/Base.h" +#include "kaleidoscope/driver/hid/Keyboardio.h" #include "kaleidoscope/driver/led/Base.h" #include "kaleidoscope/driver/bootloader/samd/Bossac.h" #include "kaleidoscope/driver/storage/Flash.h" @@ -156,6 +157,8 @@ struct RaiseStorageProps : public kaleidoscope::driver::storage::FlashProps { struct RaiseSideFlasherProps : public kaleidoscope::util::flasher::BaseProps {}; struct RaiseProps : kaleidoscope::device::BaseProps { + typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps; + typedef kaleidoscope::driver::hid::Keyboardio HID; typedef RaiseLEDDriverProps LEDDriverProps; typedef RaiseLEDDriver LEDDriver; typedef RaiseKeyScannerProps KeyScannerProps; diff --git a/src/kaleidoscope/device/ATmega32U4Keyboard.h b/src/kaleidoscope/device/ATmega32U4Keyboard.h index b9ae02ff..f710c12d 100644 --- a/src/kaleidoscope/device/ATmega32U4Keyboard.h +++ b/src/kaleidoscope/device/ATmega32U4Keyboard.h @@ -23,6 +23,7 @@ #include "kaleidoscope/device/Base.h" #include "kaleidoscope/driver/mcu/ATmega32U4.h" +#include "kaleidoscope/driver/hid/Keyboardio.h" #include "kaleidoscope/driver/keyscanner/ATmega.h" #include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h" #include "kaleidoscope/driver/storage/AVREEPROM.h" @@ -31,6 +32,8 @@ namespace kaleidoscope { namespace device { struct ATmega32U4KeyboardProps : kaleidoscope::device::BaseProps { + typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps; + typedef kaleidoscope::driver::hid::Keyboardio HID; typedef kaleidoscope::driver::mcu::ATmega32U4Props MCUProps; typedef kaleidoscope::driver::mcu::ATmega32U4 MCU; typedef kaleidoscope::driver::storage::ATmega32U4EEPROMProps StorageProps; diff --git a/src/kaleidoscope/device/Base.h b/src/kaleidoscope/device/Base.h index 5841d780..826a1cb1 100644 --- a/src/kaleidoscope/device/Base.h +++ b/src/kaleidoscope/device/Base.h @@ -25,7 +25,7 @@ #include "kaleidoscope_internal/deprecations.h" #include "kaleidoscope/macro_helpers.h" -#include "kaleidoscope/driver/hid/Keyboardio.h" +#include "kaleidoscope/driver/hid/Base.h" #include "kaleidoscope/driver/keyscanner/None.h" #include "kaleidoscope/driver/led/None.h" #include "kaleidoscope/driver/mcu/None.h" @@ -53,8 +53,8 @@ namespace kaleidoscope { namespace device { struct BaseProps { - typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps; - typedef kaleidoscope::driver::hid::Keyboardio HID; + typedef kaleidoscope::driver::hid::BaseProps HIDProps; + typedef kaleidoscope::driver::hid::Base HID; typedef kaleidoscope::driver::keyscanner::BaseProps KeyScannerProps; typedef kaleidoscope::driver::keyscanner::None KeyScanner; typedef kaleidoscope::driver::led::BaseProps LEDDriverProps; diff --git a/src/kaleidoscope/device/virtual/Virtual.h b/src/kaleidoscope/device/virtual/Virtual.h index 9bc576fc..a6ea731f 100644 --- a/src/kaleidoscope/device/virtual/Virtual.h +++ b/src/kaleidoscope/device/virtual/Virtual.h @@ -22,6 +22,7 @@ #include KALEIDOSCOPE_HARDWARE_H #include "kaleidoscope/driver/bootloader/None.h" +#include "kaleidoscope/driver/hid/Keyboardio.h" #include "kaleidoscope/driver/led/Base.h" namespace kaleidoscope { @@ -110,6 +111,8 @@ class VirtualLEDDriver // the physical keyboard. // struct VirtualProps : public kaleidoscope::DeviceProps { + typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps; + typedef kaleidoscope::driver::hid::Keyboardio HID; typedef typename kaleidoscope::DeviceProps::KeyScannerProps KeyScannerProps; typedef VirtualKeyScanner diff --git a/src/kaleidoscope/driver/hid/base/Keyboard.h b/src/kaleidoscope/driver/hid/base/Keyboard.h index 0f44b9f5..8363ea6b 100644 --- a/src/kaleidoscope/driver/hid/base/Keyboard.h +++ b/src/kaleidoscope/driver/hid/base/Keyboard.h @@ -20,6 +20,10 @@ #include "kaleidoscope/key_defs.h" +#ifndef HID_BOOT_PROTOCOL +#define HID_BOOT_PROTOCOL 0 +#endif + namespace kaleidoscope { namespace driver { namespace hid { diff --git a/src/kaleidoscope/driver/hid/base/Mouse.h b/src/kaleidoscope/driver/hid/base/Mouse.h index 4ff40d8f..ebd71d3c 100644 --- a/src/kaleidoscope/driver/hid/base/Mouse.h +++ b/src/kaleidoscope/driver/hid/base/Mouse.h @@ -30,14 +30,11 @@ class NoMouse { void begin() {} void sendReport() {} void move(int8_t x, int8_t y, int8_t vWheel, int8_t hWheel) {} + void stop(bool x, bool y, bool vWheel, bool hWheel) {} void releaseAll() {} void press(uint8_t buttons) {} void release(uint8_t buttons) {} void click(uint8_t buttons) {} - HID_MouseReport_Data_t getReport() { - static HID_MouseReport_Data_t report; - return report; - } }; struct MouseProps { @@ -63,17 +60,7 @@ class Mouse { mouse_.move(x, y, vWheel, hWheel); } void stop(bool x, bool y, bool vWheel = false, bool hWheel = false) { - HID_MouseReport_Data_t report = mouse_.getReport(); - - if (x) - report.xAxis = 0; - if (y) - report.yAxis = 0; - if (vWheel) - report.vWheel = 0; - if (hWheel) - report.hWheel = 0; - move(report.xAxis, report.yAxis, report.vWheel, report.hWheel); + mouse_.stop(x, y, vWheel, hWheel); } void releaseAllButtons() { mouse_.releaseAll(); diff --git a/src/kaleidoscope/driver/hid/keyboardio/Mouse.h b/src/kaleidoscope/driver/hid/keyboardio/Mouse.h index c9328368..f8773cd5 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/Mouse.h +++ b/src/kaleidoscope/driver/hid/keyboardio/Mouse.h @@ -50,6 +50,20 @@ class MouseWrapper { void move(int8_t x, int8_t y, int8_t vWheel, int8_t hWheel) { Mouse.move(x, y, vWheel, hWheel); } + void stop(bool x, bool y, bool vWheel = false, bool hWheel = false) { + HID_MouseReport_Data_t report = Mouse.getReport(); + + if (x) + report.xAxis = 0; + if (y) + report.yAxis = 0; + if (vWheel) + report.vWheel = 0; + if (hWheel) + report.hWheel = 0; + move(report.xAxis, report.yAxis, report.vWheel, report.hWheel); + } + void releaseAll() { Mouse.releaseAll(); } @@ -62,9 +76,6 @@ class MouseWrapper { void click(uint8_t buttons) { Mouse.click(buttons); } - HID_MouseReport_Data_t getReport() { - return Mouse.getReport(); - } }; struct MouseProps: public base::MouseProps { diff --git a/src/kaleidoscope_internal/LEDModeManager.h b/src/kaleidoscope_internal/LEDModeManager.h index 28ea5f49..835ffca6 100644 --- a/src/kaleidoscope_internal/LEDModeManager.h +++ b/src/kaleidoscope_internal/LEDModeManager.h @@ -23,7 +23,7 @@ #include -#ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#if defined(KALEIDOSCOPE_VIRTUAL_BUILD) || defined(ARDUINO_ARCH_STM32) #include #else