mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add new WS281x driver
Add a new WS281x driver which is a wrapper around jgarff's ws281x library which works on Pi B+, Pi 2, Pi Zero and probably Pi 3 as well. jgarff's ws281x library is included as a submodule Former-commit-id: e473dfd36d31b14598da5e56e4b8bf9f2aa7bb24
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