summaryrefslogtreecommitdiff
path: root/hid/src/usb
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-11-12 21:03:28 +0300
committerDevaev Maxim <[email protected]>2020-11-12 21:03:28 +0300
commit87cc8cf7b0e00f7f0a9badf551067aafad6da4ce (patch)
treecdd802d124236ded6969dc5d80c764deec357e02 /hid/src/usb
parent79ef26e2f441f6c742a5da78b08ea2d5a4cc6e18 (diff)
parent0984f0cb36c5881669010c62e986cc8bc7fe019a (diff)
Merge branch 'spi'
Diffstat (limited to 'hid/src/usb')
-rw-r--r--hid/src/usb/hid.h18
-rw-r--r--hid/src/usb/keymap.h4
-rw-r--r--hid/src/usb/keymap.h.mako8
3 files changed, 12 insertions, 18 deletions
diff --git a/hid/src/usb/hid.h b/hid/src/usb/hid.h
index b4523a6b..6b729323 100644
--- a/hid/src/usb/hid.h
+++ b/hid/src/usb/hid.h
@@ -24,8 +24,6 @@
#include <HID-Project.h>
-#include "../inline.h"
-
#include "keymap.h"
@@ -38,11 +36,11 @@ class UsbHidKeyboard {
BootKeyboard.begin();
}
- INLINE void reset() {
+ void reset() {
BootKeyboard.releaseAll();
}
- INLINE void sendKey(uint8_t code, bool state) {
+ void sendKey(uint8_t code, bool state) {
KeyboardKeycode usb_code = keymapUsb(code);
if (usb_code != KEY_ERROR_UNDEFINED) {
if (state) BootKeyboard.press(usb_code);
@@ -50,7 +48,7 @@ class UsbHidKeyboard {
}
}
- INLINE uint8_t getLedsAs(uint8_t caps, uint8_t scroll, uint8_t num) {
+ uint8_t getLedsAs(uint8_t caps, uint8_t scroll, uint8_t num) {
uint8_t leds = BootKeyboard.getLeds();
uint8_t result = 0;
@@ -69,11 +67,11 @@ class UsbHidMouse {
SingleAbsoluteMouse.begin();
}
- INLINE void reset() {
+ void reset() {
SingleAbsoluteMouse.releaseAll();
}
- INLINE void sendMouseButtons(
+ void sendMouseButtons(
bool left_select, bool left_state,
bool right_select, bool right_state,
bool middle_select, bool middle_state,
@@ -87,17 +85,17 @@ class UsbHidMouse {
if (down_select) _sendMouseButton(MOUSE_NEXT, down_state);
}
- INLINE void sendMouseMove(int x, int y) {
+ void sendMouseMove(int x, int y) {
SingleAbsoluteMouse.moveTo(x, y);
}
- INLINE void sendMouseWheel(int delta_y) {
+ void sendMouseWheel(int delta_y) {
// delta_x is not supported by hid-project now
SingleAbsoluteMouse.move(0, 0, delta_y);
}
private:
- INLINE void _sendMouseButton(uint8_t button, bool state) {
+ void _sendMouseButton(uint8_t button, bool state) {
if (state) SingleAbsoluteMouse.press(button);
else SingleAbsoluteMouse.release(button);
}
diff --git a/hid/src/usb/keymap.h b/hid/src/usb/keymap.h
index 35df2be4..1564b1f0 100644
--- a/hid/src/usb/keymap.h
+++ b/hid/src/usb/keymap.h
@@ -24,10 +24,8 @@
#include <HID-Project.h>
-#include "../inline.h"
-
-INLINE KeyboardKeycode keymapUsb(uint8_t code) {
+KeyboardKeycode keymapUsb(uint8_t code) {
switch (code) {
case 1: return KEY_A;
case 2: return KEY_B;
diff --git a/hid/src/usb/keymap.h.mako b/hid/src/usb/keymap.h.mako
index 5df3a7f5..a93d91a4 100644
--- a/hid/src/usb/keymap.h.mako
+++ b/hid/src/usb/keymap.h.mako
@@ -24,13 +24,11 @@
#include <HID-Project.h>
-#include "../inline.h"
-
<%! import operator %>
-INLINE KeyboardKeycode keymapUsb(uint8_t code) {
+KeyboardKeycode keymapUsb(uint8_t code) {
switch (code) {
-% for km in sorted(keymap, key=operator.attrgetter("serial_code")):
- case ${km.serial_code}: return ${km.arduino_name};
+% for km in sorted(keymap, key=operator.attrgetter("mcu_code")):
+ case ${km.mcu_code}: return ${km.arduino_name};
% endfor
default: return KEY_ERROR_UNDEFINED;
}