add the new driver to the build factory and Cmake

Former-commit-id: 4d52569525137e3aa029ffa271fea076155c5a66
This commit is contained in:
tostadora 2014-01-18 13:43:39 +01:00
parent fd0a69fb77
commit d38ca7de68
2 changed files with 13 additions and 0 deletions

View File

@ -55,6 +55,7 @@ if(ENABLE_SPIDEV)
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.h
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.h
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.h
${CURRENT_SOURCE_DIR}/LedDeviceP9813.h
)
SET(Leddevice_SOURCES
${Leddevice_SOURCES}
@ -62,6 +63,7 @@ if(ENABLE_SPIDEV)
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.cpp
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.cpp
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.cpp
${CURRENT_SOURCE_DIR}/LedDeviceP9813.cpp
)
endif(ENABLE_SPIDEV)

View File

@ -10,6 +10,7 @@
#include "LedDeviceLpd6803.h"
#include "LedDeviceLpd8806.h"
#include "LedDeviceWs2801.h"
#include "LedDeviceP9813.h"
#endif
#include "LedDeviceAdalight.h"
@ -145,6 +146,16 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
device = deviceWs2812b;
}
else if (type == "p9813")
{
const std::string output = deviceConfig["output"].asString();
const unsigned rate = deviceConfig["rate"].asInt();
LedDeviceP9813* deviceP9813 = new LedDeviceP9813(output, rate);
deviceP9813->open();
device = deviceP9813;
}
else
{
std::cout << "Unable to create device " << type << std::endl;