summaryrefslogtreecommitdiff
path: root/hid
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-07-15 21:03:55 +0300
committerMaxim Devaev <[email protected]>2022-07-15 21:03:55 +0300
commit9f289914e90011208a54292d43208c6bd1a0b9b9 (patch)
treedf893468881fdb18c7c8d492df55bf25bb450b59 /hid
parent24651f4db3fabc2b5a66125744380d5d5aa1ab4e (diff)
refactoring
Diffstat (limited to 'hid')
-rw-r--r--hid/src/main.cpp4
-rw-r--r--hid/src/outputs.h9
2 files changed, 9 insertions, 4 deletions
diff --git a/hid/src/main.cpp b/hid/src/main.cpp
index b1512a0d..7a7b83db 100644
--- a/hid/src/main.cpp
+++ b/hid/src/main.cpp
@@ -43,10 +43,12 @@
#endif
#include "outputs.h"
+
+static Outputs _out;
#ifdef HID_DYNAMIC
static bool _reset_required = false;
#endif
-static Outputs _out;
+
// -----------------------------------------------------------------------------
static void _cmdSetKeyboard(const uint8_t *data) { // 1 bytes
diff --git a/hid/src/outputs.h b/hid/src/outputs.h
index c4bef624..7c3fb18c 100644
--- a/hid/src/outputs.h
+++ b/hid/src/outputs.h
@@ -19,9 +19,11 @@
# #
*****************************************************************************/
+
#include "factory.h"
#include "proto.h"
+
class Outputs {
public:
void writeOutputs(uint8_t mask, uint8_t outputs, bool force) {
@@ -40,16 +42,15 @@ class Outputs {
}
void initOutputs() {
- int outputs;
# ifdef HID_DYNAMIC
_storage = DRIVERS::Factory::makeStorage(DRIVERS::NON_VOLATILE_STORAGE);
# else
_storage = DRIVERS::Factory::makeStorage(DRIVERS::DUMMY);
# endif
- outputs = _readOutputs();
+
+ uint8_t outputs = _readOutputs();
if (outputs < 0) {
outputs = 0;
-
# if defined(HID_WITH_USB) && defined(HID_SET_USB_KBD)
outputs |= PROTO::OUTPUTS1::KEYBOARD::USB;
# elif defined(HID_WITH_PS2) && defined(HID_SET_PS2_KBD)
@@ -95,9 +96,11 @@ class Outputs {
mouse = DRIVERS::Factory::makeMouse(DRIVERS::DUMMY);
break;
}
+
# ifdef ARDUINO_ARCH_AVR
USBDevice.attach();
# endif
+
kbd->begin();
mouse->begin();
}