refactoring

This commit is contained in:
Maxim Devaev 2023-03-04 20:02:28 +02:00
parent 79e1b457b7
commit 50b6237e98
4 changed files with 16 additions and 14 deletions

View File

@ -64,7 +64,7 @@ namespace DRIVERS {
}
}
Storage* Factory::makeStorage(type _type) {
Storage *Factory::makeStorage(type _type) {
switch (_type) {
# ifdef HID_DYNAMIC
case NON_VOLATILE_STORAGE:
@ -75,14 +75,14 @@ namespace DRIVERS {
}
}
Board* Factory::makeBoard(type _type) {
Board *Factory::makeBoard(type _type) {
switch (_type) {
default:
return new Board(DRIVERS::DUMMY);
}
}
Connection* Factory::makeConnection(type _type) {
Connection *Factory::makeConnection(type _type) {
# ifdef CMD_SERIAL
return new Serial();
# elif defined(CMD_SPI)

View File

@ -64,7 +64,7 @@ namespace DRIVERS {
}
}
Storage* Factory::makeStorage(type _type) {
Storage *Factory::makeStorage(type _type) {
switch (_type) {
# ifdef HID_DYNAMIC
case NON_VOLATILE_STORAGE:
@ -75,7 +75,7 @@ namespace DRIVERS {
}
}
Board* Factory::makeBoard(type _type) {
Board *Factory::makeBoard(type _type) {
switch (_type) {
case BOARD:
return new BoardStm32();
@ -84,7 +84,7 @@ namespace DRIVERS {
}
}
Connection* Factory::makeConnection(type _type) {
Connection *Factory::makeConnection(type _type) {
# ifdef CMD_SERIAL
return new Serial();
# else

View File

@ -32,8 +32,8 @@ namespace DRIVERS {
struct Factory {
static Keyboard *makeKeyboard(type _type);
static Mouse *makeMouse(type _type);
static Storage* makeStorage(type _type);
static Board* makeBoard(type _type);
static Connection* makeConnection(type _type);
static Storage *makeStorage(type _type);
static Board *makeBoard(type _type);
static Connection *makeConnection(type _type);
};
}

View File

@ -24,19 +24,21 @@
#include "tools.h"
#include "proto.h"
#include "board.h"
#include "outputs.h"
#ifdef AUM
# include "aum.h"
#endif
#include "board.h"
#include "outputs.h"
static DRIVERS::Connection* _conn;
static DRIVERS::Board* _board;
static DRIVERS::Connection *_conn;
static DRIVERS::Board *_board;
static Outputs _out;
#ifdef HID_DYNAMIC
# define RESET_TIMEOUT 500000
static bool _reset_required = false;
static unsigned long _reset_timestamp;
# define RESET_TIMEOUT 500000
#endif