diff options
author | tomaszduda23 <[email protected]> | 2023-03-04 18:25:16 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-03-04 20:25:16 +0300 |
commit | 52ac8d93a18521f19dc45e9b4283417ed06f63d8 (patch) | |
tree | caf95bfe17db38067891d4ed958cdffe50ef4459 /hid/lib/drivers-avr/factory.cpp | |
parent | 1f9e826f2fa9e27c705146254cf3597f531f0599 (diff) |
adds abstraction for connection (#111)
Diffstat (limited to 'hid/lib/drivers-avr/factory.cpp')
-rw-r--r-- | hid/lib/drivers-avr/factory.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/hid/lib/drivers-avr/factory.cpp b/hid/lib/drivers-avr/factory.cpp index b4c18273..3fc02582 100644 --- a/hid/lib/drivers-avr/factory.cpp +++ b/hid/lib/drivers-avr/factory.cpp @@ -24,6 +24,8 @@ #include "ps2/hid.h" #include "factory.h" #include "eeprom.h" +#include "serial.h" +#include "spi.h" #ifndef ARDUINO_ARCH_AVR # error "Only AVR is supported" @@ -70,13 +72,23 @@ namespace DRIVERS { # endif default: return new Storage(DRIVERS::DUMMY); - } + } } Board* Factory::makeBoard(type _type) { switch (_type) { default: return new Board(DRIVERS::DUMMY); - } + } + } + + Connection* Factory::makeConnection(type _type) { +# ifdef CMD_SERIAL + return new Serial(); +# elif defined(CMD_SPI) + return new Spi(); +# else +# error CMD phy is not defined +# endif } } |