mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
added configurable latchtime for 2801 SPI driver
Former-commit-id: a10b0bd24a85580b021c735b30ebd2635180a514
This commit is contained in:
parent
5387759287
commit
ca24450618
@ -128,8 +128,9 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
|||||||
{
|
{
|
||||||
const std::string output = deviceConfig["output"].asString();
|
const std::string output = deviceConfig["output"].asString();
|
||||||
const unsigned rate = deviceConfig["rate"].asInt();
|
const unsigned rate = deviceConfig["rate"].asInt();
|
||||||
|
const unsigned latchtime = deviceConfig.get("latchtime",500000).asInt();
|
||||||
|
|
||||||
LedDeviceWs2801* deviceWs2801 = new LedDeviceWs2801(output, rate);
|
LedDeviceWs2801* deviceWs2801 = new LedDeviceWs2801(output, rate, latchtime);
|
||||||
deviceWs2801->open();
|
deviceWs2801->open();
|
||||||
|
|
||||||
device = deviceWs2801;
|
device = deviceWs2801;
|
||||||
|
@ -11,13 +11,20 @@
|
|||||||
// hyperion local includes
|
// hyperion local includes
|
||||||
#include "LedDeviceWs2801.h"
|
#include "LedDeviceWs2801.h"
|
||||||
|
|
||||||
LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned baudrate) :
|
LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned baudrate ) :
|
||||||
LedSpiDevice(outputDevice, baudrate, 500000),
|
LedSpiDevice(outputDevice, baudrate, 500000),
|
||||||
mLedCount(0)
|
mLedCount(0)
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned baudrate, const unsigned latchTime) :
|
||||||
|
LedSpiDevice(outputDevice, baudrate, latchTime),
|
||||||
|
mLedCount(0)
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
int LedDeviceWs2801::write(const std::vector<ColorRgb> &ledValues)
|
int LedDeviceWs2801::write(const std::vector<ColorRgb> &ledValues)
|
||||||
{
|
{
|
||||||
mLedCount = ledValues.size();
|
mLedCount = ledValues.size();
|
||||||
|
@ -21,6 +21,10 @@ public:
|
|||||||
LedDeviceWs2801(const std::string& outputDevice,
|
LedDeviceWs2801(const std::string& outputDevice,
|
||||||
const unsigned baudrate);
|
const unsigned baudrate);
|
||||||
|
|
||||||
|
LedDeviceWs2801(const std::string& outputDevice,
|
||||||
|
const unsigned baudrate,
|
||||||
|
const unsigned latchTime);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Writes the led color values to the led-device
|
/// Writes the led color values to the led-device
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user