mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Leddevices source tree refactoring (#461)
* rework structure of leddevice source tree * fix data type vor v4l sig detection value in webui * automate leddevicefactory.cpp
This commit is contained in:
34
libsrc/leddevice/dev_hid/LedDevicePaintpack.cpp
Normal file
34
libsrc/leddevice/dev_hid/LedDevicePaintpack.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "LedDevicePaintpack.h"
|
||||
|
||||
// Use out report HID device
|
||||
LedDevicePaintpack::LedDevicePaintpack(const QJsonObject &deviceConfig)
|
||||
: ProviderHID()
|
||||
{
|
||||
ProviderHID::init(deviceConfig);
|
||||
_useFeature = false;
|
||||
|
||||
_ledBuffer.resize(_ledRGBCount + 2, uint8_t(0));
|
||||
_ledBuffer[0] = 3;
|
||||
_ledBuffer[1] = 0;
|
||||
}
|
||||
|
||||
LedDevice* LedDevicePaintpack::construct(const QJsonObject &deviceConfig)
|
||||
{
|
||||
return new LedDevicePaintpack(deviceConfig);
|
||||
}
|
||||
|
||||
int LedDevicePaintpack::write(const std::vector<ColorRgb> & ledValues)
|
||||
{
|
||||
auto bufIt = _ledBuffer.begin()+2;
|
||||
for (const ColorRgb & color : ledValues)
|
||||
{
|
||||
*bufIt = color.red;
|
||||
++bufIt;
|
||||
*bufIt = color.green;
|
||||
++bufIt;
|
||||
*bufIt = color.blue;
|
||||
++bufIt;
|
||||
}
|
||||
|
||||
return writeBytes(_ledBuffer.size(), _ledBuffer.data());
|
||||
}
|
Reference in New Issue
Block a user