hyperion.ng/libsrc/leddevice/LedDeviceWs2801.cpp
redPanther b65d811640 add limit for write to leddevice (#432)
* add limit for write to leddevice

* add to default config

* add i18n

* extend xmas effect

* fix indention

* add check for minimum brightness

* adapt effects to fading and new minWriteTime

* remove old latchTime
rename minimumWriteTime to latchTime
make it as dev specific option

* set default for rewriteTime to 1s
pause smoothing on color too

* reenable smoothing for color - it looks nicer :-)

* fix timeout timer
2017-04-09 22:28:32 +02:00

21 lines
533 B
C++

#include "LedDeviceWs2801.h"
LedDeviceWs2801::LedDeviceWs2801(const QJsonObject &deviceConfig)
: ProviderSpi()
{
_deviceReady = ProviderSpi::init(deviceConfig);
}
LedDevice* LedDeviceWs2801::construct(const QJsonObject &deviceConfig)
{
return new LedDeviceWs2801(deviceConfig);
}
int LedDeviceWs2801::write(const std::vector<ColorRgb> &ledValues)
{
const unsigned dataLen = _ledCount * sizeof(ColorRgb);
const uint8_t * dataPtr = reinterpret_cast<const uint8_t *>(ledValues.data());
return writeBytes(dataLen, dataPtr);
}