refactoring

This commit is contained in:
Maxim Devaev 2022-07-11 02:12:38 +03:00
parent 1afd96cdb9
commit 89aff795fd
10 changed files with 29 additions and 29 deletions

View File

@ -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 \
"

View File

@ -19,16 +19,15 @@
# #
*****************************************************************************/
#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
case USB_KEYBOARD:
return new UsbKeyboard();
@ -38,14 +37,14 @@ namespace DRIVERS
case PS2_KEYBOARD:
return new Ps2Keyboard();
# endif
default:
return new Keyboard(DUMMY);
}
}
Mouse *Factory::makeMouse(type _type) {
switch(_type)
{
switch (_type) {
# ifdef HID_WITH_USB
case USB_MOUSE_ABSOLUTE:
case USB_MOUSE_ABSOLUTE_WIN98:
@ -57,5 +56,4 @@ namespace DRIVERS
return new Mouse(DRIVERS::DUMMY);
}
}
}

View File

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

View File

@ -23,6 +23,7 @@
#pragma once
#include <Arduino.h>
#include <SPI.h>
void spiBegin();

View File

@ -69,6 +69,7 @@ using namespace DRIVERS;
#endif
class UsbKeyboard : public DRIVERS::Keyboard {
public:
UsbKeyboard() : DRIVERS::Keyboard(DRIVERS::USB_KEYBOARD) {}

View File

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

View File

@ -64,6 +64,5 @@ namespace DRIVERS {
KeyboardLedsState result = {0};
return result;
}
};
}

View File

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

View File

@ -22,5 +22,7 @@
#pragma once
#include <Arduino.h>
bool is_micros_timed_out(unsigned long start_ts, unsigned long timeout);