hyperion.ng/libsrc/leddevice/LedDeviceRawHID.cpp
redPanther 96e8c29582 refresh time for all devices + schema fixes (#305)
* refresh for all :-)
remove dups

* - integrate refresh leds for all devices
- fix schemas for led devices

* add minimum for rewrite time

* rewriteTime: add missing info in config examples
2016-12-02 12:07:24 +01:00

28 lines
656 B
C++

#include "LedDeviceRawHID.h"
// Use feature report HID device
LedDeviceRawHID::LedDeviceRawHID(const QJsonObject &deviceConfig)
: ProviderHID()
{
ProviderHID::init(deviceConfig);
_useFeature = true;
_ledBuffer.resize(_ledRGBCount);
}
LedDevice* LedDeviceRawHID::construct(const QJsonObject &deviceConfig)
{
return new LedDeviceRawHID(deviceConfig);
}
int LedDeviceRawHID::write(const std::vector<ColorRgb> & ledValues)
{
// write data
memcpy(_ledBuffer.data(), ledValues.data(), _ledRGBCount);
return writeBytes(_ledBuffer.size(), _ledBuffer.data());
}
void LedDeviceRawHID::rewriteLeds()
{
writeBytes(_ledBuffer.size(), _ledBuffer.data());
}