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}
#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<HIDProps> HID;
typedef RaiseLEDDriverProps LEDDriverProps;
typedef RaiseLEDDriver LEDDriver;
typedef RaiseKeyScannerProps KeyScannerProps;

@ -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<HIDProps> HID;
typedef kaleidoscope::driver::mcu::ATmega32U4Props MCUProps;
typedef kaleidoscope::driver::mcu::ATmega32U4<MCUProps> MCU;
typedef kaleidoscope::driver::storage::ATmega32U4EEPROMProps StorageProps;

@ -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<HIDProps> HID;
typedef kaleidoscope::driver::hid::BaseProps HIDProps;
typedef kaleidoscope::driver::hid::Base<HIDProps> HID;
typedef kaleidoscope::driver::keyscanner::BaseProps KeyScannerProps;
typedef kaleidoscope::driver::keyscanner::None KeyScanner;
typedef kaleidoscope::driver::led::BaseProps LEDDriverProps;

@ -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<HIDProps> HID;
typedef typename kaleidoscope::DeviceProps::KeyScannerProps
KeyScannerProps;
typedef VirtualKeyScanner

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

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

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

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

Loading…
Cancel
Save