Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 4d52569

Browse files
committed
add the new driver to the build factory and Cmake
1 parent df7341a commit 4d52569

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

libsrc/leddevice/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ if(ENABLE_SPIDEV)
5555
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.h
5656
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.h
5757
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.h
58+
${CURRENT_SOURCE_DIR}/LedDeviceP9813.h
5859
)
5960
SET(Leddevice_SOURCES
6061
${Leddevice_SOURCES}
6162
${CURRENT_SOURCE_DIR}/LedSpiDevice.cpp
6263
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.cpp
6364
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.cpp
6465
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.cpp
66+
${CURRENT_SOURCE_DIR}/LedDeviceP9813.cpp
6567
)
6668
endif(ENABLE_SPIDEV)
6769

libsrc/leddevice/LedDeviceFactory.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "LedDeviceLpd6803.h"
1111
#include "LedDeviceLpd8806.h"
1212
#include "LedDeviceWs2801.h"
13+
#include "LedDeviceP9813.h"
1314
#endif
1415

1516
#include "LedDeviceAdalight.h"
@@ -145,6 +146,16 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
145146

146147
device = deviceWs2812b;
147148
}
149+
else if (type == "p9813")
150+
{
151+
const std::string output = deviceConfig["output"].asString();
152+
const unsigned rate = deviceConfig["rate"].asInt();
153+
154+
LedDeviceP9813* deviceP9813 = new LedDeviceP9813(output, rate);
155+
deviceP9813->open();
156+
157+
device = deviceP9813;
158+
}
148159
else
149160
{
150161
std::cout << "Unable to create device " << type << std::endl;

0 commit comments

Comments
 (0)