mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
refactoring
This commit is contained in:
parent
24651f4db3
commit
9f289914e9
@ -43,10 +43,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "outputs.h"
|
#include "outputs.h"
|
||||||
|
|
||||||
|
|
||||||
|
static Outputs _out;
|
||||||
#ifdef HID_DYNAMIC
|
#ifdef HID_DYNAMIC
|
||||||
static bool _reset_required = false;
|
static bool _reset_required = false;
|
||||||
#endif
|
#endif
|
||||||
static Outputs _out;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
static void _cmdSetKeyboard(const uint8_t *data) { // 1 bytes
|
static void _cmdSetKeyboard(const uint8_t *data) { // 1 bytes
|
||||||
|
|||||||
@ -19,9 +19,11 @@
|
|||||||
# #
|
# #
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
|
|
||||||
|
|
||||||
class Outputs {
|
class Outputs {
|
||||||
public:
|
public:
|
||||||
void writeOutputs(uint8_t mask, uint8_t outputs, bool force) {
|
void writeOutputs(uint8_t mask, uint8_t outputs, bool force) {
|
||||||
@ -40,16 +42,15 @@ class Outputs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initOutputs() {
|
void initOutputs() {
|
||||||
int outputs;
|
|
||||||
# ifdef HID_DYNAMIC
|
# ifdef HID_DYNAMIC
|
||||||
_storage = DRIVERS::Factory::makeStorage(DRIVERS::NON_VOLATILE_STORAGE);
|
_storage = DRIVERS::Factory::makeStorage(DRIVERS::NON_VOLATILE_STORAGE);
|
||||||
# else
|
# else
|
||||||
_storage = DRIVERS::Factory::makeStorage(DRIVERS::DUMMY);
|
_storage = DRIVERS::Factory::makeStorage(DRIVERS::DUMMY);
|
||||||
# endif
|
# endif
|
||||||
outputs = _readOutputs();
|
|
||||||
|
uint8_t outputs = _readOutputs();
|
||||||
if (outputs < 0) {
|
if (outputs < 0) {
|
||||||
outputs = 0;
|
outputs = 0;
|
||||||
|
|
||||||
# if defined(HID_WITH_USB) && defined(HID_SET_USB_KBD)
|
# if defined(HID_WITH_USB) && defined(HID_SET_USB_KBD)
|
||||||
outputs |= PROTO::OUTPUTS1::KEYBOARD::USB;
|
outputs |= PROTO::OUTPUTS1::KEYBOARD::USB;
|
||||||
# elif defined(HID_WITH_PS2) && defined(HID_SET_PS2_KBD)
|
# elif defined(HID_WITH_PS2) && defined(HID_SET_PS2_KBD)
|
||||||
@ -95,9 +96,11 @@ class Outputs {
|
|||||||
mouse = DRIVERS::Factory::makeMouse(DRIVERS::DUMMY);
|
mouse = DRIVERS::Factory::makeMouse(DRIVERS::DUMMY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef ARDUINO_ARCH_AVR
|
# ifdef ARDUINO_ARCH_AVR
|
||||||
USBDevice.attach();
|
USBDevice.attach();
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
kbd->begin();
|
kbd->begin();
|
||||||
mouse->begin();
|
mouse->begin();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user