summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--hid/lib/drivers-avr/factory.cpp22
-rw-r--r--hid/lib/drivers-avr/spi.cpp3
-rw-r--r--hid/lib/drivers-avr/spi.h1
-rw-r--r--hid/lib/drivers-avr/usb/hid.h1
-rw-r--r--hid/lib/drivers/factory.h2
-rw-r--r--hid/lib/drivers/keyboard.h1
-rw-r--r--hid/lib/drivers/tools.cpp4
-rw-r--r--hid/lib/drivers/tools.h2
-rw-r--r--hid/src/main.cpp18
10 files changed, 29 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index c0a95f5c..12fa18dc 100644
--- a/Makefile
+++ b/Makefile
@@ -206,8 +206,8 @@ keymap: testenv
--volume `pwd`:/src \
-it $(TESTENV_IMAGE) bash -c "cd src \
&& ./genmap.py keymap.csv kvmd/keyboard/mappings.py.mako kvmd/keyboard/mappings.py \
- && ./genmap.py keymap.csv hid/src/usb/keymap.h.mako hid/src/usb/keymap.h \
- && ./genmap.py keymap.csv hid/src/ps2/keymap.h.mako hid/src/ps2/keymap.h \
+ && ./genmap.py keymap.csv hid/lib/drivers-avr/usb/keymap.h.mako hid/lib/drivers-avr/usb/keymap.h \
+ && ./genmap.py keymap.csv hid/lib/drivers-avr/ps2/keymap.h.mako hid/lib/drivers-avr/ps2/keymap.h \
"
diff --git a/hid/lib/drivers-avr/factory.cpp b/hid/lib/drivers-avr/factory.cpp
index d58e6c96..26f10583 100644
--- a/hid/lib/drivers-avr/factory.cpp
+++ b/hid/lib/drivers-avr/factory.cpp
@@ -19,43 +19,41 @@
# #
*****************************************************************************/
+
#include "usb/hid.h"
#include "ps2/hid.h"
#include "factory.h"
-namespace DRIVERS
-{
+namespace DRIVERS {
Keyboard *Factory::makeKeyboard(type _type) {
switch (_type) {
-
-# ifdef HID_WITH_USB
+# ifdef HID_WITH_USB
case USB_KEYBOARD:
return new UsbKeyboard();
-# endif
+# endif
-# ifdef HID_WITH_PS2
+# ifdef HID_WITH_PS2
case PS2_KEYBOARD:
return new Ps2Keyboard();
-# endif
+# endif
+
default:
return new Keyboard(DUMMY);
}
}
Mouse *Factory::makeMouse(type _type) {
- switch(_type)
- {
-# ifdef HID_WITH_USB
+ switch (_type) {
+# ifdef HID_WITH_USB
case USB_MOUSE_ABSOLUTE:
case USB_MOUSE_ABSOLUTE_WIN98:
return new UsbMouseAbsolute(_type);
case USB_MOUSE_RELATIVE:
return new UsbMouseRelative();
-# endif
+# endif
default:
return new Mouse(DRIVERS::DUMMY);
}
}
-
}
diff --git a/hid/lib/drivers-avr/spi.cpp b/hid/lib/drivers-avr/spi.cpp
index e2b56928..66061692 100644
--- a/hid/lib/drivers-avr/spi.cpp
+++ b/hid/lib/drivers-avr/spi.cpp
@@ -22,9 +22,6 @@
#include "spi.h"
-#include <Arduino.h>
-#include <SPI.h>
-
static volatile uint8_t _spi_in[8] = {0};
static volatile uint8_t _spi_in_index = 0;
diff --git a/hid/lib/drivers-avr/spi.h b/hid/lib/drivers-avr/spi.h
index fc9337e5..6a8e9e8c 100644
--- a/hid/lib/drivers-avr/spi.h
+++ b/hid/lib/drivers-avr/spi.h
@@ -23,6 +23,7 @@
#pragma once
#include <Arduino.h>
+#include <SPI.h>
void spiBegin();
diff --git a/hid/lib/drivers-avr/usb/hid.h b/hid/lib/drivers-avr/usb/hid.h
index 0bc5cb2d..dec850a7 100644
--- a/hid/lib/drivers-avr/usb/hid.h
+++ b/hid/lib/drivers-avr/usb/hid.h
@@ -69,6 +69,7 @@ using namespace DRIVERS;
#endif
+
class UsbKeyboard : public DRIVERS::Keyboard {
public:
UsbKeyboard() : DRIVERS::Keyboard(DRIVERS::USB_KEYBOARD) {}
diff --git a/hid/lib/drivers/factory.h b/hid/lib/drivers/factory.h
index c787347a..0fb8e173 100644
--- a/hid/lib/drivers/factory.h
+++ b/hid/lib/drivers/factory.h
@@ -24,8 +24,8 @@
#include "keyboard.h"
#include "mouse.h"
-namespace DRIVERS {
+namespace DRIVERS {
struct Factory {
static Keyboard *makeKeyboard(type _type);
static Mouse *makeMouse(type _type);
diff --git a/hid/lib/drivers/keyboard.h b/hid/lib/drivers/keyboard.h
index 2e902818..49fd15de 100644
--- a/hid/lib/drivers/keyboard.h
+++ b/hid/lib/drivers/keyboard.h
@@ -64,6 +64,5 @@ namespace DRIVERS {
KeyboardLedsState result = {0};
return result;
}
-
};
}
diff --git a/hid/lib/drivers/tools.cpp b/hid/lib/drivers/tools.cpp
index 7f0e29ca..0220e5f0 100644
--- a/hid/lib/drivers/tools.cpp
+++ b/hid/lib/drivers/tools.cpp
@@ -19,7 +19,9 @@
# #
*****************************************************************************/
-#include <Arduino.h>
+
+#include "tools.h"
+
bool is_micros_timed_out(unsigned long start_ts, unsigned long timeout) {
unsigned long now = micros();
diff --git a/hid/lib/drivers/tools.h b/hid/lib/drivers/tools.h
index 0f11c7c3..00f0fd2a 100644
--- a/hid/lib/drivers/tools.h
+++ b/hid/lib/drivers/tools.h
@@ -22,5 +22,7 @@
#pragma once
+#include <Arduino.h>
+
bool is_micros_timed_out(unsigned long start_ts, unsigned long timeout);
diff --git a/hid/src/main.cpp b/hid/src/main.cpp
index fe030a3a..f518fa25 100644
--- a/hid/src/main.cpp
+++ b/hid/src/main.cpp
@@ -178,21 +178,21 @@ static void _cmdMouseButtonEvent(const uint8_t *data) { // 2 bytes
_state & PROTO::CMD::MOUSE::_button::SELECT, \
_state & PROTO::CMD::MOUSE::_button::STATE
_mouse->sendButtons(
- MOUSE_PAIR(data[0], LEFT),
- MOUSE_PAIR(data[0], RIGHT),
- MOUSE_PAIR(data[0], MIDDLE),
- MOUSE_PAIR(data[1], EXTRA_UP),
- MOUSE_PAIR(data[1], EXTRA_DOWN)
- );
+ MOUSE_PAIR(data[0], LEFT),
+ MOUSE_PAIR(data[0], RIGHT),
+ MOUSE_PAIR(data[0], MIDDLE),
+ MOUSE_PAIR(data[1], EXTRA_UP),
+ MOUSE_PAIR(data[1], EXTRA_DOWN)
+ );
# undef MOUSE_PAIR
}
static void _cmdMouseMoveEvent(const uint8_t *data) { // 4 bytes
// See /kvmd/apps/otg/hid/keyboard.py for details
_mouse->sendMove(
- PROTO::merge8_int(data[0], data[1]),
- PROTO::merge8_int(data[2], data[3])
- );
+ PROTO::merge8_int(data[0], data[1]),
+ PROTO::merge8_int(data[2], data[3])
+ );
}
static void _cmdMouseRelativeEvent(const uint8_t *data) { // 2 bytes