mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge pull request #533 from markwal/rpi_ws281x
Add new WS281x driver Former-commit-id: 1264edf7f5e0bc29f091e72989ab7116b78056bf
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
#include "LedDeviceWS2812b.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_WS281XPWM
|
||||
#include "LedDeviceWS281x.h"
|
||||
#endif
|
||||
|
||||
LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
{
|
||||
std::cout << "Device configuration: " << deviceConfig << std::endl;
|
||||
@@ -285,6 +289,18 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
LedDeviceWS2812b * ledDeviceWS2812b = new LedDeviceWS2812b();
|
||||
device = ledDeviceWS2812b;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_WS281XPWM
|
||||
else if (type == "ws281x")
|
||||
{
|
||||
const int gpio = deviceConfig.get("gpio", 18).asInt();
|
||||
const int leds = deviceConfig.get("leds", 12).asInt();
|
||||
const uint32_t freq = deviceConfig.get("freq", (Json::UInt)800000ul).asInt();
|
||||
const int dmanum = deviceConfig.get("dmanum", 5).asInt();
|
||||
|
||||
LedDeviceWS281x * ledDeviceWS281x = new LedDeviceWS281x(gpio, leds, freq, dmanum);
|
||||
device = ledDeviceWS281x;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user