Merge pull request #1060 from keyboardio/portability-fixes

Assorted portability fixes
pull/1072/head^2
Jesse Vincent 3 years ago committed by GitHub
commit 36938bb57b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,6 +26,7 @@
#define CRGB(r,g,b) (cRGB){b, g, r} #define CRGB(r,g,b) (cRGB){b, g, r}
#include "kaleidoscope/driver/keyscanner/Base.h" #include "kaleidoscope/driver/keyscanner/Base.h"
#include "kaleidoscope/driver/hid/Keyboardio.h"
#include "kaleidoscope/driver/led/Base.h" #include "kaleidoscope/driver/led/Base.h"
#include "kaleidoscope/driver/bootloader/samd/Bossac.h" #include "kaleidoscope/driver/bootloader/samd/Bossac.h"
#include "kaleidoscope/driver/storage/Flash.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 RaiseSideFlasherProps : public kaleidoscope::util::flasher::BaseProps {};
struct RaiseProps : kaleidoscope::device::BaseProps { struct RaiseProps : kaleidoscope::device::BaseProps {
typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps;
typedef kaleidoscope::driver::hid::Keyboardio<HIDProps> HID;
typedef RaiseLEDDriverProps LEDDriverProps; typedef RaiseLEDDriverProps LEDDriverProps;
typedef RaiseLEDDriver LEDDriver; typedef RaiseLEDDriver LEDDriver;
typedef RaiseKeyScannerProps KeyScannerProps; typedef RaiseKeyScannerProps KeyScannerProps;

@ -23,6 +23,7 @@
#include "kaleidoscope/device/Base.h" #include "kaleidoscope/device/Base.h"
#include "kaleidoscope/driver/mcu/ATmega32U4.h" #include "kaleidoscope/driver/mcu/ATmega32U4.h"
#include "kaleidoscope/driver/hid/Keyboardio.h"
#include "kaleidoscope/driver/keyscanner/ATmega.h" #include "kaleidoscope/driver/keyscanner/ATmega.h"
#include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h" #include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h"
#include "kaleidoscope/driver/storage/AVREEPROM.h" #include "kaleidoscope/driver/storage/AVREEPROM.h"
@ -31,6 +32,8 @@ namespace kaleidoscope {
namespace device { namespace device {
struct ATmega32U4KeyboardProps : kaleidoscope::device::BaseProps { struct ATmega32U4KeyboardProps : kaleidoscope::device::BaseProps {
typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps;
typedef kaleidoscope::driver::hid::Keyboardio<HIDProps> HID;
typedef kaleidoscope::driver::mcu::ATmega32U4Props MCUProps; typedef kaleidoscope::driver::mcu::ATmega32U4Props MCUProps;
typedef kaleidoscope::driver::mcu::ATmega32U4<MCUProps> MCU; typedef kaleidoscope::driver::mcu::ATmega32U4<MCUProps> MCU;
typedef kaleidoscope::driver::storage::ATmega32U4EEPROMProps StorageProps; typedef kaleidoscope::driver::storage::ATmega32U4EEPROMProps StorageProps;

@ -25,7 +25,7 @@
#include "kaleidoscope_internal/deprecations.h" #include "kaleidoscope_internal/deprecations.h"
#include "kaleidoscope/macro_helpers.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/keyscanner/None.h"
#include "kaleidoscope/driver/led/None.h" #include "kaleidoscope/driver/led/None.h"
#include "kaleidoscope/driver/mcu/None.h" #include "kaleidoscope/driver/mcu/None.h"
@ -53,8 +53,8 @@ namespace kaleidoscope {
namespace device { namespace device {
struct BaseProps { struct BaseProps {
typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps; typedef kaleidoscope::driver::hid::BaseProps HIDProps;
typedef kaleidoscope::driver::hid::Keyboardio<HIDProps> HID; typedef kaleidoscope::driver::hid::Base<HIDProps> HID;
typedef kaleidoscope::driver::keyscanner::BaseProps KeyScannerProps; typedef kaleidoscope::driver::keyscanner::BaseProps KeyScannerProps;
typedef kaleidoscope::driver::keyscanner::None KeyScanner; typedef kaleidoscope::driver::keyscanner::None KeyScanner;
typedef kaleidoscope::driver::led::BaseProps LEDDriverProps; typedef kaleidoscope::driver::led::BaseProps LEDDriverProps;

@ -22,6 +22,7 @@
#include KALEIDOSCOPE_HARDWARE_H #include KALEIDOSCOPE_HARDWARE_H
#include "kaleidoscope/driver/bootloader/None.h" #include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/hid/Keyboardio.h"
#include "kaleidoscope/driver/led/Base.h" #include "kaleidoscope/driver/led/Base.h"
namespace kaleidoscope { namespace kaleidoscope {
@ -110,6 +111,8 @@ class VirtualLEDDriver
// the physical keyboard. // the physical keyboard.
// //
struct VirtualProps : public kaleidoscope::DeviceProps { struct VirtualProps : public kaleidoscope::DeviceProps {
typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps;
typedef kaleidoscope::driver::hid::Keyboardio<HIDProps> HID;
typedef typename kaleidoscope::DeviceProps::KeyScannerProps typedef typename kaleidoscope::DeviceProps::KeyScannerProps
KeyScannerProps; KeyScannerProps;
typedef VirtualKeyScanner typedef VirtualKeyScanner

@ -20,6 +20,10 @@
#include "kaleidoscope/key_defs.h" #include "kaleidoscope/key_defs.h"
#ifndef HID_BOOT_PROTOCOL
#define HID_BOOT_PROTOCOL 0
#endif
namespace kaleidoscope { namespace kaleidoscope {
namespace driver { namespace driver {
namespace hid { namespace hid {

@ -30,14 +30,11 @@ class NoMouse {
void begin() {} void begin() {}
void sendReport() {} void sendReport() {}
void move(int8_t x, int8_t y, int8_t vWheel, int8_t hWheel) {} 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 releaseAll() {}
void press(uint8_t buttons) {} void press(uint8_t buttons) {}
void release(uint8_t buttons) {} void release(uint8_t buttons) {}
void click(uint8_t buttons) {} void click(uint8_t buttons) {}
HID_MouseReport_Data_t getReport() {
static HID_MouseReport_Data_t report;
return report;
}
}; };
struct MouseProps { struct MouseProps {
@ -63,17 +60,7 @@ class Mouse {
mouse_.move(x, y, vWheel, hWheel); mouse_.move(x, y, vWheel, hWheel);
} }
void stop(bool x, bool y, bool vWheel = false, bool hWheel = false) { void stop(bool x, bool y, bool vWheel = false, bool hWheel = false) {
HID_MouseReport_Data_t report = mouse_.getReport(); mouse_.stop(x, y, vWheel, hWheel);
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 releaseAllButtons() { void releaseAllButtons() {
mouse_.releaseAll(); mouse_.releaseAll();

@ -50,6 +50,20 @@ class MouseWrapper {
void move(int8_t x, int8_t y, int8_t vWheel, int8_t hWheel) { void move(int8_t x, int8_t y, int8_t vWheel, int8_t hWheel) {
Mouse.move(x, y, vWheel, 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() { void releaseAll() {
Mouse.releaseAll(); Mouse.releaseAll();
} }
@ -62,9 +76,6 @@ class MouseWrapper {
void click(uint8_t buttons) { void click(uint8_t buttons) {
Mouse.click(buttons); Mouse.click(buttons);
} }
HID_MouseReport_Data_t getReport() {
return Mouse.getReport();
}
}; };
struct MouseProps: public base::MouseProps { struct MouseProps: public base::MouseProps {

@ -23,7 +23,7 @@
#include <stddef.h> #include <stddef.h>
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD #if defined(KALEIDOSCOPE_VIRTUAL_BUILD) || defined(ARDUINO_ARCH_STM32)
#include <new> #include <new>
#else #else

Loading…
Cancel
Save